Skip to content

Commit

Permalink
fix damage not being applied when hitting walls (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
dethrace-labs committed Sep 28, 2022
1 parent db3d6ac commit 76ea16a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ else()
include(GetGitRevisionDescription)
git_describe(DETHRACE_VERSION)
endif()
message(STATUS "DethRace version ${DETHRACE_VERSION}")

message(STATUS "dethrace version ${DETHRACE_VERSION}")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

Expand Down Expand Up @@ -53,6 +54,7 @@ add_subdirectory(lib/glad)
add_subdirectory(lib/miniaudio)

add_library(compile_with_werror INTERFACE)

if(DETHRACE_WERROR)
if(MSVC)
target_compile_options(compile_with_werror INTERFACE /WX)
Expand Down Expand Up @@ -101,10 +103,12 @@ if(DETHRACE_INSTALL)
string(TOLOWER "${CMAKE_SYSTEM_NAME}-${DETHRACE_ARCH}" CPACK_SYSTEM_NAME)

set(CPACK_PACKAGE_DIRECTORY dist)

if(MSVC)
set(CPACK_GENERATOR ZIP)
else()
set(CPACK_GENERATOR TGZ)
endif()

include(CPack)
endif()
34 changes: 19 additions & 15 deletions src/DETHRACE/common/car.c
Original file line number Diff line number Diff line change
Expand Up @@ -2815,21 +2815,25 @@ int CollCheck(tCollision_info* c, br_scalar dt) {
} else {
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(c)->pre_car_col_velocity.v[1] - c->v.v[1]) * gDefensive_powerup_factor[CAR(c)->power_up_levels[0]];
if (v_diff < -20.0f && CAR(c)->number_of_wheels_on_ground < 3) {
if (c->driver == eDriver_oppo && c->index == 4 && v_diff < -40.0) {
KnackerThisCar(CAR(c));
StealCar(CAR(c));
v_diff = v_diff * 5.0;
}
for (i = 0; i < CAR(c)->car_actor_count; i++) {
ts2 = (v_diff + 20.0) * -0.01;
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.0) * -1.5);
}
v_diff = (car_spec->pre_car_col_velocity.v[1] - c->v.v[1]) * gDefensive_powerup_factor[car_spec->power_up_levels[0]];
if (CAR(c)->invulnerable
|| (c->driver < eDriver_net_human && (c->driver != eDriver_oppo || PointOutOfSight(&c->pos, 150.0f)))
|| (v_diff >= -20.0f)
|| CAR(c)->number_of_wheels_on_ground >= 3) {
CrushAndDamageCar(CAR(c), &dir, &normal_force, NULL);
} else {
// Cops Special Forces is always stolen if destroyed!
if (c->driver == eDriver_oppo && c->index == 4 && v_diff < -40.0f) {
KnackerThisCar(CAR(c));
StealCar(CAR(c));
v_diff = v_diff * 5.0f;
}
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/harness/harness.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void Harness_DetectGameMode() {
void Harness_Init(int* argc, char* argv[]) {
int result;

LOG_INFO("DethRace version " DETHRACE_VERSION);
LOG_INFO("version: " DETHRACE_VERSION);

// disable the original CD check code
harness_game_config.disable_cd_check = 1;
Expand Down

0 comments on commit 76ea16a

Please sign in to comment.