Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18 | Rev 20 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "depth.h" |
1 | #include "depth.h" |
2 | 2 | ||
3 | #include "brender.h" |
3 | #include "brender/brender.h" |
4 | #include "displays.h" |
4 | #include "displays.h" |
5 | #include "errors.h" |
5 | #include "errors.h" |
6 | #include "globvars.h" |
6 | #include "globvars.h" |
7 | #include "globvrkm.h" |
7 | #include "globvrkm.h" |
8 | #include "globvrpb.h" |
8 | #include "globvrpb.h" |
Line 337... | Line 337... | ||
337 | gHorizon_material = BrMaterialLoad(the_path); |
337 | gHorizon_material = BrMaterialLoad(the_path); |
338 | if (gHorizon_material == NULL) { |
338 | if (gHorizon_material == NULL) { |
339 | FatalError(kFatalError_FindSkyMaterial_S, "HORIZON.MAT"); // 2nd argument added |
339 | FatalError(kFatalError_FindSkyMaterial_S, "HORIZON.MAT"); // 2nd argument added |
340 | } |
340 | } |
341 | gHorizon_material->index_blend = BrPixelmapAllocate(BR_PMT_INDEX_8, 256, 256, NULL, 0); |
341 | gHorizon_material->index_blend = BrPixelmapAllocate(BR_PMT_INDEX_8, 256, 256, NULL, 0); |
- | 342 | ||
- | 343 | // HACK: moved below loop |
|
342 | BrTableAdd |
344 | // BrTableAdd(gHorizon_material->index_blend); |
343 | for (i = 0; i < 256; i++) { |
345 | for (i = 0; i < 256; i++) { |
344 | for (j = 0; j < 256; j++) { |
346 | for (j = 0; j < 256; j++) { |
345 | *((tU8*)gHorizon_material->index_blend->pixels + 256 * i + j) = j; |
347 | *((tU8*)gHorizon_material->index_blend->pixels + 256 * i + j) = j; |
346 | } |
348 | } |
347 | } |
349 | } |
- | 350 | // HACK: this should be above the for loop. Haven't been able to figure out how this is working in OG, as changes made to the pixelmap |
|
- | 351 | // don't update the stored copy without calling `BrTableUpdate`. |
|
- | 352 | BrTableAdd(gHorizon_material->index_blend); |
|
- | 353 | ||
348 | gHorizon_material->flags |= BR_MATF_PERSPECTIVE; |
354 | gHorizon_material->flags |= BR_MATF_PERSPECTIVE; |
349 | BrMaterialAdd(gHorizon_material); |
355 | BrMaterialAdd(gHorizon_material); |
350 | gForward_sky_model = CreateHorizonModel(gCamera); |
356 | gForward_sky_model = CreateHorizonModel(gCamera); |
351 | gRearview_sky_model = CreateHorizonModel(gRearview_camera); |
357 | gRearview_sky_model = CreateHorizonModel(gRearview_camera); |
352 | BrModelAdd(gForward_sky_model); |
358 | BrModelAdd(gForward_sky_model); |
Line 816... | Line 822... | ||
816 | camera_ptr->field_of_view += 0x1c7; // 2.4993896484375 degrees |
822 | camera_ptr->field_of_view += 0x1c7; // 2.4993896484375 degrees |
817 | if (camera_ptr->field_of_view > 0x78e3) { // 169.9969482421875 degrees |
823 | if (camera_ptr->field_of_view > 0x78e3) { // 169.9969482421875 degrees |
818 | camera_ptr->field_of_view = 0x78e3; |
824 | camera_ptr->field_of_view = 0x78e3; |
819 | } |
825 | } |
820 | #ifdef DETHRACE_FIX_BUGS |
826 | #ifdef DETHRACE_FIX_BUGS |
821 | sprintf(s, "Camera angle increased to %f", (float) |
827 | sprintf(s, "Camera angle increased to %f", (float)BrAngleToDegrees(camera_ptr->field_of_view)); |
822 | #else |
828 | #else |
823 | sprintf(s, "Camera angle increased to %d", gProgram_state.current_depth_effect.end); |
829 | sprintf(s, "Camera angle increased to %d", gProgram_state.current_depth_effect.end); |
824 | #endif |
830 | #endif |
825 | NewTextHeadupSlot(4, 0, 500, -1, s); |
831 | NewTextHeadupSlot(4, 0, 500, -1, s); |
826 | } |
832 | } |
Line 838... | Line 844... | ||
838 | camera_ptr->field_of_view -= 0x1c7; // 2.4993896484375 degrees |
844 | camera_ptr->field_of_view -= 0x1c7; // 2.4993896484375 degrees |
839 | if (camera_ptr->field_of_view < 0x71c) { // 9.99755859375 degrees |
845 | if (camera_ptr->field_of_view < 0x71c) { // 9.99755859375 degrees |
840 | camera_ptr->field_of_view = 0x71c; |
846 | camera_ptr->field_of_view = 0x71c; |
841 | } |
847 | } |
842 | #ifdef DETHRACE_FIX_BUGS |
848 | #ifdef DETHRACE_FIX_BUGS |
843 | sprintf(s, "Camera angle decreased to %f", (float) |
849 | sprintf(s, "Camera angle decreased to %f", (float)BrAngleToDegrees(camera_ptr->field_of_view)); |
844 | #else |
850 | #else |
845 | sprintf(s, "Camera angle decreased to %d", gProgram_state.current_depth_effect.end); |
851 | sprintf(s, "Camera angle decreased to %d", gProgram_state.current_depth_effect.end); |
846 | #endif |
852 | #endif |
847 | NewTextHeadupSlot(4, 0, 500, -1, s); |
853 | NewTextHeadupSlot(4, 0, 500, -1, s); |
848 | } |
854 | } |
Line 916... | Line 922... | ||
916 | } |
922 | } |
917 | 923 | ||
918 | // IDA: void __cdecl ToggleSky() |
924 | // IDA: void __cdecl ToggleSky() |
919 | void ToggleSky(void) { |
925 | void ToggleSky(void) { |
920 | LOG_TRACE("()"); |
926 | LOG_TRACE("()"); |
921 | - | ||
922 |
|
927 | NOT_IMPLEMENTED(); |
923 | if (gProgram_state.current_depth_effect.sky_texture != NULL) { |
- | |
924 | NewTextHeadupSlot(4, 0, 2000, -4, GetMiscString(kMiscString_SkyTextureOn)); |
- | |
925 | } else if (gSwap_sky_texture != NULL) { |
- | |
926 | NewTextHeadupSlot(4, 0, 2000, -4, GetMiscString(kMiscString_SkyTextureOff)); |
- | |
927 | } else { |
- | |
928 | NewTextHeadupSlot(4, 0, 2000, -4, GetMiscString(kMiscString_ThereIsNoSkyTextureForThisRace)); |
- | |
929 | } |
- | |
930 | } |
928 | } |
931 | 929 | ||
932 | // IDA: int __cdecl GetDepthCueingOn() |
930 | // IDA: int __cdecl GetDepthCueingOn() |
933 | int GetDepthCueingOn(void) { |
931 | int GetDepthCueingOn(void) { |
934 | LOG_TRACE("()"); |
932 | LOG_TRACE("()"); |
Line 968... | Line 966... | ||
968 | } |
966 | } |
969 | 967 | ||
970 | // IDA: void __cdecl ToggleDepthCueing() |
968 | // IDA: void __cdecl ToggleDepthCueing() |
971 | void ToggleDepthCueing(void) { |
969 | void ToggleDepthCueing(void) { |
972 | LOG_TRACE("()"); |
970 | LOG_TRACE("()"); |
973 | - | ||
974 | SetDepthCueingOn(!GetDepthCueingOn()); |
- | |
975 | if (gProgram_state.current_depth_effect.type != eDepth_effect_none) { |
- | |
976 | NewTextHeadupSlot(4, 0, 2000, -4, GetMiscString(kMiscString_DepthCueingOn)); |
- | |
977 | } else if (gSwap_depth_effect_type != eDepth_effect_none) { |
- | |
978 | NewTextHeadupSlot(4, 0, 2000, -4, GetMiscString(kMiscString_DepthCueingOff)); |
- | |
979 |
|
971 | NOT_IMPLEMENTED(); |
980 | NewTextHeadupSlot(4, 0, 2000, -4, GetMiscString(kMiscString_ThereIsNoDepthCueingForThisRace)); |
- | |
981 | } |
- | |
982 | } |
972 | } |
983 | 973 | ||
984 | // IDA: void __cdecl ChangeDepthEffect() |
974 | // IDA: void __cdecl ChangeDepthEffect() |
985 | void ChangeDepthEffect(void) { |
975 | void ChangeDepthEffect(void) { |
986 | //br_scalar x1; // Pierre-Marie Baty -- unused variable |
976 | //br_scalar x1; // Pierre-Marie Baty -- unused variable |
Line 990... | Line 980... | ||
990 | //br_scalar z1; // Pierre-Marie Baty -- unused variable |
980 | //br_scalar z1; // Pierre-Marie Baty -- unused variable |
991 | //br_scalar z2; // Pierre-Marie Baty -- unused variable |
981 | //br_scalar z2; // Pierre-Marie Baty -- unused variable |
992 | //br_scalar distance; // Pierre-Marie Baty -- unused variable |
982 | //br_scalar distance; // Pierre-Marie Baty -- unused variable |
993 | //tSpecial_volume* special_volume; // Pierre-Marie Baty -- unused variable |
983 | //tSpecial_volume* special_volume; // Pierre-Marie Baty -- unused variable |
994 | LOG_TRACE("()"); |
984 | LOG_TRACE("()"); |
995 | - | ||
996 | gProgram_state.current_depth_effect.type = gProgram_state.default_depth_effect.type; |
- | |
997 | gProgram_state.current_depth_effect.sky_texture = gProgram_state.default_depth_effect.sky_texture; |
- | |
998 | gProgram_state.current_depth_effect.start = gProgram_state.default_depth_effect.start; |
- | |
999 |
|
985 | STUB_ONCE(); |
1000 | } |
986 | } |
1001 | 987 | ||
1002 | // IDA: void __cdecl MungeForwardSky() |
988 | // IDA: void __cdecl MungeForwardSky() |
1003 | void MungeForwardSky(void) { |
989 | void MungeForwardSky(void) { |
1004 | LOG_TRACE("()"); |
990 | LOG_TRACE("()"); |