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 573... | Line 579... | ||
573 | gProgram_state.current_depth_effect.end); |
579 | gProgram_state.current_depth_effect.end); |
574 | } |
580 | } |
575 | 581 | ||
576 | // IDA: void __usercall DepthEffect(br_pixelmap *pRender_buffer@<EAX>, br_pixelmap *pDepth_buffer@<EDX>, br_actor *pCamera@<EBX>, br_matrix34 *pCamera_to_world@<ECX>) |
582 | // IDA: void __usercall DepthEffect(br_pixelmap *pRender_buffer@<EAX>, br_pixelmap *pDepth_buffer@<EDX>, br_actor *pCamera@<EBX>, br_matrix34 *pCamera_to_world@<ECX>) |
577 | void DepthEffect(br_pixelmap* pRender_buffer, br_pixelmap* pDepth_buffer, br_actor* pCamera, br_matrix34* pCamera_to_world) { |
583 | void DepthEffect(br_pixelmap* pRender_buffer, br_pixelmap* pDepth_buffer, br_actor* pCamera, br_matrix34* pCamera_to_world) { |
578 | LOG_TRACE("(%p, %p, %p, %p)", pRender_buffer, pDepth_buffer, pCamera, pCamera_to_world); |
584 | LOG_TRACE("(%p, %p, %p, %p)", pRender_buffer, pDepth_buffer, pCamera, pCamera_to_world); |
579 | 585 | ||
580 | if (gProgram_state.current_depth_effect.type == eDepth_effect_darkness) { |
586 | if (gProgram_state.current_depth_effect.type == eDepth_effect_darkness) { |
581 | DoDepthCue(pRender_buffer, pDepth_buffer); |
587 | DoDepthCue(pRender_buffer, pDepth_buffer); |
582 | } |
588 | } |
583 | if (gProgram_state.current_depth_effect.type == eDepth_effect_fog) { |
589 | if (gProgram_state.current_depth_effect.type == eDepth_effect_fog) { |
Line 733... | Line 739... | ||
733 | gProgram_state.default_depth_effect.end = gProgram_state.current_depth_effect.end; |
739 | gProgram_state.default_depth_effect.end = gProgram_state.current_depth_effect.end; |
734 | } |
740 | } |
735 | 741 | ||
736 | // IDA: void __cdecl AssertYons() |
742 | // IDA: void __cdecl AssertYons() |
737 | void AssertYons(void) { |
743 | void AssertYons(void) { |
738 | br_camera* camera_ptr; |
744 | br_camera* camera_ptr; |
739 | int i; |
745 | int i; |
740 | LOG_TRACE("()"); |
746 | LOG_TRACE("()"); |
741 | 747 | ||
742 | for (i = 0; i < COUNT_OF(gCamera_list); ++i) { |
748 | for (i = 0; i < COUNT_OF(gCamera_list); ++i) { |
743 | camera_ptr = gCamera_list[i]->type_data; |
749 | camera_ptr = gCamera_list[i]->type_data; |
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 894... | Line 900... | ||
894 | BrMaterialUpdate(gHorizon_material, -1); |
900 | BrMaterialUpdate(gHorizon_material, -1); |
895 | } |
901 | } |
896 | } |
902 | } |
897 | } |
903 | } |
898 | gSky_on = pOn; |
904 | gSky_on = pOn; |
899 | } |
905 | } |
900 | 906 | ||
901 | // IDA: void __cdecl ToggleSkyQuietly() |
907 | // IDA: void __cdecl ToggleSkyQuietly() |
902 | void ToggleSkyQuietly(void) { |
908 | void ToggleSkyQuietly(void) { |
903 | br_pixelmap* temp; |
909 | br_pixelmap* temp; |
904 | LOG_TRACE("()"); |
910 | LOG_TRACE("()"); |
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("()"); |
935 | return gDepth_cueing_on; |
933 | return gDepth_cueing_on; |
936 | } |
934 | } |
937 | 935 | ||
938 | // IDA: void __usercall SetDepthCueingOn(int pOn@<EAX>) |
936 | // IDA: void __usercall SetDepthCueingOn(int pOn@<EAX>) |
939 | void SetDepthCueingOn(int pOn) { |
937 | void SetDepthCueingOn(int pOn) { |
940 | LOG_TRACE("(%d)", pOn); |
938 | LOG_TRACE("(%d)", pOn); |
941 | if (pOn != gDepth_cueing_on && gHorizon_material) { |
939 | if (pOn != gDepth_cueing_on && gHorizon_material) { |
942 | InstantDepthChange(gSwap_depth_effect_type, gProgram_state.current_depth_effect.sky_texture, gSwap_depth_effect_start, gSwap_depth_effect_end); |
940 | InstantDepthChange(gSwap_depth_effect_type, gProgram_state.current_depth_effect.sky_texture, gSwap_depth_effect_start, gSwap_depth_effect_end); |
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("()"); |