Ejemplo n.º 1
0
static void lslinit_processInitFile (void)
{
  InitLines ();
  InitReduce (INITFILE1);

  if (ltoken_getCode (nextToken) != LEOFTOKEN)
    {
      LocalUserError (nextToken, "unexpected tokens after end-of-file");
    }
}
Ejemplo n.º 2
0
status_t GlLineScanner::Init(	int32 w, int32 h, uint32 count, float perpAngle,
								int8 perpSignX, int8 perpSignY)
{
	status_t		err = InitLines(count);
	if (err != B_OK) return err;

	int32			x = 0, y = 0;
	GlDegreeLine	line(perpAngle, float(x), float(y), perpSignX, perpSignY);
	for (uint32 k = 0; k < count; k++) {
		mLine1->cells[k].x = x;
		mLine1->cells[k].y = y;
		line.GetNext(&x, &y);
	}
	return B_OK;
}
Ejemplo n.º 3
0
// ----------------------------------------------------------------------------
void Main()
{
	FlipScreen();
	
	InitLines();
	
	LoadFile( BOUNCINGFXCODE_BB00Z80BINPCK_TRACKFILEID, CODESEGMENT0000 );
	Unpack( 0xBB00, CODESEGMENT0000 );
	
	bank_memcpy( BANKC0, VIDEOSEGMENT0000, VIDEOSEGMENTC000, VIDEOSEGMENTC000_SIZE );
	InitBounceTransit();
	
	LoadFile( ANGELTITLE2BIGFILE_TRACKFILEID, ANGELTITLE2H_DATAPTR );
	BankUnpack( BANKC4, 0x4080, ANGELASDEMONBMPTOPBINPCK_PTR );
	BankUnpack( BANKC1, 0xC000, ANGELASDEMONBMPBOTTOMBINPCK_PTR );
	
	bank_memcpy( BANKC6, 0x4000, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE );
	
	BankUnpack( BANKC4, 0x6800, BOUNCINGDELTAY_1BINPCK_PTR );
	BankUnpack( BANKC6, 0x6800, BOUNCINGDELTAY_2BINPCK_PTR );
	
	bank_memcpy( BANKC0, VIDEOSEGMENT0000, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE );
	bank_memcpy( BANKC0, VIDEOSEGMENT4000, VIDEOSEGMENTC000, VIDEOSEGMENTC000_SIZE );
	
	DrawBounceTransit();
	
	FlipScreen();
	
	PushBank (BANKC1);
	LoadFile( ANGELSCROLLOFFSETBINPCK_TRACKFILEID, CODESEGMENT4000 );
	LoadFile( ANGELSCROLLIMAGEBINPCK_TRACKFILEID, CODESEGMENT4000 + 0x200 );
	PopBank();
	
	bank_memcpy( BANKC4, VIDEOSEGMENT0000, 0x4080, VIDEOSEGMENT0000_SIZE );
	bank_memcpy( BANKC6, 0x4080, VIDEOSEGMENT0000, VIDEOSEGMENT0000_SIZE );
	
	LoadFile( ANGELBMPTOPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 );
	BankUnpack( BANKC4, 0x4080, VIDEOSEGMENT0000 );
	
	LoadFile( ANGELBMPBOTTOMBINPCK_TRACKFILEID, VIDEOSEGMENT0000 );	
	PushBank (BANKC1);
	Unpack( VIDEOSEGMENT4000, VIDEOSEGMENT0000 );
	PopBank();
	
	bank_memcpy( BANKC0, VIDEOSEGMENT0000, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE );
}
Ejemplo n.º 4
0
status_t GlLineSlicer::HalfQuad(int32 w, int32 h, float angle,
								int8 xSign, int8 ySign,
								int32 originX, int32 originY,
								int32 changeX, int32 changeY)
{
	/* Init the lines */
	uint32					count = (w > h) ? w : h;
	ArpVALIDATE(count > 0, return B_ERROR);
	status_t				err = InitLines(count);
	if (err != B_OK) return err;
	/* Fill the coords of each cell */
	int32					x = originX, y = originY;
	GlDegreeLine			line(angle, float(x), float(y), xSign, ySign);
	for (uint32 k = 0; k < count; k++) {
		mLine->cells[k].x = x;
		mLine->cells[k].y = y;
		line.GetNext(&x, &y);
	}
	mLine->Offset(0, 0);
	InitLineVal(mLine->size, mLine->cells);
	/* Init the frame */
	InitFrame(w, h, count, mLine->cells);

	ArpASSERT(false);	// FIX:  Who calls this?  Need to figure out the steps
#if 0
	/* Find the number of steps */
	int32				ox = originX, oy = originY;
	uint32				c = 0;
	while (GL_IN_BOUNDS(ox, oy, w, h)) {
		ox += changeX;
		oy += changeY;
		c++;
	}
uint32	c2 = 0;
#endif
	/* Render each slice */
	while (FrameInBounds(w, h)) {
		FillLine(w, h, mLine->size, mLine->cells);
		mLine->Offset(changeX, changeY);
		OffsetBounds(changeX, changeY);
//c2++;
	}
//printf("c %ld real %ld\n", c, c2);
	return B_OK;
}
Ejemplo n.º 5
0
/*
   draw the actual game map
*/
void PrintMap( void)
{
   BCINT n, m;

   /* draw the shaded secret & damage Sectors if desired */
   if (FlagShdAreas)
   {
      InitShades();

      /* find all secret & damage Sectors */
      for (n = 0; n < NumSectors; n++)
	 if (Sectors[ n].special == S_DAMAG1 || Sectors[ n].special == S_DAMAG2 ||
	     Sectors[ n].special == S_DAMAG3 || Sectors[ n].special == S_DAMAG4 ||
	     (Sectors[ n].special == S_DAMEND && GameVersion < 16))
	    ShadeSector( n, 'D');
	 else if (Sectors[ n].special == S_SECRET)
	    ShadeSector( n, 'S');
   }

   /* draw the LineDefs to form the map */
   InitLines();

   for (n = 0; n < NumLineDefs; n++)
      if (FlagFadeLins)
      {
	 /* check if Sector on either side of LineDef is secret */
	 m = Sectors[ SideDefs[ LineDefs[ n].sidedef1].sector].special;
	 if (m != S_SECRET && LineDefs[ n].sidedef2 != -1)
	    m = Sectors[ SideDefs[ LineDefs[ n].sidedef2].sector].special;

	 PrintMapLine( Vertexes[ LineDefs[ n].start].x, Vertexes[ LineDefs[ n].start].y,
		       Vertexes[ LineDefs[ n].end].x,   Vertexes[ LineDefs[ n].end].y,
		       (LineDefs[ n].flags & L_IMPASS),
		       (LineDefs[ n].flags & L_SECRET) || m == S_SECRET);
      }
      else
	 PrintMapLine( Vertexes[ LineDefs[ n].start].x, Vertexes[ LineDefs[ n].start].y,
		       Vertexes[ LineDefs[ n].end].x,   Vertexes[ LineDefs[ n].end].y,
		       (LineDefs[ n].flags & L_IMPASS), FALSE);

   /* draw all desired Things */
   InitThings();

   for (n = 0; n < NumThings; n++)
      /* check whether multi-player Thing should be printed */
      if (FlagMultPlay || ! (Things[ n].when & T_MULTI))
	 /* check whether UV or non-UV Thing should be printed */
	 if ((FlagUltraVlc && (Things[ n].when & T_ULTRA)) ||
	     (! FlagUltraVlc && (Things[ n].when & T_NONUV)) ||
	     Things[ n].when == 0) /* print always if no difficulty bits */
	 {
	    m = Things[ n].type;
	    switch( GetThingClass( m))
	    {
	    case CLASS_START:
	       /* always print Player 1 Start, others only if multi-player Things */
	       if (FlagMultPlay || m == THING_PLAYER1)
		  break;
	       else
		  continue;
	    case CLASS_ENHANCE:
	       if (FlagGoodies)
		  break;
	       else
		  continue;
	    case CLASS_BONUS:
	       if (FlagGoodies)
		  break;
	       else
		  continue;
	    case CLASS_WEAPON:
	       if (FlagGoodies)
		  break;
	       else
		  continue;
	    case CLASS_ENEMY:
	       if (FlagEnemies)
		  break;
	       else
		  continue;
	    case CLASS_DECOR:
	       if (FlagDecors)
		  break;
	       else
		  continue;
	    case CLASS_BARREL:
	       if (FlagDecors)
		  break;
	       else
		  continue;
	    case CLASS_TELEPORT:
	       /* always print Teleport Exits */
	       break;
	    default:
	       break;
	    }

	    PrintMapThing( GetThingClass( m), Things[ n].xpos, Things[ n].ypos,
			   GetThingRadius( m), Things[ n].angle);
	 }

   /* draw the Teleport links if desired */
   if (FlagTeleprts)
   {
      BCINT t;

      InitLinks();

      /* find all (incl. monster-only) teleporting LineDefs */
      for (n = 0; n < NumLineDefs; n++)
	 if (LineDefs[ n].type == L_TELEP1 || LineDefs[ n].type == L_TELEPR ||
	     LineDefs[ n].type == L_TELPM1 || LineDefs[ n].type == L_TELPMR)
	 {
	    /* find associated Sector */
	    for (m = 0; m < NumSectors; m++)
	       if (Sectors[ m].tag == LineDefs[ n].tag)
		  if ((t = FindTeleExit( m)) != NumThings)
		  {
		     /* draw link from LineDef midpoint to teleport exit center */
		     PrintTeleLink( (Vertexes[ LineDefs[ n].start].x + Vertexes[ LineDefs[ n].end].x) / 2,
				    (Vertexes[ LineDefs[ n].start].y + Vertexes[ LineDefs[ n].end].y) / 2,
				    Things[ t].xpos, Things[ t].ypos);
		     break; /* for */
		  }

	    if (m == NumSectors) /* safety check */
	       printf( "[No sector tagged %d found with teleport exit.]\n",
			LineDefs[ n].tag);
	 }
   }
}
void MecanumThread()
{
	float x,y;
	_DEBPRINT("---Mecanum Thread Alive---\n");
	flMotor=new PWM(4,1);
	frMotor=new PWM(4,2);
	blMotor=new PWM(4,3);
	brMotor=new PWM(4,4);
	leftJoystick=new Joystick(1);
	InitLines();
	while (ds->IsEnabled())
	{
		x=leftJoystick->GetX();
		y=leftJoystick->GetY();
		ds->SetDigitalOut(4,0);
		_DEBPRINT("Lines: %d\n",CalcVel());
		if (fabs(x) < fabs(y))
		{
			//forward and reverse
			flVel=(char)((y*64)+128);
			blVel=(char)((y*64)+128);
			frVel=(char)((y*64)+128);
			brVel=(char)((y*64)+128);
			flMotor->SetRaw(flVel);
			blMotor->SetRaw(blVel);
			frMotor->SetRaw(frVel);
			brMotor->SetRaw(blVel);
		}
		
		else if (fabs(x) > fabs(y))
		{
			if (x > 0.1)
			{
				if (leftJoystick->GetButton(Joystick::kTriggerButton))
				{
					//cw turn
					flVel=(char)((x*64)+128);
					blVel=(char)((x*64)+128);
					frVel=(char)((-x*64)+128);
					brVel=(char)((-x*64)+128);
				}
			
				else
				{
					//right shift
					flVel=(char)((x*64)+128);
					blVel=(char)((-x*64)+128);
					frVel=(char)((-x*64)+128);
					brVel=(char)((x*64)+128);
				}
			}
			
			else if (x < -0.1)
			{
				if (leftJoystick->GetButton(Joystick::kTriggerButton))
					{
						//ccw turn
						flVel=(char)((-x*64)+128);
						blVel=(char)((-x*64)+128);
						frVel=(char)((x*64)+128);
						brVel=(char)((x*64)+128);
					}
							
					else
					{
						//left shift
						flVel=(char)((-x*64)+128);
						blVel=(char)((x*64)+128);
						frVel=(char)((x*64)+128);
						brVel=(char)((-x*64)+128);
					}
			}
		}
		flMotor->SetRaw(flVel);
		blMotor->SetRaw(blVel);
		frMotor->SetRaw(frVel);
		brMotor->SetRaw(blVel);
		_DEBPRINT(("\nX is %f\n", x);
		_DEBPRINT(("Y is %f\n", y);
		_DEBPRINT(("flVel is %d\n", flVel);
		_DEBPRINT(("blVel is %d\n", blVel);
		_DEBPRINT(("frVel is %d\n", frVel);
		_DEBPRINT(("brVel is %d\n", brVel);
		/*//forward
		if (y>=0.1)
		{
			flVel=(char)((y*128)+128);
			blVel=(char)((y*128)+128);
			frVel=(char)((y*128)+128);
			brVel=(char)((y*128)+128);
		}
		
		//reverse
		else if (y<=-0.1)
		{
			flVel=(char)(-1 * (y*128)+128);
			blVel=(char)(-1 * (y*128)+128);
			frVel=(char)(-1 * (y*128)+128);
			brVel=(char)(-1 * (y*128)+128);
		}
		
		//right shift
		else if (x>=0.1)
		{
			if (leftJoystick->GetButton(Joystick::kTriggerButton))
			{
				//trigger is down, cw turn
				flVel=(char)((y*128)+128);
				blVel=(char)((y*128)+128);
				frVel=(char)(-1 * (y*128)+128);
				brVel=(char)(-1 * (y*128)+128);
			}
			
			else {
				flVel=(char)(-1 * (y*128)+128);
				blVel=(char)((y*128)+128);
				frVel=(char)((y*128)+128);
				brVel=(char)(-1 * (y*128)+128);
			}
		}
		
		//left shift
		else if (x<-0.1)
		{
			if (leftJoystick->GetButton(Joystick::kTriggerButton))
			{
				//trigger is down, ccw turn
				flVel=(char)(-1 * (y*128)+128);
				blVel=(char)(-1 * (y*128)+128);
				frVel=(char)((y*128)+128);
				brVel=(char)((y*128)+128);
			}
			
			else {
				flVel=(char)((y*128)+128);
				blVel=(char)((y*128)+128);
				frVel=(char)((y*128)+128);
				brVel=(char)((y*128)+128);
			}
		}*/
		
		Wait(0.1);
	}
}
Ejemplo n.º 7
0
/***********************************************************************
 Import the given 0 terminated text by invoking the given import Hook
 for every line
***********************************************************************/
BOOL ImportText(struct InstData *data, const char *contents, struct Hook *importHook, LONG wraplength, struct MinList *lines)
{
  struct line_node *line;

  ENTER();

  // make sure we start with an empty list of lines
  InitLines(lines);

  if((line = AllocVecPooled(data->mypool, sizeof(struct line_node))) != NULL)
  {
    struct ImportMessage im;

    memset(line, 0, sizeof(*line));

    im.Data = contents;
    im.ImportWrap = wraplength;
    im.PoolHandle = data->mypool;
    im.ConvertTabs = data->ConvertTabs;
    im.TabSize = data->TabSize;

    while(TRUE)
    {
      struct line_node *new_line;

      im.linenode = &line->line;

      // invoke the hook, it will return NULL in case it is finished or
      // an error occured
      im.Data = (char*)CallHookPkt(importHook, NULL, &im);

      if(im.Data == NULL)
      {
        if(line->line.Contents != NULL)
        {
          // add the last imported line to the list
          AddLine(lines, line);
        }
        else
        {
          // free the line node if it didn't contain any contents
          if(ContainsLines(lines) == FALSE)
          {
            FreeVecPooled(data->mypool, line);
          }
          else
          {
            // if the line has nor predecessor it was obviously the first line
            // so we prepare a "fake" line_node to let the textEditor clear our
            // text
            if(Init_LineNode(data, line, "\n") == TRUE)
              AddLine(lines, line);
            else
              FreeVecPooled(data->mypool, line);
          }
        }

        // bail out
        break;
      }

      // add the imported line to the list
      AddLine(lines, line);

      if((new_line = AllocVecPooled(data->mypool, sizeof(struct line_node))) == NULL)
        break;

      // inherit the flow from the current line for the next line,
      // but only if the clearFlow variable is not set
      if(line->line.clearFlow == FALSE)
        new_line->line.Flow = line->line.Flow;

      line = new_line;
    }
  }

  RETURN(ContainsLines(lines));
  return ContainsLines(lines);
}