diff --git a/source/ai/actor_moving.c b/source/ai/actor_moving.c index a052aa6c..60db1b1a 100644 --- a/source/ai/actor_moving.c +++ b/source/ai/actor_moving.c @@ -204,7 +204,6 @@ symbols in this file: /* ---------- headers */ -#define REAL_MATH_EXTERNAL_POINT_FROM_LINE3D #include "cseries/cseries.h" #include "cseries/errors.h" #define PATH_EXTERNAL_FLEE_ROUTINES @@ -235,7 +234,6 @@ symbols in this file: #include "objects/objects.h" #include "physics/collision_model_definitions.h" #undef PATH_EXTERNAL_FLEE_ROUTINES -#undef REAL_MATH_EXTERNAL_POINT_FROM_LINE3D /* ---------- constants */ @@ -655,24 +653,10 @@ void actor_move_transform_avoidance_vector( real_vector3d const *avoidance_vector, real_vector3d *direction_vector) { - real component; - *direction_vector = *global_zero_vector3d; - - component = avoidance_vector->i; - direction_vector->i += component * avoidance_data->forward.i; - direction_vector->j += component * avoidance_data->forward.j; - direction_vector->k += component * avoidance_data->forward.k; - - component = avoidance_vector->j; - direction_vector->i += component * avoidance_data->left.i; - direction_vector->j += component * avoidance_data->left.j; - direction_vector->k += component * avoidance_data->left.k; - - component = avoidance_vector->k; - direction_vector->i += component * avoidance_data->up.i; - direction_vector->j += component * avoidance_data->up.j; - direction_vector->k += component * avoidance_data->up.k; + point_from_line3d((real_point3d *)direction_vector, &avoidance_data->forward, (avoidance_vector->i), (real_point3d *)direction_vector); + point_from_line3d((real_point3d *)direction_vector, &avoidance_data->left, (avoidance_vector->j), (real_point3d *)direction_vector); + point_from_line3d((real_point3d *)direction_vector, &avoidance_data->up, (avoidance_vector->k), (real_point3d *)direction_vector); return; } @@ -832,10 +816,8 @@ static short actor_move_test_avoidance_vector( real *collision_t, byte *collision_timer) { - struct collision_bsp_test_vector_result collision_result; - real_vector3d offset; - real_vector3d divergence; - real scale; + real_vector3d divergence_direction; + real_vector3d origin_offset; short result = _actor_vector_avoidance_clear; short object_index; @@ -854,46 +836,51 @@ static short actor_move_test_avoidance_vector( *collision_t = REAL_MAX; - actor_move_transform_avoidance_vector(avoidance_data, &avoidance_ray->offset, &offset); - actor_move_transform_avoidance_vector(avoidance_data, &avoidance_ray->divergence, &divergence); + origin_offset = *global_zero_vector3d; + point_from_line3d((real_point3d *)&origin_offset, &avoidance_data->forward, (avoidance_ray->offset.i), (real_point3d *)&origin_offset); + point_from_line3d((real_point3d *)&origin_offset, &avoidance_data->left, (avoidance_ray->offset.j), (real_point3d *)&origin_offset); + point_from_line3d((real_point3d *)&origin_offset, &avoidance_data->up, (avoidance_ray->offset.k), (real_point3d *)&origin_offset); + divergence_direction = *global_zero_vector3d; + point_from_line3d((real_point3d *)&divergence_direction, &avoidance_data->forward, (avoidance_ray->divergence.i), (real_point3d *)&divergence_direction); + point_from_line3d((real_point3d *)&divergence_direction, &avoidance_data->left, (avoidance_ray->divergence.j), (real_point3d *)&divergence_direction); + point_from_line3d((real_point3d *)&divergence_direction, &avoidance_data->up, (avoidance_ray->divergence.k), (real_point3d *)&divergence_direction); - ray_origin->x = offset.i*avoidance_data->avoid_width + avoidance_data->origin.x; - ray_origin->y = offset.j*avoidance_data->avoid_width + avoidance_data->origin.y; - ray_origin->z = offset.k*avoidance_data->avoid_width + avoidance_data->origin.z; + point_from_line3d(&avoidance_data->origin, &origin_offset, (avoidance_data->avoid_width), ray_origin); + scale_vector3d(&divergence_direction, avoidance_ray->length*avoidance_data->avoid_distance, ray_direction); - scale = avoidance_data->avoid_distance*avoidance_ray->length; - ray_direction->i = divergence.i*scale; - ray_direction->j = divergence.j*scale; - ray_direction->k = divergence.k*scale; - - vector_from_points3d(&avoidance_data->origin, ray_origin, &offset); - if (collision_bsp_test_vector( - FLAG(_collision_test_front_facing_surfaces_bit) | - FLAG(_collision_test_back_facing_surfaces_bit), - avoidance_data->bsp, - 0, - NULL, - &avoidance_data->origin, - &offset, - 1.f, - &collision_result)) { - result = _actor_vector_avoidance_obstructed_structure; - *collision_t = 0.f; - } - else if (collision_bsp_test_vector( - FLAG(_collision_test_front_facing_surfaces_bit) | - FLAG(_collision_test_back_facing_surfaces_bit), - avoidance_data->bsp, - 0, - NULL, - ray_origin, - ray_direction, - 1.f, - &collision_result)) - { - result = _actor_vector_avoidance_obstructed_structure; - *collision_t = collision_result.t; + real_vector3d vector_to_origin; + struct collision_bsp_test_vector_result collision_result; + + vector_from_points3d(&avoidance_data->origin, ray_origin, &vector_to_origin); + if (collision_bsp_test_vector( + FLAG(_collision_test_front_facing_surfaces_bit) | + FLAG(_collision_test_back_facing_surfaces_bit), + avoidance_data->bsp, + 0, + NULL, + &avoidance_data->origin, + &vector_to_origin, + 1.f, + &collision_result)) + { + result = _actor_vector_avoidance_obstructed_structure; + *collision_t = 0.f; + } + else if (collision_bsp_test_vector( + FLAG(_collision_test_front_facing_surfaces_bit) | + FLAG(_collision_test_back_facing_surfaces_bit), + avoidance_data->bsp, + 0, + NULL, + ray_origin, + ray_direction, + 1.f, + &collision_result)) + { + result = _actor_vector_avoidance_obstructed_structure; + *collision_t = collision_result.t; + } } for (object_index = 0; @@ -902,7 +889,8 @@ static short actor_move_test_avoidance_vector( { struct vehicle_avoidance_cylinder *cylinder = &avoidance_data->avoidance_objects[object_index]; - real object_t; + real_vector3d dummy_normal; + real intersect_t; if (pill_test_vector3d( &cylinder->base, @@ -910,12 +898,12 @@ static short actor_move_test_avoidance_vector( cylinder->width, ray_origin, ray_direction, - &object_t, - &offset) && - object_t < *collision_t) + &intersect_t, + &dummy_normal) && + intersect_t < *collision_t) { result = _actor_vector_avoidance_obstructed_object; - *collision_t = object_t; + *collision_t = intersect_t; } } diff --git a/source/ai/actor_type_definitions.h b/source/ai/actor_type_definitions.h deleted file mode 100644 index 04b25b63..00000000 --- a/source/ai/actor_type_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -ACTOR_TYPE_DEFINITIONS.H - -file has inline function assertions. -*/ - -#ifndef __ACTOR_TYPE_DEFINITIONS_H -#define __ACTOR_TYPE_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __ACTOR_TYPE_DEFINITIONS_H diff --git a/source/ai/ai_constants.h b/source/ai/ai_constants.h deleted file mode 100644 index 21cd8c91..00000000 --- a/source/ai/ai_constants.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -AI_CONSTANTS.H - -header included in hcex build. -*/ - -#ifndef __AI_CONSTANTS_H -#define __AI_CONSTANTS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __AI_CONSTANTS_H diff --git a/source/bitmaps/bitmap_macros.h b/source/bitmaps/bitmap_macros.h deleted file mode 100644 index bd547c9f..00000000 --- a/source/bitmaps/bitmap_macros.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -BITMAP_MACROS.H - -header included in hcex build. -*/ - -#ifndef __BITMAP_MACROS_H -#define __BITMAP_MACROS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __BITMAP_MACROS_H diff --git a/source/bitmaps/s3tc/s3tc.c b/source/bitmaps/s3tc/s3tc.c index ac22649f..2d62daf9 100644 --- a/source/bitmaps/s3tc/s3tc.c +++ b/source/bitmaps/s3tc/s3tc.c @@ -655,7 +655,19 @@ void DecodeBlockRGB__single_pixel( if (pblockSrc == NULL) { - memset(colorDst, 0, sizeof(*colorDst)); + /* BUG (original, preserved for exact matching): January clears S3TC_BLOCK_PIXELS colors here, + * 0x40 bytes (0x45fc30 +0x11 push 0x40, +0x15 call _csmemset), as the full-block decoder + * DecodeBlockRGB does, but colorDst addresses ONE color. In bitmap_2d_get_pixel, the only caller + * chain, that color is the four-byte local pixel, so the clear would overwrite 60 further bytes of + * that function's frame. + * The clear is not executed in January: bitmap_2d_get_pixel decodes only when + * bitmap->base_address is not NULL and halts (display_assert, then an unconditional system_exit) + * unless block_address >= bitmap->base_address; it passes block_address here for dxt1, and + * DecodeBlockAlpha4__single_pixel and DecodeBlockAlpha3__single_pixel pass &source->rgb + * (block_address + 8) for dxt3 and dxt5. No other function references this one. + * January's bytes give the length (0x40) only; its spelling here is inferred from DecodeBlockRGB, + * not recovered source. A corrected build clears sizeof(*colorDst). */ + memset(colorDst, 0, S3TC_BLOCK_PIXELS * sizeof(struct s3tc_color)); return; } @@ -692,8 +704,13 @@ void DecodeBlockRGB__single_pixel( colors[3].rgba[S3TC_ALPHA] = 0; } - match_assert("c:\\halo\\SOURCE\\bitmaps\\s3tc\\s3tc.c", 773, u >= 0 && u < 4); - match_assert("c:\\halo\\SOURCE\\bitmaps\\s3tc\\s3tc.c", 774, v >= 0 && v < 4); + /* BUG (original, preserved for exact matching): both assertions admit 4 (0x45fc30 +0x17c cmp si,4 / + * +0x180 jle; +0x1aa cmp bx,4 / +0x1ae jle; the assertion strings are January's "u>=0 && u<=4" and + * "v>=0 && v<=4"), although a block has four columns and four rows, 0..3. With u or v equal to 4 the + * selector shift below can reach 32 or more. bitmap_2d_get_pixel masks both coordinates with 3 before + * every call, so neither value exceeds 3 in January. A corrected build asserts u<4 and v<4. */ + match_assert("c:\\halo\\SOURCE\\bitmaps\\s3tc\\s3tc.c", 773, u>=0 && u<=4); + match_assert("c:\\halo\\SOURCE\\bitmaps\\s3tc\\s3tc.c", 774, v>=0 && v<=4); *colorDst = colors[(pblockSrc->bitmap >> (2 * (4 * v + u))) & 3]; diff --git a/source/bungie_net/common/memory_manager.h b/source/bungie_net/common/memory_manager.h deleted file mode 100644 index b110f063..00000000 --- a/source/bungie_net/common/memory_manager.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -MEMORY_MANAGER.H - -header included in hcex build. -*/ - -#ifndef __MEMORY_MANAGER_H -#define __MEMORY_MANAGER_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __MEMORY_MANAGER_H diff --git a/source/bungie_net/network/transport.h b/source/bungie_net/network/transport.h index 6b385cd9..82835ae6 100644 --- a/source/bungie_net/network/transport.h +++ b/source/bungie_net/network/transport.h @@ -70,7 +70,7 @@ struct transport_address /* ---------- prototypes */ -short transport_initialize( +long transport_initialize( void); short transport_dispose( void); diff --git a/source/bungie_net/network/transport_endpoint_set_winsock.c b/source/bungie_net/network/transport_endpoint_set_winsock.c index 4e26f467..5d3aa9f8 100644 --- a/source/bungie_net/network/transport_endpoint_set_winsock.c +++ b/source/bungie_net/network/transport_endpoint_set_winsock.c @@ -249,25 +249,27 @@ void transport_pop_key( return; } -short transport_initialize( +long transport_initialize( void) { + long result = _transport_error_none; + if (!transport_initialized) { WSADATA info = { 0 }; XNetStartupParams startup_params = { 0 }; DWORD link_status; - DWORD address_status; - unsigned long deadline; FILE *bypass_file; - short wsa_error; startup_params.cfgSizeOfStruct = sizeof(startup_params); + startup_params.cfgFlags = 0; startup_params.cfgPrivatePoolSizeInPages = 24; startup_params.cfgEnetReceiveQueueLength = 8; startup_params.cfgIpFragMaxSimultaneous = 4; startup_params.cfgIpFragMaxPacketDiv256 = 8; startup_params.cfgSockMaxSockets = 128; + startup_params.cfgSockDefaultRecvBufsizeInK = 0; + startup_params.cfgSockDefaultSendBufsizeInK = 0; startup_params.cfgKeyRegMax = 1; startup_params.cfgSecRegMax = 32; @@ -281,6 +283,9 @@ short transport_initialize( (link_status & XNET_ETHERNET_LINK_FULL_DUPLEX) ? " in full-duplex mode" : "", (link_status & XNET_ETHERNET_LINK_HALF_DUPLEX) ? " in half-duplex mode" : ""); + /* January stores these two fields a second time here. */ + startup_params.cfgSizeOfStruct = sizeof(startup_params); + startup_params.cfgFlags = 0; bypass_file = fopen("d:\\bypass_security.txt", "r"); if (bypass_file) { @@ -290,35 +295,53 @@ short transport_initialize( } if (XNetStartup(&startup_params) != 0) - return _transport_error_not_initialized; - - wsa_error = WSAStartup(MAKEWORD(2, 0), &info); - if (wsa_error != 0) { - XNetCleanup(); - winsock_error_to_string(wsa_error); - return _transport_error_not_initialized; + result = _transport_error_not_initialized; } - - deadline = system_milliseconds() + 10000; - do + else { - address_status = XNetGetTitleXnAddr(&global_address); - if (system_milliseconds() > deadline || - address_status == XNET_GET_XNADDR_NONE) + short wsa_error = WSAStartup(MAKEWORD(2, 0), &info); + + if (wsa_error != 0) { - WSACleanup(); XNetCleanup(); + winsock_error_to_string(wsa_error); + return _transport_error_not_initialized; } - } - while (address_status == XNET_GET_XNADDR_PENDING); + else + { + unsigned long deadline = system_milliseconds() + 10000; + DWORD address_status; - XNetRandom(global_nonce, sizeof(global_nonce)); - transport_initialized = TRUE; + do + { + address_status = XNetGetTitleXnAddr(&global_address); + if (system_milliseconds() > deadline) + { + address_status = XNET_GET_XNADDR_NONE; + break; + } + } + while (address_status == XNET_GET_XNADDR_PENDING); + + if (address_status == XNET_GET_XNADDR_NONE) + { + WSACleanup(); + XNetCleanup(); + result = _transport_error_not_initialized; + } + else + { + XNetRandom(global_nonce, sizeof(global_nonce)); + result = _transport_error_none; + transport_initialized = TRUE; + } + } + } } - return _transport_error_none; + return result; } void transport_client_stop( @@ -468,18 +491,25 @@ static int __cdecl poll_ep_array_compare_proc( void const *a, void const *b) { - struct transport_endpoint *endpoint_a = *(struct transport_endpoint *const *)a; - struct transport_endpoint *endpoint_b = *(struct transport_endpoint *const *)b; + int result; - if (!endpoint_a && endpoint_b) + a = *(struct transport_endpoint const *const *)a; + b = *(struct transport_endpoint const *const *)b; + + if (!a && b) { - return 1; + result = 1; } - else if (endpoint_a && !endpoint_b) + else if (a && !b) { - return -1; + result = -1; } - return 0; + else + { + result = 0; + } + + return result; } /* ---------- public code */ diff --git a/source/camera/camera_track_definitions.h b/source/camera/camera_track_definitions.h deleted file mode 100644 index 00d97956..00000000 --- a/source/camera/camera_track_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -CAMERA_TRACK_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __CAMERA_TRACK_DEFINITIONS_H -#define __CAMERA_TRACK_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __CAMERA_TRACK_DEFINITIONS_H diff --git a/source/cseries/build_number.h b/source/cseries/build_number.h deleted file mode 100644 index 5d59c92f..00000000 --- a/source/cseries/build_number.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -BUILD_NUMBER.H - -header included in hcex build. -*/ - -#ifndef __BUILD_NUMBER_H -#define __BUILD_NUMBER_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __BUILD_NUMBER_H diff --git a/source/cseries/headers.h b/source/cseries/headers.h deleted file mode 100644 index b870c2cc..00000000 --- a/source/cseries/headers.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HEADERS.H - -header included in hcex build. -*/ - -#ifndef __HEADERS_H -#define __HEADERS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HEADERS_H diff --git a/source/cseries/platform.h b/source/cseries/platform.h deleted file mode 100644 index 178b0844..00000000 --- a/source/cseries/platform.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -PLATFORM.H - -header included in hcex build. -*/ - -#ifndef __PLATFORM_H -#define __PLATFORM_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __PLATFORM_H diff --git a/source/cutscene/cinematics.c b/source/cutscene/cinematics.c index ab5c78ae..eeddaf6f 100644 --- a/source/cutscene/cinematics.c +++ b/source/cutscene/cinematics.c @@ -431,7 +431,6 @@ void cinematic_render( if (!ui_widgets_active()) { real_argb_color text_color; - long shadow_alpha; pixel32_to_real_argb_color( title->foreground_color, @@ -454,15 +453,13 @@ void cinematic_render( title->text_flags, &text_color); - shadow_alpha = PIN( - fast_ftol( - (real)(long)(byte)(title->shadow_color >> 24) * - fade_amount), - 0, - 255); - rasterizer_text_set_shadow_color( - ((pixel32)shadow_alpha << 24) | + ((pixel32)PIN( + fast_ftol( + (real)(long)(byte)(title->shadow_color >> 24) * + fade_amount), + 0, + 255) << 24) | (title->shadow_color & 0x00FFFFFF)); { diff --git a/source/dialogs/dialogs.h b/source/dialogs/dialogs.h deleted file mode 100644 index 1bbe187c..00000000 --- a/source/dialogs/dialogs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -DIALOGS.H - -header included in hcex build. -*/ - -#ifndef __DIALOGS_H -#define __DIALOGS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __DIALOGS_H diff --git a/source/effects/particle_definitions.h b/source/effects/particle_definitions.h deleted file mode 100644 index aee56088..00000000 --- a/source/effects/particle_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -PARTICLE_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __PARTICLE_DEFINITIONS_H -#define __PARTICLE_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __PARTICLE_DEFINITIONS_H diff --git a/source/hs/hs_compile.c b/source/hs/hs_compile.c index e31047e0..5f67b1fa 100644 --- a/source/hs/hs_compile.c +++ b/source/hs/hs_compile.c @@ -413,7 +413,7 @@ symbols in this file: #include "ai/ai_script.h" #include "hs/hs.h" #include "hs/hs_library_internal.h" -#include "hs/hs_library_internal_compile.h" +/* Empty reconstructed header removed; no declarations to include. */ #include "hs/hs_scenario_definitions.h" #include "interface/hud_definitions.h" #include "interface/interface.h" diff --git a/source/hs/hs_enum.h b/source/hs/hs_enum.h deleted file mode 100644 index 32c750f1..00000000 --- a/source/hs/hs_enum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HS_ENUM.H - -header included in hcex build. -*/ - -#ifndef __HS_ENUM_H -#define __HS_ENUM_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HS_ENUM_H diff --git a/source/hs/hs_function.h b/source/hs/hs_function.h deleted file mode 100644 index 06d0cf0a..00000000 --- a/source/hs/hs_function.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HS_FUNCTION.H - -header included in hcex build. -*/ - -#ifndef __HS_FUNCTION_H -#define __HS_FUNCTION_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HS_FUNCTION_H diff --git a/source/hs/hs_glue.h b/source/hs/hs_glue.h deleted file mode 100644 index d2b7381f..00000000 --- a/source/hs/hs_glue.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HS_GLUE.H - -header included in hcex build. -*/ - -#ifndef __HS_GLUE_H -#define __HS_GLUE_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HS_GLUE_H diff --git a/source/hs/hs_library_internal_compile.h b/source/hs/hs_library_internal_compile.h deleted file mode 100644 index 80ebfedf..00000000 --- a/source/hs/hs_library_internal_compile.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HS_LIBRARY_INTERNAL_COMPILE.H - -file has inline function assertions. -*/ - -#ifndef __HS_LIBRARY_INTERNAL_COMPILE_H -#define __HS_LIBRARY_INTERNAL_COMPILE_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/HS_COMPILE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HS_LIBRARY_INTERNAL_COMPILE_H diff --git a/source/hs/hs_library_internal_runtime.h b/source/hs/hs_library_internal_runtime.h deleted file mode 100644 index 6b51fde9..00000000 --- a/source/hs/hs_library_internal_runtime.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HS_LIBRARY_INTERNAL_RUNTIME.H - -file has inline function assertions. -*/ - -#ifndef __HS_LIBRARY_INTERNAL_RUNTIME_H -#define __HS_LIBRARY_INTERNAL_RUNTIME_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/HS_RUNTIME.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HS_LIBRARY_INTERNAL_RUNTIME_H diff --git a/source/hs/hs_runtime.c b/source/hs/hs_runtime.c index f9f27a75..6a4a0f3d 100644 --- a/source/hs/hs_runtime.c +++ b/source/hs/hs_runtime.c @@ -266,7 +266,7 @@ symbols in this file: #include "ai/ai_script.h" #include "hs/hs.h" #include "hs/hs_library_internal.h" -#include "hs/hs_library_internal_runtime.h" +/* Empty reconstructed header removed; no declarations to include. */ #include "hs/object_lists.h" #include "hs/hs_scenario_definitions.h" #include "math/real_math.h" diff --git a/source/input/input_device_defaults.h b/source/input/input_device_defaults.h deleted file mode 100644 index ca9989e7..00000000 --- a/source/input/input_device_defaults.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -INPUT_DEVICE_DEFAULTS.H - -header included in hcex build. -*/ - -#ifndef __INPUT_DEVICE_DEFAULTS_H -#define __INPUT_DEVICE_DEFAULTS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __INPUT_DEVICE_DEFAULTS_H diff --git a/source/input/input_windows.h b/source/input/input_windows.h deleted file mode 100644 index c18cd27c..00000000 --- a/source/input/input_windows.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -INPUT_WINDOWS.H - -header included in hcex build. -*/ - -#ifndef __INPUT_WINDOWS_H -#define __INPUT_WINDOWS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __INPUT_WINDOWS_H diff --git a/source/interface/hud_messaging_definitions.h b/source/interface/hud_messaging_definitions.h deleted file mode 100644 index 3d766085..00000000 --- a/source/interface/hud_messaging_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -HUD_MESSAGING_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __HUD_MESSAGING_DEFINITIONS_H -#define __HUD_MESSAGING_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __HUD_MESSAGING_DEFINITIONS_H diff --git a/source/interface/hud_nav_points.c b/source/interface/hud_nav_points.c index f30b2705..f1b6eca1 100644 --- a/source/interface/hud_nav_points.c +++ b/source/interface/hud_nav_points.c @@ -677,109 +677,67 @@ short hud_get_nav_point_render_type( void custom_render_nav_point( short local_player_index, - real_point3d const *position, + real_point3d const *position_pointer, short nav_index, short waypoint_type) { long return_eip = get_return_eip(); long stack_buffer[STACK_BUFFER_LENGTH]; struct hud_waypoint_arrow *arrow; - real_point3d view_point; + real_point3d position; real distance; - real arrow_scale; + real scale; real_point2d screen_position; - real horizontal_radius; - real vertical_radius; - real vertical_component; - real horizontal_component; - real radius_product; + real a, b, ab, bx, ay; real theta; - csmemset(stack_buffer, 0x62, sizeof(stack_buffer)); - - arrow = TAG_BLOCK_GET_ELEMENT( - &hud_globals->waypoint.arrows, - nav_index, - struct hud_waypoint_arrow); - view_point = *position; + memset(stack_buffer, 0x62, sizeof(stack_buffer)); + arrow = TAG_BLOCK_GET_ELEMENT(&hud_globals->waypoint.arrows, nav_index, struct hud_waypoint_arrow); + position = *position_pointer; { - long unit_index = local_player_get_player_index(local_player_index)==NONE ? - NONE : - player_get(local_player_get_player_index(local_player_index))->unit_index; real_point3d cam_pos; - real delta_x; - real delta_y; - real delta_z; - unit_get_camera_position(unit_index, &cam_pos); - - delta_x = position->x-cam_pos.x; - delta_y = position->y-cam_pos.y; - delta_z = position->z-cam_pos.z; - distance = square_root( - delta_x*delta_x + (delta_y*delta_y + delta_z*delta_z)); + unit_get_camera_position(local_player_get_player_index(local_player_index) == NONE ? NONE : player_get(local_player_get_player_index(local_player_index))->unit_index, &cam_pos); + distance = distance3d(&cam_pos, position_pointer); } - if (distance>15.0f) + if (distance > 15.f) { - arrow_scale = 0.5f; + scale = 0.5f; } else { - arrow_scale = (real)pow( - 1.0f-distance*(1.0f/15.0f), - 0.7) + 0.5f; + scale = (real)pow(1.f - distance / 15.f, 0.7) + 0.5f; } - matrix4x3_transform_point( - &render.frustum.world_to_view, - &view_point, - &view_point); - - if (waypoint_type==_waypoint_off_screen || - !render_camera_view_to_screen( - &render.camera, - &render.frustum, - &view_point, - &screen_position)) + matrix4x3_transform_point(&render.frustum.world_to_view, &position, &position); + if (waypoint_type == _waypoint_off_screen || !render_camera_view_to_screen(&render.camera, &render.frustum, &position, &screen_position)) { - screen_position.x = view_point.x; - screen_position.y = -view_point.y; + screen_position.x = position.x; + screen_position.y = -position.y; waypoint_type = _waypoint_off_screen; } else { - screen_position.x -= (real)( - ((render.camera.viewport_bounds.x1-render.camera.viewport_bounds.x0)/2) + - render.camera.viewport_bounds.x0); - screen_position.y -= (real)( - ((render.camera.viewport_bounds.y1-render.camera.viewport_bounds.y0)/2) + - render.camera.viewport_bounds.y0); + screen_position.x -= render.camera.viewport_bounds.x0 + (render.camera.viewport_bounds.x1 - render.camera.viewport_bounds.x0) / 2; + screen_position.y -= render.camera.viewport_bounds.y0 + (render.camera.viewport_bounds.y1 - render.camera.viewport_bounds.y0) / 2; } - horizontal_radius = - ((real)(render.camera.window_bounds.x1-render.camera.window_bounds.x0) - - (hud_globals->waypoint.right_offset+hud_globals->waypoint.left_offset))*0.5f; - vertical_radius = - ((real)(render.camera.window_bounds.y1-render.camera.window_bounds.y0) - - (hud_globals->waypoint.bottom_offset+hud_globals->waypoint.top_offset))*0.5f; - radius_product = vertical_radius*horizontal_radius; - vertical_component = vertical_radius*screen_position.x; - horizontal_component = horizontal_radius*screen_position.y; - theta = 0.0f; + a = ((render.camera.window_bounds.x1 - render.camera.window_bounds.x0) - (hud_globals->waypoint.right_offset + hud_globals->waypoint.left_offset)) / 2.f; + b = ((render.camera.window_bounds.y1 - render.camera.window_bounds.y0) - (hud_globals->waypoint.bottom_offset + hud_globals->waypoint.top_offset)) / 2.f; + ab = a * b; + bx = b * screen_position.x; + ay = a * screen_position.y; + theta = 0.f; - if (waypoint_type==_waypoint_off_screen || - radius_product*radius_product <= - vertical_component*vertical_component + horizontal_component*horizontal_component) + if (waypoint_type == _waypoint_off_screen || ab * ab <= bx * bx + ay * ay) { - real scale = square_root( - (radius_product*radius_product) / - (vertical_component*vertical_component + horizontal_component*horizontal_component)); + real factor = square_root(ab * ab / (bx * bx + ay * ay)); + screen_position.x *= factor; + screen_position.y *= factor; waypoint_type = _waypoint_off_screen; - screen_position.x *= scale; - screen_position.y *= scale; if (!TEST_FLAG(arrow->flags, _hud_waypoint_dont_rotate_offscreen_bit)) { @@ -787,112 +745,64 @@ void custom_render_nav_point( } } - screen_position.x += (real)( - (render.camera.viewport_bounds.x1-render.camera.viewport_bounds.x0)/2); - screen_position.y += (real)( - (render.camera.viewport_bounds.y1-render.camera.viewport_bounds.y0)/2); - - match_assert( - "c:\\halo\\SOURCE\\interface\\hud_nav_points.c", - 615, - waypoint_type!=NONE); - + screen_position.x += (render.camera.viewport_bounds.x1 - render.camera.viewport_bounds.x0) / 2; + screen_position.y += (render.camera.viewport_bounds.y1 - render.camera.viewport_bounds.y0) / 2; + match_assert("c:\\halo\\SOURCE\\interface\\hud_nav_points.c", 615, waypoint_type!=NONE); { - long bitmap_group_index = hud_globals->waypoint.arrow_bitmap.index; + long bitmap_index = hud_globals->waypoint.arrow_bitmap.index; struct bitmap_data const *bitmap = NULL; real_rectangle2d const *clip = NULL; - hud_retrieve_bitmap_and_bounding_rect( - bitmap_group_index, - arrow->sequence_indices[waypoint_type], - 0, - &bitmap, - &clip); - - if (bitmap && _texture_cache_bitmap_get_hardware_format( - (struct bitmap_data *)bitmap, FALSE, TRUE)) + hud_retrieve_bitmap_and_bounding_rect(bitmap_index, arrow->sequence_indices[waypoint_type], 0, &bitmap, &clip); + if (bitmap && _texture_cache_bitmap_get_hardware_format((struct bitmap_data *)bitmap, FALSE, TRUE)) { - point2d point; - real_rgb_color rgb_temp; + point2d corner; byte alpha; - real fade; + real_rgb_color rgb_temp; - point.x = (short)(long)screen_position.x; - point.y = (short)(long)screen_position.y; - alpha = (byte)PIN(fast_ftol_C(arrow->opacity)*255, 0, 255); + corner.x = (short)screen_position.x; + corner.y = (short)screen_position.y; + alpha = PIN(255 * fast_ftol_C(arrow->opacity), 0, 255); pixel32_to_real_rgb_color(arrow->color, &rgb_temp); - fade = 1.0f-arrow->fade; - rgb_temp.red *= PIN(fade, 0.0f, 1.0f); - rgb_temp.green *= PIN(fade, 0.0f, 1.0f); - rgb_temp.blue *= PIN(fade, 0.0f, 1.0f); + rgb_temp.red *= PIN(1.f - arrow->fade, 0.f, 1.f); + rgb_temp.green *= PIN(1.f - arrow->fade, 0.f, 1.f); + rgb_temp.blue *= PIN(1.f - arrow->fade, 0.f, 1.f); + hud_draw_bitmap_direct(bitmap, _hud_anchor_center, &corner, clip, scale, theta, ((pixel32)alpha << 24) | real_rgb_color_to_pixel32(&rgb_temp), FALSE); - hud_draw_bitmap_direct( - bitmap, - _hud_anchor_center, - &point, - clip, - arrow_scale, - theta, - ((pixel32)alpha<<24) | real_rgb_color_to_pixel32(&rgb_temp), - FALSE); - - if (waypoint_type!=_waypoint_off_screen) + if (waypoint_type != _waypoint_off_screen) { - struct number_hud_element_definition numbers; struct hud_absolute_placement_definition placement; - real decimal_modulus; - real bitmap_extent; - - distance *= 3.0480001f; - csmemset(&placement, 0, sizeof(placement)); - csmemset(&numbers, 0, sizeof(numbers)); + struct number_hud_element_definition numbers; + real fractional_value; + distance *= 3.048f; + memset(&placement, 0, sizeof(struct hud_absolute_placement_definition)); + memset(&numbers, 0, sizeof(struct number_hud_element_definition)); placement.corner = _hud_anchor_top_left; - numbers.colors.color = - ((pixel32)alpha<<24) | real_rgb_color_to_pixel32(&rgb_temp); - numbers.colors.flash_color = - ((pixel32)alpha<<24) | real_rgb_color_to_pixel32(&rgb_temp); + numbers.colors.color = ((pixel32)alpha << 24) | real_rgb_color_to_pixel32(&rgb_temp); + numbers.colors.flash_color = ((pixel32)alpha << 24) | real_rgb_color_to_pixel32(&rgb_temp); numbers.digits = 3; numbers.fractional_digits = 1; - numbers.number_flags = - FLAG(_hud_number_show_all_leading_zeros_bit) | - FLAG(_hud_number_show_trailing_m_bit); + numbers.number_flags = FLAG(_hud_number_show_all_leading_zeros_bit) | FLAG(_hud_number_show_trailing_m_bit); - bitmap_extent = - ((clip->x1-clip->x0)*(real)bitmap->width)*0.5f; - numbers.placement.offset.x = (short)(long)( - bitmap_extent*arrow_scale*0.33000001f + (real)point.x); - bitmap_extent = - ((clip->y1-clip->y0)*(real)bitmap->height)*0.5f; - numbers.placement.offset.y = (short)(long)( - bitmap_extent*arrow_scale*0.66000003f + (real)point.y); - numbers.placement.offset.x -= render.camera.window_bounds.x0; - numbers.placement.offset.x += render.camera.viewport_bounds.x0; - numbers.placement.offset.y -= render.camera.window_bounds.y0; - numbers.placement.offset.y += render.camera.viewport_bounds.y0; + numbers.placement.offset.x = corner.x + (bitmap->width * (clip->x1 - clip->x0) / 2.f) * scale * 0.33f; + numbers.placement.offset.y = corner.y + (bitmap->height * (clip->y1 - clip->y0) / 2.f) * scale * 0.66f; + numbers.placement.offset.x -= render.camera.window_bounds.x0 - render.camera.viewport_bounds.x0; + numbers.placement.offset.y -= render.camera.window_bounds.y0 - render.camera.viewport_bounds.y0; - decimal_modulus = (real)pow(10.0, 4.0); - { - short decimal_value = (short)fast_ftol( - (real)fmod( - fabs(decimal_modulus*distance), - decimal_modulus)); - - hud_draw_numbers( - local_player_index, - &placement, - &numbers, - (short)fast_ftol_C(distance), - decimal_value, - 0, - 0, - 0.0f); - } + fractional_value = power(10.f, 4.f); + hud_draw_numbers(local_player_index, &placement, &numbers, + fast_ftol_C(distance), fast_ftol(fmod(fabs((real)(fractional_value * distance)), fractional_value)), + 0, 0, 0.f); } } } - match_assert_stack_frame("c:\\halo\\SOURCE\\interface\\hud_nav_points.c", 675); + { + short corrupt_index = check_stack_buffer(stack_buffer); + match_vassert("c:\\halo\\SOURCE\\interface\\hud_nav_points.c", 675, return_eip == get_return_eip(), "corrupt return address!"); + match_vassert("c:\\halo\\SOURCE\\interface\\hud_nav_points.c", 675, corrupt_index == NONE, csprintf(temporary, "corrupt stack at %d!", corrupt_index)); + } return; } diff --git a/source/interface/interface_panels.h b/source/interface/interface_panels.h deleted file mode 100644 index dee43d2f..00000000 --- a/source/interface/interface_panels.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -INTERFACE_PANELS.H - -header included in hcex build. -*/ - -#ifndef __INTERFACE_PANELS_H -#define __INTERFACE_PANELS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __INTERFACE_PANELS_H diff --git a/source/interface/inventory_displays.h b/source/interface/inventory_displays.h deleted file mode 100644 index de198854..00000000 --- a/source/interface/inventory_displays.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -INVENTORY_DISPLAYS.H - -header included in hcex build. -*/ - -#ifndef __INVENTORY_DISPLAYS_H -#define __INVENTORY_DISPLAYS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __INVENTORY_DISPLAYS_H diff --git a/source/interface/meter_definitions.h b/source/interface/meter_definitions.h deleted file mode 100644 index 8dbd1846..00000000 --- a/source/interface/meter_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -METER_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __METER_DEFINITIONS_H -#define __METER_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __METER_DEFINITIONS_H diff --git a/source/interface/ui_widget_group.h b/source/interface/ui_widget_group.h deleted file mode 100644 index 6d2b511f..00000000 --- a/source/interface/ui_widget_group.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -UI_WIDGET_GROUP.H - -header included in hcex build. -*/ - -#ifndef __UI_WIDGET_GROUP_H -#define __UI_WIDGET_GROUP_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __UI_WIDGET_GROUP_H diff --git a/source/items/garbage_definitions.h b/source/items/garbage_definitions.h deleted file mode 100644 index a8530c5c..00000000 --- a/source/items/garbage_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -GARBAGE_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __GARBAGE_DEFINITIONS_H -#define __GARBAGE_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __GARBAGE_DEFINITIONS_H diff --git a/source/items/items.c b/source/items/items.c index 942008ac..7e756066 100644 --- a/source/items/items.c +++ b/source/items/items.c @@ -461,7 +461,6 @@ void item_accelerate( { real acceleration_magnitude = magnitude3d(acceleration); real_vector3d rotation_axis; - double rotation_magnitude; if (acceleration_magnitude < 0.0001f) { @@ -477,10 +476,10 @@ void item_accelerate( &rotation_axis); } - rotation_magnitude = - real_seed_random(get_global_random_seed_address()) * - acceleration_magnitude * 1.5707964f; - scale_vector3d(&rotation_axis, (real)rotation_magnitude, &rotation_axis); + scale_vector3d( + &rotation_axis, + real_seed_random(get_global_random_seed_address()) * 1.5707964f * acceleration_magnitude, + &rotation_axis); add_vectors3d( &item->object.angular_velocity, &rotation_axis, diff --git a/source/items/weapon_interface_definitions.h b/source/items/weapon_interface_definitions.h deleted file mode 100644 index 37e38014..00000000 --- a/source/items/weapon_interface_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -WEAPON_INTERFACE_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __WEAPON_INTERFACE_DEFINITIONS_H -#define __WEAPON_INTERFACE_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __WEAPON_INTERFACE_DEFINITIONS_H diff --git a/source/math/real_math.h b/source/math/real_math.h index 219604e4..d69d9c97 100644 --- a/source/math/real_math.h +++ b/source/math/real_math.h @@ -1556,7 +1556,7 @@ __inline real plane3d_distance_to_point( real_plane3d const *plane, real_point3d const *point) { - return (dot_product3d((real_vector3d *)point, &plane->n) - plane->d); + return dot_product3d((real_vector3d *)point, &plane->n) - plane->d; } #endif diff --git a/source/math/vector_tree.h b/source/math/vector_tree.h deleted file mode 100644 index 856b4cbf..00000000 --- a/source/math/vector_tree.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -VECTOR_TREE.H - -header included in hcex build. -*/ - -#ifndef __VECTOR_TREE_H -#define __VECTOR_TREE_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __VECTOR_TREE_H diff --git a/source/memory/sl_list.h b/source/memory/sl_list.h deleted file mode 100644 index fd854e2e..00000000 --- a/source/memory/sl_list.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -SL_LIST.H - -header included in hcex build. -*/ - -#ifndef __SL_LIST_H -#define __SL_LIST_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __SL_LIST_H diff --git a/source/objects/index_resolution.h b/source/objects/index_resolution.h deleted file mode 100644 index 6c360e2f..00000000 --- a/source/objects/index_resolution.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -INDEX_RESOLUTION.H - -header included in hcex build. -*/ - -#ifndef __INDEX_RESOLUTION_H -#define __INDEX_RESOLUTION_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __INDEX_RESOLUTION_H diff --git a/source/objects/widgets/aleph.h b/source/objects/widgets/aleph.h deleted file mode 100644 index d32d1360..00000000 --- a/source/objects/widgets/aleph.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -ALEPH.H - -header included in hcex build. -*/ - -#ifndef __ALEPH_H -#define __ALEPH_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __ALEPH_H diff --git a/source/objects/widgets/antenna_definitions.h b/source/objects/widgets/antenna_definitions.h deleted file mode 100644 index 5788f773..00000000 --- a/source/objects/widgets/antenna_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -ANTENNA_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __ANTENNA_DEFINITIONS_H -#define __ANTENNA_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __ANTENNA_DEFINITIONS_H diff --git a/source/objects/widgets/cellular_automata.h b/source/objects/widgets/cellular_automata.h deleted file mode 100644 index 2c0bdfdf..00000000 --- a/source/objects/widgets/cellular_automata.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -CELLULAR_AUTOMATA.H - -header included in hcex build. -*/ - -#ifndef __CELLULAR_AUTOMATA_H -#define __CELLULAR_AUTOMATA_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __CELLULAR_AUTOMATA_H diff --git a/source/objects/widgets/cellular_automata2d.h b/source/objects/widgets/cellular_automata2d.h deleted file mode 100644 index 0445d870..00000000 --- a/source/objects/widgets/cellular_automata2d.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -CELLULAR_AUTOMATA2D.H - -header included in hcex build. -*/ - -#ifndef __CELLULAR_AUTOMATA2D_H -#define __CELLULAR_AUTOMATA2D_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __CELLULAR_AUTOMATA2D_H diff --git a/source/objects/widgets/flag_definitions.h b/source/objects/widgets/flag_definitions.h deleted file mode 100644 index be3c394e..00000000 --- a/source/objects/widgets/flag_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -FLAG_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __FLAG_DEFINITIONS_H -#define __FLAG_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __FLAG_DEFINITIONS_H diff --git a/source/objects/widgets/glow_definitions.h b/source/objects/widgets/glow_definitions.h deleted file mode 100644 index 5e73eba3..00000000 --- a/source/objects/widgets/glow_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -GLOW_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __GLOW_DEFINITIONS_H -#define __GLOW_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __GLOW_DEFINITIONS_H diff --git a/source/objects/widgets/light_volume_definitions.h b/source/objects/widgets/light_volume_definitions.h deleted file mode 100644 index 4737f509..00000000 --- a/source/objects/widgets/light_volume_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -LIGHT_VOLUME_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __LIGHT_VOLUME_DEFINITIONS_H -#define __LIGHT_VOLUME_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __LIGHT_VOLUME_DEFINITIONS_H diff --git a/source/objects/widgets/lightning_definitions.h b/source/objects/widgets/lightning_definitions.h deleted file mode 100644 index 19c16522..00000000 --- a/source/objects/widgets/lightning_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -LIGHTNING_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __LIGHTNING_DEFINITIONS_H -#define __LIGHTNING_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __LIGHTNING_DEFINITIONS_H diff --git a/source/physics/physics_constants.h b/source/physics/physics_constants.h deleted file mode 100644 index fff8c8b2..00000000 --- a/source/physics/physics_constants.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -PHYSICS_CONSTANTS.H - -header included in hcex build. -*/ - -#ifndef __PHYSICS_CONSTANTS_H -#define __PHYSICS_CONSTANTS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __PHYSICS_CONSTANTS_H diff --git a/source/physics/terrain_definitions.h b/source/physics/terrain_definitions.h deleted file mode 100644 index 73ba3f17..00000000 --- a/source/physics/terrain_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -TERRAIN_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __TERRAIN_DEFINITIONS_H -#define __TERRAIN_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __TERRAIN_DEFINITIONS_H diff --git a/source/rasterizer/rasterizer_hardware_format_utilities.h b/source/rasterizer/rasterizer_hardware_format_utilities.h deleted file mode 100644 index 6797ecde..00000000 --- a/source/rasterizer/rasterizer_hardware_format_utilities.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -RASTERIZER_HARDWARE_FORMAT_UTILITIES.H - -header included in hcex build. -*/ - -#ifndef __RASTERIZER_HARDWARE_FORMAT_UTILITIES_H -#define __RASTERIZER_HARDWARE_FORMAT_UTILITIES_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __RASTERIZER_HARDWARE_FORMAT_UTILITIES_H diff --git a/source/rasterizer/rasterizer_memory_pool.c b/source/rasterizer/rasterizer_memory_pool.c index 30c4b28e..1b8e37fa 100644 --- a/source/rasterizer/rasterizer_memory_pool.c +++ b/source/rasterizer/rasterizer_memory_pool.c @@ -8,7 +8,7 @@ RASTERIZER_MEMORY_POOL.C #include "errors.h" #include "real_math.h" #include "rasterizer.h" -#include "rasterizer_memory_pool.h" +/* Empty reconstructed header removed; no declarations to include. */ /* ---------- globals */ diff --git a/source/rasterizer/rasterizer_memory_pool.h b/source/rasterizer/rasterizer_memory_pool.h deleted file mode 100644 index 29ec4acf..00000000 --- a/source/rasterizer/rasterizer_memory_pool.h +++ /dev/null @@ -1,11 +0,0 @@ -/* -RASTERIZER_MEMORY_POOL.H - -Narrow cross-translation-unit interface owned by RASTERIZER_MEMORY_POOL.C. -*/ - -#ifndef __RASTERIZER_MEMORY_POOL_H -#define __RASTERIZER_MEMORY_POOL_H -#pragma once - -#endif /* __RASTERIZER_MEMORY_POOL_H */ diff --git a/source/rasterizer/xbox/rasterizer_xbox_environment.c b/source/rasterizer/xbox/rasterizer_xbox_environment.c index 4df20253..95710f24 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_environment.c +++ b/source/rasterizer/xbox/rasterizer_xbox_environment.c @@ -155,7 +155,7 @@ symbols in this file: #include "rasterizer/common/rasterizer_common.h" #include "rasterizer/rasterizer_geometry.h" #include "rasterizer/rasterizer_lights.h" -#include "rasterizer/rasterizer_memory_pool.h" +/* Empty reconstructed header removed; no declarations to include. */ #include "rasterizer/rasterizer_transparent_geometry.h" #include "shaders/shader_definitions.h" #include "shaders/shaders.h" diff --git a/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c b/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c index 5e29c5b9..0ed768a0 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c +++ b/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c @@ -180,11 +180,6 @@ enum MAXIMUM_ATMOSPHERE_DOMINANT_WARNINGS = 20, }; -enum -{ - NUMBER_OF_PIXEL_SHADER_STAGES = 8, -}; - enum { _fog_definition_atmosphere_dominant_bit = 1, diff --git a/source/saved films/saved_films.h b/source/saved films/saved_films.h deleted file mode 100644 index f2b88ed7..00000000 --- a/source/saved films/saved_films.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -SAVED_FILMS.H - -header included in hcex build. -*/ - -#ifndef __SAVED_FILMS_H -#define __SAVED_FILMS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __SAVED_FILMS_H diff --git a/source/saved games/game_state_procs.h b/source/saved games/game_state_procs.h deleted file mode 100644 index 5463311c..00000000 --- a/source/saved games/game_state_procs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -GAME_STATE_PROCS.H - -header included in hcex build. -*/ - -#ifndef __GAME_STATE_PROCS_H -#define __GAME_STATE_PROCS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __GAME_STATE_PROCS_H diff --git a/source/scenario/scenario_placement.h b/source/scenario/scenario_placement.h deleted file mode 100644 index bfb6c9da..00000000 --- a/source/scenario/scenario_placement.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -SCENARIO_PLACEMENT.H - -header included in hcex build. -*/ - -#ifndef __SCENARIO_PLACEMENT_H -#define __SCENARIO_PLACEMENT_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __SCENARIO_PLACEMENT_H diff --git a/source/scenario/structure_bsp_procs.h b/source/scenario/structure_bsp_procs.h deleted file mode 100644 index 9ed9bc80..00000000 --- a/source/scenario/structure_bsp_procs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -STRUCTURE_BSP_PROCS.H - -header included in hcex build. -*/ - -#ifndef __STRUCTURE_BSP_PROCS_H -#define __STRUCTURE_BSP_PROCS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __STRUCTURE_BSP_PROCS_H diff --git a/source/shell/shell_windows.h b/source/shell/shell_windows.h deleted file mode 100644 index 7375799b..00000000 --- a/source/shell/shell_windows.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -SHELL_WINDOWS.H - -header included in hcex build. -*/ - -#ifndef __SHELL_WINDOWS_H -#define __SHELL_WINDOWS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __SHELL_WINDOWS_H diff --git a/source/sound/platform_sound.h b/source/sound/platform_sound.h deleted file mode 100644 index f0ad55ef..00000000 --- a/source/sound/platform_sound.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -PLATFORM_SOUND.H - -header included in hcex build. -*/ - -#ifndef __PLATFORM_SOUND_H -#define __PLATFORM_SOUND_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __PLATFORM_SOUND_H diff --git a/source/strings/resource.h b/source/strings/resource.h deleted file mode 100644 index f7a4e678..00000000 --- a/source/strings/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -RESOURCE.H - -header included in hcex build. -*/ - -#ifndef __RESOURCE_H -#define __RESOURCE_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __RESOURCE_H diff --git a/source/structures/detail_object_definitions.h b/source/structures/detail_object_definitions.h deleted file mode 100644 index 89c61bb9..00000000 --- a/source/structures/detail_object_definitions.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -DETAIL_OBJECT_DEFINITIONS.H - -header included in hcex build. -*/ - -#ifndef __DETAIL_OBJECT_DEFINITIONS_H -#define __DETAIL_OBJECT_DEFINITIONS_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __DETAIL_OBJECT_DEFINITIONS_H diff --git a/source/structures/radiosity/radiosity.h b/source/structures/radiosity/radiosity.h deleted file mode 100644 index 37535934..00000000 --- a/source/structures/radiosity/radiosity.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -RADIOSITY.H - -header included in hcex build. -*/ - -#ifndef __RADIOSITY_H -#define __RADIOSITY_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __RADIOSITY_H diff --git a/source/structures/radiosity/radiosity_io.h b/source/structures/radiosity/radiosity_io.h deleted file mode 100644 index bc21a6b5..00000000 --- a/source/structures/radiosity/radiosity_io.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -RADIOSITY_IO.H - -header included in hcex build. -*/ - -#ifndef __RADIOSITY_IO_H -#define __RADIOSITY_IO_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __RADIOSITY_IO_H diff --git a/source/text/draw_string_types.h b/source/text/draw_string_types.h deleted file mode 100644 index 0fc8fbf3..00000000 --- a/source/text/draw_string_types.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -DRAW_STRING_TYPES.H - -header included in hcex build. -*/ - -#ifndef __DRAW_STRING_TYPES_H -#define __DRAW_STRING_TYPES_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __DRAW_STRING_TYPES_H diff --git a/source/tool/connected_geometry.c b/source/tool/connected_geometry.c index 1d19c83c..9e6b19a6 100644 --- a/source/tool/connected_geometry.c +++ b/source/tool/connected_geometry.c @@ -46,6 +46,8 @@ enum /* ---------- macros */ +#define CONNECTED_GEOMETRY_COPLANAR_EPSILON 0.01f + /* ---------- structures */ struct intermediate_geometry_triangle @@ -446,13 +448,12 @@ long connected_geometry_add_triangle( } static boolean triangle_coplanar( - void *predicate_data, + void *data, struct connected_geometry *geometry, struct connected_geometry_triangle *triangle, long group_index) { - real_plane3d *plane = predicate_data; - real_point3d *point0 = dynamic_array_get_element( + real_point3d const *point0= dynamic_array_get_element( &geometry->points, ((struct connected_geometry_edge *)dynamic_array_get_element( &geometry->edges, @@ -460,7 +461,7 @@ static boolean triangle_coplanar( sizeof(struct connected_geometry_edge)))->point_indices[ (triangle->edge_designators[0] & LONG_MIN) != 0], sizeof(real_point3d)); - real_point3d *point1 = dynamic_array_get_element( + real_point3d const *point1= dynamic_array_get_element( &geometry->points, ((struct connected_geometry_edge *)dynamic_array_get_element( &geometry->edges, @@ -468,48 +469,31 @@ static boolean triangle_coplanar( sizeof(struct connected_geometry_edge)))->point_indices[ (triangle->edge_designators[1] & LONG_MIN) != 0], sizeof(real_point3d)); - real_point3d *point2 = dynamic_array_get_element( + real_point3d const *point2= dynamic_array_get_element( &geometry->points, ((struct connected_geometry_edge *)dynamic_array_get_element( &geometry->edges, triangle->edge_designators[2] & LONG_MAX, sizeof(struct connected_geometry_edge)))->point_indices[ (triangle->edge_designators[2] & LONG_MIN) != 0], - sizeof(real_point3d)); + sizeof(real_point3d)); real_plane3d triangle_plane; - real point_distance; - real point_product; - real facing; + boolean coplanar; - if (fabs( - point0->y*plane->n.j + - point0->z*plane->n.k + - point0->x*plane->n.i - - plane->d) < 0.01f && - fabs( - point1->y*plane->n.j + - point1->z*plane->n.k + - point1->x*plane->n.i - - plane->d) < 0.01f) + if (fabs(plane3d_distance_to_point((real_plane3d const *)data, point0))n)>0.f) { - point_distance = point2->y*plane->n.j; - point_distance += point2->z*plane->n.k; - point_product = point2->x*plane->n.i; - point_distance += point_product; - if (fabs(point_distance - plane->d) < 0.01f && - plane3d_from_points(&triangle_plane, point0, point2, point1) != NULL) - { - facing = triangle_plane.n.i*plane->n.i; - facing += triangle_plane.n.k*plane->n.k; - facing += triangle_plane.n.j*plane->n.j; - if (facing > 0.0f) - { - return TRUE; - } - } + coplanar= TRUE; + } + else + { + coplanar= FALSE; } - return FALSE; + return coplanar; } void connected_geometry_add_intermediate_triangle( diff --git a/source/tool/intermediate_geometry.h b/source/tool/intermediate_geometry.h deleted file mode 100644 index 22cd0756..00000000 --- a/source/tool/intermediate_geometry.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -INTERMEDIATE_GEOMETRY.H - -header included in hcex build. -*/ - -#ifndef __INTERMEDIATE_GEOMETRY_H -#define __INTERMEDIATE_GEOMETRY_H -#pragma once - -/* ---------- constants */ - -/* ---------- macros */ - -/* ---------- structures */ - -/* ---------- prototypes/EXAMPLE.C */ - -/* ---------- globals */ - -/* ---------- public code */ - -#endif // __INTERMEDIATE_GEOMETRY_H diff --git a/source/units/bipeds.c b/source/units/bipeds.c index f94b9f99..2410c760 100644 --- a/source/units/bipeds.c +++ b/source/units/bipeds.c @@ -233,7 +233,6 @@ symbols in this file: /* ---------- headers */ -#define REAL_MATH_EXTERNAL_POINT_FROM_LINE3D #define REAL_MATH_EXTERNAL_REAL_RANDOM_RANGE #include "cseries.h" #include "ai/ai_communication.h" @@ -952,11 +951,7 @@ void biped_adjust_placement( if (TEST_FLAG(flags, _biped_pill_centered_at_origin_bit) && !TEST_FLAG(flags, _biped_flying_bit)) { - real height_offset = definition->biped.collision_radius; - - data->position.x += data->up.i*height_offset; - data->position.y += data->up.j*height_offset; - data->position.z += data->up.k*height_offset; + point_from_line3d(&data->position, &data->up, (definition->biped.collision_radius), &data->position); } return; @@ -1025,20 +1020,8 @@ void biped_get_sight_position( left.j = desired_facing->i; left.k = 0.f; - { - real forward_distance = desired_gun_offset->i; - - sight_position->x += desired_facing->i*forward_distance; - sight_position->y += desired_facing->j*forward_distance; - sight_position->z += desired_facing->k*forward_distance; - { - real sideways_distance = desired_gun_offset->j; - - sight_position->x += left.i*sideways_distance; - sight_position->y += left.j*sideways_distance; - sight_position->z += left.k*sideways_distance; - } - } + point_from_line3d(sight_position, desired_facing, (desired_gun_offset->i), sight_position); + point_from_line3d(sight_position, &left, (desired_gun_offset->j), sight_position); sight_position->z += desired_gun_offset->k; } else @@ -1487,10 +1470,7 @@ static long biped_find_ground_surface( global_current_collision_users[global_current_collision_user_depth++] = _collision_user_bipeds; object_get_origin(object_index, &origin); - /* Preserve January's inline schedule without owning point_from_line3d here. */ - origin.x = global_up3d->i*0.4f + origin.x; - origin.y = global_up3d->j*0.4f + origin.y; - origin.z = global_up3d->k*0.4f + origin.z; + point_from_line3d(&origin, global_up3d, 0.4f, &origin); scale_vector3d(direction, distance, &vector); if (collision_bsp_test_vector( @@ -1505,15 +1485,7 @@ static long biped_find_ground_surface( { surface_index = result.surface_index; if (point) - { - real_point3d const *line_point = &origin; - real_vector3d const *line_vector = &vector; - real line_t = result.t; - - point->x = line_vector->i*line_t + line_point->x; - point->y = line_vector->j*line_t + line_point->y; - point->z = line_vector->k*line_t + line_point->z; - } + point_from_line3d(&origin, &vector, result.t, point); if (normal) *normal = result.plane->n; } @@ -1900,11 +1872,11 @@ static boolean biped_jump( if (upward_velocityobject.up.i*velocity_delta; - jump_velocity.j += biped->object.up.j*velocity_delta; - jump_velocity.k += biped->object.up.k*velocity_delta; + point_from_line3d( + (real_point3d *)&jump_velocity, + &biped->object.up, + jump_magnitude-upward_velocity, + (real_point3d *)&jump_velocity); } } @@ -2247,6 +2219,11 @@ static void biped_update_jumping( if (cheat.jetpack && biped->unit.player_index != NONE) { struct player_datum *player = player_get(biped->unit.player_index); + /* inferred, descriptive names (not recovered Bungie identifiers): no PDB records the locals of this block */ + const real minimum_acceleration = 0.01f; + const real maximum_acceleration = 0.05f; + const real maximum_velocity = 1.4f; + const real damping = 0.8f; boolean impulse = FALSE; if (TEST_FLAG(biped->unit.control_flags, _unit_control_weapon_primary_trigger_bit) && @@ -2257,7 +2234,7 @@ static void biped_update_jumping( dot_product3d( &biped->object.translational_velocity, &biped->unit.aiming_vector)); - real acceleration_scale = PIN(forward_velocity * 0.71428573f, 0.f, 1.f); + real acceleration_scale = PIN(forward_velocity / maximum_velocity, 0.f, 1.f); real_vector3d lateral_velocity; point_from_line3d( @@ -2268,25 +2245,24 @@ static void biped_update_jumping( point_from_line3d( (real_point3d *)&biped->object.translational_velocity, &lateral_velocity, - 0.8f - 1.f, + damping - 1.f, (real_point3d *)&biped->object.translational_velocity); point_from_line3d( (real_point3d *)&biped->object.translational_velocity, &biped->unit.aiming_vector, - acceleration_scale * 0.04f - - acceleration_scale * acceleration_scale * 0.05f + 0.01f, + acceleration_scale * (maximum_acceleration - minimum_acceleration) - + acceleration_scale * acceleration_scale * maximum_acceleration + minimum_acceleration, (real_point3d *)&biped->object.translational_velocity); SET_FLAG(biped->biped.flags, _biped_airborne_bit, TRUE); impulse = TRUE; } - - if (!impulse && - TEST_FLAG(biped->unit.control_flags, _unit_control_crouch_modifier_bit) && + else if (TEST_FLAG(biped->unit.control_flags, _unit_control_crouch_modifier_bit) && TEST_FLAG(biped->biped.flags, _biped_airborne_bit)) { - real_vector3d *velocity = &biped->object.translational_velocity; - - scale_vector3d(velocity, 0.8f - 1.f, velocity); + scale_vector3d( + &biped->object.translational_velocity, + damping - 1.f, + &biped->object.translational_velocity); } if (player->local_player_index != NONE && impulse)