|
@@ -251,7 +251,7 @@ int TombRaider::getNumAnimsForMoveable(int moveable_index)
|
251
|
251
|
**************************************************************************/
|
252
|
252
|
|
253
|
253
|
int start_anim;
|
254
|
|
- int next_start_anim;
|
|
254
|
+ int next_start_anim = 0xFFFF;
|
255
|
255
|
tr2_moveable_t *last_moveable = 0x0;
|
256
|
256
|
tr2_moveable_t *moveable = 0x0;
|
257
|
257
|
tr2_moveable_t *next_moveable = 0x0;
|
|
@@ -439,7 +439,6 @@ int TombRaider::checkMime(char *filename)
|
439
|
439
|
case 0xfffffff0: // bogus
|
440
|
440
|
case 0x00345254: // "TR4\0"
|
441
|
441
|
return 0;
|
442
|
|
- break;
|
443
|
442
|
default:
|
444
|
443
|
;
|
445
|
444
|
}
|
|
@@ -892,8 +891,6 @@ int TombRaider::Load(char *filename, void (*percent)(int))
|
892
|
891
|
|
893
|
892
|
if (mEngineVersion >= TR_VERSION_3)
|
894
|
893
|
{
|
895
|
|
- int j;
|
896
|
|
-
|
897
|
894
|
for (j = 0; j < _rooms[i].room_data.num_rectangles; ++j)
|
898
|
895
|
{
|
899
|
896
|
_rooms[i].room_data.rectangles[j].texture &= 0x7fff;
|
|
@@ -927,8 +924,6 @@ int TombRaider::Load(char *filename, void (*percent)(int))
|
927
|
924
|
|
928
|
925
|
if (mEngineVersion >= TR_VERSION_3)
|
929
|
926
|
{
|
930
|
|
- int j;
|
931
|
|
-
|
932
|
927
|
for (j = 0; j < _rooms[i].room_data.num_triangles; ++j)
|
933
|
928
|
{
|
934
|
929
|
_rooms[i].room_data.triangles[j].texture &= 0x7fff;
|
|
@@ -961,8 +956,6 @@ int TombRaider::Load(char *filename, void (*percent)(int))
|
961
|
956
|
|
962
|
957
|
if (mEngineVersion >= TR_VERSION_3)
|
963
|
958
|
{
|
964
|
|
- int j;
|
965
|
|
-
|
966
|
959
|
for (j = 0; j < _rooms[i].room_data.num_sprites; j++)
|
967
|
960
|
{
|
968
|
961
|
_rooms[i].room_data.sprites[j].texture &= 0x7fff;
|
|
@@ -1978,17 +1971,21 @@ int TombRaider::Load(char *filename, void (*percent)(int))
|
1978
|
1971
|
#endif
|
1979
|
1972
|
}
|
1980
|
1973
|
break;
|
|
1974
|
+ case TR_VERSION_2:
|
|
1975
|
+ case TR_VERSION_3:
|
|
1976
|
+ case TR_VERSION_5:
|
|
1977
|
+ case TR_VERSION_UNKNOWN:
|
1981
|
1978
|
default:
|
1982
|
1979
|
//! \fixme (Endian) Read bit32 / int32_t
|
1983
|
1980
|
Fread(&mNumSampleIndices, 4, 1, f);
|
1984
|
1981
|
printDebug("Load", "mNumSampleIndices = %i", mNumSampleIndices);
|
1985
|
|
-
|
1986
|
1982
|
if (mNumSampleIndices > 0)
|
1987
|
1983
|
{
|
1988
|
1984
|
mSampleIndices = new int[mNumSampleIndices];
|
1989
|
1985
|
//! \fixme (Endian)
|
1990
|
1986
|
Fread(mSampleIndices, 4, mNumSampleIndices, f);
|
1991
|
1987
|
}
|
|
1988
|
+ break;
|
1992
|
1989
|
}
|
1993
|
1990
|
|
1994
|
1991
|
#ifdef ZLIB_SUPPORT
|
|
@@ -2150,6 +2147,11 @@ void TombRaider::getColor(int index, float color[4])
|
2150
|
2147
|
//color[2] = (_palette8[index].b & 0xfd) / 64.0;
|
2151
|
2148
|
color[3] = 1.0;
|
2152
|
2149
|
break;
|
|
2150
|
+ case TR_VERSION_2:
|
|
2151
|
+ case TR_VERSION_3:
|
|
2152
|
+ case TR_VERSION_4:
|
|
2153
|
+ case TR_VERSION_5:
|
|
2154
|
+ case TR_VERSION_UNKNOWN:
|
2153
|
2155
|
default:
|
2154
|
2156
|
color[0] = (float)(_palette16[index] & 0xff) / 256.0;
|
2155
|
2157
|
color[1] = (float)((_palette16[index] >> 8) & 0xff) / 256.0;
|
|
@@ -2225,6 +2227,11 @@ void TombRaider::getMeshColoredRectangle(unsigned int meshIndex,
|
2225
|
2227
|
case TR_VERSION_1:
|
2226
|
2228
|
getColor(mMeshes[meshIndex].coloured_rectangles[faceIndex].texture & 0xff, color);
|
2227
|
2229
|
break;
|
|
2230
|
+ case TR_VERSION_2:
|
|
2231
|
+ case TR_VERSION_3:
|
|
2232
|
+ case TR_VERSION_4:
|
|
2233
|
+ case TR_VERSION_5:
|
|
2234
|
+ case TR_VERSION_UNKNOWN:
|
2228
|
2235
|
default:
|
2229
|
2236
|
getColor((mMeshes[meshIndex].coloured_rectangles[faceIndex].texture>>8) & 0xff, color);
|
2230
|
2237
|
}
|
|
@@ -2251,6 +2258,11 @@ void TombRaider::getMeshColoredTriangle(unsigned int meshIndex,
|
2251
|
2258
|
getColor(mMeshes[meshIndex].coloured_triangles[faceIndex].texture & 0xff,
|
2252
|
2259
|
color);
|
2253
|
2260
|
break;
|
|
2261
|
+ case TR_VERSION_2:
|
|
2262
|
+ case TR_VERSION_3:
|
|
2263
|
+ case TR_VERSION_4:
|
|
2264
|
+ case TR_VERSION_5:
|
|
2265
|
+ case TR_VERSION_UNKNOWN:
|
2254
|
2266
|
default:
|
2255
|
2267
|
getColor((mMeshes[meshIndex].coloured_triangles[faceIndex].texture>>8) & 0xff,
|
2256
|
2268
|
color);
|
|
@@ -2493,6 +2505,13 @@ void TombRaider::getMeshVertexArrays(unsigned int meshIndex,
|
2493
|
2505
|
case TR_VERSION_4:
|
2494
|
2506
|
case TR_VERSION_3:
|
2495
|
2507
|
colorValue /= 16384.0;
|
|
2508
|
+ //! \fixme Should we really fall through here?!?
|
|
2509
|
+ break; // just testing -- xythobuz, 20140119
|
|
2510
|
+
|
|
2511
|
+ case TR_VERSION_1:
|
|
2512
|
+ case TR_VERSION_2:
|
|
2513
|
+ case TR_VERSION_5:
|
|
2514
|
+ case TR_VERSION_UNKNOWN:
|
2496
|
2515
|
default:
|
2497
|
2516
|
colorValue = (1.0 - (colorValue / 8192.0));
|
2498
|
2517
|
break;
|
|
@@ -2522,8 +2541,14 @@ int TombRaider::getRoomBox(unsigned int roomIndex, unsigned int index,
|
2522
|
2541
|
switch (getEngine())
|
2523
|
2542
|
{
|
2524
|
2543
|
case TR_VERSION_UNKNOWN:
|
|
2544
|
+ default:
|
2525
|
2545
|
break;
|
2526
|
|
- default: // TR1-TR5
|
|
2546
|
+
|
|
2547
|
+ case TR_VERSION_1:
|
|
2548
|
+ case TR_VERSION_2:
|
|
2549
|
+ case TR_VERSION_3:
|
|
2550
|
+ case TR_VERSION_4:
|
|
2551
|
+ case TR_VERSION_5:
|
2527
|
2552
|
xyzA[0] = (unsigned short)_boxes[index].xmin * 1024.0;
|
2528
|
2553
|
xyzA[1] = (short)_boxes[index].true_floor;
|
2529
|
2554
|
xyzA[2] = (unsigned short)_boxes[index].zmin * 1024.0;
|
|
@@ -2553,8 +2578,13 @@ unsigned int TombRaider::getRoomBoxCount(unsigned int roomIndex)
|
2553
|
2578
|
switch (getEngine())
|
2554
|
2579
|
{
|
2555
|
2580
|
case TR_VERSION_UNKNOWN:
|
|
2581
|
+ default:
|
2556
|
2582
|
break;
|
2557
|
|
- default: // TR1-TR5
|
|
2583
|
+ case TR_VERSION_1:
|
|
2584
|
+ case TR_VERSION_2:
|
|
2585
|
+ case TR_VERSION_3:
|
|
2586
|
+ case TR_VERSION_4:
|
|
2587
|
+ case TR_VERSION_5:
|
2558
|
2588
|
return _num_boxes;
|
2559
|
2589
|
}
|
2560
|
2590
|
|
|
@@ -2712,7 +2742,6 @@ int TombRaider::getRoomLight(unsigned int roomIndex, unsigned int index,
|
2712
|
2742
|
{
|
2713
|
2743
|
case TR_VERSION_UNKNOWN:
|
2714
|
2744
|
return -1;
|
2715
|
|
- break;
|
2716
|
2745
|
case TR_VERSION_1:
|
2717
|
2746
|
case TR_VERSION_2:
|
2718
|
2747
|
case TR_VERSION_3:
|
|
@@ -2838,7 +2867,10 @@ unsigned int TombRaider::getRoomLightCount(unsigned int roomIndex)
|
2838
|
2867
|
break;
|
2839
|
2868
|
case TR_VERSION_5:
|
2840
|
2869
|
return mRoomsTR5[roomIndex].numRoomLights;
|
2841
|
|
- break;
|
|
2870
|
+ case TR_VERSION_1:
|
|
2871
|
+ case TR_VERSION_2:
|
|
2872
|
+ case TR_VERSION_3:
|
|
2873
|
+ case TR_VERSION_4:
|
2842
|
2874
|
default:
|
2843
|
2875
|
return _rooms[roomIndex].num_lights;
|
2844
|
2876
|
}
|
|
@@ -2859,8 +2891,8 @@ int TombRaider::getRoomModel(unsigned int roomIndex, unsigned int index,
|
2859
|
2891
|
switch (getEngine())
|
2860
|
2892
|
{
|
2861
|
2893
|
case TR_VERSION_UNKNOWN:
|
|
2894
|
+ default:
|
2862
|
2895
|
return -1;
|
2863
|
|
- break;
|
2864
|
2896
|
case TR_VERSION_5:
|
2865
|
2897
|
count = NumStaticMeshes();
|
2866
|
2898
|
|
|
@@ -2880,7 +2912,10 @@ int TombRaider::getRoomModel(unsigned int roomIndex, unsigned int index,
|
2880
|
2912
|
}
|
2881
|
2913
|
}
|
2882
|
2914
|
break;
|
2883
|
|
- default: // TR1-TR4
|
|
2915
|
+ case TR_VERSION_1:
|
|
2916
|
+ case TR_VERSION_2:
|
|
2917
|
+ case TR_VERSION_3:
|
|
2918
|
+ case TR_VERSION_4:
|
2884
|
2919
|
count = NumStaticMeshes();
|
2885
|
2920
|
|
2886
|
2921
|
for (i = 0; i < count; ++i)
|
|
@@ -2912,11 +2947,14 @@ unsigned int TombRaider::getRoomModelCount(unsigned int roomIndex)
|
2912
|
2947
|
switch (getEngine())
|
2913
|
2948
|
{
|
2914
|
2949
|
case TR_VERSION_UNKNOWN:
|
|
2950
|
+ default:
|
2915
|
2951
|
break;
|
2916
|
2952
|
case TR_VERSION_5:
|
2917
|
2953
|
return mRoomsTR5[roomIndex].numStaticMeshes;
|
2918
|
|
- break;
|
2919
|
|
- default: // TR1-TR4
|
|
2954
|
+ case TR_VERSION_1:
|
|
2955
|
+ case TR_VERSION_2:
|
|
2956
|
+ case TR_VERSION_3:
|
|
2957
|
+ case TR_VERSION_4:
|
2920
|
2958
|
return _rooms[roomIndex].num_static_meshes;
|
2921
|
2959
|
}
|
2922
|
2960
|
|
|
@@ -2934,6 +2972,7 @@ int TombRaider::getRoomPortal(unsigned int roomIndex, unsigned int index,
|
2934
|
2972
|
switch (getEngine())
|
2935
|
2973
|
{
|
2936
|
2974
|
case TR_VERSION_UNKNOWN:
|
|
2975
|
+ default:
|
2937
|
2976
|
break;
|
2938
|
2977
|
case TR_VERSION_5:
|
2939
|
2978
|
*adjoiningRoom = mRoomsTR5[roomIndex].doors[index].adjoining_room;
|
|
@@ -2955,7 +2994,10 @@ int TombRaider::getRoomPortal(unsigned int roomIndex, unsigned int index,
|
2955
|
2994
|
vertices[10] = mRoomsTR5[roomIndex].doors[index].vertices[3].y;
|
2956
|
2995
|
vertices[11] = mRoomsTR5[roomIndex].doors[index].vertices[3].z;
|
2957
|
2996
|
break;
|
2958
|
|
- default: // TR1-TR4
|
|
2997
|
+ case TR_VERSION_1:
|
|
2998
|
+ case TR_VERSION_2:
|
|
2999
|
+ case TR_VERSION_3:
|
|
3000
|
+ case TR_VERSION_4:
|
2959
|
3001
|
*adjoiningRoom = _rooms[roomIndex].portals[index].adjoining_room;
|
2960
|
3002
|
|
2961
|
3003
|
normal[0] = _rooms[roomIndex].portals[index].normal.x;// / NORMAL_SCALE;
|
|
@@ -2988,11 +3030,14 @@ unsigned int TombRaider::getRoomPortalCount(unsigned int roomIndex)
|
2988
|
3030
|
switch (getEngine())
|
2989
|
3031
|
{
|
2990
|
3032
|
case TR_VERSION_UNKNOWN:
|
|
3033
|
+ default:
|
2991
|
3034
|
break;
|
2992
|
3035
|
case TR_VERSION_5:
|
2993
|
3036
|
return mRoomsTR5[roomIndex].numDoors;
|
2994
|
|
- break;
|
2995
|
|
- default: // TR1-TR4
|
|
3037
|
+ case TR_VERSION_1:
|
|
3038
|
+ case TR_VERSION_2:
|
|
3039
|
+ case TR_VERSION_3:
|
|
3040
|
+ case TR_VERSION_4:
|
2996
|
3041
|
return _rooms[roomIndex].num_portals;
|
2997
|
3042
|
}
|
2998
|
3043
|
|
|
@@ -3013,6 +3058,7 @@ void TombRaider::getRoomRectangle(unsigned int roomIndex,
|
3013
|
3058
|
switch (getEngine())
|
3014
|
3059
|
{
|
3015
|
3060
|
case TR_VERSION_UNKNOWN:
|
|
3061
|
+ default:
|
3016
|
3062
|
break;
|
3017
|
3063
|
case TR_VERSION_5:
|
3018
|
3064
|
for (i = 0, count = 0; i < mRoomsTR5[roomIndex].numLayers; ++i)
|
|
@@ -3041,7 +3087,10 @@ void TombRaider::getRoomRectangle(unsigned int roomIndex,
|
3041
|
3087
|
count += mRoomsTR5[roomIndex].layers[i].numLayerRectangles;
|
3042
|
3088
|
}
|
3043
|
3089
|
break;
|
3044
|
|
- default:
|
|
3090
|
+ case TR_VERSION_1:
|
|
3091
|
+ case TR_VERSION_2:
|
|
3092
|
+ case TR_VERSION_3:
|
|
3093
|
+ case TR_VERSION_4:
|
3045
|
3094
|
tIndex = _rooms[roomIndex].room_data.rectangles[rectangleIndex].texture;
|
3046
|
3095
|
*texture = _object_textures[tIndex].tile;
|
3047
|
3096
|
*flags = 0;
|
|
@@ -3082,6 +3131,7 @@ unsigned int TombRaider::getRoomRectangleCount(unsigned int roomIndex)
|
3082
|
3131
|
switch (getEngine())
|
3083
|
3132
|
{
|
3084
|
3133
|
case TR_VERSION_UNKNOWN:
|
|
3134
|
+ default:
|
3085
|
3135
|
break;
|
3086
|
3136
|
case TR_VERSION_5:
|
3087
|
3137
|
for (i = 0, count = 0; i < mRoomsTR5[roomIndex].numLayers; ++i)
|
|
@@ -3090,8 +3140,10 @@ unsigned int TombRaider::getRoomRectangleCount(unsigned int roomIndex)
|
3090
|
3140
|
}
|
3091
|
3141
|
|
3092
|
3142
|
return count;
|
3093
|
|
- break;
|
3094
|
|
- default:
|
|
3143
|
+ case TR_VERSION_1:
|
|
3144
|
+ case TR_VERSION_2:
|
|
3145
|
+ case TR_VERSION_3:
|
|
3146
|
+ case TR_VERSION_4:
|
3095
|
3147
|
return ((_rooms[roomIndex].room_data.num_rectangles < 0) ? 0 :
|
3096
|
3148
|
_rooms[roomIndex].room_data.num_rectangles);
|
3097
|
3149
|
}
|
|
@@ -3119,6 +3171,7 @@ int TombRaider::getRoomSector(unsigned int roomIndex, unsigned int index,
|
3119
|
3171
|
switch (getEngine())
|
3120
|
3172
|
{
|
3121
|
3173
|
case TR_VERSION_UNKNOWN:
|
|
3174
|
+ default:
|
3122
|
3175
|
break;
|
3123
|
3176
|
case TR_VERSION_5:
|
3124
|
3177
|
*floorDataIndex = mRoomsTR5[roomIndex].sectors[index].fd_index;
|
|
@@ -3135,7 +3188,10 @@ int TombRaider::getRoomSector(unsigned int roomIndex, unsigned int index,
|
3135
|
3188
|
*floor = mRoomsTR5[roomIndex].sectors[index].floor * 256.0f;
|
3136
|
3189
|
*ceiling = mRoomsTR5[roomIndex].sectors[index].ceiling * 256.0f;
|
3137
|
3190
|
break;
|
3138
|
|
- default:
|
|
3191
|
+ case TR_VERSION_1:
|
|
3192
|
+ case TR_VERSION_2:
|
|
3193
|
+ case TR_VERSION_3:
|
|
3194
|
+ case TR_VERSION_4:
|
3139
|
3195
|
*floorDataIndex = _rooms[roomIndex].sector_list[index].fd_index;
|
3140
|
3196
|
*boxIndex = _rooms[roomIndex].sector_list[index].box_index;
|
3141
|
3197
|
*roomBelow = _rooms[roomIndex].sector_list[index].room_below;
|
|
@@ -3183,6 +3239,7 @@ unsigned int TombRaider::getRoomSectorCount(unsigned int roomIndex,
|
3183
|
3239
|
switch (getEngine())
|
3184
|
3240
|
{
|
3185
|
3241
|
case TR_VERSION_UNKNOWN:
|
|
3242
|
+ default:
|
3186
|
3243
|
break;
|
3187
|
3244
|
case TR_VERSION_5:
|
3188
|
3245
|
// width of sector list
|
|
@@ -3193,7 +3250,10 @@ unsigned int TombRaider::getRoomSectorCount(unsigned int roomIndex,
|
3193
|
3250
|
|
3194
|
3251
|
return (mRoomsTR5[roomIndex].numZSectors *
|
3195
|
3252
|
mRoomsTR5[roomIndex].numXSectors);
|
3196
|
|
- default:
|
|
3253
|
+ case TR_VERSION_1:
|
|
3254
|
+ case TR_VERSION_2:
|
|
3255
|
+ case TR_VERSION_3:
|
|
3256
|
+ case TR_VERSION_4:
|
3197
|
3257
|
// width of sector list
|
3198
|
3258
|
*zSectorsCount = _rooms[roomIndex].num_zsectors;
|
3199
|
3259
|
|
|
@@ -3355,11 +3415,14 @@ unsigned int TombRaider::getRoomSpriteCount(unsigned int roomIndex)
|
3355
|
3415
|
switch (getEngine())
|
3356
|
3416
|
{
|
3357
|
3417
|
case TR_VERSION_UNKNOWN:
|
|
3418
|
+ default:
|
3358
|
3419
|
break;
|
3359
|
3420
|
case TR_VERSION_5:
|
3360
|
3421
|
return 0; // No room sprites in TRC
|
3361
|
|
- break;
|
3362
|
|
- default:
|
|
3422
|
+ case TR_VERSION_1:
|
|
3423
|
+ case TR_VERSION_2:
|
|
3424
|
+ case TR_VERSION_3:
|
|
3425
|
+ case TR_VERSION_4:
|
3363
|
3426
|
return ((_rooms[roomIndex].room_data.num_sprites < 0) ?
|
3364
|
3427
|
0 : _rooms[roomIndex].room_data.num_sprites);
|
3365
|
3428
|
}
|
|
@@ -3380,6 +3443,7 @@ void TombRaider::getRoomTriangle(unsigned int roomIndex,
|
3380
|
3443
|
switch (getEngine())
|
3381
|
3444
|
{
|
3382
|
3445
|
case TR_VERSION_UNKNOWN:
|
|
3446
|
+ default:
|
3383
|
3447
|
break;
|
3384
|
3448
|
case TR_VERSION_5:
|
3385
|
3449
|
for (i = 0, count = 0; i < mRoomsTR5[roomIndex].numLayers; ++i)
|
|
@@ -3408,7 +3472,10 @@ void TombRaider::getRoomTriangle(unsigned int roomIndex,
|
3408
|
3472
|
count += mRoomsTR5[roomIndex].layers[i].numLayerTriangles;
|
3409
|
3473
|
}
|
3410
|
3474
|
break;
|
3411
|
|
- default:
|
|
3475
|
+ case TR_VERSION_1:
|
|
3476
|
+ case TR_VERSION_2:
|
|
3477
|
+ case TR_VERSION_3:
|
|
3478
|
+ case TR_VERSION_4:
|
3412
|
3479
|
tIndex = _rooms[roomIndex].room_data.triangles[triangleIndex].texture;
|
3413
|
3480
|
*texture = _object_textures[tIndex].tile;
|
3414
|
3481
|
*flags = 0;
|
|
@@ -3454,6 +3521,7 @@ void TombRaider::getRoomTriangles(unsigned int index, int textureOffset,
|
3454
|
3521
|
switch (getEngine())
|
3455
|
3522
|
{
|
3456
|
3523
|
case TR_VERSION_UNKNOWN:
|
|
3524
|
+ default:
|
3457
|
3525
|
break;
|
3458
|
3526
|
case TR_VERSION_5:
|
3459
|
3527
|
for (i = 0, count = 0; i < mRoomsTR5[index].numLayers; ++i)
|
|
@@ -3461,9 +3529,12 @@ void TombRaider::getRoomTriangles(unsigned int index, int textureOffset,
|
3461
|
3529
|
count += mRoomsTR5[index].layers[i].numLayerTriangles;
|
3462
|
3530
|
}
|
3463
|
3531
|
|
3464
|
|
- // FIXME!!!
|
|
3532
|
+ //! \fixme !!!
|
3465
|
3533
|
break;
|
3466
|
|
- default:
|
|
3534
|
+ case TR_VERSION_1:
|
|
3535
|
+ case TR_VERSION_2:
|
|
3536
|
+ case TR_VERSION_3:
|
|
3537
|
+ case TR_VERSION_4:
|
3467
|
3538
|
// Generate textured triangles
|
3468
|
3539
|
count = ((_rooms[index].room_data.num_triangles < 0) ? 0 :
|
3469
|
3540
|
_rooms[index].room_data.num_triangles);
|
|
@@ -3521,6 +3592,7 @@ unsigned int TombRaider::getRoomTriangleCount(unsigned int roomIndex)
|
3521
|
3592
|
switch (getEngine())
|
3522
|
3593
|
{
|
3523
|
3594
|
case TR_VERSION_UNKNOWN:
|
|
3595
|
+ default:
|
3524
|
3596
|
break;
|
3525
|
3597
|
case TR_VERSION_5:
|
3526
|
3598
|
for (i = 0, count = 0; i < mRoomsTR5[roomIndex].numLayers; ++i)
|
|
@@ -3529,8 +3601,10 @@ unsigned int TombRaider::getRoomTriangleCount(unsigned int roomIndex)
|
3529
|
3601
|
}
|
3530
|
3602
|
|
3531
|
3603
|
return count;
|
3532
|
|
- break;
|
3533
|
|
- default:
|
|
3604
|
+ case TR_VERSION_1:
|
|
3605
|
+ case TR_VERSION_2:
|
|
3606
|
+ case TR_VERSION_3:
|
|
3607
|
+ case TR_VERSION_4:
|
3534
|
3608
|
return ((_rooms[roomIndex].room_data.num_triangles < 0) ? 0 :
|
3535
|
3609
|
_rooms[roomIndex].room_data.num_triangles);
|
3536
|
3610
|
}
|
|
@@ -3551,9 +3625,14 @@ void TombRaider::getRoomVertex(unsigned int roomIndex,unsigned int vertexIndex,
|
3551
|
3625
|
switch (getEngine())
|
3552
|
3626
|
{
|
3553
|
3627
|
case TR_VERSION_5:
|
3554
|
|
- // FIXME!!!
|
|
3628
|
+ //! \fixme !!!
|
3555
|
3629
|
print("getRoomVertex", "Error: No TRC implementation is the answer");
|
3556
|
3630
|
break;
|
|
3631
|
+ case TR_VERSION_1:
|
|
3632
|
+ case TR_VERSION_2:
|
|
3633
|
+ case TR_VERSION_3:
|
|
3634
|
+ case TR_VERSION_4:
|
|
3635
|
+ case TR_VERSION_UNKNOWN:
|
3557
|
3636
|
default:
|
3558
|
3637
|
vertex = &_rooms[index].room_data.vertices[i].vertex;
|
3559
|
3638
|
|
|
@@ -3585,6 +3664,9 @@ void TombRaider::getRoomVertex(unsigned int roomIndex,unsigned int vertexIndex,
|
3585
|
3664
|
rgba[2] = color_value + ((float)_rooms[index].room_light_colour.b /
|
3586
|
3665
|
mRoomVertexLightingFactor);
|
3587
|
3666
|
break;
|
|
3667
|
+ case TR_VERSION_2:
|
|
3668
|
+ case TR_VERSION_5: // Not really...
|
|
3669
|
+ case TR_VERSION_UNKNOWN:
|
3588
|
3670
|
default:
|
3589
|
3671
|
color_value = _rooms[index].room_data.vertices[i].lighting1;
|
3590
|
3672
|
color_value = (1.1 - (color_value / 8192.0));
|
|
@@ -3634,6 +3716,7 @@ void TombRaider::getRoomVertexArrays(unsigned int roomIndex,
|
3634
|
3716
|
switch (getEngine())
|
3635
|
3717
|
{
|
3636
|
3718
|
case TR_VERSION_UNKNOWN:
|
|
3719
|
+ default:
|
3637
|
3720
|
break;
|
3638
|
3721
|
case TR_VERSION_5:
|
3639
|
3722
|
*vertexCount = count;
|
|
@@ -3667,7 +3750,10 @@ void TombRaider::getRoomVertexArrays(unsigned int roomIndex,
|
3667
|
3750
|
}
|
3668
|
3751
|
}
|
3669
|
3752
|
break;
|
3670
|
|
- default:
|
|
3753
|
+ case TR_VERSION_1:
|
|
3754
|
+ case TR_VERSION_2:
|
|
3755
|
+ case TR_VERSION_3:
|
|
3756
|
+ case TR_VERSION_4:
|
3671
|
3757
|
*vertexCount = count;
|
3672
|
3758
|
*vertices = new float[count*3];
|
3673
|
3759
|
*normalCount = 0; //! \fixme Do some TR1-TR4 levels support normals here?
|
|
@@ -3695,6 +3781,9 @@ void TombRaider::getRoomVertexArrays(unsigned int roomIndex,
|
3695
|
3781
|
color_value = _rooms[roomIndex].room_data.vertices[i].lighting1;
|
3696
|
3782
|
color_value /= 16384.0;
|
3697
|
3783
|
break;
|
|
3784
|
+ case TR_VERSION_2:
|
|
3785
|
+ case TR_VERSION_5:
|
|
3786
|
+ case TR_VERSION_UNKNOWN:
|
3698
|
3787
|
default:
|
3699
|
3788
|
color_value = _rooms[roomIndex].room_data.vertices[i].lighting1;
|
3700
|
3789
|
color_value = (1.1 - (color_value / 8192.0));
|
|
@@ -3716,6 +3805,10 @@ void TombRaider::getRoomVertexArrays(unsigned int roomIndex,
|
3716
|
3805
|
((float)_rooms[roomIndex].room_light_colour.b /
|
3717
|
3806
|
mRoomVertexLightingFactor));
|
3718
|
3807
|
break;
|
|
3808
|
+ case TR_VERSION_1:
|
|
3809
|
+ case TR_VERSION_2:
|
|
3810
|
+ case TR_VERSION_5:
|
|
3811
|
+ case TR_VERSION_UNKNOWN:
|
3719
|
3812
|
default:
|
3720
|
3813
|
rgba[0] = color_value;
|
3721
|
3814
|
rgba[1] = color_value;
|
|
@@ -3752,6 +3845,7 @@ unsigned int TombRaider::getRoomVertexCount(unsigned int roomIndex)
|
3752
|
3845
|
switch (getEngine())
|
3753
|
3846
|
{
|
3754
|
3847
|
case TR_VERSION_UNKNOWN:
|
|
3848
|
+ default:
|
3755
|
3849
|
break;
|
3756
|
3850
|
case TR_VERSION_5:
|
3757
|
3851
|
for (i = 0, count = 0; i < mRoomsTR5[roomIndex].numLayers; ++i)
|
|
@@ -3760,8 +3854,10 @@ unsigned int TombRaider::getRoomVertexCount(unsigned int roomIndex)
|
3760
|
3854
|
}
|
3761
|
3855
|
|
3762
|
3856
|
return count;
|
3763
|
|
- break;
|
3764
|
|
- default:
|
|
3857
|
+ case TR_VERSION_1:
|
|
3858
|
+ case TR_VERSION_2:
|
|
3859
|
+ case TR_VERSION_3:
|
|
3860
|
+ case TR_VERSION_4:
|
3765
|
3861
|
return ((_rooms[roomIndex].room_data.num_vertices < 0) ? 0 :
|
3766
|
3862
|
_rooms[roomIndex].room_data.num_vertices);
|
3767
|
3863
|
}
|
|
@@ -3792,6 +3888,9 @@ int TombRaider::getSkyModelId()
|
3792
|
3888
|
case TR_VERSION_4:
|
3793
|
3889
|
id = 459;
|
3794
|
3890
|
break;
|
|
3891
|
+ case TR_VERSION_1:
|
|
3892
|
+ case TR_VERSION_5:
|
|
3893
|
+ case TR_VERSION_UNKNOWN:
|
3795
|
3894
|
default:
|
3796
|
3895
|
return -1;
|
3797
|
3896
|
}
|
|
@@ -3989,6 +4088,7 @@ void TombRaider::getSoundSample(unsigned int index,
|
3989
|
4088
|
case TR_VERSION_5:
|
3990
|
4089
|
getRiffDataTR4(index, bytes, data);
|
3991
|
4090
|
break;
|
|
4091
|
+ case TR_VERSION_UNKNOWN:
|
3992
|
4092
|
default:
|
3993
|
4093
|
;
|
3994
|
4094
|
}
|
|
@@ -4016,6 +4116,7 @@ unsigned int TombRaider::getSoundSamplesCount()
|
4016
|
4116
|
case TR_VERSION_5:
|
4017
|
4117
|
count = mNumTR4Samples;
|
4018
|
4118
|
break;
|
|
4119
|
+ case TR_VERSION_UNKNOWN:
|
4019
|
4120
|
default:
|
4020
|
4121
|
count = 0;
|
4021
|
4122
|
}
|
|
@@ -4042,6 +4143,7 @@ bool TombRaider::isRoomValid(int index)
|
4042
|
4143
|
switch (getEngine())
|
4043
|
4144
|
{
|
4044
|
4145
|
case TR_VERSION_UNKNOWN:
|
|
4146
|
+ default:
|
4045
|
4147
|
break;
|
4046
|
4148
|
case TR_VERSION_5:
|
4047
|
4149
|
if (index < _num_rooms &&
|
|
@@ -4705,7 +4807,7 @@ int TombRaider::Fread(void *buffer, size_t size, size_t count, FILE *f)
|
4705
|
4807
|
print("Fread", "ERROR: Failed fread. Should Abort. @ 0x%x", offset);
|
4706
|
4808
|
reset();
|
4707
|
4809
|
exit(2);
|
4708
|
|
- return -1;
|
|
4810
|
+ // return -1; // Unreachable anyways
|
4709
|
4811
|
}
|
4710
|
4812
|
|
4711
|
4813
|
return count;
|
|
@@ -4748,7 +4850,7 @@ int TombRaider::getRiffOffsets(unsigned char *riffData,
|
4748
|
4850
|
unsigned int **offsets,
|
4749
|
4851
|
unsigned int numOffsets)
|
4750
|
4852
|
{
|
4751
|
|
- unsigned int i, j, riffCount, state;
|
|
4853
|
+ unsigned int i, j = 0, riffCount, state;
|
4752
|
4854
|
|
4753
|
4855
|
*offsets = new unsigned int[numOffsets];
|
4754
|
4856
|
|
|
@@ -4985,6 +5087,10 @@ unsigned char *TombRaider::getTexTile(int texture)
|
4985
|
5087
|
}
|
4986
|
5088
|
}
|
4987
|
5089
|
break;
|
|
5090
|
+ case TR_VERSION_1:
|
|
5091
|
+ case TR_VERSION_2:
|
|
5092
|
+ case TR_VERSION_5:
|
|
5093
|
+ case TR_VERSION_UNKNOWN:
|
4988
|
5094
|
default:
|
4989
|
5095
|
;
|
4990
|
5096
|
}
|