ソースを参照

Using only colors that were defined for renderer

Thomas Buck 10年前
コミット
4d98afd2aa
7個のファイルの変更69行の追加78行の削除
  1. 1
    1
      include/Window.h
  2. 1
    1
      include/WindowSDL.h
  3. 12
    1
      include/global.h
  4. 5
    5
      src/Console.cpp
  5. 8
    13
      src/Menu.cpp
  6. 37
    52
      src/Render.cpp
  7. 5
    5
      src/WindowSDL.cpp

+ 1
- 1
include/Window.h ファイルの表示

55
 
55
 
56
     virtual void writeString(WindowString *s) = 0;
56
     virtual void writeString(WindowString *s) = 0;
57
 
57
 
58
-    virtual void drawText(unsigned int x, unsigned int y, float scale, unsigned char *color, const char *s, ...)
58
+    virtual void drawText(unsigned int x, unsigned int y, float scale, const float color[4], const char *s, ...)
59
         __attribute__((format(printf, 6, 0))) = 0;
59
         __attribute__((format(printf, 6, 0))) = 0;
60
 
60
 
61
     unsigned int mWidth;
61
     unsigned int mWidth;

+ 1
- 1
include/WindowSDL.h ファイルの表示

61
 
61
 
62
     virtual void writeString(WindowString *s);
62
     virtual void writeString(WindowString *s);
63
 
63
 
64
-    virtual void drawText(unsigned int x, unsigned int y, float scale, unsigned char *color, const char *s, ...)
64
+    virtual void drawText(unsigned int x, unsigned int y, float scale, const float color[4], const char *s, ...)
65
         __attribute__((format(printf, 6, 0)));
65
         __attribute__((format(printf, 6, 0)));
66
 
66
 
67
 private:
67
 private:

+ 12
- 1
include/global.h ファイルの表示

7
 #ifndef _GLOBAL_H_
7
 #ifndef _GLOBAL_H_
8
 #define _GLOBAL_H_
8
 #define _GLOBAL_H_
9
 
9
 
10
+const float BLACK[]       = {  0.0f,  0.0f,  0.0f, 1.0f };
11
+const float DIM_WHITE[]   = {  0.5f,  0.5f,  0.5f, 1.0f };
12
+const float WHITE[]       = {  1.0f,  1.0f,  1.0f, 1.0f };
13
+const float RED[]         = {  1.0f,  0.0f,  0.0f, 1.0f };
14
+const float GREEN[]       = {  0.0f,  1.0f,  0.0f, 1.0f };
15
+const float NEXT_PURPLE[] = {  0.3f,  0.3f,  0.5f, 1.0f };
16
+const float OR_BLUE[]     = {  0.5f,  0.7f,  1.0f, 1.0f };
17
+const float PINK[]        = {  1.0f,  0.0f,  1.0f, 1.0f };
18
+const float YELLOW[]      = {  1.0f,  1.0f,  0.0f, 1.0f };
19
+const float CYAN[]        = {  0.0f,  1.0f,  1.0f, 1.0f };
20
+
10
 typedef enum {
21
 typedef enum {
11
     menuAction = 0,
22
     menuAction = 0,
12
     consoleAction, // menu and console should always be the first two items
23
     consoleAction, // menu and console should always be the first two items
61
     int w;
72
     int w;
62
     int h;
73
     int h;
63
     float scale;
74
     float scale;
64
-    unsigned char color[4];
75
+    float color[4];
65
 } WindowString;
76
 } WindowString;
66
 
77
 
67
 #endif
78
 #endif

+ 5
- 5
src/Console.cpp ファイルの表示

14
 #endif
14
 #endif
15
 
15
 
16
 #include "config.h"
16
 #include "config.h"
17
+#include "global.h"
17
 #include "Console.h"
18
 #include "Console.h"
18
 #include "main.h"
19
 #include "main.h"
19
 #include "utils/strings.h"
20
 #include "utils/strings.h"
90
 
91
 
91
 void Console::display() {
92
 void Console::display() {
92
     Window *window = gOpenRaider->mWindow;
93
     Window *window = gOpenRaider->mWindow;
93
-    unsigned char color[4] = {0xFF, 0xFF, 0xFF, 0xFF};
94
 
94
 
95
     if (mVisible) {
95
     if (mVisible) {
96
         // Calculate line drawing geometry
96
         // Calculate line drawing geometry
110
             scrollIndicator = 100;
110
             scrollIndicator = 100;
111
         }
111
         }
112
 
112
 
113
-        gOpenRaider->mWindow->drawText(10, 10, 0.70f, color,
113
+        gOpenRaider->mWindow->drawText(10, 10, 0.70f, OR_BLUE,
114
                 "%s uptime %lus scroll %d%%", VERSION, systemTimerGet() / 1000, scrollIndicator);
114
                 "%s uptime %lus scroll %d%%", VERSION, systemTimerGet() / 1000, scrollIndicator);
115
 
115
 
116
         // Draw output log
116
         // Draw output log
125
         }
125
         }
126
         for (int i = 0; i < end; i++) {
126
         for (int i = 0; i < end; i++) {
127
             gOpenRaider->mWindow->drawText(10, ((i + drawOffset) * lineSteps) + firstLine,
127
             gOpenRaider->mWindow->drawText(10, ((i + drawOffset) * lineSteps) + firstLine,
128
-                    0.75f, color, "%s", mHistory[i + historyOffset - mLineOffset]);
128
+                    0.75f, OR_BLUE, "%s", mHistory[i + historyOffset - mLineOffset]);
129
         }
129
         }
130
 
130
 
131
         // Draw current input
131
         // Draw current input
132
         if ((mInputBufferPointer > 0) && (mInputBuffer[0] != '\0')) {
132
         if ((mInputBufferPointer > 0) && (mInputBuffer[0] != '\0')) {
133
-            gOpenRaider->mWindow->drawText(10, inputLine, 0.75f, color, "> %s", mInputBuffer);
133
+            gOpenRaider->mWindow->drawText(10, inputLine, 0.75f, OR_BLUE, "> %s", mInputBuffer);
134
         } else {
134
         } else {
135
-            gOpenRaider->mWindow->drawText(10, inputLine, 0.75f, color, ">");
135
+            gOpenRaider->mWindow->drawText(10, inputLine, 0.75f, OR_BLUE, ">");
136
         }
136
         }
137
 
137
 
138
         //! \todo display the current mPartialInput. The UTF-8 segfaults SDL-TTF, somehow?
138
         //! \todo display the current mPartialInput. The UTF-8 segfaults SDL-TTF, somehow?

+ 8
- 13
src/Menu.cpp ファイルの表示

14
 #endif
14
 #endif
15
 
15
 
16
 #include "config.h"
16
 #include "config.h"
17
+#include "global.h"
17
 #include "main.h"
18
 #include "main.h"
18
 #include "Menu.h"
19
 #include "Menu.h"
19
 #include "utils/strings.h"
20
 #include "utils/strings.h"
75
 
76
 
76
     for (int i = 0; i < (max - min); i++) {
77
     for (int i = 0; i < (max - min); i++) {
77
         char *map = gOpenRaider->mMapList[i + min];
78
         char *map = gOpenRaider->mMapList[i + min];
78
-        unsigned char color[4] = {0xFF, 0xFF, 0xFF, 0xFF};
79
-        if ((i + min) == (int)mCursor) {
80
-            // Less greem & red --> highlight in red
81
-            color[1] = 0x42;
82
-            color[2] = 0x42;
83
-        }
84
-        gOpenRaider->mWindow->drawText(25, 100 + (25 * i), 0.75f, color, "%s", map);
79
+        if ((i + min) == (int)mCursor)
80
+            gOpenRaider->mWindow->drawText(25, 100 + (25 * i), 0.75f, RED, "%s", map);
81
+        else
82
+            gOpenRaider->mWindow->drawText(25, 100 + (25 * i), 0.75f, OR_BLUE, "%s", map);
85
     }
83
     }
86
 }
84
 }
87
 
85
 
88
 void Menu::display() {
86
 void Menu::display() {
89
     Window *window = gOpenRaider->mWindow;
87
     Window *window = gOpenRaider->mWindow;
90
-    unsigned char color[4] = {0xFF, 0xFF, 0xFF, 0xFF};
91
 
88
 
92
     if (mVisible) {
89
     if (mVisible) {
93
         // Draw half-transparent *overlay*
90
         // Draw half-transparent *overlay*
101
         window->writeString(&mainText);
98
         window->writeString(&mainText);
102
 
99
 
103
         if (!gOpenRaider->mMapListFilled) {
100
         if (!gOpenRaider->mMapListFilled) {
104
-            gOpenRaider->mWindow->drawText(25, (window->mHeight / 2) - 20, 0.75f, color, "Generating map list...");
101
+            gOpenRaider->mWindow->drawText(25, (window->mHeight / 2) - 20, 0.75f, OR_BLUE, "Generating map list...");
105
         } else {
102
         } else {
106
             if (gOpenRaider->mMapList.size() == 0) {
103
             if (gOpenRaider->mMapList.size() == 0) {
107
-                gOpenRaider->mWindow->drawText(25, (window->mHeight / 2) - 20, 0.75f, color, "No maps found! See README.md");
104
+                gOpenRaider->mWindow->drawText(25, (window->mHeight / 2) - 20, 0.75f, RED, "No maps found! See README.md");
108
             } else {
105
             } else {
109
                 // draw *play button* above list
106
                 // draw *play button* above list
110
                 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
107
                 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
111
                 glDisable(GL_TEXTURE_2D);
108
                 glDisable(GL_TEXTURE_2D);
112
                 glRecti(25, 25, 100, 75);
109
                 glRecti(25, 25, 100, 75);
113
                 glEnable(GL_TEXTURE_2D);
110
                 glEnable(GL_TEXTURE_2D);
114
-                color[0] = color[1] = color[2] = 0x00;
115
-                gOpenRaider->mWindow->drawText(40, 35, 0.75f, color, "Play");
116
-                color[0] = color[1] = color[2] = 0xFF;
111
+                gOpenRaider->mWindow->drawText(40, 35, 0.75f, BLACK, "Play");
117
 
112
 
118
                 displayMapList();
113
                 displayMapList();
119
             }
114
             }

+ 37
- 52
src/Render.cpp ファイルの表示

24
 #include "Emitter.h"
24
 #include "Emitter.h"
25
 #endif
25
 #endif
26
 
26
 
27
+#include "global.h"
27
 #include "main.h"
28
 #include "main.h"
28
 #include "Game.h"
29
 #include "Game.h"
29
 #include "OpenRaider.h"
30
 #include "OpenRaider.h"
30
 #include "Render.h"
31
 #include "Render.h"
31
 
32
 
32
-//! \fixme Should be changed
33
-#define LARA gOpenRaider->mGame->mLara
34
-#define gWorld gOpenRaider->mGame->mWorld
35
-
36
-// Colors
37
-const float BLACK[]       = {  0.0f,  0.0f,  0.0f, 1.0f };
38
-const float DIM_WHITE[]   = {  0.5f,  0.5f,  0.5f, 1.0f };
39
-const float WHITE[]       = {  1.0f,  1.0f,  1.0f, 1.0f };
40
-const float RED[]         = {  1.0f,  0.0f,  0.0f, 1.0f };
41
-const float GREEN[]       = {  0.0f,  1.0f,  0.0f, 1.0f };
42
-const float NEXT_PURPLE[] = {  0.3f,  0.3f,  0.5f, 1.0f };
43
-//const float OR_BLUE[]     = {  0.5f,  0.7f,  1.0f, 1.0f };
44
-const float PINK[]        = {  1.0f,  0.0f,  1.0f, 1.0f };
45
-const float YELLOW[]      = {  1.0f,  1.0f,  0.0f, 1.0f };
46
-const float CYAN[]        = {  0.0f,  1.0f,  1.0f, 1.0f };
47
-
48
 ViewVolume gViewVolume; /* View volume for frustum culling */
33
 ViewVolume gViewVolume; /* View volume for frustum culling */
49
 
34
 
50
 void Render::drawLoadScreen()
35
 void Render::drawLoadScreen()
325
 
310
 
326
 void Render::ClearWorld()
311
 void Render::ClearWorld()
327
 {
312
 {
328
-    LARA = NULL;
313
+    gOpenRaider->mGame->mLara = NULL;
329
 
314
 
330
     mRoomRenderList.clear();
315
     mRoomRenderList.clear();
331
 
316
 
599
 
584
 
600
     index = -1;
585
     index = -1;
601
 
586
 
602
-    if (LARA)
587
+    if (gOpenRaider->mGame->mLara)
603
     {
588
     {
604
         float yaw;
589
         float yaw;
605
         int sector;
590
         int sector;
606
         float camOffsetH = 0.0f;
591
         float camOffsetH = 0.0f;
607
 
592
 
608
 
593
 
609
-        switch (LARA->moveType)
594
+        switch (gOpenRaider->mGame->mLara->moveType)
610
         {
595
         {
611
             case worldMoveType_fly:
596
             case worldMoveType_fly:
612
             case worldMoveType_noClipping:
597
             case worldMoveType_noClipping:
619
                 break;
604
                 break;
620
         }
605
         }
621
 
606
 
622
-        curPos[0] = LARA->pos[0];
623
-        curPos[1] = LARA->pos[1];
624
-        curPos[2] = LARA->pos[2];
625
-        yaw = LARA->angles[1];
607
+        curPos[0] = gOpenRaider->mGame->mLara->pos[0];
608
+        curPos[1] = gOpenRaider->mGame->mLara->pos[1];
609
+        curPos[2] = gOpenRaider->mGame->mLara->pos[2];
610
+        yaw = gOpenRaider->mGame->mLara->angles[1];
626
 
611
 
627
-        index = LARA->room;
612
+        index = gOpenRaider->mGame->mLara->room;
628
 
613
 
629
         // Mongoose 2002.08.24, New 3rd person camera hack
614
         // Mongoose 2002.08.24, New 3rd person camera hack
630
         camPos[0] = curPos[0];
615
         camPos[0] = curPos[0];
634
         camPos[0] -= (1024.0f * sinf(yaw));
619
         camPos[0] -= (1024.0f * sinf(yaw));
635
         camPos[2] -= (1024.0f * cosf(yaw));
620
         camPos[2] -= (1024.0f * cosf(yaw));
636
 
621
 
637
-        sector = gWorld.getSector(index, camPos[0], camPos[2]);
622
+        sector = gOpenRaider->mGame->mWorld.getSector(index, camPos[0], camPos[2]);
638
 
623
 
639
         // Handle camera out of world
624
         // Handle camera out of world
640
-        if (sector < 0 || gWorld.isWall(index, sector))
625
+        if (sector < 0 || gOpenRaider->mGame->mWorld.isWall(index, sector))
641
         {
626
         {
642
             camPos[0] = curPos[0] + (64.0f * sinf(yaw));
627
             camPos[0] = curPos[0] + (64.0f * sinf(yaw));
643
             camPos[1] -= 64.0f;
628
             camPos[1] -= 64.0f;
663
     updateViewVolume();
648
     updateViewVolume();
664
 
649
 
665
     // Let's see the LoS -- should be event controled
650
     // Let's see the LoS -- should be event controled
666
-    if (LARA)
651
+    if (gOpenRaider->mGame->mLara)
667
     {
652
     {
668
-        //      SkeletalModel *mdl = (SkeletalModel *)LARA->tmpHook;
653
+        //      SkeletalModel *mdl = (SkeletalModel *)gOpenRaider->mGame->mLara->tmpHook;
669
 
654
 
670
         // Draw in solid colors
655
         // Draw in solid colors
671
         glDisable(GL_TEXTURE_2D);
656
         glDisable(GL_TEXTURE_2D);
672
         glDisable(GL_CULL_FACE);
657
         glDisable(GL_CULL_FACE);
673
 
658
 
674
-        if (LARA->state == 64) // eWeaponFire
659
+        if (gOpenRaider->mGame->mLara->state == 64) // eWeaponFire
675
         {
660
         {
676
             vec3_t u, v; //, s, t;
661
             vec3_t u, v; //, s, t;
677
 
662
 
678
-            // Center of LARA
663
+            // Center of gOpenRaider->mGame->mLara
679
             u[0] = curPos[0];
664
             u[0] = curPos[0];
680
             u[1] = curPos[1] - 512.0f;
665
             u[1] = curPos[1] - 512.0f;
681
             u[2] = curPos[2];
666
             u[2] = curPos[2];
682
 
667
 
683
-            // Location LARA is aiming at?  ( Not finished yet )
684
-            v[0] = u[0] + (9000.0f * sinf(LARA->angles[1]));
685
-            v[1] = u[1] + (9000.0f * sinf(LARA->angles[2]));
686
-            v[2] = u[2] + (9000.0f * cosf(LARA->angles[1]));
668
+            // Location gOpenRaider->mGame->mLara is aiming at?  ( Not finished yet )
669
+            v[0] = u[0] + (9000.0f * sinf(gOpenRaider->mGame->mLara->angles[1]));
670
+            v[1] = u[1] + (9000.0f * sinf(gOpenRaider->mGame->mLara->angles[2]));
671
+            v[2] = u[2] + (9000.0f * cosf(gOpenRaider->mGame->mLara->angles[1]));
687
 
672
 
688
             // Test tracing of aim
673
             // Test tracing of aim
689
             renderTrace(0, u, v); // v = target
674
             renderTrace(0, u, v); // v = target
690
         }
675
         }
691
 
676
 
692
-        entity_t *route = LARA->master;
677
+        entity_t *route = gOpenRaider->mGame->mLara->master;
693
 
678
 
694
         while (route)
679
         while (route)
695
         {
680
         {
733
     {
718
     {
734
         entity_t *e;
719
         entity_t *e;
735
         std::vector<entity_t *> entityRenderList;
720
         std::vector<entity_t *> entityRenderList;
736
-        std::vector<entity_t *> *entities = gWorld.getEntities();
721
+        std::vector<entity_t *> *entities = gOpenRaider->mGame->mWorld.getEntities();
737
 
722
 
738
         for (unsigned int i = 0; i < entities->size(); i++)
723
         for (unsigned int i = 0; i < entities->size(); i++)
739
         {
724
         {
740
             e = entities->at(i);
725
             e = entities->at(i);
741
 
726
 
742
             // Mongoose 2002.03.26, Don't show lara to it's own player
727
             // Mongoose 2002.03.26, Don't show lara to it's own player
743
-            if (!e || e == LARA)
728
+            if (!e || e == gOpenRaider->mGame->mLara)
744
             {
729
             {
745
                 continue;
730
                 continue;
746
             }
731
             }
979
 
964
 
980
 void Render::drawSkyMesh(float scale)
965
 void Render::drawSkyMesh(float scale)
981
 {
966
 {
982
-    skeletal_model_t *model = gWorld.getModel(mSkyMesh);
967
+    skeletal_model_t *model = gOpenRaider->mGame->mWorld.getModel(mSkyMesh);
983
 
968
 
984
 
969
 
985
     if (!model)
970
     if (!model)
996
     glTranslated(0.0, 1000.0, 0.0);
981
     glTranslated(0.0, 1000.0, 0.0);
997
     glScaled(scale, scale, scale);
982
     glScaled(scale, scale, scale);
998
     //drawModel(model);
983
     //drawModel(model);
999
-    //drawModelMesh(gWorld.getMesh(mSkyMesh), );
984
+    //drawModelMesh(gOpenRaider->mGame->mWorld.getMesh(mSkyMesh), );
1000
     glPopMatrix();
985
     glPopMatrix();
1001
     glEnable(GL_DEPTH_TEST);
986
     glEnable(GL_DEPTH_TEST);
1002
 }
987
 }
1012
 
997
 
1013
 
998
 
1014
     // Draw lara or other player model ( move to entity rendering method )
999
     // Draw lara or other player model ( move to entity rendering method )
1015
-    if (mFlags & Render::fViewModel && LARA && LARA->tmpHook)
1000
+    if (mFlags & Render::fViewModel && gOpenRaider->mGame->mLara && gOpenRaider->mGame->mLara->tmpHook)
1016
     {
1001
     {
1017
-        SkeletalModel *mdl = static_cast<SkeletalModel *>(LARA->tmpHook);
1002
+        SkeletalModel *mdl = static_cast<SkeletalModel *>(gOpenRaider->mGame->mLara->tmpHook);
1018
 
1003
 
1019
         if (mdl)
1004
         if (mdl)
1020
         {
1005
         {
1021
 
1006
 
1022
             // Mongoose 2002.03.22, Test 'idle' aniamtions
1007
             // Mongoose 2002.03.22, Test 'idle' aniamtions
1023
-            if (!LARA->moving)
1008
+            if (!gOpenRaider->mGame->mLara->moving)
1024
             {
1009
             {
1025
                 frame = mdl->getIdleAnimation();
1010
                 frame = mdl->getIdleAnimation();
1026
 
1011
 
1051
         glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1036
         glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1052
         glTranslated(0, 500, 1200);
1037
         glTranslated(0, 500, 1200);
1053
 #else
1038
 #else
1054
-        glTranslated(LARA->pos[0], LARA->pos[1], LARA->pos[2]);
1039
+        glTranslated(gOpenRaider->mGame->mLara->pos[0], gOpenRaider->mGame->mLara->pos[1], gOpenRaider->mGame->mLara->pos[2]);
1055
         glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1040
         glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1056
 #endif
1041
 #endif
1057
 
1042
 
1058
-        drawModel(static_cast<SkeletalModel *>(LARA->tmpHook));
1043
+        drawModel(static_cast<SkeletalModel *>(gOpenRaider->mGame->mLara->tmpHook));
1059
         glPopMatrix();
1044
         glPopMatrix();
1060
     }
1045
     }
1061
 
1046
 
1064
     {
1049
     {
1065
         std::vector<sprite_seq_t *> *sprites;
1050
         std::vector<sprite_seq_t *> *sprites;
1066
 
1051
 
1067
-        sprites = gWorld.getSprites();
1052
+        sprites = gOpenRaider->mGame->mWorld.getSprites();
1068
 
1053
 
1069
         for (unsigned int i = 0; i < sprites->size(); i++)
1054
         for (unsigned int i = 0; i < sprites->size(); i++)
1070
         {
1055
         {
1184
 
1169
 
1185
                 if (tag2)
1170
                 if (tag2)
1186
                 {
1171
                 {
1187
-                    drawModelMesh(gWorld.getMesh(tag2->mesh), Render::skeletalMesh);
1172
+                    drawModelMesh(gOpenRaider->mGame->mWorld.getMesh(tag2->mesh), Render::skeletalMesh);
1188
                 }
1173
                 }
1189
             }
1174
             }
1190
         }
1175
         }
1227
                     {
1212
                     {
1228
                         glPushMatrix();
1213
                         glPushMatrix();
1229
                         glTranslatef(mdl->ponyOff2, 0.0, 0.0);
1214
                         glTranslatef(mdl->ponyOff2, 0.0, 0.0);
1230
-                        drawModelMesh(gWorld.getMesh(mdl->ponytailMeshId + i),
1215
+                        drawModelMesh(gOpenRaider->mGame->mWorld.getMesh(mdl->ponytailMeshId + i),
1231
                                 Render::skeletalMesh);
1216
                                 Render::skeletalMesh);
1232
                         glPopMatrix();
1217
                         glPopMatrix();
1233
 
1218
 
1234
                         glPushMatrix();
1219
                         glPushMatrix();
1235
                         glTranslatef(-mdl->ponyOff2, 0.0, 0.0);
1220
                         glTranslatef(-mdl->ponyOff2, 0.0, 0.0);
1236
-                        drawModelMesh(gWorld.getMesh(mdl->ponytailMeshId + i),
1221
+                        drawModelMesh(gOpenRaider->mGame->mWorld.getMesh(mdl->ponytailMeshId + i),
1237
                                 Render::skeletalMesh);
1222
                                 Render::skeletalMesh);
1238
                         glPopMatrix();
1223
                         glPopMatrix();
1239
                     }
1224
                     }
1240
                     else
1225
                     else
1241
                     {
1226
                     {
1242
-                        drawModelMesh(gWorld.getMesh(mdl->ponytailMeshId + i),
1227
+                        drawModelMesh(gOpenRaider->mGame->mWorld.getMesh(mdl->ponytailMeshId + i),
1243
                                 Render::skeletalMesh);
1228
                                 Render::skeletalMesh);
1244
                     }
1229
                     }
1245
                 }
1230
                 }
1253
             }
1238
             }
1254
         }
1239
         }
1255
 
1240
 
1256
-        drawModelMesh(gWorld.getMesh(tag->mesh), Render::skeletalMesh);
1241
+        drawModelMesh(gOpenRaider->mGame->mWorld.getMesh(tag->mesh), Render::skeletalMesh);
1257
     }
1242
     }
1258
 
1243
 
1259
     // Cycle frames ( cheap hack from old ent state based system )
1244
     // Cycle frames ( cheap hack from old ent state based system )
1635
     if (!mesh)
1620
     if (!mesh)
1636
         return;
1621
         return;
1637
 
1622
 
1638
-    r_mesh = gWorld.getMesh(mesh->index);
1623
+    r_mesh = gOpenRaider->mGame->mWorld.getMesh(mesh->index);
1639
 
1624
 
1640
     if (!r_mesh)
1625
     if (!r_mesh)
1641
         return;
1626
         return;
1885
         return;
1870
         return;
1886
     }
1871
     }
1887
 
1872
 
1888
-    model = gWorld.getModel(index);
1873
+    model = gOpenRaider->mGame->mWorld.getModel(index);
1889
 
1874
 
1890
     if (model)
1875
     if (model)
1891
     {
1876
     {

+ 5
- 5
src/WindowSDL.cpp ファイルの表示

546
     assert(mInit == true);
546
     assert(mInit == true);
547
 
547
 
548
     SDL_Color color;
548
     SDL_Color color;
549
-    color.r = s->color[0];
550
-    color.g = s->color[1];
551
-    color.b = s->color[2];
552
-    color.a = s->color[3];
549
+    color.r = (unsigned char)(s->color[0] * 255.0f);
550
+    color.g = (unsigned char)(s->color[1] * 255.0f);
551
+    color.b = (unsigned char)(s->color[2] * 255.0f);
552
+    color.a = (unsigned char)(s->color[3] * 255.0f);
553
 
553
 
554
     SDL_Surface *surface = TTF_RenderUTF8_Blended(mFont, s->text, color);
554
     SDL_Surface *surface = TTF_RenderUTF8_Blended(mFont, s->text, color);
555
     if (surface == NULL) {
555
     if (surface == NULL) {
599
     SDL_FreeSurface(surface);
599
     SDL_FreeSurface(surface);
600
 }
600
 }
601
 
601
 
602
-void WindowSDL::drawText(unsigned int x, unsigned int y, float scale, unsigned char *color, const char *s, ...) {
602
+void WindowSDL::drawText(unsigned int x, unsigned int y, float scale, const float color[4], const char *s, ...) {
603
     va_list args;
603
     va_list args;
604
     va_start(args, s);
604
     va_start(args, s);
605
     vsnprintf(tempText.text, 256, s, args);
605
     vsnprintf(tempText.text, 256, s, args);

読み込み中…
キャンセル
保存