fix damage not being applied when hitting walls (#164)

This commit is contained in:
Dethrace Engineering Department 2022-09-28 20:41:52 +13:00 committed by GitHub
parent db3d6ac91e
commit 76ea16aabe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 17 deletions

View File

@ -19,7 +19,8 @@ else()
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
git_describe(DETHRACE_VERSION) git_describe(DETHRACE_VERSION)
endif() endif()
message(STATUS "DethRace version ${DETHRACE_VERSION}")
message(STATUS "dethrace version ${DETHRACE_VERSION}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
@ -53,6 +54,7 @@ add_subdirectory(lib/glad)
add_subdirectory(lib/miniaudio) add_subdirectory(lib/miniaudio)
add_library(compile_with_werror INTERFACE) add_library(compile_with_werror INTERFACE)
if(DETHRACE_WERROR) if(DETHRACE_WERROR)
if(MSVC) if(MSVC)
target_compile_options(compile_with_werror INTERFACE /WX) target_compile_options(compile_with_werror INTERFACE /WX)
@ -101,10 +103,12 @@ if(DETHRACE_INSTALL)
string(TOLOWER "${CMAKE_SYSTEM_NAME}-${DETHRACE_ARCH}" CPACK_SYSTEM_NAME) string(TOLOWER "${CMAKE_SYSTEM_NAME}-${DETHRACE_ARCH}" CPACK_SYSTEM_NAME)
set(CPACK_PACKAGE_DIRECTORY dist) set(CPACK_PACKAGE_DIRECTORY dist)
if(MSVC) if(MSVC)
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
else() else()
set(CPACK_GENERATOR TGZ) set(CPACK_GENERATOR TGZ)
endif() endif()
include(CPack) include(CPack)
endif() endif()

View File

@ -2815,21 +2815,25 @@ int CollCheck(tCollision_info* c, br_scalar dt) {
} else { } else {
BrVector3Scale(&normal_force, &normal_force, 0.75f); BrVector3Scale(&normal_force, &normal_force, 0.75f);
} }
if ((c->driver >= eDriver_net_human || (c->driver == eDriver_oppo && !PointOutOfSight(&c->pos, 150.0))) && !CAR(c)->invulnerable) { v_diff = (car_spec->pre_car_col_velocity.v[1] - c->v.v[1]) * gDefensive_powerup_factor[car_spec->power_up_levels[0]];
v_diff = (CAR(c)->pre_car_col_velocity.v[1] - c->v.v[1]) * gDefensive_powerup_factor[CAR(c)->power_up_levels[0]]; if (CAR(c)->invulnerable
if (v_diff < -20.0f && CAR(c)->number_of_wheels_on_ground < 3) { || (c->driver < eDriver_net_human && (c->driver != eDriver_oppo || PointOutOfSight(&c->pos, 150.0f)))
if (c->driver == eDriver_oppo && c->index == 4 && v_diff < -40.0) { || (v_diff >= -20.0f)
KnackerThisCar(CAR(c)); || CAR(c)->number_of_wheels_on_ground >= 3) {
StealCar(CAR(c)); CrushAndDamageCar(CAR(c), &dir, &normal_force, NULL);
v_diff = v_diff * 5.0; } else {
} // Cops Special Forces is always stolen if destroyed!
for (i = 0; i < CAR(c)->car_actor_count; i++) { if (c->driver == eDriver_oppo && c->index == 4 && v_diff < -40.0f) {
ts2 = (v_diff + 20.0) * -0.01; KnackerThisCar(CAR(c));
TotallySpamTheModel(CAR(c), i, CAR(c)->car_model_actors[i].actor, &CAR(c)->car_model_actors[i].crush_data, ts2); StealCar(CAR(c));
} v_diff = v_diff * 5.0f;
for (i = 0; i < COUNT_OF(CAR(c)->damage_units); i++) { }
DamageUnit(CAR(c), i, IRandomPosNeg(5) + (v_diff + 20.0) * -1.5); for (i = 0; i < CAR(c)->car_actor_count; i++) {
} ts2 = (v_diff + 20.0f) * -0.01f;
TotallySpamTheModel(CAR(c), i, CAR(c)->car_model_actors[i].actor, &CAR(c)->car_model_actors[i].crush_data, ts2);
}
for (i = 0; i < COUNT_OF(CAR(c)->damage_units); i++) {
DamageUnit(CAR(c), i, IRandomPosNeg(5) + (v_diff + 20.0f) * -1.5f);
} }
} }
if (!noise_defeat) { if (!noise_defeat) {

View File

@ -176,7 +176,7 @@ void Harness_DetectGameMode() {
void Harness_Init(int* argc, char* argv[]) { void Harness_Init(int* argc, char* argv[]) {
int result; int result;
LOG_INFO("DethRace version " DETHRACE_VERSION); LOG_INFO("version: " DETHRACE_VERSION);
// disable the original CD check code // disable the original CD check code
harness_game_config.disable_cd_check = 1; harness_game_config.disable_cd_check = 1;