-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtorcs-1.3.1-mac.diff
812 lines (748 loc) · 27.4 KB
/
torcs-1.3.1-mac.diff
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
Only in torcs-1.3.1-mac: .DS_Store
Only in torcs-1.3.1-mac: MacTorcs
diff -ru torcs-1.3.1/data/tracks/aalborg/Makefile torcs-1.3.1-mac/data/tracks/aalborg/Makefile
--- torcs-1.3.1/data/tracks/aalborg/Makefile 2005-03-21 22:14:06.000000000 +0100
+++ torcs-1.3.1-mac/data/tracks/aalborg/Makefile 2010-06-16 00:23:09.000000000 +0200
@@ -25,7 +25,7 @@
tr-curb-bw-aa-r.rgb grass-aa.rgb tr-g-to-asphalt-aa-l_n.rgb tr-grass-aa-l_n.rgb \
tr-asphalt-2-aa-r_n.rgb tr-asphalt-aa-bw2-e_n.rgb tr-asphalt-aa-bw2_n.rgb \
tarmac-wall-1-g2.rgb tr-asphalt-to-g-aa-l_n.rgb tr-asphalt-aa-bw2-s_n.rgb \
- aalborg.png background.png
+ background.png
data-tracks-road_PKGFILES = $(DATA)
diff -ru torcs-1.3.1/data/tracks/road/alpine-2/Makefile torcs-1.3.1-mac/data/tracks/road/alpine-2/Makefile
--- torcs-1.3.1/data/tracks/road/alpine-2/Makefile 2008-06-05 01:09:11.000000000 +0200
+++ torcs-1.3.1-mac/data/tracks/road/alpine-2/Makefile 2010-06-16 00:23:09.000000000 +0200
@@ -23,7 +23,7 @@
arbor2_n.rgb concrete2.rgb shadow2.rgb tr-stone-wall.rgb truck_arbor_berniw_n.rgb \
truck_arbor_dummy_n.rgb truck_arbor_hymie_n.rgb truck_arbor_inferno_n.rgb \
truck_arbor_mouse_n.rgb truck_arbor_ole_n.rgb truck_arbor_speedy_n.rgb \
- truck_arbor_tp_n.rgb truck_arbor_usr_n.rgb alpine-2.png armco2_arbor.png \
+ truck_arbor_tp_n.rgb truck_arbor_usr_n.rgb armco2_arbor.png \
armco_snow_arbor.png armcoturn_arbor.png background.png BARS_tree_n.png BLBDBK.png \
BLDG05_tree.png brick01.png cliff.png CMNTA.png concdark.png CONCRE.png \
concrete01.png concwall2.png concwall.png GRDRA_tree_n.png ice.png LOGOMELA.png \
diff -ru torcs-1.3.1/data/tracks/road/forza/Makefile torcs-1.3.1-mac/data/tracks/road/forza/Makefile
--- torcs-1.3.1/data/tracks/road/forza/Makefile 2008-02-24 13:55:08.000000000 +0100
+++ torcs-1.3.1-mac/data/tracks/road/forza/Makefile 2010-06-16 00:23:09.000000000 +0200
@@ -23,7 +23,7 @@
100.png 300.png ABtree_n.png background.png BAtree_n.png BEtree_n.png \
BLBDBK.png BLDAB.png BLDA.png BLUPOLE.png BRtree_n.png BTOWB.png BUtree_n.png \
CAtree_n.png CHtree_n.png CMNTA.png CMNTBB.png CMNTB.png conc.png CONCTP.png CRNA.png \
- CRNB.png CRNC.png CRND.png CRNF.png DBLOGO.png FERRED.png FLTBLK.png FNCEB.png forza.png \
+ CRNB.png CRNC.png CRND.png CRNF.png DBLOGO.png FERRED.png FLTBLK.png FNCEB.png \
FRRI.png FRtree_n.png G2tree_n.png GBtree_n.png GCtree_n.png GDtree_n.png GEtree_n.png \
GFtree_n.png GGtree.png GNtree_n.png GRAS2B.png GRtree_n.png GSBLUE.png GSBSTAIR.png \
GSDH.png GSPAtree.png GSRNDF.png GSSOLID.png GStree_n.png GSUNDER.png ITtree_n.png \
diff -ru torcs-1.3.1/data/tracks/road/ruudskogen/Makefile torcs-1.3.1-mac/data/tracks/road/ruudskogen/Makefile
--- torcs-1.3.1/data/tracks/road/ruudskogen/Makefile 2006-08-19 23:52:07.000000000 +0200
+++ torcs-1.3.1-mac/data/tracks/road/ruudskogen/Makefile 2010-06-16 00:23:09.000000000 +0200
@@ -20,7 +20,7 @@
DATADIR = tracks/road/$(TRACK)
DATA = $(TRACK).xml $(TRACK).acc $(TRACK).png readme.txt background.png shadow2.rgb \
- env.png arb01_n.png arb02_n.png background.png dekk01.png grass01.png \
+ env.png arb01_n.png arb02_n.png dekk01.png grass01.png \
grass02.png hus02.png hytte01.png lave01.png lave02.png rk_tree_1_n.png \
rk_tree_2_n.png rk_tree_3_n.png road01-dashlines.png road01-pitentry.png \
road01-pits_n.png road01.png road02.png road03.png road-edge.png \
diff -ru torcs-1.3.1/data/tracks/road/wheel-2/Makefile torcs-1.3.1-mac/data/tracks/road/wheel-2/Makefile
--- torcs-1.3.1/data/tracks/road/wheel-2/Makefile 2008-02-24 15:24:44.000000000 +0100
+++ torcs-1.3.1-mac/data/tracks/road/wheel-2/Makefile 2010-06-16 00:23:09.000000000 +0200
@@ -24,7 +24,7 @@
background.png building1.png building2.png clkdtm.png girder_tree_n.png grass.png \
rmbl.png sand.png sbridge2.png shadow2.png sign1.png sign2.png sign3.png swall2.png \
tirewall.png tr-barrier.png tr-barrier-tree_n.png treeg11_n.png treeline.png \
- tree_n.png tr-spec.png truck_arbor_ctd_n.png water_green2.png wheel-2.png wheel.png \
+ tree_n.png tr-spec.png truck_arbor_ctd_n.png water_green2.png wheel.png \
barr1_n.rgb concdal.rgb shadow2.rgb texwheel.rgb torcs1.rgb truck0.rgb
diff -ru torcs-1.3.1/src/drivers/olethros/driver.cpp torcs-1.3.1-mac/src/drivers/olethros/driver.cpp
--- torcs-1.3.1/src/drivers/olethros/driver.cpp 2008-05-31 00:18:32.000000000 +0200
+++ torcs-1.3.1-mac/src/drivers/olethros/driver.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -41,6 +41,8 @@
#ifdef WIN32
#include <float.h>
#define isnan _isnan
+#elif defined(__APPLE__)
+#include "isnan.h"
#endif
#undef TEST_PITSTOPS
diff -ru torcs-1.3.1/src/drivers/olethros/geometry.cpp torcs-1.3.1-mac/src/drivers/olethros/geometry.cpp
--- torcs-1.3.1/src/drivers/olethros/geometry.cpp 2006-01-06 16:22:29.000000000 +0100
+++ torcs-1.3.1-mac/src/drivers/olethros/geometry.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -27,6 +27,8 @@
#ifdef WIN32
#include <float.h>
#define isnan _isnan
+#elif defined(__APPLE__)
+#include "isnan.h"
#endif
diff -ru torcs-1.3.1/src/libs/client/splash.cpp torcs-1.3.1-mac/src/libs/client/splash.cpp
--- torcs-1.3.1/src/libs/client/splash.cpp 2008-08-16 16:58:51.000000000 +0200
+++ torcs-1.3.1-mac/src/libs/client/splash.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -20,7 +20,11 @@
#include <windows.h>
#define HAVE_CONFIG_H
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
diff -ru torcs-1.3.1/src/libs/learning/policy.cpp torcs-1.3.1-mac/src/libs/learning/policy.cpp
--- torcs-1.3.1/src/libs/learning/policy.cpp 2005-09-19 14:48:03.000000000 +0200
+++ torcs-1.3.1-mac/src/libs/learning/policy.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -18,7 +18,9 @@
#ifdef WIN32
#include <float.h>
#define isnan _isnan
-#endif // WIN32
+#elif defined(__APPLE__)
+#include "isnan.h"
+#endif
#undef POLICY_LOG
diff -ru torcs-1.3.1/src/libs/tgfclient/fg_gm.cpp torcs-1.3.1-mac/src/libs/tgfclient/fg_gm.cpp
--- torcs-1.3.1/src/libs/tgfclient/fg_gm.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/libs/tgfclient/fg_gm.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -42,8 +42,13 @@
2004/10/03 Bernhard Wymann: Added Randr support, bugfixes.
*/
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
#include <GL/gl.h>
#include <GL/glu.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -51,7 +56,7 @@
#include <tgfclient.h>
#include "fg_gm.h"
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
#include <GL/glx.h>
#include <X11/Xlib.h>
@@ -468,7 +473,7 @@
*/
void fglutGameModeString( const char* string )
{
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
int width = 640, height = 480, depth = 16, refresh = 72;
/*
@@ -501,7 +506,7 @@
*/
int fglutEnterGameMode( void )
{
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
/*
* Remember the current resolution, etc.
*/
@@ -529,7 +534,7 @@
*/
void fglutLeaveGameMode( void )
{
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
/*
* Then, have the desktop visual settings restored
*/
diff -ru torcs-1.3.1/src/libs/tgfclient/glfeatures.h torcs-1.3.1-mac/src/libs/tgfclient/glfeatures.h
--- torcs-1.3.1/src/libs/tgfclient/glfeatures.h 2005-08-05 11:26:39.000000000 +0200
+++ torcs-1.3.1-mac/src/libs/tgfclient/glfeatures.h 2010-06-16 00:23:09.000000000 +0200
@@ -28,14 +28,16 @@
#ifndef _GRFEATURES_H_
#define _GRFEATURES_H_
-#ifdef WIN32
-#include <windows.h>
-#include <GL/gl.h>
-#include <GL/glext.h>
-#else
-#include <GL/gl.h>
-#endif // WIN32
-
+#ifdef WIN32
+#include <windows.h>
+#include <GL/gl.h>
+#include <GL/glext.h>
+#elif defined(__APPLE__)
+#include <OpenGL/gl.h>
+#else
+#include <GL/gl.h>
+#endif // WIN32
+
#include <tgfclient.h>
#include <graphic.h>
diff -ru torcs-1.3.1/src/libs/tgfclient/gui.cpp torcs-1.3.1-mac/src/libs/tgfclient/gui.cpp
--- torcs-1.3.1/src/libs/tgfclient/gui.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/libs/tgfclient/gui.cpp 2010-06-16 02:51:58.000000000 +0200
@@ -249,6 +249,11 @@
int modifier;
tGfuiObject *obj;
+#ifdef __APPLE__
+ /* work around GLUT bug on OS X which swaps the delete and backspace keys */
+ if (key == 8) key = 127;
+ else if (key == 127) key = 8;
+#endif
modifier = glutGetModifiers();
/* user preempt key */
@@ -322,6 +327,11 @@
tGfuiKey *curKey;
int modifier;
+#ifdef __APPLE__
+ /* work around GLUT bug on OS X which swaps the delete and backspace keys */
+ if (key == 8) key = 127;
+ else if (key == 127) key = 8;
+#endif
modifier = glutGetModifiers();
/* user preempt key */
diff -ru torcs-1.3.1/src/libs/tgfclient/guifont.cpp torcs-1.3.1-mac/src/libs/tgfclient/guifont.cpp
--- torcs-1.3.1/src/libs/tgfclient/guifont.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/libs/tgfclient/guifont.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -24,7 +24,7 @@
#ifdef WIN32
#include <windows.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__APPLE__)
#include <machine/endian.h>
#else
#include <endian.h>
diff -ru torcs-1.3.1/src/libs/tgfclient/guimenu.cpp torcs-1.3.1-mac/src/libs/tgfclient/guimenu.cpp
--- torcs-1.3.1/src/libs/tgfclient/guimenu.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/libs/tgfclient/guimenu.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -29,7 +29,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <tgfclient.h>
#include "gui.h"
diff -ru torcs-1.3.1/src/libs/tgfclient/img.cpp torcs-1.3.1-mac/src/libs/tgfclient/img.cpp
--- torcs-1.3.1/src/libs/tgfclient/img.cpp 2006-10-29 16:55:33.000000000 +0100
+++ torcs-1.3.1-mac/src/libs/tgfclient/img.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -28,7 +28,11 @@
#include <windows.h>
#endif
+#ifdef __APPLE__
+#include <libpng/png.h>
+#else
#include "png.h"
+#endif
#include <tgfclient.h>
#include <stdlib.h>
diff -ru torcs-1.3.1/src/libs/tgfclient/screen.cpp torcs-1.3.1-mac/src/libs/tgfclient/screen.cpp
--- torcs-1.3.1/src/libs/tgfclient/screen.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/libs/tgfclient/screen.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -27,7 +27,12 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+ #include <CoreFoundation/CoreFoundation.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <math.h>
#ifndef WIN32
#include <unistd.h>
@@ -248,6 +253,19 @@
int maxfreq;
int i, depth;
+#ifdef __APPLE__
+ /* glutInit chdirs into the resource directory, but GfScrInit attempts to access the config
+ files before calling it. Set the working directory in advance, so that the configuration
+ files can be found. We could also move glutInit here on OS X. */
+ char *resPath;
+ CFURLRef resDir = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
+ resPath = (char *)malloc(4096);
+ CFURLGetFileSystemRepresentation(resDir, true, (UInt8 *)resPath, 4096);
+ chdir(resPath);
+ free(resPath);
+ CFRelease(resDir);
+#endif
+
sprintf(buf, "%s%s", GetLocalDir(), GFSCR_CONF_FILE);
handle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
xw = (int)GfParmGetNum(handle, GFSCR_SECT_PROP, GFSCR_ATT_X, (char*)NULL, 640);
@@ -487,7 +505,7 @@
static const int CMDSIZE = 1024;
char cmd[CMDSIZE];
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
char *arg[8];
int curArg;
#endif
@@ -515,6 +533,24 @@
#else
GfScrShutdown();
+#ifdef __APPLE__
+ /* On Mac OS X, a multithreaded process cannot call exec. Therefore, we fork first. */
+ CFURLRef binUrl = CFBundleCopyExecutableURL(CFBundleGetMainBundle());
+ CFURLGetFileSystemRepresentation(binUrl, true, (UInt8 *)cmd, sizeof(cmd));
+ CFRelease(binUrl);
+ pid_t pid = fork();
+ if (pid == 0) { /* child */
+ execl(cmd, cmd, NULL);
+ perror("exec failed");
+ exit(1);
+ }
+ else if (pid > 0) { /* parent */
+ exit(0);
+ }
+ perror("fork failed");
+ exit(1);
+#else
+
sprintf (cmd, "%storcs-bin", GetLibDir ());
memset (arg, 0, sizeof (arg));
curArg = 0;
@@ -567,8 +603,8 @@
break;
}
-
-#endif
+#endif // __APPLE__
+#endif // WIN32
if (retcode) {
perror("torcs");
exit(1);
diff -ru torcs-1.3.1/src/libs/tgfclient/tgfclient.h torcs-1.3.1-mac/src/libs/tgfclient/tgfclient.h
--- torcs-1.3.1/src/libs/tgfclient/tgfclient.h 2008-08-16 16:12:08.000000000 +0200
+++ torcs-1.3.1-mac/src/libs/tgfclient/tgfclient.h 2010-06-16 00:23:09.000000000 +0200
@@ -28,7 +28,11 @@
#define __TGFCLIENT__H__
#include <tgf.h>
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <js.h>
#include <screen_properties.h>
diff -ru torcs-1.3.1/src/linux/main.cpp torcs-1.3.1-mac/src/linux/main.cpp
--- torcs-1.3.1/src/linux/main.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/linux/main.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -19,7 +19,11 @@
#include <stdlib.h>
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <tgfclient.h>
#include <client.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/OpenalSoundInterface.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/OpenalSoundInterface.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/OpenalSoundInterface.cpp 2006-01-05 10:53:37.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/OpenalSoundInterface.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -164,7 +164,7 @@
void OpenalSoundInterface::setNCars(int n_cars)
{
engpri = new SoundPri[n_cars];
- car_src = new SoundSource[n_cars];
+ car_src = new TorcsSoundSource[n_cars];
}
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/PlibSoundInterface.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/PlibSoundInterface.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/PlibSoundInterface.cpp 2005-11-18 01:20:32.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/PlibSoundInterface.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -60,7 +60,7 @@
void PlibSoundInterface::setNCars(int n_cars)
{
engpri = new SoundPri[n_cars];
- car_src = new SoundSource[n_cars];
+ car_src = new TorcsSoundSource[n_cars];
}
slScheduler* PlibSoundInterface::getScheduler()
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/SoundInterface.h torcs-1.3.1-mac/src/modules/graphic/ssggraph/SoundInterface.h
--- torcs-1.3.1/src/modules/graphic/ssggraph/SoundInterface.h 2005-11-18 01:20:32.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/SoundInterface.h 2010-06-16 00:23:09.000000000 +0200
@@ -241,8 +241,8 @@
slScheduler* sched;
std::vector<TorcsSound*> sound_list;
SoundPri* engpri;
- SoundSource* car_src;
- SoundSource tyre_src[4];
+ TorcsSoundSource* car_src;
+ TorcsSoundSource tyre_src[4];
void DopplerShift (SoundChar* sound, float* p_src, float* u_src, float* p, float* u);
void SetMaxSoundCar(CarSoundData** car_sound_data, QueueSoundMap* smap);
float global_gain;
@@ -274,8 +274,8 @@
float a; //amplitude modulation
} SoundChar;
protected:
- SoundSource* car_src;
- SoundSource tyre_src[4];
+ TorcsSoundSource* car_src;
+ TorcsSoundSource tyre_src[4];
ALCcontext* cc;
ALCdevice* dev;
float global_gain;
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/TorcsSound.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/TorcsSound.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/TorcsSound.cpp 2005-11-18 01:20:32.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/TorcsSound.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -186,7 +186,7 @@
}
/// Create a sound source
-SoundSource::SoundSource()
+TorcsSoundSource::TorcsSoundSource()
{
a = 0.0;
f = 1.0;
@@ -198,7 +198,7 @@
* At the moment this
*/
-void SoundSource::update()
+void TorcsSoundSource::update()
{
// Get relative speed/position vector
sgVec3 u;
@@ -259,7 +259,7 @@
/** Set source position and velocity.
*/
-void SoundSource::setSource(sgVec3 p, sgVec3 u)
+void TorcsSoundSource::setSource(sgVec3 p, sgVec3 u)
{
for (int i=0; i<3; i++) {
p_src[i] = p[i];
@@ -269,7 +269,7 @@
/** Set listener position and velocity.
*/
-void SoundSource::setListener (sgVec3 p, sgVec3 u)
+void TorcsSoundSource::setListener (sgVec3 p, sgVec3 u)
{
for (int i=0; i<3; i++) {
p_lis[i] = p[i];
@@ -330,7 +330,11 @@
ALenum format;
ALboolean srcloop;
+#ifdef __APPLE__
+ alutLoadWAVFile((ALbyte *) filename, &format, &wave, &size, &freq);
+#else
alutLoadWAVFile((ALbyte *) filename, &format, &wave, &size, &freq, &srcloop);
+#endif
error = alGetError();
if (error != AL_NO_ERROR) {
printf("OpenAL Error: %d, could not load %s\n", error, filename);
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/TorcsSound.h torcs-1.3.1-mac/src/modules/graphic/ssggraph/TorcsSound.h
--- torcs-1.3.1/src/modules/graphic/ssggraph/TorcsSound.h 2005-11-18 01:20:32.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/TorcsSound.h 2010-06-16 00:23:09.000000000 +0200
@@ -26,9 +26,15 @@
#include <plib/sg.h>
#include <plib/sl.h>
+#ifdef __APPLE__
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
+#include <freealut/alut.h>
+#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alut.h>
+#endif
#include "sound_defines.h"
class SoundInterface;
@@ -136,7 +142,7 @@
* principle possible to implement multiple listeners, something which
* should be extremely useful for same-computer multiplayer games.
*/
-class SoundSource {
+class TorcsSoundSource {
public:
sgVec3 p_lis; ///< listener position for this source
sgVec3 u_lis; ///< listener velocity for this source
@@ -145,7 +151,7 @@
float a; ///< Environmental attenuation
float f; ///< Environmental frequency shift
float lp; ///< Environmental filtering
- SoundSource();
+ TorcsSoundSource();
void update();
void setSource(sgVec3 p, sgVec3 u);
void setListener (sgVec3 p, sgVec3 u);
@@ -174,7 +180,7 @@
public:
OpenalTorcsSound(const char* filename,
OpenalSoundInterface* sitf,
- int flags = (ACTIVE_VOLUME|ACTIVE_PITCH),
+ int flags = (ACTIVE_VOLUME|ACTIVE_PITCH),
bool loop = false, bool static_pool = true);
virtual ~OpenalTorcsSound();
virtual void setVolume(float vol);
@@ -182,7 +188,7 @@
virtual void setLPFilter(float lp);
virtual void setSource(sgVec3 p, sgVec3 u);
virtual void getSource (sgVec3 p, sgVec3 u);
- virtual void setReferenceDistance (float dist);
+ virtual void setReferenceDistance (float dist);
//virtual void setListener (sgVec3 p, sgVec3 u);
virtual void play();
virtual void start();
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grcam.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grcam.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grcam.cpp 2007-11-06 21:43:31.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grcam.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -21,11 +21,16 @@
#include <stdlib.h>
#include <math.h>
#include <memory.h>
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
+#endif
#include <plib/ssg.h>
#include <robottools.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grcar.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grcar.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grcar.cpp 2008-08-24 21:26:46.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grcar.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -26,7 +26,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grcarlight.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grcarlight.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grcarlight.cpp 2008-08-29 01:24:54.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grcarlight.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -25,7 +25,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grmain.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grmain.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grmain.cpp 2005-08-05 11:48:29.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grmain.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -23,7 +23,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grscene.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grscene.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grscene.cpp 2006-02-20 21:16:09.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grscene.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -28,7 +28,11 @@
#include <GL/gl.h>
#include <GL/glext.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <plib/ssgAux.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grskidmarks.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grskidmarks.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grskidmarks.cpp 2005-12-25 02:22:06.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grskidmarks.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -26,7 +26,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grsmoke.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grsmoke.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grsmoke.cpp 2005-07-21 23:27:15.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grsmoke.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -24,7 +24,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grtrackmap.h torcs-1.3.1-mac/src/modules/graphic/ssggraph/grtrackmap.h
--- torcs-1.3.1/src/modules/graphic/ssggraph/grtrackmap.h 2005-08-05 11:48:30.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grtrackmap.h 2010-06-16 00:23:09.000000000 +0200
@@ -29,9 +29,15 @@
#include <car.h>
#include <raceman.h>
-#include <GL/gl.h>
-#include <GL/glut.h>
-#include <GL/glu.h>
+#ifdef __APPLE__
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
+ #include <GLUT/glut.h>
+#else
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #include <GL/glut.h>
+#endif
#ifndef WIN32
#include <unistd.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grutil.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grutil.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grutil.cpp 2008-11-09 18:50:22.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grutil.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -25,7 +25,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <plib/ssg.h>
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/grvtxtable.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/grvtxtable.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/grvtxtable.cpp 2005-09-19 21:00:57.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/grvtxtable.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -31,7 +31,11 @@
#include "grscene.h"
#include "grcar.h"
#include "grutil.h"
+#ifdef __APPLE__
+#include <OpenGL/glu.h>
+#else
#include <GL/glu.h>
+#endif
/* from grloadac.cpp (beuark!) */
extern double shad_xmax;
diff -ru torcs-1.3.1/src/modules/graphic/ssggraph/ssggraph.cpp torcs-1.3.1-mac/src/modules/graphic/ssggraph/ssggraph.cpp
--- torcs-1.3.1/src/modules/graphic/ssggraph/ssggraph.cpp 2005-02-01 20:08:19.000000000 +0100
+++ torcs-1.3.1-mac/src/modules/graphic/ssggraph/ssggraph.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -20,7 +20,11 @@
#ifdef WIN32
#include <windows.h>
#endif
-#include <GL/gl.h>
+#ifdef __APPLE__
+ #include <OpenGL/gl.h>
+#else
+ #include <GL/gl.h>
+#endif
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/modules/simu/simuv2/SOLID-2.0/src/C-api.cpp torcs-1.3.1-mac/src/modules/simu/simuv2/SOLID-2.0/src/C-api.cpp
--- torcs-1.3.1/src/modules/simu/simuv2/SOLID-2.0/src/C-api.cpp 2006-04-28 01:33:35.000000000 +0200
+++ torcs-1.3.1-mac/src/modules/simu/simuv2/SOLID-2.0/src/C-api.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -23,10 +23,10 @@
Eindhoven University of Technology
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/
-
-#ifdef _MSC_VER
-#pragma warning(disable:4786) // identifier was truncated to '255'
-#endif // _MSC_VER
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786) // identifier was truncated to '255'
+#endif // _MSC_VER
#include <SOLID/solid.h>
@@ -44,7 +44,7 @@
#include "Polyhedron.h"
#include "Response.h"
#include "RespTable.h"
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
# include <sys/types.h>
#endif
diff -ru torcs-1.3.1/src/tools/texmapper/maintexmapper.cpp torcs-1.3.1-mac/src/tools/texmapper/maintexmapper.cpp
--- torcs-1.3.1/src/tools/texmapper/maintexmapper.cpp 2008-11-09 18:50:23.000000000 +0100
+++ torcs-1.3.1-mac/src/tools/texmapper/maintexmapper.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -28,7 +28,11 @@
#include <getopt.h>
#include <math.h>
#include <plib/ssg.h>
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <tgfclient.h>
diff -ru torcs-1.3.1/src/tools/trackgen/maintrackgen.cpp torcs-1.3.1-mac/src/tools/trackgen/maintrackgen.cpp
--- torcs-1.3.1/src/tools/trackgen/maintrackgen.cpp 2008-11-09 18:50:23.000000000 +0100
+++ torcs-1.3.1-mac/src/tools/trackgen/maintrackgen.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -37,7 +37,11 @@
#include <math.h>
#include <plib/ul.h>
#include <plib/ssg.h>
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <tgfclient.h>
#include <track.h>
diff -ru torcs-1.3.1/src/tools/trackgen/objects.cpp torcs-1.3.1-mac/src/tools/trackgen/objects.cpp
--- torcs-1.3.1/src/tools/trackgen/objects.cpp 2008-11-09 18:50:23.000000000 +0100
+++ torcs-1.3.1-mac/src/tools/trackgen/objects.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -32,7 +32,11 @@
#endif
#include <math.h>
#include <plib/ssg.h>
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <tgfclient.h>
#include <track.h>
diff -ru torcs-1.3.1/src/tools/trackgen/relief.cpp torcs-1.3.1-mac/src/tools/trackgen/relief.cpp
--- torcs-1.3.1/src/tools/trackgen/relief.cpp 2008-11-09 18:50:23.000000000 +0100
+++ torcs-1.3.1-mac/src/tools/trackgen/relief.cpp 2010-06-16 00:23:09.000000000 +0200
@@ -33,7 +33,11 @@
#endif
#include <math.h>
#include <plib/ssg.h>
-#include <GL/glut.h>
+#ifdef __APPLE__
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glut.h>
+#endif
#include <tgfclient.h>
#include <track.h>