Browse Source

fixed timer bug. enabled more fastcard options.

Thomas Buck 10 years ago
parent
commit
bd830f9eaa
2 changed files with 16 additions and 28 deletions
  1. 6
    0
      ChangeLog
  2. 10
    28
      src/System.cpp

+ 6
- 0
ChangeLog View File

5
 
5
 
6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7
 
7
 
8
+	[ 20140215 ]
9
+	* Enabled previously disabled polygon smoothing & color material
10
+	  when setting fastcard to true
11
+	* Fixed bug in system timer millisecond conversion
12
+	* Extended rc_get_bool to also accept 0 or 1 besides true and false
13
+
8
 	[ 20140210 ]
14
 	[ 20140210 ]
9
 	* Finished the Tomb Raider 1 Item/State definitions
15
 	* Finished the Tomb Raider 1 Item/State definitions
10
 	* Ported to SDL2 and SDL2-TTF using the Migration Guide:
16
 	* Ported to SDL2 and SDL2-TTF using the Migration Guide:

+ 10
- 28
src/System.cpp View File

32
 #include <memory_test.h>
32
 #include <memory_test.h>
33
 #endif
33
 #endif
34
 
34
 
35
+#include <MatMath.h>
35
 #include <System.h>
36
 #include <System.h>
36
 
37
 
37
 ////////////////////////////////////////////////////////////
38
 ////////////////////////////////////////////////////////////
507
     {
508
     {
508
         glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
509
         glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
509
         glHint(GL_FOG_HINT, GL_NICEST);
510
         glHint(GL_FOG_HINT, GL_NICEST);
510
-        glDisable(GL_COLOR_MATERIAL);
511
+        glEnable(GL_COLOR_MATERIAL);
511
         glEnable(GL_DITHER);
512
         glEnable(GL_DITHER);
512
 
513
 
513
         // AA polygon edges
514
         // AA polygon edges
514
-        //glEnable(GL_POLYGON_SMOOTH);
515
-        //glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
515
+        glEnable(GL_POLYGON_SMOOTH);
516
+        glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
516
 
517
 
517
         glEnable(GL_POINT_SMOOTH);
518
         glEnable(GL_POINT_SMOOTH);
519
+        glEnable(GL_FOG);
518
     }
520
     }
519
     else
521
     else
520
     {
522
     {
563
     // gluPerspective is deprecated!
565
     // gluPerspective is deprecated!
564
     // gluPerspective(m_fovY, ((GLdouble)w)/((GLdouble)h), m_clipNear, m_clipFar);
566
     // gluPerspective(m_fovY, ((GLdouble)w)/((GLdouble)h), m_clipNear, m_clipFar);
565
     // Fix: http://stackoverflow.com/a/2417756
567
     // Fix: http://stackoverflow.com/a/2417756
566
-    GLfloat fH = tanf(m_fovY / 360.0f * 3.14159f) * m_clipNear;
568
+    GLfloat fH = tanf(m_fovY * HEL_PI / 360.0f) * m_clipNear;
567
     GLfloat fW = fH * ((GLfloat)w)/((GLfloat)h);
569
     GLfloat fW = fH * ((GLfloat)w)/((GLfloat)h);
568
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
570
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
569
 
571
 
624
         return -1;
626
         return -1;
625
     }
627
     }
626
 
628
 
627
-    if (strncmp(buffer, "true", 4) == 0)
629
+    if ((strncmp(buffer, "true", 4) == 0) || (buffer[0] == '1'))
628
         *val = true;
630
         *val = true;
629
-    else if (strncmp(buffer, "false", 5) == 0)
631
+    else if ((strncmp(buffer, "false", 5) == 0) || (buffer[0] == '0'))
630
         *val = false;
632
         *val = false;
631
     else
633
     else
632
         return -2;
634
         return -2;
639
 {
641
 {
640
     static struct timeval start;
642
     static struct timeval start;
641
     static struct timeval stop;
643
     static struct timeval stop;
642
-    static struct timeval total;
643
     static struct timezone tz;
644
     static struct timezone tz;
644
 
645
 
645
 
646
 
647
     {
648
     {
648
         case 0:
649
         case 0:
649
             gettimeofday(&start, &tz);
650
             gettimeofday(&start, &tz);
650
-            total.tv_sec = 0;
651
-            total.tv_usec = 0;
652
             break;
651
             break;
653
         case 1:
652
         case 1:
654
             gettimeofday(&stop, &tz);
653
             gettimeofday(&stop, &tz);
655
 
654
 
656
             if (start.tv_usec > stop.tv_usec)
655
             if (start.tv_usec > stop.tv_usec)
657
             {
656
             {
658
-#ifdef OBSOLETE
659
-                stop.tv_usec = (1000000 + stop.tv_usec);
660
-#else
661
-                stop.tv_usec = (1000 + stop.tv_usec);
662
-#endif
657
+                stop.tv_usec += 1000000;
663
                 stop.tv_sec--;
658
                 stop.tv_sec--;
664
             }
659
             }
665
 
660
 
666
             stop.tv_usec -= start.tv_usec;
661
             stop.tv_usec -= start.tv_usec;
667
             stop.tv_sec -= start.tv_sec;
662
             stop.tv_sec -= start.tv_sec;
668
 
663
 
669
-#ifdef OBSOLETE
670
-            total.tv_sec += stop.tv_sec;
671
-            total.tv_usec += stop.tv_usec;
672
-
673
-            while (total.tv_usec > 1000000)
674
-            {
675
-                total.tv_usec -= 1000000;
676
-                total.tv_sec++;
677
-            }
678
-
679
-            return total.tv_sec * 1000000 + total.tv_usec;
680
-#else
681
-            return (stop.tv_sec-start.tv_sec)*1000+(stop.tv_usec-start.tv_usec)/1000;
682
-#endif
664
+            return ((stop.tv_sec - start.tv_sec) * 1000) + ((stop.tv_usec - start.tv_usec) / 1000);
683
     }
665
     }
684
 
666
 
685
     return 0;
667
     return 0;

Loading…
Cancel
Save