-
Notifications
You must be signed in to change notification settings - Fork 67
/
xcharts0.cpp
2331 lines (2105 loc) · 76.7 KB
/
xcharts0.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
** Astrolog (Version 7.70) File: xcharts0.cpp
**
** IMPORTANT NOTICE: Astrolog and all chart display routines and anything
** not enumerated below used in this program are Copyright (C) 1991-2024 by
** Walter D. Pullen ([email protected], http://www.astrolog.org/astrolog.htm).
** Permission is granted to freely use, modify, and distribute these
** routines provided these credits and notices remain unmodified with any
** altered or distributed versions of the program.
**
** The main ephemeris databases and calculation routines are from the
** library SWISS EPHEMERIS and are programmed and copyright 1997-2008 by
** Astrodienst AG. Use of that source code is subject to license for Swiss
** Ephemeris Free Edition at https://www.astro.com/swisseph/swephinfo_e.htm.
** This copyright notice must not be changed or removed by any user of this
** program.
**
** Additional ephemeris databases and formulas are from the calculation
** routines in the program PLACALC and are programmed and Copyright (C)
** 1989,1991,1993 by Astrodienst AG and Alois Treindl ([email protected]). The
** use of that source code is subject to regulations made by Astrodienst
** Zurich, and the code is not in the public domain. This copyright notice
** must not be changed or removed by any user of this program.
**
** The original planetary calculation routines used in this program have
** been copyrighted and the initial core of this program was mostly a
** conversion to C of the routines created by James Neely as listed in
** 'Manual of Computer Programming for Astrologers', by Michael Erlewine,
** available from Matrix Software.
**
** Atlas composed using data from https://www.geonames.org/ licensed under a
** Creative Commons Attribution 4.0 License. Time zone changes composed using
** public domain TZ database: https://data.iana.org/time-zones/tz-link.html
**
** The PostScript code within the core graphics routines are programmed
** and Copyright (C) 1992-1993 by Brian D. Willoughby ([email protected]).
**
** More formally: This program is free software; you can redistribute it
** and/or modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of the
** License, or (at your option) any later version. This program is
** distributed in the hope that it will be useful and inspiring, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details, a copy of which is in the
** LICENSE.HTM file included with Astrolog, and at http://www.gnu.org
**
** Initial programming 8/28-30/1991.
** X Window graphics initially programmed 10/23-29/1991.
** PostScript graphics initially programmed 11/29-30/1992.
** Last code change made 4/22/2024.
*/
#include "astrolog.h"
#ifdef GRAPH
/*
******************************************************************************
** Graphics Chart Utilities.
******************************************************************************
*/
// Given a string, draw it on the screen using the given color. The position
// of the text is based the saved positions of where we drew the text the last
// time the routine was called, being either directly below in the same column
// or in the same row just to the right. This is used by the sidebar drawing
// routine to print a list of text on the chart.
int DrawPrint(CONST char *sz, int m, int n)
{
static int xStart, x, y;
if (sz == NULL) { // Null string means just initialize position.
if (n >= 0) {
xStart = x = m; y = n;
} else
x += m;
return y;
}
if (y >= gs.yWin-1) // Don't draw if have scrolled off the chart bottom.
return y;
DrawColor(m);
if (CwchSz(sz) > 25) // Adjust slightly to fit in 26 character strings.
x -= xFont2*gi.nScaleText/2;
DrawSz(sz, x, y, dtLeft | dtBottom | dtScale2);
// If the second parameter is TRUE, then stay on the same line, otherwise
// when FALSE go to the next line at the original column setting.
if (n)
x += CchSz(sz) * xFontT;
else {
x = xStart;
n = y;
y += yFontT;
}
return y;
}
// Draw a zodiac position on the screen, rounding and formatting as needed.
int DrawZodiac(real deg, int n)
{
if (us.fRound) {
if (us.nDegForm == dfZod)
deg = Mod(deg + (is.fSeconds ? rRound/60.0/60.0 : rRound/60.0));
else if (us.nDegForm == dfHM)
deg = Mod(deg + (is.fSeconds ? rRound/4.0/60.0 : rRound/4.0));
}
return DrawPrint(SzZodiac(deg), kSignB(SFromZ(deg)), n);
}
// Print chart info in the sidebar for a single chart. Called from
// DrawSidebar() 1-6 times depending on the relationship chart mode.
void DrawInfo(CI *pci, CONST char *szHeader, flag fAll)
{
char sz[cchSzDef], szT[cchSzDef], *pch, *pch2;
if (szHeader != NULL)
DrawPrint(szHeader, gi.kiOn, fFalse);
if (FSzSet(pci->nam))
DrawPrint(pci->nam, gi.kiLite, fFalse);
if (FNoTimeOrSpace(*pci))
DrawPrint("No time or space", gi.kiLite, fFalse);
else if (us.nRel == rcComposite)
DrawPrint("Composite chart", gi.kiLite, fFalse);
else {
// Standard case: Print date, time, location, and maybe more.
sprintf(sz, "%.3s %s", szDay[DayOfWeek(pci->mon, pci->day, pci->yea)],
SzDate(pci->mon, pci->day, pci->yea, fTrue));
DrawPrint(sz, gi.kiLite, fFalse);
DrawPrint(SzTim(pci->tim), gi.kiLite, fTrue);
sprintf(sz, " %s%cT Zone %s%s", is.fSeconds ? "" : "(", ChDst(pci->dst),
SzZone(pci->zon), is.fSeconds ? "" : ")");
DrawPrint(sz, gi.kiLite, fFalse);
if (FSzSet(pci->loc))
DrawPrint(pci->loc, gi.kiLite, fFalse);
DrawPrint(SzLocation(pci->lon, pci->lat), gi.kiLite, fFalse);
if (fAll) {
sprintf(sz, "%s%s houses", us.fHouse3D == (gi.nMode != gSphere) ?
"3D " : (us.fHouse3D && gi.nMode == gSphere ? "2D " : ""),
szSystem[is.nHouseSystem]);
DrawPrint(sz, gi.kiLite, fFalse);
sprintf(sz, "%s, %s", !us.fSidereal ? "Tropical" :
(!us.fSidereal2 ? "Sidereal" : "Sidereal Inv"),
us.objCenter == oSun ?
(!us.fBarycenter ? "Heliocentric" : "Barycentric") :
(us.objCenter == oEar ?
(!us.fTopoPos ? "Geocentric" : "Topocentric") :
szObjDisp[us.objCenter]));
DrawPrint(sz, gi.kiLite, fFalse);
sprintf(sz, "Julian Day: %13.5f", JulianDayFromTime(is.T));
DrawPrint(sz, gi.kiLite, fFalse);
if (us.fProgress) {
sprintf(sz, "Progressed To: %s", SzDate(MonT, DayT, YeaT, 0));
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.objRot1 != us.objRot2 || us.fObjRotWhole) {
sprintf(sz, "Rotate: %.3s to %.3s%s", szObjDisp[us.objRot1],
szObjDisp[us.objRot2], us.fObjRotWhole ? "'s sign" : "");
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.objOnAsc) {
sprintf(sz, "Solar: %.4s%s on %.3s", szObjDisp[NAbs(us.objOnAsc)-1],
us.fSolarWhole ? "'s sign" : "",
szObjDisp[us.objOnAsc > 0 ? oAsc : oMC]);
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.fEquator)
DrawPrint("Special: Equatorial lon.", gi.kiLite, fFalse);
if (us.fGeodetic)
DrawPrint("Special: Geodetic houses", gi.kiLite, fFalse);
if (us.fFlip)
DrawPrint("Special: Domal mode", gi.kiLite, fFalse);
if (us.fDecan)
DrawPrint("Special: Decan mode", gi.kiLite, fFalse);
if (us.rHarmonic != 1.0) {
if (gi.nMode != gMidpoint || us.rHarmonic == 0.0) {
FormatR(szT, us.rHarmonic, -5);
sprintf(sz, "Special: Harmonic %.7s", szT);
} else {
FormatR(szT, rDegMax / us.rHarmonic, -5);
sprintf(sz, "Special: Dial %.7s", szT);
}
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.nDwad == 1)
DrawPrint("Special: Dwad mode", gi.kiLite, fFalse);
else if (us.nDwad > 1) {
sprintf(sz, "Special: Dwad level %d", us.nDwad);
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.fNavamsa)
DrawPrint("Special: Navamsa mode", gi.kiLite, fFalse);
if (us.fMoonMove && (us.fMoons || us.fStar)) {
sprintf(sz, "Special: Overlay %ss",
FStar(us.objCenter) ? "planet" : "moon");
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.fNoNutation && !us.fSidereal)
DrawPrint("Special: No Nutation", gi.kiLite, fFalse);
if (us.rDeltaT != rInvalid) {
FormatR(szT, us.rDeltaT, -4);
sprintf(sz, "Special: Delta-T = %s", szT);
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.rObjAddition != 0.0) {
sprintf(sz, "%s: %s (%s)", us.rObjAddition != us.rCuspAddition ?
"Objs" : "Time", SzHMS((int)(us.rObjAddition*3600.0 +
rSmall*RSgn2(us.rObjAddition))*60), SzTim(Tim + us.rObjAddition));
DrawPrint(sz, gi.kiLite, fFalse);
}
if (us.rCuspAddition != 0.0 && us.rCuspAddition != us.rObjAddition) {
sprintf(sz, "Cusp: %s (%s)", SzHMS((int)(us.rCuspAddition*3600.0 +
rSmall*RSgn2(us.rCuspAddition))*60), SzTim(Tim + us.rCuspAddition));
DrawPrint(sz, gi.kiLite, fFalse);
}
if (FSzSet(gs.szSidebar))
for (pch2 = gs.szSidebar; *pch2;) {
for (pch = sz; *pch2 && *pch2 != '\n' &&
!(*pch2 == '\\' && pch2[1] == 'n'); pch++, pch2++) {
#ifdef EXPRESS
// Expand escape sequences like "\A" to that custom variable.
// Expand escape sequences like "\a" to that variable's string.
if (*pch2 == '\\') {
if (FCapCh(pch2[1])) {
pch = PchFormatExpression(pch, pch2[1] - '@') - 1;
pch2++;
continue;
} else if (FUncapCh(pch2[1])) {
pch = PchFormatString(pch, pch2[1] - '`') - 1;
pch2++;
continue;
}
}
#endif
*pch = *pch2;
if (*pch2 == '\\' && pch2[1] == '\\')
pch2++;
}
*pch = sz[26] = chNull;
DrawPrint(sz, gi.kiLite, fFalse);
if (*pch2 == '\n')
pch2++;
else if (*pch2 == '\\' && pch2[1] == 'n')
pch2 += 2;
}
}
}
}
#define szC1 "Chart #1"
#define szC2 "Chart #2"
#define szC3 "Chart #3"
#define szC4 "Chart #4"
#define szC5 "Chart #5"
#define szC6 "Chart #6"
#define DrawInfoSphere(ci, sz1, sz2) \
DrawInfo(&ci, gi.nMode != gSphere ? sz1 : sz2, fFalse)
// Print text showing the chart information and house and planet positions
// of a chart in a "sidebar" to the right of the chart in question. This is
// always done for the -v and -w graphic wheel charts unless the -v0 switch
// flag is also set, in which case none of the things here are done.
void DrawSidebar()
{
char sz[cchSzDef];
ET et;
int i, j, k, l, y, a, s, rays, nSav;
real r;
flag fSav;
// Decorate the chart a little.
if (!gs.fIndianWheel) {
if (gs.nDecaType == 1) {
// If decoration value 1, draw spider web lines in each corner.
DrawColor(gi.kiGray);
j = gs.nDecaLine + 1;
k = gs.yWin * gs.nDecaSize / 100;
l = gs.xWin * gs.nDecaSize / 100;
for (y = 0; y <= 1; y++)
for (i = 0; i <= 1; i++)
for (a = 1; a < j; a++)
DrawLine(i*(gs.xWin-1), y ? (gs.yWin-1-a*k/j) : a*k/j,
i ? gs.xWin-1-l+a*l/j : l-a*l/j, y*(gs.yWin-1));
} else if (gs.nDecaType == 2) {
// If decoration value 2, draw a moire pattern in each corner.
k = gs.yWin * gs.nDecaSize / 200;
l = gs.xWin * gs.nDecaSize / 200;
fSav = gs.fThick;
DrawThick(fFalse);
for (y = 0; y <= 1; y++)
for (i = 0; i <= 1; i++)
for (s = 0; s <= 1; s++)
for (a = 1; a < (s ? l : k)*2; a++) {
DrawColor(FOdd(a) ? gi.kiGray : gi.kiOff);
DrawLine(i ? gs.xWin-1-l : l, y ? gs.yWin-1-k : k,
s ? (i ? gs.xWin-1-a : a) : i*(gs.xWin-1),
s ? y*(gs.yWin-1) : (y ? gs.yWin-1-a : a));
}
DrawThick(fSav);
}
// Print dominant Ray(s) in upper left corner of wheel.
else if (gs.nDecaType >= 3) {
nSav = gi.nScale;
if (gs.nDecaType <= 4) {
gi.nScale = gs.yWin / 160;
if (gi.nScale > 0) {
rays = ChartEsoteric(fTrue);
sprintf(sz, "Ray %d", rays/10);
DrawColor(kRayB[rays/10]);
DrawSz(sz, 7, 7, dtLeft | dtTop | dtScale);
if (gs.nDecaType >= 4) {
sprintf(sz, ".%d", rays%10);
DrawColor(kRayB[rays%10]);
DrawSz(sz, 7+5*gi.nScale*xFont, 7, dtLeft | dtTop | dtScale);
}
}
}
#ifdef INTRPRET
else {
gi.nScale = gs.yWin / 400;
if (gi.nScale > 0) {
rays = InterpretEsoteric(fTrue);
for (i = 0; i < 5; i++) {
sprintf(sz, "%-4.4s: Ray %d", rgEsoRayArea[i], rays%10);
DrawColor(kRayB[rays%10]);
DrawSz(sz, 7, 7+(4-i)*gi.nScale*yFont, dtLeft | dtTop | dtScale);
rays /= 10;
}
}
}
#endif
gi.nScale = nSav;
}
}
if (!gs.fText || us.fVelocity) // Don't draw sidebar if -v0 flag is set.
return;
a = us.fAnsiChar;
us.fAnsiChar =
(gs.nFontTxt == 0 || (gs.ft != ftPS && gs.ft != ftWmf)) << 1;
DrawColor(gi.kiLite);
i = gs.xWin-1;
gs.xWin += xSideT;
if (gs.fBorder)
DrawLineY(i, 1, gs.yWin-2);
DrawPrint(NULL, gs.xWin-xSideT+xFontT-gi.nScaleT, yFontT*7/5);
#ifdef EXPRESS
// Notify AstroExpression the sidebar is about to be drawn.
if (!us.fExpOff && FSzSet(us.szExpSidebar))
ParseExpression(us.szExpSidebar);
#endif
// Print chart header and setting information.
sprintf(sz, "%s %s", szAppName, szVersionCore);
DrawPrint(sz, gi.kiOn, fFalse);
if (us.nRel == rcComposite) {
DrawInfo(&ciMain, szC1, fFalse);
DrawPrint("", gi.kiLite, fFalse);
DrawInfo(&ciTwin, szC2, fFalse);
} else if (us.nRel == rcSynastry && !FEqCI(ciMain, ciTwin)) {
DrawInfo(&ciMain, szC1 ": Houses", fFalse);
DrawPrint("", gi.kiLite, fFalse);
DrawInfo(&ciTwin, szC2 ": Planets", fFalse);
} else if (us.nRel == rcDual && !FEqCI(ciMain, ciTwin)) {
DrawInfoSphere(ciMain, "#1: Inner Ring + Houses", szC1 " + Houses");
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciTwin, "#2: Outer Ring + Planets", szC2);
} else if (us.nRel == rcTriWheel &&
!(FEqCI(ciMain, ciTwin) && FEqCI(ciTwin, ciThre))) {
DrawInfoSphere(ciMain, "#1: Inner Ring + Houses", szC1 " + Houses");
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciTwin, "#2: Middle Ring", szC2);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciThre, "#3: Outer Ring + Planets", szC3);
} else if (us.nRel == rcQuadWheel && !(FEqCI(ciMain, ciTwin) &&
FEqCI(ciTwin, ciThre) && FEqCI(ciThre, ciFour))) {
DrawInfoSphere(ciMain, "#1: Inner Ring + Houses", szC1 " + Houses");
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciTwin, "#2: Middle Inner Ring", szC2);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciThre, "#3: Middle Outer Ring", szC3);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciFour, "#4: Outer Ring + Planets", szC4);
} else if (us.nRel == rcQuinWheel) {
DrawInfoSphere(ciMain, "#1: Inner Ring + Houses", szC1 " + Houses");
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciTwin, "#2: Middle Inner Ring", szC2);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciThre, "#3: Middle Ring", szC3);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciFour, "#4: Middle Outer Ring", szC4);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciFive, "#5: Outer Ring + Planets", szC5);
} else if (us.nRel == rcHexaWheel) {
DrawInfoSphere(ciMain, "#1: Inner Ring + Houses", szC1 " + Houses");
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciTwin, "#2: Second Inner Ring", szC2);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciThre, "#3: Middle Inner Ring", szC3);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciFour, "#4: Middle Outer Ring", szC4);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciFive, "#5: Second Outer Ring", szC5);
DrawPrint("", gi.kiLite, fFalse);
DrawInfoSphere(ciHexa, "#6: Outer Ring + Planets", szC6);
} else if (us.nRel == rcTransit || us.nRel == rcProgress) {
DrawInfoSphere(ciMain, "#1: Inner Ring (Natal)", szC1 ": Natal");
DrawPrint("", gi.kiLite, fFalse);
if (us.nRel == rcTransit)
DrawInfoSphere(ciTwin, "#2: Outer Ring (Transit)", szC2 ": Transit");
else
DrawInfoSphere(ciTwin, "#2: Outer Ring (Progress)", szC2 ": Progress");
} else
DrawInfo(&ciMain, NULL, fTrue);
// Print house cusp positions.
if (us.nHouseSystem != hsNull) {
DrawPrint("", gi.kiLite, fFalse);
for (i = 1; i <= cSign; i++) {
sprintf(sz, "%2d%s house: ", i, szSuffix[i]);
y = DrawPrint(sz, kSignB(i), fTrue);
if (!is.fSeconds && (gs.nScale == 100 ||
gs.nFontAll == 0 || !gi.fFile || gs.ft == ftBmp) && y < gs.yWin-1) {
s = gi.nScale;
gi.nScale = gi.nScaleTextT;
DrawSign(SFromZ(chouse[i]),
gs.xWin-12*gi.nScale, y-(yFont/2-1)*gi.nScale);
gi.nScale = s;
}
DrawZodiac(chouse[i], fFalse);
}
}
// Print planet positions.
DrawPrint("", gi.kiLite, fFalse);
for (j = 0; j <= oNorm; j++) {
i = rgobjList[j];
if (!(FProper2(i) &&
(!FCusp(i) || RAbs(planetalt[i]) > rSmall ||
MinDistance(planet[i], chouse[i-cuspLo+1]) > rSmall)))
continue;
sprintf(sz, is.fSeconds ? "%-3.3s: " : "%-4.4s: ", szObjDisp[i]);
DrawPrint(sz, kObjB[i], fTrue);
y = DrawZodiac(planet[i], fTrue);
if (!is.fSeconds && i < starLo && gi.nMode != gSector &&
(gs.nScale == 100 || gs.nFontAll == 0 || !gi.fFile || gs.ft == ftBmp) &&
y < gs.yWin-1) {
// Don't draw planet glyph in PS or Metafile, since can't be resized.
s = gi.nScale;
gi.nScale = gi.nScaleTextT;
DrawObject(-i-1, gs.xWin-12*gi.nScale, y-(yFont/2-1)*gi.nScale);
gi.nScale = s;
}
sprintf(sz, "%c ", ret[i] < 0.0 ? chRet : ' ');
DrawPrint(sz, gi.kiOn, fTrue);
if (gi.nMode != gSector || !is.fSeconds) {
is.fSeconds = fFalse;
DrawPrint(SzAltitude(planetalt[i]), gi.kiLite, fTrue);
is.fSeconds = us.fSeconds;
}
if (gi.nMode == gSector) {
r = GFromO(cp1.obj[i]); s = (int)r + 1;
if (!is.fSeconds)
sprintf(sz, " %2d", s);
else
sprintf(sz, "%6.3f%c", r + 1.0, pluszone[s] ? '+' : '-');
DrawPrint(sz, pluszone[s] ? kRedB : kDkGreenB, fFalse);
} else
DrawPrint("", gi.kiOn, fFalse);
}
// Print star positions.
for (i = starLo; i <= starHi; i++) {
s = rgobjList[i];
if (!FProper(s))
continue;
sprintf(sz, is.fSeconds ? "%-3.3s: " : "%-4.4s: ", szObjDisp[s]);
DrawPrint(sz, kObjB[s], fTrue);
DrawZodiac(planet[s], fTrue);
DrawPrint(" ", gi.kiOn, fTrue);
if (gi.nMode != gSector || !is.fSeconds) {
is.fSeconds = fFalse;
DrawPrint(SzAltitude(planetalt[s]), gi.kiLite, fTrue);
is.fSeconds = us.fSeconds;
}
if (gi.nMode == gSector) {
r = GFromO(cp1.obj[s]); s = (int)r + 1;
if (!is.fSeconds)
sprintf(sz, " %2d", s);
else
sprintf(sz, "%6.3f%c", r + 1.0, pluszone[s] ? '+' : '-');
DrawPrint(sz, pluszone[s] ? kRedB : kDkGreenB, fFalse);
} else
DrawPrint("", gi.kiOn, fFalse);
}
// Print element table information.
DrawPrint("", gi.kiLite, fFalse);
CreateElemTable(&et);
sprintf(sz, "Fire: %d,", et.coElem[eFir]);
DrawPrint(sz, kElemB[eFir], fTrue);
sprintf(sz, " Earth: %d,", et.coElem[eEar]);
DrawPrint(sz, kElemB[eEar], fFalse);
sprintf(sz, "Air : %d,", et.coElem[eAir]);
DrawPrint(sz, kElemB[eAir], fTrue);
sprintf(sz, " Water: %d", et.coElem[eWat]);
DrawPrint(sz, kElemB[eWat], fFalse);
sprintf(sz, "Car: %d,", et.coMode[0]); DrawPrint(sz, kModeB(0), fTrue);
sprintf(sz, " Fix: %d,", et.coMode[1]); DrawPrint(sz, kModeB(1), fTrue);
sprintf(sz, " Mut: %d", et.coMode[2]); DrawPrint(sz, kModeB(2), fFalse);
sprintf(sz, "Yang: %d, Yin: %d", et.coYang, et.coYin);
DrawPrint(sz, gi.kiLite, fFalse);
if (et.coMC > 9 && et.coIC > 9 && et.coAsc > 9 && et.coDes > 9)
DrawPrint(NULL, -xFont2*gi.nScaleText/2, -1);
sprintf(sz, "M: %d,", et.coMC); DrawPrint(sz, kElemB[eEar], fTrue);
sprintf(sz, " N: %d,", et.coIC); DrawPrint(sz, kElemB[eWat], fTrue);
sprintf(sz, " A: %d,", et.coAsc); DrawPrint(sz, kElemB[eFir], fTrue);
sprintf(sz, " D: %d", et.coDes); DrawPrint(sz, kElemB[eAir], fFalse);
sprintf(sz, "Ang: %d,", et.coModeH[0]); DrawPrint(sz, kModeB(0), fTrue);
sprintf(sz, " Suc: %d,", et.coModeH[1]); DrawPrint(sz, kModeB(1), fTrue);
sprintf(sz, " Cad: %d", et.coModeH[2]); DrawPrint(sz, kModeB(2), fFalse);
sprintf(sz, "Learn: %d, Share: %d", et.coLearn, et.coShare);
DrawPrint(sz, gi.kiLite, fFalse);
us.fAnsiChar = a;
}
// Fill in the specified sector of a wheel chart at the given coordinates. The
// sector type may be sign, house, or Gauquelin sector.
flag DrawFillWheel(int x, int y, int i, int typ)
{
KV kvC, kvF;
int nTrans;
real rDeg;
if (gs.nDecaFill <= 0)
return fFalse;
// Figure out what RGB colors to use to fill.
if (!gi.fFile || gi.fBmp) {
nTrans = (int)(gs.rBackPct * 256.0 / 100.0);
if (nTrans <= 0)
return fFalse;
if (gs.nDecaFill == 1)
kvC = rgbbmp[gi.kiCur];
else {
rDeg = (real)(i-1) * rDegMax / (real)(typ < 2 ? cSign : cSector);
kvC = gs.nDecaFill == 2 ? KvHue(rDeg) : KvHue2(rDeg);
}
kvF = KvBlend(rgbbmp[gi.kiOff], kvC, gs.rBackPct / 100.0);
#ifdef EXPRESS
// Modify RGB color through AstroExpression if one defined.
if (!us.fExpOff && FSzSet(us.szExpColFill)) {
ExpSetN(iLetterX, typ);
ExpSetN(iLetterY, i);
ExpSetN(iLetterZ, kvF);
ParseExpression(us.szExpColFill);
kvF = NExpGet(iLetterZ);
}
#endif
} else
kvF = -1;
// Actually go fill in the area.
DrawFill(x, y, kvF);
// Return whether glyphs drawn on filled area should be background color.
return (RgbR(kvF) + RgbG(kvF)*151/100 + RgbB(kvF) >= 128*3) != gs.fInverse;
}
CONST int objNakshatra[9+1] = {0,
oSou, oVen, oSun, oMoo, oMar, oNod, oJup, oSat, oMer};
// This is a subprocedure of XChartWheel() and XChartWheelRelation(). Draw
// the outer sign and house rings for a wheel chart at the specified zodiac
// locations and at the given radius values.
void DrawWheel(real *xsign, real *xhouse, int cx, int cy, real unitx,
real unity, real rh1, real rh2, real rs1)
{
int nTrans = (int)(gs.rBackPct * 256.0 / 100.0), *rgRules, i, j, k, kSav,
x, y, nSav;
CONST int *rgTerm;
real rh, rs, rs2 = 0.95, r9 = 0.99, ra, rb, px, py, rDeg, hOld, h;
flag fVector = (gs.ft == ftPS || gs.ft == ftWmf), fSimpleDecan, fOff, fSav;
rh = (rh1 + rh2) / 2.0; rs = (rs1 + rs2) / 2.0;
fSimpleDecan = us.fListDecan && us.nDecanType <= ddChaldea &&
!(!us.fExpOff && FSzSet(us.szExpDecan));
// Draw small five or one degree increments around the zodiac sign ring.
fSav = us.fHouse3D; us.fHouse3D = fFalse;
for (i = 0; i < nDegMax; i++) {
rDeg = PZ(HousePlaceInX((real)i, 0.0));
px = PX(rDeg); py = PY(rDeg);
DrawColor(i%10 > 0 ? gi.kiGray :
(gs.fColorSign ? kSignB(i/30 + 1) : gi.kiOn));
k = (!gs.fColor && !fVector && i%5 > 0);
if (i%5 > 0) {
ra = rh2 + (rs1 - rh2) * 0.30;
rb = rh2 + (rs1 - rh2) * 0.70;
} else {
ra = rh2; rb = rs1;
if (fSimpleDecan && i%10 == 0 && i%30 != 0)
rb += (rs2 - rs1) * 0.30;
}
DrawDash(cx+POINT1(unitx, ra, px), cy+POINT1(unity, ra, py),
cx+POINT2(unitx, rb, px), cy+POINT2(unity, rb, py), k);
}
us.fHouse3D = fSav;
// Draw circles for the zodiac sign rings.
DrawColor(gi.kiOn);
DrawCircle(cx, cy, (int)(unitx*rs2+rRound), (int)(unity*rs2+rRound));
DrawCircle(cx, cy, (int)(unitx*rs1+rRound), (int)(unity*rs1+rRound));
// Draw the glyphs for the signs themselves.
for (i = 1; i <= cSign; i++) {
rDeg = xsign[i];
// Draw lines separating each sign from each other.
DrawColor(gs.fColorSign ? kSignB(i) : gi.kiOn);
px = PX(rDeg); py = PY(rDeg);
DrawLine(cx+POINT2(unitx, rs2, px), cy+POINT2(unity, rs2, py),
cx+POINT1(unitx, rs1, px), cy+POINT1(unity, rs1, py));
}
if (us.fListDecan) {
rs = rs1 + (rs2 - rs1) * 0.67;
if (us.nDecanType == ddDecanR) {
if (ignore7[rrStd] && ignore7[rrEso] && !ignore7[rrHie])
rgRules = rgSignHie1;
else if (ignore7[rrStd] && !ignore7[rrEso])
rgRules = rgSignEso1;
else
rgRules = rules;
} else if (FBetween(us.nDecanType, ddEgypt, ddPtolemy))
rgTerm = (us.nDecanType == ddEgypt ? rgnTermEgypt : rgnTermPtolemy);
}
for (i = 1; i <= cSign; i++) {
rDeg = Midpoint(xsign[i], xsign[Mod12(i+1)]);
DrawColor(kSignB(i));
x = cx+POINT0(unitx, rs, PX(rDeg));
y = cy+POINT0(unity, rs, PY(rDeg));
fOff = DrawFillWheel(x, y, i, 0);
if (nTrans >= 128)
DrawColor(fOff ? gi.kiOff : gi.kiOn);
DrawSign(i, x, y);
// Draw decan rulers or other sign subdivisions if specified.
if (us.fListDecan) {
hOld = 0.0;
for (j = 0; hOld < 30.0; j++, hOld += h) {
h = 10.0;
k = -13;
if (us.nDecanType <= ddDecanR)
k = rgRules[SFromZ(Decan(ZFromS(i) + hOld))];
else if (us.nDecanType == ddDecanS)
k = -SFromZ(Decan(ZFromS(i) + hOld));
else if (us.nDecanType == ddChaldea) {
k = ((i-1)*3 + j) % 7;
k = (0x5143276 >> (6-k)*4) & 15;
} else if (FBetween(us.nDecanType, ddEgypt, ddPtolemy)) {
if (j < 5) {
h = (real)((rgTerm[i*2-2] >> (4-j)*4) & 15);
k = (rgTerm[i*2-1] >> (4-j)*4) & 15;
}
} else if (us.nDecanType == ddNavamsa) {
h = 30.0 / 9.0 + rSmall;
k = -SFromZ(Navamsa(ZFromS(i) + hOld));
} else if (us.nDecanType == dd27) {
rDeg = rDegMax / 27.0;
h = rDeg - (j > 0 ? 0.0 : rDeg*RFract(ZFromS(i) / rDeg));
if (hOld + h > 30.0)
h = 30.0 - hOld;
k = ((int)((ZFromS(i) + hOld + 1.0) / rDeg) + 1);
k = -100 - k;
} else {
h = 30.0 / 12.0;
k = -(us.nDecanType == dd12 ? j + 1 : Mod12(j + i));
}
rDeg = ZFromS(i) + hOld + h/2.0;
#ifdef EXPRESS
// Notify AstroExpression a decan symbol is about to be drawn.
if (!us.fExpOff && FSzSet(us.szExpDecan)) {
ExpSetR(iLetterW, h);
ExpSetN(iLetterX, i);
ExpSetN(iLetterY, j);
ExpSetN(iLetterZ, k);
ParseExpression(us.szExpDecan);
h = RExpGet(iLetterW);
k = NExpGet(iLetterZ);
if (h <= 0.0)
h = 10.0;
else if (hOld + h > 30.0)
h = 30.0 - hOld;
rDeg = ZFromS(i) + hOld + h/2.0;
}
#endif
rDeg = PZ(HousePlaceInX(rDeg, 0.0));
ra = rs1 + (rs2 - rs1) * 0.20;
nSav = gi.nScale;
gi.nScale = (gi.nScale + 1) >> 1;
x = cx+POINT0(unitx, ra, PX(rDeg));
y = cy+POINT0(unity, ra, PY(rDeg));
if (nTrans >= 128)
DrawColor(fOff ? gi.kiOff : gi.kiOn);
if (FItem(k)) {
if (!(nTrans >= 128))
DrawColor(kObjB[k]);
kSav = kObjB[k]; kObjB[k] = gi.kiCur;
DrawObject(k, x, y);
kObjB[k] = kSav;
} else if (FValidSign(-k)) {
if (!(nTrans >= 128))
DrawColor(kSignB(-k));
DrawSign(-k, x, y);
} else if (k <= -100) {
k = -k-100;
if (!(nTrans >= 128))
DrawColor(kObjA[objNakshatra[(k-1) % 9 + 1]]);
DrawNakshatra(k, x, y);
}
gi.nScale = nSav;
if (!fSimpleDecan && hOld > 0.0) {
// Draw hatch mark for this section if haven't already done so.
rDeg = ZFromS(i) + hOld;
rDeg = PZ(HousePlaceInX(rDeg, 0.0));
px = PX(rDeg); py = PY(rDeg);
DrawColor(gs.fColorSign ? kSignB(i/30 + 1) : gi.kiOn);
ra = rs1; rb = rs1 + (rs2 - rs1) * 0.30;
DrawLine(cx+POINT1(unitx, ra, px), cy+POINT1(unity, ra, py),
cx+POINT2(unitx, rb, px), cy+POINT2(unity, rb, py));
}
}
}
}
// Draw Ascendant/Descendant and Midheaven/Nadir lines across whole chart.
DrawColor(gs.fColorHouse ? kSignB(sAri) : gi.kiLite);
DrawDash(cx+POINT1(unitx, r9, PX(xhouse[sAri])),
cy+POINT1(unity, r9, PY(xhouse[sAri])), cx, cy, !gs.fColor);
if (gs.fColorHouse) DrawColor(kSignB(sLib));
DrawDash(cx+POINT1(unitx, r9, PX(xhouse[sLib])),
cy+POINT1(unity, r9, PY(xhouse[sLib])), cx, cy, !gs.fColor);
if (gs.fColorHouse) DrawColor(kSignB(sCap));
DrawDash(cx+POINT1(unitx, r9, PX(xhouse[sCap])),
cy+POINT1(unity, r9, PY(xhouse[sCap])), cx, cy, !gs.fColor);
if (gs.fColorHouse) DrawColor(kSignB(sCan));
DrawDash(cx+POINT1(unitx, r9, PX(xhouse[sCan])),
cy+POINT1(unity, r9, PY(xhouse[sCan])), cx, cy, !gs.fColor);
// Draw circles for the house rings.
DrawColor(gi.kiOn);
DrawCircle(cx, cy, (int)(unitx*rh2+rRound), (int)(unity*rh2+rRound));
DrawCircle(cx, cy, (int)(unitx*rh1+rRound), (int)(unity*rh1+rRound));
if (nTrans > 0) {
// Draw sign rings again to cover up angle lines drawn over them above.
DrawCircle(cx, cy, (int)(unitx*rs2+rRound), (int)(unity*rs2+rRound));
DrawCircle(cx, cy, (int)(unitx*rs1+rRound), (int)(unity*rs1+rRound));
}
// Draw hatches within houses, if -YRd switch set.
k = us.nSignDiv;
if (k > 0) {
ra = rh1 + (rh - rh1) * 0.25;
rb = rh1 - (rh - rh1) * 0.25;
for (i = 1; i <= cSign; i++)
for (j = 0; j < k; j++) {
rDeg = xhouse[i] +
MinDifference(xhouse[i], xhouse[Mod12(i+1)]) * (real)j / (real)k;
px = PX(rDeg); py = PY(rDeg);
DrawColor(gs.fColorHouse ? kSignB(i) : gi.kiOn);
DrawLine(cx+POINT2(unitx, j ? ra : rh1, px),
cy+POINT2(unity, j ? ra : rh1, py),
cx+POINT1(unitx, rb, px),
cy+POINT1(unity, rb, py));
}
}
// Draw the glyphs for the houses themselves.
for (i = 1; i <= cSign; i++) {
DrawColor(gs.fColorHouse ? kSignB(i) : gi.kiOn);
px = PX(xhouse[i]); py = PY(xhouse[i]);
DrawLine(cx+POINT2(unitx, rh2, px), cy+POINT2(unity, rh2, py),
cx+POINT1(unitx, rh1, px), cy+POINT1(unity, rh1, py));
// Draw minor lines from non-angular houses to center of wheel.
if (i%3 != 1) {
DrawColor(gs.fColorHouse ? kSignB(i) : gi.kiGray);
DrawDash(cx, cy, cx+POINT2(unitx, rh1, px),
cy+POINT2(unity, rh1, py), 1 + !gs.fColor*3);
}
}
for (i = 1; i <= cSign; i++) {
rDeg = Midpoint(xhouse[i], xhouse[Mod12(i+1)]);
DrawColor(kSignB(i));
x = cx+POINT0(unitx, rh, PX(rDeg));
y = cy+POINT0(unity, rh, PY(rDeg));
fOff = DrawFillWheel(x, y, i, 1);
if (nTrans >= 128)
DrawColor(fOff ? gi.kiOff : gi.kiOn);
DrawHouse(i, x, y);
}
}
// Another subprocedure of XChartWheel() and XChartWheelRelation(). Draw a set
// of planets in a wheel chart, drawing each glyph and a line from it to a dot
// indicating the planet's actual location.
void DrawSymbolRing(real *symbol, real *xplanet, real *dir, int cx, int cy,
real unitx, real unity, real rp, real rl1, real rl2, real rg)
{
char sz[cchSzDef], rgch[oNorm1], rgf[oPlu-oMar+1][cLetter], chT;
int col[oNorm1], i0, i, j, x, y;
real symbolM[oNorm1], temp, rx, ry, rT;
for (i = is.nObj; i >= 0; i--) if (FProper(i)) {
if (gs.fLabel) {
temp = symbol[i];
DrawColor(dir[i] < 0.0 ? gi.kiGray : gi.kiOn);
DrawDash(cx+POINT1(unitx, rl1, PX(xplanet[i])),
cy+POINT1(unity, rl1, PY(xplanet[i])),
cx+POINT1(unitx, rl2, PX(temp)),
cy+POINT1(unity, rl2, PY(temp)),
(dir[i] < 0.0 ? 1 : 0) - gs.fColor);
DrawObject(i, cx+POINT1(unitx, rg, PX(temp)),
cy+POINT1(unity, rg, PY(temp)));
} else
DrawColor(kObjB[i]);
if (!gs.fHouseExtra && us.nRel >= rcNone)
DrawSpot(cx+POINT1(unitx, rp, PX(xplanet[i])),
cy+POINT1(unity, rp, PY(xplanet[i])));
else
DrawPoint(cx+POINT1(unitx, rp, PX(xplanet[i])),
cy+POINT1(unity, rp, PY(xplanet[i])));
}
// Wheels within wheels: Display planetary moons in orbit around their
// planet glyphs, when the -X8 setting is active.
if (!gs.fMoonWheel)
return;
ClearB((pbyte)rgf, sizeof(rgf));
for (i = 0; i <= custHi; i++) {
if (ignore[i])
continue;
j = ObjOrbit(i);
if (ignore[j] || !FHasMoon(j) || j == us.objCenter || j == i)
continue;
if (!us.fMoonMove) {
rx = space[i].x - space[j].x; ry = space[i].y - space[j].y;
temp = Mod(planet[j] - RAngleD(rx, ry));
} else
temp = Mod(planet[j] - planet[i]);
rT = (MinDistance(rDegHalf, temp) / rDegQuad - 1.0)*100.0;
col[i] = (rT <= -75.0 ? kObjB[oMC] : (rT >= 75.0 ? kObjB[oNad] :
(FBetween(temp, rDegQuad - 22.5, rDegQuad + 22.5) ? kObjB[oDes] :
(FBetween(temp, 270 - 22.5, 270 + 22.5) ? kObjB[oAsc] : gi.kiGray))));
temp += symbol[j];
symbolM[i] = temp;
// Only the first moon around a planet starting with 'X' gets capitalized.
chT = szObjDisp[i][0];
if (FBetween(j, oMar, oPlu) && FBetween(chT, 'A', 'Z')) {
if (rgf[j - oMar][chT - 'A'])
chT += ('a' - 'A');
else
rgf[j - oMar][chT - 'A'] = fTrue;
}
rgch[i] = chT;
}
for (i0 = 0; i0 < cHasMoons; i0++) {
i = rgobjHasMoons[i0];
if (ignore[i])
continue;
if (FCust(i)) {
j = ObjOrbit(i);
if (FHasMoon(j))
continue;
}
FillSymbolRingM(i, symbolM,
(6.0 - (real)(gs.nScale / 100)) * (real)gi.nScaleTextT2 / 2.0);
}
for (i = custHi; i >= 0; i--) {
if (ignore[i])
continue;
j = ObjOrbit(i);
if (ignore[j] || !FHasMoon(j) || j == us.objCenter || j == i)
continue;
temp = symbol[j];
x = cx+POINT1(unitx, rg, PX(temp)); y = cy+POINT1(unity, rg, PY(temp));
sprintf(sz, "%c", rgch[i]);
DrawColor(col[i]);
temp = symbolM[i];
x += (int)((real)(6*gi.nScale+5*gi.nScaleT)*PX(temp));
y += (int)((real)(6*gi.nScale+5*gi.nScaleT)*PY(temp));
DrawSz(sz, x, y + gi.nScaleT*2, dtScale2);
}
}
// Another subprocedure of XChartWheel() and XChartWheelRelation(). Draw one
// planet ring of a wheel chart at the specified locations and radius values.
void DrawRing(int iRing, int iRingMax,
real xplanet[objMax], real symbol[objMax], int cx, int cy, real base,
real ri1, real ri2, real rp, real rl1, real rl2, real rg, real rGlyph)
{
CP *pcp = rgpcp[iRingMax > 1 ? iRing : 0];
real unitx = (real)cx, unity = (real)cy;
int i;
FProcessCommandLine(szWheelX[iRing]);
if (gs.fMoonWheel)
rl2 -= 0.01;
// Draw the planet glyphs and lines to where the planets actually are.
for (i = 0; i <= is.nObj; i++)
symbol[i] = xplanet[i];
FillSymbolRing(symbol, rGlyph);
DrawSymbolRing(symbol, xplanet, pcp->dir, cx, cy, unitx, unity,
rp, rl1, rl2, rg);
for (i = 0; i <= is.nObj; i++)
if (!FProper(i))
xplanet[i] = -1.0;
if (ri1 >= ri2)
return;
// Draw dotted lines from this ring to the innermost ring of a multiwheel.
for (i = is.nObj; i >= 0; i--) if (FProper(i)) {
DrawColor(kObjB[i]);
DrawPoint(cx+POINT1(unitx, base, PX(xplanet[i])),
cy+POINT1(unity, base, PY(xplanet[i])));
if (!gs.fHouseExtra) {
DrawColor(pcp->dir[i] < 0.0 ? gi.kiGray : gi.kiOn);
DrawDash(cx+POINT1(unitx, ri1, PX(xplanet[i])),
cy+POINT1(unity, ri1, PY(xplanet[i])),
cx+POINT2(unitx, ri2, PX(xplanet[i])),
cy+POINT2(unity, ri2, PY(xplanet[i])),
1 + Min(iRingMax-iRing, 3) - gs.fColor);
}
}
}
// Another drawing routine similar to above, plot a set of planets within a 2D
// expanse of pixels, so that there's a minimum of overlapping glyphs.
void DrawObjects(ObjDraw *rgod, int cod, int zEdge)
{
int zGlyph, zGlyph2, zGlyphS, zGlyphS2, i, j, k, k2, obj;
KI kSav;
// Define or adjust some initial values.
zGlyph = 7*gi.nScale; zGlyphS = 9*gi.nScaleTextT;
zGlyph2 = zGlyph << 1; zGlyphS2 = zGlyphS << 1;
// Assume glyph is positioned below actual point, unless say otherwise.
for (i = 0; i < cod; i++) if (rgod[i].f) {
if (zEdge > 0 && !FInRect(rgod[i].x, rgod[i].y,
zEdge, zEdge, gs.xWin-zEdge, gs.yWin-zEdge)) {
rgod[i].f = fFalse;
continue;
}
obj = rgod[i].obj;
rgod[i].yg = rgod[i].y + (obj < moonsLo ? zGlyph : zGlyphS);
}
// Determine where to draw the glyphs in relation to the actual points,
// so that the glyphs aren't drawn on top of each other if possible.
for (i = 0; i < cod; i++) if (rgod[i].f) {
obj = rgod[i].obj;
k = k2 = gs.xWin + gs.yWin;