Skip to content

Commit 76ea16a

Browse files
fix damage not being applied when hitting walls (#164)
1 parent db3d6ac commit 76ea16a

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ else()
1919
include(GetGitRevisionDescription)
2020
git_describe(DETHRACE_VERSION)
2121
endif()
22-
message(STATUS "DethRace version ${DETHRACE_VERSION}")
22+
23+
message(STATUS "dethrace version ${DETHRACE_VERSION}")
2324

2425
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
2526

@@ -53,6 +54,7 @@ add_subdirectory(lib/glad)
5354
add_subdirectory(lib/miniaudio)
5455

5556
add_library(compile_with_werror INTERFACE)
57+
5658
if(DETHRACE_WERROR)
5759
if(MSVC)
5860
target_compile_options(compile_with_werror INTERFACE /WX)
@@ -101,10 +103,12 @@ if(DETHRACE_INSTALL)
101103
string(TOLOWER "${CMAKE_SYSTEM_NAME}-${DETHRACE_ARCH}" CPACK_SYSTEM_NAME)
102104

103105
set(CPACK_PACKAGE_DIRECTORY dist)
106+
104107
if(MSVC)
105108
set(CPACK_GENERATOR ZIP)
106109
else()
107110
set(CPACK_GENERATOR TGZ)
108111
endif()
112+
109113
include(CPack)
110114
endif()

src/DETHRACE/common/car.c

+19-15
Original file line numberDiff line numberDiff line change
@@ -2815,21 +2815,25 @@ int CollCheck(tCollision_info* c, br_scalar dt) {
28152815
} else {
28162816
BrVector3Scale(&normal_force, &normal_force, 0.75f);
28172817
}
2818-
if ((c->driver >= eDriver_net_human || (c->driver == eDriver_oppo && !PointOutOfSight(&c->pos, 150.0))) && !CAR(c)->invulnerable) {
2819-
v_diff = (CAR(c)->pre_car_col_velocity.v[1] - c->v.v[1]) * gDefensive_powerup_factor[CAR(c)->power_up_levels[0]];
2820-
if (v_diff < -20.0f && CAR(c)->number_of_wheels_on_ground < 3) {
2821-
if (c->driver == eDriver_oppo && c->index == 4 && v_diff < -40.0) {
2822-
KnackerThisCar(CAR(c));
2823-
StealCar(CAR(c));
2824-
v_diff = v_diff * 5.0;
2825-
}
2826-
for (i = 0; i < CAR(c)->car_actor_count; i++) {
2827-
ts2 = (v_diff + 20.0) * -0.01;
2828-
TotallySpamTheModel(CAR(c), i, CAR(c)->car_model_actors[i].actor, &CAR(c)->car_model_actors[i].crush_data, ts2);
2829-
}
2830-
for (i = 0; i < COUNT_OF(CAR(c)->damage_units); i++) {
2831-
DamageUnit(CAR(c), i, IRandomPosNeg(5) + (v_diff + 20.0) * -1.5);
2832-
}
2818+
v_diff = (car_spec->pre_car_col_velocity.v[1] - c->v.v[1]) * gDefensive_powerup_factor[car_spec->power_up_levels[0]];
2819+
if (CAR(c)->invulnerable
2820+
|| (c->driver < eDriver_net_human && (c->driver != eDriver_oppo || PointOutOfSight(&c->pos, 150.0f)))
2821+
|| (v_diff >= -20.0f)
2822+
|| CAR(c)->number_of_wheels_on_ground >= 3) {
2823+
CrushAndDamageCar(CAR(c), &dir, &normal_force, NULL);
2824+
} else {
2825+
// Cops Special Forces is always stolen if destroyed!
2826+
if (c->driver == eDriver_oppo && c->index == 4 && v_diff < -40.0f) {
2827+
KnackerThisCar(CAR(c));
2828+
StealCar(CAR(c));
2829+
v_diff = v_diff * 5.0f;
2830+
}
2831+
for (i = 0; i < CAR(c)->car_actor_count; i++) {
2832+
ts2 = (v_diff + 20.0f) * -0.01f;
2833+
TotallySpamTheModel(CAR(c), i, CAR(c)->car_model_actors[i].actor, &CAR(c)->car_model_actors[i].crush_data, ts2);
2834+
}
2835+
for (i = 0; i < COUNT_OF(CAR(c)->damage_units); i++) {
2836+
DamageUnit(CAR(c), i, IRandomPosNeg(5) + (v_diff + 20.0f) * -1.5f);
28332837
}
28342838
}
28352839
if (!noise_defeat) {

src/harness/harness.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void Harness_DetectGameMode() {
176176
void Harness_Init(int* argc, char* argv[]) {
177177
int result;
178178

179-
LOG_INFO("DethRace version " DETHRACE_VERSION);
179+
LOG_INFO("version: " DETHRACE_VERSION);
180180

181181
// disable the original CD check code
182182
harness_game_config.disable_cd_check = 1;

0 commit comments

Comments
 (0)