From d910fd0e7ce7fa1722d26fbbd2b4238bd8617a21 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Fri, 8 Jun 2012 01:41:31 +0200 Subject: [PATCH] cleanly decide it to drop a hoard orb depending on wether we were killed by ourselves, en enemy or team-mate without any ugly and unreliable hacks --- CHANGELOG.txt | 4 ++++ main/multi.c | 12 ------------ main/object.c | 21 +++++++++------------ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 558018d25..3f8a35a93 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20120608 +-------- +main/multi.c, main/object.c: cleanly decide it to drop a hoard orb depending on wether we were killed by ourselves, en enemy or team-mate without any ugly and unreliable hacks + 20120601 -------- main/kconfig.c, main/kconfig.h, main/menu.c, main/playsave.c, main/playsave.h: Introduced sensitivity sliders for keyboard which cause movement increase the longer the designated key is pressed diff --git a/main/multi.c b/main/multi.c index 38096b778..3d6664aa3 100644 --- a/main/multi.c +++ b/main/multi.c @@ -638,7 +638,6 @@ multi_sort_kill_list(void) } extern object *obj_find_first_of_type (int); -char Multi_killed_yourself=0; void multi_compute_kill(int killer, int killed) { @@ -651,8 +650,6 @@ void multi_compute_kill(int killer, int killed) char killed_name[(CALLSIGN_LEN*2)+4]; char killer_name[(CALLSIGN_LEN*2)+4]; - Multi_killed_yourself=0; - // Both object numbers are localized already! if ((killed < 0) || (killed > Highest_object_index) || (killer < 0) || (killer > Highest_object_index)) @@ -761,7 +758,6 @@ void multi_compute_kill(int killer, int killed) if (killer_pnum == Player_num) { HUD_init_message(HM_MULTI, "%s %s %s!", TXT_YOU, TXT_KILLED, TXT_YOURSELF ); - Multi_killed_yourself=1; multi_add_lifetime_killed(); } else @@ -822,14 +818,6 @@ void multi_compute_kill(int killer, int killed) if (Newdemo_state == ND_STATE_RECORDING && !( Game_mode & GM_BOUNTY ) ) newdemo_record_multi_kill(killer_pnum, 1); } - else - { - if (Game_mode & GM_TEAM) - { - if (killed_pnum==Player_num && get_team(killed_pnum) == get_team(killer_pnum)) - Multi_killed_yourself=1; - } - } kill_matrix[killer_pnum][killed_pnum] += 1; Players[killed_pnum].net_killed_total += 1; diff --git a/main/object.c b/main/object.c index 2808d4125..640dc862f 100644 --- a/main/object.c +++ b/main/object.c @@ -1663,8 +1663,6 @@ void dead_player_frame(void) time_dead = 0; } -extern char Multi_killed_yourself; - // ------------------------------------------------------------------------------------------------------------------ void start_player_death_sequence(object *player) { @@ -1687,17 +1685,16 @@ void start_player_death_sequence(object *player) #ifdef NETWORK if (Game_mode & GM_MULTI) { - multi_send_kill(Players[Player_num].objnum); - -// If Hoard, increase number of orbs by 1 -// Only if you haven't killed yourself -// This prevents cheating - + int killer_pnum = Player_num; + if (Players[Player_num].killer_objnum > 0 && Players[Player_num].killer_objnum < Highest_object_index) + killer_pnum = Objects[Players[Player_num].killer_objnum].id; + + // If Hoard, increase number of orbs by 1. Only if you haven't killed yourself. This prevents cheating if (Game_mode & GM_HOARD) - if (Players[Player_num].secondary_ammo[PROXIMITY_INDEX]<12) - if (!Multi_killed_yourself) - Players[Player_num].secondary_ammo[PROXIMITY_INDEX]++; - + if (Players[Player_num].secondary_ammo[PROXIMITY_INDEX]<12) + if (!(Players[Player_num].killer_objnum == Players[Player_num].objnum || ((Game_mode & GM_TEAM) && get_team(Player_num) == get_team(killer_pnum)))) + Players[Player_num].secondary_ammo[PROXIMITY_INDEX]++; + multi_send_kill(Players[Player_num].objnum); } #endif