Explorar el Código

Now segfaults somwhere else in Render

Thomas Buck hace 10 años
padre
commit
1b8d5f6694
Se han modificado 3 ficheros con 15 adiciones y 36 borrados
  1. 6
    10
      src/Game.cpp
  2. 9
    24
      src/Render.cpp
  3. 0
    2
      src/World.cpp

+ 6
- 10
src/Game.cpp Ver fichero

132
         processRoom(i);
132
         processRoom(i);
133
     printf("Done! Found %d rooms.\n", mTombRaider.NumRooms());
133
     printf("Done! Found %d rooms.\n", mTombRaider.NumRooms());
134
     printf("Processing meshes: ");
134
     printf("Processing meshes: ");
135
-    for (int i = 0; i < mTombRaider.getMeshCount(); i++)
135
+    for (int i = 0; i < mTombRaider.getMeshCount(); i++) {
136
         processModel(i);
136
         processModel(i);
137
+    }
137
     printf("Done! Found %d meshes.\n", mTombRaider.getMeshCount());
138
     printf("Done! Found %d meshes.\n", mTombRaider.getMeshCount());
138
     processSprites();
139
     processSprites();
139
     processMoveables();
140
     processMoveables();
633
             break;
634
             break;
634
         }
635
         }
635
     }
636
     }
636
-    if (cache.empty() || (!found))
637
+    if (!found)
637
     {
638
     {
638
         sModel->model = r_model;
639
         sModel->model = r_model;
639
         mWorld.addEntity(thing);
640
         mWorld.addEntity(thing);
892
     //fflush(stdout);
893
     //fflush(stdout);
893
 }
894
 }
894
 
895
 
895
-int compareFaceTextureId(const void *voidA, const void *voidB)
896
+bool compareFaceTextureId(const void *voidA, const void *voidB)
896
 {
897
 {
897
     texture_tri_t *a = (texture_tri_t *)voidA, *b = (texture_tri_t *)voidB;
898
     texture_tri_t *a = (texture_tri_t *)voidA, *b = (texture_tri_t *)voidB;
898
 
899
 
899
     if (!a || !b)
900
     if (!a || !b)
900
-        return -1; // error really
901
-
902
-    // less than
903
-    if (a->texture < b->texture)
904
-        return -1;
901
+        return false; // error really
905
 
902
 
906
-    // greater than ( no need for equal )
907
-    return 1;
903
+    return (a->texture < b->texture);
908
 }
904
 }
909
 
905
 
910
 #ifdef EXPERIMENTAL
906
 #ifdef EXPERIMENTAL

+ 9
- 24
src/Render.cpp Ver fichero

112
 }
112
 }
113
 
113
 
114
 
114
 
115
-int compareEntites(const void *voidA, const void *voidB)
115
+bool compareEntites(const void *voidA, const void *voidB)
116
 {
116
 {
117
     entity_t *a = (entity_t *)voidA, *b = (entity_t *)voidB;
117
     entity_t *a = (entity_t *)voidA, *b = (entity_t *)voidB;
118
     vec_t distA, distB;
118
     vec_t distA, distB;
119
 
119
 
120
     if (!a || !b)
120
     if (!a || !b)
121
-        return -1; // error really
121
+        return false; // error really
122
 
122
 
123
     distA = gViewVolume.getDistToSphereFromNear(a->pos[0],
123
     distA = gViewVolume.getDistToSphereFromNear(a->pos[0],
124
             a->pos[1],
124
             a->pos[1],
129
             b->pos[2],
129
             b->pos[2],
130
             1.0f);
130
             1.0f);
131
 
131
 
132
-    // less than
133
-    if (distA < distB)
134
-        return -1;
135
-
136
-    // greater than ( no need for equal )
137
-    return 1;
132
+    return (distA < distB);
138
 }
133
 }
139
 
134
 
140
 
135
 
141
-int compareStaticModels(const void *voidA, const void *voidB)
136
+bool compareStaticModels(const void *voidA, const void *voidB)
142
 {
137
 {
143
     static_model_t *a = (static_model_t *)voidA, *b = (static_model_t *)voidB;
138
     static_model_t *a = (static_model_t *)voidA, *b = (static_model_t *)voidB;
144
     vec_t distA, distB;
139
     vec_t distA, distB;
145
 
140
 
146
     if (!a || !b)
141
     if (!a || !b)
147
-        return -1; // error really
142
+        return false; // error really
148
 
143
 
149
     distA = gViewVolume.getDistToSphereFromNear(a->pos[0],
144
     distA = gViewVolume.getDistToSphereFromNear(a->pos[0],
150
             a->pos[1],
145
             a->pos[1],
155
             b->pos[2],
150
             b->pos[2],
156
             128.0f);
151
             128.0f);
157
 
152
 
158
-    // less than
159
-    if (distA < distB)
160
-        return -1;
161
-
162
-    // greater than ( no need for equal )
163
-    return 1;
153
+    return (distA < distB);
164
 }
154
 }
165
 
155
 
166
 
156
 
167
-int compareRoomDist(const void *voidA, const void *voidB)
157
+bool compareRoomDist(const void *voidA, const void *voidB)
168
 {
158
 {
169
     const RenderRoom *a = static_cast<const RenderRoom *>(voidA);
159
     const RenderRoom *a = static_cast<const RenderRoom *>(voidA);
170
     const RenderRoom *b = static_cast<const RenderRoom *>(voidB);
160
     const RenderRoom *b = static_cast<const RenderRoom *>(voidB);
171
 
161
 
172
 
162
 
173
     if (!a || !b || !a->room || !b->room)
163
     if (!a || !b || !a->room || !b->room)
174
-        return -1; // error really
175
-
176
-    // less than
177
-    if (a->dist < b->dist)
178
-        return -1;
164
+        return false; // error really
179
 
165
 
180
-    // greater than ( no need for equal )
181
-    return 1;
166
+    return (a->dist < b->dist);
182
 }
167
 }
183
 
168
 
184
 
169
 

+ 0
- 2
src/World.cpp Ver fichero

121
     sector_t * s;
121
     sector_t * s;
122
     int sector;
122
     int sector;
123
 
123
 
124
-
125
     r = mRooms[room];
124
     r = mRooms[room];
126
 
125
 
127
     if (!r)
126
     if (!r)
150
     int sector;
149
     int sector;
151
     room_mesh_t *r;
150
     room_mesh_t *r;
152
 
151
 
153
-
154
     r = mRooms[room];
152
     r = mRooms[room];
155
 
153
 
156
     if (!r)
154
     if (!r)

Loading…
Cancelar
Guardar