71 #define KEYDOWN( name, key ) (name[key]&0x80)
99 if (newState ==
PRESS) {
103 if (gain > 1) gain = 1;
113 if (newState ==
PRESS) {
117 if (gain < 0) gain = 0;
127 static int whichvdu = 1;
128 for (
int j = 0;
j < 3; ++
j) {
139 for (i = 0; i < 32; ++i) {
144 for (i = 0; i < 32; ++i) {
157 for (; view < 2; ++
view)
160 for (; examine < 2; ++examine)
163 if ( (examine == 2) && (view == 2) )
168 namespace CockpitKeys
183 if ( release || (ch ==
']' || ch ==
'[') )
return;
187 if ( textmessager < _Universe->numPlayers() ) {
201 std::string::size_type space = gcp->
textMessage.find(
' ' );
213 }
else if (code != 0 && code <= 127) {
214 char newstr[2] = {(char) code, 0};
225 if (newState ==
PRESS) {
226 static bool chat_only_in_network =
228 if ( (
Network == NULL) && chat_only_in_network )
255 if (newState ==
PRESS) {
256 printf(
"skipping\n" );
265 for (
int i = fromCam;
i <= toCam;
i++) {
266 if (newState ==
PRESS) {
284 for (
int i = fromCam;
i <= toCam;
i++) {
285 if (newState ==
PRESS) {
301 for (
int i = fromCam;
i <= toCam;
i++) {
302 if (newState ==
PRESS) {
316 for (
int i = fromCam;
i <= toCam;
i++) {
319 if (newState ==
PRESS) {
364 if (newState ==
PRESS || newState ==
DOWN) {
372 }
else if (newState ==
RELEASE) {
382 if (newState ==
PRESS || newState ==
DOWN) {
390 }
else if (newState ==
RELEASE) {
400 if (newState ==
PRESS || newState ==
DOWN) {
408 }
else if (newState ==
RELEASE) {
418 if (newState ==
PRESS || newState ==
DOWN) {
426 }
else if (newState ==
RELEASE) {
437 if (newState ==
PRESS) {
448 static int tmp = (game_options.
cockpit ? 1 : 0);
454 string cockpit =
"disabled-cockpit.cpt";
466 if (newState ==
PRESS || newState ==
DOWN) {
472 if (newState ==
PRESS || newState ==
DOWN)
480 if ( newState ==
PRESS || (newState ==
DOWN && scrolltime >= .5) ) {
482 printf(
"Enabling exceptions %d\n",
allexcept );
489 if ( newState ==
PRESS || (newState ==
DOWN && scrolltime >= .5) ) {
491 printf(
"Disabling exceptions\n" );
497 if (newState ==
PRESS || newState ==
DOWN)
503 if (newState ==
PRESS || newState ==
DOWN)
509 if (newState ==
PRESS || newState ==
DOWN) {
520 if (newState ==
PRESS || newState ==
DOWN) {
526 if (newState ==
PRESS || newState ==
DOWN) {
532 if (newState ==
PRESS || newState ==
DOWN) {
543 if (newState ==
PRESS || newState ==
DOWN) {
555 if (newState ==
PRESS || newState ==
DOWN) {
566 if (newState ==
PRESS) {
576 if (newState ==
PRESS) {
586 if (newState ==
PRESS) {
597 if (newState ==
PRESS) {
608 if (newState ==
PRESS) {
618 if (newState ==
PRESS) {
629 if (newState ==
PRESS) {
660 if (newState ==
PRESS)
665 if (newState ==
PRESS)
670 if (newState ==
PRESS)
675 if (newState ==
PRESS)
680 if (newState ==
PRESS)
685 if (newState ==
PRESS)
691 if (newState ==
PRESS || newState ==
DOWN) {
702 if (newState ==
PRESS || newState ==
DOWN) {
713 using namespace CockpitKeys;
730 var =
getSaveData( 0,
"436457r1K3574r7uP71m35", 0 );
731 putSaveData( 0,
"436457r1K3574r7uP71m35", 0, var+1 );
738 std::vector< StarSystem* > &ssys,
739 std::vector< QVector > &savedloc,
740 vector< vector< std::string > > &savefiles )
742 vector< std::string >fighter0mods;
743 vector< int > fighter0indices;
749 if (stdstr.length() > 0) {
759 if (stdstr.length() > 0) {
773 int *tmptarget =
new int[
numf];
778 vsUMap< string, int >targetmap;
780 char fightername[1024] =
"hornet.xunit";
783 vector< Flightgroup* >::const_iterator siter;
786 for (siter = fg.begin(); siter != fg.end(); siter++) {
788 string fg_name = fg->
name;
789 string fullname = fg->
type;
790 strcpy( fightername, fullname.c_str() );
791 string ainame = fg->
ainame;
792 float fg_radius = 0.0;
794 for (
int s = 0; s < fg->
nr_ships; s++) {
797 printf(
"Error: in createObjects: more ships in flightgroups than in total for mission!\n"
798 "Variables a=%d, fg-number-of-ships=%d, total nr=%d, fact=%s, fgname=%s\n",
803 QVector pox( 1000+150*a, 100*a, 100 );
805 pox.i = fg->
pos.i+s*fg_radius*3;
806 pox.j = fg->
pos.j+s*fg_radius*3;
807 pox.k = fg->
pos.k+s*fg_radius*3;
808 if (pox.i == pox.j && pox.j == pox.k && pox.k == 0) {
809 pox.i = rand()*10000./RAND_MAX-5000;
810 pox.j = rand()*10000./RAND_MAX-5000;
811 pox.k = rand()*10000./RAND_MAX-5000;
815 if ( fg_terrain == -1 || (fg_terrain == -2 && myterrain == NULL) ) {
816 string modifications(
"" );
817 if ( s == 0 && squadnum < (
int) fighter0name.size() ) {
820 fighter0indices.push_back( a );
821 if (fighter0name[squadnum].length() == 0)
822 fighter0name[squadnum] = string( fightername );
824 strcpy( fightername, fighter0name[squadnum].c_str() );
826 if (savedloc[squadnum].
i != FLT_MAX)
830 std::string srcsys = (*dat)[0];
833 (grav = *ui) != NULL;
836 for (
unsigned int i = 0;
i < siz; ++
i)
852 fighter0mods.push_back( modifications = game_options.
getCallsign( squadnum ) );
857 fprintf( stderr,
"FOUND MODIFICATION = %s FOR PLAYER #%d\n", modifications.c_str(), squadnum );
859 fighter0mods.push_back(
"" );
863 if ( squadnum < (
int) fighter0name.size() ) {
868 if (
Network != NULL && squadnum < (
int) fighter0name.size() ) {
869 if (
Network[squadnum].getCallsign() != modifications) {
870 cout<<
"Not CREATING A NETWORK PLAYER "<<fightername<<
" FOR "<<modifications<<endl;
873 cout<<
"CREATING A NETWORK PLAYER : "<<fightername<<endl;
880 cout<<
"Creating fighter["<<squadnum<<
"] from "<<modifications<<
" on Network["<<squadnum<<
"] named "
883 cout<<
"Not CREATING A LOCAL SHIP : "<<fightername<<endl;
886 cout<<
"CREATING A LOCAL SHIP : "<<fightername<<endl;
890 if ( s == 0 && squadnum < (
int) fighter0name.size() ) {
893 fighter0mods[squadnum].c_str(), pox );
895 if ( squadnum < (
int) fighter0name.size() ) {
900 bool isvehicle =
false;
901 if (fg_terrain == -2) {
921 printf(
"pox %lf %lf %lf\n", pox.i, pox.j, pox.k );
923 fg_radius = fighters[
a]->
rSize();
924 if (
benchmark > 0.0 || ( s != 0 || squadnum >= (
int) fighter0name.size() ) ) {
935 muzak[m_i].SetParent( fighters[0] );
938 for (
unsigned int cnum = 0; cnum < fighter0indices.size(); cnum++) {
971 +
QVector( rand()*10000./RAND_MAX-5000, rand()*10000./RAND_MAX-5000, rand()*10000./RAND_MAX-5000 ) );