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,6 +5,12 @@
5 5
 
6 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 14
 	[ 20140210 ]
9 15
 	* Finished the Tomb Raider 1 Item/State definitions
10 16
 	* Ported to SDL2 and SDL2-TTF using the Migration Guide:

+ 10
- 28
src/System.cpp View File

@@ -32,6 +32,7 @@
32 32
 #include <memory_test.h>
33 33
 #endif
34 34
 
35
+#include <MatMath.h>
35 36
 #include <System.h>
36 37
 
37 38
 ////////////////////////////////////////////////////////////
@@ -507,14 +508,15 @@ void System::initGL()
507 508
     {
508 509
         glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
509 510
         glHint(GL_FOG_HINT, GL_NICEST);
510
-        glDisable(GL_COLOR_MATERIAL);
511
+        glEnable(GL_COLOR_MATERIAL);
511 512
         glEnable(GL_DITHER);
512 513
 
513 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 518
         glEnable(GL_POINT_SMOOTH);
519
+        glEnable(GL_FOG);
518 520
     }
519 521
     else
520 522
     {
@@ -563,7 +565,7 @@ void System::resizeGL(unsigned int w, unsigned int h)
563 565
     // gluPerspective is deprecated!
564 566
     // gluPerspective(m_fovY, ((GLdouble)w)/((GLdouble)h), m_clipNear, m_clipFar);
565 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 569
     GLfloat fW = fH * ((GLfloat)w)/((GLfloat)h);
568 570
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
569 571
 
@@ -624,9 +626,9 @@ int rc_get_bool(char *buffer, bool *val)
624 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 630
         *val = true;
629
-    else if (strncmp(buffer, "false", 5) == 0)
631
+    else if ((strncmp(buffer, "false", 5) == 0) || (buffer[0] == '0'))
630 632
         *val = false;
631 633
     else
632 634
         return -2;
@@ -639,7 +641,6 @@ unsigned int system_timer(int state)
639 641
 {
640 642
     static struct timeval start;
641 643
     static struct timeval stop;
642
-    static struct timeval total;
643 644
     static struct timezone tz;
644 645
 
645 646
 
@@ -647,39 +648,20 @@ unsigned int system_timer(int state)
647 648
     {
648 649
         case 0:
649 650
             gettimeofday(&start, &tz);
650
-            total.tv_sec = 0;
651
-            total.tv_usec = 0;
652 651
             break;
653 652
         case 1:
654 653
             gettimeofday(&stop, &tz);
655 654
 
656 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 658
                 stop.tv_sec--;
664 659
             }
665 660
 
666 661
             stop.tv_usec -= start.tv_usec;
667 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 667
     return 0;

Loading…
Cancel
Save