Procházet zdrojové kódy

Turned conversion warnings on

Thomas Buck před 10 roky
rodič
revize
1e14ca3d42
10 změnil soubory, kde provedl 41 přidání a 41 odebrání
  1. 1
    1
      Makefile
  2. 3
    3
      src/Particle.cpp
  3. 2
    2
      src/Quaternion.cpp
  4. 1
    1
      src/SDLSystem.cpp
  5. 2
    2
      src/Sound.cpp
  6. 2
    2
      src/System.cpp
  7. 1
    1
      src/Vector3d.cpp
  8. 6
    6
      src/ViewVolume.cpp
  9. 20
    20
      src/World.cpp
  10. 3
    3
      src/tga.cpp

+ 1
- 1
Makefile Zobrazit soubor

88
 WARNINGS+=-Wno-disabled-macro-expansion -Wno-missing-variable-declarations
88
 WARNINGS+=-Wno-disabled-macro-expansion -Wno-missing-variable-declarations
89
 WARNINGS+=-Wno-missing-prototypes -Wno-pedantic
89
 WARNINGS+=-Wno-missing-prototypes -Wno-pedantic
90
 
90
 
91
-WARNINGS+=-Wno-conversion -Wno-sign-conversion -Wno-shorten-64-to-32
91
+WARNINGS+=-Wno-shorten-64-to-32 -Wno-sign-conversion
92
 
92
 
93
 FLAGS_ALL=-std=c++11
93
 FLAGS_ALL=-std=c++11
94
 
94
 

+ 3
- 3
src/Particle.cpp Zobrazit soubor

19
 {
19
 {
20
     setActive(true);
20
     setActive(true);
21
     TextureId(0);
21
     TextureId(0);
22
-    Speed(2000.0, 2000.0, 2000.0);
23
-    Color(1.0, 1.0, 1.0);
24
-    Force(0.0, 0.8, 0.0);
22
+    Speed(2000.0f, 2000.0f, 2000.0f);
23
+    Color(1.0f, 1.0f, 1.0f);
24
+    Force(0.0f, 0.8f, 0.0f);
25
 
25
 
26
     Reset();
26
     Reset();
27
 }
27
 }

+ 2
- 2
src/Quaternion.cpp Zobrazit soubor

78
 
78
 
79
     m[ 8] = 2.0f * (mX*mZ - mW*mY);
79
     m[ 8] = 2.0f * (mX*mZ - mW*mY);
80
     m[ 9] = 2.0f * (mY*mZ + mW*mX);
80
     m[ 9] = 2.0f * (mY*mZ + mW*mX);
81
-    m[10] = 1.0 - 2.0f * (mX*mX + mY*mY);
81
+    m[10] = 1.0f - 2.0f * (mX*mX + mY*mY);
82
     m[11] = 0.0f;
82
     m[11] = 0.0f;
83
 
83
 
84
     m[12] = 0.0f;
84
     m[12] = 0.0f;
157
 
157
 
158
 vec_t Quaternion::magnitude()
158
 vec_t Quaternion::magnitude()
159
 {
159
 {
160
-    return sqrt(dot(*this, *this));
160
+    return sqrtf(dot(*this, *this));
161
 }
161
 }
162
 
162
 
163
 
163
 

+ 1
- 1
src/SDLSystem.cpp Zobrazit soubor

191
     // gluPerspective is deprecated!
191
     // gluPerspective is deprecated!
192
     // gluPerspective(m_fovY, aspect, m_clipNear, m_clipFar);
192
     // gluPerspective(m_fovY, aspect, m_clipNear, m_clipFar);
193
     // fix: http://stackoverflow.com/a/2417756
193
     // fix: http://stackoverflow.com/a/2417756
194
-    GLfloat fH = tan(float(m_fovY / 360.0f * 3.14159f) ) * m_clipNear;
194
+    GLfloat fH = tanf(m_fovY / 360.0f * 3.14159f) * m_clipNear;
195
     GLfloat fW = fH * aspect;
195
     GLfloat fW = fH * aspect;
196
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
196
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
197
 
197
 

+ 2
- 2
src/Sound.cpp Zobrazit soubor

160
         return -3;
160
         return -3;
161
     }
161
     }
162
 
162
 
163
-    alBufferData(mBuffer[mNextBuffer], format, data, size, freq);
163
+    alBufferData(mBuffer[mNextBuffer], format, data, size, static_cast<ALsizei>(freq));
164
 
164
 
165
     alSourcei(mSource[mNextSource], AL_BUFFER, mBuffer[mNextBuffer]);
165
     alSourcei(mSource[mNextSource], AL_BUFFER, mBuffer[mNextBuffer]);
166
 
166
 
234
     }
234
     }
235
 
235
 
236
 
236
 
237
-    alBufferData(mBuffer[mNextBuffer], format, data, size, freq);
237
+    alBufferData(mBuffer[mNextBuffer], format, data, size, static_cast<ALsizei>(freq));
238
 
238
 
239
     alSourcei(mSource[mNextSource], AL_BUFFER, mBuffer[mNextBuffer]);
239
     alSourcei(mSource[mNextSource], AL_BUFFER, mBuffer[mNextBuffer]);
240
 
240
 

+ 2
- 2
src/System.cpp Zobrazit soubor

564
     // gluPerspective is deprecated!
564
     // gluPerspective is deprecated!
565
     // gluPerspective(m_fovY, ((GLdouble)w)/((GLdouble)h), m_clipNear, m_clipFar);
565
     // gluPerspective(m_fovY, ((GLdouble)w)/((GLdouble)h), m_clipNear, m_clipFar);
566
     // Fix: http://stackoverflow.com/a/2417756
566
     // Fix: http://stackoverflow.com/a/2417756
567
-    GLfloat fH = tan(float(m_fovY / 360.0f * 3.14159f)) * m_clipNear;
568
-    GLfloat fW = fH * ((GLdouble)w)/((GLdouble)h);
567
+    GLfloat fH = tanf(m_fovY / 360.0f * 3.14159f) * m_clipNear;
568
+    GLfloat fW = fH * ((GLfloat)w)/((GLfloat)h);
569
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
569
     glFrustum(-fW, fW, -fH, fH, m_clipNear, m_clipFar);
570
 
570
 
571
     glMatrixMode(GL_MODELVIEW);
571
     glMatrixMode(GL_MODELVIEW);

+ 1
- 1
src/Vector3d.cpp Zobrazit soubor

75
 
75
 
76
 vec_t Vector3d::magnitude()
76
 vec_t Vector3d::magnitude()
77
 {
77
 {
78
-    return sqrt(mVec[0]*mVec[0] + mVec[1]*mVec[1] + mVec[2]*mVec[2]);
78
+    return sqrtf(mVec[0]*mVec[0] + mVec[1]*mVec[1] + mVec[2]*mVec[2]);
79
 }
79
 }
80
 
80
 
81
 
81
 

+ 6
- 6
src/ViewVolume.cpp Zobrazit soubor

296
     mFrustum[0][3] = clip[15] - clip[12];
296
     mFrustum[0][3] = clip[15] - clip[12];
297
 
297
 
298
     /* Normalize the result */
298
     /* Normalize the result */
299
-    t = sqrt(mFrustum[0][0] * mFrustum[0][0] +
299
+    t = sqrtf(mFrustum[0][0] * mFrustum[0][0] +
300
             mFrustum[0][1] * mFrustum[0][1] +
300
             mFrustum[0][1] * mFrustum[0][1] +
301
             mFrustum[0][2] * mFrustum[0][2]);
301
             mFrustum[0][2] * mFrustum[0][2]);
302
     mFrustum[0][0] /= t;
302
     mFrustum[0][0] /= t;
311
     mFrustum[1][3] = clip[15] + clip[12];
311
     mFrustum[1][3] = clip[15] + clip[12];
312
 
312
 
313
     /* Normalize the result */
313
     /* Normalize the result */
314
-    t = sqrt(mFrustum[1][0] * mFrustum[1][0] +
314
+    t = sqrtf(mFrustum[1][0] * mFrustum[1][0] +
315
             mFrustum[1][1] * mFrustum[1][1] +
315
             mFrustum[1][1] * mFrustum[1][1] +
316
             mFrustum[1][2] * mFrustum[1][2]);
316
             mFrustum[1][2] * mFrustum[1][2]);
317
     mFrustum[1][0] /= t;
317
     mFrustum[1][0] /= t;
326
     mFrustum[2][3] = clip[15] + clip[13];
326
     mFrustum[2][3] = clip[15] + clip[13];
327
 
327
 
328
     /* Normalize the result */
328
     /* Normalize the result */
329
-    t = sqrt(mFrustum[2][0] * mFrustum[2][0] +
329
+    t = sqrtf(mFrustum[2][0] * mFrustum[2][0] +
330
             mFrustum[2][1] * mFrustum[2][1] +
330
             mFrustum[2][1] * mFrustum[2][1] +
331
             mFrustum[2][2] * mFrustum[2][2]);
331
             mFrustum[2][2] * mFrustum[2][2]);
332
     mFrustum[2][0] /= t;
332
     mFrustum[2][0] /= t;
341
     mFrustum[3][3] = clip[15] - clip[13];
341
     mFrustum[3][3] = clip[15] - clip[13];
342
 
342
 
343
     /* Normalize the result */
343
     /* Normalize the result */
344
-    t = sqrt(mFrustum[3][0] * mFrustum[3][0] +
344
+    t = sqrtf(mFrustum[3][0] * mFrustum[3][0] +
345
             mFrustum[3][1] * mFrustum[3][1] +
345
             mFrustum[3][1] * mFrustum[3][1] +
346
             mFrustum[3][2] * mFrustum[3][2]);
346
             mFrustum[3][2] * mFrustum[3][2]);
347
     mFrustum[3][0] /= t;
347
     mFrustum[3][0] /= t;
356
     mFrustum[4][3] = clip[15] - clip[14];
356
     mFrustum[4][3] = clip[15] - clip[14];
357
 
357
 
358
     /* Normalize the result */
358
     /* Normalize the result */
359
-    t = sqrt(mFrustum[4][0] * mFrustum[4][0] +
359
+    t = sqrtf(mFrustum[4][0] * mFrustum[4][0] +
360
             mFrustum[4][1] * mFrustum[4][1] +
360
             mFrustum[4][1] * mFrustum[4][1] +
361
             mFrustum[4][2] * mFrustum[4][2]);
361
             mFrustum[4][2] * mFrustum[4][2]);
362
     mFrustum[4][0] /= t;
362
     mFrustum[4][0] /= t;
371
     mFrustum[5][3] = clip[15] + clip[14];
371
     mFrustum[5][3] = clip[15] + clip[14];
372
 
372
 
373
     /* Normalize the result */
373
     /* Normalize the result */
374
-    t = sqrt(mFrustum[5][0] * mFrustum[5][0] +
374
+    t = sqrtf(mFrustum[5][0] * mFrustum[5][0] +
375
             mFrustum[5][1] * mFrustum[5][1] +
375
             mFrustum[5][1] * mFrustum[5][1] +
376
             mFrustum[5][2] * mFrustum[5][2]);
376
             mFrustum[5][2] * mFrustum[5][2]);
377
     mFrustum[5][0] /= t;
377
     mFrustum[5][0] /= t;

+ 20
- 20
src/World.cpp Zobrazit soubor

443
     switch (movement)
443
     switch (movement)
444
     {
444
     {
445
         case 'f':
445
         case 'f':
446
-            x = e->pos[0] + (testd * sin(e->angles[1]));
447
-            y = e->pos[1] + (testd * sin(pitch));
448
-            z = e->pos[2] + (testd * cos(e->angles[1]));
446
+            x = e->pos[0] + (testd * sinf(e->angles[1]));
447
+            y = e->pos[1] + (testd * sinf(pitch));
448
+            z = e->pos[2] + (testd * cosf(e->angles[1]));
449
             break;
449
             break;
450
         case 'b':
450
         case 'b':
451
-            x = e->pos[0] - (testd * sin(e->angles[1]));
452
-            y = e->pos[1] - (testd * sin(pitch));
453
-            z = e->pos[2] - (testd * cos(e->angles[1]));
451
+            x = e->pos[0] - (testd * sinf(e->angles[1]));
452
+            y = e->pos[1] - (testd * sinf(pitch));
453
+            z = e->pos[2] - (testd * cosf(e->angles[1]));
454
             break;
454
             break;
455
         case 'l':
455
         case 'l':
456
-            x = e->pos[0] - (testd * sin(e->angles[1] + 90.0));
456
+            x = e->pos[0] - (testd * sinf(e->angles[1] + 90.0f));
457
             y = e->pos[1];
457
             y = e->pos[1];
458
-            z = e->pos[2] - (testd * cos(e->angles[1] + 90.0));
458
+            z = e->pos[2] - (testd * cosf(e->angles[1] + 90.0f));
459
             break;
459
             break;
460
         case 'r':
460
         case 'r':
461
-            x = e->pos[0] + (testd * sin(e->angles[1] + 90.0));
461
+            x = e->pos[0] + (testd * sinf(e->angles[1] + 90.0f));
462
             y = e->pos[1];
462
             y = e->pos[1];
463
-            z = e->pos[2] + (testd * cos(e->angles[1] + 90.0));
463
+            z = e->pos[2] + (testd * cosf(e->angles[1] + 90.0f));
464
             break;
464
             break;
465
         default:
465
         default:
466
             return;
466
             return;
523
         switch (movement)
523
         switch (movement)
524
         {
524
         {
525
             case 'f':
525
             case 'f':
526
-                x = e->pos[0] + (moved * sin(e->angles[1]));
527
-                y = e->pos[1] + (moved * sin(pitch));
528
-                z = e->pos[2] + (moved * cos(e->angles[1]));
526
+                x = e->pos[0] + (moved * sinf(e->angles[1]));
527
+                y = e->pos[1] + (moved * sinf(pitch));
528
+                z = e->pos[2] + (moved * cosf(e->angles[1]));
529
                 break;
529
                 break;
530
             case 'b':
530
             case 'b':
531
-                x = e->pos[0] - (moved * sin(e->angles[1]));
532
-                y = e->pos[1] - (moved * sin(pitch));
533
-                z = e->pos[2] - (moved * cos(e->angles[1]));
531
+                x = e->pos[0] - (moved * sinf(e->angles[1]));
532
+                y = e->pos[1] - (moved * sinf(pitch));
533
+                z = e->pos[2] - (moved * cosf(e->angles[1]));
534
                 break;
534
                 break;
535
             case 'l':
535
             case 'l':
536
-                x = e->pos[0] - (moved * sin(e->angles[1] + 90.0));
537
-                z = e->pos[2] - (moved * cos(e->angles[1] + 90.0));
536
+                x = e->pos[0] - (moved * sinf(e->angles[1] + 90.0f));
537
+                z = e->pos[2] - (moved * cosf(e->angles[1] + 90.0f));
538
                 break;
538
                 break;
539
             case 'r':
539
             case 'r':
540
-                x = e->pos[0] + (moved * sin(e->angles[1] + 90.0));
541
-                z = e->pos[2] + (moved * cos(e->angles[1] + 90.0));
540
+                x = e->pos[0] + (moved * sinf(e->angles[1] + 90.0f));
541
+                z = e->pos[2] + (moved * cosf(e->angles[1] + 90.0f));
542
                 break;
542
                 break;
543
         }
543
         }
544
 
544
 

+ 3
- 3
src/tga.cpp Zobrazit soubor

275
     strncpy(comment, "OpenRaider TGA", 63);
275
     strncpy(comment, "OpenRaider TGA", 63);
276
     comment[63] = 0;
276
     comment[63] = 0;
277
 
277
 
278
-    header.comment_lenght = strlen(comment);
278
+    header.comment_lenght = (unsigned char)strlen(comment);
279
     header.colormap_type = 0;
279
     header.colormap_type = 0;
280
 
280
 
281
     // No colormaps
281
     // No colormaps
284
     header.colormap_bbp = 0;
284
     header.colormap_bbp = 0;
285
 
285
 
286
     header.origin_x = header.origin_y = 0;
286
     header.origin_x = header.origin_y = 0;
287
-    header.width = width;
288
-    header.height = height;
287
+    header.width = (unsigned short)width;
288
+    header.height = (unsigned short)height;
289
 
289
 
290
     header.desc_flags = 0;
290
     header.desc_flags = 0;
291
 
291
 

Loading…
Zrušit
Uložit