Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

ooii.c 54.8 KB
Newer Older
1 2 3 4 5 6
/*
 * This code handles Operation Overkill ][ terminal codes
 */

#include <string.h>
#include <genwrap.h>
deuce's avatar
deuce committed
7
#include <xpbeep.h>
8 9 10
#include <ciolib.h>
#include <cterm.h>
#include <time.h>
11
#include "term.h"
12
#include "ooii.h"
13 14 15
#include "ooii_cmenus.h"
#include "ooii_bmenus.h"
#include "ooii_logons.h"
16
#include "ooii_sounds.h"
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152

static unsigned char stormColors[7]={7,12,8,15,14,13,1};

static char diseases[11][14]=    // #,str length

{"None",                 // 0
 "Pneumonia",            // 1
 "Malaria",              // 2
 "Yellow Fever",         // 3
 "Hydrocism",            // 4
 "Staph",                // 5
 "Rabies",               // 6
 "Polio",                // 7
 "Black Plague",         // 8
 "Delyria",              // 9
 "Poison"};              // 10


static char weapons[27][20]=

{"",                  // 0
 "Steel Chain",        // 1
 "Salanger",           // 2
 "Natase",             // 3
 "TransAxe",           // 4	{  Power Pack   }
 "Electric Sword",     // 5	{ Power Pack   }
 "Tevix-Bahn",         // 6     { Cirze Supply }
 "Xendrix",            // 7	{ NOT FOR SALE!  Infinex }
 "Trilasm",            // 8	{ ZZETs        }
 "Exavator",           // 9	{ ZZETs        }
 "Raxhaven",           // 10	{ Power Pack   }
 "SanPlizer",          // 11	{ Power Pack   }
 "Devastator",         // 12	{ Cirze Supply }
 "Z-Tempest",          // 13	{ Cirze Supply }
 "Herculean",          // 14	{ NOT FOR SALE!  Infinex }
 "Trignet",            // 15	{ NOT FOR SALE!  Firenet }
 "Extinguisher",       // 16
 "Shovel",             // 17
 "Nail Gun",           // 18
 "Jack Knife",         // 19
 "Metal Shears",       // 20
 "Wall Hook",          // 21
 "Hoist",              // 22
 "Propeller",          // 23
 "Pickaxe",            // 24
 "Sledge Hammer",      // 25
 "Hydra-Jack" };       // 26



static char ammos[6][20]=

{"",                  // 0
 "ZZETs",              // 1	{  (Trilasm/Exavator) }
 "Power Pack",         // 2	{  (SanPlizer/RaxHaven/E-Sword/)        }
 "Cirze Supply",       // 3	{  (Z-Tempest/Devastator/Tevix-Bahn)    }
 "Infinex",            // 4	{  NOT FOR SALE!! (Herculean/Xendrix)   }
 "Firenet" };          // 5	{  NOT FOR SALE!! (Trignet)             }


static char equips[46][20]=

{"",                   // 0
 "Rations",             // 1
 "Hemp Rope",           // 2
 "Silencer",            // 3
 "Transmitter",         // 4
 "Summoner",            // 5
 "MedPack",             // 6
 "Thumpers",            // 7
 "Galacticom",          // 8
 "Gasmask",             // 9
 "Duroplast",           // 10
 "Aerial Scan",         // 11
 "VacPack",             // 12
 "Telegrasp",           // 13	{ NOT FOR SALE! }
 "Red Key",             // 14	{ NOT FOR SALE! }
 "Blue Key",            // 15	{ NOT FOR SALE! }
 "Green Key",           // 16	{ NOT FOR SALE! }
 "Techkit",             // 17	{ NOT FOR SALE! }
 "Rusted Wire",         // 18	{ NOT FOR SALE! }{Arming Device}
 "Clay Package",        // 19	{ NOT FOR SALE! }{Plutonium}
 "Alarm Clock",         // 20	{ NOT FOR SALE! }{Timer}
 "Broken Keypad",       // 21	{ NOT FOR SALE! }{Keypad}
 "Code Key",            // 22	{ NOT FOR SALE! }{Entry Into AFBase}
 "Alien Device",        // 23	{ NOT FOR SALE! }{Entry Into SpaceShip}
 "Trikorder",           // 24	{ NOT FOR SALE! }
 "Remote Control",      // 25	{ NOT FOR SALE! }
 "Human Skull",         // 26	{ NOT FOR SALE! }
 "Floppy Disk",         // 27	{ NOT FOR SALE! }{Entry to Computer Silo}
 "Alien Skull",         // 28	{ NOT FOR SALE! }
 "Hydrite Egg",         // 29	{ NOT FOR SALE! }
 "Lazer Key",           // 30	{ NOT FOR SALE! }{Entry thru AFB doorways }
 "Landmine",            // 31	{ For Sale Only In AirForce Base}
 "Zimmer",              // 32	{ For Sale Only In AirForce Base}
 "Re-Bar Scrap",        // 33
 "Door Hinge",          // 34
 "Broken Wrench",       // 35
 "Steel Coupling",      // 36
 "Pipe Fitting",        // 37
 "Rotted Cabling",      // 38
 "Pipe Die",            // 39
 "Chrome Pipe",         // 40
 "Gate Valve",          // 41
 "Butane Tank",         // 42
 "Drill Bit",           // 43
 "I-Bar Clamp",         // 44
 "Copper Tubing"};      // 45



static char suits[4][20]=

{"",                   // 0
 "Environmental Suit",  // 1
 "Combat Suit",         // 2
 "Anti-G Suit"};        // 3


static char armors[13][20]=

{"",                   // 0
 "Leather",             // 1
 "HeXonium",            // 2
 "Laser Vest",          // 3
 "Shezvarin",           // 4
 "Reflecto",            // 5
 "Mudrane Sheathing",   // 6
 "Breonesin Sheeting",  // 7
 "Barbed Wire",         // 8
 "Asbestos Pads",       // 9
 "Cuprid Vest",         // 10
 "Sheet Metal",         // 11
 "PolyCarbon"};         // 12


153 154 155 156
static void term_gotoxy(int x, int y)
{
	char	ansistr[32];

deuce's avatar
deuce committed
157
	sprintf(ansistr, "\x1b[%d;%dH", y, x);
158
	cterm_write(cterm, ansistr, strlen(ansistr), NULL, 0, NULL);
159 160 161 162
}

static void term_clearscreen(void)
{
163
	cterm_write(cterm, "\x1b[0m\x1b[2J\x1b[H", 11, NULL, 0, NULL);
164 165 166 167 168 169 170 171 172 173 174 175 176
}

const int 	term_colours[8]={0,4,2,6,1,5,3,7};
static void term_setattr(int attr)
{
	char str[16];
	int fg,ofg;
	int bg,obg;
	int bl,obl;
	int br,obr;
	int oa;

	str[0]=0;
177
	if(cterm->attr==attr)
178 179 180 181 182 183 184
		return;

	bl=attr&0x80;
	bg=(attr>>4)&0x7;
	fg=attr&0x07;
	br=attr&0x08;

185
	oa=cterm->attr;
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
	obl=oa&0x80;
	obg=(oa>>4)&0x7;
	ofg=oa&0x07;
	obr=oa&0x08;

	strcpy(str,"\033[");
	if(obl!=bl) {
		if(!bl)
			strcat(str,"25;");
		else
			strcat(str,"5;");
	}
	if(br!=obr) {
		if(br)
			strcat(str,"1;");
		else
			strcat(str,"22;");
	}
	if(fg!=ofg)
		sprintf(str+strlen(str),"3%d;",term_colours[fg]);
	if(bg!=obg)
		sprintf(str+strlen(str),"4%d;",term_colours[bg]);
	str[strlen(str)-1]='m';
209
	cterm_write(cterm, str, strlen(str), NULL, 0, NULL);
210 211
}

deuce's avatar
deuce committed
212
static void readInPix(char codeCh, int ooii_mode) {
213 214
	int fptr;

215 216
	term_clearscreen();
	term_gotoxy(1,1);
217 218 219
	switch ((char)codeCh) {
		// complex pictures
		case 'A':
220
			fptr=0;	/* Main = 0 */
221 222
			break;
		case 'B':
223
			fptr=1;	/* Barracks = 1 */
224 225
			break;
		case 'C':
226
			fptr=3;	/* Head-quarters = 3 */	
227 228
			break;
		case 'D':
229
			fptr=2;	/* Communications = 2 */
230 231
			break;
		case 'E':
232
			fptr=4;	/* Wastelands = 4 */
233 234 235 236 237
			break;


		// base pictures
		case 'F':
238
			fptr=0;	/* Main menu = 0 */
239 240
			break;
		case 'G':
241
			fptr=1;	/* Barracks = 1 */
242 243
			break;
		case 'H':
244
			fptr=3;	/* Storage = 3 */
245 246
			break;
		case 'I':
247
			fptr=5;	/* Tech Centre = 5 */
248 249
			break;
		case 'J':
250
			fptr=2;	/* Control Room = 2 */
251 252
			break;
		case 'K':
253
			fptr=4;	/* Radio Room = 4 */
254 255 256 257 258 259 260 261
			break;

		// logon pictures
		case '0':
			fptr=xp_random(10);
			break;
	}

262
	if (codeCh>='A' && codeCh<='E')
deuce's avatar
deuce committed
263
		cterm_write(cterm, ooii_cmenus[ooii_mode-1][fptr], strlen((char *)ooii_cmenus[ooii_mode-1][fptr])-1, NULL, 0, NULL);
264
	else if (codeCh>='F' && codeCh<='K')
deuce's avatar
deuce committed
265
		cterm_write(cterm, ooii_bmenus[ooii_mode-1][fptr], strlen((char *)ooii_bmenus[ooii_mode-1][fptr])-1, NULL, 0, NULL);
266
	else if (codeCh=='0')
deuce's avatar
deuce committed
267
		cterm_write(cterm, ooii_logon[ooii_mode-1][fptr], strlen((char *)ooii_logon[ooii_mode-1][fptr])-1, NULL, 0, NULL);
268

269 270 271 272 273 274
	/* We don't overwrite the status line, so we don't need to redraw it */
	/* statusLine(); */

	return;
}

deuce's avatar
deuce committed
275 276
static int readInText(unsigned char *codeStr) {
	unsigned char *origCodeStr=codeStr;
277 278 279

	switch ((char)codeStr[0]) {
		case '1':
280
			term_setattr(BROWN);
281 282 283 284
	    	cterm_write(cterm, "You mosey on over to the bar and take a seat on a scuffed barstool.  The\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "slighty deformed keeper grunts, \"Woth ja leeke?\"  A galacticom on the top\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "shelf behind him translates his jumble into \"What would you like?\"  You\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "start to wonder what ever happened to the old standard human language.\r\n\r\n", -1, NULL, 0, NULL);
285
	    	term_setattr(LIGHTGREEN);
286
	    	cterm_write(cterm, "\"Give me the House Special,\" you smirk.\r\n\r\n", -1, NULL, 0, NULL);
287
	    	term_setattr(GREEN);
288 289 290 291
	    	cterm_write(cterm, "The bartender stares at you with one eye and then drools in agreement.  He\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "vanishes from behind the bar and pops back up a few seconds later.  He\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "slides you the mysterious drink as he begins to chuckle.  White smoke\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "slithers from the bubbling green slime over onto the bar counter.\r\n\r\n", -1, NULL, 0, NULL);
292
	    	term_setattr(LIGHTGREEN);
293 294
	    	cterm_write(cterm, "\"What do I owe you?\" you inquire to the barman.  He promptly responds\r\n", -1, NULL, 0, NULL);
	    	cterm_write(cterm, "with that same smirk on his face, \"Youkla telph me.\"\r\n", -1, NULL, 0, NULL);
295 296 297 298 299 300
	    	break;
	}

	return(codeStr-origCodeStr);;
}

deuce's avatar
deuce committed
301
static void getBlock(unsigned char **codeStr, char *menuBlock)
302 303 304 305
{
	menuBlock[0]=0;
	if(**codeStr=='_')
		(*codeStr)++;
306
	while(**codeStr && **codeStr != '_' && **codeStr != '|') {
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
		*(menuBlock++) = *((*codeStr)++);
		*menuBlock=0;
	}
}

static void strljust(char *buf, size_t len, char pad)
{
	size_t buflen=strlen(buf);

	if(buflen < len) {
		memset(buf+buflen, pad, len-buflen);
		buf[len]=0;
	}
}

static void strrjust(char *buf, size_t len, char pad)
{
	size_t buflen=strlen(buf);

	if(buflen < len) {
		memmove(buf+(len-buflen), buf, buflen+1);
		memset(buf, pad, len-buflen);
	}
}

deuce's avatar
deuce committed
332
static int readSmallMenu(unsigned char *codeStr) {
333 334 335 336 337 338 339 340 341 342 343 344
	#define MultA 2
	#define MultE 3
	#define MultS 3
	#define MultW 2

	long aPrice[5]={0,4500,14500,29000,42500};
	long ePrice[13]={0,50,200,300,500,800,1000,1500,1750,2000,3000,5000,15000};
	long sPrice[3]={0,4500,13500};
	long wPrice[15]={0,700,4250,9500,18000,32500,55750,0,7500,12000,19250,30500,41000,64750,0};

	char tempBlock[255];
	char menuBlock[255];
deuce's avatar
deuce committed
345
	int  yy;
346
	int  zz;
deuce's avatar
deuce committed
347
	unsigned char *origCodeStr=codeStr;
348
	char buf[260];
349 350 351

	switch ((char)codeStr[0]) {
		case 'a':
352
			term_setattr(LIGHTGREEN);
353
			cterm_write(cterm, "Supply Room\r\n", -1, NULL, 0, NULL);
354
			term_setattr(GREEN);
355
			cterm_write(cterm, "~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
356
			term_setattr(LIGHTCYAN);
357 358 359 360 361 362 363 364
			cterm_write(cterm, "-[A]  Armor\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[E]  Equipment\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[P]  Power Supply/Ammo\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Suits/Outfits\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[W]  Weapons\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[I]  Supply Inventory\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[C]  Check\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to HQ\r\n\r\n", -1, NULL, 0, NULL);
365
			term_setattr(LIGHTBLUE);
366
			cterm_write(cterm, "-<Supply Room>   ", -1, NULL, 0, NULL);
367 368 369
			break;

		case 'b':
370
			term_setattr(WHITE);
371
			cterm_write(cterm, "Recruit Chambers\r\n", -1, NULL, 0, NULL);
372
			term_setattr(RED);
373
			cterm_write(cterm, "~~~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
374
			term_setattr(LIGHTCYAN);
375 376 377 378 379 380 381 382
			cterm_write(cterm, "-[A]  Adjust Specs\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[C]  Check Status\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[M]  Morgue Listing\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[R]  Roster Status\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[T]  Training Room\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[U]  Use Equipment\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[V]  View Recruit\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Exit to Barracks\r\n\r\n", -1, NULL, 0, NULL);
383
			term_setattr(LIGHTBLUE);
384
			cterm_write(cterm, "-<Chambers>   ", -1, NULL, 0, NULL);
385 386 387
			break;

		case 'c':
388
			term_setattr(LIGHTMAGENTA);
389
			cterm_write(cterm, "Adjust Specifications:\r\n", -1, NULL, 0, NULL);
390
			term_setattr(MAGENTA);
391
			cterm_write(cterm, "~~~~~~~~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
392
			term_setattr(LIGHTGREEN);
393 394 395 396 397 398 399 400 401 402
			cterm_write(cterm, "-[A]  Ansi Color On/Off\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[C]  Combat Action/Stat-Random\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[D]  Disable/Enable Ansiterm\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[E]  Expert Menus On/Off\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[F]  Fight-Text Delay Change\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[P]  Password Change\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[Q]  Quote for Combat\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Scanner Scroll/Stationary\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[T]  Terminate Yourself\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Exit\r\n\r\n", -1, NULL, 0, NULL);
403
			term_setattr(LIGHTBLUE);
404
			cterm_write(cterm, "-<Specs>   ", -1, NULL, 0, NULL);
405 406 407 408 409
			break;

		case 'd':
			codeStr++;

410
			term_setattr(LIGHTMAGENTA);
411
			cterm_write(cterm, "Storage Bank:\r\n", -1, NULL, 0, NULL);
412
			term_setattr(MAGENTA);
413
			cterm_write(cterm, "~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
414
			term_setattr(WHITE);
415

416
			cterm_write(cterm, "Crystals in Savings : ", -1, NULL, 0, NULL);
417 418
			getBlock(&codeStr,menuBlock);
			strcat(menuBlock,"\r\n");
419
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
420

421
			cterm_write(cterm, "Crystals on Loan    : ", -1, NULL, 0, NULL);
422 423
			getBlock(&codeStr,menuBlock);
			strcat(menuBlock,"\r\n");
424
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
425

426
			cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
427
			term_setattr(LIGHTCYAN);
428

429 430 431 432
			cterm_write(cterm, "-[D]  Deposit\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[W]  Withdraw\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[L]  Make a Loan\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[P]  Pay off Loan\r\n", -1, NULL, 0, NULL);
433 434 435 436

			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
			if (zz>0)
437
				cterm_write(cterm, "-[S]  Squadron Account\r\n", -1, NULL, 0, NULL);
438

439 440
			cterm_write(cterm, "-[T]  Transfer Crystals\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Exit to Chambers\r\n\r\n", -1, NULL, 0, NULL);
441 442

			getBlock(&codeStr,menuBlock);
443
			term_setattr(WHITE);
444

445 446 447
			cterm_write(cterm, "You have ", -1, NULL, 0, NULL);
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
			cterm_write(cterm, " crystals onhand.\r\n\r\n", -1, NULL, 0, NULL);
448
			term_setattr(LIGHTBLUE);
449
			cterm_write(cterm, "-<Bank>   ", -1, NULL, 0, NULL);
450 451 452 453 454
			break;

		case 'e' :
			codeStr++;

455
			term_setattr(YELLOW);
456 457
			cterm_write(cterm, "You are now in the Games Room, a delightful place to leisurely relax from\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "the everyday hack n' slash.   A small bar is located on the south wall.\r\n\r\n", -1, NULL, 0, NULL);
458

459
			term_setattr(WHITE);
460
			getBlock(&codeStr,menuBlock);
461
			cterm_write(cterm, "Games Left :[ ", -1, NULL, 0, NULL);
462
			term_setattr(LIGHTCYAN);
463 464
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
			cterm_write(cterm, "\r\n\r\n", -1, NULL, 0, NULL);
465
			term_setattr(LIGHTGREEN);
466

467 468 469 470 471 472 473
			cterm_write(cterm, "-[A]  Arm Wrestling\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[B]  Barl's Bar\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[L]  Loot Crystals\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[M]  Meat Darts\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[R]  Roach Races\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  SharpShooter\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Exit to Barracks\r\n\r\n", -1, NULL, 0, NULL);
474

475
			term_setattr(LIGHTBLUE);
476
			cterm_write(cterm, "-<Games Room>   ", -1, NULL, 0, NULL);
477 478 479 480 481
			break;

		case 'f' :
			codeStr++;

482 483
			term_setattr(WHITE); cterm_write(cterm, "Sentry Post\r\n", -1, NULL, 0, NULL);
			term_setattr(RED); cterm_write(cterm, "~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
484
			term_setattr(LIGHTCYAN);
485 486 487 488 489

			getBlock(&codeStr,menuBlock);
			yy=atoi(menuBlock);
			if (yy>0) {

490 491 492
				cterm_write(cterm, "-[O]  Offer Guard Items\r\n\r\n", -1, NULL, 0, NULL);
				cterm_write(cterm, "-[V]  View Gate Guard\r\n", -1, NULL, 0, NULL);
				cterm_write(cterm, "-[U]  Upgrade Gate Guard\r\n", -1, NULL, 0, NULL);
493 494
			}
			else
495
				cterm_write(cterm, "-[R]  Requisition New Guard\r\n", -1, NULL, 0, NULL);
496

497 498
			cterm_write(cterm, "-[C]  Check Your Status\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Exit to Barracks\r\n\r\n", -1, NULL, 0, NULL);
499
			term_setattr(LIGHTBLUE);
500
			cterm_write(cterm, "-<Sentry Post>   ", -1, NULL, 0, NULL);
501 502 503 504 505
			break;

		case 'g':
			codeStr++;

506 507
			term_setattr(WHITE); cterm_write(cterm, "Electronic-Mail\r\n", -1, NULL, 0, NULL);
			term_setattr(LIGHTGRAY);   cterm_write(cterm, "~~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
508 509 510 511

			getBlock(&codeStr,menuBlock);

			if (menuBlock[0]>48) {
512
				term_setattr(YELLOW);
513
				cterm_write(cterm, "-[M]  Mass Mail to Squadron\r\n\r\n", -1, NULL, 0, NULL);
514 515
			}

516
			term_setattr(LIGHTCYAN);
517 518 519
			cterm_write(cterm, "-[R]  Read E-Mail\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Send E-Mail\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to Comm. Post\r\n\r\n", -1, NULL, 0, NULL);
520
			term_setattr(LIGHTBLUE);
521
			cterm_write(cterm, "-<E-Mail>   ", -1, NULL, 0, NULL);
522 523 524
			break;

		case 'h':
525
			term_setattr(LIGHTCYAN);
526
			cterm_write(cterm, "\r\nHelp Information:\r\n", -1, NULL, 0, NULL);
527
			term_setattr(CYAN);
528 529 530 531 532 533 534 535 536
			cterm_write(cterm, "~~~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(WHITE);
			cterm_write(cterm, "-[1]  Scenario\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[2]  Character\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[3]  Complex\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[4]  Wastelands\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[5]  Bases\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[6]  Bulletin Info\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[7]  Logon News Info\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[0]  Exit\r\n\r\n", -1, NULL, 0, NULL);
537 538 539 540 541
			break;

		case 'i':
			codeStr++;

542 543
			term_setattr(LIGHTCYAN); cterm_write(cterm, "Medical Center\r\n", -1, NULL, 0, NULL);
			term_setattr(CYAN);   cterm_write(cterm, "~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(LIGHTGREEN);
544

545
			cterm_write(cterm, "Radiation   :[ ", -1, NULL, 0, NULL);
546 547 548
			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
			if (zz<44)
549
				term_setattr(WHITE);
550
			else
551
				term_setattr(LIGHTRED);
552
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL); cterm_write(cterm, "%\r\n", -1, NULL, 0, NULL);
553

554
			term_setattr(LIGHTGREEN);
555
			cterm_write(cterm, "Hit Points  :[ ", -1, NULL, 0, NULL);
556 557 558
			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
			if (zz>5)
559
				term_setattr(WHITE);
560
			else
561
				term_setattr(LIGHTRED);
562

563
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
564
			getBlock(&codeStr,menuBlock);
565 566 567
			cterm_write(cterm, " (", -1, NULL, 0, NULL);
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
			cterm_write(cterm, ")\r\n", -1, NULL, 0, NULL);
568

569
			term_setattr(LIGHTGREEN);
570
			cterm_write(cterm, "Infectious  :[ ", -1, NULL, 0, NULL);
571 572
			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
573
			term_setattr(WHITE);
574

575
			cterm_write(cterm, diseases[zz], -1, NULL, 0, NULL); cterm_write(cterm, "\r\n\r\n", -1, NULL, 0, NULL);
576
			term_setattr(CYAN);
577

578 579 580 581 582
			cterm_write(cterm, "-[M]  Medical Treatment\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[R]  Radiation Treatment\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[N]  Neutralize Disease\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[V]  Vaccinate Disease\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to HQ\r\n\r\n", -1, NULL, 0, NULL);
583
			term_setattr(LIGHTBLUE);
584
			cterm_write(cterm, "-<Medical Center>   ", -1, NULL, 0, NULL);
585 586 587
			break;

		case 'j' :
588
			term_setattr(LIGHTMAGENTA);
589 590 591 592 593 594 595 596 597 598 599 600 601
			cterm_write(cterm, "Records Room\r\n", -1, NULL, 0, NULL);
			term_setattr(MAGENTA);   cterm_write(cterm, "~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(LIGHTGREEN);
			cterm_write(cterm, "-[A]  Total Ability\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[B]  Bravery\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[C]  Combat Accuracy\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[E]  Experience\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[K]  Total Kills\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[O]  Owned Crystals\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[P]  Power\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Squadrons\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[W]  Wealth\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[H]  Hall of Fame\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to HQ\r\n\r\n", -1, NULL, 0, NULL);
602
			term_setattr(LIGHTBLUE);
603
			cterm_write(cterm, "-<Records>   ", -1, NULL, 0, NULL);
604 605 606 607 608
			break;

		case 'k':
			codeStr++;

609 610
			term_setattr(LIGHTGREEN); cterm_write(cterm, "Supply Armor\r\n", -1, NULL, 0, NULL);
			term_setattr(GREEN);  cterm_write(cterm, "~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);  term_setattr(WHITE);
611 612 613

			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
614 615
			cterm_write(cterm, armors[zz], -1, NULL, 0, NULL);
			cterm_write(cterm, " / ", -1, NULL, 0, NULL);
616
			getBlock(&codeStr,menuBlock);
617 618
			cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
			cterm_write(cterm, " Hits\r\n\r\n", -1, NULL, 0, NULL);
619

620
			term_setattr(LIGHTCYAN);
621 622 623
			cterm_write(cterm, "-[B]  Buy Armor\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Sell Armor\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to Supply Room\r\n\r\n", -1, NULL, 0, NULL);
624
			term_setattr(LIGHTBLUE);
625
			cterm_write(cterm, "-<Supply Armor>   ", -1, NULL, 0, NULL);
626 627 628 629 630 631
			break;

		case 'l':
			codeStr++;
			getBlock(&codeStr,menuBlock);

632
			term_setattr(LIGHTBLUE);
633 634
			cterm_write(cterm, "Armor Types           Hits     Crystals\r\n", -1, NULL, 0, NULL); term_setattr(CYAN);
			cterm_write(cterm, "~~~~~~~~~~~           ~~~~     ~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(LIGHTCYAN);
635 636 637 638

			for (zz=1;zz<5;zz++) {
				sprintf(buf,"-[%d]  - %s",zz,armors[zz]);
				strljust(buf,23,' ');
639
				cterm_write(cterm, buf, -1, NULL, 0, NULL);
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656

				switch (zz) {
					case 1:
						sprintf(buf,"50");
						break;
					case 2:
						sprintf(buf,"80");
						break;
					case 3:
						sprintf(buf,"110");
						break;
					case 4:
						sprintf(buf,"150");
						break;

				}
				strrjust(buf,3,' ');
657
				cterm_write(cterm, buf, -1, NULL, 0, NULL);
658 659 660 661 662 663 664 665


				if (menuBlock[0]==48)
					sprintf(buf,"%ld",aPrice[zz]);
				else
					sprintf(buf,"%ld",aPrice[zz]*MultA);

				strrjust(buf,13,' ');
666
				cterm_write(cterm, buf, -1, NULL, 0, NULL); cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
667 668 669 670 671 672 673
			}
			break;


		case 'm' : codeStr++;

			if (codeStr[0]=='1') {
674 675
				term_setattr(LIGHTGREEN); cterm_write(cterm, "Supply Equipment\r\n", -1, NULL, 0, NULL);
				term_setattr(GREEN);  cterm_write(cterm, "~~~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
676 677
			}
			else {
678
				term_setattr(LIGHTCYAN);
679 680 681
				cterm_write(cterm, "\r\n-[B]  Buy Equipment\r\n", -1, NULL, 0, NULL);
				cterm_write(cterm, "-[S]  Sell Equipment\r\n\r\n", -1, NULL, 0, NULL);
				cterm_write(cterm, "-[*]  Back to Supply Room\r\n\r\n", -1, NULL, 0, NULL);
682
				term_setattr(LIGHTBLUE);
683
				cterm_write(cterm, "-<Supply Equip>   ", -1, NULL, 0, NULL);
684 685 686 687 688 689
			}
			break;

		case 'n' : codeStr++;
			getBlock(&codeStr,menuBlock);

690
			term_setattr(LIGHTBLUE);
691 692
			cterm_write(cterm, "Equipment                 Crystals\r\n", -1, NULL, 0, NULL); term_setattr(CYAN);
			cterm_write(cterm, "~~~~~~~~~                 ~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(LIGHTCYAN);
693 694 695 696 697 698 699 700

			for (zz=1;zz<13;zz++) {
				if (zz<=9)
					sprintf(buf,"-[%d]  - %s",zz,equips[zz]);
				else
					sprintf(buf,"-[%d] - %s",zz,equips[zz]);

				strljust(buf,28,' ');
701
				cterm_write(cterm, buf, -1, NULL, 0, NULL);
702 703 704 705 706 707 708

				if (menuBlock[0]==48)
					sprintf(buf,"%ld",ePrice[zz]);
				else
					sprintf(buf,"%ld",ePrice[zz]*MultE);

				strrjust(buf,6,' ');
709
				cterm_write(cterm, buf, -1, NULL, 0, NULL); cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
710 711
			}

712
			cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
713 714 715 716 717 718 719
			break;

		case 'o':
			codeStr++;
			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);

720 721 722 723
			term_setattr(LIGHTGREEN); cterm_write(cterm, "Supply Suits\r\n", -1, NULL, 0, NULL);
			term_setattr(GREEN);  cterm_write(cterm, "~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL);
			term_setattr(WHITE);  cterm_write(cterm, "Suit : ", -1, NULL, 0, NULL);
			cterm_write(cterm, suits[zz], -1, NULL, 0, NULL);
724

725
			term_setattr(LIGHTCYAN);
726 727 728
			cterm_write(cterm, "\r\n\r\n-[B]  Buy a Suit\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Sell a Suit\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to Supply Room\r\n\r\n", -1, NULL, 0, NULL);
729
			term_setattr(LIGHTBLUE);
730
			cterm_write(cterm, "-<Supply Suits>   ", -1, NULL, 0, NULL);
731 732 733 734 735 736
			break;

		case 'p' :
			codeStr++;
			getBlock(&codeStr,menuBlock);

737 738
			term_setattr(LIGHTBLUE); cterm_write(cterm, "Suits/Outfits               Crystals\r\n", -1, NULL, 0, NULL);
			term_setattr(CYAN);  cterm_write(cterm, "~~~~~~~~~~~~~               ~~~~~~~~\r\n", -1, NULL, 0, NULL);
739
			term_setattr(LIGHTCYAN);
740 741 742 743

			for (zz=1;zz<3;zz++) {
				sprintf(buf,"-[%d]  - %s",zz,suits[zz]);
				strljust(buf,30,' ');
744
				cterm_write(cterm, buf, -1, NULL, 0, NULL);
745 746 747 748 749 750 751

				if (menuBlock[0]==48)
					sprintf(buf,"%ld",sPrice[zz]);
				else
					sprintf(buf,"%ld",sPrice[zz]*MultS);

				strrjust(buf,6,' ');
752
				cterm_write(cterm, buf, -1, NULL, 0, NULL); cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
753 754 755 756 757
			}
			break;

		case 'q' : codeStr++;

758 759
			term_setattr(LIGHTGREEN);  cterm_write(cterm, "Supply Weapons\r\n", -1, NULL, 0, NULL);
			term_setattr(GREEN);   cterm_write(cterm, "~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(WHITE);
760 761 762 763

			for (yy=1;yy<3;yy++) {
				getBlock(&codeStr,menuBlock);
				zz=atoi(menuBlock);
764
				cterm_write(cterm, weapons[zz], -1, NULL, 0, NULL); cterm_write(cterm, " / ", -1, NULL, 0, NULL);
765 766
				getBlock(&codeStr,menuBlock);
				zz=atoi(menuBlock);
767
				cterm_write(cterm, ammos[zz], -1, NULL, 0, NULL); cterm_write(cterm, " / ", -1, NULL, 0, NULL);
768
				getBlock(&codeStr,menuBlock);
769
				cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);  cterm_write(cterm, " Rds\r\n", -1, NULL, 0, NULL);
770 771
			}

772
			term_setattr(LIGHTCYAN);
773 774 775
			cterm_write(cterm, "\r\n-[B]  Buy Weapon\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[S]  Sell Weapon\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[*]  Back to Supply Room\r\n\r\n", -1, NULL, 0, NULL);
776
			term_setattr(LIGHTBLUE);
777
			cterm_write(cterm, "-<Supply Weapons>   ", -1, NULL, 0, NULL);
778 779 780 781 782
			break;

		case 'r' : codeStr++;
			getBlock(&codeStr,menuBlock);

783 784
			term_setattr(LIGHTBLUE); cterm_write(cterm, "Hand-to-Hand Weapons        Crystals\r\n", -1, NULL, 0, NULL);
			term_setattr(CYAN);  cterm_write(cterm, "~~~~~~~~~~~~~~~~~~~~        ~~~~~~~~\r\n", -1, NULL, 0, NULL);
785
			term_setattr(LIGHTCYAN);
786 787 788 789

			for (zz=1;zz<7;zz++) {
				sprintf(buf,"-[%d]  - %s",zz,weapons[zz]);
				strljust(buf,30,' ');
790
				cterm_write(cterm, buf, -1, NULL, 0, NULL);
791 792 793 794 795 796 797

				if (menuBlock[0]==48)
					sprintf(buf,"%ld",wPrice[zz]);
				else
					sprintf(buf,"%ld",wPrice[zz]*MultW);

				strrjust(buf,6,' ');
798
				cterm_write(cterm, buf, -1, NULL, 0, NULL); cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
799 800
			}

801 802
			term_setattr(LIGHTBLUE); cterm_write(cterm, "\r\nLong-Range Weapons          Crystals\r\n", -1, NULL, 0, NULL);
			term_setattr(CYAN);  cterm_write(cterm, "~~~~~~~~~~~~~~~~~~          ~~~~~~~~\r\n", -1, NULL, 0, NULL);
803
			term_setattr(LIGHTCYAN);
804 805 806 807 808 809 810 811

			for (zz=7;zz<13;zz++) {
				if (zz<10)
					sprintf(buf,"-[%d]  - %s",zz,weapons[zz+1]);
				else
					sprintf(buf,"-[%d] - %s",zz,weapons[zz+1]);

				strljust(buf,30,' ');
812
				cterm_write(cterm, buf, -1, NULL, 0, NULL);
813 814 815 816 817 818 819

				if (menuBlock[0]==48)
					sprintf(buf,"%ld",wPrice[zz+1]);
				else
					sprintf(buf,"%ld",wPrice[zz+1]*MultW);

				strrjust(buf,6,' ');
820
				cterm_write(cterm, buf, -1, NULL, 0, NULL);  cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
821 822 823 824 825 826 827
			}
			break;

		case 's' : codeStr++;
			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);

828 829
			term_setattr(LIGHTGREEN); cterm_write(cterm, "Squadrons Menu\r\n", -1, NULL, 0, NULL);
			term_setattr(GREEN);  cterm_write(cterm, "~~~~~~~~~~~~~~\r\n", -1, NULL, 0, NULL); term_setattr(LIGHTCYAN);
830

831
			cterm_write(cterm, "-[S]  Show Squadrons/Leaders\r\n", -1, NULL, 0, NULL);
832 833

			if (zz>0)
834 835
				cterm_write(cterm, "-[M]  Show Squadron Members\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
836 837

			if (zz==0)
838
				cterm_write(cterm, "-[D]  Declare a Squadron\r\n", -1, NULL, 0, NULL);
839 840
			else
			if (zz<10)
841
				cterm_write(cterm, "-[Q]  Quit your Squadron\r\n", -1, NULL, 0, NULL);
842
			else
843
				cterm_write(cterm, "-[L]  Leader Options\r\n", -1, NULL, 0, NULL);
844 845

			if (zz==0)
846
				cterm_write(cterm, "-[R]  Recruit to a Squadron\r\n", -1, NULL, 0, NULL);
847

848
			cterm_write(cterm, "\r\n-[*]  Return to HQ\r\n\r\n", -1, NULL, 0, NULL);
849

850
			term_setattr(LIGHTBLUE); cterm_write(cterm, "-<Squadrons>   ", -1, NULL, 0, NULL);
851 852 853 854 855
			break;

		case 't' : codeStr++;
			getBlock(&codeStr,menuBlock);

856 857
			term_setattr(WHITE); cterm_write(cterm, "Sighting : ", -1, NULL, 0, NULL);
			term_setattr(LIGHTMAGENTA); cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
858
			term_setattr(LIGHTCYAN);
859

860
			cterm_write(cterm, "\r\n\r\n-[L]  ", -1, NULL, 0, NULL);
861
			term_setattr(CYAN);
862 863
			cterm_write(cterm, "Long-Range Combat\r\n", -1, NULL, 0, NULL);
			term_setattr(LIGHTCYAN); cterm_write(cterm, "-[H]  ", -1, NULL, 0, NULL);
864
			term_setattr(CYAN);
865
			cterm_write(cterm, "Hand-to-Hand Combat\r\n", -1, NULL, 0, NULL);
866 867 868 869 870

			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);

			if (!zz) {
871 872
				term_setattr(LIGHTCYAN); cterm_write(cterm, "-[R]  ", -1, NULL, 0, NULL);
				term_setattr(CYAN);   cterm_write(cterm, "Run like hell!\r\n", -1, NULL, 0, NULL);
873 874
			}

875 876 877 878
			term_setattr(LIGHTCYAN); cterm_write(cterm, "\r\n-[C]  ", -1, NULL, 0, NULL); term_setattr(MAGENTA); cterm_write(cterm, "Check Status\r\n", -1, NULL, 0, NULL);
			term_setattr(LIGHTCYAN); cterm_write(cterm,   "-[V]  ", -1, NULL, 0, NULL); term_setattr(MAGENTA); cterm_write(cterm, "View Opponent\r\n\r\n", -1, NULL, 0, NULL);
			term_setattr(LIGHTCYAN); cterm_write(cterm,   "-[M]  ", -1, NULL, 0, NULL); term_setattr(LIGHTGRAY); cterm_write(cterm, "Toggle Combat Modes\r\n\r\n", -1, NULL, 0, NULL);
			term_setattr(LIGHTBLUE);  cterm_write(cterm, "-<Combat>   ", -1, NULL, 0, NULL);
879 880 881 882 883 884 885
			break;


		case 'u' : codeStr++;
			getBlock(&codeStr,menuBlock);
			strcpy(tempBlock,menuBlock);

886 887 888
			term_setattr(WHITE);  cterm_write(cterm, "Camp :[ ", -1, NULL, 0, NULL);
			term_setattr(LIGHTGREEN); cterm_write(cterm, menuBlock, -1, NULL, 0, NULL);
			term_setattr(WHITE);  cterm_write(cterm, " ]:\r\n", -1, NULL, 0, NULL); term_setattr(RED);
889

890 891
			for (zz=0;zz<(10+strlen(menuBlock));zz++) cterm_write(cterm, "~", -1, NULL, 0, NULL);
			cterm_write(cterm, "\r\n", -1, NULL, 0, NULL);
892

893
			term_setattr(CYAN);
894 895 896
			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
			if (zz>0)
897
				cterm_write(cterm, "-[A]  Attack recruit\r\n", -1, NULL, 0, NULL);
898

899
			cterm_write(cterm, "-[L]  Leave a message\r\n\r\n", -1, NULL, 0, NULL);
900 901 902 903

			getBlock(&codeStr,menuBlock);
			zz=atoi(menuBlock);
			if (!zz)
904
				cterm_write(cterm, "-[B]  Borrow camper's items\r\n", -1, NULL, 0, NULL);
905
			else
906
				cterm_write(cterm, "-[S]  Steal camper's items\r\n", -1, NULL, 0, NULL);
907

908 909 910
			cterm_write(cterm, "-[G]  Give camper items\r\n\r\n", -1, NULL, 0, NULL);
			cterm_write(cterm, "-[V]  View ", -1, NULL, 0, NULL);
			cterm_write(cterm, tempBlock, -1, NULL, 0, NULL);
911

912 913 914