00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "config.h"
00035
00036 #include <stdio.h>
00037 #include "defs.h"
00038 #include "struct.h"
00039 #include "data.h"
00040
00041 struct player *players;
00042 struct player *me = NULL;
00043 struct torp *torps;
00044 struct plasmatorp *plasmatorps;
00045 struct status *status;
00046 struct ship *myship;
00047 struct stats *mystats;
00048 struct planet *planets;
00049 struct phaser *phasers;
00050 struct message *messages;
00051 struct mctl *mctl;
00052 struct memory universe;
00053
00054 int ghoststart = 0;
00055
00056
00057
00058 int ghost_pno = 0;
00059
00060
00061
00062 int keepInfo = 15;
00063
00064
00065
00066 int showPlanetOwner = 0;
00067
00068 int phaserShrink = 0;
00069 int theirPhaserShrink = 0;
00070 int shrinkPhaserOnMiss = 0;
00071
00072 int newDashboard = 0;
00073
00074
00075
00076 int old_db = 0;
00077
00078
00079
00080 int fastQuit = 0;
00081 int gen_distress = 0;
00082
00083
00084
00085 int niftyNewMessages = 1;
00086 int oldalert = 0;
00087 int remap[16] =
00088 {0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0};
00089 int messpend = 0;
00090
00091 #ifdef XTRA_MESSAGE_UI
00092 int messageHUD = 0;
00093
00094
00095
00096
00097 int messHoldThresh = 0;
00098
00099
00100
00101
00102 int messMouseDelta = 0;
00103
00104
00105
00106
00107 #endif
00108 int lastcount = 0;
00109 int mdisplayed = 0;
00110 int udcounter = 0;
00111 int showTractorPressor = 1;
00112 int showLock = 3;
00113 int showPhaser = 2;
00114 int autoKey = 0;
00115 int extraBorder = 1;
00116
00117
00118 int tryUdp = 1;
00119 int tryUdp1 = 1;
00120 struct plupdate pl_update[MAXPLANETS];
00121 char buttonmap[0x20] =
00122 {'\0', '\0', '\0', '\0', '\0', '\0'};
00123 int lastm = 0;
00124 int delay = 0;
00125 int rdelay = 0;
00126 int namemode = 1;
00127 int quittime = 60;
00128 int showStats = 0;
00129 int warnShields = 0;
00130 int ROMVLVS = 0;
00131 int warncount = 0;
00132 int warntimer = -1;
00133 int infomapped = 0;
00134 int mustexit = 0;
00135 int messtime = 5;
00136 int keeppeace = 0;
00137
00138 #ifdef GATEWAY
00139 unsigned LONG netaddr = 0;
00140
00141 #endif
00142
00143 int msgBeep = 1;
00144 int scanmapped = 0;
00145
00146 int logmess = 0;
00147 int continuetractor = 1;
00148 int tcounter = 2;
00149 int showlocal = 2;
00150 int showgalactic = 2;
00151
00152 #ifdef HAVE_XPM
00153 int pixMissing = 0;
00154 int pixFlags = 0;
00155
00156 #endif
00157 char *title = NULL;
00158 char *shipnos = "0123456789abcdefghijklmnopqrstuvwxyz";
00159
00160 #ifndef RSA
00161
00162
00163 int sock = -1;
00164
00165
00166
00167 #endif
00168 int xtrekPort = -1;
00169 int queuePos = -1;
00170 int pickOk = -1;
00171 int lastRank = -1;
00172 int promoted = 0;
00173
00174 #ifdef ROTATERACE
00175 int rotate = 0;
00176 int rotate_deg = 0;
00177
00178 #endif
00179
00180 int loginAccept = -1;
00181 unsigned localflags = 0;
00182 int tournMask = 15;
00183 int nextSocket = 0;
00184
00185
00186
00187 char *serverName = NULL;
00188
00189
00190
00191 char defaultsFile[80] = "";
00192
00193 char *myname = NULL;
00194 int loggedIn = 0;
00195 int reinitPlanets = 0;
00196 int timerDelay = 200000;
00197
00198
00199
00200 int redrawDelay = 0;
00201
00202
00203
00204 int reportKills = 1;
00205
00206
00207
00208 int phaserWindow = 0;
00209
00210
00211
00212
00213 #ifdef PHASER_STATS
00214 int phaserShowStats = 0;
00215 int phaserStatTry = 0;
00216 int phaserStatHit = 0;
00217
00218 #endif
00219 int censorMessages = 0;
00220
00221 #ifdef RECORDGAME
00222 FILE *recordFile = NULL;
00223
00224
00225
00226
00227 FILE *recordIndexFile = NULL;
00228 FILE *recordContextFile = NULL;
00229
00230 int playback = 0;
00231
00232 #endif
00233
00234 FILE *logFile = NULL;
00235
00236
00237
00238
00239 int scanplayer = 0;
00240 int showTractor = 1;
00241
00242
00243
00244 int commMode = 0;
00245
00246
00247
00248 int commModeReq = 0;
00249
00250
00251
00252 int commStatus = 0;
00253
00254
00255
00256 int commSwitchTimeout = 0;
00257 int udpTotal = 1;
00258
00259
00260
00261 int udpDropped = 0;
00262
00263
00264
00265 int udpRecentDropped = 0;
00266
00267
00268
00269 int udpSock = -1;
00270 int udpDebug = 0;
00271
00272
00273
00274 int udpClientSend = 1;
00275
00276
00277
00278 int udpClientRecv = 1;
00279
00280
00281
00282 int udpSequenceChk = 1;
00283
00284
00285
00286 int weaponUpdate = 0;
00287
00288
00289
00290
00291
00292 #ifdef GATEWAY
00293 int gw_serv_port, gw_port, gw_local_port;
00294 char *gw_mach = NULL;
00295
00296 #endif
00297
00298
00299 int baseLocalPort = 0;
00300
00301 int debug = 0;
00302
00303 int messageon = 0;
00304
00305 #ifdef RSA
00306 char testdata[16];
00307 int RSA_Client = 1;
00308
00309 #endif
00310
00311 int SBhours = 0;
00312
00313 #ifdef SHORT_PACKETS
00314 int why_dead = 0;
00315 int tryShort = 1;
00316 int tryShort1 = 1;
00317 int recv_short = 0;
00318 int recv_mesg = 1;
00319 int recv_kmesg = 1;
00320 int recv_threshold = 0;
00321 char recv_threshold_s[8] =
00322 {'0', '\0'};
00323 int recv_warn = 1;
00324
00325 #endif
00326
00327
00328 int netstat = 0;
00329 int netstatfreq = 5;
00330
00331 int updatespeed = 5;
00332
00333
00334 char *metaserver = "metaserver.netrek.org";
00335 int metaport = 3521;
00336
00337
00338
00339 #ifdef NBT
00340 struct macro_list macro[MAX_MACRO];
00341 int MacroMode = 0;
00342 int macrocnt = 0;
00343
00344 #endif
00345
00346 extern double Sin[], Cos[];
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364 int VShieldBitmaps = 1;
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384 #ifdef NEWMACRO
00385 int MacroNum = 0;
00386
00387 #endif
00388 char lastMessage[80];
00389 char *classes[] =
00390 {"SC", "DD", "CA", "BB", "AS", "SB", "GA", "AT"};
00391 char teamlet[] =
00392 {'I', 'F', 'R', 'X', 'K', 'X', 'X', 'X', 'O', 'X', 'X', 'X',
00393 'X', 'X', 'X', 'A'};
00394 char *teamshort[16] =
00395 {"IND", "FED", "ROM", "X", "KLI", "X", "X", "X", "ORI",
00396 "X", "X", "X", "X", "X", "X", "ALL"};
00397 char pseudo[PSEUDOSIZE];
00398 char defpasswd[PSEUDOSIZE];
00399 char login[PSEUDOSIZE];
00400
00401 struct ship shipvals[NUM_TYPES];
00402
00403
00404 struct rank ranks[NUMRANKS] =
00405 {
00406 {0.0, 0.0, 0.0, "Ensign", "Esgn"},
00407 {2.0, 1.0, 0.0, "Lieutenant", "Lt "},
00408 {4.0, 2.0, 0.0, "Lt. Cmdr.", "LtCm"},
00409 {8.0, 3.0, 0.0, "Commander", "Cder",},
00410 {15.0, 4.0, 0.0, "Captain", "Capt"},
00411 {20.0, 5.0, 0.0, "Flt. Capt.", "FltC"},
00412 {25.0, 6.0, 0.0, "Commodore", "Cdor"},
00413 {30.0, 7.0, 0.0, "Rear Adm.", "RAdm"},
00414 {40.0, 8.0, 0.0, "Admiral", "Admr"}};
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436 int ping = 0;
00437 LONG packets_sent = 0;
00438
00439
00440
00441 LONG packets_received = 0;
00442
00443
00444 char deathmessage[80];
00445 char outmessage[85];
00446
00447
00448
00449
00450
00451
00452 char *xdisplay_name = NULL;
00453
00454 int UseNewDistress = 0;
00455 int UseNewMacro = 1;
00456 int UseSmartMacro = 1;
00457 int rejectMacro = 0;
00458 int maskrecip = 0;
00459
00460 unsigned char singleMacro[65] = "";
00461
00462 int enemyPhasers = 1;
00463
00464 char cloakChars[3] = "??";
00465
00466 int showIND = 0;
00467 int newPlist = 0;
00468
00469
00470
00471
00472
00473
00474
00475
00476 #define NUM_DIST 27
00477
00478
00479 struct dmacro_list dist_prefered[NUM_DIST];
00480
00481
00482
00483
00484 struct dmacro_list dist_defaults[] =
00485 {
00486 {'X', "no zero", "this should never get looked at"},
00487
00488 {'\xd4', "taking", " %T%c->%O (%S) Carrying %a to %l%?%n>-1%{ @ %n%}\0"},
00489
00490 {'\xcf', "ogg", " %T%c->%O Help Ogg %p at %l\0"},
00491
00492 {'\xc2', "bomb", " %T%c->%O %?%n>4%{bomb %l @ %n%!bomb%}\0"},
00493
00494 {'\xc3', "space_control", " %T%c->%O Help Control at %L\0"},
00495
00496 {'\x91', "save_planet", " %T%c->%O Emergency at %L!!!!\0"},
00497
00498 {'\x92', "base_ogg", " %T%c->%O Sync with --]> %g <[-- OGG ogg OGG base!!\0"},
00499
00500 {'\x93', "help1", " %T%c->%O Help me! %d%% dam, %s%% shd, %f%% fuel %a armies.\0"},
00501
00502 {'\x94', "help2", " %T%c->%O Help me! %d%% dam, %s%% shd, %f%% fuel %a armies.\0"},
00503
00504 {'\xc5', "escorting", " %T%c->%O ESCORTING %g (%d%%D %s%%S %f%%F)\0"},
00505
00506 {'\xd0', "ogging", " %T%c->%O Ogging %h\0"},
00507
00508 {'\xcd', "bombing", " %T%c->%O Bombing %l @ %n\0"},
00509
00510 {'\xcc', "controlling", " %T%c->%O Controlling at %l\0"},
00511
00512 {'\x95', "asw", " %T%c->%O Anti-bombing %p near %b.\0"},
00513
00514 {'\x96', "asbomb", " %T%c->%O DON'T BOMB %l. Let me bomb it (%S)\0"},
00515
00516 {'\x97', "doing1", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%% dam, %s%% shd, %f%% fuel)\0"},
00517
00518 {'\x98', "doing2", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%% dam, %s%% shd, %f%% fuel)\0"},
00519
00520 {'\xc6', "free_beer", " %T%c->%O %p is free beer\0"},
00521
00522 {'\xce', "no_gas", " %T%c->%O %p @ %l has no gas\0"},
00523
00524 {'\xc8', "crippled", " %T%c->%O %p @ %l crippled\0"},
00525
00526 {'\x99', "pickup", " %T%c->%O %p++ @ %l\0"},
00527
00528 {'\x90', "pop", " %T%c->%O %l%?%n>-1%{ @ %n%}!\0"},
00529
00530 {'F', "carrying", " %T%c->%O %?%S=SB%{Your Starbase is c%!C%}arrying %?%a>0%{%a%!NO%} arm%?%a=1%{y%!ies%}.\0"},
00531
00532 {'\xa0', "other1", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%%D, %s%%S, %f%%F)\0"},
00533
00534 {'\x83', "other2", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%%D, %s%%S, %f%%F)\0"},
00535
00536 {'E', "help", " %T%c->%O Help(%S)! %s%% shd, %d%% dmg, %f%% fuel,%?%S=SB%{ %w%% wtmp,%!%}%E%{ ETEMP!%}%W%{ WTEMP!%} %a armies!\0"},
00537 {'\0', '\0', '\0'},
00538 };
00539
00540 struct dmacro_list *distmacro = dist_defaults;
00541
00542 int sizedist = sizeof(dist_defaults);
00543
00544 #ifdef BEEPLITE
00545 char *distlite[NUM_DIST] =
00546 {
00547 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00548 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00549 NULL, NULL, NULL, NULL, NULL, NULL, NULL
00550 };
00551
00552 int DefLite = 0;
00553 int UseLite = 0;
00554
00555 int emph_planet_seq_n[MAXPLANETS] =
00556 {0,};
00557 int emph_player_seq_n[MAXPLAYER] =
00558 {0,};
00559
00560
00561
00562 int beep_lite_cycle_time_player = 10;
00563 int beep_lite_cycle_time_planet = 10;
00564 int liteflag = 0;
00565 char F_beeplite_flags = LITE_PLAYERS_MAP |
00566 LITE_PLAYERS_LOCAL |
00567 LITE_SELF |
00568 LITE_PLANETS |
00569 LITE_SOUNDS |
00570 LITE_TTS;
00571
00572 int tts_len = 0;
00573 int tts_max_len = 40;
00574 int tts_width = 0;
00575 int tts_timer = 0;
00576 int tts_time = 25;
00577 int tts_pos = TWINSIDE / 2 - 16;
00578
00579
00580
00581 char lastIn[100];
00582
00583 #endif
00584
00585 #ifdef RCM
00586
00587 struct dmacro_list rcm_msg[] =
00588 {
00589 {'0', "none", "Unknown RCM message"},
00590 {'1', "kill", "GOD->ALL %i (%S) (%T%c%?%a>0%{+%a armies%!%}) was kill %?%d>0%{%k%!NO CREDIT)%} for %u (%r%p) %?%w>0%{%W%!%}"},
00591 {'2', "planet", "GOD->ALL %i (%S) (%T%c%?%a>0%{+%a armies%!%} killed by %l (%z) %?%w>0%{%W%!%}"},
00592 {'3', "bomb", "%N->%Z We are being attacked by %i (%T%c) who is %d%% damaged."},
00593 {'4', "destroy", "%N->%Z %N destroyed by %i (%T%c)"},
00594 {'5', "take", "%N->%O %N taken by %i (%T%c)"},
00595 {'6', "ghostbust", "GOD->ALL %i (%S) (%T%c) was kill %k for the GhostBusters"},
00596 {'\0', '\0', '\0'},
00597 };
00598
00599 #endif
00600
00601 int highlightFriendlyPhasers = 0;
00602
00603 #ifdef IGNORE_SIGNALS_SEGV_BUS
00604
00605
00606 int ignore_signals = 0;
00607
00608 #endif
00609
00610 #ifdef MOTION_MOUSE
00611
00612 int motion_mouse = 0;
00613 int user_motion_thresh = 16;
00614 int motion_mouse_enablable = 1;
00615 int motion_mouse_steering = 0;
00616
00617 #endif
00618
00619 #ifdef SHIFTED_MOUSE
00620
00621 int extended_mouse = 0;
00622
00623 #endif
00624
00625 int ignoreCaps = 1;
00626
00627
00628
00629
00630 #ifdef MOUSE_AS_SHIFT
00631
00632 int mouse_as_shift = 0;
00633 int b1_as_shift = 0;
00634 int b2_as_shift = 0;
00635 int b3_as_shift = 0;
00636
00637 #endif
00638
00639 #ifdef TNG_FED_BITMAPS
00640 int use_tng_fed_bitmaps = 0;
00641
00642
00643 #endif
00644
00645 #ifdef VARY_HULL
00646
00647 int vary_hull = 0;
00648
00649 #endif
00650
00651 #ifdef XTREKRC_HELP
00652
00653
00654 #endif
00655
00656 #ifdef CONTROL_KEY
00657 int use_control_key = 1;
00658
00659 #endif
00660
00661 #ifdef DOC_WIN
00662
00663 int maxdoclines = 0, maxxtrekrclines = 0;
00664
00665 #endif
00666
00667
00668
00669
00670 #ifdef REFRESH_INTERVAL
00671 int refresh_interval = 0;
00672
00673 #endif
00674
00675 int max_fd = 3;
00676
00677 #ifdef TOOLS
00678
00679 int shelltools = 1;
00680 struct key_list macroKeys[MAX_KEY];
00681 unsigned char keys[MAX_KEY] = "";
00682 char *wwwlink = "netscape -remote \"openURL(%s)\"";
00683 char *upgradeURL = "http://cow.netrek.org/current/index.html#%s";
00684 char *releaseURL = "http://cow.netrek.org/%s/README.html#pl%i";
00685 char *bugURL = "http://sourceforge.net/bugs/?group_id=968";
00686
00687
00688
00689 #endif
00690
00691 #ifdef SOUND
00692 int sound_init = 0;
00693 int sound_toggle = 0;
00694 char *sounddir = NULL;
00695
00696
00697 #endif
00698
00699 #ifdef HOCKEY_LINES
00700 int hockey_s_lines = 0;
00701 struct s_line s_lines[NUM_HOCKEY_LINES + 1];
00702 int normal_s_lines = 0;
00703
00704 #endif
00705
00706 #ifdef MULTILINE_MACROS
00707 int multiline_enabled = 0;
00708
00709 #endif
00710
00711 #ifdef FEATURE_PACKETS
00712 int F_feature_packets = 0;
00713
00714 #endif
00715
00716 int F_cloak_maxwarp = 0;
00717 int F_self_8flags = 1;
00718 int F_self_8flags2 = 0;
00719 int F_ship_cap = 0;
00720
00721 #ifdef HAVE_XPM
00722 int F_agri_pix = 1;
00723
00724 #endif
00725
00726 #ifdef WARP_DEAD
00727 int F_dead_warp = 0;
00728
00729 #endif
00730
00731 int F_many_self = 0;
00732
00733 #ifdef UDP_PORTSWAP
00734 int portSwap = 0;
00735 #endif