home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 105 / af105sub.adf / Beyondthedark.LZX / BeyondTheDark / Developer / Source / ASwarm / ASwarm.c next >
C/C++ Source or Header  |  2016-01-08  |  14KB  |  525 lines

  1.  
  2. #include <exec/memory.h>
  3. #include <exec/execbase.h>
  4. #include <graphics/gfxbase.h>
  5. #include <intuition/intuitionbase.h>
  6. #include <libraries/iffparse.h>
  7. #include <utility/tagitem.h>
  8.  
  9. #define __USE_SYSBASE 42
  10.  
  11. #include <proto/exec.h>
  12. #include <proto/graphics.h>
  13. #include <proto/intuition.h>
  14. #include <proto/utility.h>
  15.  
  16. #include "BTD.h"
  17.  
  18. struct IntuitionBase *IntuitionBase;
  19. struct GfxBase *GfxBase;
  20. struct Library *UtilityBase;
  21.  
  22. #define ASTAG(o) (BTD_Client+(o))
  23.  
  24. #define AS_Wasps ASTAG(0)
  25. #define AS_Bees  ASTAG(1)
  26. #define AS_Tight ASTAG(2)
  27. #define AS_Speed ASTAG(3)
  28. #define AS_Vel   ASTAG(4)
  29. #define AS_Aim   ASTAG(5)
  30. #define AS_Cycle ASTAG(6)
  31.  
  32. #define MAX_SPEED     4L
  33. #define MAX_WASPS     10L
  34. #define MAX_BEES      500L
  35. #define MAX_TIGHTNESS 10L
  36. #define MAX_VEL       15L
  37.  
  38. #define DEF_SPEED     3L
  39. #define DEF_WASPS     2L
  40. #define DEF_BEES      25L
  41. #define DEF_TIGHTNESS 6L
  42. #define DEF_VEL       5L
  43.  
  44. #define BEEACC  3
  45. #define BEEVELOC 2
  46. #define WASPACC 5
  47. #define WASPVELOC 5
  48. #define BORDER  20
  49. #define WASPVEL (WASPVELOC+SP->ss_Velocity)
  50. #define BEEVEL  (BEEVELOC+SP->ss_Velocity)
  51.  
  52. char *Speeds[] = {"Slow","Normal","Fast","Incredible",NULL};
  53.  
  54. struct BTDCycle ASwarmCycleParams[] =
  55.  {
  56.   AS_Speed,"Speed",BTDPT_CYCLE,DEF_SPEED,Speeds
  57.  };
  58.  
  59. struct BTDInteger ASwarmIntParams[] =
  60.  {
  61.   AS_Wasps,"Wasps",BTDPT_INTEGER,DEF_WASPS,1L,MAX_WASPS,TRUE,
  62.   AS_Bees,"Bees",BTDPT_INTEGER,DEF_BEES,1L,MAX_BEES,TRUE,
  63.   AS_Vel,"Velocity",BTDPT_INTEGER,DEF_VEL,1L,MAX_VEL,TRUE,
  64.   AS_Tight,"Tightness",BTDPT_INTEGER,DEF_TIGHTNESS,1L,MAX_TIGHTNESS,TRUE
  65.  };
  66.  
  67. struct BTDBoolean ASwarmBoolParams[] =
  68.  {
  69.   AS_Cycle,"Cycle",BTDPT_BOOLEAN,TRUE,
  70.   AS_Aim,"Aim Mode",BTDPT_BOOLEAN,FALSE
  71.  };
  72.  
  73. struct BTDNode *ASwarmParams[] =
  74.  {
  75.   &ASwarmCycleParams[0].BC_Node,
  76.   &ASwarmIntParams[0].BI_Node,&ASwarmIntParams[1].BI_Node,
  77.   &ASwarmIntParams[2].BI_Node,&ASwarmIntParams[3].BI_Node,
  78.   &ASwarmBoolParams[0].BB_Node,&ASwarmBoolParams[1].BB_Node,
  79.   NULL
  80.  };
  81.  
  82. struct BTDInfo ASwarmInfo =
  83.  {
  84.   BTDI_Revision,MAKE_ID('S','W','R','M'),
  85.   "ASwarm","based on XSwarm","Markus Illenseer and Matthias Scheler",
  86.   ASwarmParams
  87.  };
  88.  
  89. /* rainbow colors */
  90.  
  91. #define NUM_RAINBOW_COLORS 6
  92.  
  93. UBYTE RBRed[NUM_RAINBOW_COLORS+1]   = {0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF};
  94. UBYTE RBGreen[NUM_RAINBOW_COLORS+1] = {0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00};
  95. UBYTE RBBlue[NUM_RAINBOW_COLORS+1]  = {0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00};
  96.  
  97. #define NUM_STEPS 16
  98.  
  99. #define NUM_BEE_COLORS (NUM_RAINBOW_COLORS*NUM_STEPS)
  100.  
  101. /* structure for a swarm, including the wasp */
  102.  
  103. struct SwarmStruct
  104.  {
  105.   struct BTDDrawInfo *ss_BTDDrawInfo;
  106.   WORD ss_Width;   /* Width and */
  107.   WORD ss_Height;  /* Height of the used area */
  108.   LONG ss_Speed;   /* Speed */
  109.   LONG ss_Count;   /* time until next frame */
  110.   BOOL ss_AimMode; /* Bees may aim another wasp */
  111.   WORD ss_Color;   /* Actual Color */
  112.   WORD ss_DColor;  /* Cycling direction */
  113.   WORD ss_NumWasps;/* total number of the Wasps */
  114.   WORD *ss_WX[4];  /* The Wasps x-Position*/  /* WX[3] is used for Velocity */
  115.   WORD *ss_WY[4];  /* Y-Position */
  116.   WORD *ss_NB;     /* No. of Bees following this Wasp */
  117.   WORD ss_NumBees; /* Total (!) number of Bees */
  118.   LONG ss_Velocity;/* Velocity of the insects */
  119.   WORD ss_BeeAcc;  /* Acceleration of the Bees */
  120.   WORD *ss_X[4];   /* The Bees X-Position */  /* X[3] used for Velocity */
  121.   WORD *ss_Y[4];   /* Y-Position */
  122.   WORD *ss_MW;     /* The aimed Wasp */
  123.   LONG ss_RandN,ss_RandF,ss_RandI;
  124.   UBYTE ss_Red[NUM_BEE_COLORS];
  125.   UBYTE ss_Green[NUM_BEE_COLORS];
  126.   UBYTE ss_Blue[NUM_BEE_COLORS];
  127.  };
  128.  
  129. /* Ill's strange Macros for easy access to the above structure */
  130.  
  131. #define BXVel(I)   (SP->ss_X[3][I])
  132. #define BYVel(I)   (SP->ss_Y[3][I])
  133. #define BeeX(P,I)  (SP->ss_X[P][I])
  134. #define BeeY(P,I)  (SP->ss_Y[P][I])
  135. #define MyWasp(I)  (SP->ss_MW[I])
  136.  
  137. #define WaXVel(I)  (SP->ss_WX[3][I])
  138. #define WaYVel(I)  (SP->ss_WY[3][I])
  139. #define WaspX(P,I) (SP->ss_WX[P][I])
  140. #define WaspY(P,I) (SP->ss_WY[P][I])
  141.  
  142. /* library stuff */
  143.  
  144. char MyBlankerName[] = "aswarm.btd";
  145. char MyBlankerID[]   = "ASwarm Blanker V" VERSION "." REVISION " for BTD";
  146.  
  147. LONG MyBlankerLibInit(void)
  148.  
  149. {
  150.  if (GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",37L))
  151.   {
  152.    if (IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",37L))
  153.     {
  154.      if (UtilityBase=OpenLibrary("utility.library",37L)) return TRUE;
  155.  
  156.      CloseLibrary (&IntuitionBase->LibNode);
  157.     }
  158.    CloseLibrary (&GfxBase->LibNode);
  159.   }
  160.  return FALSE;
  161. }
  162.  
  163. void MyBlankerLibFree(void)
  164.  
  165. {
  166.  CloseLibrary (UtilityBase);
  167.  CloseLibrary (&IntuitionBase->LibNode);
  168.  CloseLibrary (&GfxBase->LibNode);
  169. }
  170.  
  171. /* random generator */
  172.  
  173. #define RAND(m) (Random(SP,m)-(m)/2)
  174.  
  175. void __regargs InitRandom(struct SwarmStruct *SwarmStruct,ULONG Instance)
  176.  
  177. {
  178.  ULONG Time[2];
  179.  
  180.  CurrentTime (&Time[0],&Time[1]);
  181.  SwarmStruct->ss_RandN=(LONG)Time[0];
  182.  
  183.  if (Time[1]<1024L) Time[1]|=1;
  184.  else Time[1]>>=10;
  185.  Time[1]^=Instance;
  186.  
  187.  SwarmStruct->ss_RandF=4*Time[1]+1;
  188.  SwarmStruct->ss_RandI=2*Time[1]+1;
  189. }
  190.  
  191. WORD __regargs Random(struct SwarmStruct *SwarmStruct,WORD Max)
  192.  
  193. {
  194.  SwarmStruct->ss_RandN=SwarmStruct->ss_RandF*SwarmStruct->ss_RandN+SwarmStruct->ss_RandI;
  195.  if (SwarmStruct->ss_RandN<0L) SwarmStruct->ss_RandN=-SwarmStruct->ss_RandN;
  196.  
  197.  return (WORD)(SwarmStruct->ss_RandN%Max);
  198. }
  199.  
  200. /* fast integer square root, result will be not exact for x>255 */
  201.  
  202. BYTE SquareRootTab[256] = /* The mighty 256 Bytes eater :-) */
  203.  {
  204.   0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,
  205.   4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,
  206.   5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,
  207.   6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  208.   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  209.   8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
  210.   9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,
  211.   10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,
  212.   11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
  213.   12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
  214.   12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,
  215.   13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
  216.   13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,
  217.   14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  218.   14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
  219.   15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
  220.  };
  221.  
  222. LONG __regargs FastSQRT(LONG x)
  223.  
  224. {
  225.  LONG sr;
  226.  
  227.  sr=1L;
  228.  while (x>255L)
  229.   {
  230.    x/=4L;
  231.    sr*=2L;
  232.   }
  233.  return sr*(LONG)SquareRootTab[x];
  234. }
  235.  
  236. /* implementation of library functions */
  237.  
  238. struct BTDInfo *QueryMyBlanker(void)
  239.  
  240. {
  241.  return &ASwarmInfo;
  242. }
  243.  
  244. ULONG __regargs SwarmSize(LONG NumWaps,LONG NumBees)
  245.  
  246. {
  247.  return sizeof(struct SwarmStruct)+sizeof(WORD)*((ULONG)(NumWaps+NumBees)*9L);
  248. }
  249.  
  250. struct SwarmStruct *InitMyBlanker(struct TagItem *TagList)
  251.  
  252. {
  253.  struct BTDDrawInfo *BTDDrawInfo;
  254.  ULONG *Error,Dummy,Instance,Index;
  255.  LONG NumWasps,NumBees,Tightness;
  256.  struct SwarmStruct *SP;
  257.  WORD *Ptr;
  258.  
  259.  if ((BTDDrawInfo=(struct BTDDrawInfo *)
  260.                    GetTagData(BTD_DrawInfo,NULL,TagList))==NULL) return NULL;
  261.  Error=(ULONG *)GetTagData(BTD_Error,(ULONG)&Dummy,TagList);
  262.  if ((BTDDrawInfo->BDI_Width<(BORDER*3))||
  263.      (BTDDrawInfo->BDI_Height<(BORDER*3)))
  264.   {
  265.    *Error=BTDERR_Size;
  266.    return NULL;
  267.   }
  268.  Instance=GetTagData(BTD_Instance,0L,TagList);
  269.  
  270.  NumWasps=GetTagData(AS_Wasps,DEF_WASPS,TagList);
  271.  NumBees=GetTagData(AS_Bees,DEF_BEES,TagList);
  272.  if ((SP=AllocVec(SwarmSize(NumWasps,NumBees),MEMF_PUBLIC|MEMF_CLEAR))==NULL)
  273.   {
  274.    *Error=BTDERR_Memory;
  275.    return NULL;
  276.   }
  277.  
  278.  SP->ss_BTDDrawInfo=BTDDrawInfo;
  279.  SP->ss_Width=BTDDrawInfo->BDI_Width;
  280.  SP->ss_Height=BTDDrawInfo->BDI_Height;
  281.  SP->ss_NumWasps=NumWasps;
  282.  SP->ss_NumBees=NumBees;
  283.  SP->ss_Velocity=GetTagData(AS_Vel,DEF_VEL,TagList);
  284.  Tightness=GetTagData(AS_Tight,DEF_TIGHTNESS,TagList);
  285.  SP->ss_BeeAcc=(Tightness*BEEACC)/MAX_SPEED+1;
  286.  
  287.  Ptr=(WORD *)&SP[1];
  288.  for (Index=0L; Index<4L; Index++)
  289.   {
  290.    SP->ss_WX[Index]=Ptr;
  291.    Ptr+=NumWasps;
  292.    SP->ss_WY[Index]=Ptr;
  293.    Ptr+=NumWasps;
  294.    SP->ss_X[Index]=Ptr;
  295.    Ptr+=NumBees;
  296.    SP->ss_Y[Index]=Ptr;
  297.    Ptr+=NumBees;
  298.   }
  299.  SP->ss_NB=Ptr;
  300.  SP->ss_MW=Ptr+NumWasps;
  301.  
  302.  InitRandom (SP,Instance);
  303.  
  304.  SP->ss_Speed=GetTagData(AS_Speed,DEF_SPEED,TagList)+1L;
  305.  SP->ss_Count=MAX_SPEED;
  306.  SP->ss_AimMode=GetTagData(AS_Aim,FALSE,TagList);
  307.  
  308.  /* Colors */
  309.  
  310.  if (GetTagData(AS_Cycle,TRUE,TagList))
  311.   {
  312.    ULONG Col,Step;
  313.  
  314.    for (Index=0L, Col=0L; Index<NUM_RAINBOW_COLORS; Index++)
  315.     for (Step=0L; Step<NUM_STEPS; Step++, Col++)
  316.      {
  317.       SP->ss_Red[Col]=RBRed[Index]+((RBRed[Index+1]-RBRed[Index])*Step)/NUM_STEPS;
  318.       SP->ss_Green[Col]=RBGreen[Index]+((RBGreen[Index+1]-RBGreen[Index])*Step)/NUM_STEPS;
  319.       SP->ss_Blue[Col]=RBBlue[Index]+((RBBlue[Index+1]-RBBlue[Index])*Step)/NUM_STEPS;
  320.      }
  321.  
  322.    SP->ss_Color=Random(SP,NUM_BEE_COLORS);
  323.    SP->ss_DColor=Random(SP,2)?(NUM_BEE_COLORS-1):1;
  324.   }
  325.  else
  326.   {
  327.    SP->ss_DColor=0;
  328.    BTDDrawInfo->BDI_Red[BTDDrawInfo->BDI_Pens[1]]=0xFF;
  329.    BTDDrawInfo->BDI_Green[BTDDrawInfo->BDI_Pens[1]]=0x00;
  330.    BTDDrawInfo->BDI_Blue[BTDDrawInfo->BDI_Pens[1]]=0x00;
  331.    BTDDrawInfo->BDI_Changed[BTDDrawInfo->BDI_Pens[1]]=TRUE;
  332.   }
  333.  
  334.  /* Wasps */
  335.  for (Index=0L; Index<NumWasps; Index++)
  336.   {
  337.    WaspX(1,Index)=WaspX(0,Index)=BORDER+Random(SP,SP->ss_Width-2*BORDER);
  338.    WaspY(1,Index)=WaspY(0,Index)=BORDER+Random(SP,SP->ss_Height-2*BORDER);
  339.    WaXVel(Index)=RAND(WASPACC);
  340.    WaYVel(Index)=RAND(WASPACC);
  341.    SP->ss_NB[Index]=0;
  342.   }
  343.  
  344.  /* Bees */
  345.  for (Index=0L; Index<NumBees; Index++)
  346.   {
  347.    BeeX(1,Index)=BeeX(0,Index)=BORDER+Random(SP,SP->ss_Width-2*BORDER);
  348.    BeeY(1,Index)=BeeY(0,Index)=BORDER+Random(SP,SP->ss_Height-2*BORDER);
  349.    BXVel(Index)=RAND(SP->ss_BeeAcc);
  350.    BYVel(Index)=RAND(SP->ss_BeeAcc);
  351.    SP->ss_NB[MyWasp(Index)=Index%SP->ss_NumWasps]++;
  352.   }
  353.  
  354.  BTDDrawInfo->BDI_Red[BTDDrawInfo->BDI_Pens[0]]=255;
  355.  BTDDrawInfo->BDI_Green[BTDDrawInfo->BDI_Pens[0]]=255;
  356.  BTDDrawInfo->BDI_Blue[BTDDrawInfo->BDI_Pens[0]]=255;
  357.  BTDDrawInfo->BDI_Changed[BTDDrawInfo->BDI_Pens[0]]=TRUE;
  358.  
  359.  return SP;
  360. }
  361.  
  362. void EndMyBlanker(struct SwarmStruct *SP)
  363.  
  364. {
  365.  FreeVec (SP);
  366. }
  367.  
  368. void AnimMyBlanker(struct SwarmStruct *SP)
  369.  
  370. {
  371.  struct BTDDrawInfo *BTDDrawInfo;
  372.  LONG Index,Left,Top;
  373.  struct RastPort *RP;
  374.  WORD WaspPen,BeePen;
  375.  
  376.  BTDDrawInfo=SP->ss_BTDDrawInfo;
  377.  if (SP->ss_DColor)
  378.   {
  379.    BTDDrawInfo->BDI_Red[BTDDrawInfo->BDI_Pens[1]]=SP->ss_Red[SP->ss_Color];
  380.    BTDDrawInfo->BDI_Green[BTDDrawInfo->BDI_Pens[1]]=SP->ss_Green[SP->ss_Color];
  381.    BTDDrawInfo->BDI_Blue[BTDDrawInfo->BDI_Pens[1]]=SP->ss_Blue[SP->ss_Color];
  382.    BTDDrawInfo->BDI_Changed[BTDDrawInfo->BDI_Pens[1]]=TRUE;
  383.    SP->ss_Color=(SP->ss_Color+SP->ss_DColor)%NUM_BEE_COLORS;
  384.   }
  385.  
  386.  WaitTOF();
  387.  if (SP->ss_Count<MAX_SPEED)
  388.   {
  389.    SP->ss_Count++;
  390.    return;
  391.   }
  392.  SP->ss_Count=SP->ss_Speed;
  393.  
  394.  /* Wasps */
  395.  
  396.  for (Index=0L; Index<SP->ss_NumWasps; Index++)
  397.   {
  398.    WaspX(2,Index)=WaspX(1,Index);
  399.    WaspX(1,Index)=WaspX(0,Index);
  400.    WaspY(2,Index)=WaspY(1,Index);
  401.    WaspY(1,Index)=WaspY(0,Index);
  402.  
  403.    WaXVel(Index)+=RAND(WASPACC);
  404.    WaYVel(Index)+=RAND(WASPACC);
  405.  
  406.    if (WaXVel(Index)>WASPVEL) WaXVel(Index)=WASPVEL;
  407.    if (WaXVel(Index)<-WASPVEL) WaXVel(Index)=-WASPVEL;
  408.    if (WaYVel(Index)>WASPVEL) WaYVel(Index)=WASPVEL;
  409.    if (WaYVel(Index)<-WASPVEL) WaYVel(Index)=-WASPVEL;
  410.  
  411.    WaspX(0,Index)=WaspX(1,Index)+WaXVel(Index);
  412.    WaspY(0,Index)=WaspY(1,Index)+WaYVel(Index);
  413.  
  414.    /* Bounce check for Wasps */
  415.  
  416.    if ((WaspX(0,Index)<BORDER)||(WaspX(0,Index)>SP->ss_Width-BORDER-1))
  417.     {
  418.      WaXVel(Index)=-WaXVel(Index);
  419.      WaspX(0,Index)+=WaXVel(Index);
  420.     }
  421.    if ((WaspY(0,Index)<BORDER)||(WaspY(0,Index)>SP->ss_Height-BORDER-1))
  422.     {
  423.      WaYVel(Index)=-WaYVel(Index);
  424.      WaspY(0,Index)+=WaYVel(Index);
  425.     }
  426.   }
  427.  
  428.  /* Bees */
  429.  
  430.  for (Index=0L; Index<SP->ss_NumBees; Index++)
  431.   {
  432.    WORD DX,DY,ChkIndex;
  433.    LONG Distance,NewDistance;
  434.  
  435.    BeeX(2,Index)=BeeX(1,Index);
  436.    BeeX(1,Index)=BeeX(0,Index);
  437.    BeeY(2,Index)=BeeY(1,Index);
  438.    BeeY(1,Index)=BeeY(0,Index);
  439.  
  440.    DX=WaspX(1,MyWasp(Index))-BeeX(1,Index);
  441.    DY=WaspY(1,MyWasp(Index))-BeeY(1,Index);
  442.    Distance=FastSQRT(DX*DX+DY*DY);
  443.    if (Distance==0L) Distance=1L;
  444.  
  445.    if (SP->ss_AimMode) /* Look out for the nearest wasp if Aim-Mode is on */
  446.     for (ChkIndex=0; ChkIndex<SP->ss_NumWasps; ChkIndex++)
  447.      if (ChkIndex!=MyWasp(Index))
  448.       {
  449.        LONG NewDX,NewDY;
  450.  
  451.        NewDX=WaspX(1,ChkIndex)-BeeX(1,Index);
  452.        NewDY=WaspY(1,ChkIndex)-BeeY(1,Index);
  453.        NewDistance=FastSQRT(NewDX*NewDX+NewDY*NewDY);
  454.        if (Distance>NewDistance)
  455.         {
  456.          DX=NewDX;
  457.          DY=NewDY;
  458.          if (NewDistance==0L) Distance=1L;
  459.          else Distance=NewDistance;
  460.          SP->ss_NB[MyWasp(Index)]--;
  461.          SP->ss_NB[MyWasp(Index)=ChkIndex]++; /* Mark a nearer Wasp */
  462.         }
  463.       }
  464.  
  465.    BXVel(Index)+=(DX*SP->ss_BeeAcc)/Distance+RAND(3);
  466.    BYVel(Index)+=(DY*SP->ss_BeeAcc)/Distance+RAND(3);
  467.  
  468.    if (BXVel(Index)>BEEVEL)  BXVel(Index)=BEEVEL;
  469.    if (BXVel(Index)<-BEEVEL) BXVel(Index)=-BEEVEL;
  470.    if (BYVel(Index)>BEEVEL)  BYVel(Index)=BEEVEL;
  471.    if (BYVel(Index)<-BEEVEL) BYVel(Index)=-BEEVEL;
  472.  
  473.    BeeX(0,Index)=BeeX(1,Index)+BXVel(Index);
  474.    BeeY(0,Index)=BeeY(1,Index)+BYVel(Index);
  475.  
  476.   /* Bounce check for Bees */
  477.  
  478.    if ((BeeX(0,Index)<BORDER)||(BeeX(0,Index)>(SP->ss_Width-BORDER-1)))
  479.     {
  480.      BXVel(Index)=-BXVel(Index);
  481.      BeeX(0,Index)+=BXVel(Index);
  482.     }
  483.    if ((BeeY(0,Index)<BORDER)||(BeeY(0,Index)>(SP->ss_Height-BORDER-1)))
  484.     {
  485.      BYVel(Index)=-BYVel(Index);
  486.      BeeY(0,Index)+=BYVel(Index);
  487.     }
  488.   }
  489.  
  490.  
  491.  RP=BTDDrawInfo->BDI_RPort;
  492.  Left=BTDDrawInfo->BDI_Left;
  493.  Top=BTDDrawInfo->BDI_Top;
  494.  WaspPen=BTDDrawInfo->BDI_Pens[0];
  495.  BeePen=BTDDrawInfo->BDI_Pens[1];
  496.  
  497.  /* Move our insects */
  498.  
  499.  for (Index=0L; Index<SP->ss_NumWasps; Index++)   /* Wasps */
  500.   {
  501.    SetAPen (RP,BTD_BgPen);
  502.    Move (RP,Left+WaspX(2,Index),Top+WaspY(2,Index));
  503.    Draw (RP,Left+WaspX(1,Index),Top+WaspY(1,Index));
  504.  
  505.    SetAPen (RP,WaspPen);
  506.    Draw (RP,Left+WaspX(0,Index),Top+WaspY(0,Index));
  507.   }
  508.  
  509.  for (Index=0L; Index<SP->ss_NumBees; Index++)   /* Bees  */
  510.   {
  511.    SetAPen (RP,BTD_BgPen);
  512.    Move (RP,Left+BeeX(2,Index),Top+BeeY(2,Index));
  513.    Draw (RP,Left+BeeX(1,Index),Top+BeeY(1,Index));
  514.  
  515.    SetAPen (RP,BeePen);
  516.    Draw (RP,Left+BeeX(0,Index),Top+BeeY(0,Index));
  517.   }
  518. }
  519.  
  520. ULONG PenCountMyBlanker(struct TagItem *TagList)
  521.  
  522. {
  523.  return 2L;
  524. }
  525.