/** set the toggles???
 * 
 * \param wh the button 
 * \param i in or out
 */
void Toggle(int wh,int i) 
{
 TRACE3("->Toggle(wh %d, i %d)", wh, i);
 switch(wh)
   {
    case 1:if (i==1) gxVirtualDisplay(&vh,1,21,55,49,89,81,0);else
	  gxVirtualDisplay(&vh,1,56,55,49,89,81,0); break;

    case 2:if(i==1)  gxVirtualDisplay(&vh,38,21,92,49,127,81,0);else
	  gxVirtualDisplay(&vh,38,56,92,49,127,81,0); break;

    case 3:if(i==1)  gxVirtualDisplay(&vh,75,21,129,49,163,81,0);else
	  gxVirtualDisplay(&vh,75,56,129,49,163,81,0); break;

    case 4:if(i==1)  gxVirtualDisplay(&vh,112,21,166,49,200,81,0);else
	  gxVirtualDisplay(&vh,112,56,166,49,200,81,0); break;

    case 5:if (i==1)  gxVirtualDisplay(&vh,153,1,5,49,52,71,0);
	     else gxVirtualDisplay(&vh,153,26,5,49,52,71,0); break;

  default:break;
 }
 TRACE1("<-Toggle()");
 return;
}
void ClearDisplay(void)
{
 gxVirtualDisplay(&vhptr,202,48,202,48,241,82,0);
 gxVirtualDisplay(&vhptr,17,83,17,83,241,195,0);
 gxVirtualDisplay(&vhptr,242,23,242,23,315,195,0);
 grSetColor(1);
 return;
}
/** draw a piechart
 * 
 * The piechart is indicating the number of astronauts on this mission.
 * 
 * \param s something of an offset...
 */
void draw_Pie(int s)
{
 int off;
 if (s==0) off=1;
   else off=s*20;
 gxVirtualDisplay(&vh,off,1,7,51,25,69,0);
 return;
}
int GetMinus(char plr)
{
 char i;int u;

 i=PrestMin(plr);
  RectFill(206,36,235,44,7);
 if (i<3) u=1; //ok
   else if (i<9) u=10; //caution
	else u=19; //danger
  gxVirtualDisplay(&vh,203,u,203,24,238,31,0);
 grSetColor(11);
 if (i>0) PrintAt(210,42,"-");
  else grMoveTo(210,42);
 DispNum(0,0,i);
 grSetColor(1);
 return 0;
}
Beispiel #5
0
void AI_Begin(char plr)
{
    int i;
    FILE *fin;
    int32_t len[2];


    for (i = 0; i < 768; i++) {
        pal[i] = 0;
    }

    fin = sOpen("TURN.BUT", "rb", 0);
    fread(&pal, 768, 1, fin);
    len[0] = fread(screen, 1, MAX_X * MAX_Y, fin);
    fclose(fin);
    RLED_img((char *)screen, vhptr.vptr, (unsigned int)len[0],
             vhptr.w, vhptr.h);

    gxClearDisplay(0, 0);
    ShBox(0, 60, 319, 80);
    grSetColor(6 + plr * 3);

    if (plr == 0) {
        DispBig(15, 64, "DIRECTOR OF THE UNITED STATES", 0, -1);
    } else {
        DispBig(30, 64, "CHIEF DESIGNER OF THE USSR", 0, -1);
    }

    grSetColor(11);
    grMoveTo(175, 122);

    if (Data->Season == 0) {
        PrintAt(0, 0, "SPRING 19");
    } else {
        PrintAt(0, 0, "FALL 19");
    }

    DispNum(0, 0, Data->Year);
    gxVirtualDisplay(&vhptr, 1 + 110 * plr, 1, 30, 85, 30 + 107, 85 + 93, 0);
    grSetColor(11);
    PrintAt(60, 58, "COMPUTER TURN:  THINKING...");
    music_start(M_SOVTYP);
    FadeIn(2, pal, 10, 0, 0);
    colss = 0;
}
void DrawFuture(char plr,int mis,char pad)
{
  int i,j;
  FILE *fin;
  unsigned sz;
  strcpy(IKEY,"k011");strcpy(IDT,"i011");
  
  JointFlag=0; // initialize joint flag
  F1=F2=F3=F4=FMen=F5=0;
  for (i=0;i<5;i++) lck[i]=status[i]=0;
  FadeOut(2,pal,10,0,0);
  Load_FUT_BUT();
  fin=sOpen("FMIN.IMG","rb",0);
  fread(&pal[0],768,1,fin);
  sz=fread(screen,1,MAX_X*MAX_Y,fin);
  fclose(fin);
  RLED_img((char *)screen,(char *)vhptr.vptr,sz,vhptr.w,vhptr.h);
  gxClearDisplay(0,0);

  gr_sync ();

    if (pad==2) JointFlag=0; // third pad automatic no joint mission
    else
      if (Data->P[plr].LaunchFacility[pad+1] == 1)
      {
       if (Data->P[plr].Future[pad+1].MissionCode==0) JointFlag=1; // if no mission then set joint flag
	  else if (Data->P[plr].Future[pad+1].part==1) // check if the part of that second mission is set
		 {
		  JointFlag=1;
		  Data->P[plr].Future[pad+1].MissionCode=0; // clear mission
		  Data->P[plr].Future[pad+1].part=0;
		 };
      };

  if (pad==1 || pad==0) {
    if (Data->P[plr].LaunchFacility[pad+1]==1) JointFlag=1;
  }

  i=Data->Year;j=Data->Season;
  TRACE3("--- Setting i=Year (%d), j=Season (%d)", i, j);
  if ((i==60 && j==0) || (i==62 && j==0) || (i==64 && j==0) ||
      (i==66 && j==0) || (i==69 && j==1) || (i==71 && j==1) ||
      (i==73 && j==1)) {

     gxVirtualVirtual(&vhptr,1,2,12,11,&vhptr,198,153,gxSET); /* Mars */
     MarFlag=1; } else MarFlag=0;
  if ((i==60 || i==64 || i==68 || i==72 || i==73 || i==77)) {
    gxVirtualVirtual(&vhptr,14,2,64,54,&vhptr,214,130,gxSET); /* Jup */
    JupFlag=1; } else JupFlag=0;
  if (i==61 || i==66 || i==72) {
    gxVirtualVirtual(&vhptr,66,2,114,53,&vhptr,266,135,gxSET); /* Sat */
    SatFlag=1; } else SatFlag=0;

  RectFill(1,1,318,21,3);RectFill(317,22,318,198,3);RectFill(1,197,316,198,3);
  RectFill(1,22,2,196,3);OutBox(0,0,319,199);InBox(3,3,30,19);
  InBox(3,22,316,196);
  IOBox(242,3,315,19);
  ShBox(5,24,183,47);
  ShBox(5,24,201,47); //name box
  ShBox(5,74,41,82); // RESET
  ShBox(5,49,53,72); //dur/man
  ShBox(43,74,53,82); // lock
  ShBox(80,74,90,82);
  ShBox(117,74,127,82);
  ShBox(154,74,164,82);
  ShBox(191,74,201,82);
  ShBox(5,84,16,130);   //arrows up
  ShBox(5,132,16,146); //middle box
  ShBox(5,148,16,194);   //    down
  ShBox(203,24,238,31);  // new right boxes
  RectFill(206,36,235,44,7);
  ShBox(203,33,238,47);
  InBox(205,35,236,45);
  UPArrow(8,95);DNArrow(8,157);
  
  gxVirtualDisplay(&vh,140,5,5,132,15,146,0);
  Toggle(5,1);draw_Pie(0);OutBox(5,49,53,72);
  Toggle(1,1);TogBox(55,49,0);
  Toggle(2,1);TogBox(92,49,0);
  Toggle(3,1);TogBox(129,49,0);

  FMen=F1=F2=F3=F4=F5=0;
  for (i=1;i<4;i++){
    if (status[i]!=0) {
      Toggle(i,1);
    }
  };
	 if (JointFlag==0) {
      F4=2;lck[4]=1;
      Toggle(4,1);
      InBox(191,74,201,82);
      PlaceRX(5);
      TogBox(166,49,1);
    }
	 else {
      F4=0; lck[4]=0;
      status[4]=0;
      Toggle(4,1);
      OutBox(191,74,201,82);
      ClearRX(5);
      TogBox(166,49,0);
    };

  gr_sync ();
  Missions(plr,8,37,mis,1);
  GetMinus(plr);
  grSetColor(5);
  /* lines of text are 1:8,30  2:8,37   3:8,44    */
  switch(pad) { // These used to say Pad 1, 2, 3  -Leon
    case 0: PrintAt(8,30,"PAD A:");break;
    case 1: PrintAt(8,30,"PAD B:");break;
    case 2: PrintAt(8,30,"PAD C:");break;
    default:break;
  };
  grSetColor(1);
  PrintAt(9,80,"RESET");
  PrintAt(256,13,"CONTINUE");
  grSetColor(11);
   if (Data->Season==0) PrintAt(200,9,"SPRING");
   else PrintAt(205,9,"FALL");
   PrintAt(206,16,"19");
   DispNum(0,0,Data->Year);
  grSetColor(1);
  FlagSm(plr,4,4);
  DispBig(40,5,"FUTURE MISSIONS",0,-1);
  FadeIn(2,pal,10,0,0);
  
  return;
}