New player structures "frags" and "deaths"

player[<killer>].frags <victim>

Equals how many times player <killer> killed <victim>. Note that the sum of these values will not equal the total kills or deaths for a player since another player may disconnect, so use "frag" or "deaths" instead.

player[<id>].deaths

Equals the total number of times the player died in the round, not including suicides.

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6563 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-12-12 05:14:19 +00:00
parent 71e3948e70
commit bcb41aac3e
3 changed files with 18 additions and 0 deletions

View file

@ -1063,6 +1063,8 @@ const memberlabel_t PlayerLabels[]=
{ "hudpal", PLAYER_HUDPAL, 0, 0 },
{ "index", PLAYER_INDEX, 0, 0 },
{ "connected", PLAYER_CONNECTED, 0, 0 },
{ "frags", PLAYER_FRAGS, LABEL_HASPARM2, MAXPLAYERS },
{ "deaths", PLAYER_DEATHS, 0, 0 },
{ NULL, -1, 0, 0 } // END OF LIST
};

View file

@ -406,6 +406,8 @@ enum PlayerLabel_t
PLAYER_HUDPAL,
PLAYER_INDEX,
PLAYER_CONNECTED,
PLAYER_FRAGS,
PLAYER_DEATHS,
PLAYER_END
};

View file

@ -575,6 +575,13 @@ int32_t __fastcall VM_GetPlayer(int32_t const playerNum, int32_t labelNum, int32
case PLAYER_HUDPAL: labelNum = P_GetHudPal(ps); break;
case PLAYER_INDEX: labelNum = playerNum; break;
case PLAYER_CONNECTED: labelNum = g_player[playerNum].playerquitflag; break;
case PLAYER_FRAGS:
if (playerNum == lParm2)
labelNum = ps->fraggedself;
else
labelNum = g_player[playerNum].frags[lParm2];
break;
case PLAYER_DEATHS: labelNum = g_player[playerNum].frags[playerNum]; break;
default: labelNum = -1; break;
}
@ -764,6 +771,13 @@ void __fastcall VM_SetPlayer(int32_t const playerNum, int32_t const labelNum, in
case PLAYER_LAST_QUICK_KICK: ps->last_quick_kick = iSet; break;
case PLAYER_AUTOSTEP: ps->autostep = iSet; break;
case PLAYER_AUTOSTEP_SBW: ps->autostep_sbw = iSet; break;
case PLAYER_FRAGS:
if (playerNum == lParm2)
ps->fraggedself = iSet;
else
g_player[playerNum].frags[lParm2] = iSet;
break;
case PLAYER_DEATHS: g_player[playerNum].frags[playerNum] = iSet; break;
default: break;
}
}