⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xoptions.c

📁 占星术4.0源码
💻 C
📖 第 1 页 / 共 3 页
字号:
      DrawObject(i, cx+POINT(unitx, 0.65, PX(temp)),
        cy+POINT(unity, 0.65, PY(temp)));
    }
    DrawColor(objectcolor[i]);
    DrawPoint(cx+POINT(unitx, 0.56, PX(xplanet2[i])),
      cy+POINT(unity, 0.56, PY(xplanet2[i])));
    DrawPoint(cx+POINT(unitx, 0.43, PX(xplanet2[i])),
      cy+POINT(unity, 0.43, PY(xplanet2[i])));
    DrawColor(ret2[i] < 0.0 ? gray : on);
    DrawDash(cx+POINT(unitx, 0.45, PX(xplanet2[i])),
      cy+POINT(unity, 0.45, PY(xplanet2[i])),
      cx+POINT(unitx, 0.54, PX(xplanet2[i])),
      cy+POINT(unity, 0.54, PY(xplanet2[i])), 2-xcolor);
  }

  /* Now draw the inner ring of planets. If it weren't for the outer ring,  */
  /* this would be just like the standard non-relationship wheel chart with */
  /* only one set of planets. Again, draw glyph, and a line to true point.  */

  for (i = 1; i <= total; i++) {
    symbol[i] = xplanet1[i];
  }
  FillSymbolRing(symbol);
  for (i = 1; i <= total; i++) if (Proper(i)) {
    if (xlabel) {
      temp = symbol[i];
      DrawColor(ret1[i] < 0.0 ? gray : on);
      DrawDash(cx+POINT(unitx, 0.45, PX(xplanet1[i])),
        cy+POINT(unity, 0.45, PY(xplanet1[i])),
        cx+POINT(unitx, 0.48, PX(temp)),
        cy+POINT(unity, 0.48, PY(temp)),
        (ret1[i] < 0.0 ? 1 : 0) - xcolor);
      DrawObject(i, cx+POINT(unitx, 0.52, PX(temp)),
        cy+POINT(unity, 0.52, PY(temp)));
    } else
      DrawColor(objectcolor[i]);
    DrawPoint(cx+POINT(unitx, 0.43, PX(xplanet1[i])),
      cy+POINT(unity, 0.43, PY(xplanet1[i])));
  }

  /* Draw lines connecting planets between the two charts that have aspects. */

  if (!xbonus) {                  /* Don't draw aspects in bonus mode. */
    CreateGridRelation(FALSE);
    for (j = total; j >= 1; j--)
      for (i = total; i >= 1; i--)
        if (grid->n[i][j] && Proper(i) && Proper(j)) {
          DrawColor(aspectcolor[grid->n[i][j]]);
          DrawDash(cx+POINT(unitx, 0.41, PX(xplanet1[j])),
            cy+POINT(unity, 0.41, PY(xplanet1[j])),
            cx+POINT(unitx, 0.41, PX(xplanet2[i])),
            cy+POINT(unity, 0.41, PY(xplanet2[i])),
            abs(grid->v[i][j]/60/2));
        }
  }

  /* Go draw sidebar with chart information and positions if need be. */

  DrawInfo();
}


/* Draw an aspect (or midpoint) grid in the window, between the planets in  */
/* two different charts, with the planets labeled at the top and side. This */
/* chart is done when the -g switch is combined with the -r0 and -X switch. */
/* Like above, the chart always has a (definable) fixed number of cells.    */

void XChartGridRelation()
{
  char string[STRING];
  int unit, siz, x, y, i, j, k, l;
  colpal c;

  unit = CELLSIZE*SCALE; siz = (gridobjects+1)*unit;
  CreateGridRelation(xbonus != (exdisplay & DASHg0) > 0);
  for (y = 0, j = -1; y <= gridobjects; y++) {
    do {
      j++;
    } while (ignore[j] && j <= total);
    DrawColor(gray);
    DrawDash(0, (y+1)*unit, siz, (y+1)*unit, !xcolor);
    DrawDash((y+1)*unit, 0, (y+1)*unit, siz, !xcolor);
    DrawColor(hilite);
    DrawEdge(0, y*unit, unit, (y+1)*unit);
    DrawEdge(y*unit, 0, (y+1)*unit, unit);
    if (j <= total) for (x = 0, i = -1; x <= gridobjects; x++) {
      do {
        i++;
      } while (ignore[i] && i <= total);

      /* Again, we are looping through each cell in each row and column. */

      if (i <= total) {
        turtlex = x*unit+unit/2;
        turtley = y*unit+unit/2 - (SCALE/scalet > 2 ? 5*scalet : 0);

        /* If current cell is on top row or left hand column, draw glyph */
        /* of planet owning the particular row or column in question.    */

        if (y == 0 || x == 0) {
          if (x+y > 0)
            DrawObject(j == 0 ? i : j, turtlex, turtley);
        } else {

        /* Otherwise, draw glyph of aspect in effect, or glyph of */
        /* sign of midpoint, between the two planets in question. */

          if (xbonus == (exdisplay & DASHg0) > 0) {
            DrawColor(c = aspectcolor[grid->n[i][j]]);
            DrawAspect(grid->n[i][j], turtlex, turtley);
          } else {
            DrawColor(c = signcolor(grid->n[i][j]));
            DrawSign(grid->n[i][j], turtlex, turtley);
          }
        }

        /* Again, when scale size is 300, print some text in current cell: */

        if (SCALE/scalet > 2 && xlabel) {

          /* For top and left edges, print sign and degree of the planet. */

          if (y == 0 || x == 0) {
            if (x+y > 0) {
              k = ZTOS(y == 0 ? planet2[i] : planet1[j]);
              l = (int)((y == 0 ? planet2[i] : planet1[j])-STOZ(k));
              c = signcolor(k);
              sprintf(string, "%c%c%c %02d", SIGNAM(k), l);

              /* For extreme upper left corner, print some little arrows */
              /* pointing out chart1's planets and chart2's planets.     */

            } else {
              c = hilite;
              sprintf(string, "1v 2->");
            }
          } else {
            k = abs(grid->v[i][j]);

            /* For aspect cells, print the orb in degrees and minutes. */

            if (xbonus == (exdisplay & DASHg0) > 0)
              if (grid->n[i][j])
                sprintf(string, "%c%d %02d'", k != grid->v[i][j] ? (exdisplay &
                  DASHga ? 'a' : '-') : (exdisplay & DASHga ? 's' : '+'),
                  k/60, k%60);
              else
                sprintf(string, "");

            /* For midpoint cells, print degree and minute. */

            else
              sprintf(string, "%2d %02d'", k/60, k%60);
          }
          DrawColor(c);
          DrawText(string, x*unit+unit/2, (y+1)*unit-3*scalet, TRUE);
        }
      }
    }
  }
}


#ifdef BIORHYTHM
#define BIODAYS 14     /* Number of days to include in each half of chart. */

/* Draw a graphic biorhythm chart on the screen, as is done when the -rb    */
/* switch is combined with -X. This is technically a relationship chart in  */
/* that biorhythm status is determined by a natal chart time at another     */
/* later time. For the day in question, and for two weeks before and after, */
/* the Physical, Emotional, and Mental percentages are plotted.             */

void XChartBiorhythm()
{
  char string[6], *c;
  real jd, r, a;
  int x1, x2, xs, cx, y1, y2, ys, cy, i, j, k, x, y, x0, y0;

  k = FONTX*6*scalet;
  x1 = k; x2 = chartx-k; xs = x2-x1; cx = (x1+x2)/2;
  k = CELLSIZE;
  y1 = k; y2 = charty-k; ys = y2-y1; cy = (y1+y2)/2;

  /* Create a dotted day/percentage grid to graph on. */
  DrawColor(gray);
  DrawDash(x1, cy, x2, cy, 1);
  DrawDash(cx, y1, cx, y2, 1);
  for (j = -BIODAYS+1; j <= BIODAYS-1; j++) {
    x = x1 + MULTDIV(xs, j+BIODAYS, BIODAYS*2);
    for (k = -90; k <= 90; k += 10) {
      y = y1 + MULTDIV(ys, 100+k, 200);
      DrawPoint(x, y);
    }
  }

  /* Now actually draw the three biorhythm curves. */
  for (i = 1; i <= 3; i++) {
    jd = floor(JD + ROUND);
    switch (i) {
    case 1: r = _PHY; c = "PHYS"; DrawColor(elemcolor[_FIR]); break;
    case 2: r = _EMO; c = "EMOT"; DrawColor(elemcolor[_WAT]); break;
    case 3: r = _INT; c = "INTE"; DrawColor(elemcolor[_EAR]); break;
    }
    for (jd -= (real)BIODAYS, j = -BIODAYS; j <= BIODAYS; j++, jd += 1.0) {
      a = Biorhythm(jd, r);
      x = x1 + MULTDIV(xs, j+BIODAYS, BIODAYS*2);
      y = y1 + (int)((real)ys * (100.0-a) / 200.0);
      if (j > -BIODAYS)
        DrawLine(x0, y0, x, y);
      else
        DrawText(c, x1/2, y+2*scalet, FALSE);
      x0 = x; y0 = y;
    }
  }

  DrawColor(hilite);
  /* Label biorhythm percentages along right vertical axis. */
  for (k = -100; k <= 100; k += 10) {
    sprintf(string, "%c%3d%%", k < 0 ? '-' : '+', abs(k));
    y = y1 + MULTDIV(ys, 100-k, 200);
    DrawText(string, (x2+chartx)/2, y+2*scalet, FALSE);
  }
  /* Label days on top horizontal axis. */
  for (j = -BIODAYS; j <= BIODAYS; j += 2) {
    x = x1 + MULTDIV(xs, j+BIODAYS, BIODAYS*2);
    sprintf(string, "%c%d", j < 0 ? '-' : '+', abs(j));
    DrawText(string, x, y1-2*scalet, TRUE);
  }
  DrawEdge(x1, y1, x2, y2);
}
#endif


/* Create a chart in the window based on the current graphics chart mode. */
/* This is the main dispatch routine for all of the program's graphics.   */

void XChart()
{
  char string[STRING];
  int i, j, k;

  scalet = psfile ? PSMUL : (metafile ? METAMUL : 1);

  DrawClearScreen();
  switch (modex) {
  case MODEv:
  case MODEw:
    if (relation > DASHr0)
      XChartWheel();
    else
      XChartWheelRelation();
    break;
  case MODEL:
    DrawWorld(degree);     /* First draw map of world.           */
    XChartAstroGraph();    /* Then draw astro-graph lines on it. */
    break;
  case MODEg:
    if (relation > DASHr0)
      XChartGrid();
    else
      XChartGridRelation();
    break;
  case MODEZ:
    if (exdisplay & DASHZ0)
      XChartHorizonSky();
    else
      XChartHorizon();
    break;
  case MODES:
    XChartSpace();
    break;
  case MODEE:
    XChartEphemeris();
    break;
  case MODEW:
    DrawWorld(degree);                         /* First draw map of world. */
    if (xbonus && (exdisplay & DASHXW0) == 0)  /* Then maybe Ley lines.    */
      DrawLeyLines(degree);
    break;
  case MODEG:
  case MODEP:
    DrawGlobe(degree);
    break;
#ifdef BIORHYTHM
  case MODEb:
    XChartBiorhythm();
    break;
#endif
  }

  /* Print text showing chart information at bottom of window. */

  DrawColor(hilite);
  if (xtext && modex != MODEW && modex != MODEG && modex != MODEP &&
    ((modex != MODEv && modex != MODEw) || (exdisplay & DASHv0) > 0)) {
    if (Mon == -1)
      sprintf(string, "(no time or space)");
    else if (relation == DASHrc)
      sprintf(string, "(composite)");
    else {
      i = (int) (FRACT(dabs(Tim))*100.0+ROUND/60.0);
      j = (int) (FRACT(dabs(Zon))*100.0+ROUND/60.0);
      k = ansi; ansi = FALSE;
      sprintf(string, "%s %s (%d:%02d GMT) %s",
        CharDate(Mon, Day, Yea, 2), CharTime((int)floor(Tim), i),
        (int)(-Zon), j, CharLocation(Lon, Lat, 100.0));
      ansi = k;
    }
    DrawText(string, chartx/2, charty-3*scalet, TRUE);
  }

  /* Draw a border around the chart if the mode is set and appropriate. */

  if ((xborder || modex == MODEg) && modex != MODEG && modex != MODEP &&
    (modex != MODEW || (exdisplay & DASHXW0) == 0))
    DrawEdgeAll();
}
#endif /* GRAPH */

/* xoptions.c */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -