Download this file

41003 lines (37033 with data), 1.3 MB

////////////////////////////////////////////////////////////////////////////////////////// // // //Copyright (c) 2002,2003,2004 by Tarn Adams // // // ////////////////////////////////////////////////////////////////////////////////////////// //This file is part of Liberal Crime Squad. // // // // Liberal Crime Squad is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // Liberal Crime Squad is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with Liberal Crime Squad; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ////////////////////////////////////////////////////////////////////////////////////////// /* Windows will use original Windows API Code unless GO_PORTABLE is defined * (this will need to be defined in you Makefile/Visual C++ Project), in which * case the portable routines will be used instead. */ #ifdef WIN32 #include <windows.h> #include <string.h> //Visual C++ .NET (7) includes the STL with vector, so we //will use that, otherwise the HP STL Vector.h will be used. #ifdef __MINGW32__ #include <iostream> #include <fstream> #include <vector> #include <io.h> //needed for unlink() #else #if _MSC_VER > 1200 #define WIN32_DOTNET #include <iostream> #include <fstream> #include <vector> #else #define WIN32_PRE_DOTNET #include <iostream.h> #include <fstream.h> #include "vector.h" #endif #endif #include "curses.h" //undo PDCurses macros that break vector class #undef erase #undef clear #define CH_USE_CP437 #else #include <vector> #include <string.h> #include <iostream> #include <fstream> #include <ctype.h> #define GO_PORTABLE #define CH_USE_ASCII_HACK #ifdef XCURSES #define HAVE_PROTO 1 #define CPLUSPLUS 1 /* Try these PDCurses/Xcurses options later... #define FAST_VIDEO #define REGISTERWINDOWS */ #include <xcurses.h> //This is the X11 Port of PDCurses //undo PDCurses macros that break vector class #undef erase #undef clear #else #ifdef NCURSES #include <ncurses.h> #else #include <curses.h> #endif #endif #endif /* Headers for Portability */ #ifdef GO_PORTABLE #include <time.h> #ifdef Linux // And BSD and SVr4 #include <unistd.h> #include <sys/time.h> #include <signal.h> #endif #endif using namespace std; #include "lcsio.h" #include "compat.h" #include "cursesmovie.h" #include "cursesgraphics.h" CursesMoviest movie; unsigned char bigletters[27][5][7][4]; unsigned char newstops[5][80][5][4]; unsigned char newspic[20][78][18][4]; //outstanding issues //site trucker-type bug still happens (latte-stand) //might have to do with missing location in the verifyworklocation() loop //but cannot locate instance of this //can have hostage in court? //changes 3.10 alpha 1 //added AZERTY keyboard support //added bullet-proof vests //added SWAT units //reduced chance of hitting bystanders //added multiple hit chances for automatic weapons //added extra hit probability for shotguns //removed sever types from handguns and knives //fixed bug in newspaper site emphasis //reduced fence values for armor //sleepers can warn before raids //courts made more difficult //hacking harder, a little less rewarding //sleeper overhaul //dating conservatives, kidnapping on dates more risky //made it easier to maintain LCS integrity when someone high up is arrested //changed version variable to 31001 //changes 3.09 //udistrict -> outoftown for the outskirts location //in advanceday(), made people going on vacation drop off squad loot //if they are the last person in their squad (or else it would be deleted) //added a function to every instance where a vehicle is deleted that //makes sure that the liberal car preferences are nullified //update version number on the title screen //changed version variable to 30900 //changed activesquad to squad[sq] in one portion of the squad movement code //added a tweak to verifyworklocation(), but problem probably still exists //changes 3.08 //siegetype occurred many times where it shouldn't have in a majornewspaper() if statement //added loitering offense if no other offense exists //fixed the wheelchair bug in assemblesquad() //OUTSTANDING ISSUES: //possible bug with hauling people //somebody claims saving works only 3/4 of the time (no confirmation) //somebody claims squads don't move (sounds like older version bug, they haven't told me version) //#define NOENEMYATTACK //#define SHITLAWS //#define GIVEBLOODYARMOR //#define HIGHFUNDS //#define AUTOENLIGHTEN //#define SHOWWAIT #define BIT1 1 #define BIT2 2 #define BIT3 4 #define BIT4 8 #define BIT5 16 #define BIT6 32 #define BIT7 64 #define BIT8 128 #define BIT9 256 #define BIT10 512 #define BIT11 1024 #define BIT12 2048 #define BIT13 4096 #define BIT14 8192 #define BIT15 16384 #define BIT16 32768 unsigned long seed; unsigned long r_num(void); long LCSrandom(unsigned long max); enum UnlockTypes { UNLOCK_DOOR, UNLOCK_CAGE, UNLOCK_SAFE, UNLOCKNUM }; enum BashTypes { BASH_DOOR, BASHNUM }; enum HackTypes { HACK_SUPERCOMPUTER, HACKNUM }; enum SpecialAttacks { ATTACK_CANNON, ATTACK_FLAME, ATTACK_SUCK, ATTACKNUM }; enum SiteTypes { SITE_DOWNTOWN, SITE_UDISTRICT, SITE_OUTOFTOWN, SITE_INDUSTRIAL, SITE_RESIDENTIAL_TENEMENT, SITE_RESIDENTIAL_APARTMENT, SITE_RESIDENTIAL_APARTMENT_UPSCALE, SITE_RESIDENTIAL_SHELTER, SITE_LABORATORY_COSMETICS, SITE_LABORATORY_GENETIC, SITE_HOSPITAL_CLINIC, SITE_HOSPITAL_UNIVERSITY, SITE_GOVERNMENT_POLICESTATION, SITE_GOVERNMENT_COURTHOUSE, SITE_GOVERNMENT_PRISON, SITE_GOVERNMENT_INTELLIGENCEHQ, SITE_INDUSTRY_SWEATSHOP, SITE_INDUSTRY_POLLUTER, SITE_INDUSTRY_NUCLEAR, SITE_INDUSTRY_WAREHOUSE, SITE_CORPORATE_HEADQUARTERS, SITE_CORPORATE_HOUSE, SITE_MEDIA_AMRADIO, SITE_MEDIA_CABLENEWS, SITE_BUSINESS_PAWNSHOP, SITE_BUSINESS_CRACKHOUSE, SITE_BUSINESS_JUICEBAR, SITE_BUSINESS_CIGARBAR, SITE_BUSINESS_LATTESTAND, SITE_BUSINESS_VEGANCOOP, SITE_BUSINESS_INTERNETCAFE, SITE_BUSINESS_DEPTSTORE, SITE_BUSINESS_HALLOWEEN, SITENUM }; enum CreatureTypes { CREATURE_SECURITYGUARD, CREATURE_SCIENTIST_LABTECH, CREATURE_SCIENTIST_EMINENT, CREATURE_CORPORATE_MANAGER, CREATURE_CORPORATE_CEO, CREATURE_WORKER_SERVANT, CREATURE_WORKER_JANITOR, CREATURE_WORKER_SWEATSHOP, CREATURE_WORKER_FACTORY_NONUNION, CREATURE_WORKER_FACTORY_CHILD, CREATURE_WORKER_SECRETARY, CREATURE_WORKER_FACTORY_UNION, CREATURE_LANDLORD, CREATURE_TEENAGER, CREATURE_COP, CREATURE_SWAT, CREATURE_DEATHSQUAD, CREATURE_EDUCATOR, CREATURE_GANGUNIT, CREATURE_JUDGE_LIBERAL, CREATURE_JUDGE_CONSERVATIVE, CREATURE_AGENT, CREATURE_RADIOPERSONALITY, CREATURE_NEWSANCHOR, CREATURE_GENETIC, CREATURE_GUARDDOG, CREATURE_PRISONER, CREATURE_JUROR, CREATURE_LAWYER, CREATURE_SEWERWORKER, CREATURE_COLLEGESTUDENT, CREATURE_MUSICIAN, CREATURE_MATHEMATICIAN, CREATURE_TEACHER, CREATURE_HSDROPOUT, CREATURE_BUM, CREATURE_GANGMEMBER, CREATURE_CRACKHEAD, CREATURE_PRIEST, CREATURE_ENGINEER, CREATURE_FASTFOODWORKER, CREATURE_TELEMARKETER, CREATURE_OFFICEWORKER, CREATURE_FOOTBALLCOACH, CREATURE_PROSTITUTE, CREATURE_MAILMAN, CREATURE_GARBAGEMAN, CREATURE_PLUMBER, CREATURE_CHEF, CREATURE_CONSTRUCTIONWORKER, CREATURE_AMATEURMAGICIAN, CREATURE_TANK, CREATURE_MERC, CREATURE_HICK, CREATURE_SOLDIER, CREATURE_PRISONGUARD, CREATURE_HIPPIE, CREATURE_CRITIC_ART, CREATURE_CRITIC_MUSIC, CREATURE_SOCIALITE, CREATURE_PROGRAMMER, CREATURE_RETIREE, CREATURE_PAINTER, CREATURE_SCULPTOR, CREATURE_AUTHOR, CREATURE_JOURNALIST, CREATURE_DANCER, CREATURE_PHOTOGRAPHER, CREATURE_CAMERAMAN, CREATURE_HAIRSTYLIST, CREATURE_FASHIONDESIGNER, CREATURE_CLERK, CREATURE_THIEF, CREATURE_ACTOR, CREATURE_YOGAINSTRUCTOR, CREATURE_ATHLETE, CREATURE_BIKER, CREATURE_TRUCKER, CREATURE_TAXIDRIVER, CREATURE_NUN, CREATURE_MUTANT, CREATURENUM }; enum Attributes { ATTRIBUTE_STRENGTH, ATTRIBUTE_INTELLIGENCE, ATTRIBUTE_WISDOM, ATTRIBUTE_AGILITY, ATTRIBUTE_HEALTH, ATTRIBUTE_CHARISMA, ATTRIBUTE_HEART, ATTNUM }; enum Skills { SKILL_HANDTOHAND, SKILL_KNIFE, SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_SPEAR, SKILL_PISTOL, SKILL_RIFLE, SKILL_ASSAULTRIFLE, SKILL_PERSUASION, SKILL_LAW, SKILL_SECURITY, SKILL_DISGUISE, SKILL_COMPUTERS, SKILL_GARMENTMAKING, SKILL_DRIVING, SKILL_WRITING, SKILLNUM }; enum Bodyparts { BODYPART_HEAD, BODYPART_BODY, BODYPART_ARM_RIGHT, BODYPART_ARM_LEFT, BODYPART_LEG_RIGHT, BODYPART_LEG_LEFT, BODYPARTNUM }; #define WOUND_SHOT BIT1 #define WOUND_CUT BIT2 #define WOUND_BRUISED BIT3 #define WOUND_BURNED BIT4 #define WOUND_BLEEDING BIT5 #define WOUND_TORN BIT6 #define WOUND_NASTYOFF BIT7 #define WOUND_CLEANOFF BIT8 enum Weapons { WEAPON_NONE, WEAPON_BASEBALLBAT, WEAPON_CROWBAR, WEAPON_KNIFE, WEAPON_SHANK, WEAPON_SYRINGE, WEAPON_REVOLVER_22, WEAPON_REVOLVER_44, WEAPON_SEMIPISTOL_9MM, WEAPON_SEMIPISTOL_45, WEAPON_AUTORIFLE_M16, WEAPON_AUTORIFLE_AK47, WEAPON_SEMIRIFLE_AR15, WEAPON_CARBINE_M4, WEAPON_SMG_MP5, WEAPON_SHOTGUN_PUMP, WEAPON_SWORD, WEAPON_CHAIN, WEAPON_NIGHTSTICK, WEAPON_GAVEL, WEAPON_AXE, WEAPON_HAMMER, WEAPON_MAUL, WEAPON_CROSS, WEAPON_STAFF, WEAPON_PITCHFORK, WEAPON_TORCH, WEAPONNUM }; struct weaponst { short type; short ammo; char ranged(void) { switch(type) { case WEAPON_REVOLVER_22: case WEAPON_REVOLVER_44: case WEAPON_SEMIPISTOL_9MM: case WEAPON_SEMIPISTOL_45: case WEAPON_AUTORIFLE_M16: case WEAPON_AUTORIFLE_AK47: case WEAPON_SEMIRIFLE_AR15: case WEAPON_CARBINE_M4: case WEAPON_SMG_MP5: case WEAPON_SHOTGUN_PUMP: return 1; } return 0; } }; // *JDS* This should be expanded to cover // any situation in which you want a bullet // proof vest to act as a proper uniform. // eg, security, etc... // // Yes, it would be in some ways cooler to // do it the other way around -- have // body armor be a subtype, and use the // uniform as your main type, but that // would necessitate modifying the names // of the armor pieces across many cases. // // Perhaps I will change this system, // so that there is a flag after the // armor name (like the bloody and damaged // flags) which signals a vest is being // worn underneath, but eh... this should // work for now. enum BallisticVestTypes { BVEST_POLICE, BVEST_MILITARY }; enum MaskTypes { MASK_ASHCROFT, MASK_BARR, MASK_BLAIR, MASK_BUSH_BARBARA, MASK_BUSH_GEORGE, MASK_BUSH_GEORGE2, MASK_CARTER, MASK_CHENEY, MASK_CLINTON_BILL, MASK_CLINTON_HILLARY, MASK_FALWELL, MASK_FORD, MASK_GORE_AL, MASK_GORE_TIPPER, MASK_HELMS, MASK_JASON, MASK_LINCOLN, MASK_KENNEDY_JOHN, MASK_KENNEDY_ROBERT, MASK_KISSINGER, MASK_NIXON, MASK_POWELL, MASK_REAGAN_NANCY, MASK_REAGAN_RONALD, MASK_RICE, MASK_ROBERTSON, MASK_RUMSFELD, MASK_SATAN, MASK_STARR, MASK_THURMOND, MASK_WASHINGTON, MASK_WAXMAN, //SURPRISE MASKS MASK_JESUS, MASK_COLEMAN_GARY, MASK_MADONNA, MASK_SPEARS, MASK_EMINEM, MASK_AGUILERA, MASK_WAHLBERG, MASK_IGGYPOP, MASK_CASH, MASK_BINLADEN, MASK_LORDS, MASK_SHIELDS, MASK_JACKSON_MICHAEL, MASK_CRUTHERS, MASK_KING_DON, MASKNUM }; enum Armors { ARMOR_NONE, ARMOR_CLOTHES, ARMOR_TRENCHCOAT, ARMOR_WORKCLOTHES, ARMOR_SECURITYUNIFORM, ARMOR_POLICEUNIFORM, ARMOR_CHEAPSUIT, ARMOR_EXPENSIVESUIT, ARMOR_BLACKSUIT, ARMOR_CHEAPDRESS, ARMOR_EXPENSIVEDRESS, ARMOR_BLACKDRESS, ARMOR_LABCOAT, ARMOR_BLACKROBE, ARMOR_CLOWNSUIT, ARMOR_BONDAGEGEAR, ARMOR_MASK, ARMOR_MILITARY, ARMOR_PRISONGUARD, ARMOR_PRISONER, ARMOR_TOGA, ARMOR_MITHRIL, ARMOR_OVERALLS, ARMOR_WIFEBEATER, ARMOR_BALLISTICVEST, ARMOR_HEAVYBALLISTICVEST, ARMORNUM }; #define ARMORFLAG_DAMAGED BIT1 #define ARMORFLAG_BLOODY BIT2 struct armorst { short type; short subtype; char quality; unsigned short flag; armorst() { quality='1'; flag=0; } }; enum ClipType { CLIP_9, CLIP_45, CLIP_ASSAULT, CLIP_SMG, CLIP_22, CLIP_44, CLIP_BUCKSHOT, CLIPNUM }; enum LootType { LOOT_LABEQUIPMENT, LOOT_COMPUTER, LOOT_TV, LOOT_SECRETDOCUMENTS, LOOT_CEOPHOTOS, LOOT_INTHQDISK, LOOT_CORPFILES, LOOT_POLICERECORDS, LOOT_VCR, LOOT_CELLPHONE, LOOT_TVCAMERA, LOOT_BROADCASTINGEQUIPMENT, LOOT_SILVERWARE, LOOT_SCANNER, LOOT_PRINTER, LOOT_FINECLOTH, LOOT_CHEMICAL, LOOTNUM }; enum SpecialWounds { SPECIALWOUND_TEETH, SPECIALWOUND_RIGHTEYE, SPECIALWOUND_LEFTEYE, SPECIALWOUND_NOSE, SPECIALWOUND_TONGUE, SPECIALWOUND_RIGHTLUNG, SPECIALWOUND_LEFTLUNG, SPECIALWOUND_HEART, SPECIALWOUND_LIVER, SPECIALWOUND_STOMACH, SPECIALWOUND_RIGHTKIDNEY, SPECIALWOUND_LEFTKIDNEY, SPECIALWOUND_SPLEEN, SPECIALWOUND_RIBS, SPECIALWOUND_NECK, SPECIALWOUND_UPPERSPINE, SPECIALWOUND_LOWERSPINE, SPECIALWOUNDNUM }; #define RIBNUM 10 #define TOOTHNUM 32 /* *JDS* I'm making laws an array instead of a bunch * of bits which are either on or off. Each charge can be * duplicated, for multiple counts, and intense focus * for wanted persons. */ enum Lawflags { LAWFLAG_KIDNAPPING, LAWFLAG_MURDER, LAWFLAG_THEFT, LAWFLAG_BREAKING, LAWFLAG_TERRORISM, LAWFLAG_JURY, LAWFLAG_TREASON, LAWFLAG_ESCAPED, LAWFLAG_HELPESCAPE, LAWFLAG_RESIST, LAWFLAG_BURNFLAG, LAWFLAG_SPEECH, LAWFLAG_VANDALISM, LAWFLAG_ASSAULT, LAWFLAG_CARTHEFT, LAWFLAG_INFORMATION, LAWFLAG_COMMERCE, LAWFLAG_CCFRAUD, LAWFLAG_BROWNIES, LAWFLAG_BURIAL, LAWFLAG_PROSTITUTION, LAWFLAG_DISTURBANCE, LAWFLAG_HIREILLEGAL, LAWFLAG_RACKETEERING, LAWFLAG_LOITERING, LAWFLAG_GUNCARRY, LAWFLAGNUM }; /* *JDS* In addition to laws being an array, * each law will be associated with a "heat" value, * indicating how much that particular crime draws * police attention to the wanted person, and to the * LCS as a whole. This is a global array, available * at runtime and indexed to the lawflag enum, so that * code can dynamically look up these hea t values as * needed at runtime. */ int LawflagHeat[LAWFLAGNUM] = { 128, // LAWFLAG_KIDNAPPING, 64, // LAWFLAG_MURDER, 4, // LAWFLAG_THEFT, 1, // LAWFLAG_BREAKING, 64, // LAWFLAG_TERRORISM, 32, // LAWFLAG_JURY, 128, // LAWFLAG_TREASON, 64, // LAWFLAG_ESCAPED, 32, // LAWFLAG_HELPESCAPE, 1, // LAWFLAG_RESIST, 1, // LAWFLAG_BURNFLAG, 4, // LAWFLAG_SPEECH, 1, // LAWFLAG_VANDALISM, 4, // LAWFLAG_ASSAULT, 8, // LAWFLAG_CARTHEFT, 4, // LAWFLAG_INFORMATION, 1, // LAWFLAG_COMMERCE, 8, // LAWFLAG_CCFRAUD, 4, // LAWFLAG_BROWNIES, 4, // LAWFLAG_BURIAL, 1, // LAWFLAG_PROSTITUTION, 1, // LAWFLAG_DISTURBANCE, 1, // LAWFLAG_HIREILLEGAL, 8, // LAWFLAG_RACKETEERING, 0, // LAWFLAG_LOITERING, 8 // LAWFLAG_GUNCARRY }; enum BusinessFronts { BUSINESSFRONT_INSURANCE, BUSINESSFRONT_TEMPAGENCY, BUSINESSFRONTNUM }; enum AnimalGlosses { ANIMALGLOSS_NONE,//IMPORTANT THAT THIS BE HERE AT ZERO ANIMALGLOSS_TANK, ANIMALGLOSS_ANIMAL, ANIMALGLOSSNUM }; enum Activity { ACTIVITY_NONE, ACTIVITY_VISIT, ACTIVITY_HOSTAGETENDING, ACTIVITY_TROUBLE, ACTIVITY_FUNDS_LEGAL, ACTIVITY_FUNDS_ILLEGAL, ACTIVITY_REPAIR_ARMOR, ACTIVITY_MAKE_ARMOR, ACTIVITY_POLLS, ACTIVITY_STEALCARS, ACTIVITY_WHEELCHAIR, ACTIVITY_BURY, ACTIVITY_WRITE, ACTIVITY_CLINIC, ACTIVITYNUM }; struct activityst { long type; long arg; long arg2; }; long curcreatureid=0; #define CREATUREFLAG_WHEELCHAIR BIT1 #define CREATUREFLAG_JUSTESCAPED BIT2 #define CREATUREFLAG_MISSING BIT3 #define CREATUREFLAG_KIDNAPPED BIT4 #define CREATUREFLAG_SLEEPER BIT5 #define CREATUREFLAG_ILLEGALALIEN BIT6 struct creaturest { char name[40]; char propername[40]; long squadid;//REMEMBER, THIS IS ID NUMBER, NOT ARRAY INDEX char exists; char align; char alive; short type; char animalgloss; short specialattack; short clinic; short dating; short hiding; short trainingtime; short trainingsubject; creaturest *prisoner; short sentence; char deathpenalty; long joindays; long deathdays; long id; long hireid; char forceinc; long att[ATTNUM]; unsigned long skill[SKILLNUM]; unsigned long skill_ip[SKILLNUM]; weaponst weapon; armorst armor; int clip[CLIPNUM]; unsigned long money; long juice; char wound[BODYPARTNUM]; short blood; char special[SPECIALWOUNDNUM]; unsigned int lawflag[LAWFLAGNUM]; long location; long worklocation; char cantbluff; long base; activityst activity; long carid; char is_driver; long pref_carid; char pref_is_driver; unsigned short flag; creaturest() { creatureinit(); } ~creaturest() { if(prisoner!=NULL) { if(prisoner->squadid!=-1)delete prisoner; } } char canwalk(void) { if(!alive)return 0; int legok=2; if((wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)|| (wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF))legok--; if((wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)|| (wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF))legok--; if(special[SPECIALWOUND_NECK]!=1|| special[SPECIALWOUND_UPPERSPINE]!=1|| special[SPECIALWOUND_LOWERSPINE]!=1)return 0; if(legok==0)return 0; return 1; } void creatureinit(void) { hireid=-1; worklocation=0; juice=0; flag=0; carid=-1; is_driver=0; pref_carid=-1; pref_is_driver=0; id=curcreatureid; curcreatureid++; joindays=0; deathdays=0; squadid=-1; cantbluff=0; location=0; base=0; activity.type=ACTIVITY_NONE; for(int i=0;i<LAWFLAGNUM;i++) lawflag[i]=0; clinic=0; dating=0; hiding=0; trainingtime=0; trainingsubject=-1; specialattack=-1; animalgloss=0; prisoner=NULL; alive=1; blood=100; for(int w=0;w<BODYPARTNUM;w++)wound[w]=0; weapon.type=WEAPON_NONE; weapon.ammo=0; armor.type=ARMOR_CLOTHES; armor.quality='1'; armor.flag=0; for(int a=0;a<ATTNUM;a++) { att[a]=1; } int attnum=32; while(attnum>0) { int a=LCSrandom(ATTNUM); if(att[a]<10) { att[a]++; attnum--; } } for(int s=0;s<SKILLNUM;s++) { skill[s]=0; skill_ip[s]=0; } for(int c=0;c<CLIPNUM;c++)clip[c]=0; special[SPECIALWOUND_TEETH]=TOOTHNUM; special[SPECIALWOUND_RIGHTEYE]=1; special[SPECIALWOUND_LEFTEYE]=1; special[SPECIALWOUND_NOSE]=1; special[SPECIALWOUND_TONGUE]=1; special[SPECIALWOUND_RIGHTLUNG]=1; special[SPECIALWOUND_LEFTLUNG]=1; special[SPECIALWOUND_HEART]=1; special[SPECIALWOUND_LIVER]=1; special[SPECIALWOUND_STOMACH]=1; special[SPECIALWOUND_RIGHTKIDNEY]=1; special[SPECIALWOUND_LEFTKIDNEY]=1; special[SPECIALWOUND_SPLEEN]=1; special[SPECIALWOUND_RIBS]=RIBNUM; special[SPECIALWOUND_NECK]=1; special[SPECIALWOUND_UPPERSPINE]=1; special[SPECIALWOUND_LOWERSPINE]=1; forceinc=0; sentence=0; deathpenalty=0; } long attval(short a,char usejuice=1); }; #define SITEBLOCK_EXIT BIT1 #define SITEBLOCK_BLOCK BIT2 #define SITEBLOCK_DOOR BIT3 #define SITEBLOCK_KNOWN BIT4 #define SITEBLOCK_LOOT BIT5 #define SITEBLOCK_LOCKED BIT6 #define SITEBLOCK_KLOCK BIT7 #define SITEBLOCK_CLOCK BIT8 #define SITEBLOCK_RESTRICTED BIT9 #define SITEBLOCK_BLOODY BIT10 #define SITEBLOCK_BLOODY2 BIT11 enum SpecialBlocks { SPECIAL_LAB_COSMETICS_CAGEDANIMALS, SPECIAL_LAB_GENETIC_CAGEDANIMALS, SPECIAL_POLICESTATION_LOCKUP, SPECIAL_COURTHOUSE_LOCKUP, SPECIAL_COURTHOUSE_JURYROOM, SPECIAL_PRISON_CONTROL, SPECIAL_INTEL_SUPERCOMPUTER, SPECIAL_SWEATSHOP_EQUIPMENT, SPECIAL_POLLUTER_EQUIPMENT, SPECIAL_NUCLEAR_ONOFF, SPECIAL_HOUSE_PHOTOS, SPECIAL_CORPORATE_FILES, SPECIAL_RADIO_BROADCASTSTUDIO, SPECIAL_NEWS_BROADCASTSTUDIO, SPECIAL_APARTMENT_LANDLORD, SPECIAL_APARTMENT_SIGN, SPECIAL_RESTAURANT_TABLE, SPECIAL_CAFE_COMPUTER, SPECIAL_STAIRS_UP, SPECIAL_STAIRS_DOWN, SPECIALNUM }; #define SIEGEFLAG_UNIT BIT1 #define SIEGEFLAG_TRAP BIT2 #define SIEGEFLAG_HEAVYUNIT BIT3 #define SIEGEFLAG_UNIT_DAMAGED BIT4 struct siteblockst { short special; unsigned short flag; unsigned char siegeflag; }; enum ItemTypes { ITEM_WEAPON, ITEM_ARMOR, ITEM_MONEY, ITEM_CLIP, ITEM_LOOT, ITEMNUM }; struct itemst { weaponst weapon; armorst armor; unsigned long money; short cliptype; short loottype; short type; long number; itemst() { number=1; } }; vector<itemst *> groundloot; enum SiegeTypes { SIEGE_POLICE, SIEGE_CIA, SIEGE_HICKS, SIEGE_CORPORATE, SIEGENUM }; struct siegest { char siege; short siegetype; char underattack; long attacktime; short kills; short escalationstate; char lights_off; char cameras_off; short timeuntillocated; short timeuntilcorps; short timeuntilcia; siegest() { siege=0; siegetype=-1; underattack=0; escalationstate=0; timeuntillocated=-1; timeuntilcorps=-1; timeuntilcia=-1; } }; #define COMPOUND_BASIC BIT1 #define COMPOUND_CAMERAS BIT2 #define COMPOUND_TANKTRAPS BIT3 #define COMPOUND_TRAPS BIT4 #define COMPOUND_GENERATOR BIT5 #define COMPOUND_PRINTINGPRESS BIT6 struct locationst { char name[40]; char shortname[20]; short type; long parent; vector<itemst *> loot; long renting; char newrental; char needcar; short closed; char highsecurity; siegest siege; int heat; char compound_walls; long compound_stores; short front_business; char front_name[40]; char haveflag; unsigned long mapseed; locationst() { init(); needcar=0; renting=-1; } void init(void) { haveflag=0; newrental=0; heat=0; closed=0; highsecurity=0; mapseed=seed;r_num(); compound_walls=0; compound_stores=0; front_business=-1; } }; vector<locationst *> location; enum VehicleTypes { VEHICLE_VAN, VEHICLE_STATIONWAGON, VEHICLE_SPORTSCAR, VEHICLE_BUG, VEHICLE_PICKUP, VEHICLE_POLICECAR, VEHICLE_TAXICAB, VEHICLE_SUV, VEHICLE_AGENTCAR, VEHICLE_JEEP, VEHICLENUM, }; enum VehicleColors { VEHICLECOLOR_RED, VEHICLECOLOR_WHITE, VEHICLECOLOR_BLUE, VEHICLECOLOR_BEIGE, VEHICLECOLOR_POLICE, VEHICLECOLOR_TAXI, VEHICLECOLOR_BLACK, VEHICLECOLORNUM }; struct vehiclest { short type; short color; long location; int myear; long id; void init(int t); }; vector<vehiclest *> vehicle; long curcarid=0; char showcarprefs=1; enum CarChaseObstacles { CARCHASE_OBSTACLE_FRUITSTAND, CARCHASE_OBSTACLENUM }; #define MAPX 70 #define MAPY 23 #define MAPZ 10 siteblockst map[MAPX][MAPY][MAPZ]; //struct chaseseqst struct chaseseqst { long location; vector<vehiclest *> friendcar; vector<vehiclest *> enemycar; char canpullover; //public: void clean(void); }; void chaseseqst::clean(void) { for(int v=0;v<enemycar.size();v++) { delete enemycar[v]; } enemycar.clear(); friendcar.clear(); } chaseseqst chaseseq; char slogan[80]; vector<creaturest *> pool; struct squadst { char name[40]; creaturest *squad[6]; activityst activity; int id; vector<itemst *> loot; squadst() { for(int p=0;p<6;p++)squad[p]=NULL; strcpy(name,""); activity.type=ACTIVITY_NONE; id=-1; } ~squadst() { for(int l=0;l<loot.size();l++) { delete loot[l]; } loot.clear(); } }; vector<squadst *> squad; squadst *activesquad=NULL; long cursquadid=0; char disbanding=0; int disbandtime=0; char cantseereason; #define ENCMAX 18 creaturest encounter[ENCMAX]; enum GameModes { GAMEMODE_TITLE, GAMEMODE_BASE, GAMEMODE_SITE, GAMEMODE_CHASECAR, GAMEMODE_CHASEFOOT }; char loaded=0; int mode=GAMEMODE_TITLE; short offended_cops=0; short offended_corps=0; short offended_cia=0; short offended_amradio=0; short offended_cablenews=0; int police_heat=0; unsigned long attorneyseed; long selectedsiege=-1; char lcityname[80]; char newscherrybusted=0; int month=1; int year=2005; int amendnum=28; enum Views { VIEW_ABORTION, VIEW_GAY, VIEW_DEATHPENALTY, VIEW_TAXES, VIEW_NUCLEARPOWER, VIEW_ANIMALRESEARCH, VIEW_POLICEBEHAVIOR, VIEW_PRISONS, VIEW_INTELLIGENCE, VIEW_FREESPEECH, VIEW_GENETICS, VIEW_JUSTICES, VIEW_SWEATSHOPS, VIEW_POLLUTION, VIEW_CORPORATECULTURE, VIEW_CEOSALARY, //*JDS* I'm using VIEWNUM-4 in a random generator that rolls a //random issue, not including the media ones, and this will //break if these stop being the last 4 issues; do a search //for VIEWNUM-4 to change it if it needs to be changed. VIEW_AMRADIO, VIEW_CABLENEWS, //THESE TWO MUST BE LAST FOR VIEWNUM-2 TO WORK IN PLACES VIEW_LIBERALCRIMESQUAD, VIEW_LIBERALCRIMESQUADPOS, VIEWNUM }; short attitude[VIEWNUM]; short newspaper_topicwork[VIEWNUM]; enum Laws { LAW_ABORTION, LAW_ANIMALRESEARCH, LAW_POLICEBEHAVIOR, LAW_PRIVACY, LAW_DEATHPENALTY, LAW_NUCLEARPOWER, LAW_POLLUTION, LAW_LABOR, LAW_GAY, LAW_CORPORATE, LAW_FREESPEECH, LAW_FLAGBURNING, LAW_GUNCONTROL, LAW_TAX, LAWNUM }; short law[LAWNUM]; short house[435]; short senate[100]; short court[9]; char courtname[9][80]; enum Execs { EXEC_PRESIDENT, EXEC_VP, EXEC_STATE, EXEC_ATTORNEY, EXECNUM }; short exec[EXECNUM]; short execterm=1; char execname[EXECNUM][80]; unsigned long version=31100; unsigned long lowestloadversion=31005; unsigned long lowestloadscoreversion=30001; unsigned long stat_recruits=0; unsigned long stat_kidnappings=0; unsigned long stat_dead=0; unsigned long stat_kills=0; unsigned long stat_funds=0; unsigned long stat_spent=0; unsigned long stat_buys=0; unsigned long stat_burns=0; unsigned long ustat_recruits=0; unsigned long ustat_kidnappings=0; unsigned long ustat_dead=0; unsigned long ustat_kills=0; unsigned long ustat_funds=0; unsigned long ustat_spent=0; unsigned long ustat_buys=0; unsigned long ustat_burns=0; int locx,locy,locz; short sitetype; short sitealienate; short sitealarm; short sitealarmtimer; short postalarmtimer; long sitecrime; long cursite; short interface_pgup='['; short interface_pgdn=']'; int day=1; #ifdef HIGHFUNDS unsigned long funds=100000; #else unsigned long funds=7; #endif long moneygained_donate=0; long moneygained_brownies=0; long moneygained_goods=0; long moneygained_ccfraud=0; long moneygained_hustling=0; long moneygained_thievery=0; long moneylost_goods=0; long moneylost_trouble=0; long moneylost_rent=0; long moneylost_manufacture=0; long moneylost_legal=0; long moneylost_compound=0; long moneylost_hostage=0; short party_status=-1; struct datest { long mac_id; vector<creaturest *> date; short timeleft; datest() { timeleft=0; } ~datest() { for(int d=0;d<date.size();d++)delete date[d]; date.clear(); } }; vector<datest *> date; enum Crimes { CRIME_STOLEGROUND, CRIME_UNLOCKEDDOOR, CRIME_BROKEDOWNDOOR, CRIME_ATTACKED_MISTAKE, CRIME_ATTACKED, CRIME_CARCHASE, CRIME_CARCRASH, CRIME_FOOTCHASE, CRIME_KILLEDSOMEBODY, CRIME_SHUTDOWNREACTOR, CRIME_POLICE_LOCKUP, CRIME_COURTHOUSE_LOCKUP, CRIME_PRISON_RELEASE, CRIME_JURYTAMPERING, CRIME_HACK_INTEL, CRIME_BREAK_SWEATSHOP, CRIME_BREAK_FACTORY, CRIME_HOUSE_PHOTOS, CRIME_CORP_FILES, CRIME_FREE_RABBITS, CRIME_FREE_BEASTS, CRIMENUM }; enum NewsStories { NEWSSTORY_MAJOREVENT, NEWSSTORY_SQUAD_SITE, NEWSSTORY_SQUAD_ESCAPED, NEWSSTORY_SQUAD_FLEDATTACK, NEWSSTORY_SQUAD_DEFENDED, NEWSSTORY_SQUAD_BROKESIEGE, NEWSSTORY_SQUAD_KILLED_SIEGEATTACK, NEWSSTORY_SQUAD_KILLED_SIEGEESCAPE, NEWSSTORY_SQUAD_KILLED_SITE, NEWSSTORY_CARTHEFT, NEWSSTORY_MASSACRE, NEWSSTORY_KIDNAPREPORT, NEWSSTORYNUM }; struct newsstoryst { short type; short view; creaturest *cr; vector<int> crime; long loc,priority,page; char positive; short siegetype; newsstoryst() { cr=NULL; } }; vector<newsstoryst *> newsstory; newsstoryst *sitestory=NULL; struct blogpostst { char type; char power; char issue; }; vector<blogpostst *> blogpost; struct highscorest { char valid; char endtype; char slogan[80]; int month; int year; unsigned long stat_recruits; unsigned long stat_kidnappings; unsigned long stat_dead; unsigned long stat_kills; unsigned long stat_funds; unsigned long stat_spent; unsigned long stat_buys; unsigned long stat_burns; }; #define SCORENUM 5 highscorest score[SCORENUM]; int yourscore=-1; void set_color(short f,short b,char bright); void translategetch(int &c); void translategetch_cap(int &c); void mode_title(void); void mode_base(void); void mode_site(long loc); void mode_site(void); void printparty(void); void printlocation(long loc); void burnflag(void); void getslogan(void); void review(void); void review_mode(short mode); void assemblesquad(squadst *cursquad); void squadlessbaseassign(void); void promoteliberals(void); void sortbyhire(vector<creaturest *> &temppool,vector<int> &level); void orderparty(void); void stopevil(void); void initliberal(creaturest &cr); void printliberalstats(creaturest &cr,char smll); void initsite(locationst &loc); void getactivity(char *str,activityst &act); long getsquad(long id); long id_getcar(long id); void printsitemap(int x,int y,int z); void printblock(int x,int y,int z,int px,int py); void prepareencounter(short type,char sec); void printencounter(void); void printchaseencounter(void); int skillatt(int skill); void makecreature(creaturest &cr,short type); void generateroom(int rx,int ry,int dx,int dy,int z=0); void knowmap(int locx,int locy,int locz); void getweapon(char *str,int type); void getweaponfull(char *str,int type); void getarmor(char *str,int type,int subtype=-1); void getarmorfull(char *str,armorst &armor,char superfull); void getarmorfull(char *str,int type,int subtype=-1); void getmaskdesc(char *str,short mask); void getskill(char *str,int type); void getclip(char *str,int clip); void getloot(char *str,int loot); void getrecruitcreature(char *str,int type); void gettitle(char *str,creaturest &cr); void delenc(short e,char loot); void youattack(void); void enemyattack(void); void attack(creaturest &a,creaturest &t,char mistake,char &actual); void creatureadvance(void); void advancecreature(creaturest &cr); void damagemod(creaturest &t,char &damtype,int &damamount,int mod); void makeloot(creaturest &cr,vector<itemst *> &loot); void severloot(creaturest &cr,vector<itemst *> &loot); void equip(vector<itemst *> &loot,int loc); void consolidateloot(vector<itemst *> &loot); char itemcompare(itemst *a,itemst *b); short ammotype(int type); void save(void); void autosave(void); char load(void); void choose_buyer(short &buyer); void conservatise(creaturest &cr); char talk(creaturest &a,int t); void liberalize(creaturest &cr); void kidnapattempt(void); char kidnap(creaturest &a,creaturest &t,char &amateur); void kidnaptransfer(creaturest &cr); void namecreature(creaturest &cr); void name(char *str); void firstname(char *str); void lastname(char *str); void noticecheck(int exclude); void disguisecheck(void); int disguiseskill(void); char weaponcheck(creaturest &cr,short type); char hasdisguise(creaturest &cr,short type); char alienationcheck(char mistake); void survey(creaturest *cr); void special_lab_cosmetics_cagedanimals(void); void special_readsign(int sign); void special_nuclear_onoff(void); void special_lab_genetic_cagedanimals(void); void special_policestation_lockup(void); void special_courthouse_lockup(void); void special_courthouse_jury(void); void special_prison_control(void); void special_intel_supercomputer(void); void special_sweatshop_equipment(void); void special_polluter_equipment(void); void special_house_photos(void); void special_corporate_files(void); void special_radio_broadcaststudio(void); void special_news_broadcaststudio(void); void clearcommandarea(void); void clearmessagearea(void); void clearmaparea(void); char unlock(short type,char &actual); char bash(short type,char &actual); long bashstrengthmod(int t); char hack(short type,char &actual); char liberalagenda(char won); char confirmdisband(void); char radio_broadcast(void); char news_broadcast(void); void change_public_opinion(int v,int power,char affect,char cap=1); void resolvesite(void); void passmonth(char &clearformess,char canseethings); void dispersalcheck(char &clearformess); void locatesquad(squadst *st,long loc); void basesquad(squadst *st,long loc); int monthday(void); void advanceday(char &clearformess,char canseethings); void majornewspaper(char &clearformess,char canseethings); void removesquadinfo(creaturest &cr); void investlocation(void); void cleangonesquads(void); void advancelocations(void); char securityable(int type); void initlocation(locationst &loc); void loadhighscores(void); enum EndTypes { END_WON, END_HICKS, END_CIA, END_POLICE, END_CORP, END_REAGAN, END_DEAD, END_PRISON, END_EXECUTED, END_DATING, END_HIDING, END_DISBANDLOSS, END_DISPERSED, ENDNUM }; enum ReportTypes { REPORT_NEWS, REPORT_OPINION, REPORT_ATTACK, REPORTNUM }; void savehighscore(char endtype); void viewhighscores(void); void reset(void); void elections(char clearformess,char canseethings); void supremecourt(char clearformess,char canseethings); void congress(char clearformess,char canseethings); char wincheck(void); int publicmood(int l); void getview(char *str,short view); void getlaw(char *str,int l); void chooseview(short &view); void guardianupdate(char size,char power); int choosespecialedition(char &clearformess); unsigned long fenceselect(void); unsigned long fencevalue(itemst &it); void moveloot(vector<itemst *> &dest,vector<itemst *> &source); void tossjustices(char canseethings); void reaganify(char canseethings); char ratify(int level,int view,int lawview,char congress,char canseethings); void amendmentheading(void); void romannumeral(int amendnum); char incapacitated(creaturest &a,char noncombat,char &printed); void printhealthstat(creaturest &g,int y,int x,char smll); void healthmodroll(int &aroll,creaturest &a); int clinictime(creaturest &g); void siegecheck(char canseethings); void siegeturn(char clearformess); void giveup(void); void adjustblogpower(int &power); int fooddaysleft(int loc); int numbereating(int loc); void escape_engage(void); void autopromote(int loc); void escapesiege(char won); char addsiegeencounter(char type); void conquertext(void); void criminalizeparty(short crime); void criminalizepool(short crime,long exclude=-1,short loc=-1); void juiceparty(long juice); void addjuice(creaturest &cr,long juice,long cap=1000); void statebrokenlaws(int loc); char rangedweapon(weaponst &w); void trial(creaturest &g); char prison(creaturest &g); void partyrescue(void); void penalize(creaturest &g,char lenient); void printnews(short l,short newspaper); void adddeathmessage(creaturest &cr); void fullstatus(int p); void makecharacter(void); void hospital(int loc); void pawnshop(int loc); void deptstore(int loc); void halloweenstore(int loc); void locheader(void); void activate(void); void activatebulk(void); void printcreatureinfo(creaturest *cr); void activate(creaturest *cr); void makedelimiter(int y,int x); int getpoolcreature(long id); void select_tendhostage(creaturest *cr); long select_hostagefundinglevel(creaturest *cr,creaturest *hs); void select_makeclothing(creaturest *cr); long select_troublefundinglevel(creaturest *cr); char select_view(creaturest *cr,long &v); void tendhostage(creaturest *cr,char &clearformess); char disguisesite(long type); void armordamage(armorst &armor,int bp); void bloodblast(armorst &armor); char squadhasitem(squadst &sq,int type,int subtype); int getrandomcreaturetype(int cr[CREATURENUM]); long armor_makedifficulty(int type,creaturest *cr); long armor_makeprice(int type); void repairarmor(creaturest &cr,char &clearformess); void makearmor(creaturest &cr,char &clearformess); void funds_and_trouble(char &clearformess); void fundreport(char &clearformess); void getcarfull(char *str,int type); void getcar(char *str,int type); void getcarfull(char *str,vehiclest &car,char halffull=0); char stealcar(creaturest &cr,char &clearformess); void getwheelchair(creaturest &cr,char &clearformess); long difficulty_carfind(int type); char carselect(creaturest &cr,short &cartype); void getcarcolor(char *str,int type); short naturalcarcolor(int type); char maskselect(creaturest *cr,short &mask); long sensealarmchance(int ct); long touchalarmchance(int ct); void setvehicles(void); void squadgrab_immobile(char dead); void freehostage(creaturest &cr,char situation); void capturecreature(creaturest &t); char chasesequence(void); char footchase(void); char chasesequence(creaturest &cr,vehiclest &v); char footchase(creaturest &cr); char endcheck(short cause=-1); void makechasers(long sitetype,long sitecrime); void evasivedrive(void); void evasiverun(void); long driveskill(creaturest &cr,vehiclest *v); void drivingupdate(short &obstacle); void obstacledrive(short obstacle,char choice); void dodgedrive(void); void crashfriendlycar(int v); void crashenemycar(int v); void chase_giveup(void); void verifyworklocation(creaturest &cr); void sleepereffect(creaturest &cr,char &clearformess,char canseethings,int *libpower); void setpriority(newsstoryst &ns); void displaystory(newsstoryst &ns); void loadgraphics(void); void displaycenterednewsfont(char *str,int y); void displaycenteredsmallnews(char *str,int y); void displaynewspicture(int p,int y); void constructeventstory(char *story,short view,char positive); void displaynewsstory(char *story,short *storyx_s,short *storyx_e,int y); void cityname(char *story); char talkreceptive(creaturest &cr); void generatefiller(char *story,int amount); char kid(creaturest &cr); char completevacation(datest &d,int p,char &clearformess); char completedate(datest &d,int p,char &clearformess); void updateworld_laws(short *law,short *oldlaw); void reloadparty(void); void imprison(creaturest &g); void addlocationname(locationst *loc); void loadinitfile(void); void removecarprefs_pool(long carid); bool iscriminal(creaturest &cr); int testclearallsquads(); int testsquadclear(squadst &thissquad, int obase); void hospitalize(int loc, creaturest &patient); /*-------------------------------------------------------------------------- * Portability Functions * * These functions are intended to replace explicit calls to Windows API. * * We can do the following: * * (a) Write alternative calls for the ports, keep Windows calls. * (b) Write portable alternatives for use by Windows and ports. * (c) Do (a) and (b) and decide what Windows does (API or portable) * based on the value of a MACRO GO_PORTABLE. * * compat.cpp is the place for non-trivial or more global functions. *--------------------------------------------------------------------------*/ unsigned long getSeed(void) { unsigned long t; #ifdef GO_PORTABLE t = (unsigned long)time(NULL); /* Seconds since 1970-01-01 00:00:00 */ #else // WIN32 t = (unsigned long)GetTickCount(); /* ms since system boot */ #endif return(t); } /* raw_output() is provided in PDcurses/Xcurses but is not in ncurses. * This function is for compatibility and is currently a do nothing function. */ #ifdef NCURSES inline int raw_output(bool bf) { raw(); return OK; } #endif /*-------------------------------------------------------------------------- * End of Portability Functions *--------------------------------------------------------------------------*/ int main(int argc, char* argv[]) { //start curses initscr(); noecho(); //initialize curses color start_color(); seed=getSeed(); //initialize the array of color pairs for(int i=0;i<8;i++) { for(int j=0;j<8;j++) { if(i==0&&j==0) { init_pair(7*8,0,0); continue; } if(i==7&&j==0)continue; init_pair(i*8+j,i,j); } } //turns off cursor curs_set(0); //begin the game loop keypad(stdscr,TRUE); raw_output(TRUE); loadgraphics(); loadinitfile(); strcpy(slogan,"We need a slogan!"); for(int v=0;v<VIEWNUM;v++) { attitude[v]=45; newspaper_topicwork[v]=0; } attitude[VIEW_LIBERALCRIMESQUAD]=0; attitude[VIEW_LIBERALCRIMESQUADPOS]=20; law[LAW_ABORTION]=2; law[LAW_ANIMALRESEARCH]=-2; law[LAW_POLICEBEHAVIOR]=0; law[LAW_PRIVACY]=0; law[LAW_DEATHPENALTY]=-1; law[LAW_NUCLEARPOWER]=-1; law[LAW_POLLUTION]=-1; law[LAW_LABOR]=0; law[LAW_GAY]=1; law[LAW_CORPORATE]=0; law[LAW_FREESPEECH]=0; law[LAW_FLAGBURNING]=1; law[LAW_TAX]=0; law[LAW_GUNCONTROL]=-1; #ifdef SHITLAWS for(int l=0;l<LAWNUM;l++)law[l]=-2; #endif for(int s=0;s<100;s++) { if(s<20)senate[s]=-2; else if(s<45)senate[s]=-1; else if(s<70)senate[s]=0; else if(s<90)senate[s]=1; else senate[s]=2; } for(int h=0;h<435;h++) { if(h<30)house[h]=-2; else if(h<200)house[h]=-1; else if(h<300)house[h]=0; else if(h<400)house[h]=1; else house[h]=2; } for(int c=0;c<9;c++) { if(c<2)court[c]=-2; else if(c<5)court[c]=-1; else if(c<7)court[c]=0; else if(c<8)court[c]=1; else court[c]=2; name(courtname[c]); } for(int e=0;e<EXECNUM;e++) { exec[e]=-1; name(execname[e]); } attorneyseed=getSeed(); cityname(lcityname); loaded=load(); mode_title(); //deinitialize curses endwin(); return 0; } //sets current color to desired setting void set_color(short f,short b,char bright) { //color swap required for PDcurses if(f==7&&b==0) { f=0;b=0; } else if(f==0&&b==0) { f=7;b=0; } //pick color pair based on foreground and background if(bright)attrset(A_BOLD | COLOR_PAIR(f*8+b)); else { attrset(COLOR_PAIR(f*8+b)); } } //picks a random number from 0 to max-1 long LCSrandom(unsigned long max) { r_num(); long double rand_y; long double rand_i; rand_i = 2147483648UL; rand_y = max*((long double)seed/rand_i); return((long)rand_y); } //sets seed to a random number from 0 to 2 billion unsigned long r_num(void) { seed=(seed*907725L+99979777UL)%2147483648UL; return seed; } //IN CASE FUNKY ARROW KEYS ARE SENT IN, TRANSLATE THEM BACK void translategetch(int &c) { //if(c==-63)c='7'; //if(c==-62)c='8'; //if(c==-61)c='9'; //if(c==-60)c='4'; //if(c==-59)c='5'; //if(c==-58)c='6'; //if(c==-57)c='1'; //if(c==-56)c='2'; //if(c==-55)c='3'; if(c==-6)c='0'; if(c==-50)c='.'; if(c==-53)c=10; if(c==-47)c='+'; if(c==-48)c='-'; if(c==-49)c='*'; if(c==-54)c='/'; /* if(c==2)c='2'; if(c==3)c='8'; if(c==4)c='4'; if(c==5)c='6'; */ // SPECIAL TRANSLATION for AZERTY keyboard if(interface_pgup=='.') { if(c==';')c='.'; if(c==':')c='/'; if(c=='&')c='1'; if(c=='é')c='2'; if(c=='\"')c='3'; if(c=='\'')c='4'; if(c=='(')c='5'; if(c=='-')c='6'; if(c=='è')c='7'; if(c=='_')c='8'; if(c=='ç')c='9'; if(c=='à')c='0'; } if(c>='A'&&c<='Z'){c-='A';c+='a';} /* Support Cursor Keys...*/ if(c==KEY_LEFT)c='a'; if(c==KEY_RIGHT)c='d'; if(c==KEY_UP)c='w'; if(c==KEY_DOWN)c='x'; } void translategetch_cap(int &c) { //if(c==-63)c='7'; //if(c==-62)c='8'; //if(c==-61)c='9'; //if(c==-60)c='4'; //if(c==-59)c='5'; //if(c==-58)c='6'; //if(c==-57)c='1'; //if(c==-56)c='2'; //if(c==-55)c='3'; if(c==-6)c='0'; if(c==-50)c='.'; if(c==-53)c=10; if(c==-47)c='+'; if(c==-48)c='-'; if(c==-49)c='*'; if(c==-54)c='/'; /* if(c==2)c='2'; if(c==3)c='8'; if(c==4)c='4'; if(c==5)c='6'; */ } void mode_title(void) { //title screen erase(); char str[100]; set_color(COLOR_WHITE,COLOR_BLACK,1); strcpy(str,"Liberal Crime Squad"); move(4,39-((strlen(str)-1)>>1)); addstr(str); set_color(COLOR_WHITE,COLOR_BLACK,1); strcpy(str,"Inspired by the 1983 version of Oubliette"); move(6,39-((strlen(str)-1)>>1)); addstr(str); if(loaded) { char num[20]; int l=strlen(slogan); set_color(COLOR_WHITE,COLOR_BLACK,1); move(8,40-(l>>1)); addstr(slogan); move(9,10); addstr("Liberals Indoctrinated: "); itoa(stat_recruits,num,10); addstr(num); move(10,10); addstr("Liberals Martyred: "); itoa(stat_dead,num,10); addstr(num); move(11,10); addstr("Conservatives Killed: "); itoa(stat_kills,num,10); addstr(num); move(9,47); addstr("Funds Taxed: "); itoa(stat_funds,num,10); addstr(num); move(10,47); addstr("Funds Spent: "); itoa(stat_spent,num,10); addstr(num); move(11,47); addstr("Conservatives Kidnapped: "); itoa(stat_kidnappings,num,10); addstr(num); } set_color(COLOR_WHITE,COLOR_BLACK,1); strcpy(str,"v3.9 Copyright (C) 2002-4, Tarn Adams"); move(13,39-((strlen(str)-1)>>1)); addstr(str); strcpy(str,"A Bay 12 Games Production"); move(14,39-((strlen(str)-1)>>1)); addstr(str); strcpy(str,"www.bay12games.com"); move(15,39-((strlen(str)-1)>>1)); addstr(str); strcpy(str,"v3.11 Maintained by the Open Source Community"); move(17,39-((strlen(str)-1)>>1)); addstr(str); strcpy(str,"Press ESC now to quit. Quitting later causes your progress to be saved."); move(20,39-((strlen(str)-1)>>1)); addstr(str); strcpy(str,"Press any other key to pursue your Liberal Agenda!"); move(22,39-((strlen(str)-1)>>1)); addstr(str); int c=getch(); translategetch(c); if(c==27) { endwin(); exit(0); } viewhighscores(); if(!loaded)makecharacter(); mode=GAMEMODE_BASE; mode_base(); save(); } void mode_base(void) { short advanced=0; short directing=0; short in_newspaper=0; short in_halloween=0; short in_halloween2=0; short in_training=0; short in_compound=0; short investing=0; short investing_newspaper=0; short investing_halloween=0; short investing_training=0; short investing_compound=0; short investing_stores=0; short buyer=0; char forcewait,canseethings; long nonsighttime=0; #ifdef SHOWWAIT int oldforcemonth=month; #endif int length=0; long l = 0; do { forcewait=1; canseethings=0; cantseereason=3; if(!disbanding) { for(int p=0;p<pool.size();p++) { if(pool[p]->alive&& pool[p]->align==1&& pool[p]->dating==0&& pool[p]->hiding==0&& !(pool[p]->flag & CREATUREFLAG_SLEEPER)) { if(location[pool[p]->location]->type!=SITE_GOVERNMENT_PRISON&& location[pool[p]->location]->type!=SITE_GOVERNMENT_COURTHOUSE&& location[pool[p]->location]->type!=SITE_GOVERNMENT_POLICESTATION) { canseethings=1; if(pool[p]->clinic==0){forcewait=0;break;} } } else { if(pool[p]->dating==1&&cantseereason>1)cantseereason=1; else if(pool[p]->hiding==1&&cantseereason>2)cantseereason=2; } } } else { cantseereason=4; } #ifdef SHOWWAIT if(forcewait&&oldforcemonth!=month) { oldforcemonth=month; erase(); move(0,0); char num[20]; itoa(year,num,10); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr(num); int y=2; for(int v=0;v<VIEWNUM;v++) { if(attitude[VIEW_LIBERALCRIMESQUAD]==0&& v==VIEW_LIBERALCRIMESQUADPOS)continue; if(attitude[v]==-1)set_color(COLOR_BLACK,COLOR_BLACK,1); else if(attitude[v]<10)set_color(COLOR_RED,COLOR_BLACK,1); else if(attitude[v]<30)set_color(COLOR_MAGENTA,COLOR_BLACK,1); else if(attitude[v]<50)set_color(COLOR_YELLOW,COLOR_BLACK,1); else if(attitude[v]<70)set_color(COLOR_BLUE,COLOR_BLACK,1); else if(attitude[v]<90)set_color(COLOR_CYAN,COLOR_BLACK,1); else set_color(COLOR_GREEN,COLOR_BLACK,1); move(y,0); if(attitude[v]==-1) { addstr("Unknown how many "); } else { itoa(attitude[v],num,10); addstr(num); addstr("% "); } switch(v) { case VIEW_ABORTION:addstr("supported abortion.");break; case VIEW_GAY:addstr("were in favor of equal rights for homosexuals.");break; case VIEW_DEATHPENALTY:addstr("opposed the death penalty.");break; case VIEW_TAXES:addstr("were against cutting taxes.");break; case VIEW_NUCLEARPOWER:addstr("were terrified of nuclear power.");break; case VIEW_ANIMALRESEARCH:addstr("deplored animal research.");break; case VIEW_POLICEBEHAVIOR:addstr("were critical of the police.");break; case VIEW_INTELLIGENCE:addstr("thought the intelligence community invades privacy.");break; case VIEW_FREESPEECH:addstr("believed in unfettered free speech.");break; case VIEW_GENETICS:addstr("abhorred genetically altered food products.");break; case VIEW_JUSTICES:addstr("were for the appointment of Liberal justices.");break; case VIEW_SWEATSHOPS:addstr("would boycott companies that used sweatshops.");break; case VIEW_POLLUTION:addstr("thought industry should lower pollution.");break; case VIEW_CORPORATECULTURE:addstr("were disgusted by corporate malfeasance.");break; case VIEW_CEOSALARY:addstr("believed that CEO salaries are too great.");break; case VIEW_LIBERALCRIMESQUAD:addstr("had heard of the Liberal Crime Squad.");break; case VIEW_LIBERALCRIMESQUADPOS:addstr("of these held the Liberal Crime Squad in high regard.");break; case VIEW_PRISONS:addstr("think the prison system needs reform.");break; case VIEW_AMRADIO:addstr("do not like AM radio.");break; case VIEW_CABLENEWS:addstr("have a negative opinion of cable news programs.");break; } y++; } refresh(); } #endif if(!forcewait) { if(nonsighttime>=365*4) { erase(); char str[100]; if(nonsighttime>=365*16) { strcpy(str,"How long since you've heard these sounds... times have changed."); } else if(nonsighttime>=365*8) { strcpy(str,"It has been a long time. A lot must have changed..."); } else { strcpy(str,"It sure has been a while. Things might have changed a bit."); } set_color(COLOR_WHITE,COLOR_BLACK,1); move(12,39-((strlen(str)-1)>>1)); addstr(str); refresh(); getch(); } nonsighttime=0; } int partysize=0; int partydead=0; if(activesquad!=NULL) { for(int p=0;p<6;p++) { if(activesquad->squad[p]!=NULL)partysize++; else { if(p==buyer)buyer=0; continue; } // *JDS* This bay be a hack vvv if(!partysize) { delete activesquad; activesquad=NULL; } if(!activesquad->squad[p]->alive)partydead++; } } long safenumber=0; for(l=0;l<location.size();l++) { if(location[l]->renting>=0)safenumber++; } siegest *siege=NULL; if(selectedsiege!=-1)siege=&location[selectedsiege]->siege; if(activesquad!=NULL)siege=&location[activesquad->squad[0]->location]->siege; char sieged=0; if(siege!=NULL)sieged=siege->siege; char underattack=0; if(siege!=NULL) { if(sieged)underattack=siege->underattack; } char haveflag=0; if(selectedsiege!=-1)haveflag=location[selectedsiege]->haveflag; if(activesquad!=NULL)haveflag=location[activesquad->squad[0]->location]->haveflag; char cannotwait=0; for(l=0;l<location.size();l++) { if(!location[l]->siege.siege)continue; if(location[l]->siege.underattack) { cannotwait=1; break; } //NOTE: returns -1 if no eaters, so is okay if(fooddaysleft(l)==0) { cannotwait=1; break; } } if(!forcewait) { erase(); if(activesquad!=NULL)selectedsiege=-1; locheader(); if(selectedsiege!=-1) { printlocation(selectedsiege); if(location[selectedsiege]->type==SITE_INDUSTRY_WAREHOUSE&& !location[selectedsiege]->siege.siege) { set_color(COLOR_WHITE,COLOR_BLACK,0); move(8,1); addstr("I - Invest in this location"); } } else if(activesquad!=NULL)printparty(); else makedelimiter(8,0); if(sieged) { move(8,1); if(underattack) { set_color(COLOR_RED,COLOR_BLACK,1); addstr("Under Attack"); } else { set_color(COLOR_YELLOW,COLOR_BLACK,1); addstr("Under Siege"); } } if(haveflag) { for(int p=0;p<7;p++) { move(p+17,32); if(p<3) { set_color(COLOR_WHITE,COLOR_BLUE,1); move(p+17,32); addstr("::::::"); set_color(COLOR_WHITE,COLOR_RED,1); move(p+17,38); for(int i=0;i<10;i++)addch(CH_LOWER_HALF_BLOCK); } else { if(p<6)set_color(COLOR_WHITE,COLOR_RED,1); else set_color(COLOR_RED,COLOR_BLACK,0); for(int i=0;i<16;i++) { if(p==6)addch(CH_UPPER_HALF_BLOCK); else addch(CH_LOWER_HALF_BLOCK); } } } } if(partysize>0&&!underattack)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(11,1); addstr("E - Equipment"); if(pool.size()>0)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(12,1); addstr("R - Review and reorganize Liberals"); if(partysize>1)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(12,40); addstr("O - Change the squad's Liberal order"); if(squad.size()>1||(activesquad==NULL&&squad.size()>0))set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(13,40); addstr("TAB - Next Squad"); if(safenumber>0)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(13,62); addstr("Z - Next Location"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(14,40); addstr("L - The Status of the Liberal Agenda"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(13,1); addstr("A - Activate the Uninvolved"); if(partysize>0) { if(activesquad->activity.type!=ACTIVITY_NONE)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); } else set_color(COLOR_BLACK,COLOR_BLACK,1); move(14,1); addstr("C - Cancel this Squad's Departure"); if(sieged) { if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(10,1); addstr("F - Escape/Engage"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(10,23); addstr("G - Give Up"); } else { if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(10,1); addstr("F - Go forth to stop EVIL"); } if(partysize>0&&(party_status==-1||partysize>1))set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(11,40); addstr("# - Check the status of a squad Liberal"); if(party_status!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(10,40); addstr("0 - Show the squad's Liberal status"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(15,1); addstr("X - Live to fight EVIL another day"); move(16,1); if(cannotwait) { set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("Cannot Wait until Siege Resolved"); } else { move(16,1); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("W - Wait a day"); if(day==monthday())addstr(" (next month)"); } set_color(COLOR_WHITE,COLOR_BLACK,0); move(16,40); addstr("S - FREE SPEECH: the Liberal Slogan"); if(vehicle.size()>0&&partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(11,23); addstr("V - Vehicles"); move(15,40); if(haveflag) { set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("P - PROTEST: burn the flag"); } else { if(funds>=20&&!sieged&& (selectedsiege!=-1||activesquad!=NULL))set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); addstr("P - PATRIOTISM: fly a flag here ($20)"); } length=strlen(slogan); set_color(COLOR_WHITE,COLOR_BLACK,1); if(haveflag)move(24,40-(length>>1)); else move(20,40-(length>>1)); addstr(slogan); refresh(); } int c='w'; if(!forcewait) { c=getch(); translategetch(c); } if(c=='x')break; if(c=='i'&&selectedsiege!=-1) { if(location[selectedsiege]->type==SITE_INDUSTRY_WAREHOUSE&& !location[selectedsiege]->siege.siege) { investlocation(); } } if(c=='l') { disbanding=liberalagenda(0); } if(c=='g'&&sieged) { giveup(); cleangonesquads(); } if(c=='f'&&partysize>0) { //NOTE THAT THERE ARE TWO MORE OF THESE //IDENTICAL LINES BELOW if(!sieged) { stopevil(); } else { escape_engage(); cleangonesquads(); } } if(c=='o'&&partysize>1)orderparty(); if(c=='c'&&partysize>0) { activesquad->activity.type=ACTIVITY_NONE; } if(c=='a') { activate(); } if(c==9&&squad.size()>0) { if(activesquad==NULL)activesquad=squad[0]; else { for(int sq=0;sq<squad.size();sq++) { if(squad[sq]==activesquad) { if(sq==squad.size()-1)activesquad=squad[0]; else activesquad=squad[sq+1]; break; } } } } if(c=='z'&&safenumber>0) { activesquad=NULL; long sl; if(selectedsiege==-1)sl=0; else sl=selectedsiege+1; for(long l=sl;l<location.size();l++) { if(location[l]->renting>=0) { selectedsiege=l; break; } else if(l==location.size()-1)l=-1; } } if(c=='e'&&partysize>0&&!underattack) { if(location[activesquad->squad[0]->location]->renting>=0) { equip(activesquad->loot,activesquad->squad[0]->location); } else equip(activesquad->loot,-1); } if(c=='r'&&pool.size()>0)review(); if(c=='w'&&(forcewait||!cannotwait)) { char clearformess=forcewait; if(!canseethings)nonsighttime++; advanceday(clearformess,canseethings); if(day>monthday())passmonth(clearformess,canseethings); advancelocations(); } if(c=='v'&&vehicle.size()>0&&partysize>0)setvehicles(); if(c=='p'&&haveflag) { burnflag(); stat_burns++; if(selectedsiege!=-1) { location[selectedsiege]->haveflag=0; criminalizepool(LAWFLAG_BURNFLAG,-1,selectedsiege); } if(activesquad!=NULL) { location[activesquad->squad[0]->base]->haveflag=0; criminalizepool(LAWFLAG_BURNFLAG,-1,activesquad->squad[0]->base); } //PUBLICITY IF BURN FLAG DURING SIEGE //ESPECIALLY IF IT IS REALLY ILLEGAL if(sieged) { change_public_opinion(VIEW_LIBERALCRIMESQUAD,1,0); change_public_opinion(VIEW_FREESPEECH,1,1); if(law[LAW_FLAGBURNING]<=0) { change_public_opinion(VIEW_LIBERALCRIMESQUAD,1,0); change_public_opinion(VIEW_FREESPEECH,1,1); } if(law[LAW_FLAGBURNING]<=-1) { change_public_opinion(VIEW_LIBERALCRIMESQUAD,5,0); change_public_opinion(VIEW_FREESPEECH,2,1); } if(law[LAW_FLAGBURNING]==-2) { change_public_opinion(VIEW_LIBERALCRIMESQUAD,15,0); change_public_opinion(VIEW_FREESPEECH,5,1); } } } else if(c=='p'&&funds>=20&&!sieged&& (selectedsiege!=-1||activesquad!=NULL)) { funds-=20; stat_spent+=20; if(selectedsiege!=-1)location[selectedsiege]->haveflag=1; if(activesquad!=NULL)location[activesquad->squad[0]->base]->haveflag=1; stat_buys++; moneylost_compound+=20; } if(c=='s')getslogan(); if(c=='0')party_status=-1; if(c>='1'&&c<='6'&&activesquad!=NULL) { if(activesquad->squad[c-'1']!=NULL) { if(party_status==c-'1')fullstatus(party_status); else party_status=c-'1'; } } }while(1); } void initliberal(creaturest &cr) { cr.creatureinit(); cr.prisoner=NULL; cr.align=1; cr.type=CREATURE_BUM; cr.money=0; namecreature(cr); //STARTING SKILLS int startsknum=cr.attval(ATTRIBUTE_WISDOM); while(startsknum>0) { cr.skill[LCSrandom(SKILLNUM)]++; startsknum--; } } void printliberalstats(creaturest &cr,char smll) { set_color(COLOR_WHITE,COLOR_BLACK,0); char num[20],str[200]; move(2,0); addstr("Name: "); addstr(cr.name); addstr(", "); gettitle(str,cr); addstr(str); move(4,25);addstr("Juice: "); itoa(cr.juice,num,10); addstr(num); if(cr.juice<500) { move(5,25);addstr("Next: "); if(cr.juice<0)addstr("0"); else if(cr.juice<10)addstr("10"); else if(cr.juice<50)addstr("50"); else if(cr.juice<100)addstr("100"); else if(cr.juice<200)addstr("200"); else addstr("500"); } move(4,0);addstr("Heart: "); itoa(cr.attval(ATTRIBUTE_HEART),num,10); addstr(num); move(5,0);addstr("Intelligence: "); itoa(cr.attval(ATTRIBUTE_INTELLIGENCE),num,10); addstr(num); move(6,0);addstr("Wisdom: "); itoa(cr.attval(ATTRIBUTE_WISDOM),num,10); addstr(num); move(7,0);addstr("Health: "); itoa(cr.attval(ATTRIBUTE_HEALTH),num,10); addstr(num); move(8,0);addstr("Agility: "); itoa(cr.attval(ATTRIBUTE_AGILITY),num,10); addstr(num); move(9,0);addstr("Strength: "); itoa(cr.attval(ATTRIBUTE_STRENGTH),num,10); addstr(num); move(10,0);addstr("Charisma: "); itoa(cr.attval(ATTRIBUTE_CHARISMA),num,10); addstr(num); char used[SKILLNUM]; memset(used,0,sizeof(char)*SKILLNUM); int snum=14; if(smll)snum=7; char printed=1; while(snum>0&&printed) { printed=0; unsigned long max=0; long maxs=-1; for(int s=0;s<SKILLNUM;s++) { if(cr.skill[s]>max && !used[s]) { max=cr.skill[s]; maxs=s; } } if(maxs!=-1) { used[maxs]=1; printed=1; if(cr.skill_ip[maxs]>=100*((10+cr.skill[maxs])/10)&& cr.skill[maxs]<cr.attval(skillatt(maxs))*2)set_color(COLOR_WHITE,COLOR_BLACK,1); else set_color(COLOR_WHITE,COLOR_BLACK,0); if(!smll)move(4+14-snum,40); else move(4+7-snum,40); getskill(str,maxs); strcat(str,": "); itoa(cr.skill[maxs],num,10); strcat(str,num); addstr(str); if((snum==14&&!smll)||(snum==7&&smll)) { set_color(COLOR_WHITE,COLOR_BLACK,0); move(2,40); getrecruitcreature(str,cr.type); addstr(str); } } snum--; } set_color(COLOR_WHITE,COLOR_BLACK,0); if(!smll) { move(12,0); addstr("Weapon: "); getweaponfull(str,cr.weapon.type); addstr(str); if(ammotype(cr.weapon.type)!=-1) { char num[20]; itoa(cr.weapon.ammo,num,10); addstr(" ("); addstr(num); int at=ammotype(cr.weapon.type); itoa(cr.clip[at],num,10); addstr("/"); addstr(num); addstr(")"); } move(13,0); addstr("Armor: "); getarmorfull(str,cr.armor,1); addstr(str); move(14,0); addstr("Transport: "); long v=-1; if(showcarprefs==1)v=id_getcar(cr.pref_carid); else v=id_getcar(cr.carid); if(v!=-1&&showcarprefs!=-1) { getcarfull(str,*vehicle[v]); char d; if(showcarprefs==1)d=cr.pref_is_driver; else d=cr.is_driver; if(d)strcat(str,"-D"); } else { int legok=2; if((cr.wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)|| (cr.wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF))legok--; if((cr.wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)|| (cr.wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF))legok--; if(cr.flag & CREATUREFLAG_WHEELCHAIR)strcpy(str,"Wheelchair"); else if(legok>=1)strcpy(str,"On Foot"); else strcpy(str,"On \"Foot\""); } addstr(str); int woundsum=0; for(int w=0;w<BODYPARTNUM;w++) { if(cr.wound[w]!=0)woundsum++; } if(woundsum>0) { for(int w=0;w<BODYPARTNUM;w++) { if(cr.wound[w] & WOUND_BLEEDING)set_color(COLOR_RED,COLOR_BLACK,1); else set_color(COLOR_WHITE,COLOR_BLACK,0); move(16+w,0); switch(w) { case BODYPART_HEAD:addstr("Head:");break; case BODYPART_BODY:addstr("Body:");break; case BODYPART_ARM_RIGHT:addstr("Right Arm:");break; case BODYPART_ARM_LEFT:addstr("Left Arm:");break; case BODYPART_LEG_RIGHT:addstr("Right Leg:");break; case BODYPART_LEG_LEFT:addstr("Left Leg:");break; } move(16+w,12); if(cr.wound[w] & WOUND_NASTYOFF)addstr("Ripped off (Scared Straight)"); else if(cr.wound[w] & WOUND_CLEANOFF)addstr("Cleanly severed"); else { int sum=0; if(cr.wound[w] & WOUND_SHOT)sum++; if(cr.wound[w] & WOUND_CUT)sum++; if(cr.wound[w] & WOUND_BRUISED)sum++; if(cr.wound[w] & WOUND_BURNED)sum++; if(cr.wound[w] & WOUND_TORN)sum++; if(sum==0) { set_color(COLOR_GREEN,COLOR_BLACK,1); addstr("Liberal"); } if(cr.wound[w] & WOUND_SHOT){addstr("Shot");sum--;if(sum>0)addstr(",");} if(cr.wound[w] & WOUND_BRUISED){addstr("Bruised");sum--;if(sum>0)addstr(",");} if(cr.wound[w] & WOUND_CUT){addstr("Cut");sum--;if(sum>0)addstr(",");} if(cr.wound[w] & WOUND_TORN){addstr("Torn");sum--;if(sum>0)addstr(",");} if(cr.wound[w] & WOUND_BURNED){addstr("Burned");sum--;if(sum>0)addstr(",");} } } set_color(COLOR_WHITE,COLOR_BLACK,0); } } //SPECIAL WOUNDS if(!smll) { set_color(COLOR_GREEN,COLOR_BLACK,0); move(3,62); if(cr.special[SPECIALWOUND_HEART]!=1)addstr("Heart Punctured"); move(4,62); if(cr.special[SPECIALWOUND_RIGHTLUNG]!=1)addstr("R. Lung Collapsed"); move(5,62); if(cr.special[SPECIALWOUND_LEFTLUNG]!=1)addstr("L. Lung Collapsed"); move(6,62); if(cr.special[SPECIALWOUND_NECK]!=1)addstr("Broken Neck"); move(7,62); if(cr.special[SPECIALWOUND_UPPERSPINE]!=1)addstr("Broken Up Spine"); move(8,62); if(cr.special[SPECIALWOUND_LOWERSPINE]!=1)addstr("Broken Lw Spine"); move(9,62); if(cr.special[SPECIALWOUND_RIGHTEYE]!=1)addstr("No Right Eye"); move(10,62); if(cr.special[SPECIALWOUND_LEFTEYE]!=1)addstr("No Left Eye"); move(11,62); if(cr.special[SPECIALWOUND_NOSE]!=1)addstr("No Nose"); move(12,62); if(cr.special[SPECIALWOUND_TONGUE]!=1)addstr("No Tongue"); move(13,62); if(cr.special[SPECIALWOUND_TEETH]==0)addstr("No Teeth"); else if(cr.special[SPECIALWOUND_TEETH]==TOOTHNUM-1)addstr("Missing a Tooth"); else if(cr.special[SPECIALWOUND_TEETH]<TOOTHNUM)addstr("Missing Teeth"); move(14,62); if(cr.special[SPECIALWOUND_LIVER]!=1)addstr("Liver Damaged"); move(15,62); if(cr.special[SPECIALWOUND_RIGHTKIDNEY]!=1)addstr("R. Kidney Damaged"); move(16,62); if(cr.special[SPECIALWOUND_LEFTKIDNEY]!=1)addstr("L. Kidney Damaged"); move(17,62); if(cr.special[SPECIALWOUND_STOMACH]!=1)addstr("Stomach Injured"); move(18,62); if(cr.special[SPECIALWOUND_SPLEEN]!=1)addstr("Busted Spleen"); move(19,62); if(cr.special[SPECIALWOUND_RIBS]==0)addstr("All Ribs Broken"); else if(cr.special[SPECIALWOUND_RIBS]==RIBNUM-1)addstr("Broken Rib"); else if(cr.special[SPECIALWOUND_RIBS]<RIBNUM)addstr("Broken Ribs"); set_color(COLOR_WHITE,COLOR_BLACK,0); } } enum ReviewModes { REVIEWMODE_LIBERALS, REVIEWMODE_HOSTAGES, REVIEWMODE_CLINIC, REVIEWMODE_JUSTICE, REVIEWMODE_SLEEPERS, REVIEWMODE_DEAD, REVIEWMODE_AWAY, REVIEWMODENUM }; void review(void) { int page=0; do { erase(); set_color(COLOR_WHITE,COLOR_BLACK,0); move(0,0); addstr("Review your Liberals and Assemble Squads"); move(1,0); addstr("----SQUAD NAME-----------------LOCATION------------ACTIVITY----------------------"); int y=2; for(int p=page*19;p<squad.size()+REVIEWMODENUM&&p<page*19+19;p++) { if(p<squad.size()) { if(activesquad==squad[p])set_color(COLOR_WHITE,COLOR_BLACK,1); else set_color(COLOR_WHITE,COLOR_BLACK,0); move(y,0); addch(y+'A'-2);addstr(" - "); addstr(squad[p]->name); move(y,31); if(squad[p]->squad[0]!=NULL) { addstr(location[squad[p]->squad[0]->location]->shortname); } move(y,51); if(squad[p]->squad[0]!=NULL) { char str[80]; getactivity(str,squad[p]->activity); if(squad[p]->activity.type==ACTIVITY_NONE) { int count=0;char haveact=0; for(int p2=0;p2<6;p2++) { if(squad[p]->squad[p2]==NULL)continue; count++; if(squad[p]->squad[p2]->activity.type!=ACTIVITY_NONE) { getactivity(str,squad[p]->squad[p2]->activity); haveact=1; } } if(haveact&&count>1)strcpy(str,"Acting Individually"); } addstr(str); } } else if(p==squad.size()) { set_color(COLOR_GREEN,COLOR_BLACK,1); move(y,0); addch('1');addstr(" - "); addstr("Active Liberals"); } else if(p==squad.size()+1) { set_color(COLOR_RED,COLOR_BLACK,1); move(y,0); addch('2');addstr(" - "); addstr("Hostages"); } else if(p==squad.size()+2) { set_color(COLOR_WHITE,COLOR_BLACK,1); move(y,0); addch('3');addstr(" - "); addstr("CLINIC"); } else if(p==squad.size()+3) { set_color(COLOR_YELLOW,COLOR_BLACK,1); move(y,0); addch('4');addstr(" - "); addstr("Justice System"); } else if(p==squad.size()+4) { set_color(COLOR_MAGENTA,COLOR_BLACK,1); move(y,0); addch('5');addstr(" - "); addstr("Sleepers"); } else if(p==squad.size()+5) { set_color(COLOR_BLACK,COLOR_BLACK,1); move(y,0); addch('6');addstr(" - "); addstr("The Dead"); } else if(p==squad.size()+6) { set_color(COLOR_BLUE,COLOR_BLACK,1); move(y,0); addch('7');addstr(" - "); addstr("Away"); } y++; } set_color(COLOR_WHITE,COLOR_BLACK,0); move(22,0); addstr("Press a Letter to select a squad. 1-7 to view Liberal groups."); move(23,0); if(interface_pgup=='[') { addstr("[] to view other Liberal pages. Press U to Promote Liberals."); } else if(interface_pgup=='.') { addstr("; and : to view other Liberal pages. Press U to Promote Liberals."); } else { addstr("PGUP/PGDN to view other Liberal pages. Press U to Promote Liberals."); } move(24,0); addstr("Press Z to Assemble a New Squad. Press T to Assign New Bases to the Squadless."); refresh(); int c=getch(); translategetch(c); if(c==interface_pgup&&page>0)page--; if(c==interface_pgdn&&(page+1)*19<squad.size()+REVIEWMODENUM)page++; if(c==10)return; if(c>='a'&&c<='s') { int sq=page*19+(int)(c-'a'); if(sq<squad.size()&&sq>=0) { if(squad[sq]==activesquad)assemblesquad(squad[sq]); else activesquad=squad[sq]; } } if(c>='1'&&c<='7')review_mode((int)(c-'1')); if(c=='z') { assemblesquad(NULL); if(activesquad==NULL&&squad.size()>0) { activesquad=squad[squad.size()-1]; } } if(c=='t')squadlessbaseassign(); if(c=='u')promoteliberals(); }while(1); } void assemblesquad(squadst *cursquad) { long culloc=-1; int p; if(cursquad!=NULL) { culloc=cursquad->squad[0]->location; } char newsquad=0; if(cursquad==NULL) { cursquad=new squadst; cursquad->id=cursquadid; cursquadid++; newsquad=1; } vector<creaturest *> temppool; for(p=0;p<pool.size();p++) { if(pool[p]->alive==1&& pool[p]->align==1&& pool[p]->clinic==0&& pool[p]->dating==0&& pool[p]->hiding==0) { if(location[pool[p]->location]->type!=SITE_GOVERNMENT_POLICESTATION&& location[pool[p]->location]->type!=SITE_GOVERNMENT_COURTHOUSE&& location[pool[p]->location]->type!=SITE_GOVERNMENT_PRISON&& (pool[p]->location==culloc||culloc==-1))temppool.push_back(pool[p]); } } //BUILD LIST OF BASES FOR EACH SQUAD IN CASE IT ENDS UP EMPTY //THEN WILL DROP ITS LOOT THERE vector<int> squadloc; squadloc.resize(squad.size()); for(int sl=0;sl<squad.size();sl++) { squadloc[sl]=squad[sl]->squad[0]->location; if(squadloc[sl]!=-1) { if(location[squadloc[sl]]->renting==-1) { squadloc[sl]=-1; } } } short page=0; int squadsize; char num[20]; do { squadsize=0; for(p=0;p<6;p++)if(cursquad->squad[p]!=NULL)squadsize++; erase(); set_color(COLOR_WHITE,COLOR_BLACK,0); move(0,0); if(squadsize<6)addstr("Assemble the squad!"); else addstr("The squad is full."); if(newsquad) { move(0,71); addstr("New Squad"); } else { move(0,73-strlen(cursquad->name)); addstr("Squad: "); addstr(cursquad->name); } move(1,0); addstr("----CODE NAME------------SKILL---HEALTH-----------PROFESSION--------------------"); int y=2; for(p=page*19;p<temppool.size()&&p<page*19+19;p++) { set_color(COLOR_WHITE,COLOR_BLACK,0); move(y,0); addch(y+'A'-2);addstr(" - "); addstr(temppool[p]->name); char bright=0; unsigned long skill=0; for(int sk=0;sk<SKILLNUM;sk++) { skill+=(unsigned long)temppool[p]->skill[sk]; if(temppool[p]->skill_ip[sk]>=100*((10+temppool[p]->skill[sk])/10)&& temppool[p]->skill[sk]<temppool[p]->attval(skillatt(sk))*2)bright=1; } set_color(COLOR_WHITE,COLOR_BLACK,bright); move(y,25); itoa(skill,num,10); addstr(num); printhealthstat(*temppool[p],y,33,FALSE); if(temppool[p]->squadid==cursquad->id) { set_color(COLOR_GREEN,COLOR_BLACK,1); move(y,75); addstr("SQUAD"); } else if(temppool[p]->squadid!=-1) { set_color(COLOR_YELLOW,COLOR_BLACK,0); move(y,75); addstr("SQUAD"); } else if(cursquad->squad[0]!=NULL) { if(cursquad->squad[0]->location!=temppool[p]->location) { set_color(COLOR_BLACK,COLOR_BLACK,1); move(y,75); addstr("AWAY"); } } char str[200]; if(temppool[p]->align==-1)set_color(COLOR_RED,COLOR_BLACK,1); else if(temppool[p]->align==0)set_color(COLOR_WHITE,COLOR_BLACK,1); else set_color(COLOR_GREEN,COLOR_BLACK,1); move(y,50); getrecruitcreature(str,temppool[p]->type); addstr(str); y++; } set_color(COLOR_WHITE,COLOR_BLACK,0); move(22,0); addstr("Press a Letter to add or remove a Liberal from the squad."); move(23,0); if(interface_pgup=='[') { addstr("[] to view other Liberal pages."); } else if(interface_pgup=='.') { addstr("; and : to view other Liberal pages."); } else { addstr("PGUP/PGDN to view other Liberal pages."); } move(24,0); if(squadsize>0)addstr("1 - The squad is ready."); else addstr("1 - I need no squad!"); if(squadsize>0)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(24,40); addstr("9 - Dissolve the squad."); refresh(); int c=getch(); translategetch(c); //PAGE UP if(c==interface_pgup&&page>0)page--; //PAGE DOWN if(c==interface_pgdn&&(page+1)*19<temppool.size())page++; if(c>='a'&&c<='s') { int p=page*19+(int)(c-'a'); if(p<temppool.size()) { char conf=1; if(cursquad->squad[0]!=NULL) { if(cursquad->squad[0]->location!=temppool[p]->location) { set_color(COLOR_RED,COLOR_BLACK,1); move(22,0); addstr(" "); move(23,0); addstr(" Liberals must be in the same location to form a Squad. "); move(24,0); addstr(" "); refresh(); getch(); conf=0; } } if(!temppool[p]->canwalk()&& !(temppool[p]->flag & CREATUREFLAG_WHEELCHAIR)) { set_color(COLOR_RED,COLOR_BLACK,1); move(22,0); addstr(" "); move(23,0); addstr(" Squad Liberals must be able to move around. "); move(24,0); addstr(" Have this Liberal procure a wheelchair. "); refresh(); getch(); conf=0; } if(conf) { if(temppool[p]->squadid==cursquad->id) { char flipstart=0; for(int pt=0;pt<6;pt++) { if(cursquad->squad[pt]==temppool[p]) { flipstart=1; cursquad->squad[pt]->squadid=-1; } if(flipstart&&pt<5)cursquad->squad[pt]=cursquad->squad[pt+1]; } if(flipstart)cursquad->squad[5]=NULL; } else if(squadsize<6) { for(int pt=0;pt<6;pt++) { if(cursquad->squad[pt]==NULL) { removesquadinfo(*temppool[p]); cursquad->squad[pt]=temppool[p]; temppool[p]->squadid=cursquad->id; break; } } } } } } if(c=='1') { //CHECK IF GOOD char good=1; char care=0; for(int p=0;p<6;p++) { if(cursquad->squad[p]!=NULL) { if(cursquad->squad[p]->align==1) { care=1; break; } else good=0; } } if(good||care)break; else { set_color(COLOR_RED,COLOR_BLACK,1); move(22,0); addstr(" "); move(23,0); addstr("You cannot form a Squad with only Conservatives! "); move(24,0); addstr(" "); refresh(); getch(); } } if(c=='9') { for(int p=0;p<6;p++) { if(cursquad->squad[p]!=NULL) { cursquad->squad[p]->squadid=-1; cursquad->squad[p]=NULL; } } } }while(1); //FINALIZE NEW SQUADS char hasmembers=0; for(p=0;p<6;p++) { if(cursquad->squad[p]!=NULL) { hasmembers=1; break; } } if(newsquad) { if(hasmembers) { move(22,0); addstr(" "); move(23,0); addstr("What shall we designate this Liberal squad? "); move(24,0); addstr(" "); keypad(stdscr,FALSE); raw_output(FALSE); echo(); curs_set(1); mvgetstr(24,0,cursquad->name); curs_set(0); noecho(); raw_output(TRUE); keypad(stdscr,TRUE); squad.push_back(cursquad); } else delete cursquad; } //NUKE ALL EMPTY SQUADS for(int sq=squad.size()-1;sq>=0;sq--) { hasmembers=0; for(int p=0;p<6;p++) { if(squad[sq]->squad[p]!=NULL) { hasmembers=1; break; } } if(!hasmembers) { if(squadloc[sq]!=-1) { for(int l=0;l<squad[sq]->loot.size();l++) { location[squadloc[sq]]->loot.push_back(squad[sq]->loot[l]); } squad[sq]->loot.clear(); } if(activesquad==squad[sq])activesquad=NULL; delete squad[sq]; squad.erase(squad.begin() + sq); } } } void orderparty(void) { if(activesquad==NULL)return; int partysize=0; for(int p=0;p<6;p++) { if(activesquad->squad[p]!=NULL)partysize++; } if(partysize<=1)return; int spot=0; do { printparty(); move(8,20); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr("Choose a Liberal squad member for Place "); char num[20]; itoa(spot+1,num,10); addstr(num); addstr("."); refresh(); int c=getch(); translategetch(c); if(c==10)return; if(c>=spot+'1'&&c<=partysize+'1'-1) { creaturest *swap=activesquad->squad[spot]; activesquad->squad[spot]=activesquad->squad[c-'1']; activesquad->squad[c-'1']=swap; spot++; } }while(spot<partysize-1); } void initsite(locationst &loc) { int x = 0; //PREP if(activesquad==NULL)return; for(int e=0;e<ENCMAX;e++)encounter[e].exists=0; for(int p=0;p<6;p++) { if(activesquad->squad[p]!=NULL) { activesquad->squad[p]->forceinc=0; } } for(int l=0;l<groundloot.size();l++) { delete groundloot[l]; } groundloot.clear(); //MAKE MAP unsigned long oldseed=seed; seed=loc.mapseed; for(x=0;x<MAPX;x++) { for(int y=0;y<MAPY;y++) { for(int z=0;z<MAPZ;z++) { map[x][y][z].flag=SITEBLOCK_BLOCK; map[x][y][z].special=-1; map[x][y][z].siegeflag=0; } } } map[MAPX>>1][0][0].flag=SITEBLOCK_EXIT; map[(MAPX>>1)+1][0][0].flag=SITEBLOCK_EXIT; map[(MAPX>>1)+1][1][0].flag=SITEBLOCK_EXIT; map[(MAPX>>1)-1][0][0].flag=SITEBLOCK_EXIT; map[(MAPX>>1)-1][1][0].flag=SITEBLOCK_EXIT; map[MAPX>>1][1][0].flag=0; map[MAPX>>1][2][0].flag=SITEBLOCK_DOOR; if(loc.type==SITE_RESIDENTIAL_APARTMENT_UPSCALE|| loc.type==SITE_RESIDENTIAL_APARTMENT|| loc.type==SITE_RESIDENTIAL_TENEMENT) { map[MAPX>>1][1][0].special=SPECIAL_APARTMENT_SIGN; short height; int floors=LCSrandom(6)+1; int swap; for(int z=0;z<floors;z++) { for(int y=3;y<MAPY-3;y++) { map[MAPX>>1][y][z].flag=0; if(y%4==0) { height=y+LCSrandom(3)-1; map[(MAPX>>1)-1][height][z].flag=SITEBLOCK_DOOR; generateroom((MAPX>>1)-8,y-1,7,3,z); height=y+LCSrandom(3)-1; map[(MAPX>>1)+1][height][z].flag=SITEBLOCK_DOOR; generateroom((MAPX>>1)+2,y-1,7,3,z); if(y==4&&z==0) { map[(MAPX>>1)+2][height][z].flag=0; map[(MAPX>>1)+2][height][z].special=SPECIAL_APARTMENT_LANDLORD; } } } swap=(z%2)*2-1; if(z>0) { map[(MAPX>>1)+1*swap][MAPY-4][z].flag=0; map[(MAPX>>1)+1*swap][MAPY-4][z].special=SPECIAL_STAIRS_DOWN; } if(z<floors-1) { map[(MAPX>>1)-1*swap][MAPY-4][z].flag=0; map[(MAPX>>1)-1*swap][MAPY-4][z].special=SPECIAL_STAIRS_UP; } } } else { switch(loc.type) { case SITE_BUSINESS_LATTESTAND: { for(int x=(MAPX>>1)-4;x<=(MAPX>>1)+4;x++) { for(int y=0;y<7;y++) { if(x==(MAPX>>1)-4||x==(MAPX>>1)+4|| y==0||y==6)map[x][y][0].flag=SITEBLOCK_EXIT; else map[x][y][0].flag=0; map[x][y][0].special=-1; map[x][y][0].siegeflag=0; } } break; } case SITE_BUSINESS_JUICEBAR: case SITE_BUSINESS_CIGARBAR: case SITE_BUSINESS_VEGANCOOP: case SITE_BUSINESS_INTERNETCAFE: { for(int x=(MAPX>>1)-4;x<=(MAPX>>1)+4;x++) { for(int y=3;y<10;y++) { map[x][y][0].flag=0; map[x][y][0].special=-1; map[x][y][0].siegeflag=0; } } break; } case SITE_BUSINESS_CRACKHOUSE: { int dx=LCSrandom(5)*2+19; int dy=LCSrandom(3)*2+7; int rx=(MAPX>>1)-(dx>>1); int ry=3; generateroom(rx,ry,dx,dy,0); break; } default: { int dx=LCSrandom(5)*2+35; int dy=LCSrandom(3)*2+15; int rx=(MAPX>>1)-(dx>>1); int ry=3; generateroom(rx,ry,dx,dy,0); break; } } } //CLEAR AWAY BLOCKED DOORWAYS char block; char opennum; for(x=0;x<MAPX;x++) { for(int y=0;y<MAPY;y++) { for(int z=0;z<MAPZ;z++) { if(map[x][y][z].flag & SITEBLOCK_DOOR) { block=BIT1 | BIT2 | BIT3 | BIT4; opennum=0; if(x>0)if(!(map[x-1][y][z].flag&SITEBLOCK_BLOCK)){block&=~BIT2;opennum++;} if(x<MAPX-1)if(!(map[x+1][y][z].flag&SITEBLOCK_BLOCK)){block&=~BIT3;opennum++;} if(y>0)if(!(map[x][y-1][z].flag&SITEBLOCK_BLOCK)){block&=~BIT1;opennum++;} if(y<MAPY-1)if(!(map[x][y+1][z].flag&SITEBLOCK_BLOCK)){block&=~BIT4;opennum++;} if(opennum>=2)continue; //BLAST EVERYTHING AROUND TOTALLY BLOCKED DOOR if(block==(BIT1 | BIT2 | BIT3 | BIT4)) { if(x>0)map[x-1][y][z].flag&=~SITEBLOCK_BLOCK; if(x<MAPX-1)map[x+1][y][z].flag&=~SITEBLOCK_BLOCK; if(y>0)map[x][y-1][z].flag&=~SITEBLOCK_BLOCK; if(y<MAPY-1)map[x][y+1][z].flag&=~SITEBLOCK_BLOCK; } //DEAD-END OR OPEN A THREE-BLOCKED DOOR else if(!(block&BIT1)) { if(y<MAPY-1)map[x][y+1][z].flag&=~SITEBLOCK_BLOCK; else map[x][y+1][z].flag=SITEBLOCK_BLOCK; } else if(!(block&BIT4)) { if(y>0)map[x][y-1][z].flag&=~SITEBLOCK_BLOCK; else map[x][y-1][z].flag=SITEBLOCK_BLOCK; } else if(!(block&BIT2)) { if(x<MAPX-1)map[x+1][y][z].flag&=~SITEBLOCK_BLOCK; else map[x+1][y][z].flag=SITEBLOCK_BLOCK; } else if(!(block&BIT3)) { if(x>0)map[x-1][y][z].flag&=~SITEBLOCK_BLOCK; else map[x-1][y][z].flag=SITEBLOCK_BLOCK; } } } } } //DELETE NON-DOORS for(x=0;x<MAPX;x++) { for(int y=0;y<MAPY;y++) { for(int z=0;z<MAPZ;z++) { if(map[x][y][z].flag & SITEBLOCK_DOOR) { block=BIT1 | BIT2 | BIT3 | BIT4; if(x>0)if(!(map[x-1][y][z].flag&SITEBLOCK_BLOCK))block&=~BIT2; if(x<MAPX-1)if(!(map[x+1][y][z].flag&SITEBLOCK_BLOCK))block&=~BIT3; if(y>0)if(!(map[x][y-1][z].flag&SITEBLOCK_BLOCK))block&=~BIT1; if(y<MAPY-1)if(!(map[x][y+1][z].flag&SITEBLOCK_BLOCK))block&=~BIT4; if((block & BIT1) && (block & BIT4))continue; if((block & BIT2) && (block & BIT3))continue; map[x][y][z].flag&=~SITEBLOCK_DOOR; map[x][y][z].flag&=~SITEBLOCK_LOCKED; } } } } //ADD RESTRICTIONS bool restricted=0; switch(loc.type) { case SITE_LABORATORY_COSMETICS: case SITE_LABORATORY_GENETIC: case SITE_GOVERNMENT_POLICESTATION: case SITE_GOVERNMENT_COURTHOUSE: case SITE_GOVERNMENT_PRISON: case SITE_GOVERNMENT_INTELLIGENCEHQ: case SITE_MEDIA_AMRADIO: case SITE_MEDIA_CABLENEWS: restricted=1; for(x=2;x<MAPX-2;x++) { for(int y=2;y<MAPY-2;y++) { for(int z=0;z<MAPZ;z++) { map[x][y][z].flag|=SITEBLOCK_RESTRICTED; } } } break; } //NOW CLEAR FIRST FLOOR RESTRICTIONS NEAR TO DOOR char acted; map[MAPX>>1][2][0].flag&=~SITEBLOCK_RESTRICTED; do { acted=0; for(int x=2;x<MAPX-2;x++) { for(int y=2;y<MAPY-2;y++) { if(!(map[x][y][0].flag & SITEBLOCK_DOOR)&& !(map[x][y][0].flag & SITEBLOCK_BLOCK)&& (map[x][y][0].flag & SITEBLOCK_RESTRICTED)) { if(!(map[x-1][y][0].flag & SITEBLOCK_RESTRICTED)|| !(map[x+1][y][0].flag & SITEBLOCK_RESTRICTED)|| !(map[x][y-1][0].flag & SITEBLOCK_RESTRICTED)|| !(map[x][y+1][0].flag & SITEBLOCK_RESTRICTED)) { map[x][y][0].flag&=~SITEBLOCK_RESTRICTED; acted=1; continue; } } } } }while(acted); //ADD ACCESSORIES seed=oldseed; for(x=2;x<MAPX-2;x++) { for(int y=2;y<MAPY-2;y++) { for(int z=0;z<MAPZ;z++) { if(!(map[x][y][0].flag & SITEBLOCK_DOOR)&& !(map[x][y][0].flag & SITEBLOCK_BLOCK)&& !LCSrandom(10)) { switch(loc.type) { case SITE_RESIDENTIAL_SHELTER: case SITE_BUSINESS_CRACKHOUSE: case SITE_BUSINESS_JUICEBAR: case SITE_BUSINESS_CIGARBAR: case SITE_BUSINESS_LATTESTAND: case SITE_BUSINESS_VEGANCOOP: case SITE_BUSINESS_INTERNETCAFE: case SITE_INDUSTRY_WAREHOUSE: break; default: map[x][y][z].flag|=SITEBLOCK_LOOT; break; } } if(!(map[x][y][0].flag & SITEBLOCK_DOOR)&& !(map[x][y][0].flag & SITEBLOCK_BLOCK)&& !(map[x][y][0].flag & SITEBLOCK_LOOT)&& (map[x][y][0].flag & SITEBLOCK_RESTRICTED)&& loc.type==SITE_LABORATORY_COSMETICS&&!LCSrandom(10)) { map[x][y][z].special=SPECIAL_LAB_COSMETICS_CAGEDANIMALS; } if(!(map[x][y][0].flag & SITEBLOCK_DOOR)&& !(map[x][y][0].flag & SITEBLOCK_BLOCK)&& !(map[x][y][0].flag & SITEBLOCK_LOOT)&& (map[x][y][0].flag & SITEBLOCK_RESTRICTED)&& loc.type==SITE_LABORATORY_GENETIC&&!LCSrandom(10)) { map[x][y][z].special=SPECIAL_LAB_GENETIC_CAGEDANIMALS; } if(map[x][y][0].flag==0&& loc.type==SITE_INDUSTRY_SWEATSHOP&&!LCSrandom(10)) { map[x][y][z].special=SPECIAL_SWEATSHOP_EQUIPMENT; } if(map[x][y][0].flag==0&& loc.type==SITE_INDUSTRY_POLLUTER&&!LCSrandom(10)) { map[x][y][z].special=SPECIAL_POLLUTER_EQUIPMENT; } if(map[x][y][0].flag==0&& (loc.type==SITE_BUSINESS_JUICEBAR|| loc.type==SITE_BUSINESS_CIGARBAR|| loc.type==SITE_BUSINESS_LATTESTAND|| loc.type==SITE_BUSINESS_INTERNETCAFE)&& !LCSrandom(10)) { map[x][y][z].special=SPECIAL_RESTAURANT_TABLE; } if(map[x][y][z].flag==0&&loc.type==SITE_BUSINESS_INTERNETCAFE&& !LCSrandom(10)) { map[x][y][z].special=SPECIAL_CAFE_COMPUTER; } } } } int freex,freey,freez=0; //ADD FIRST SPECIAL int count=100000; do { freex=LCSrandom(MAPX-4)+2; freey=LCSrandom(MAPY-4)+2; if(freex>=(MAPX>>1)-2&& freex<=(MAPX>>1)+2)freey=LCSrandom(MAPY-6)+4; count--; }while(( map[freex][freey][freez].flag & SITEBLOCK_DOOR || map[freex][freey][freez].flag & SITEBLOCK_BLOCK || map[freex][freey][freez].flag & SITEBLOCK_LOOT || map[freex][freey][freez].special!=-1 )&&count>0); switch(loc.type) { case SITE_INDUSTRY_NUCLEAR: map[freex][freey][freez].special=SPECIAL_NUCLEAR_ONOFF; break; case SITE_GOVERNMENT_POLICESTATION: map[freex][freey][freez].special=SPECIAL_POLICESTATION_LOCKUP; break; case SITE_GOVERNMENT_COURTHOUSE: map[freex][freey][freez].special=SPECIAL_COURTHOUSE_LOCKUP; break; case SITE_GOVERNMENT_PRISON: map[freex][freey][freez].special=SPECIAL_PRISON_CONTROL; break; case SITE_GOVERNMENT_INTELLIGENCEHQ: map[freex][freey][freez].special=SPECIAL_INTEL_SUPERCOMPUTER; break; case SITE_CORPORATE_HEADQUARTERS: map[freex][freey][freez].special=SPECIAL_CORPORATE_FILES; break; case SITE_CORPORATE_HOUSE: map[freex][freey][freez].special=SPECIAL_HOUSE_PHOTOS; break; case SITE_MEDIA_AMRADIO: map[freex][freey][freez].special=SPECIAL_RADIO_BROADCASTSTUDIO; break; case SITE_MEDIA_CABLENEWS: map[freex][freey][freez].special=SPECIAL_NEWS_BROADCASTSTUDIO; break; } count=100000; //ADD SECOND SPECIAL do { freex=LCSrandom(MAPX-4)+2; freey=LCSrandom(MAPY-4)+2; if(freex>=(MAPX>>1)-2&& freex<=(MAPX>>1)+2)freey=LCSrandom(MAPY-6)+4; count--; }while(( map[freex][freey][freez].flag & SITEBLOCK_DOOR || map[freex][freey][freez].flag & SITEBLOCK_BLOCK || map[freex][freey][freez].flag & SITEBLOCK_LOOT || map[freex][freey][freez].special!=-1 )&&count>0); switch(loc.type) { case SITE_GOVERNMENT_COURTHOUSE: map[freex][freey][freez].special=SPECIAL_COURTHOUSE_JURYROOM; break; } } void generateroom(int rx,int ry,int dx,int dy,int z) { for(int x=rx;x<rx+dx;x++) { for(int y=ry;y<ry+dy;y++) { map[x][y][z].flag=0; } } if((dx<=3||dy<=3)&&!LCSrandom(2))return; if(dx<=2&&dy<=2)return; //LAY DOWN WALL AND ITERATE if((!LCSrandom(2)||dy<=2)&&dx>2) { int wx=rx+LCSrandom(dx-2)+1; for(int wy=0;wy<dy;wy++)map[wx][ry+wy][z].flag=SITEBLOCK_BLOCK; int rny=LCSrandom(dy); map[wx][ry+rny][z].flag=SITEBLOCK_DOOR; if(!LCSrandom(3))map[wx][ry+rny][z].flag|=SITEBLOCK_LOCKED; generateroom(rx,ry,wx-rx,dy,z); generateroom(wx+1,ry,rx+dx-wx-1,dy,z); } else { int wy=ry+LCSrandom(dy-2)+1; for(int wx=0;wx<dx;wx++)map[rx+wx][wy][z].flag=SITEBLOCK_BLOCK; int rnx=LCSrandom(dx); map[rx+rnx][wy][z].flag=SITEBLOCK_DOOR; if(!LCSrandom(3))map[rx+rnx][wy][z].flag|=SITEBLOCK_LOCKED; generateroom(rx,ry,dx,wy-ry,z); generateroom(rx,wy+1,dx,ry+dy-wy-1,z); } } void mode_site(long loc) { sitetype=location[loc]->type; cursite=loc; sitealarm=0; sitealarmtimer=-1; postalarmtimer=0; sitealienate=0; sitecrime=0; initsite(*location[loc]); sitestory=newsstory[newsstory.size()-1]; mode=GAMEMODE_SITE; if(!location[loc]->siege.siege) { locx=MAPX>>1; locy=1; locz=0; } else { sitealarm=1; location[loc]->siege.attacktime=0; location[loc]->siege.kills=0; //PLACE YOU int maxy=0; for(int x=0;x<MAPX;x++) { for(int y=0;y<MAPY;y++) { for(int z=0;z<MAPZ;z++) { if(!location[loc]->siege.lights_off)map[x][y][z].flag|=SITEBLOCK_KNOWN; map[x][y][z].flag&=~SITEBLOCK_LOCKED; map[x][y][z].flag&=~SITEBLOCK_LOOT; } if(!(map[x][y][0].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR)))maxy=y; } } do { locx=LCSrandom(MAPX); locy=maxy-LCSrandom(3); if(locy<3)locy=3; locz=0; }while(map[locx][locy][locz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR)); //PLACE LOOT int lootnum=location[loc]->loot.size(); if(lootnum>10)lootnum=10; int lx,ly,lz; for(int l=0;l<lootnum;l++) { do { lx=LCSrandom(MAPX); ly=LCSrandom(MAPY); lz=0; }while(map[lx][ly][lz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR|SITEBLOCK_EXIT)); map[lx][ly][lz].flag|=SITEBLOCK_LOOT; } //PLACE TRAPS if(location[loc]->compound_walls & COMPOUND_TRAPS) { int trapnum=30; for(int t=0;t<trapnum;t++) { do { lx=LCSrandom(MAPX); ly=LCSrandom(MAPY); lz=0; }while(map[lx][ly][lz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR|SITEBLOCK_EXIT|SITEBLOCK_LOOT)); map[lx][ly][lz].siegeflag|=SIEGEFLAG_TRAP; } } //PLACE UNITS int unitnum=10; int count=50000; for(int t=0;t<unitnum;t++) { do { lx=LCSrandom(11)+(MAPX/2)-5; ly=LCSrandom(8); lz=0; count--; if(count==0)break; }while((map[lx][ly][lz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR|SITEBLOCK_EXIT))|| (map[lx][ly][lz].siegeflag & (SIEGEFLAG_UNIT|SIEGEFLAG_HEAVYUNIT|SIEGEFLAG_TRAP))); map[lx][ly][lz].siegeflag|=SIEGEFLAG_UNIT; } if(!(location[loc]->compound_walls & COMPOUND_TANKTRAPS)&& location[loc]->siege.siegetype==SIEGE_POLICE&& location[loc]->siege.escalationstate>=2) { count=50000; int hunitnum=3; for(int t=0;t<hunitnum;t++) { do { lx=LCSrandom(11)+(MAPX/2)-5; ly=LCSrandom(8); lz=0; count--; if(count==0)break; }while((map[lx][ly][lz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR|SITEBLOCK_EXIT))|| (map[lx][ly][lz].siegeflag & (SIEGEFLAG_UNIT|SIEGEFLAG_HEAVYUNIT|SIEGEFLAG_TRAP))); map[lx][ly][lz].siegeflag|=SIEGEFLAG_HEAVYUNIT; } } } mode_site(); } void mode_site(void) { int p, x, u; if(activesquad==NULL)return; reloadparty(); showcarprefs=-1; char bail_on_base=1; if(cursite==activesquad->squad[0]->base)bail_on_base=0; knowmap(locx,locy,locz); char hostcheck=0; do { int partysize=0; int partyalive=0; for(p=0;p<6;p++) { if(activesquad->squad[p]!=NULL)partysize++; else continue; if(activesquad->squad[p]->alive==1)partyalive++; } int encsize=0; int freeable=0; int enemy=0; int majorenemy=0; int talkers=0; for(int e=0;e<ENCMAX;e++) { if(encounter[e].exists) { encsize++; if(encounter[e].align==-1)enemy++; if(encounter[e].type==CREATURE_WORKER_SERVANT|| encounter[e].type==CREATURE_WORKER_FACTORY_CHILD|| encounter[e].type==CREATURE_WORKER_SWEATSHOP)freeable++; else if(!encounter[e].cantbluff)talkers++; if(encounter[e].type==CREATURE_CORPORATE_CEO|| encounter[e].type==CREATURE_RADIOPERSONALITY|| encounter[e].type==CREATURE_NEWSANCHOR|| encounter[e].type==CREATURE_SCIENTIST_EMINENT|| encounter[e].type==CREATURE_JUDGE_CONSERVATIVE)majorenemy++; } } int libnum=0; for(p=0;p<pool.size();p++) { if(pool[p]->align==1&& pool[p]->alive&& pool[p]->location==cursite&& !(pool[p]->flag & CREATUREFLAG_SLEEPER))libnum++; } erase(); if(location[cursite]->siege.siege) { set_color(COLOR_RED,COLOR_BLACK,1); move(0,0); addlocationname(location[cursite]); addstr(", Level "); char num[20]; itoa(locz+1,num,10); addstr(num); addstr(": Escape or Engage"); } else { if (postalarmtimer>100)set_color(COLOR_RED,COLOR_BLACK,1); else if(postalarmtimer>80)set_color(COLOR_YELLOW,COLOR_BLACK,1); else set_color(COLOR_WHITE,COLOR_BLACK,0); move(0,0); addlocationname(location[cursite]); addstr(", Level "); char num[20]; itoa(locz+1,num,10); addstr(num); if(postalarmtimer>100)addstr(": MASSIVE CONSERVATIVE RESPONSE"); else if(postalarmtimer>80)addstr(": MASSIVE RESPONSE IMMINENT"); else if(sitealienate==1)addstr(": ALIENATED MASSES"); else if(sitealienate==2)addstr(": ALIENATED EVERYONE"); else if(sitealarm)addstr(": CONSERVATIVES ALARMED"); else if(sitealarmtimer==0)addstr(": CONSERVATIVES SUSPICIOUS"); } //PRINT PARTY if(partyalive==0)party_status=-1; printparty(); //PRINT SITE INSTRUCTIONS if(partyalive>0) { if(!enemy||!sitealarm)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(9,1); addstr("W,A,D,X - Move"); if(partysize>1)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(11,1); addstr("O - Change the squad's Liberal order"); if(partysize>0&&(party_status==-1||partysize>1))set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(12,1); addstr("# - Check the status of a squad Liberal"); if(party_status!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(13,1); addstr("0 - Show the squad's Liberal status"); if(groundloot.size()>0||(map[locx][locy][locz].flag&SITEBLOCK_LOOT)) { set_color(COLOR_WHITE,COLOR_BLACK,0); } else set_color(COLOR_BLACK,COLOR_BLACK,1); move(9,18); addstr("G - Get Loot"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(9,35); addstr("M - Map"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(10,35); addstr("S - Wait"); if(!enemy||!sitealarm)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(10,45); addstr("L - Reload"); if(enemy)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(13,45); addstr("K - Kidnap"); if(talkers)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(14,18); addstr("T - Talk"); if(map[locx][locy][locz].special!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(11,45); addstr("U - Use"); if(enemy&&sitealarm)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(12,45); addstr("V - Evade"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(9,45); addstr("E - Equip"); if(enemy)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(14,1); addstr("F - Fight!"); if(!location[cursite]->siege.siege) { if(freeable&&(!enemy||!sitealarm))set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(14,35); addstr("R - Release oppressed"); } else { if(libnum>6)set_color(COLOR_WHITE,COLOR_BLACK,0); else set_color(COLOR_BLACK,COLOR_BLACK,1); move(14,35); addstr("R - Reorganize"); } } else { set_color(COLOR_WHITE,COLOR_BLACK,0); move(9,1); addstr("C - Reflect on your Conservative ineptitude"); } //PRINT SITE MAP printsitemap(locx,locy,locz); //CHECK IF YOU HAVE A SQUIRMING AMATEUR HOSTAGE //hostcheck SHOULD ONLY BE 1 WHEN A NEWENC IS CREATED if(hostcheck) { char havehostage=0; for(int p=0;p<6;p++) { if(activesquad->squad[p]!=NULL) { if(activesquad->squad[p]->prisoner!=NULL&& activesquad->squad[p]->weapon.type==WEAPON_NONE) { if(activesquad->squad[p]->prisoner->squadid==-1) { activesquad->squad[p]->prisoner->flag|=CREATUREFLAG_KIDNAPPED; if(activesquad->squad[p]->type==CREATURE_RADIOPERSONALITY)offended_amradio=1; if(activesquad->squad[p]->type==CREATURE_NEWSANCHOR)offended_cablenews=1; havehostage=1; } } } } if(havehostage) { alienationcheck(1); sitecrime+=5; criminalizeparty(LAWFLAG_KIDNAPPING); } hostcheck=0; clearmessagearea(); } refresh(); int c=getch(); translategetch(c); if(partyalive==0&&c=='c') { //DESTROY ALL CARS BROUGHT ALONG WITH PARTY if(!location[cursite]->siege.siege) { for(int p=0;p<6;p++) { if(activesquad->squad[p]==NULL)continue; if(activesquad->squad[p]->carid!=-1) { long v=id_getcar(activesquad->squad[p]->carid); if(v!=-1) { removecarprefs_pool(vehicle[v]->id); delete vehicle[v]; vehicle.erase(vehicle.begin() + v); } } } } for(int p=0;p<6;p++) { if(activesquad->squad[p]==NULL)continue; for(int pl=pool.size()-1;pl>=0;pl--) { if(pool[pl]==activesquad->squad[p]) { delete pool[pl]; pool.erase(pool.begin() + pl); break; } } activesquad->squad[p]=NULL; } //END OF GAME CHECK if(!endcheck()) { if(location[cursite]->siege.siege) { if(location[cursite]->siege.underattack)sitestory->type=NEWSSTORY_SQUAD_KILLED_SIEGEATTACK; else sitestory->type=NEWSSTORY_SQUAD_KILLED_SIEGEESCAPE; } else sitestory->type=NEWSSTORY_SQUAD_KILLED_SITE; if(!location[cursite]->siege.siege) { if(!sitealienate) { long addjuice=sitecrime;if(addjuice>20)addjuice=20; juiceparty(addjuice); } resolvesite(); } mode=GAMEMODE_BASE; showcarprefs=0; return; } } if(partyalive>0) { int olocx=locx; int olocy=locy; int olocz=locz; char override=0; if(c=='v'&&enemy&&sitealarm) { set_color(COLOR_WHITE,COLOR_BLACK,1); move(16,1); addstr("Which way? (W,A,D, and X to move, ENTER to abort) "); move(17,1); addstr(" "); refresh(); do { int c2=getch(); translategetch(c2); if(c2=='w'||c2=='a'||c2=='d'||c2=='x') { c=c2; override=1; break; } if(c2==10)break; }while(1); } if(c=='w'&&locy>0&&(!enemy||!sitealarm||override)) { if(!(map[locx][locy-1][locz].flag & SITEBLOCK_BLOCK))locy--; } if(c=='a'&&locx>0&&(!enemy||!sitealarm||override)) { if(!(map[locx-1][locy][locz].flag & SITEBLOCK_BLOCK))locx--; } if(c=='d'&&locx<MAPX-1&&(!enemy||!sitealarm||override)) { if(!(map[locx+1][locy][locz].flag & SITEBLOCK_BLOCK))locx++; } if(c=='x'&&locy<MAPY-1&&(!enemy||!sitealarm||override)) { if(!(map[locx][locy+1][locz].flag & SITEBLOCK_BLOCK))locy++; } if(c=='k'&&enemy) { kidnapattempt(); } if(c=='u'&&map[locx][locy][locz].special!=-1) { switch(map[locx][locy][locz].special) { case SPECIAL_LAB_COSMETICS_CAGEDANIMALS:special_lab_cosmetics_cagedanimals();break; case SPECIAL_NUCLEAR_ONOFF:special_nuclear_onoff();break; case SPECIAL_LAB_GENETIC_CAGEDANIMALS:special_lab_genetic_cagedanimals();break; case SPECIAL_POLICESTATION_LOCKUP:special_policestation_lockup();break; case SPECIAL_COURTHOUSE_LOCKUP:special_courthouse_lockup();break; case SPECIAL_COURTHOUSE_JURYROOM:special_courthouse_jury();break; case SPECIAL_PRISON_CONTROL:special_prison_control();break; case SPECIAL_INTEL_SUPERCOMPUTER:special_intel_supercomputer();break; case SPECIAL_SWEATSHOP_EQUIPMENT:special_sweatshop_equipment();break; case SPECIAL_POLLUTER_EQUIPMENT:special_polluter_equipment();break; case SPECIAL_HOUSE_PHOTOS:special_house_photos();break; case SPECIAL_CORPORATE_FILES:special_corporate_files();break; case SPECIAL_RADIO_BROADCASTSTUDIO:special_radio_broadcaststudio();break; case SPECIAL_NEWS_BROADCASTSTUDIO:special_news_broadcaststudio();break; case SPECIAL_APARTMENT_SIGN:special_readsign(SPECIAL_APARTMENT_SIGN);break; case SPECIAL_STAIRS_UP:locz++;break; case SPECIAL_STAIRS_DOWN:locz--;break; } } if(c=='t'&&talkers) { int forcesp=-1; int forcetk=-1; for(int p=0;p<6;p++) { if(activesquad->squad[p]!=NULL) { if(activesquad->squad[p]->alive) { if(forcesp==-1)forcesp=p; else forcesp=-2; } } } for(int e=0;e<ENCMAX;e++) { if(encounter[e].exists&&encounter[e].alive&& !(encounter[e].type==CREATURE_WORKER_SERVANT|| encounter[e].type==CREATURE_WORKER_SWEATSHOP)) { if(!encounter[e].cantbluff) { if(forcetk==-1)forcetk=e; else forcetk=-2; } } } if(forcetk!=-1&&forcesp!=-1) { int tk=-1,sp=-1; if(forcesp==-2) { clearcommandarea(); clearmessagearea(); clearmaparea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(9,1); addstr("Which Liberal will speak?"); move(9,50); addstr("Issues"); move(9,60); addstr("Dating"); move(9,70); addstr("Bluff"); char num[20]; int y=11; for(int p=0;p<6;p++) { if(activesquad->squad[p]!=NULL) { if(activesquad->squad[p]->alive) { move(y,1); addch(p+'1'); addstr(" - "); addstr(activesquad->squad[p]->name); move(y,50); itoa(activesquad->squad[p]->attval(ATTRIBUTE_CHARISMA)+ activesquad->squad[p]->attval(ATTRIBUTE_HEART)+ activesquad->squad[p]->skill[SKILL_PERSUASION]*2,num,10); addstr(num); move(y,60); itoa(activesquad->squad[p]->attval(ATTRIBUTE_CHARISMA)*2+ activesquad->squad[p]->skill[SKILL_PERSUASION]*2,num,10); addstr(num); move(y,70); itoa(activesquad->squad[p]->attval(ATTRIBUTE_CHARISMA)+ activesquad->squad[p]->attval(ATTRIBUTE_WISDOM)+ activesquad->squad[p]->skill[SKILL_PERSUASION]*2,num,10); addstr(num); y++; } } } do { refresh(); int c=getch(); translategetch(c); if(c>='1'&&c<='6') { sp=c-'1'; if(activesquad->squad[sp]!=NULL) { if(activesquad->squad[sp]->alive)break; } } if(c==10||c==27||c==32){sp=-1;break;} }while(1); } else sp=forcesp; if(sp!=-1) { if(forcetk==-2) { do { clearcommandarea(); clearmessagearea(); clearmaparea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(9,1); addstr("To whom?"); int x=1,y=11; for(int t=0;t<ENCMAX;t++) { if(encounter[t].exists) { move(y,x); addch(t+'A'); addstr(" - "); addstr(encounter[t].name); y++; if(y==17) { y=11; x+=30; } } } refresh(); int c=getch(); translategetch(c); if(c>='a'&&c<='z') { tk=c-'a'; if(tk<ENCMAX) { if(encounter[tk].exists) { if(encounter[tk].alive&& !(encounter[tk].type==CREATURE_WORKER_SERVANT|| encounter[tk].type==CREATURE_WORKER_SWEATSHOP)) { if(encounter[tk].cantbluff==2) { clearcommandarea(); clearmessagearea(); clearmaparea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(9,1); addstr("You can't talk in the middle of a fight."); refresh(); getch(); } else if(encounter[tk].cantbluff==1) { clearcommandarea(); clearmessagearea(); clearmaparea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(9,1); addstr(encounter[tk].name); addstr(" won't talk to you."); refresh(); getch(); } else if(encounter[tk].align!=-1&&sitealarm&&enemy) { clearcommandarea(); clearmessagearea(); clearmaparea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(9,1); addstr("You have to deal with the conservatives first."); refresh(); getch(); } else break; } } } } if(c==10||c==27||c==32){tk=-1;break;} }while(1); } else tk=forcetk; if(tk!=-1) { if(talk(*activesquad->squad[sp],tk)) { if(enemy&&sitealarm)enemyattack(); else if(enemy)disguisecheck(); creatureadvance(); } } } } } if(c=='l'&&(!enemy||!sitealarm)) { reloadparty(); printparty(); refresh(); creatureadvance(); } if(c=='o'&&partysize>1)orderparty(); if(c=='0')party_status=-1; if(c=='m') { for(int x=0;x<MAPX;x++) { for(int y=0;y<MAPY;y++) { if(map[x][y][locz].flag & SITEBLOCK_KNOWN) { move(y+1,x+5); if(x==locx&&y==locy) { set_color(COLOR_GREEN,COLOR_BLACK,1); addch(1); } else { set_color(COLOR_WHITE,COLOR_BLACK,0); if(map[x][y][locz].flag & SITEBLOCK_BLOCK)addch(CH_FULL_BLOCK); else if(map[x][y][locz].flag & SITEBLOCK_DOOR)addch(CH_LIGHT_SHADE); else if((map[x][y][locz].siegeflag & SIEGEFLAG_HEAVYUNIT)&& (location[cursite]->compound_walls & COMPOUND_CAMERAS)&&!location[cursite]->siege.cameras_off) { set_color(COLOR_RED,COLOR_BLACK,1); addch(CH_YEN_SIGN); } else if((map[x][y][locz].siegeflag & SIEGEFLAG_UNIT)&& (location[cursite]->compound_walls & COMPOUND_CAMERAS)&&!location[cursite]->siege.cameras_off) { set_color(COLOR_RED,COLOR_BLACK,1); addch(2); } else if((map[x][y][locz].siegeflag & SIEGEFLAG_UNIT_DAMAGED)&& (location[cursite]->compound_walls & COMPOUND_CAMERAS)&&!location[cursite]->siege.cameras_off) { set_color(COLOR_RED,COLOR_BLACK,0); addch(2); } else if(map[x][y][locz].special==SPECIAL_STAIRS_UP) { set_color(COLOR_YELLOW,COLOR_BLACK,1); addch(24); } else if(map[x][y][locz].special==SPECIAL_STAIRS_DOWN) { set_color(COLOR_YELLOW,COLOR_BLACK,1); addch(25); } else if(map[x][y][locz].special!=-1) { set_color(COLOR_YELLOW,COLOR_BLACK,1); addch('!'); } else if(map[x][y][locz].siegeflag & SIEGEFLAG_TRAP) { set_color(COLOR_YELLOW,COLOR_BLACK,1); addch('!'); } else if(map[x][y][locz].flag & SITEBLOCK_LOOT) { set_color(COLOR_MAGENTA,COLOR_BLACK,1); addch('$'); } else addch(' '); } } else { set_color(COLOR_BLACK,COLOR_BLACK,1); move(y+1,x+5); addch(CH_FULL_BLOCK); } } } refresh(); getch(); } if(enemy&&c=='f') { youattack(); enemyattack(); creatureadvance(); } if(c=='r'&&location[cursite]->siege.siege&&libnum>6) { assemblesquad(activesquad); autopromote(cursite); } if(freeable&&(!enemy||!sitealarm)&&c=='r'&&!location[cursite]->siege.siege) { short followers=0; short actgot=0; if(enemy)sitealarm=1; char freed; char flipstart; do { flipstart=0; freed=0; for(int e=0;e<ENCMAX;e++) { if(!encounter[e].exists)break; if((encounter[e].type==CREATURE_WORKER_SERVANT|| encounter[e].type==CREATURE_WORKER_FACTORY_CHILD|| encounter[e].type==CREATURE_WORKER_SWEATSHOP)&&!flipstart) { followers++; flipstart=1; freed=1; if(partysize<6) { creaturest *newcr=new creaturest; *newcr=encounter[e]; namecreature(*newcr); newcr->location=activesquad->squad[0]->location; newcr->base=activesquad->squad[0]->base; newcr->hireid=activesquad->squad[0]->id; pool.push_back(newcr); stat_recruits++; for(int p=0;p<6;p++) { if(activesquad->squad[p]==NULL) { activesquad->squad[p]=newcr; newcr->squadid=activesquad->id; break; } } actgot++; partysize++; } } if(flipstart) { if(e<ENCMAX-1)encounter[e]=encounter[e+1]; } } if(flipstart)encounter[ENCMAX-1].exists=0; if(freed) { int time=20+LCSrandom(10); if(time<1)time=1; if(sitealarmtimer>time||sitealarmtimer==-1)sitealarmtimer=time; } }while(freed); if(followers>0) { clearmessagearea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(16,1); addstr("You free "); if(followers>1)addstr("some Oppressed workers"); else addstr("an Oppressed worker"); addstr(" from the Conservatives."); if(actgot<followers) { refresh(); getch(); clearmessagearea(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(16,1); if(actgot==0&&followers>1)addstr("They all leave"); else if(followers-actgot>1)addstr("Some leave"); else if(actgot==0)addstr("The worker leaves"); else addstr("One worker leaves"); addstr(" you, as there are many Liberals here."); set_color(COLOR_WHITE,COLOR_BLACK,1); move(17,1); addstr("The last thing you need is more attention."); } refresh(); getch(); } } if(c>='1'&&c<='6') { if(activesquad->squad[c-'1']!=NULL) { if(party_status==c-'1')fullstatus(party_status); else party_status=c-'1'; } } if(c=='e') { equip(activesquad->loot,-1); if(enemy&&sitealarm)enemyattack(); else if(enemy)disguisecheck(); creatureadvance(); } if(c=='g'&&(groundloot.size()>0||(map[locx][locy][locz].flag&SITEBLOCK_LOOT))) { char tookground=0; if(map[locx][locy][locz].flag&SITEBLOCK_LOOT) { map[locx][locy][locz].flag&=~SITEBLOCK_LOOT; if(location[cursite]->siege.siege) { //GRAB SOME OF THE BASE LOOT int lcount=1; //1 FROM THE ONE DELETED ABOVE for(int x=0;x<MAPX;x++) { for(int y=0;y<MAPY;y++) { for(int z=0;z<MAPZ;z++) { if(map[x][y][z].flag&SITEBLOCK_LOOT) { lcount++; } } } } int lplus=location[cursite]->loot.size()/lcount; if(lcount==1)lplus=location[cursite]->loot.size(); itemst *it; int b; while(lplus>0) { b=LCSrandom(location[