Beispiel #1
0
void getinitials(void)
{
  Sint4 k,i;
  newframe();
  outtext("ENTER YOUR",100,70,3);
  outtext(" INITIALS",100,90,3);
  outtext("_ _ _",128,130,3);
  strcpy(scoreinit[0],"...");
  killsound();
  for (i=0;i<3;i++) {
    k=0;
    while (k==0) {
      k=getinitial(i*24+128,130);
      if (k==8 || k==127) {
        if (i>0)
          i--;
        k=0;
      }
    }
    if (k!=0) {
      gwrite(i*24+128,130,k,3);
      scoreinit[0][i]=k;
    }
  }
  for (i=0;i<20;i++)
    flashywait(15);
  setupsound();
  gclear();
  gpal(0);
  ginten(0);
  setretr(true);
  recputinit(scoreinit[0]);
}
Beispiel #2
0
void image_ginit ( int *kx, int *ky, int *sizx, int *sizy, int *iret )
{
int i, ier;
int newsize = (*kx) * (*ky);
char devstr[40];

    *iret = 0;

    if ( newsize > gsize ) {
	if ( gsize > 0 )
	    grid = (float *)realloc( grid, newsize*sizeof(float) );
	else
	    grid = (float *)malloc( newsize*sizeof(float) );

	if ( grid == NULL ) {
	    gsize = 0;
	    printf ("Error allocating requested grid points ( %d ).\n", newsize );
	    *iret = -1;
        }
	else
	    gsize = newsize;
    }

    for ( i=0; i < gsize; i++ ) grid[i] = RMISSD;

    if ( worksize < gsize )
      {
      if ( xin != NULL ) free(xin);
      if ( xout != NULL ) free(xout);
      if ( yin != NULL ) free(yin);
      if ( yout != NULL ) free(yout);

      xin = (float *)malloc(gsize * sizeof(float));
      xout = (float *)malloc(gsize * sizeof(float));
      yin = (float *)malloc(gsize * sizeof(float));
      yout = (float *)malloc(gsize * sizeof(float));
      worksize = gsize;
   
      if(xin == NULL) worksize = 0;
      if(xout == NULL) worksize = 0;
      if(yin == NULL) worksize = 0;
      if(yout == NULL) worksize = 0;
   
      if ( worksize == 0 ) 
         {
         printf("failed to malloc work arrays\n");
	 *iret = -1;
         return;
         }
      }


    sprintf(devstr,"gif|/dev/null|%d;%d\0",*sizx,*sizy);
    gg_sdev ( devstr, &ier, strlen(devstr));
    gclear ( &ier );
    im_drop ( &ier );
    radar_bounds(kx, ky, iret);
}
Beispiel #3
0
//Èë¿Úº¯Êý
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lptCmdLine, int nCmd)
{
	srand(time(0));
	ghInstance = hInstance;
	ginit();
	GameLoop(gdisplay);
	gclear();
	return 0;
}
Beispiel #4
0
Rat* getStrategies(Equilibrium eq)
{	
	int n = eq.lcpdim;
	
	Rat* strat;
	strat = malloc((n) * sizeof(Rat));
	
	int i, row;
	gmpt num, den;
	ginit(num);
	ginit(den);
	
	for (i=1; i<=n; i++) 
    {
		if((row = eq.bascobas[Z(i)]) < n) /* If Z(i) is basic */
		{	
            /* value of  Z(i):  scfa[Z(i)]*rhs[row] / (scfa[RHS]*det)   */
        	gmulint(eq.scfa[Z(i)], eq.A[row][RHS(n)], num);
			gmulint(eq.det, eq.scfa[RHS(n)], den);
            greduce(num, den);
			strat[i-1] = ratinit();
			gset(strat[i-1].num, num);
			gset(strat[i-1].den, den);
		}
		else if((row = eq.bascobas[W(i,n)]) < n)
		{
			strat[i-1] = ratfromi(0);
			/* value of  W(i-n)  is  rhs[row] / (scfa[RHS]*det)         
        	copy(num, eq.A[row][RHS(n)]);
			mulint(eq.det, eq.scfa[RHS(n)], den);
            reduce(num, den);
			copy(strat[i-1].num, num);
			copy(strat[i-1].den, den);*/
		}
		else
		{
			strat[i-1] = ratfromi(0);
		}
    }   /* end of  for (i=...)          */
	gclear(num);
	gclear(den);
	return strat;
}
Beispiel #5
0
/* ARGSUSED */
void mpcstw_ctlBtnCb ( Widget w, long which, XtPointer call )
/************************************************************************
 * mpcstw_ctlBtnCb							*
 *									*
 * This is the callback for the control buttons 			*
 *									*
 * void mpcstw_ctlBtnCb(w, which, call) 				*
 *									*
 * Input parameters:							*
 *	w	Widget		calling widget ID			*
 *	which	long		client data				*
 *	call	XtPointer	never used				*
 *									*
 * Output parameters:							*
 * Return parameters:							*
 *			NONE						*
 *									*
 **									*
 * Log: 								*
 * S. Wang/GSC		09/96						*
 * C. Lin/EAI		07/97	call new mapw module			*
 * G. Krueger/EAI	11/97	Renamed NxmHelp functions		*
 * S. Jacobs/NCEP	10/99	Added current loop to setting map proj	*
 * E. Safford/GSC	10/99	dataw_getCurLoop -> loop_getCurLoop   	*
 * M. Li/GSC		03/01	removed mapw_setMap			*
 ***********************************************************************/
{
int		ignore;
/*---------------------------------------------------------------------*/

	switch(which) {

	    case 0:				/* Accept */

		mpcstw_textCb( NULL, 0, NULL );
		mpcstw_popdown();

		mpcstw_updtMapDvr( );

/*
 * draws map
 */
		gclear( &ignore );
		mapw_redrawMap();
		break;

	    case 1:			/* Help   */
		NxmHelp_helpBtnCb(w, 4, NULL);
		break;

	    case 2:			/* Cancel */
		mpcstw_popdown();
		break;
	}
}
Beispiel #6
0
void getinitials(void)
{
  Sint4 k,i;
#ifdef _WINDOWS
  pause_windows_sound_playback();
#endif
  newframe();
  outtext("ENTER YOUR",100,70,3);
  outtext(" INITIALS",100,90,3);
  outtext("_ _ _",128,130,3);
  strcpy(scoreinit[0],"...");
  killsound();
  for (i=0;i<3;i++) {
    k=0;
    while (k==0) {
      k=getinitial(i*24+128,130);
      if (k==8 || k==127) {
        if (i>0)
          i--;
        k=0;
      }
    }
    if (k!=0) {
      gwrite(i*24+128,130,k,3);
      scoreinit[0][i]=k;
    }
  }
  for (i=0;i<20;i++)
#ifdef _WINDOWS
    flashywait(2);
#else
    flashywait(15);
#endif
  setupsound();
  gclear();
  gpal(0);
  ginten(0);
  setretr(TRUE);
  recputinit(scoreinit[0]);
#ifdef _WINDOWS
  resume_windows_sound_playback();
#endif
}
Beispiel #7
0
void wgem_gclear( int *iret )
/************************************************************************
 * wgem_gclear              						*
 *									*
 * This function is a wrapper for gclear. 				*
 *									*
 * void wgem_gclear( iret )						*
 *									*
 * Input parameters:							*
 *	   		None	                   			*
 * Output parameters:							*
 *	*iret		int	return code				*
 **									*
 * Log:									*
 * E. Safford/SAIC	12/07	initial coding                          *
 ***********************************************************************/
{
    gclear( iret );
}
Beispiel #8
0
void endofgame(void)
{
  Sint4 i;
  bool initflag=FALSE;
  for (i=0;i<diggers;i++)
    addscore(i,0);
  if (playing || !drfvalid)
    return;
  if (gauntlet) {
    cleartopline();
    outtext("TIME UP",120,0,3);
    for (i=0;i<50 && !escape;i++)
      newframe();
    outtext("       ",120,0,3);
  }
  for (i=curplayer;i<curplayer+diggers;i++) {
    scoret=scdat[i].score;
    if (scoret>scorehigh[11]) {
      gclear();
      drawscores();
      strcpy(pldispbuf,"PLAYER ");
      if (i==0)
        strcat(pldispbuf,"1");
      else
        strcat(pldispbuf,"2");
      outtext(pldispbuf,108,0,2);
      outtext(" NEW HIGH SCORE ",64,40,2);
      getinitials();
      shufflehigh();
      savescores();
      initflag=TRUE;
    }
  }
  if (!initflag && !gauntlet) {
    cleartopline();
    outtext("GAME OVER",104,0,3);
    for (i=0;i<50 && !escape;i++)
      newframe();
    outtext("         ",104,0,3);
    setretr(TRUE);
  }
}
Beispiel #9
0
/**************************** Main ****************************************/
void main(void)
{
unsigned char zaehlertief, zaehlerhoch, data[256];
long periode = 1000000L;      /* Zeitintervall zwischen Messungen */
int i, start = TRUE;

   initcom();
   ginit();
   gwindow(0,255,0,255);

   t_start();			/* Installiere Timer-Software */
   t_alarm_start();		/* Installiere Alarm-Uhr */
   printf("\nPOISSON V1.0\n");


   for ( i = 0; i <= 255; i++ ) data[i] = 0;
   t_alarm_set(0,periode,T_ONCE);

   do {
      do ; while ( t_alarm_check(0) == 0 );
      t_alarm_set(0,periode,T_ONCE);
      txchar(SYNCHBYTE);
      zaehlertief = rxcharw();
      zaehlerhoch = rxcharw();

      if ( start ) start = FALSE;	 /* Erster Wert unbrauchbar */
      else data[zaehlertief]++;

      gclear();
      for ( i = 0; i <= 255; i++ ) {
	 if ( i == 0 ) gpos(i, data[i]);
	 else gdraw(i, data[i]);
      }
   } while ( !kbhit() );

   t_stop();   /* Desinstalliere Timer */
   printf("\nDr�cke Taste..."); getch(); getch();
   gend();
}
Beispiel #10
0
void Meta::replay (void *ps, int clip)
/* Redraw the graphics as noted in notespace */
{	Active=0;
	char *p=Start;
	double c,r,c1,r1,cc[16],hue;
	int col,st,width,n,i,co[16];
	while (p<End)
	{   int command=nextcommand(p);
    	switch(command)
		{	case 1 :
				gclear(p);
				break;
			case 2 :
				c=nextlong(p);
				r=nextlong(p);
				c1=nextlong(p);
				r1=nextlong(p);
				if (clip) gclip(ps,c,r,c1,r1);
				break;
         	case 10 :
				c=nextlong(p);
				r=nextlong(p);
				c1=nextlong(p);
				r1=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				width=nextint(p);
				gline(ps,c,r,c1,r1,col,st,width);
				break;
			case 20 :
				c=nextlong(p);
				r=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gmarker(ps,c,r,col,st);
				break;
			case 30 :
				n=nextint(p);
				for (i=0; i<n; i++)
				{	cc[2*i]=nextlong(p);
					cc[2*i+1]=nextlong(p);
					co[i]=nextint(p);
				}
				st=nextint(p);
				gfill(ps,cc,st,n,co);
				break;
			case 31 :
				for (i=0; i<8; i++) cc[i]=nextlong(p);
				hue=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gfillh(ps,cc,hue,col,st);
				break;
			case 32 :
				c=nextlong(p);
				r=nextlong(p);
				c1=nextlong(p);
				r1=nextlong(p);
				hue=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gbar(ps,c,r,c1,r1,hue,col,st);
				break;
			case 33 :
				c=nextlong(p);
				r=nextlong(p);
				c1=nextlong(p);
				r1=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gbar1(ps,c,r,c1,r1,col,st);
				break;
			case 40 :
				c=nextlong(p);
				r=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gtext(ps,c,r,p,col,st);
				p+=strlen(p)+1;
				break;
			case 41 :
				c=nextlong(p);
				r=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gvtext(ps,c,r,p,col,st);
				p+=strlen(p)+1;
				break;
			case 42 :
				c=nextlong(p);
				r=nextlong(p);
				col=nextint(p);
				st=nextint(p);
				gvutext(ps,c,r,p,col,st);
				p+=strlen(p)+1;
				break;
			case 50 :
				nextlong(p);
				break;
			default :
            	Active=1;
				return;
		}
	}
	Active=1;
}
Beispiel #11
0
static void mapset_applyFrom ( void )
/************************************************************************
 * mapset_applyFrom                                                     *
 *                                                                      *
 * This function gets the selected settings from the specific loop	*
 * and set the current loop accordingly.				*
 *                                                                      *
 * void mapset_applyFrom()                                              *
 *                                                                      *
 * Input parameters:                                                    *
 * Output parameters:                                                   *
 * Return parameters:                                                   *
 *                      NONE                                            *
 *                                                                      *
 **                                                                     *
 * Log:                                                                 *
 * M. Li/SAIC           01/02                                           *
 * M. Li/SAIC           02/02   Set map to Custom if source is img.     *
 * H. Zeng/EAI          05/02   changed para list for zoomw_setZoom     *
 * T. Piper/SAIC        07/03   treat all unremapped images the same    *
 * T. Piper/SAIC	04/05	updated for nmp_smapattr CSC		*
 ***********************************************************************/
{
int         ii, jj, nn, ier;
int         loop, cur_lp, ovlnum, itype, roamVal;
Boolean     changes_made, ovlflg[MAX_OVL], proj_ok;
nmpstr_t    smap, sproj, sgarea[2], tmap, tproj, tgarea[2];
nmpovlstr_t ovlattr[MAX_OVL];

/*---------------------------------------------------------------------*/
/*
 * If no selection in the options frame, do nothing
 */
    nn = 0;
    for (ii = 0; ii < OPTIONS; ii++) {
        nn += (int) XmToggleButtonGetState(_options[ii]);
    }

    if (nn == 0) return;

/*
 * Search the source loop
 */
    for (ii = 0; ii < MAX_LOOP; ii++) {
	if (XmToggleButtonGetState(_fromlp[ii])) {
	    loop = ii;
	    break;
	}
    }

/*
 * Get map settings
 */
    if( XmToggleButtonGetState(_options[MAP])  ||
	XmToggleButtonGetState(_options[ZOOM]) ) {
	nmp_gmapattr ( loop, smap, sproj, sgarea, &ier );
	if (dataw_isImgInLoop(loop)) {
	    nmp_gtruattr(loop, sproj, sgarea, &ier);
        }
    }

/*
 * If proj contains "SAT", as it does for some unremapped images,
 * it can not be applied to other loops.  Flag this condition.
 */
    proj_ok = TRUE;
    if ( strstr(sproj, "SAT") != (char *)NULL ) {
        proj_ok = FALSE;
    }

/*
 * Get overlay attributes
 */
    if(XmToggleButtonGetState(_options[OVERLAY])) {
        nmp_govlflg(loop, ovlflg, &ier);
        nmp_govlnum(&ovlnum, &ier);

	for ( ii = 0; ii < ovlnum; ii++ ) {
	    if (ovlflg[ii]) {
	        nmp_govlattr(ii, loop, &itype, ovlattr[ii], &ier);
	    }
	}
    }

/*
 * Get the roam value
 */
    if(XmToggleButtonGetState(_options[ROAM])) {
        roamVal = loop_getRoamVal(loop);
    }

/*
 * Set the current loop 
 */
    changes_made = False;
    cur_lp = loop_getCurLoop();

/*
 * Set map
 */
    if (XmToggleButtonGetState(_options[MAP])) {

/*
 * If image in current loop, apply source garea only
 */
	nmp_gmapattr ( cur_lp, tmap, tproj, tgarea, &ier );
	if (dataw_isImgInLoop(cur_lp)) {
	    nmp_smapattr(cur_lp, tmap, tproj, sgarea, False, &ier);
	}
	else {
/*
 * No image in current loop.  Set map to "Custom",
 * apply source garea and appropriate projection.
 */
	    if (dataw_isImgInLoop(loop)) {  /* Image in source loop */
	        if ( proj_ok ) {  /* Remapped image in source loop, use its projection */
	            nmp_smapattr(cur_lp, "Custom", sproj, sgarea, False, &ier);
	        }
	        else {  /* Unremapped image in source loop, use target loop projection */
	            nmp_smapattr(cur_lp, "Custom", tproj, sgarea, False, &ier);
	        }
	    }
	    else {  /*  No image in source or target loop, use all source info */
	        nmp_smapattr(cur_lp, smap, sproj, sgarea, False, &ier);
	    }
	}

        changes_made = True;
    }

/*
 * Set zoomed area
 */
    if (XmToggleButtonGetState(_options[ZOOM])) {
        nmp_szoom ( cur_lp, sgarea[1], &ier );
	zoomw_setZoom (cur_lp);
        changes_made = True;
    }

/*
 * Set overlays
 */
    if (XmToggleButtonGetState(_options[OVERLAY])) {
        for ( jj = 0; jj < ovlnum; jj++ ) {
	    nmp_sovlflg(cur_lp, jj, ovlflg[jj], &ier);

	    if (ovlflg[jj]) {
		nmp_sovlattr(cur_lp, jj, ovlattr[jj], &ier);
	    }
        }

	changes_made = True;
    }

/*
 * Set roam settings
 */
    if (XmToggleButtonGetState(_options[ROAM])) {
        loop_setRoamVal(cur_lp, roamVal);
        changes_made = True;
    }

    _settingChngd[cur_lp] = changes_made;

    if (changes_made) {
/*
 * Set toggle buttons for the map and overlays on the map window
 */
	mapw_updtMapBtns(loop);
	mapw_updtOvlBtns();

	loop_setDataChngd(cur_lp, TRUE);
	
/*
 * Draw map and overlays with new changes on the map window
 */
	gclear(&ier);
	nmp_setmapstr(cur_lp, &ier);
	nmp_plot(cur_lp, 0, "ALL", &ier);
	geplot(&ier);
    }
}
Beispiel #12
0
void game(void)
{
  Sint4 t,c,i;
  bool flashplayer=false;
  if (gauntlet) {
    cgtime=gtime*1193181l;
    timeout=false;
  }
  initlives();
  gamedat[0].level=startlev;
  if (nplayers==2)
    gamedat[1].level=startlev;
  alldead=false;
  gclear();
  curplayer=0;
  initlevel();
  curplayer=1;
  initlevel();
  zeroscores();
  bonusvisible=true;
  if (nplayers==2)
    flashplayer=true;
  curplayer=0;
  while (getalllives()!=0 && !escape && !timeout) {
    while (!alldead && !escape && !timeout) {
      initmbspr();

      if (playing)
        randv=playgetrand();
      else
        randv=getlrt();
#ifdef INTDRF
      fprintf(info,"%lu\n",randv);
      frame=0;
#endif
      recputrand(randv);
      if (levnotdrawn) {
        levnotdrawn=false;
        drawscreen();
        if (flashplayer) {
          flashplayer=false;
          strcpy(pldispbuf,"PLAYER ");
          if (curplayer==0)
            strcat(pldispbuf,"1");
          else
            strcat(pldispbuf,"2");
          cleartopline();
          for (t=0;t<15;t++)
            for (c=1;c<=3;c++) {
              outtext(pldispbuf,108,0,c);
              writecurscore(c);
              newframe();
              if (escape)
                return;
            }
          drawscores();
          for (i=0;i<diggers;i++)
            addscore(i,0);
        }
      }
      else
        initchars();
      outtext("        ",108,0,3);
      initscores();
      drawlives();
      music(1);

      flushkeybuf();
      for (i=0;i<diggers;i++)
        digger_readdir(i);
      while (!alldead && !gamedat[curplayer].levdone && !escape && !timeout) {
        penalty=0;
        dodigger();
        domonsters();
        dobags();
        if (penalty>8)
          incmont(penalty-8);
        testpause();
        checklevdone();
      }
      erasediggers();
      musicoff();
      t=20;
      while ((getnmovingbags()!=0 || t!=0) && !escape && !timeout) {
        if (t!=0)
          t--;
        penalty=0;
        dobags();
        dodigger();
        domonsters();
        if (penalty<8)
          t=0;
      }
      soundstop();
      for (i=0;i<diggers;i++)
        killfire(i);
      erasebonus();
      cleanupbags();
      savefield();
      erasemonsters();
      recputeol();
      if (playing)
        playskipeol();
      if (escape)
        recputeog();
      if (gamedat[curplayer].levdone)
        soundlevdone();
      if (countem()==0 || gamedat[curplayer].levdone) {
#ifdef INTDRF
        fprintf(info,"%i\n",frame);
#endif
        for (i=curplayer;i<diggers+curplayer;i++)
          if (getlives(i)>0 && !digalive(i))
            declife(i);
        drawlives();
        gamedat[curplayer].level++;
        if (gamedat[curplayer].level>1000)
          gamedat[curplayer].level=1000;
        initlevel();
      }
      else
        if (alldead) {
#ifdef INTDRF
          fprintf(info,"%i\n",frame);
#endif
          for (i=curplayer;i<curplayer+diggers;i++)
            if (getlives(i)>0)
              declife(i);
          drawlives();
        }
      if ((alldead && getalllives()==0 && !gauntlet && !escape) || timeout)
        endofgame();
    }
    alldead=false;
    if (nplayers==2 && getlives(1-curplayer)!=0) {
      curplayer=1-curplayer;
      flashplayer=levnotdrawn=true;
    }
  }
#ifdef INTDRF
  fprintf(info,"-1\n%lu\n%i",getscore0(),gamedat[0].level);
#endif
}
Beispiel #13
0
void do_clg (void)
{	graphic_mode(); gclear(); gflush();
}
Beispiel #14
0
/* ARGSUSED */
void mpcstw_textCb ( Widget w, long flag, XtPointer call )
/************************************************************************
 * mpcstw_textCb							*
 *									*
 * This is the callback for the proj Text field widget			*
 *									*
 * void mpcstw_textCb(w, flag, call)					*
 *									*
 * Input parameters:							*
 *	w	Widget		calling widget ID			*
 *	flag	long		= 1 draw map, = 0 do not draw map	*
 *	call	XtPointer	never used				*
 *									*
 * Output parameters:							*
 * Return parameters:							*
 *			NONE						*
 *									*
 **									*
 * Log: 								*
 * S. Wang/GSC	09/96	projTextCb and gareaTextCb			*
 * C. Lin/EAI	11/96	combine projTextCb and gareaTextCb together	*
 * C. Lin/EAI	02/97	bug fix in freeing string 'text'		*
 * C. Lin/EAI	07/97	call new mapw module				*
 * S. Jacobs/NCEP	10/99	Added current loop to setting map proj	*
 * E. Safford/GSC	10/99	dataw_getCurLoop -> loop_getCurLoop   	*
 * M. Li/GSC		03/01	removed mapw_getDEFproj and mapw_setMap	*
 * E. Safford/GSC	05/01	added mpcstw_updtMapDvr  		*
 * J. Wu/GSC       	05/01	free XmStrings    			*
 ***********************************************************************/
{
int	      	ignore;
char	      	*text;
unsigned char 	shadow_char;
XmString      	str_def_con;
/*---------------------------------------------------------------------*/
/*
 * get the PROJ input
 */
    text = XmTextFieldGetString(_projTextW);

    if ( (strlen(text)==(size_t)0) || (strcmp( _projCopy, "SAT" ) == 0) ) {
	strcpy( _projEdit, _projCopy);
	XmTextSetString( _projTextW, _projEdit );
    }
    else {
	strcpy( _projEdit, text );
    }

    if ( text ) XtFree(text);

/*
 * get the GAREA input
 */
    text = XmTextFieldGetString(_gareaTextW);

    if ( strlen(text)==(size_t)0 ) {
	strcpy( _gareaEdit, _gareaCopy );
	XmTextSetString( _gareaTextW, _gareaEdit );
    }
    else {
	strcpy( _gareaEdit, text );
    }

    XtVaGetValues(_defaultConFrame, XmNshadowType, &shadow_char, NULL);

    if ( shadow_char == XmSHADOW_IN ) {

	str_def_con = XmStringCreateLocalized( _curDef );
	XtVaSetValues(_defaultConLabel,
			XmNlabelString,  str_def_con,
			NULL);
        XmStringFree ( str_def_con );
    }

    if ( text ) XtFree(text);

    mpcstw_updtMapDvr( );

    if ( flag == 1 ) {
	gclear( &ignore );
	mapw_redrawMap();
    }
}
Beispiel #15
0
int mainprog(void)
{
  Sint4 frame,t,x;
  loadscores();
  escape=false;
  do {
    soundstop();
    creatembspr();
    detectjoy();
    gclear();
    gtitle();
    outtext("D I G G E R",100,0,3);
    shownplayers();
    showtable();
    started=false;
    frame=0;
    newframe();
    teststart();
    while (!started) {
      started=teststart();
      if ((akeypressed==27 || akeypressed=='n' || akeypressed=='N') &&
          !gauntlet && diggers==1) {
        switchnplayers();
        shownplayers();
        akeypressed=0;
      }
      if (frame==0)
        for (t=54;t<174;t+=12)
          outtext("            ",164,t,0);
      if (frame==50) {
        movedrawspr(FIRSTMONSTER,292,63);
        x=292;
      }
      if (frame>50 && frame<=77) {
        x-=4;
        drawmon(0,1,DIR_LEFT,x,63);
      }
      if (frame>77)
        drawmon(0,1,DIR_RIGHT,184,63);
      if (frame==83)
        outtext("NOBBIN",216,64,2);
      if (frame==90) {
        movedrawspr(FIRSTMONSTER+1,292,82);
        drawmon(1,0,DIR_LEFT,292,82);
        x=292;
      }
      if (frame>90 && frame<=117) {
        x-=4;
        drawmon(1,0,DIR_LEFT,x,82);
      }
      if (frame>117)
        drawmon(1,0,DIR_RIGHT,184,82);
      if (frame==123)
        outtext("HOBBIN",216,83,2);
      if (frame==130) {
        movedrawspr(FIRSTDIGGER,292,101);
        drawdigger(0,DIR_LEFT,292,101,1);
        x=292;
      }
      if (frame>130 && frame<=157) {
        x-=4;
        drawdigger(0,DIR_LEFT,x,101,1);
      }
      if (frame>157)
        drawdigger(0,DIR_RIGHT,184,101,1);
      if (frame==163)
        outtext("DIGGER",216,102,2);
      if (frame==178) {
        movedrawspr(FIRSTBAG,184,120);
        drawgold(0,0,184,120);
      }
      if (frame==183)
        outtext("GOLD",216,121,2);
      if (frame==198)
        drawemerald(184,141);
      if (frame==203)
        outtext("EMERALD",216,140,2);
      if (frame==218)
        drawbonus(184,158);
      if (frame==223)
        outtext("BONUS",216,159,2);
      newframe();
      frame++;
      if (frame>250)
        frame=0;
    }
    if (savedrf) {
      if (gotgame) {
        recsavedrf();
        gotgame=false;
      }
      savedrf=false;
      continue;
    }
    if (escape)
      break;
    recinit();
    game();
    gotgame=true;
    if (gotname) {
      recsavedrf();
      gotgame=false;
    }
    savedrf=false;
    escape=false;
  } while (!escape);
  finish();
  return 0;
}
Beispiel #16
0
void guitst_rgstrCanvas ( void )
/************************************************************************
 * guitst_rgstrCanvas   	                                        *
 *                                                                      *
 * This function registers the canvas as a gempak window		*
 *                                                                      *
 * void	guitst_rgstrCanvas()						*
 *                                                                      *
 * Input parameters:                                                    *
 * Output parameters:                                                   *
 * Return parameters:                                                   *
 *                      NONE                                            *
 *                                                                      *
 ** Log:                                                                *
 *   C. Lin/EAI      04/96                                              *
 *   S. Wang/GSC     10/97	modified for guitst                     *
 *   H. Zeng/EAI     04/00      changed cursor change function          *
 * T. Piper/SAIC	10/04	Moved gg_panl after gclear		*
 ***********************************************************************/
{

Window    gwin;
GC	  gemgc;
char      wname[20];
int       iret, xdpth;
Dimension width, height;

/*---------------------------------------------------------------------*/

        /*
         * set the cursor to the default
         */
        NxmCursor_setCursor(_canvasW, CURS_DEFAULT);

        strcpy(wname, "guitst");

        /*
         * get the window info
         */
        gwin = XtWindow(_canvasW);
        gemgc = XCreateGC(gemdisplay, gwin, 0, 0);
        xdpth = DefaultDepth((XtPointer)gemdisplay,
			     DefaultScreen((XtPointer)gemdisplay));

        XtVaGetValues(_canvasW, XmNwidth,  &width,
                         XmNheight, &height,
                         NULL );

        /*
         * call GEMPAK to register the window (drawing area)
         * from now on, this drawing area will be GEMPAK's
         * window identified by name = wname.
         */
        xmotifw( gwin, wname, gemgc, (int)width, (int)height,
              			  xdpth, &iret );

        /*
         * set DEVICE in gempak
         */
        gg_motf(wname, &iret, strlen(wname));

        /*
         * clear screen and set panel
         */

	gclear(&iret);
        gg_panl("0", &iret, 1);

	
}
Beispiel #17
0
int main ( void )
/************************************************************************
 * TESTNSN								*
 *									*
 * This program test the NSN library of routines.			*
 *									*
 **									*
 * Log:									*
 * S. Jacobs/NCEP	 6/99	Created					*
 * M. Li/GSC		 7/00	Added nsn_save and nsn_rest		*
 * T. Lee/SAIC		 8/03	Add time interval to nsn_gtim, nsn_dspl	*
 * T. Lee/SAIC		 2/04	Add reference time flag to nsn_gtim	*
 * T. Lee/SAIC		 4/04	Added delta reference time to nsn_gtim	*
 * T. Lee/SAIC		10/04	Added bin hours				*
 * T. Piper/SAIC        01/08   Added GD_INIT; removed from IN_BDTA     *
 * F. J. Yen/NCEP	04/08   Insert new parms for nsn_dspl (CSC).	*
 *				Request input for bin hours.		*
 ***********************************************************************/
{
	int	cont, ier, iret, numsub, id;
	char	ergrp[4], erstr[81], select[LLSCRN];

	int	iindex, jindex, knt, ntime, match, ititl, idelta,
		mode, istat, minute, isbcat, mrange, intrvl,
		ibfr, iaftr, mbfr, maftr, mstrct;
	char	alias[81], cycle[81], parms[81], color[81],
		level[81], vcord[81], filter[81], txtatt[81],
		garea[81], proj[5], panel[81], dattim[21], device[81],
		map[21], ltln[21], ans[9];
	unsigned int	jflag;
	Boolean	iflag;
	dttms_t	endtim, timarr[2000];

	char	blank[] = " ";

/*---------------------------------------------------------------------*/

	in_bdta ( &ier );
	gd_init ( &ier );

	mode = 1;
	ginitp ( &mode, &istat, &ier );

	printf ( "Enter full DEVICE string:\n" );
	scanf ( " %s", device );

	gg_sdev ( device, &ier, strlen ( device ) );

	strcpy ( ergrp, "NSN" );

	cont = G_TRUE;

	while ( cont ) {
	    printf ( "\n\n" );
	    printf ( "   1 = NSN_INIT   2 = NSN_SATT   3 = NSN_QATT\n" );
	    printf ( "   4 = NSN_GTIM   5 = NSN_DSPL   6 = NSN_SAVE\n" );
	    printf ( "   7 = NSN_REST\n\n" );
	    printf ( "  20 = Change device\n\n" );
	    printf ( "\n" );
	    printf ( "Select a subroutine number or type EXIT: " );
	    scanf ( " %s", select );
	    switch ( select[0] ) {
		case 'e':
		case 'E':
			cont = G_FALSE;
		default:
			numsub = atoi ( select );
			break;
	    }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 1 )  {
		nsn_init ( &iret );

		printf ( "iret = %d\n", iret );

		if  ( iret != 0 )  {
		    strcpy ( erstr, " " );
		    er_wmsg ( ergrp, &iret, erstr, &ier,
			      strlen ( ergrp ), strlen ( erstr ) );
		}
	    }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 2 )  {
		printf ( "Enter index number:\n" );
		scanf  ( " %d", &iindex );
		printf ( "Enter the data alias (e.g., UAIR):\n" );
		scanf  ( " %s", alias );
		printf ( "Enter data subcategory number:\n" );
		scanf  ( " %d", &isbcat );
		printf ( "Enter the cycle date/time or NONE:\n" );
		scanf  ( " %s", cycle );
		printf ( "Enter the parm list:\n" );
		scanf  ( " %s", parms );
		printf ( "Enter the color list:\n" );
		scanf  ( " %s", color );
		printf ( "Enter the level:\n" );
		scanf  ( " %s", level );
		printf ( "Enter the vertical coordinate:\n" );
		scanf  ( " %s", vcord );
		printf ( "Enter the filter:\n" );
		scanf  ( " %s", filter );
		printf ( "Enter the text attributes string:\n" );
		scanf  ( " %s", txtatt );

		nsn_satt ( iindex, alias, isbcat, cycle, parms, color,
			   level, vcord, filter, txtatt, &jindex,
			   &iret );

		printf ( "iret   = %d\n", iret );
		printf ( "jindex = %d\n", jindex );

		if  ( iret != 0 )  {
		    strcpy ( erstr, " " );
		    er_wmsg ( ergrp, &iret, erstr, &ier,
			      strlen ( ergrp ), strlen ( erstr ) );
		}
	    }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 3 )  {
		printf ( "Enter index number:\n" );
		scanf  ( " %d", &iindex );

		nsn_qatt ( iindex, alias, &isbcat, cycle, parms, color,
			   level, vcord, filter, txtatt, &iret );

		printf ( "iret   = %d\n", iret );
		printf ( "alias  = %s\n", alias );
		printf ( "isbcat = %d\n", isbcat );
		printf ( "cycle  = %s\n", cycle );
		printf ( "parms  = %s\n", parms );
		printf ( "color  = %s\n", color );
		printf ( "level  = %s\n", level );
		printf ( "vcord  = %s\n", vcord );
		printf ( "filter = %s\n", filter );
		printf ( "txtatt = %s\n", txtatt );

		if  ( iret != 0 )  {
		    strcpy ( erstr, " " );
		    er_wmsg ( ergrp, &iret, erstr, &ier,
			      strlen ( ergrp ), strlen ( erstr ) );
		}
	    }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 4 )  {
		printf ( "Enter index number:\n" );
		scanf  ( " %d", &iindex );
                printf ( "Enter end time for range:\n" );
		scanf  ( " %s", endtim );
		printf ( "Enter time range in minutes:\n" );
		scanf  ( " %d", &mrange );
		printf ( "Enter time interval in minutes:\n" );
		scanf  ( " %d", &intrvl );
		printf ( "Enter reference time flag:\n" );
		scanf  ( " %u", &jflag );
		iflag = (Boolean) jflag;
		printf ( "Enter delta reference time in minutes:\n" );
		scanf  ( " %d", &idelta );


		nsn_gtim ( iindex, endtim, mrange, intrvl, iflag, 
			   &idelta, &ntime, timarr, &iret );

		printf ( "idelta = %d\n", idelta );
		printf ( "iret   = %d\n", iret );
		printf ( "ntime  = %d\n", ntime );
		if  ( ntime > 0 )  {
		    for ( knt = 0; knt < ntime; knt++ ) {
			printf ( "Times: timarr[%d] = %s\n",
				 knt, timarr[knt] );
		    }
		}

		if  ( iret != 0 )  {
		    strcpy ( erstr, " " );
		    er_wmsg ( ergrp, &iret, erstr, &ier,
			      strlen ( ergrp ), strlen ( erstr ) );
		}
	    }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 5 )  {
		printf ( "Enter index number:\n" );
		scanf  ( " %d", &iindex );

		nsn_qatt ( iindex, alias, &isbcat, cycle, parms, color,
			   level, vcord, filter, txtatt, &iret );

		printf ( "Enter GAREA:\n" );
		scanf  ( " %s", garea );

		printf ( "Default projection? (y/n)\n" );
		scanf  ( " %s", ans );
		if  ( ans[0] == 'N' || ans[0] == 'n' )  {
		    printf ( "Enter PROJ:\n" );
		    scanf  ( " %s", proj );
		}
		else {
		    strcpy ( proj, blank );
		}

		printf ( "Enter PANEL:\n" );
		scanf  ( " %s", panel );
		printf ( "Enter DATTIM:\n" );
		scanf  ( " %s", dattim );

                printf ( "Enter end time for range:\n" );
		scanf  ( " %s", endtim );
		printf ( "Enter the time range in minutes:\n" );
		scanf  ( " %d", &mrange );
		printf ( "Enter the time interval in minutes:\n" );
		scanf  ( " %d", &intrvl );

		printf ( "Enter time match type:\n" );
		scanf  ( " %d", &match );
		printf ( "Enter minutes for difference match:\n" );
		scanf  ( " %d", &minute );
		printf ( "Enter title line:\n" );
		scanf  ( " %d", &ititl );
                printf ( "Enter binning time before current time: hh mm:\n" );
                scanf  ( " %d %d", &ibfr, &mbfr );
                printf ( "Enter binning time after current time: hh mm:\n" );
                scanf  ( " %d %d", &iaftr, &maftr );
                printf ( "Enter most recent only flag (0 for no; 1 for yes)\n" );
                scanf  ( " %d", &mstrct );

		gg_maps ( proj, garea, blank, &id, &ier,
			  strlen ( proj ), strlen ( garea ),
			  strlen ( blank ) );

		gclear ( &ier );

		strcpy ( map, "1" );
		gg_map ( map, &ier, strlen ( map ) );

		strcpy ( ltln, "2" );
		gg_ltln ( ltln, &ier, strlen ( ltln ) );

		nsn_dspl ( panel, dattim, alias, &isbcat, cycle, parms,
			   color, level, vcord, filter, txtatt,       
			   endtim, &mrange, &intrvl, &match, &minute, 
			   &ititl, &ibfr, &mbfr, &iaftr, &maftr,
			   &mstrct, &iret,
			   strlen ( panel ), strlen ( dattim ),
			   strlen ( alias ), strlen ( cycle ),
			   strlen ( parms ), strlen ( color ),
			   strlen ( level ), strlen ( vcord ),
			   strlen ( filter ), strlen ( txtatt ),
			   strlen ( endtim ) );

		geplot ( &ier );

		if  ( iret != 0 )  {
		    strcpy ( erstr, " " );
		    er_wmsg ( ergrp, &iret, erstr, &ier,
			      strlen ( ergrp ), strlen ( erstr ) );
		}
	    }

/*---------------------------------------------------------------------*/
            if  ( numsub == 6 )  {
                nsn_save ( &iret );

                printf ( "iret = %d\n", iret );

                if  ( iret != 0 )  {
                    strcpy ( erstr, " " );
                    er_wmsg ( ergrp, &iret, erstr, &ier,
                              strlen ( ergrp ), strlen ( erstr ) );
                }
            }

/*---------------------------------------------------------------------*/
            if  ( numsub == 7 )  {
                nsn_rest ( &iret );

                printf ( "iret = %d\n", iret );

                if  ( iret != 0 )  {
                    strcpy ( erstr, " " );
                    er_wmsg ( ergrp, &iret, erstr, &ier,
                              strlen ( ergrp ), strlen ( erstr ) );
                }
            }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 10 )  {
		dumpcmn ( &iret );
	    }

/*---------------------------------------------------------------------*/
	    if  ( numsub == 20 )  {
		printf ( "Enter full DEVICE string:\n" );
		scanf ( " %s", device );

		gg_sdev ( device, &ier, strlen ( device ) );
	    }

	}
	return(0);
}