prozac-qfcc/status.qc

836 lines
22 KiB
C++
Raw Normal View History

2001-07-17 05:58:10 +00:00
/*======================================================
STATUS.QC TeamFortress v2.5
(c) TeamFortress Software Pty Ltd 13/5/97
(c) Craig Hauser 26/3/00
========================================================
TF status bar functions
=======================================================*/
#include "defs.qh"
2001-07-17 05:58:10 +00:00
float(float tno) TeamFortress_TeamGetScore;
////////////////////////////////////////////////////
// NumberToStringxxx functions
// take an integer, return a constant string.
#ifdef STATUSBAR
void(entity pl, string s1) CenterPrint;
void(entity pl, string s1, string s2) CenterPrint2;
void(entity pl, string s1, string s2, string s3) CenterPrint3;
void(entity pl, string s1, string s2, string s3, string s4) CenterPrint4;
void(entity pl, string s1, string s2, string s3, string s4, string s5) CenterPrint5;
void(entity pl, string s1, string s2, string s3, string s4, string s5, string s6) CenterPrint6;
void(entity pl, string s1, string s2, string s3, string s4, string s5, string s6, string s7) CenterPrint7;
void(entity pl, float fTime, string s1) StatusPrint;
string(entity pl) GetStatusSize;
string(entity pl) ClipSizeToString100;
string(float num) NumberToString10;
string(entity te) SentryDetailsToString;
string(entity te) TeslaDetailsToString;
//used for print
string(float tno) GetTrueTeamName;
string(float pc) TeamFortress_GetClassName;
string(float pc) TeamFortress_GetJobName;
void(entity demon) custom_demon_name;
//- OfN -
float(entity thing) IsMonster;
float(entity player) HasMonster;
/////////////////////////////////////////////////////////////////
// CenterPrint replacement. Takes into account the status bar //
/////////////////////////////////////////////////////////////////
void(entity pl, string s1) CenterPrint =
{
centerprint(pl, s1);
pl.StatusRefreshTime = time + 1;
};
void(entity pl, string s1, string s2) CenterPrint2 =
{
centerprint(pl, s1, s2);
pl.StatusRefreshTime = time + 1;
};
void(entity pl, string s1, string s2, string s3) CenterPrint3 =
{
centerprint(pl, s1, s2, s3);
pl.StatusRefreshTime = time + 1;
};
void(entity pl, string s1, string s2, string s3, string s4) CenterPrint4 =
{
centerprint(pl, s1, s2, s3, s4);
pl.StatusRefreshTime = time + 1;
};
void(entity pl, string s1, string s2, string s3, string s4, string s5) CenterPrint5 =
{
centerprint(pl, s1, s2, s3, s4, s5);
pl.StatusRefreshTime = time + 1;
};
void(entity pl, string s1, string s2, string s3, string s4, string s5, string s6) CenterPrint6 =
{
centerprint(pl, s1, s2, s3, s4, s5, s6);
pl.StatusRefreshTime = time + 1;
};
void(entity pl, string s1, string s2, string s3, string s4, string s5, string s6, string s7) CenterPrint7 =
{
centerprint(pl, s1, s2, s3, s4, s5, s6, s7);
pl.StatusRefreshTime = time + 1;
};
//////////////////////////////////////////////////////////////////
// StatusPrint - like centerprint, but works with the status bar
void(entity pl, float fTime, string s1) StatusPrint =
{
centerprint(pl, s1);
pl.StatusRefreshTime = time + fTime;
};
void(entity pl) RefreshStatusBar =
{
local string s1, s2, s3, s4;
local string s5, s6, s7;
local float num;
if (pl.StatusBarSize == 0)
{
pl.StatusRefreshTime = time + 60;
return;
}
pl.StatusRefreshTime = time + 1.0;
if (pl.playerclass == PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
return;
s1 = GetStatusSize(pl);
num = ceil(team1score);
if (num >= 1000)
{
s2 = s3 = s4 = "9";
}
else
{
//CH The below functions take a number and print out each character
if (num >= 100)
s2 = NumberToString10(floor(num/100));
else
s2 = " ";
if (num >= 10)
s3 = NumberToString10(floor((num - (floor(num/100)*100))/10));
else
s3 = " ";
if (num > 0)
s4 = NumberToString10(floor((num - (floor(num/10)*10))));
else
s4 = "0";
}
//s2 = "<22><><EFBFBD><EFBFBD>: ";
//s3 = (ftos(ceil(team1score)));
//s4 = " <20><><EFBFBD>: "
//s5 = (ftos(ceil(team2score)));
s5 = " :<3A><><EFBFBD><EFBFBD> <20><><EFBFBD>: ";
s6 = (ftos(ceil(team2score)));
s7 = ClipSizeToString100(pl);
centerprint(pl, s1, s2, s3, s4, s5, s6,s7);
//CH determines which screen to show next (its at the end of all RefreshStatusBars)
if (self.has_sentry)
self.StatusBarScreen = 1;
else if (self.has_tesla)
self.StatusBarScreen = 4;
else if (self.scaned != self)
self.StatusBarScreen = 5;
else if (self.is_undercover != 0)
self.StatusBarScreen = 2; // (self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT)
else if (self.is_detpacking || HasMonster(self) || (self.is_haxxxoring && self.job & JOB_HACKER))
2001-07-17 05:58:10 +00:00
self.StatusBarScreen = 3;
else
self.StatusBarScreen = 0;
};
//sentry bar :)
void(entity pl) RefreshStatusBar1 =
{
local string s1, s2, s3, s4;
local string s5, s6, s7;
local string val;
local float num;
local entity sent;
if (pl.StatusBarSize == 0)
{
pl.StatusRefreshTime = time + 60;
return;
}
pl.StatusRefreshTime = time + 1.0;
if (pl.playerclass == PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
return;
s1 = GetStatusSize(pl);
do
sent = find(world, classname, "building_sentrygun");
while (sent != world && sent.real_owner != self);
if (sent)
2001-07-17 05:58:10 +00:00
{
s2 = SentryDetailsToString(sent);
s3 = ftos(floor((sent.health / sent.max_health) * 100));
s4 = "% health ";
if (sent.enemy != world)
{
s5 = "Attacking: ";
s6 = sent.enemy.netname;
}
else
{
s5 = "Idle";
s6 = " ";
}
if (self.is_building)
{
s7 = "\n building... \n";
}
else
{
s7 = ClipSizeToString100(pl);
}
centerprint(pl, s1, s2, s3, s4, s5, s6,s7);
}
2001-07-17 05:58:10 +00:00
//CH determines which screen to show next (its at the end of all RefreshStatusBars)
if (self.has_tesla)
self.StatusBarScreen = 4;
else if (self.scaned != self)
self.StatusBarScreen = 5;
else if (self.is_undercover != 0)
self.StatusBarScreen = 2; //(self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT)
else if (self.is_detpacking || HasMonster(self) || (self.is_haxxxoring && self.job & JOB_HACKER))
2001-07-17 05:58:10 +00:00
self.StatusBarScreen = 3;
else
self.StatusBarScreen = 0;
};
//Tesla bar :)
void(entity pl) RefreshStatusBar4 =
{
local string s1, s2, s3, s4;
local string s5, s6, s7;
local string val;
local float num;
local entity sent;
if (pl.StatusBarSize == 0)
{
pl.StatusRefreshTime = time + 60;
return;
}
pl.StatusRefreshTime = time + 1.0;
if (pl.playerclass == PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
return;
s1 = GetStatusSize(pl);
do
sent = find(world, classname, "building_tesla");
while (sent != world && sent.real_owner != self);
if (sent)
2001-07-17 05:58:10 +00:00
{
//- OfN - if (sent.enemy.classname == "monster_demon1" || sent.enemy.classname == "monster_army" || sent.enemy.classname == "monster_shambler" )
if (IsMonster(sent.enemy))
custom_demon_name(sent.enemy); //CH
s2 = TeslaDetailsToString(sent);
s3 = ftos(floor((sent.health / sent.max_health) * 100));
s4 = "% health ";
if (sent.oldenemy != world)
{
s5 = "Attacking: ";
s6 = sent.enemy.netname;
}
else
{
s5 = "Idle";
s6 = " ";
}
if (self.is_building)
{
s7 = "\n building... \n";
}
else
{
s7 = ClipSizeToString100(pl);
}
centerprint(pl, s1, s2, s3, s4, s5, s6,s7);
}
2001-07-17 05:58:10 +00:00
//CH determines which screen to show next (its at the end of all RefreshStatusBars)
if (self.scaned != self)
self.StatusBarScreen = 5;
else if (self.is_undercover != 0)
self.StatusBarScreen = 2; //(self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT)
else if (self.is_detpacking || HasMonster(self) || (self.is_haxxxoring && self.job & JOB_HACKER))
2001-07-17 05:58:10 +00:00
self.StatusBarScreen = 3;
else
self.StatusBarScreen = 0;
};
//Scanner Screen
void(entity pl) RefreshStatusBar5 =
{
local string s1, s2, s3, s4;
local string s5, s6, s7;
local entity tg;
local float num;
if (pl.StatusBarSize == 0)
{
pl.StatusRefreshTime = time + 60;
return;
}
pl.StatusRefreshTime = time + 1.0;
if (pl.playerclass == PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
return;
s1 = GetStatusSize(pl);
s6 = ftos(ceil(vlen(self.scaned.origin - self.origin)));
s7 = ClipSizeToString100(pl);
if (self.scaned.classname == "player" && self.scaned.playerclass != PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
{
s2 = GetTrueTeamName(self.scaned.team_no);
s3 = ": ";
if (self.enemy.playerclass != PC_CUSTOM)
2001-07-17 05:58:10 +00:00
s4 = TeamFortress_GetClassName(self.scaned.playerclass);
else
s4 = TeamFortress_GetJobName(self.scaned.job);
s5 = "\nRange: ";
centerprint(pl, s1, s2, s3, s4, s5, s6,s7);
}
else if ((self.scaned.classname == "building_sentrygun" || self.scaned.classname == "building_tesla" || self.scaned.classname == "building_teleporter" || self.scaned.classname == "monster_demon1") && self.scaned.health > 0)
{
//- OfN - if (self.scaned.classname == "monster_demon1" || self.scaned.classname == "monster_army" || self.scaned.classname == "monster_shambler")
if (IsMonster(self.scaned))
{
custom_demon_name(self.scaned); //CH
s2 = GetTrueTeamName(self.scaned.real_owner.team_no); //demons are special
}
else
s2 = GetTrueTeamName(self.scaned.team_no);
if (self.scaned.classname == "building_sentrygun")
s3 = ": Sentry Gun (";
else if (self.scaned.classname == "building_tesla")
s3 = ": Tesla Sentry (";
else if (self.scaned.classname == "building_teleporter")
s3 = ": Teleporter Pad (";
else if (self.scaned.classname == "monster_demon1")
s3 = ": Demon (";
else if (self.scaned.classname == "monster_army")
s3 = ": Soldier (";
else if (self.scaned.classname == "monster_shambler")
s3 = ": Shambler (";
else if (self.scaned.classname == "monster_wizard")
s3 = ": Scrag (";
else
s3 = "!!!ERROR!!!";
s4 = self.scaned.real_owner.netname;
s5 = ")\nRange: ";
centerprint(pl, s1, s2, s3, s4, s5, s6, s7);
}
else if (self.scaned.classname == "item_tfgoal")
{
s2 = GetTrueTeamName(self.scaned.owned_by);
s3 = ": Item(";
s4 = self.scaned.netname;
s5 = ")\nRange: ";
centerprint(pl, s1, s2, s3, s4, s5, s6, s7);
}
else
pl.StatusRefreshTime = time + 0.1;
self.scaned = self; //Reset it.
//CH determines which screen to show next (its at the end of all RefreshStatusBars)
if (self.is_undercover != 0)
self.StatusBarScreen = 2; //(self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT)
else if (self.is_detpacking || HasMonster(self) || (self.is_haxxxoring && self.job & JOB_HACKER))
2001-07-17 05:58:10 +00:00
self.StatusBarScreen = 3;
else
self.StatusBarScreen = 0;
};
//Spy Screen
void(entity pl) RefreshStatusBar2 =
{
local string s1, s2, s3, s4;
local string s5, s6, s7;
if (pl.StatusBarSize == 0)
{
pl.StatusRefreshTime = time + 60;
return;
}
pl.StatusRefreshTime = time + 1.0;
if (pl.playerclass == PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
return;
s1 = GetStatusSize(pl);
if (self.is_undercover == 2)
s2 = "Disguising: ";
else if (self.is_undercover == 1)
s2 = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else
s2 = "Uncovered ";
if (invis_only)
{
s3 = " Inviso ";
s4 = "\n";
}
else
{
if (self.undercover_team >= 1 && self.undercover_team <= 4)
s3 = GetTrueTeamName(self.undercover_team);
else
s3 = " ";
if (self.undercover_skin == 1)
s4 = " Scout ";
else if (self.undercover_skin == 2)
s4 = " Sniper ";
else if (self.undercover_skin == 3)
s4 = " Soldier ";
else if (self.undercover_skin == 4)
s4 = " Demoman ";
else if (self.undercover_skin == 5)
s4 = " Medic ";
else if (self.undercover_skin == 6)
s4 = " Hvy Wpns";
else if (self.undercover_skin == 7)
s4 = " Pyro ";
else if (self.undercover_skin == 8)
s4 = " Spy ";
else if (self.undercover_skin == 9)
s4 = " Engineer";
else
s4 = " ";
}
s5 = ClipSizeToString100(pl);
centerprint(pl, s1, s2, s3, s4, s5);
//CH determines which screen to show next (its at the end of all RefreshStatusBars)
//(self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT)||(self.job & JOB_ARMY && self.job & JOB_DEMON_OUT)
if (self.is_detpacking || HasMonster(self) || (self.is_haxxxoring && self.job & JOB_HACKER))
2001-07-17 05:58:10 +00:00
self.StatusBarScreen = 3;
else
self.StatusBarScreen = 0;
};
//Misc Screen
void(entity pl) RefreshStatusBar3 =
{
local string s1, s2, s3, s4;
local string s5, s6, s7;
local entity tg;
local float num;
if (pl.StatusBarSize == 0)
{
pl.StatusRefreshTime = time + 60;
return;
}
pl.StatusRefreshTime = time + 1.0;
if (pl.playerclass == PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
return;
s4 = "";
s5 = "";
s1 = GetStatusSize(pl);
//(self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT)||(self.job & JOB_ARMY && self.job & JOB_DEMON_OUT)
if (self.is_haxxxoring && self.job & JOB_HACKER)
2001-07-17 05:58:10 +00:00
{
if (self.demon_two.has_camera == -2) // we r aborting hack...
{
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Aborting...";
s3 = "";
s4 = "";
}
else
{
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
s3 = ftos(100 - floor((self.demon_two.heat/self.demon_two.ltime) * 100));
s4 = "% completed";
}
}
else if (HasMonster(pl))
{
num = self.demon_one.health; //- OfN -
if (self.demon_one.classname == "monster_army")
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else if (self.demon_one.classname == "monster_shambler")
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else if (self.demon_one.classname == "monster_wizard")
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else if (self.demon_one.classname == "monster_demon1")
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else if (self.demon_one.classname == "monster_knight")
s2 = "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else if (self.demon_one.classname == "monster_hknight")
s2 = "\nHell Knight: ";
s3 = ftos(floor((self.demon_one.health / self.demon_one.max_health) * 100));
s4 = "% health";
}
else
{
s2 = "";
s3 = "";
}
if (self.is_detpacking)
{
//s4 = "\n\n "; //- OfN \n\n
s5 = "\n Setting Detpack... ";
}
//else
s6 = ClipSizeToString100(pl);
centerprint(pl, s1, s2, s3, s4, s5, s6);
//CH determines which screen to show next (its at the end of all RefreshStatusBars)
self.StatusBarScreen = 0;
};
//////////////////////////////////////////////////////////////////
// Status Bar Resolution Settings
// Thanks goes to Dave 'Zoid' Kirsch (zoid@threewave.com) from CTF
// for the res settings.
string(entity pl) GetStatusSize =
{
if (pl.StatusBarSize == 1)
{
if (pl.StatusBarRes > 7) // 768
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 7) // 600
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 6) // 480
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 5) // 400
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 4) // 384
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 3) // 350
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 2) // 300
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 1) // 240
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
// 200
return "\n\n\n\n\n\n\n\n\n\n";
}
else // if (pl.StatusBarSize == 2)
{
if (pl.StatusBarRes > 7) // 768
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 7) // 600
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 6) // 480
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 5) // 400
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 4) // 384
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 3) // 350
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 2) // 300
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
else if (pl.StatusBarRes == 1) // 240
return "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
// 200
return "\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
};
void(float res) StatusRes =
{
self.StatusBarRes = res;
if (res > 7) // 768
sprint(self, PRINT_HIGH, "Status Bar Res set to 1024x768.\n");
2001-07-17 05:58:10 +00:00
else if (res == 7) // 600
sprint(self, PRINT_HIGH, "Status Bar Res set to 800x600.\n");
2001-07-17 05:58:10 +00:00
else if (res == 6) // 480
sprint(self, PRINT_HIGH, "Status Bar Res set to 640x480.\n");
2001-07-17 05:58:10 +00:00
else if (res == 5) // 400
sprint(self, PRINT_HIGH, "Status Bar Res set to 640x400.\n");
2001-07-17 05:58:10 +00:00
else if (res == 4) // 384
sprint(self, PRINT_HIGH, "Status Bar Res set to 512x384.\n");
2001-07-17 05:58:10 +00:00
else if (res == 3) // 350
sprint(self, PRINT_HIGH, "Status Bar Res set to 320x350.\n");
2001-07-17 05:58:10 +00:00
else if (res == 2) // 300
sprint(self, PRINT_HIGH, "Status Bar Res set to 400x300.\n");
2001-07-17 05:58:10 +00:00
else if (res == 1) // 240
sprint(self, PRINT_HIGH, "Status Bar Res set to 320x240.\n");
2001-07-17 05:58:10 +00:00
else
sprint(self, PRINT_HIGH, "Status Bar Res set to 320x200.\n");
2001-07-17 05:58:10 +00:00
};
string(entity pl) ClipSizeToString100 =
//CH edited b/c nothing has over 20
{
local float num;
if (pl.current_weapon == WEAP_SHOTGUN)
2001-07-17 05:58:10 +00:00
{
if (RE_SHOTGUN - pl.reload_shotgun > pl.ammo_shells)
pl.reload_shotgun = RE_SHOTGUN - pl.ammo_shells;
num = RE_SHOTGUN - pl.reload_shotgun;
2001-07-17 05:58:10 +00:00
}
else if (pl.current_weapon == WEAP_SUPER_SHOTGUN)
2001-07-17 05:58:10 +00:00
{
if (RE_SUPER_SHOTGUN - pl.reload_super_shotgun > pl.ammo_shells)
pl.reload_super_shotgun = RE_SUPER_SHOTGUN - pl.ammo_shells;
num = RE_SUPER_SHOTGUN - pl.reload_super_shotgun;
2001-07-17 05:58:10 +00:00
}
else if (pl.current_weapon == WEAP_GRENADE_LAUNCHER)
2001-07-17 05:58:10 +00:00
{
if (RE_GRENADE_LAUNCHER - pl.reload_grenade_launcher > pl.ammo_rockets)
pl.reload_grenade_launcher = RE_GRENADE_LAUNCHER - pl.ammo_rockets;
num = RE_GRENADE_LAUNCHER - pl.reload_grenade_launcher;
2001-07-17 05:58:10 +00:00
}
else if (pl.current_weapon == WEAP_ROCKET_LAUNCHER)
2001-07-17 05:58:10 +00:00
{
if (RE_ROCKET_LAUNCHER - pl.reload_rocket_launcher > pl.ammo_rockets)
pl.reload_rocket_launcher = RE_ROCKET_LAUNCHER - pl.ammo_rockets;
num = RE_ROCKET_LAUNCHER - pl.reload_rocket_launcher;
2001-07-17 05:58:10 +00:00
}
else if (pl.current_weapon == WEAP_LIGHT_ASSAULT)
2001-07-17 05:58:10 +00:00
{
if (RE_LIGHT_ASSAULT - pl.reload_light_assault > pl.ammo_nails)
pl.reload_light_assault = RE_LIGHT_ASSAULT - pl.ammo_nails;
num = RE_LIGHT_ASSAULT - pl.reload_light_assault;
2001-07-17 05:58:10 +00:00
}
else if (pl.current_weapon == WEAP_LASERCANNON)
2001-07-17 05:58:10 +00:00
{
if (RE_LASER_CANNON - pl.reload_laser_cannon > pl.ammo_cells)
pl.reload_laser_cannon = RE_LASER_CANNON - pl.ammo_cells;
num = RE_LASER_CANNON - pl.reload_laser_cannon;
2001-07-17 05:58:10 +00:00
}
else
{
return "\n ";
}
if (num < 10)
{
if (num < 5)
{
if (num == 0)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 0";
else if (num == 1)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1";
else if (num == 2)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 2";
else if (num == 3)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 3";
else
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 4";
}
else
{
if (num == 5)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 5";
else if (num == 6)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 6";
else if (num == 7)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 7";
else if (num == 8)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 8";
else if (num == 9)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 9";
}
}
else if (num < 20)
{
if (num < 15)
{
if (num == 10)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:10";
else if (num == 11)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:11";
else if (num == 12)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:12";
else if (num == 13)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:13";
else
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:14";
}
else
{
if (num == 15)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:15";
else if (num == 16)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:16";
else if (num == 17)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:17";
else if (num == 18)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:18";
else if (num == 19)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:19";
}
}
else if (num < 30)
{
if (num < 25)
{
if (num == 20)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:20";
else if (num == 21)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:21";
else if (num == 22)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:22";
else if (num == 23)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:23";
else if (num == 24)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:24";
}
else
{
if (num == 25)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:25";
if (num == 26)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:26";
if (num == 27)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:27";
if (num == 28)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:28";
if (num == 29)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:29";
}
}
else if (num < 40)
{
if (num < 35)
{
if (num == 30)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:30";
else if (num == 31)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:31";
else if (num == 32)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:32";
else if (num == 33)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:33";
else if (num == 34)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:34";
}
else
{
if (num == 35)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:35";
if (num == 36)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:36";
if (num == 37)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:37";
if (num == 38)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:38";
if (num == 39)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:39";
}
}
else if (num >= 40)
return "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:40";
return ftos (num);
2001-07-17 05:58:10 +00:00
};
//==========
string(entity te) SentryDetailsToString =
{
if (te.ammo_shells == 0)
{
if (te.ammo_rockets == 0 && te.weapon == 3)
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: no ammo \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
else
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: no shells \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
}
else if (te.ammo_rockets == 0 && te.weapon == 3)
{
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: no rockets\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
}
else
{
return " \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
}
return " \n"; // should never happen
};
//==========
string(entity te) TeslaDetailsToString =
{
if (te.ammo_cells == 0)
{
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: No cells\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
}
else if (te.ammo_cells <= 30)
{
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Low on cells\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
}
else
{
return " \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ";
}
return " \n"; // should never happen
};
string(float num) NumberToString10 =
{
if (num == 0)
return "0";
else if (num == 1)
return "1";
else if (num == 2)
return "2";
else if (num == 3)
return "3";
else if (num == 4)
return "4";
else if (num == 5)
return "5";
else if (num == 6)
return "6";
else if (num == 7)
return "7";
else if (num == 8)
return "8";
else if (num == 9)
return "9";
else
return "A"; //CH just in case
};
#endif