introduced 3 special pseudo weapons. game, self and world to make a difference on how you got killed

This commit is contained in:
Magnus Auvinen 2009-01-12 21:41:16 +00:00
parent 1d6668583a
commit 123c5b5b99
7 changed files with 26 additions and 13 deletions

View file

@ -209,7 +209,7 @@ Messages = [
NetMessage("sv_killmsg", [
NetIntRange("killer", 0, 'MAX_CLIENTS-1'),
NetIntRange("victim", 0, 'MAX_CLIENTS-1'),
NetIntRange("weapon", -1, 'NUM_WEAPONS-1'),
NetIntRange("weapon", -3, 'NUM_WEAPONS-1'),
NetIntAny("mode_special"),
]),

View file

@ -550,7 +550,9 @@ void CHARACTER::tick()
col_get((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH ||
col_get((int)(pos.x-phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH ||
col_get((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH)
die(player->client_id, -1);
{
die(player->client_id, WEAPON_WORLD);
}
// handle weapons
handle_weapons();

View file

@ -9,6 +9,13 @@
#include <game/gamecore.hpp>
enum
{
WEAPON_GAME = -3, // team switching etc
WEAPON_SELF = -2, // console kill command
WEAPON_WORLD = -1, // death tiles etc
};
class CHARACTER : public ENTITY
{
MACRO_ALLOC_POOL_ID()

View file

@ -14,11 +14,15 @@ int GAMECONTROLLER_TDM::on_character_death(class CHARACTER *victim, class PLAYER
{
GAMECONTROLLER::on_character_death(victim, killer, weapon);
if(weapon != WEAPON_GAME)
{
// do team scoring
if(killer == victim->player || killer->team == victim->player->team)
teamscore[killer->team&1]--; // klant arschel
else
teamscore[killer->team&1]++; // good shit
}
return 0;
}

View file

@ -389,7 +389,7 @@ void mods_message(int msgtype, int client_id)
return;
p->last_kill = time_get();
p->kill_character(); //(client_id, -1);
p->kill_character(WEAPON_SELF);
p->respawn_tick = server_tick()+server_tickspeed()*3;
}
}

View file

@ -88,7 +88,7 @@ void PLAYER::snap(int snapping_client)
void PLAYER::on_disconnect()
{
kill_character();
kill_character(WEAPON_GAME);
//game.controller->on_player_death(&game.players[client_id], 0, -1);
@ -126,12 +126,12 @@ CHARACTER *PLAYER::get_character()
return 0;
}
void PLAYER::kill_character()
void PLAYER::kill_character(int weapon)
{
//CHARACTER *chr = get_character();
if(character)
{
character->die(client_id, -1);
character->die(client_id, weapon);
delete character;
character = 0;
}
@ -154,7 +154,7 @@ void PLAYER::set_team(int new_team)
str_format(buf, sizeof(buf), "%s joined the %s", server_clientname(client_id), game.controller->get_team_name(new_team));
game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
kill_character();
kill_character(WEAPON_GAME);
team = new_team;
score = 0;
dbg_msg("game", "team_join player='%d:%s' team=%d", client_id, server_clientname(client_id), team);

View file

@ -58,7 +58,7 @@ public:
CHARACTER *get_character();
void kill_character();
void kill_character(int weapon);
void try_respawn();
void respawn();