-
Notifications
You must be signed in to change notification settings - Fork 6
/
Medium.java
1975 lines (1907 loc) · 68.1 KB
/
Medium.java
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
import java.awt.*;
import java.util.Random;
/**
* Medium manages most of the graphics you see during games, such as clouds, ground, and dust.
* This class was edited and re-edited again by Chaotic for (mostly) full NFMM Graphics (excluding sparks and extra dust).
*
* @author Kaffeinated, Chaotic, Omar Wally
*/
public class Medium {
private static int nmt = 0;
private static int[] mrd = null;
private static int[] nmv = null;
private static int[][] mtx = null;
private static int[][] mty = null;
private static int[][] mtz = null;
private static int[][][] mtc = null;
public static int mgen = (int) (Math.random() * 100000D);
public static int focus_point = 400;
public static int ground = 250;
private static int skyline = -300;
public static final int[] fade = {
3000, 4500, 6000, 7500, 9000, 10500, 12000, 13500, 15000, 16500, 18000, 19500, 21000, 22500, 24000, 25500
};
private static final int[] cldd = {
210, 210, 210, 1, -1000
};
private static final int[] clds = {
210, 210, 210
};
private static final int[] osky = {
170, 220, 255
};
public static final int[] csky = {
170, 220, 255
};
private static final int[] ogrnd = {
205, 200, 200
};
public static final int[] cgrnd = {
205, 200, 200
};
private static final int[] texture = {
0, 0, 0, 50
};
private static final int[] cpol = {
215, 210, 210
};
private static final int[] crgrnd = {
205, 200, 200
};
public static final int[] cfade = {
255, 220, 220
};
public static int[] snap = {
0, 0, 0
};
public static int origfade = 3000;
public static int fogd = 7;
public static boolean lightson = false;
private static int noelec = 0;
public static int lightn = -1;
public static boolean lton = false;
private static int lilo = 217;
public static int flex = 0;
public static boolean trk = false;
public static boolean crs = false;
public static int cx = 335;
public static int cy = 200;
public static int cz = 50;
public static int xz = 0;
public static int zy = 0;
public static int x = 0;
public static int y = 0;
public static int z = 0;
public static int w = 670;
public static int h = 400;
public static int nsp = 0;
public static int spx[] = new int[7];
public static int spz[] = new int[7];
public static int sprad[] = new int[7];
private static boolean td = false;
private static int bcxz = 0;
public static int vxz = 180;
public static int adv = 500;
public static boolean vert = false;
private static int trns = 1;
private static int ogpx[][] = new int[9500][8];
private static int ogpz[][] = new int[9500][8];
private static int cgpx[] = new int[9500];
private static int cgpz[] = new int[9500];
private static int sgpx = 0;
private static int sgpz = 0;
private static int nrw = 0;
private static int ncl = 0;
public static int lastmaf = 0;
public static int checkpoint = -1;
public static boolean lastcheck = false;
public static float elecr = 0.0F;
public static boolean cpflik = false;
public static boolean nochekflk = false;
private static int cntrn = 0;
private static boolean diup[] = new boolean[3];
private static int rand[] = new int[3];
private static int trn = 0;
public static int hit = 45000;
public static int ptr = 0;
public static int ptcnt = -10;
public static int nrnd = 0;
public static long trx = 0L;
public static long trz = 0L;
private static long atrx = 0L;
private static long atrz = 0L;
public static int fallen = 0;
private static float fo = 1.0F;
private static float gofo = (float) (0.33000001311302185D + Math.random() * 1.3400000000000001D);
private static float[][] pvr;
private static int[] pmx;
private static float[] pcv;
private static int resdown;
private static int noc;
private static int[] clx;
private static int[] clz;
private static int[] cmx;
private static int[][][] clax;
private static int[][][] clay;
private static int[][][] claz;
private static int[][][][] clc;
private static int iw;
private static int nst;
private static int[] stx;
private static int[] stz;
private static int[][][] stc;
private static boolean[] bst;
private static int[] twn;
private static int ih;
private static int fvect;
public static float random() {
if (cntrn == 0) {
int i = 0;
do {
rand[i] = (int) (10D * Math.random());
diup[i] = Math.random() <= Math.random();
} while (++i < 3);
cntrn = 20;
} else {
cntrn--;
}
int j = 0;
do {
if (diup[j]) {
rand[j]++;
if (rand[j] == 10) {
rand[j] = 0;
}
} else {
rand[j]--;
if (rand[j] == -1) {
rand[j] = 9;
}
}
} while (++j < 3);
trn++;
if (trn == 3) {
trn = 0;
}
return rand[trn] / 10F;
}
public static void newpolys(int i, int j, int k, int l, Trackers trackers, int i1) {
Random random1 = new Random((i1 + cgrnd[0] + cgrnd[1] + cgrnd[2]) * 1671);
nrw = j / 1200 + 9;
ncl = l / 1200 + 9;
sgpx = i - 4800;
sgpz = k - 4800;
ogpx = null;
ogpz = null;
pvr = null;
cgpx = null;
cgpz = null;
pmx = null;
pcv = null;
ogpx = new int[nrw * ncl][8];
ogpz = new int[nrw * ncl][8];
pvr = new float[nrw * ncl][8];
cgpx = new int[nrw * ncl];
cgpz = new int[nrw * ncl];
pmx = new int[nrw * ncl];
pcv = new float[nrw * ncl];
int j1 = 0;
int k1 = 0;
for (int l1 = 0; l1 < nrw * ncl; l1++) {
cgpx[l1] = sgpx + j1 * 1200 + (int) (random1.nextDouble() * 1000D - 500D);
cgpz[l1] = sgpz + k1 * 1200 + (int) (random1.nextDouble() * 1000D - 500D);
for (int j2 = 0; j2 < trackers.nt; j2++) {
if (trackers.zy[j2] != 0 || trackers.xy[j2] != 0) {
continue;
}
if (trackers.radx[j2] < trackers.radz[j2] && Math.abs(cgpz[l1] - trackers.z[j2]) < trackers.radz[j2]) {
for (; Math.abs(cgpx[l1] - trackers.x[j2]) < trackers.radx[j2]; cgpx[l1] += random1.nextDouble()
* trackers.radx[j2] * 2D - trackers.radx[j2]) {
}
}
if (trackers.radz[j2] >= trackers.radx[j2]
|| Math.abs(cgpx[l1] - trackers.x[j2]) >= trackers.radx[j2]) {
continue;
}
for (; Math.abs(cgpz[l1] - trackers.z[j2]) < trackers.radz[j2]; cgpz[l1] += random1.nextDouble()
* trackers.radz[j2] * 2D - trackers.radz[j2]) {
}
}
if (++j1 == nrw) {
j1 = 0;
k1++;
}
}
for (int i2 = 0; i2 < nrw * ncl; i2++) {
float f = (float) (0.29999999999999999D + 1.6000000000000001D * random1.nextDouble());
ogpx[i2][0] = 0;
ogpz[i2][0] = (int) ((100D + random1.nextDouble() * 760D) * f);
ogpx[i2][1] = (int) ((100D + random1.nextDouble() * 760D) * 0.70709999999999995D * f);
ogpz[i2][1] = ogpx[i2][1];
ogpx[i2][2] = (int) ((100D + random1.nextDouble() * 760D) * f);
ogpz[i2][2] = 0;
ogpx[i2][3] = (int) ((100D + random1.nextDouble() * 760D) * 0.70709999999999995D * f);
ogpz[i2][3] = -ogpx[i2][3];
ogpx[i2][4] = 0;
ogpz[i2][4] = -(int) ((100D + random1.nextDouble() * 760D) * f);
ogpx[i2][5] = -(int) ((100D + random1.nextDouble() * 760D) * 0.70709999999999995D * f);
ogpz[i2][5] = ogpx[i2][5];
ogpx[i2][6] = -(int) ((100D + random1.nextDouble() * 760D) * f);
ogpz[i2][6] = 0;
ogpx[i2][7] = -(int) ((100D + random1.nextDouble() * 760D) * 0.70709999999999995D * f);
ogpz[i2][7] = -ogpx[i2][7];
for (int k2 = 0; k2 < 8; k2++) {
int l2 = k2 - 1;
if (l2 == -1) {
l2 = 7;
}
int i3 = k2 + 1;
if (i3 == 8) {
i3 = 0;
}
ogpx[i2][k2] = ((ogpx[i2][l2] + ogpx[i2][i3]) / 2 + ogpx[i2][k2]) / 2;
ogpz[i2][k2] = ((ogpz[i2][l2] + ogpz[i2][i3]) / 2 + ogpz[i2][k2]) / 2;
pvr[i2][k2] = (float) (1.1000000000000001D + random1.nextDouble() * 0.80000000000000004D);
int j3 = (int) Math.sqrt((int) (ogpx[i2][k2] * ogpx[i2][k2] * pvr[i2][k2] * pvr[i2][k2]
+ ogpz[i2][k2] * ogpz[i2][k2] * pvr[i2][k2] * pvr[i2][k2]));
if (j3 > pmx[i2]) {
pmx[i2] = j3;
}
}
pcv[i2] = (float) (0.96999999999999997D + random1.nextDouble() * 0.029999999999999999D);
if (pcv[i2] > 1.0F) {
pcv[i2] = 1.0F;
}
if (random1.nextDouble() > random1.nextDouble()) {
pcv[i2] = 1.0F;
}
}
}
private static void groundpolys(Graphics2D graphics2d) {
int i = (x - sgpx) / 1200 - 12;
if (i < 0) {
i = 0;
}
int j = i + 25;
if (j > nrw) {
j = nrw;
}
if (j < i) {
j = i;
}
int k = (z - sgpz) / 1200 - 12;
if (k < 0) {
k = 0;
}
int l = k + 25;
if (l > ncl) {
l = ncl;
}
if (l < k) {
l = k;
}
int ai[][] = new int[j - i][l - k];
for (int i1 = i; i1 < j; i1++) {
for (int k1 = k; k1 < l; k1++) {
ai[i1 - i][k1 - k] = 0;
int i2 = i1 + k1 * nrw;
if (resdown >= 2 && i2 % 2 != 0) {
continue;
}
int k2 = cx + (int) ((cgpx[i2] - x - cx) * RadicalMath.cos(xz) - (cgpz[i2] - z - cz) * RadicalMath.sin(xz));
int l2 = cz + (int) ((cgpx[i2] - x - cx) * RadicalMath.sin(xz) + (cgpz[i2] - z - cz) * RadicalMath.cos(xz));
int i3 = cz + (int) ((250 - y - cy) * RadicalMath.sin(zy) + (l2 - cz) * RadicalMath.cos(zy));
if (Utility.xs(k2 + pmx[i2], i3) <= 0 || Utility.xs(k2 - pmx[i2], i3) >= w || i3 <= -pmx[i2] || i3 >= fade[2]) {
continue;
}
ai[i1 - i][k1 - k] = i3;
int ai4[] = new int[8];
int ai6[] = new int[8];
int ai8[] = new int[8];
for (int l3 = 0; l3 < 8; l3++) {
ai4[l3] = (int) ((ogpx[i2][l3] * pvr[i2][l3] + cgpx[i2]) - x);
ai6[l3] = (int) ((ogpz[i2][l3] * pvr[i2][l3] + cgpz[i2]) - z);
ai8[l3] = ground;
}
Utility.rot(ai4, ai6, cx, cz, xz, 8);
Utility.rot(ai8, ai6, cy, cz, zy, 8);
int ai9[] = new int[8];
int ai10[] = new int[8];
int k4 = 0;
int i5 = 0;
int j5 = 0;
int i6 = 0;
boolean flag1 = true;
for (int l6 = 0; l6 < 8; l6++) {
ai9[l6] = Utility.xs(ai4[l6], ai6[l6]);
ai10[l6] = Utility.ys(ai8[l6], ai6[l6], 1);
if (ai10[l6] < 0 || ai6[l6] < 10) {
k4++;
}
if (ai10[l6] > h || ai6[l6] < 10) {
i5++;
}
if (ai9[l6] < 0 || ai6[l6] < 10) {
j5++;
}
if (ai9[l6] > w || ai6[l6] < 10) {
i6++;
}
}
if (j5 == 8 || k4 == 8 || i5 == 8 || i6 == 8) {
flag1 = false;
}
if (!flag1) {
continue;
}
int i7 = (int) ((cpol[0] * pcv[i2] + cgrnd[0]) / 2.0F);
int j7 = (int) ((cpol[1] * pcv[i2] + cgrnd[1]) / 2.0F);
int k7 = (int) ((cpol[2] * pcv[i2] + cgrnd[2]) / 2.0F);
if (i3 - pmx[i2] > fade[0]) {
i7 = (i7 * 7 + cfade[0]) / 8;
j7 = (j7 * 7 + cfade[1]) / 8;
k7 = (k7 * 7 + cfade[2]) / 8;
}
if (i3 - pmx[i2] > fade[1]) {
i7 = (i7 * 7 + cfade[0]) / 8;
j7 = (j7 * 7 + cfade[1]) / 8;
k7 = (k7 * 7 + cfade[2]) / 8;
}
graphics2d.setColor(new Color(i7, j7, k7));
graphics2d.fillPolygon(ai9, ai10, 8);
}
}
for (int j1 = i; j1 < j; j1++) {
for (int l1 = k; l1 < l; l1++) {
if (ai[j1 - i][l1 - k] == 0) {
continue;
}
int j2 = j1 + l1 * nrw;
int ai1[] = new int[8];
int ai2[] = new int[8];
int ai3[] = new int[8];
for (int j3 = 0; j3 < 8; j3++) {
ai1[j3] = (ogpx[j2][j3] + cgpx[j2]) - x;
ai2[j3] = (ogpz[j2][j3] + cgpz[j2]) - z;
ai3[j3] = ground;
}
Utility.rot(ai1, ai2, cx, cz, xz, 8);
Utility.rot(ai3, ai2, cy, cz, zy, 8);
int ai5[] = new int[8];
int ai7[] = new int[8];
int k3 = 0;
int i4 = 0;
int j4 = 0;
int l4 = 0;
boolean flag = true;
for (int k5 = 0; k5 < 8; k5++) {
ai5[k5] = Utility.xs(ai1[k5], ai2[k5]);
ai7[k5] = Utility.ys(ai3[k5], ai2[k5], 1);
if (ai7[k5] < 0 || ai2[k5] < 10) {
k3++;
}
if (ai7[k5] > h || ai2[k5] < 10) {
i4++;
}
if (ai5[k5] < 0 || ai2[k5] < 10) {
j4++;
}
if (ai5[k5] > w || ai2[k5] < 10) {
l4++;
}
}
if (j4 == 8 || k3 == 8 || i4 == 8 || l4 == 8) {
flag = false;
}
if (!flag) {
continue;
}
int l5 = (int) (cpol[0] * pcv[j2]);
int j6 = (int) (cpol[1] * pcv[j2]);
int k6 = (int) (cpol[2] * pcv[j2]);
if (ai[j1 - i][l1 - k] - pmx[j2] > fade[0]) {
l5 = (l5 * 7 + cfade[0]) / 8;
j6 = (j6 * 7 + cfade[1]) / 8;
k6 = (k6 * 7 + cfade[2]) / 8;
}
if (ai[j1 - i][l1 - k] - pmx[j2] > fade[1]) {
l5 = (l5 * 7 + cfade[0]) / 8;
j6 = (j6 * 7 + cfade[1]) / 8;
k6 = (k6 * 7 + cfade[2]) / 8;
}
graphics2d.setColor(new Color(l5, j6, k6));
graphics2d.fillPolygon(ai5, ai7, 8);
}
}
}
public static void newclouds(int i, int j, int k, int l) {
clx = null;
clz = null;
cmx = null;
clax = null;
clay = null;
claz = null;
clc = null;
i = i / 20 - 10000;
j = j / 20 + 10000;
k = k / 20 - 10000;
l = l / 20 + 10000;
noc = ((j - i) * (l - k)) / 0xfe502b;
clx = new int[noc];
clz = new int[noc];
cmx = new int[noc];
clax = new int[noc][3][12];
clay = new int[noc][3][12];
claz = new int[noc][3][12];
clc = new int[noc][2][6][3];
for (int i1 = 0; i1 < noc; i1++) {
clx[i1] = (int) (i + (j - i) * Math.random());
clz[i1] = (int) (k + (l - k) * Math.random());
float f = (float) (0.25D + Math.random() * 1.25D);
float f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][0] = (int) (f1 * 0.3826D);
claz[i1][0][0] = (int) (f1 * 0.92379999999999995D);
clay[i1][0][0] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][1] = (int) (f1 * 0.70709999999999995D);
claz[i1][0][1] = (int) (f1 * 0.70709999999999995D);
clay[i1][0][1] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][2] = (int) (f1 * 0.92379999999999995D);
claz[i1][0][2] = (int) (f1 * 0.3826D);
clay[i1][0][2] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][3] = (int) (f1 * 0.92379999999999995D);
claz[i1][0][3] = -(int) (f1 * 0.3826D);
clay[i1][0][3] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][4] = (int) (f1 * 0.70709999999999995D);
claz[i1][0][4] = -(int) (f1 * 0.70709999999999995D);
clay[i1][0][4] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][5] = (int) (f1 * 0.3826D);
claz[i1][0][5] = -(int) (f1 * 0.92379999999999995D);
clay[i1][0][5] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][6] = -(int) (f1 * 0.3826D);
claz[i1][0][6] = -(int) (f1 * 0.92379999999999995D);
clay[i1][0][6] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][7] = -(int) (f1 * 0.70709999999999995D);
claz[i1][0][7] = -(int) (f1 * 0.70709999999999995D);
clay[i1][0][7] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][8] = -(int) (f1 * 0.92379999999999995D);
claz[i1][0][8] = -(int) (f1 * 0.3826D);
clay[i1][0][8] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][9] = -(int) (f1 * 0.92379999999999995D);
claz[i1][0][9] = (int) (f1 * 0.3826D);
clay[i1][0][9] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][10] = -(int) (f1 * 0.70709999999999995D);
claz[i1][0][10] = (int) (f1 * 0.70709999999999995D);
clay[i1][0][10] = (int) ((25D - Math.random() * 50D) * f);
f1 = (float) ((200D + Math.random() * 700D) * f);
clax[i1][0][11] = -(int) (f1 * 0.3826D);
claz[i1][0][11] = (int) (f1 * 0.92379999999999995D);
clay[i1][0][11] = (int) ((25D - Math.random() * 50D) * f);
for (int j1 = 0; j1 < 12; j1++) {
int j2 = j1 - 1;
if (j2 == -1) {
j2 = 11;
}
int l2 = j1 + 1;
if (l2 == 12) {
l2 = 0;
}
clax[i1][0][j1] = ((clax[i1][0][j2] + clax[i1][0][l2]) / 2 + clax[i1][0][j1]) / 2;
clay[i1][0][j1] = ((clay[i1][0][j2] + clay[i1][0][l2]) / 2 + clay[i1][0][j1]) / 2;
claz[i1][0][j1] = ((claz[i1][0][j2] + claz[i1][0][l2]) / 2 + claz[i1][0][j1]) / 2;
}
for (int k1 = 0; k1 < 12; k1++) {
float f2 = (float) (1.2D + 0.59999999999999998D * Math.random());
clax[i1][1][k1] = (int) (clax[i1][0][k1] * f2);
claz[i1][1][k1] = (int) (claz[i1][0][k1] * f2);
clay[i1][1][k1] = (int) (clay[i1][0][k1] - 100D * Math.random());
f2 = (float) (1.1000000000000001D + 0.29999999999999999D * Math.random());
clax[i1][2][k1] = (int) (clax[i1][1][k1] * f2);
claz[i1][2][k1] = (int) (claz[i1][1][k1] * f2);
clay[i1][2][k1] = (int) (clay[i1][1][k1] - 240D * Math.random());
}
cmx[i1] = 0;
for (int l1 = 0; l1 < 12; l1++) {
int k2 = l1 - 1;
if (k2 == -1) {
k2 = 11;
}
int i3 = l1 + 1;
if (i3 == 12) {
i3 = 0;
}
clay[i1][1][l1] = ((clay[i1][1][k2] + clay[i1][1][i3]) / 2 + clay[i1][1][l1]) / 2;
clay[i1][2][l1] = ((clay[i1][2][k2] + clay[i1][2][i3]) / 2 + clay[i1][2][l1]) / 2;
int j3 = (int) Math.sqrt(clax[i1][2][l1] * clax[i1][2][l1] + claz[i1][2][l1] * claz[i1][2][l1]);
if (j3 > cmx[i1]) {
cmx[i1] = j3;
}
}
for (int i2 = 0; i2 < 6; i2++) {
double d1 = Math.random();
double d2 = Math.random();
for (int k3 = 0; k3 < 3; k3++) {
float f3 = clds[k3] * 1.05F - clds[k3];
clc[i1][0][i2][k3] = (int) (clds[k3] + f3 * d1);
if (clc[i1][0][i2][k3] > 255) {
clc[i1][0][i2][k3] = 255;
}
if (clc[i1][0][i2][k3] < 0) {
clc[i1][0][i2][k3] = 0;
}
clc[i1][1][i2][k3] = (int) (clds[k3] * 1.05F + f3 * d2);
if (clc[i1][1][i2][k3] > 255) {
clc[i1][1][i2][k3] = 255;
}
if (clc[i1][1][i2][k3] < 0) {
clc[i1][1][i2][k3] = 0;
}
}
}
}
}
private static void drawclouds(Graphics2D graphics2d) {
for (int i = 0; i < noc; i++) {
int j = cx + (int) ((clx[i] - x / 20 - cx) * RadicalMath.cos(xz) - (clz[i] - z / 20 - cz) * RadicalMath.sin(xz));
int k = cz + (int) ((clx[i] - x / 20 - cx) * RadicalMath.sin(xz) + (clz[i] - z / 20 - cz) * RadicalMath.cos(xz));
int l = cz + (int) ((cldd[4] - y / 20 - cy) * RadicalMath.sin(zy) + (k - cz) * RadicalMath.cos(zy));
int i1 = Utility.xs(j + cmx[i], l);
int j1 = Utility.xs(j - cmx[i], l);
if (i1 <= 0 || j1 >= w || l <= -cmx[i] || i1 - j1 <= 20) {
continue;
}
int ai[][] = new int[3][12];
int ai1[][] = new int[3][12];
int ai2[][] = new int[3][12];
int ai3[] = new int[12];
int ai4[] = new int[12];
int k1;
int l1;
int i2;
int j2;
boolean flag;
int k2;
int l2;
int i3;
for (int j3 = 0; j3 < 3; j3++) {
for (int k4 = 0; k4 < 12; k4++) {
ai[j3][k4] = (clax[i][j3][k4] + clx[i]) - x / 20;
ai2[j3][k4] = (claz[i][j3][k4] + clz[i]) - z / 20;
ai1[j3][k4] = (clay[i][j3][k4] + cldd[4]) - y / 20;
}
Utility.rot(ai[j3], ai2[j3], cx, cz, xz, 12);
Utility.rot(ai1[j3], ai2[j3], cy, cz, zy, 12);
}
for (int k3 = 0; k3 < 12; k3 += 2) {
k1 = 0;
l1 = 0;
i2 = 0;
j2 = 0;
flag = true;
k2 = 0;
l2 = 0;
i3 = 0;
for (int l4 = 0; l4 < 6; l4++) {
int i6 = 0;
byte byte0 = 1;
if (l4 == 0) {
i6 = k3;
}
if (l4 == 1) {
i6 = k3 + 1;
if (i6 >= 12) {
i6 -= 12;
}
}
if (l4 == 2) {
i6 = k3 + 2;
if (i6 >= 12) {
i6 -= 12;
}
}
if (l4 == 3) {
i6 = k3 + 2;
if (i6 >= 12) {
i6 -= 12;
}
byte0 = 2;
}
if (l4 == 4) {
i6 = k3 + 1;
if (i6 >= 12) {
i6 -= 12;
}
byte0 = 2;
}
if (l4 == 5) {
i6 = k3;
byte0 = 2;
}
ai3[l4] = Utility.xs(ai[byte0][i6], ai2[byte0][i6]);
ai4[l4] = Utility.ys(ai1[byte0][i6], ai2[byte0][i6], 1);
l2 += ai[byte0][i6];
k2 += ai1[byte0][i6];
i3 += ai2[byte0][i6];
if (ai4[l4] < 0 || ai2[0][l4] < 10) {
k1++;
}
if (ai4[l4] > h || ai2[0][l4] < 10) {
l1++;
}
if (ai3[l4] < 0 || ai2[0][l4] < 10) {
i2++;
}
if (ai3[l4] > w || ai2[0][l4] < 10) {
j2++;
}
}
if (i2 == 6 || k1 == 6 || l1 == 6 || j2 == 6) {
flag = false;
}
if (!flag) {
continue;
}
l2 /= 6;
k2 /= 6;
i3 /= 6;
int i5 = (int) Math.sqrt((cy - k2) * (cy - k2) + (cx - l2) * (cx - l2) + i3 * i3);
if (i5 >= fade[7]) {
continue;
}
int j6 = clc[i][1][k3 / 2][0];
int j7 = clc[i][1][k3 / 2][1];
int j8 = clc[i][1][k3 / 2][2];
for (int i9 = 0; i9 < 16; i9++) {
if (i5 > fade[i9]) {
j6 = (j6 * fogd + cfade[0]) / (fogd + 1);
j7 = (j7 * fogd + cfade[1]) / (fogd + 1);
j8 = (j8 * fogd + cfade[2]) / (fogd + 1);
}
}
graphics2d.setColor(new Color(j6, j7, j8));
graphics2d.fillPolygon(ai3, ai4, 6);
}
for (int l3 = 0; l3 < 12; l3 += 2) {
k1 = 0;
l1 = 0;
i2 = 0;
j2 = 0;
flag = true;
k2 = 0;
l2 = 0;
i3 = 0;
for (int j5 = 0; j5 < 6; j5++) {
int k6 = 0;
int k7 = 0;
if (j5 == 0) {
k6 = l3;
}
if (j5 == 1) {
k6 = l3 + 1;
if (k6 >= 12) {
k6 -= 12;
}
}
if (j5 == 2) {
k6 = l3 + 2;
if (k6 >= 12) {
k6 -= 12;
}
}
if (j5 == 3) {
k6 = l3 + 2;
if (k6 >= 12) {
k6 -= 12;
}
k7 = 1;
}
if (j5 == 4) {
k6 = l3 + 1;
if (k6 >= 12) {
k6 -= 12;
}
k7 = 1;
}
if (j5 == 5) {
k6 = l3;
k7 = 1;
}
ai3[j5] = Utility.xs(ai[k7][k6], ai2[k7][k6]);
ai4[j5] = Utility.ys(ai1[k7][k6], ai2[k7][k6], 1);
l2 += ai[k7][k6];
k2 += ai1[k7][k6];
i3 += ai2[k7][k6];
if (ai4[j5] < 0 || ai2[0][j5] < 10) {
k1++;
}
if (ai4[j5] > h || ai2[0][j5] < 10) {
l1++;
}
if (ai3[j5] < 0 || ai2[0][j5] < 10) {
i2++;
}
if (ai3[j5] > w || ai2[0][j5] < 10) {
j2++;
}
}
if (i2 == 6 || k1 == 6 || l1 == 6 || j2 == 6) {
flag = false;
}
if (!flag) {
continue;
}
l2 /= 6;
k2 /= 6;
i3 /= 6;
int k5 = (int) Math.sqrt((cy - k2) * (cy - k2) + (cx - l2) * (cx - l2) + i3 * i3);
if (k5 >= fade[7]) {
continue;
}
int l6 = clc[i][0][l3 / 2][0];
int l7 = clc[i][0][l3 / 2][1];
int k8 = clc[i][0][l3 / 2][2];
for (int j9 = 0; j9 < 16; j9++) {
if (k5 > fade[j9]) {
l6 = (l6 * fogd + cfade[0]) / (fogd + 1);
l7 = (l7 * fogd + cfade[1]) / (fogd + 1);
k8 = (k8 * fogd + cfade[2]) / (fogd + 1);
}
}
graphics2d.setColor(new Color(l6, l7, k8));
graphics2d.fillPolygon(ai3, ai4, 6);
}
k1 = 0;
l1 = 0;
i2 = 0;
j2 = 0;
flag = true;
k2 = 0;
l2 = 0;
i3 = 0;
for (int i4 = 0; i4 < 12; i4++) {
ai3[i4] = Utility.xs(ai[0][i4], ai2[0][i4]);
ai4[i4] = Utility.ys(ai1[0][i4], ai2[0][i4], 1);
l2 += ai[0][i4];
k2 += ai1[0][i4];
i3 += ai2[0][i4];
if (ai4[i4] < 0 || ai2[0][i4] < 10) {
k1++;
}
if (ai4[i4] > h || ai2[0][i4] < 10) {
l1++;
}
if (ai3[i4] < 0 || ai2[0][i4] < 10) {
i2++;
}
if (ai3[i4] > w || ai2[0][i4] < 10) {
j2++;
}
}
if (i2 == 12 || k1 == 12 || l1 == 12 || j2 == 12) {
flag = false;
}
if (!flag) {
continue;
}
l2 /= 12;
k2 /= 12;
i3 /= 12;
int j4 = (int) Math.sqrt((cy - k2) * (cy - k2) + (cx - l2) * (cx - l2) + i3 * i3);
if (j4 >= fade[7]) {
continue;
}
int l5 = clds[0];
int i7 = clds[1];
int i8 = clds[2];
for (int l8 = 0; l8 < 16; l8++) {
if (j4 > fade[l8]) {
l5 = (l5 * fogd + cfade[0]) / (fogd + 1);
i7 = (i7 * fogd + cfade[1]) / (fogd + 1);
i8 = (i8 * fogd + cfade[2]) / (fogd + 1);
}
}
graphics2d.setColor(new Color(l5, i7, i8));
graphics2d.fillPolygon(ai3, ai4, 12);
}
}
public static void newmountains(int i, int i_167_, int i_168_, int i_169_) {
Random random = new Random(mgen);
nmt = (int) (20.0 + 10.0 * random.nextDouble());
int i_170_ = (i + i_167_) / 60;
int i_171_ = (i_168_ + i_169_) / 60;
int i_172_ = Math.max(i_167_ - i, i_169_ - i_168_) / 60;
mrd = null;
nmv = null;
mtx = null;
mty = null;
mtz = null;
mtc = null;
mrd = new int[nmt];
nmv = new int[nmt];
mtx = new int[nmt][];
mty = new int[nmt][];
mtz = new int[nmt][];
mtc = new int[nmt][][];
int[] is = new int[nmt];
int[] is_173_ = new int[nmt];
for (int i_174_ = 0; i_174_ < nmt; i_174_++) {
int i_175_;
float f;
float f_176_;
is[i_174_] = (int) (10000.0 + random.nextDouble() * 10000.0);
int i_177_ = (int) (random.nextDouble() * 360.0);
if (random.nextDouble() > random.nextDouble()) {
f = (float) (0.2 + random.nextDouble() * 0.35);
f_176_ = (float) (0.2 + random.nextDouble() * 0.35);
nmv[i_174_] = (int) (f * (24.0 + 16.0 * random.nextDouble()));
i_175_ = (int) (85.0 + 10.0 * random.nextDouble());
} else {
f = (float) (0.3 + random.nextDouble() * 1.1);
f_176_ = (float) (0.2 + random.nextDouble() * 0.35);
nmv[i_174_] = (int) (f * (12.0 + 8.0 * random.nextDouble()));
i_175_ = (int) (104.0 - 10.0 * random.nextDouble());
}
mtx[i_174_] = new int[nmv[i_174_] * 2];
mty[i_174_] = new int[nmv[i_174_] * 2];
mtz[i_174_] = new int[nmv[i_174_] * 2];
mtc[i_174_] = new int[nmv[i_174_]][3];
for (int i_178_ = 0; i_178_ < nmv[i_174_]; i_178_++) {
mtx[i_174_][i_178_] = (int) ((i_178_ * 500 + (random.nextDouble() * 800.0 - 400.0)
- 250 * (nmv[i_174_] - 1)) * f);
mtx[i_174_][i_178_ + nmv[i_174_]] = (int) ((i_178_ * 500
+ (random.nextDouble() * 800.0 - 400.0) - 250 * (nmv[i_174_] - 1)) * f);
mtx[i_174_][nmv[i_174_]] = (int) (mtx[i_174_][0]
- (100.0 + random.nextDouble() * 600.0) * f);
mtx[i_174_][nmv[i_174_] * 2 - 1] = (int) (mtx[i_174_][nmv[i_174_] - 1]
+ (100.0 + random.nextDouble() * 600.0) * f);
if (i_178_ == 0 || i_178_ == nmv[i_174_] - 1)
mty[i_174_][i_178_] = (int) ((-400.0 - 1200.0 * random.nextDouble()) * f_176_
+ ground);
if (i_178_ == 1 || i_178_ == nmv[i_174_] - 2)
mty[i_174_][i_178_] = (int) ((-1000.0 - 1450.0 * random.nextDouble()) * f_176_
+ ground);
if (i_178_ > 1 && i_178_ < nmv[i_174_] - 2)
mty[i_174_][i_178_] = (int) ((-1600.0 - 1700.0 * random.nextDouble()) * f_176_
+ ground);
mty[i_174_][i_178_ + nmv[i_174_]] = ground - 70;
mtz[i_174_][i_178_] = i_171_ + i_172_ + is[i_174_];
mtz[i_174_][i_178_ + nmv[i_174_]] = i_171_ + i_172_ + is[i_174_];
float f_179_ = (float) (0.5 + random.nextDouble() * 0.5);
mtc[i_174_][i_178_][0] = (int) (170.0F * f_179_ + 170.0F * f_179_ * (snap[0] / 100.0F));
if (mtc[i_174_][i_178_][0] > 255)
mtc[i_174_][i_178_][0] = 255;
if (mtc[i_174_][i_178_][0] < 0)
mtc[i_174_][i_178_][0] = 0;
mtc[i_174_][i_178_][1] = (int) (i_175_ * f_179_ + 85.0F * f_179_ * (snap[1] / 100.0F));
if (mtc[i_174_][i_178_][1] > 255)
mtc[i_174_][i_178_][1] = 255;
if (mtc[i_174_][i_178_][1] < 1)
mtc[i_174_][i_178_][1] = 0;
mtc[i_174_][i_178_][2] = 0;
}
for (int i_180_ = 1; i_180_ < nmv[i_174_] - 1; i_180_++) {
int i_181_ = i_180_ - 1;
int i_182_ = i_180_ + 1;
mty[i_174_][i_180_] = ((mty[i_174_][i_181_] + mty[i_174_][i_182_]) / 2 + mty[i_174_][i_180_]) / 2;
}
Utility.rot(mtx[i_174_], mtz[i_174_], i_170_, i_171_, i_177_, nmv[i_174_] * 2);
is_173_[i_174_] = 0;
}
for (int i_183_ = 0; i_183_ < nmt; i_183_++) {
for (int i_184_ = i_183_ + 1; i_184_ < nmt; i_184_++) {
if (is[i_183_] < is[i_184_])
is_173_[i_183_]++;
else
is_173_[i_184_]++;
}
mrd[is_173_[i_183_]] = i_183_;
}
}
private static void drawmountains(Graphics2D rd) {
for (int i = 0; i < nmt; i++) {
int i_185_ = mrd[i];
int i_186_ = cx + (int) ((mtx[i_185_][0] - x / 30 - cx) * RadicalMath.cos(xz)
- (mtz[i_185_][0] - z / 30 - cz) * RadicalMath.sin(xz));
int i_187_ = cz + (int) ((mtx[i_185_][0] - x / 30 - cx) * RadicalMath.sin(xz)
+ (mtz[i_185_][0] - z / 30 - cz) * RadicalMath.cos(xz));
int i_188_ = cz
+ (int) ((mty[i_185_][0] - y / 30 - cy) * RadicalMath.sin(zy) + (i_187_ - cz) * RadicalMath.cos(zy));
int i_189_ = cx + (int) ((mtx[i_185_][nmv[i_185_] - 1] - x / 30 - cx) * RadicalMath.cos(xz)
- (mtz[i_185_][nmv[i_185_] - 1] - z / 30 - cz) * RadicalMath.sin(xz));
int i_190_ = cz + (int) ((mtx[i_185_][nmv[i_185_] - 1] - x / 30 - cx) * RadicalMath.sin(xz)
+ (mtz[i_185_][nmv[i_185_] - 1] - z / 30 - cz) * RadicalMath.cos(xz));
int i_191_ = cz + (int) ((mty[i_185_][nmv[i_185_] - 1] - y / 30 - cy) * RadicalMath.sin(zy)
+ (i_190_ - cz) * RadicalMath.cos(zy));
if (Utility.xs(i_189_, i_191_) > 0 && Utility.xs(i_186_, i_188_) < w) {
int[] is = new int[nmv[i_185_] * 2];
int[] is_192_ = new int[nmv[i_185_] * 2];
int[] is_193_ = new int[nmv[i_185_] * 2];
for (int i_194_ = 0; i_194_ < nmv[i_185_] * 2; i_194_++) {
is[i_194_] = mtx[i_185_][i_194_] - x / 30;
is_192_[i_194_] = mty[i_185_][i_194_] - y / 30;
is_193_[i_194_] = mtz[i_185_][i_194_] - z / 30;
}
int i_195_ = (int) Math.sqrt(is[nmv[i_185_] / 4] * is[nmv[i_185_] / 4]
+ is_193_[nmv[i_185_] / 4] * is_193_[nmv[i_185_] / 4]);
Utility.rot(is, is_193_, cx, cz, xz, nmv[i_185_] * 2);
Utility.rot(is_192_, is_193_, cy, cz, zy, nmv[i_185_] * 2);
int[] is_196_ = new int[4];
int[] is_197_ = new int[4];
boolean bool_201_;
for (int i_202_ = 0; i_202_ < nmv[i_185_] - 1; i_202_++) {
int i_203_ = 0;
int i_204_ = 0;
int i_205_ = 0;
int i_206_ = 0;
bool_201_ = true;
for (int i_207_ = 0; i_207_ < 4; i_207_++) {
int i_208_ = i_207_ + i_202_;
if (i_207_ == 2)
i_208_ = i_202_ + nmv[i_185_] + 1;
if (i_207_ == 3)
i_208_ = i_202_ + nmv[i_185_];
is_196_[i_207_] = Utility.xs(is[i_208_], is_193_[i_208_]);
is_197_[i_207_] = Utility.ys(is_192_[i_208_], is_193_[i_208_], 1);
if (is_197_[i_207_] < 0 || is_193_[i_208_] < 10)
i_203_++;
if (is_197_[i_207_] > h || is_193_[i_208_] < 10)
i_204_++;
if (is_196_[i_207_] < 0 || is_193_[i_208_] < 10)
i_205_++;
if (is_196_[i_207_] > w || is_193_[i_208_] < 10)
i_206_++;
}
if (i_205_ == 4 || i_203_ == 4 || i_204_ == 4 || i_206_ == 4)
bool_201_ = false;
if (bool_201_) {