-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathxtGraphics.java
4874 lines (4746 loc) · 172 KB
/
xtGraphics.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 fallk.logmaster.HLogger;
import java.applet.Applet;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ThreadLocalRandom;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
class xtGraphics extends Panel implements Runnable {
/**
*
*/
private static final long serialVersionUID = -6463312620664057856L;
SoundManager sm = new SoundManager();
/**
* starting colors for the special screen in the credits
*/
private final int[] credColors = {
25, 50, 100
};
/**
* test image for the network load feature
*/
private Image aimLogo;
private final Graphics2D rd;
private ImageObserver ob;
private final Applet app;
public int fase;
private int oldfase;
public int starcnt;
public int unlocked;
private int lockcnt;
public int opselect;
private boolean shaded;
public int flipo;
private boolean nextc;
private int gatey;
public int looped;
public final int[] sc;
/**
* x position of the cars at theh start of a race
*/
public final int[] xstart = {
0, -350, 350, 0, -350, 350, 0
};
/**
* z position of the cars at theh start of a race
*/
public final int[] zstart = {
-760, -380, -380, 0, 380, 380, 760
};
/*
* hm... it would be interesting if there was a ystart...
* int ystart[] = {
* 250, 350, 450, 550, 650, 750, 850
* };
*/
private boolean holdit;
private int holdcnt;
public boolean winner;
private final int[] flexpix;
private final int[] smokey;
private Image fleximg;
private int flatrstart;
private Thread runner;
private int runtyp;
private Image kaff;
private Image odmg;
private Image opwr;
private Image opos;
private Image owas;
private Image olap;
private Image oyourwasted;
private Image oyoulost;
private Image oyouwon;
private Image oyouwastedem;
private Image ogameh;
private Image oloadingmusic;
private Image oflaot;
private Image dmg;
private Image pwr;
private Image pos;
private Image was;
private Image lap;
private Image br;
private Image select;
private Image loadingmusic;
private Image yourwasted;
private Image youlost;
private Image youwon;
private Image youwastedem;
private Image gameh;
private Image congrd;
private Image gameov;
private Image carsbg;
private Image pgate;
private Image selectcar;
private Image statb;
private Image statbo;
public Image mdness;
private Image paused;
private Image radicalplay;
private Image logocars;
private Image logomadnes;
private Image logomadbg;
private Image byrd;
private Image opback;
private Image nfmcoms;
private Image opti;
private Image bgmain;
private Image rpro;
private Image nfmcom;
private Image flaot;
private Image fixhoop;
private Image sarrow;
private Image stunts;
private Image racing;
private Image wasting;
private Image plus;
private Image space;
private Image arrows;
private Image chil;
private Image ory;
private Image kz;
private Image kx;
private Image kv;
private Image kp;
private Image km;
private Image kn;
private Image kenter;
private Image nfm;
private final Image[][] trackbg;
public final Image[] dude;
private final Image[] dudeb;
private int duds;
private int dudo;
private final Image[] next;
private final Image[] back;
private final Image[] contin;
private final Image[] ostar;
private final Image[] star;
private int pcontin;
private int pnext;
private int pback;
private int pstar;
private final Image[] orank;
private final Image[] rank;
private final Image[] ocntdn;
private final Image[] cntdn;
private int gocnt;
private final boolean[] pengs;
private boolean aird;
private boolean grrd;
private boolean pwastd;
public boolean mutes;
private RadicalMod stages;
private RadicalMod cars;
public final RadicalMod[] stracks;
public final boolean[] loadedt;
private int lastload;
private boolean mutem;
private boolean arrace;
private int ana;
private int cntan;
private int cntovn;
private boolean flk;
private int tcnt;
private boolean tflk;
private String say;
private boolean wasay;
private int clear;
private int posit;
private int wasted;
private int laps;
private final int[] dested;
private final String[] names = {
"Tornado Shark", "Formula 7", "Wow Caninaro", "La Vite Crab", "Nimi", "MAX Revenge", "Lead Oxide",
"Kool Kat", "Drifter X", "Sword of Justice", "High Rider", "EL KING", "Mighty Eight", "M A S H E E N",
"Radical One", "DR Monstaa"
};
private int dmcnt;
private boolean dmflk;
private int pwcnt;
private boolean pwflk;
private final String[][] adj = {
{
"Cool", "Alright", "Nice"
}, {
"Wicked", "Amazing", "Super"
}, {
"Awesome", "Ripping", "Radical"
}, {
"What the...?", "Your a super star!!!!", "Who are you again...?"
}, {
"surf style", "off the lip", "bounce back"
}
};
private final String[] exlm = {
"!", "!!", "!!!"
};
private String loop;
private String spin;
private String asay;
private int auscnt;
private boolean aflk;
private final int[] sndsize = {
106, 76, 56, 116, 92, 208, 70, 80, 152, 102, 27, 65, 52, 30, 151, 129, 70
};
private final Image hello;
private final Image sign;
private final Image loadbar;
private int kbload;
public int dnload;
private float shload;
private int radpx;
private int pin;
private final int[] bgmy = {
0, 400
};
private final int[] trkx = {
0, 670
};
private int trkl;
private int trklim;
private final float[] hipno = {
1.0F, 1.0F, 3F, 1.0F, 1.2F, 1.0F, 1.7F, 1.0F, 1.0F, 8F, 1.5F, 2.0F, 1.2F, 10F, 1.8F, 1.4F, 2.0F
};
private int flkat;
private int movly;
private int xdu;
private int ydu;
private int gxdu;
private int gydu;
private final int[] pgatx = {
146, 175, 215, 267, 334, 401, 452, 493, 521
};
private final int[] pgaty = {
168, 188, 201, 212, 219, 214, 203, 189, 171
};
private final int[] pgady;
private final boolean[] pgas;
private int lxm;
private int lym;
private int pwait;
private int stopcnt;
private int cntwis;
private int crshturn;
private int bfcrash;
private int bfskid;
private boolean crashup;
private boolean skidup;
private int skflg;
private int dskflg;
private int flatr;
private int flyr;
private int flyrdest;
private int flang;
private int flangados;
private float blackn;
private float blacknados;
/**
* Filter images
*
* @param img Image to filter
* @param type Integer of what filter to apply
* @author Kaffeinated
*/
public void filterImage(Image img, int type) {
BufferedImage buff_img = new BufferedImage(img.getWidth(null), img.getHeight(null),
BufferedImage.TYPE_INT_ARGB);
Graphics2D rd_sep = buff_img.createGraphics();
rd_sep.drawImage(img, 0, 0, null);
rd_sep.dispose();
// now buff_img = BufferedImage img
if (type == 0) { //////// grayscale
BufferedImage gray = new BufferedImage(buff_img.getWidth(), buff_img.getHeight(),
BufferedImage.TYPE_INT_ARGB);
ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
op.filter(buff_img, gray);
rd.drawImage(gray, 0, 0, null);
}
if (type == 1) { ///////// sepia tone
BufferedImage sepia = new BufferedImage(buff_img.getWidth(), buff_img.getHeight(),
BufferedImage.TYPE_INT_ARGB);
int sepiaDepth = 20;
int w = buff_img.getWidth();
int h = buff_img.getHeight();
int[] pixels = new int[w * h * 4];
buff_img.getRaster().getPixels(0, 0, w, h, pixels);
for (int x = 0; x < buff_img.getWidth(); x++) {
for (int y = 0; y < buff_img.getHeight(); y++) {
int rgb = buff_img.getRGB(x, y);
Color color = new Color(rgb, true);
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
int gry = (r + g + b) / 3;
r = g = b = gry;
r = r + (sepiaDepth * 2);
g = g + sepiaDepth;
if (r > 255) {
r = 255;
}
if (g > 255) {
g = 255;
}
if (b > 255) {
b = 255;
}
b -= 20;
if (b < 0) {
b = 0;
}
if (b > 255) {
b = 255;
}
color = new Color(r, g, b, color.getAlpha());
sepia.setRGB(x, y, color.getRGB());
}
}
rd.drawImage(sepia, 0, 0, null);
}
if (type == 2) { /////////// inverts colors
BufferedImage invert = new BufferedImage(buff_img.getWidth(), buff_img.getHeight(),
BufferedImage.TYPE_INT_ARGB);
int w = buff_img.getWidth();
int h = buff_img.getHeight();
int[] pixels = new int[w * h * 4];
buff_img.getRaster().getPixels(0, 0, w, h, pixels);
for (int x = 0; x < buff_img.getWidth(); x++) {
for (int y = 0; y < buff_img.getHeight(); y++) {
int rgb = buff_img.getRGB(x, y);
Color color = new Color(rgb, true);
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
r = 255 - r;
g = 255 - g;
b = 255 - b;
if (r > 255) {
r = 255;
}
if (r < 0) {
r = 0;
}
if (g > 255) {
g = 255;
}
if (g < 0) {
g = 0;
}
if (b > 255) {
b = 255;
}
if (b < 0) {
b = 0;
}
color = new Color(r, g, b, color.getAlpha());
invert.setRGB(x, y, color.getRGB());
}
}
rd.drawImage(invert, 0, 0, null);
}
if (type == 3) { /////// alternate invert
BufferedImage altinvert = new BufferedImage(buff_img.getWidth(), buff_img.getHeight(),
BufferedImage.TYPE_INT_ARGB);
int w = buff_img.getWidth();
int h = buff_img.getHeight();
int[] pixels = new int[w * h * 4];
buff_img.getRaster().getPixels(0, 0, w, h, pixels);
for (int x = 0; x < buff_img.getWidth(); x++) {
for (int y = 0; y < buff_img.getHeight(); y++) {
int rgb = buff_img.getRGB(x, y);
Color color = new Color(rgb, true);
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
r = Medium.csky[0] - r;
g = Medium.csky[1] - g;
b = Medium.csky[2] - b;
if (r > 255) {
r = 255;
}
if (r < 0) {
r = 0;
}
if (g > 255) {
g = 255;
}
if (g < 0) {
g = 0;
}
if (b > 255) {
b = 255;
}
if (b < 0) {
b = 0;
}
color = new Color(r, g, b, color.getAlpha());
altinvert.setRGB(x, y, color.getRGB());
}
}
rd.drawImage(altinvert, 0, 0, null);
}
if (type == 4) { /////// washout type filter
BufferedImage washout = new BufferedImage(buff_img.getWidth(), buff_img.getHeight(),
BufferedImage.TYPE_INT_ARGB);
int w = buff_img.getWidth();
int h = buff_img.getHeight();
int[] pixels = new int[w * h * 4];
buff_img.getRaster().getPixels(0, 0, w, h, pixels);
for (int x = 0; x < buff_img.getWidth(); x++) {
for (int y = 0; y < buff_img.getHeight(); y++) {
int rgb = buff_img.getRGB(x, y);
Color color = new Color(rgb, true);
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
int nr = r / 2;
int ng = g / 2;
r = nr + r;
g = ng + g;
b = b + (b / 2);
if (r > 255) {
r = 255;
}
if (r < 0) {
r = 0;
}
if (g > 255) {
g = 255;
}
if (g < 0) {
g = 0;
}
if (b > 255) {
b = 255;
}
if (b < 0) {
b = 0;
}
color = new Color(r, g, b, color.getAlpha());
washout.setRGB(x, y, color.getRGB());
}
}
rd.drawImage(washout, 0, 0, null);
}
}
/**
* Special color effect in credits
*
* @param image the image
* @return image the same image but filtered with color
* @author Kaffeinated
*/
public Image credsnap(Image image) {
int i = 350; // image.getHeight(ob);
int j = image.getWidth(ob);
int ai[] = new int[j * i];
if (credColors[0] < 200) {
credColors[0] += 5;
} else {
do {
credColors[0] -= 5;
} while (credColors[0] > 25);
}
if (credColors[1] < 100) {
credColors[1] += 5;
} else {
do {
credColors[1] -= 10;
} while (credColors[1] > 50);
}
if (credColors[2] < 30) {
credColors[2] += 5;
} else {
do {
credColors[2] -= 5;
} while (credColors[2] > 100);
}
PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, j, i, ai, 0, j);
try {
pixelgrabber.grabPixels();
} catch (InterruptedException _ex) {
}
for (int k = 0; k < j * i; k++) {
Color color = new Color(ai[k]);
int l = (int) (color.getRed() * (credColors[0] / 100F));
if (l > 225) {
l = 225;
}
if (l < 0) {
l = 0;
}
int i1 = (int) (color.getGreen() * (credColors[1] / 100F));
if (i1 > 225) {
i1 = 225;
}
if (i1 < 0) {
i1 = 0;
}
int j1 = (int) (color.getBlue() * (credColors[2] / 100F));
if (j1 > 225) {
j1 = 225;
}
if (j1 < 0) {
j1 = 0;
}
Color color2 = new Color(l, i1, j1, 50); /// last is alpha
ai[k] = color2.getRGB();
}
return createImage(new MemoryImageSource(j, i, ai, 0, j));
}
public int colorinvert(int r, int g, int b) {
int hex = (0xff << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
return 0xFFFFFF - hex;
}
/**
* drawcs for images
*
* @param img image to draw
* @param y y value
* @author Kaffeinated
*/
public void paintcs(Image img, int y) {
rd.drawImage(img, (img.getWidth(null) / 2) - 670, y, null);
}
/**
* draw text over conto
*
* @param text text to draw
* @param contos conto to overlay
* @author Rafa
* @author Kaffeinated
*/
public void drawOver(String text, ContO contos) {
int x = Medium.cx + (contos.x - Medium.x - Medium.cx);
int y = Medium.cy + (contos.y - Medium.y - Medium.cy);
int z = Medium.cz + (contos.z - Medium.z - Medium.cz);
x = Utility.rotSingle(x, z, Medium.cx, Medium.cz, Medium.xz, RadicalMath.sin(Medium.xz), RadicalMath.cos(Medium.xz))[0];
y = Utility.rotSingle(y, z, Medium.cy, Medium.cz, Medium.zy, RadicalMath.sin(Medium.zy), RadicalMath.cos(Medium.zy))[0];
z = Utility.rotSingle(y, z, Medium.cy, Medium.cz, Medium.zy, RadicalMath.sin(Medium.zy), RadicalMath.cos(Medium.zy))[1];
final int xScreenCoor = Utility.xs(x, z);
final int yScreenCoor = Utility.cYs(y, z);
rd.drawString("" + text, xScreenCoor, yScreenCoor);
}
private boolean over(Image image, int i, int j, int k, int l) {
int i1 = image.getHeight(ob);
int j1 = image.getWidth(ob);
return i > k - 5 && i < k + j1 + 5 && j > l - 5 && j < l + i1 + 5;
}
public void cantgo(Control control) {
pnext = 0;
trackbg(false);
rd.setFont(new Font("SansSerif", 1, 13));
FontHandler.fMetrics = rd.getFontMetrics();
drawcs(110, "This stage will be unlocked when stage " + unlocked + " is complete!", 177, 177, 177, 3);
int i = 0;
do {
rd.drawImage(pgate, 212 + i * 30, 190, null);
} while (++i < 9);
rd.setFont(new Font("SansSerif", 1, 11));
FontHandler.fMetrics = rd.getFontMetrics();
if (aflk) {
drawcs(160, "[ Stage " + (unlocked + 1) + " Locked ]", 255, 128, 0, 3);
aflk = false;
} else {
drawcs(160, "[ Stage " + (unlocked + 1) + " Locked ]", 255, 0, 0, 3);
aflk = true;
}
rd.drawImage(select, 273, 45, null);
rd.drawImage(br, 0, 0, null);
rd.drawImage(back[pback], 305, 320, null);
rd.setFont(new Font("SansSerif", 1, 11));
FontHandler.fMetrics = rd.getFontMetrics();
drawcs(396, "You can also use Keyboard Arrows and Enter to navigate.", 82, 90, 0, 3);
lockcnt--;
if (lockcnt == 0 || control.enter || control.handb || control.left) {
control.left = false;
control.handb = false;
control.enter = false;
fase = 1;
}
}
public void loadingstage(int i) {
trackbg(true);
rd.setColor(new Color(177, 177, 177));
rd.fillRoundRect(200, 150, 270, 52, 20, 40);
rd.setColor(new Color(120, 120, 120));
rd.drawRoundRect(200, 150, 270, 52, 20, 40);
rd.setFont(new Font("SansSerif", 1, 13));
FontHandler.fMetrics = rd.getFontMetrics();
drawcs(180, "Loading Stage " + i + ", please wait...", 0, 0, 0, 3);
rd.drawImage(select, 273, 45, null);
rd.drawImage(br, 0, 0, null);
rd.setFont(new Font("SansSerif", 1, 11));
FontHandler.fMetrics = rd.getFontMetrics();
drawcs(396, "You can also use Keyboard Arrows and Enter to navigate.", 82, 90, 0, 3);
app.repaint();
if (lastload != -22) {
stages.loadMod(135, 7800, 125);
lastload = -22;
} else {
stages.stop();
}
}
public void inst(Control control) {
if (flipo == 0) {
flipo = 1;
bgmy[0] = 0;
bgmy[1] = 400;
}
if (flipo == 2) {
flipo = 3;
dudo = 200;
}
if (flipo == 4) {
flipo = 5;
dudo = 250;
}
if (flipo == 6) {
flipo = 7;
dudo = 200;
}
if (flipo == 8) {
flipo = 9;
dudo = 250;
}
if (flipo == 10) {
flipo = 11;
dudo = 200;
}
if (flipo == 12) {
flipo = 13;
dudo = 200;
}
if (flipo == 14) {
flipo = 15;
dudo = 100;
}
int i = 0;
do {
rd.drawImage(bgmain, 0, bgmy[i], null);
bgmy[i] -= 2;
if (bgmy[i] <= -400) {
bgmy[i] = 400;
}
} while (++i < 2);
aflk = !aflk;
if (flipo != 1) {
if (dudo > 0) {
if (aflk) {
if (Math.random() > Math.random()) {
duds = (int) (Math.random() * 3D);
} else {
duds = (int) (Math.random() * 2D);
}
}
dudo--;
} else {
duds = 0;
}
rd.drawImage(dude[duds], 30, -10, null);
rd.drawImage(oflaot, 127, 17, null);
}
rd.setColor(new Color(0, 0, 0));
rd.setFont(new Font("SansSerif", 1, 13));
if (flipo == 3 || flipo == 5) {
if (flipo == 3) {
rd.drawString("Hello! Welcome to the world of", 197, 42);
rd.drawString("!", 592, 42);
rd.drawImage(nfm, 404, 30, null);
rd.drawString("In this game there are two ways to complete a stage.", 197, 82);
rd.drawString("One is by racing and finishing in first place, the other is by", 197, 102);
rd.drawString("wasting and crashing all the other cars in the stage!", 197, 122);
} else {
rd.setColor(new Color(100, 100, 100));
rd.drawString("While racing, you will need to focus on going fast and passing", 197, 42);
rd.drawString("through all the checkpoints in the track. To complete a lap, you", 197, 62);
rd.drawString("must not miss a checkpoint.", 197, 82);
rd.drawString("While wasting, you will just need to chase the other cars and", 197, 102);
rd.drawString("crash into them (without worrying about track and checkpoints).", 197, 122);
rd.setColor(new Color(0, 0, 0));
}
rd.drawImage(racing, 100, 160, null);
rd.drawImage(ory, 364, 210, null);
rd.drawImage(wasting, 427, 160, null);
rd.setFont(new Font("SansSerif", 1, 11));
rd.drawString("Checkpoint", 327, 164);
rd.setFont(new Font("SansSerif", 1, 13));
rd.drawString("Drive your car using the Arrow Keys and Spacebar :", 60, 295);
rd.drawImage(space, 106, 330, null);
rd.drawImage(arrows, 440, 298, null);
rd.setFont(new Font("SansSerif", 1, 11));
rd.drawString("(When your car is on the ground Spacebar is for Handbrake)", 60, 316);
rd.drawString("Accelerate", 450, 294);
rd.drawString("Brake/Reverse", 441, 372);
rd.drawString("Turn left", 389, 350);
rd.drawString("Turn right", 525, 350);
rd.drawString("Handbrake", 182, 349);
}
if (flipo == 7 || flipo == 9) {
if (flipo == 7) {
rd.drawString("Whether you are racing or wasting the other cars you will need", 197, 42);
rd.drawString("to power up your car.", 197, 62);
rd.drawString("=> More 'Power' makes your car become faster and stronger!", 197, 82);
rd.drawString("To power up your car (and keep it powered up) you will need to", 197, 102);
rd.drawString("perform stunts!", 197, 122);
rd.drawImage(chil, 102, 270, null);
} else {
rd.drawString("The better the stunt the more power you get!", 197, 42);
rd.setColor(new Color(100, 100, 100));
rd.drawString("Forward looping pushes your car forwards in the air and helps", 197, 62);
rd.drawString("when racing. Backward looping pushes your car upwards giving it", 197, 82);
rd.drawString("more hang time in the air making it easier to control its landing.", 197, 102);
rd.drawString("Left and right rolls shift your car in the air left and right slightly.", 197, 122);
if (aflk || dudo < 150) {
rd.drawImage(chil, 102, 270, null);
}
rd.setColor(new Color(0, 0, 0));
}
rd.drawImage(stunts, 40, 150, null);
rd.drawImage(opwr, 475, 228, null);
rd.setFont(new Font("SansSerif", 1, 13));
rd.drawString("To perform stunts. When your car is in the AIR;", 60, 285);
rd.drawString("Press combo Spacebar + Arrow Keys :", 60, 305);
rd.drawImage(space, 120, 330, null);
rd.drawImage(plus, 340, 333, null);
rd.drawImage(arrows, 426, 298, null);
rd.setFont(new Font("SansSerif", 1, 11));
rd.setColor(new Color(0, 0, 0));
rd.drawString("Forward Loop", 427, 294);
rd.drawString("Backward Loop", 425, 372);
rd.drawString("Left Roll", 378, 350);
rd.drawString("Right Roll", 511, 350);
rd.drawString("Spacebar", 201, 349);
rd.setColor(new Color(140, 243, 244));
rd.fillRect(537, 232, 76, 9);
}
if (flipo == 11 || flipo == 13) {
if (flipo == 11) {
rd.drawString("When wasting cars, to help you find the other cars in the stage,", 197, 42);
rd.drawString("press [ A ] to toggle the guidance arrow from pointing to the track", 197, 62);
rd.drawString("to pointing to the cars.", 197, 82);
rd.drawString("When your car is damaged. You fix it (and reset its 'Damage') by", 197, 102);
rd.drawString("jumping through the electrified hoop.", 197, 122);
} else {
rd.setColor(new Color(100, 100, 100));
rd.drawString("You will find that in some stages it's easier to waste the other cars", 197, 42);
rd.drawString("and in some others it's easier to race and finish in first place.", 197, 62);
rd.drawString("It is up to you to decide when to waste and when to race.", 197, 82);
rd.drawString("And remember, 'Power' is an important factor in the game. You", 197, 102);
rd.drawString("will need it whether you are racing or wasting!", 197, 122);
rd.setColor(new Color(0, 0, 0));
}
rd.drawImage(fixhoop, 120, 193, null);
rd.drawImage(sarrow, 320, 203, null);
rd.setFont(new Font("SansSerif", 1, 11));
rd.drawString("The Electrified Hoop", 127, 191);
rd.drawString("Jumping through it fixes your car.", 93, 313);
rd.drawString("Make guidance arrow point to cars.", 320, 191);
}
if (flipo == 15) {
rd.drawString("There is a total of 17 stages!", 197, 42);
rd.drawString("Every two stages completed a new car will be unlocked!", 197, 62);
rd.drawString("I am Coach Insano by the way.", 197, 102);
rd.drawString("I am your coach and narrator in this game! Good Luck!", 197, 122);
rd.drawString("Other Controls :", 90, 180);
rd.setFont(new Font("SansSerif", 1, 11));
rd.drawImage(kz, 100, 200, null);
rd.drawString("OR", 141, 226);
rd.drawImage(kx, 160, 200, null);
rd.drawString("=> To look behind you while driving.", 202, 226);
rd.drawImage(kv, 100, 250, null);
rd.drawString("Change Views", 142, 276);
rd.drawImage(kp, 100, 300, null);
rd.drawString("OR", 141, 326);
rd.drawImage(kenter, 160, 300, null);
rd.drawString("Pause Game", 287, 326);
rd.drawImage(km, 420, 200, null);
rd.drawString("Mute Music", 462, 226);
rd.drawImage(kn, 420, 250, null);
rd.drawString("Mute Sound Effects", 462, 276);
}
if (flipo == 1) {
rd.setFont(new Font("SansSerif", 1, 13));
FontHandler.fMetrics = rd.getFontMetrics();
drawcs(20, "Main Game Controls", 0, 0, 0, 3);
rd.drawString("Drive your car using the Arrow Keys:", 60, 55);
rd.drawString("On the GROUND Spacebar is for Handbrake", 60, 76);
rd.drawImage(space, 106, 90, null);
rd.drawImage(arrows, 440, 58, null);
rd.setFont(new Font("SansSerif", 1, 11));
FontHandler.fMetrics = rd.getFontMetrics();
rd.drawString("Accelerate", 450, 54);
rd.drawString("Brake/Reverse", 441, 132);
rd.drawString("Turn left", 389, 110);
rd.drawString("Turn right", 525, 110);
rd.drawString("Handbrake", 182, 109);
drawcs(150, "--------------------------------------------------------------------------------"
+ "--------------------------------------------------------------------", 0, 0, 0, 3);
rd.setFont(new Font("SansSerif", 1, 13));
FontHandler.fMetrics = rd.getFontMetrics();
rd.drawString("To perform stunts:", 60, 175);
rd.drawString("In the AIR press combo Spacebar + Arrow Keys :", 60, 195);
rd.drawImage(space, 120, 220, null);
rd.drawImage(plus, 340, 223, null);
rd.drawImage(arrows, 426, 188, null);
rd.setFont(new Font("SansSerif", 1, 11));
FontHandler.fMetrics = rd.getFontMetrics();
rd.setColor(new Color(0, 0, 0));
rd.drawString("Forward Loop", 427, 184);
rd.drawString("Backward Loop", 425, 262);
rd.drawString("Left Roll", 378, 240);
rd.drawString("Right Roll", 511, 240);
rd.drawString("Spacebar", 201, 239);
rd.drawImage(stunts, 60, 260, null);
}
if (flipo >= 1 && flipo <= 13) {
rd.drawImage(next[pnext], 600, 370, null);
}
if (flipo >= 3 && flipo <= 15) {
rd.drawImage(back[pback], 10, 370, null);
}
if (flipo == 15) {
rd.drawImage(contin[pcontin], 500, 370, null);
}
if (control.enter || control.right) {
if (flipo >= 1 && flipo <= 13) {
flipo++;
}
if (control.enter && flipo == 15) {
opselect=0;
flipo = 0;
fase = oldfase;
rd.setFont(new Font("SansSerif", 1, 11));
FontHandler.fMetrics = rd.getFontMetrics();
}
control.enter = false;
control.right = false;
}
if (control.left) {
if (flipo >= 3 && flipo <= 15) {
flipo -= 3;
}
control.left = false;
}
}
public void fleximage(Image image, int i, int j) {
if (i == 0) {
PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, 670, 400, flexpix, 0, 670);
try {
pixelgrabber.grabPixels();
} catch (InterruptedException _ex) {
}
}
int k = 0;
int l = 0;
int i1 = 0;
int j1 = 0;
int k1 = (int) (Math.random() * 128D);
int l1 = (int) (5D + Math.random() * 15D);
int i2 = 0;
do {
Color color = new Color(flexpix[i2]);
int j2 = 0;
int k2 = 0;
int l2 = 0;
if (k == 0) {
j2 = color.getRed();
l = j2;
k2 = color.getGreen();
i1 = k2;
l2 = color.getBlue();
j1 = l2;
} else {
j2 = (int) ((color.getRed() + l * 0.38F * i) / (1.0F + 0.38F * i));
l = j2;
k2 = (int) ((color.getGreen() + i1 * 0.38F * i) / (1.0F + 0.38F * i));
i1 = k2;
l2 = (int) ((color.getBlue() + j1 * 0.38F * i) / (1.0F + 0.38F * i));
j1 = l2;
}
if (++k == 670) {
k = 0;
}
int i3 = (j2 * 17 + k2 + l2 + k1) / 22;
int j3 = (k2 * 17 + j2 + l2 + k1) / 22;
int k3 = (l2 * 17 + j2 + k2 + k1) / 22;
if (j == 17) {
i3 = (j2 * 17 + k2 + l2 + k1) / 22;
j3 = (k2 * 17 + j2 + l2 + k1) / 21;
k3 = (l2 * 17 + j2 + k2 + k1) / 20;
}
if (--l1 == 0) {
k1 = (int) (Math.random() * 128D);
l1 = (int) (5D + Math.random() * 15D);
}
Color color1 = new Color(i3, j3, k3);
flexpix[i2] = color1.getRGB();
} while (++i2 < 0x416e0);
fleximg = createImage(new MemoryImageSource(670, 400, flexpix, 0, 670));
rd.drawImage(fleximg, 0, 0, null);
}
private void arrow(int i, int j, CheckPoints checkpoints, ContO conto[], boolean flag) {
int ai[] = new int[7];
int ai1[] = new int[7];
int ai2[] = new int[7];
/**
* x resolution divided by two converted to hex
* http://www.binaryhexconverter.com/decimal-to-hex-converter
*/
char c = '\u014F';
byte byte0 = -90;
/**
* x resolution plus 30 converted to hex?
* http://www.binaryhexconverter.com/decimal-to-hex-converter
*/
char c1 = '\u02BC';
int k = 0;
do {
ai1[k] = byte0;
} while (++k < 7);
ai[0] = c;
ai2[0] = c1 + 110;
ai[1] = c - 35;
ai2[1] = c1 + 50;
ai[2] = c - 15;
ai2[2] = c1 + 50;
ai[3] = c - 15;
ai2[3] = c1 - 50;
ai[4] = c + 15;
ai2[4] = c1 - 50;
ai[5] = c + 15;
ai2[5] = c1 + 50;
ai[6] = c + 35;
ai2[6] = c1 + 50;
k = 0;
int l = 0;
if (!flag) {
char c2 = '\0';
if (checkpoints.x[i] - checkpoints.opx[0] >= 0) {
c2 = '\264';
}
k = (int) (90 + c2 + Math.atan(
(double) (checkpoints.z[i] - checkpoints.opz[0]) / (double) (checkpoints.x[i] - checkpoints.opx[0]))
/ 0.017453292519943295D);
} else {
int k1 = -1;
boolean flag1 = false;
int l2 = 1;
do {
if ((Utility.py(checkpoints.opx[0] / 100, checkpoints.opx[l2] / 100, checkpoints.opz[0] / 100,
checkpoints.opz[l2] / 100) < k1 || k1 == -1) && (!flag1 || checkpoints.onscreen[l2] != 0)
&& checkpoints.dested[l2] == 0) {
l = l2;
k1 = Utility.py(checkpoints.opx[0] / 100, checkpoints.opx[l2] / 100, checkpoints.opz[0] / 100,
checkpoints.opz[l2] / 100);
if (checkpoints.onscreen[l2] != 0) {
flag1 = true;
}
}
} while (++l2 < 7);
l2 = 0;
if (checkpoints.opx[l] - checkpoints.opx[0] >= 0) {
l2 = 180;
}
k = (int) (90 + l2 + Math.atan((double) (checkpoints.opz[l] - checkpoints.opz[0])
/ (double) (checkpoints.opx[l] - checkpoints.opx[0])) / 0.017453292519943295D);
drawcs(13, "[ ]", 76, 67, 240, 0);
drawcs(13, names[sc[l]], 0, 0, 0, 0);
/*