Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix damage not being applied when hitting walls #164

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ else()
include(GetGitRevisionDescription)
git_describe(DETHRACE_VERSION)
endif()
message(STATUS "DethRace version ${DETHRACE_VERSION}")

message(STATUS "dethrace version ${DETHRACE_VERSION}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder if you ever decide to create a new dethrace release, to not forget to include a VERSION file in the source release.


set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

Expand All @@ -37,6 +38,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 @@ -85,10 +87,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 @@ -2796,21 +2796,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