25 template <
typename T >
28 return (a < b) ? a :
b;
31 template <
typename T >
34 return (a > b) ? a :
b;
39 unsigned int thismode =
getMode();
40 static bool only_scanner_modes_static =
43 && thismode !=
WEBCAM && only_scanner_modes_static)
45 return ( posmodes&(posmodes-1) ) != 0;
50 {
"Target",
"Nav",
"Objectives",
"Comm",
"Weapon",
"Damage",
"Shield",
"Manifest",
"TargetManifest",
"View",
"Message"};
54 nam = nam.substr( 0, nam.find(
"." ) );
56 nam[0] = toupper( nam[0] );
64 string hr = ( (
Planet*) target )->getHumanReadablePlanetType();
71 static bool confignums =
74 if (fg->
name !=
"Base" && fg->
name !=
"Asteroid" && fg->
name !=
"Nebula") {
75 static bool printfgname =
77 static bool printshiptype =
81 +(printshiptype ? ( ( confignums && (
"" != fgnstring) ) ?
" =" :
" : " ) :
"");
82 if ( confignums && (
"" != fgnstring) )
83 fgname += fgnstring+
"= ";
87 }
else if (fg->
name ==
"Base") {
88 static bool namecolonname =
92 if ( confignums && (
"" != fgnstring) ) retval +=
" : "+fgnstring;
98 +( ( confignums && (
"" != fgnstring) ) ? (
": "+fgnstring) :
"" ) );
117 #define strcasecmp stricmp
120 char *t = strdup( s );
122 for (i = 0; t[i] !=
'\0'; i++)
123 if ( isspace( t[i] ) ) {
130 for (
unsigned int j = 0;
j < ( (
sizeof (
vdu_modes)/
sizeof (std::string) ) );
j++)
131 if ( 0 == strcasecmp( t,
vdu_modes[
j].c_str() ) )
139 char *mystr = strdup( x );
150 if (x <= 9 && x >= 0)
151 return (
char) (x+
'0');
153 return (
char) (x-10+
'A');
158 float aweight = 1-bweight;
160 a.
g*aweight+b.
g*bweight,
161 a.
b*aweight+b.
b*bweight,
162 a.
a*aweight+b.
a*bweight );
172 unsigned char r = (
unsigned char) (col.
r*255);
173 unsigned char g = (
unsigned char) (col.
g*255);
174 unsigned char b = (
unsigned char) (col.
b*255);
195 thismode.push_back(
MSG );
203 got_target_info =
false;
205 got_target_info =
true;
214 static bool init =
false;
215 static float damaged[4] = {1, 0, 0, 1};
216 static float half_damaged[4] = {1, 1, 0, 1};
217 static float full[4] = {1, 1, 1, 1};
225 return GFXColor( full[0], full[1], full[2], full[3] );
226 float avghalf = armor >= .3 ? 1 : 0;
227 if (gradient && armor >= .3)
228 avghalf = (armor-.3)/.6;
229 float avgdamaged = 1-avghalf;
230 return GFXColor( half_damaged[0]*avghalf+damaged[0]*avgdamaged,
231 half_damaged[1]*avghalf+damaged[1]*avgdamaged,
232 half_damaged[2]*avghalf+damaged[2]*avgdamaged,
233 half_damaged[3]*avghalf+damaged[3]*avgdamaged );
251 static bool HighQTargetVSSprites =
268 if (HighQTargetVSSprites) {
277 s->
SetSize( w, invertsprite ? -h : h );
279 if (drawsprite && spritetex) {
280 static const float middle_point =
283 float middle_point_small = 1-middle_point;
284 Vector ll, lr, ur, ul, mll, mlr, mur, mul;
288 mll = middle_point*ll+middle_point_small*ur;
289 mlr = middle_point*lr+middle_point_small*ul;
290 mur = middle_point*ur+middle_point_small*ll;
291 mul = middle_point*ul+middle_point_small*lr;
359 if (HighQTargetVSSprites)
366 void VDU::DrawTargetSpr(
VSSprite *s,
float per,
float &sx,
float &sy,
float &w,
float &h )
368 DrawHUDSprite(
this, s, per, sx, sy, w, h, 1, 1, 1, 1, 1,
true,
false );
376 #define MangleString( a, b ) (a)
425 {innershield, middleshield, outershield},
426 {innershield, middleshield, outershield},
427 {innershield, middleshield, outershield},
428 {innershield, middleshield, outershield}
432 static float shthresh[3] = {
434 "shield_vdu_thresh0",
435 do_shield_fade ?
"0" :
".25" ) ),
437 "shield_vdu_thresh1",
438 do_shield_fade ?
".33" :
".50" ) ),
440 "shield_vdu_thresh2",
441 do_shield_fade ?
".66" :
".75" ) )
443 float shtrans[3] = {1.0f, 1.0f, 1.0f};
444 if (do_shield_fade) {
445 shcolor[0][0].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (fs-shthresh[0])/(shthresh[1]-shthresh[0])*shtrans[0] ) );
446 shcolor[0][1].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (fs-shthresh[1])/(shthresh[2]-shthresh[1])*shtrans[1] ) );
447 shcolor[0][2].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (fs-shthresh[2])/(1.0
f-shthresh[2])*shtrans[2] ) );
448 shcolor[1][0].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (rs-shthresh[0])/(shthresh[1]-shthresh[0])*shtrans[0] ) );
449 shcolor[1][1].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (rs-shthresh[1])/(shthresh[2]-shthresh[1])*shtrans[1] ) );
450 shcolor[1][2].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (rs-shthresh[2])/(1.0
f-shthresh[2])*shtrans[2] ) );
451 shcolor[2][0].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (ls-shthresh[0])/(shthresh[1]-shthresh[0])*shtrans[0] ) );
452 shcolor[2][1].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (ls-shthresh[1])/(shthresh[2]-shthresh[1])*shtrans[1] ) );
453 shcolor[2][2].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (ls-shthresh[2])/(1.0
f-shthresh[2])*shtrans[2] ) );
454 shcolor[3][0].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (bs-shthresh[0])/(shthresh[1]-shthresh[0])*shtrans[0] ) );
455 shcolor[3][1].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (bs-shthresh[1])/(shthresh[2]-shthresh[1])*shtrans[1] ) );
456 shcolor[3][2].
a *=
mymax( 0.0
f,
mymin( 1.0
f, (bs-shthresh[2])/(1.0
f-shthresh[2])*shtrans[2] ) );
458 if (fs > shthresh[0]) {
467 if (fs > shthresh[1]) {
476 if (fs > shthresh[2]) {
485 if (rs > shthresh[0]) {
494 if (rs > shthresh[1]) {
503 if (rs > shthresh[2]) {
512 if (ls > shthresh[0]) {
521 if (ls > shthresh[1]) {
530 if (ls > shthresh[2]) {
539 if (bs > shthresh[0]) {
548 if (bs > shthresh[1]) {
557 if (bs > shthresh[2]) {
655 void VDU::DrawVDUShield(
Unit *parent )
674 static bool invert_friendly_sprite =
681 #define RETURN_STATIC_SPRITE( name ) \
683 static VSSprite s( name ".sprite" ); \
684 static VSSprite sCompat( name ".spr" ); \
685 if ( s.LoadSuccess() ) \
726 if (tmp < 0)
return 0;
742 sprintf( qr.
str,
"%.2lf", distance/game_speed );
744 if (distance < 20000)
745 sprintf( qr.
str,
"%.0lf meters", distance );
746 else if (distance < 100000)
747 sprintf( qr.
str,
"%.2lf kilometers", distance/1000 );
748 else if (distance < 299792458)
749 sprintf( qr.
str,
"%.0lf kilometers", distance/1000 );
750 else if ( distance < (120*299792458.) )
751 sprintf( qr.
str,
"%.2lf light seconds", distance/299792458 );
752 else if ( distance < (120*60*299792458.) )
753 sprintf( qr.
str,
"%.2lf light minutes", distance/(60*299792458.) );
754 else if ( distance < (48*3600*299792458.) )
755 sprintf( qr.
str,
"%.2lf light hours", distance/(3600*299792458.) );
756 else if ( distance < (365*24*3600*299792458.) )
757 sprintf( qr.
str,
"%.2lf light days", distance/(24*3600*299792458.) );
759 sprintf( qr.
str,
"%.2lf lightyears", distance/(365*24*3600*299792458.) );
766 int aa = a != 0 ? 1 : 0;
767 int bb = b != 0 ? 1 : 0;
768 int cc = c != 0 ? 1 : 0;
769 int dd = d != 0 ? 1 : 0;
770 if (aa+bb+cc+dd == 4)
772 if (aa+bb+cc+dd == 3)
774 if (aa+bb+cc+dd == 2)
781 int aa = a != 0 ? 1 : 0;
782 int bb = b != 0 ? 1 : 0;
783 int cc = c != 0 ? 1 : 0;
784 int dd = d != 0 ? 1 : 0;
785 if (aa+bb+cc+dd == 4)
787 if (aa+bb+cc+dd == 3)
789 if (aa+bb+cc+dd == 2)
791 if (aa+bb+cc+dd == 1)
804 static bool invert_target_sprite =
806 static bool invert_target_shields =
810 float au, ar, al, ad;
811 au =
OneOfFour( armor[0], armor[2], armor[4], armor[6] );
812 ar =
TwoOfFour( armor[0], armor[1], armor[4], armor[5] );
813 al =
TwoOfFour( armor[2], armor[3], armor[6], armor[7] );
814 ad =
OneOfFour( armor[1], armor[3], armor[5], armor[7] );
815 if (invert_target_shields) {
825 : ( target->getFullname().find(
828 target->GetHullPercent(),
829 true, invert_target_sprite );
835 static bool out_of_cone_information =
838 target ),
false,
false );
848 unitandfg += std::string(
"\n" );
850 static float background_alpha =
853 bool automatte = (0 == tpbg.a);
854 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
859 bool draw_auto_message = (delautotime < auto_message_lim && cp->
autoMessage.length() != 0);
862 memset( st,
'\n', 1023 );
864 if (draw_auto_message ==
true)
867 std::string newst( st );
868 if (draw_auto_message)
872 double actual_range = dist;
876 newst += string(
"Docking: Ready" );
877 else if ( dist < target->rSize() )
881 static float background_alpha =
884 bool automatte = (0 == tpbg.a);
885 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
888 static float ishieldcolor[4] = {.4, .4, 1, 1};
889 static float mshieldcolor[4] = {.4, .4, 1, 1};
890 static float oshieldcolor[4] = {.4, .4, 1, 1};
892 static bool builtin_shields =
894 if (builtin_shields) {
895 DrawShield( fs, rs, ls, bs, x, y, w, h, invert_target_shields,
896 GFXColor( ishieldcolor[0], ishieldcolor[1], ishieldcolor[2], ishieldcolor[3] ),
897 GFXColor( mshieldcolor[0], mshieldcolor[1], mshieldcolor[2], mshieldcolor[3] ),
898 GFXColor( oshieldcolor[0], oshieldcolor[1], oshieldcolor[2], oshieldcolor[3] ) );
910 static float background_alpha =
913 bool automatte = (0 == tpbg.a);
914 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
915 if (draw_auto_message)
917 != NULL ? .4 : 0 ), 0,
true,
false, automatte );
930 if (
Network != NULL && network_draw_messages ==
false)
932 if (
Network == NULL && draw_messages ==
false)
942 int rows_used = rows_needed;
943 vector< std::string >whoNOT;
944 whoNOT.push_back(
"briefing" );
945 whoNOT.push_back(
"news" );
946 whoNOT.push_back(
"bar" );
952 vector< std::string >message_people;
954 int row_lim = ( (scrolloffset< 0 || num_messages >rows) ? rows : num_messages );
957 rows_used < row_lim && mc->
last( i, lastmsg, message_people, whoNOT );
960 double sendtime = lastmsg.
time;
963 if ( sendtime <= nowtime && (sendtime > nowtime-oldtime ||
scrolloffset < 0) ) {
966 sprintf( timebuf,
"%s", stardate.c_str() );
968 int sendtime_mins = (
int) (sendtime/60.0);
969 int sendtime_secs = (
int) (sendtime-sendtime_mins*60);
970 sprintf( timebuf,
"%d.%02d", sendtime_mins, sendtime_secs );
974 if (lastmsg.
from !=
"game")
975 mymsg = lastmsg.
from +
" (" + timebuf +
"): " + lastmsg.
message;
977 mymsg = string( timebuf )+
": "+lastmsg.
message;
978 int msglen = mymsg.size();
979 int rows_needed = (
int) ( msglen/(1.6*cols) );
980 fullstr = mymsg+
"\n"+fullstr;
983 rows_used += rows_needed+1;
987 static std::string newline(
"\n" );
990 textMessage =
"Chat> "+textMessage;
991 if (floor( nowtime/2 ) != floor( nowtime )/2.0)
1006 fullstr += textMessage;
1009 static string message_prefix =
1011 fullstr = targetstr+fullstr;
1012 static float background_alpha =
1015 bool automatte = (0 == tpbg.a);
1016 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1022 void VDU::DrawScanningMessage()
1029 if (comm_ani == NULL || force) {
1030 if (posmodes&
COMM) {
1031 if (ani != NULL && comm_ani == NULL)
1032 thismode.push_back( COMM );
1033 else if (comm_ani != NULL && thismode.size() > 1 && ani != NULL)
1034 thismode.back() =
COMM;
1049 if ( !comm_ani->
Done() )
1050 return communicating.
GetUnit();
1060 string nam =
"none";
1067 std::string navdata =
1079 bool draw_auto_message = (delautotime < auto_message_lim && cp->
autoMessage.length() != 0);
1081 std::string::size_type where = msg.find(
"#" );
1082 while (where != std::string::npos) {
1083 msg = msg.substr( 0, where )+msg.substr( where+7 );
1084 where = msg.find(
"#" );
1086 msg = std::string(
"\n\n#ffff00 " )+msg;
1087 static float background_alpha =
1090 bool automatte = (0 == tpbg.a);
1091 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1093 != NULL ? .4 : 0 ),
scrolloffset,
true,
true, automatte );
1097 void VDU::DrawComm()
1099 if (comm_ani != NULL) {
1104 static bool switch_back_from_comms =
1108 if ( comm_ani->
Done() ) {
1109 if (thismode.size() > 1) {
1110 if (switch_back_from_comms) {
1111 thismode.pop_back();
1113 unsigned int blah = thismode.back();
1114 thismode.pop_back();
1115 thismode.back() =
blah;
1118 communicating.
SetUnit( NULL );
1123 static string message_prefix =
1125 static float background_alpha =
1128 bool automatte = (0 == tpbg.a);
1129 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1130 tp->
Draw( message_prefix
1133 != NULL ? .4 : 0 ),
scrolloffset,
true,
false, automatte );
1138 void VDU::DrawManifest(
Unit *parent,
Unit *target )
1141 static string manifest_heading =
1143 static bool simple_manifest =
1145 string retval( manifest_heading );
1146 if (target != parent && simple_manifest ==
false)
1150 unsigned int load = 0;
1151 unsigned int cred = 0;
1152 unsigned int vol = 0;
1153 unsigned int numCargo = target->
numCargo();
1154 unsigned int maxCargo = 16;
1156 for (
unsigned int i = 0;
i < numCargo;
i++)
1163 float cp = ca.
price;
1165 cred += cq*(
int) cp;
1166 vol += (
int) ( (
float) cq*cv );
1167 load += (
int) ( (
float) cq*cm );
1168 if ( ( (target == parent) || (maxCargo+
i >= numCargo) || lastCat.compare( cc ) ) && (maxCargo > 0) ) {
1171 if (target == parent && !simple_manifest) {
1174 retval +=
tostring( (
int) ( (
float) cq*cm ) )+string(
"t " );
1176 retval +=
tostring( (
int) ( (
float) cq*cv ) )+string(
"m3 " );
1178 retval +=
tostring( (
int) cq )+
" ";
1181 if (!simple_manifest)
1182 retval += string(
" " )+
tostring( ( (target == parent) ? cq : 1 )*(
int) cp )
1187 if (target == parent && !simple_manifest)
1188 retval += string(
"--------\nLoad: " )+
tostring( load )+string(
"t " )
1190 static float background_alpha =
1193 bool automatte = (0 == tpbg.a);
1194 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1283 void VDU::DrawDamage(
Unit *parent )
1293 static bool draw_damage_sprite =
1296 (armor[0]+armor[2]+armor[4]+armor[6])/(
float) (StartArmor[0]+StartArmor[2]+StartArmor[4]+StartArmor[6]),
1297 (armor[0]+armor[1]+armor[4]+armor[5])/(
float) (StartArmor[0]+StartArmor[1]+StartArmor[4]+StartArmor[5]),
1298 (armor[2]+armor[3]+armor[6]+armor[7])/(
float) (StartArmor[2]+StartArmor[3]+StartArmor[6]+StartArmor[7]),
1299 (armor[1]+armor[3]+armor[5]
1300 +armor[7])/(
float) (StartArmor[1]+StartArmor[3]+StartArmor[5]+StartArmor[7]),
1301 parent->
GetHull()/(*maxhull),
true, false );
1308 char ecmstatus[256];
1309 ecmstatus[0] =
'\0';
1314 strcpy( ecmstatus,
"ECM Active" );
1319 DrawShield( 0, s, s, 0, x, y, w, h,
false,
GFXColor( 0, 1, 0 ),
GFXColor( 0, .75, 0 ),
GFXColor( 0, .5, 0 ) );
1338 static float cfullpower[4] = {1, 1, 1, 1};
1339 static float cdamaged[4] = {1, 0, 0, 1};
1340 static float chdamaged[4] = {1, 1, 0, 1};
1341 static float cdestroyed[4] = {.2, .2, .2, 1};
1342 static bool init =
false;
1351 static string damage_report_heading =
1353 "#00ff00DAMAGE REPORT\n\n" ) );
1354 string retval( damage_report_heading );
1355 retval += fpstring.
str;
1356 unsigned int numCargo = parent->
numCargo();
1357 double percent_working = 0.88;
1360 "not_included_in_damage_report",
1361 "plasteel_hull tungsten_hull isometal_hull" );
1362 static bool print_percent_working =
1365 #define REPORTITEM(percent_working, max_functionality, print_percent_working, component_string) \
1367 GFXColor final_color( (chdamaged[0]*percent_working)+( cdamaged[0]*(1.0-percent_working) ), \
1368 (chdamaged[1]*percent_working)+( cdamaged[1]*(1.0-percent_working) ), \
1369 (chdamaged[2]*percent_working)+( cdamaged[2]*(1.0-percent_working) ), \
1370 (chdamaged[3]*percent_working)+( cdamaged[3]*(1.0-percent_working) ) ); \
1371 if (percent_working == 0.0) \
1372 final_color = GFXColor( cdestroyed[0], cdestroyed[1], cdestroyed[2], cdestroyed[3] ); \
1373 std::string trailer; \
1374 if (percent_working < max_functionality) \
1375 retval += colToString( final_color ).str; \
1377 retval += fpstring.str; \
1378 trailer = fpstring.str; \
1379 retval += component_string; \
1380 if (print_percent_working) \
1381 retval += string( " (" )+tostring( int(percent_working*100) )+string( "%)" ); \
1382 retval += trailer+std::string( "\n" ); \
1385 #define REPORTINTEGRATED(which, which_key, which_name_default) \
1387 static string name = vs_config->getVariable( "graphics", "hud", which_key, which_name_default ); \
1388 if (!name.empty()) { \
1389 REPORTITEM( parent->pImage->which##Functionality, parent->pImage->which##FunctionalityMax, \
1390 print_percent_working, \
1396 #define REPORTINTEGRATEDFLAG(which, which_key, which_name_default) \
1398 static string name = vs_config->getVariable( "graphics", "hud", which_key, which_name_default ); \
1399 if (!name.empty()) { \
1400 REPORTITEM( ((parent->damages & which) ? 0.1 : 1.0), 1.0, \
1408 for (
unsigned int i = 0; i < numCargo; i++) {
1409 percent_working = 0.88;
1411 bool damaged = the_cargo.
GetCategory().find( DamagedCategory ) == 0;
1413 || ( the_cargo.
GetCategory().find(
"upgrades/" ) == 0
1415 && the_cargo.
GetContent().find(
"mult_" ) != 0
1416 && the_cargo.
GetContent().find(
"add_" ) != 0
1417 && non_repair_screen_cargo.find( the_cargo.
GetContent() )
1418 == std::string::npos) ) {
1424 if (parent->
pImage != NULL) {
1426 REPORTINTEGRATED(LifeSupport,
"damage.names.life_support",
"Life Support");
1427 REPORTINTEGRATED(fireControl,
"damage.names.fire_control",
"Fire Control");
1439 retval += ecmstatus;
1440 static float background_alpha =
1443 bool automatte = (0 == tpbg.a);
1457 void VDU::DrawStarSystemAgain(
float x,
float y,
float w,
float h,
VIEWSTYLE viewStyle,
Unit *parent,
Unit *target )
1489 bool inrange =
false;
1493 sprintf( buf,
"%s\n", blah.c_str() );
1494 static bool out_of_cone_information =
1498 static float background_alpha =
1501 bool automatte = (0 == tpbg.a);
1502 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1508 for (i = 0; i < rows-1 && i < 128; i++)
1512 strcat( st,
"Range: " );
1513 strcat( st, qr.
str );
1515 bool automatte = (0 == tpbg.
a);
1516 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1522 static bool draw_vdu_target_info =
1524 if (target && draw_vdu_target_info)
1526 DrawHUDSprite(
this,
getSunImage(), 1, x, y, w, h, 1, 1, 1, 1, 1,
false,
false );
1548 }
else if (target) {
1549 static float background_alpha =
1552 bool automatte = (0 == tpbg.a);
1553 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1592 mountcolor =
GFXColor( 1, 0, 0, 1 );
1595 mountcolor =
GFXColor( 1, 1, 1, 1 );
1598 mountcolor =
GFXColor( 1, 1, 1, 1 );
1601 mountcolor =
GFXColor( 0, .2, 0, 1 );
1604 mountcolor =
GFXColor( 0, 1, .2, 1 );
1610 void VDU::DrawWeapon(
Unit *parent )
1612 static bool drawweapsprite =
1615 const float percent = .6;
1616 string buf(
"#00ff00WEAPONS\n\n#ffffffGuns:#000000" );
1617 int len = buf.length();
1618 string mbuf(
"\n#ffffffMissiles:#000000" );
1619 int mlen = mbuf.length();
1623 DrawTargetSpr( drawweapsprite ? parent->
getHudImage() : NULL, percent,
x,
y, w, h );
1629 for (
int i = 0; i < nummounts; i++) {
1630 if (drawweapsprite) {
1632 pos.i = -pos.i*fabs( w )/parent->
rSize()*percent+
x;
1633 pos.j = pos.k*fabs( h )/parent->
rSize()*percent+
y;
1638 (parent->
mounts[i].ammo >= 0) ?
string(
"(" )+
tostring( parent->
mounts[i].ammo )+string(
")" ) : string(
"" );
1641 average.r += mntcolor.
r;
1642 average.g += mntcolor.
g;
1643 average.b += mntcolor.
b;
1644 average.a += mntcolor.
a;
1645 if (i+1 < nummounts && parent->
mounts[i].bank) {
1648 GFXColor mountcolor( average.r/numave, average.g/numave, average.b/numave, average.a/numave );
1652 == (
unsigned int) len) ? string(
"" ) : string(
"," ) )+( (count++%1 == 0) ?
"\n" :
"" )+string(
1653 colToString( mountcolor ).
str )+parent->mounts[i].type->weapon_name+ammo;
1657 == (
unsigned int) mlen) ? string(
"" ) : string(
"," ) )
1659 == 0) ?
"\n" :
"" )+string(
colToString( mountcolor ).
str )+parent->mounts[i].type->weapon_name+ammo;
1665 if (mbuf.length() != (
unsigned int) mlen)
1667 static float background_alpha =
1670 bool automatte = (0 == tpbg.a);
1671 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1672 tp->
Draw( buf, 0,
true,
false, automatte );
1704 unsigned int tmp2 = (
unsigned int) suc;
1705 unsigned int tmp1 = (
unsigned int) (255-suc);
1706 suc_col_str[0] =
'#';
1707 suc_col_str[1] =
printHex( tmp1/16 );
1708 suc_col_str[2] =
printHex( tmp1%16 );
1709 suc_col_str[3] =
printHex( tmp2/16 );
1710 suc_col_str[4] =
printHex( tmp2%16 );
1711 suc_col_str[5] =
'0';
1712 suc_col_str[6] =
'0';
1718 int VDU::DrawVDUObjective(
void *obj,
int offset )
1720 static bool VDU_DrawVDUObjective_is_now_outdated =
false;
1721 assert( VDU_DrawVDUObjective_is_now_outdated ==
true );
1728 std::string rez(
"\n" );
1732 static bool force_anonymous_missions =
1738 vector< Mission::Objective >::iterator
j =
active_missions[i]->objectives.begin();
1740 if (j->getOwner() == NULL || j->getOwner() == parent) {
1741 if ( (*j).objective.length() ) {
1743 rez += (*j).objective;
1749 static float background_alpha =
1752 bool automatte = (0 == tpbg.a);
1753 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1754 tp->
Draw( rez, scrolloffset,
false,
false, automatte );
1758 void VDU::DrawVDUObjectives(
Unit *parent )
1763 bool VDU::SetWebcamAnimation()
1765 if (comm_ani == NULL) {
1768 communicating.
SetUnit( NULL );
1769 thismode.push_back( WEBCAM );
1777 void VDU::DrawWebcam(
Unit *parent )
1783 if (
Network[playernum].hasWebcam() ) {
1825 h = h+height_factor;
1837 cols =
int(fabs(ceil(w/csx)));
1838 rows =
int(fabs(ceil(h/csy)));
1844 tp->
SetSize( x+w, y-h-.5*fabs( w/cols ) );
1846 if (thismode.back() !=
COMM && comm_ani != NULL) {
1847 if ( comm_ani->
Done() ) {
1849 communicating.
SetUnit( NULL );
1853 static float auto_switch_lim =
1855 if ( (delautotime<auto_switch_lim) && (parentcp->
autoMessage.length()!=0) ) {
1856 if ( (thismode.back()!=
COMM) && ((posmodes&
NAV)!=0) ) {
1857 thismode.back() =
NAV;
1861 switch ( thismode.back() )
1867 string str(
"Lag: " );
1869 memset( buf, 0, 32 );
1870 sprintf( buf,
"%.1Lf", (
long double) lag );
1877 str += string( buf )+
"#000000 ms\n";
1878 if (
Network[playernum].IsNetcommSecured() )
1880 memset( buf, 0, 32 );
1881 sprintf( buf,
"%g",
Network[playernum].getCurrentFrequency() );
1882 str += string( buf )+
"/";
1883 memset( buf, 0, 32 );
1884 sprintf( buf,
"%g",
Network[playernum].getSelectedFrequency() );
1885 str += string( buf )+
" GHz";
1886 if (
Network[playernum].IsNetcommSecured() )
1888 if (
Network[playernum].IsNetcommActive() )
1889 str +=
" - #0000FFON";
1891 str +=
" - #FF0000OFF";
1894 static float background_alpha =
1897 bool automatte = (0 == tpbg.a);
1898 if (automatte) tp->
bgcol =
GFXColor( 0, 0, 0, background_alpha );
1905 DrawWebcam( parent );
1908 if (!got_target_info)
1909 DrawScanningMessage();
1917 DrawTarget( parentcp, parent, targ );
1920 DrawManifest( parent, parent );
1924 DrawManifest( parent, targ );
1929 DrawStarSystemAgain( .5*(x-fabs( w/2 )+1), .5*( ( y-fabs( h/2 ) )+1 ), fabs( w/2 ), fabs(
1930 h/2 ), viewStyle, parent, targ );
1936 DrawMessages( parentcp, targ );
1942 DrawDamage( parent );
1945 DrawWeapon( parent );
1948 DrawVDUShield( parent );
1951 DrawVDUObjectives( parent );
2004 got_target_info =
false;
2006 if (thismode.back() == WEBCAM &&
Network != NULL && parent != NULL) {
2010 if ( thismode.back() ==
VIEW && viewStyle !=
CP_CHASE && (thismode.back()&posmodes) ) {
2014 thismode.back() <<= 1;
2015 while ( !(thismode.back()&posmodes) ) {
2016 if (thismode.back() > posmodes)
2017 thismode.back() = 0x1;
2019 thismode.back() <<= 1;
2024 got_target_info =
false;
2026 if (thismode.back() == WEBCAM &&
Network != NULL && parent != NULL) {
2034 if (comm_ani && comm_ani->
Done() ==
false)
2035 if (communicating == un || communicating == NULL)