Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 206287 | Differences between
and this patch

Collapse All | Expand All

(-)src/game/server/entities/character.cpp (+61 lines)
Lines 56-61 Link Here
56
	last_weapon = WEAPON_HAMMER;
56
	last_weapon = WEAPON_HAMMER;
57
	queued_weapon = -1;
57
	queued_weapon = -1;
58
	
58
	
59
	if(game.controller->is_instagib())
60
	{
61
		active_weapon = WEAPON_RIFLE;
62
		last_weapon = WEAPON_RIFLE;
63
		queued_weapon = -1;
64
	}
65
	
59
	//clear();
66
	//clear();
60
	this->player = player;
67
	this->player = player;
61
	this->pos = pos;
68
	this->pos = pos;
Lines 662-667 Link Here
662
	dbg_msg("game", "kill killer='%d:%s' victim='%d:%s' weapon=%d special=%d",
669
	dbg_msg("game", "kill killer='%d:%s' victim='%d:%s' weapon=%d special=%d",
663
		killer, server_clientname(killer),
670
		killer, server_clientname(killer),
664
		player->client_id, server_clientname(player->client_id), weapon, mode_special);
671
		player->client_id, server_clientname(player->client_id), weapon, mode_special);
672
	
673
	if(on_spree())
674
	{
675
		game.create_sound(pos, SOUND_GRENADE_EXPLODE);
676
		game.create_explosion(pos, player->client_id, WEAPON_RIFLE, true);
677
	}
678
	
679
	if(game.get_player_char(killer))
680
		game.get_player_char(killer)->spree_add();
681
	spree_end(killer);
665
682
666
	// send the kill message
683
	// send the kill message
667
	NETMSG_SV_KILLMSG msg;
684
	NETMSG_SV_KILLMSG msg;
Lines 694-705 Link Here
694
	player->respawn_tick = server_tick()+server_tickspeed()/2;
711
	player->respawn_tick = server_tick()+server_tickspeed()/2;
695
}
712
}
696
713
714
char spree_note[4][32] = { "is on a killing spree", "is on a rampage", "is dominating", "is unstoppable" };
715
716
void CHARACTER::spree_add()
717
{
718
	spree++;
719
	if(spree % 5 == 0)
720
	{
721
		int p = (int)spree/5-1;
722
		if(p > 3)
723
			p = 3;
724
		char buf[256];
725
		str_format(buf, sizeof(buf), "%s %s with %d kills!", server_clientname(player->client_id), spree_note[p], spree);
726
		game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
727
	}
728
}
729
730
void CHARACTER::spree_end(int killer)
731
{
732
	if(spree >= 5)
733
	{
734
		char buf[256];
735
		str_format(buf, sizeof(buf), "%s %d-kills killing spree was ended by %s", server_clientname(player->client_id), spree, server_clientname(killer));
736
		game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
737
	}
738
	spree = 0;
739
}
740
741
bool CHARACTER::on_spree()
742
{
743
	if(spree >= 5)
744
		return true;
745
	return false;
746
}
747
697
bool CHARACTER::take_damage(vec2 force, int dmg, int from, int weapon)
748
bool CHARACTER::take_damage(vec2 force, int dmg, int from, int weapon)
698
{
749
{
699
	core.vel += force;
750
	core.vel += force;
700
	
751
	
701
	if(game.controller->is_friendly_fire(player->client_id, from) && !config.sv_teamdamage)
752
	if(game.controller->is_friendly_fire(player->client_id, from) && !config.sv_teamdamage)
702
		return false;
753
		return false;
754
	
755
	if(game.controller->is_instagib() && weapon == WEAPON_GAME)
756
		return false;
757
	
758
	if(game.controller->is_instagib())
759
	{
760
		game.create_sound(pos, SOUND_HIT, cmask_one(from));
761
		die(from, weapon);
762
		return true;
763
	}
703
764
704
	// player only inflicts half damage on self
765
	// player only inflicts half damage on self
705
	if(from == player->client_id)
766
	if(from == player->client_id)
(-)src/game/server/entities/character.hpp (+6 lines)
Lines 83-88 Link Here
83
	//int score;
83
	//int score;
84
	int team;
84
	int team;
85
	int player_state; // if the client is chatting, accessing a menu or so
85
	int player_state; // if the client is chatting, accessing a menu or so
86
	
87
	int spree;
86
88
87
	// the player core for the physics	
89
	// the player core for the physics	
88
	CHARACTER_CORE core;
90
	CHARACTER_CORE core;
Lines 113-118 Link Here
113
	void fire_weapon();
115
	void fire_weapon();
114
116
115
	void die(int killer, int weapon);
117
	void die(int killer, int weapon);
118
	
119
	void spree_add();
120
	void spree_end(int killer);
121
	bool on_spree();
116
122
117
	bool take_damage(vec2 force, int dmg, int from, int weapon);	
123
	bool take_damage(vec2 force, int dmg, int from, int weapon);	
118
124
(-)src/game/server/entities/laser.cpp (+4 lines)
Lines 1-5 Link Here
1
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
1
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
2
#include <engine/e_server_interface.h>
2
#include <engine/e_server_interface.h>
3
#include <engine/e_config.h>
3
#include <game/generated/g_protocol.hpp>
4
#include <game/generated/g_protocol.hpp>
4
#include <game/server/gamecontext.hpp>
5
#include <game/server/gamecontext.hpp>
5
#include "laser.hpp"
6
#include "laser.hpp"
Lines 72-77 Link Here
72
				energy = -1;
73
				energy = -1;
73
				
74
				
74
			game.create_sound(pos, SOUND_RIFLE_BOUNCE);
75
			game.create_sound(pos, SOUND_RIFLE_BOUNCE);
76
			
77
			if(bounces == 1 && config.sv_laserjumps)
78
				game.create_explosion(pos, owner, WEAPON_GAME, false);
75
		}
79
		}
76
	}
80
	}
77
	else
81
	else
(-)src/game/server/gamecontroller.cpp (-5 / +24 lines)
Lines 29-34 Link Here
29
	
29
	
30
	unbalanced_tick = -1;
30
	unbalanced_tick = -1;
31
	force_balanced = false;
31
	force_balanced = false;
32
	instagib = false;
32
	
33
	
33
	num_spawn_points[0] = 0;
34
	num_spawn_points[0] = 0;
34
	num_spawn_points[1] = 0;
35
	num_spawn_points[1] = 0;
Lines 145-151 Link Here
145
		subtype = WEAPON_NINJA;
146
		subtype = WEAPON_NINJA;
146
	}
147
	}
147
	
148
	
148
	if(type != -1)
149
	if(type != -1 && !is_instagib())
149
	{
150
	{
150
		PICKUP *pickup = new PICKUP(type, subtype);
151
		PICKUP *pickup = new PICKUP(type, subtype);
151
		pickup->pos = pos;
152
		pickup->pos = pos;
Lines 329-338 Link Here
329
	chr->health = 10;
330
	chr->health = 10;
330
	
331
	
331
	// give default weapons
332
	// give default weapons
332
	chr->weapons[WEAPON_HAMMER].got = 1;
333
	if(is_instagib())
333
	chr->weapons[WEAPON_HAMMER].ammo = -1;
334
	{
334
	chr->weapons[WEAPON_GUN].got = 1;
335
		chr->weapons[WEAPON_RIFLE].got = 1;
335
	chr->weapons[WEAPON_GUN].ammo = 10;
336
		chr->weapons[WEAPON_RIFLE].ammo = -1;
337
	}
338
	else
339
	{
340
		chr->weapons[WEAPON_HAMMER].got = 1;
341
		chr->weapons[WEAPON_HAMMER].ammo = -1;
342
		chr->weapons[WEAPON_GUN].got = 1;
343
		chr->weapons[WEAPON_GUN].ammo = 10;
344
	}
336
}
345
}
337
346
338
void GAMECONTROLLER::do_warmup(int seconds)
347
void GAMECONTROLLER::do_warmup(int seconds)
Lines 471-477 Link Here
471
	server_setbrowseinfo(gametype, prog);
480
	server_setbrowseinfo(gametype, prog);
472
}
481
}
473
482
483
void GAMECONTROLLER::make_instagib(char *new_gametype)
484
{
485
	instagib = true;
486
	gametype = new_gametype;
487
}
474
488
489
bool GAMECONTROLLER::is_instagib() const
490
{
491
	return instagib;
492
}
493
475
bool GAMECONTROLLER::is_teamplay() const
494
bool GAMECONTROLLER::is_teamplay() const
476
{
495
{
477
	return game_flags&GAMEFLAG_TEAMS;
496
	return game_flags&GAMEFLAG_TEAMS;
(-)src/game/server/gamecontroller.hpp (+4 lines)
Lines 50-59 Link Here
50
	int game_flags;
50
	int game_flags;
51
	int unbalanced_tick;
51
	int unbalanced_tick;
52
	bool force_balanced;
52
	bool force_balanced;
53
	bool instagib;
53
	
54
	
54
public:
55
public:
55
	const char *gametype;
56
	const char *gametype;
56
57
58
	void make_instagib(char *gametype);
59
	bool is_instagib() const;
60
57
	bool is_teamplay() const;
61
	bool is_teamplay() const;
58
	
62
	
59
	GAMECONTROLLER();
63
	GAMECONTROLLER();
(-)src/game/server/hooks.cpp (-1 / +16 lines)
Lines 531-537 Link Here
531
	//players = new PLAYER[MAX_CLIENTS];
531
	//players = new PLAYER[MAX_CLIENTS];
532
532
533
	// select gametype
533
	// select gametype
534
	if(strcmp(config.sv_gametype, "mod") == 0)
534
	if(strcmp(config.sv_gametype, "ictf") == 0)
535
	{
536
		game.controller = new GAMECONTROLLER_CTF;
537
		game.controller->make_instagib("iCTF");
538
	}
539
	else if(strcmp(config.sv_gametype, "itdm") == 0)
540
	{
541
		game.controller = new GAMECONTROLLER_TDM;
542
		game.controller->make_instagib("iTDM");
543
	}
544
	else if(strcmp(config.sv_gametype, "idm") == 0)
545
	{
546
		game.controller = new GAMECONTROLLER_DM;
547
		game.controller->make_instagib("iDM");
548
	}
549
	else if(strcmp(config.sv_gametype, "mod") == 0)
535
		game.controller = new GAMECONTROLLER_MOD;
550
		game.controller = new GAMECONTROLLER_MOD;
536
	else if(strcmp(config.sv_gametype, "ctf") == 0)
551
	else if(strcmp(config.sv_gametype, "ctf") == 0)
537
		game.controller = new GAMECONTROLLER_CTF;
552
		game.controller = new GAMECONTROLLER_CTF;
(-)src/game/variables.hpp (+3 lines)
Lines 71-73 Link Here
71
71
72
MACRO_CONFIG_INT(dbg_focus, 0, 0, 1, CFGFLAG_CLIENT, "")
72
MACRO_CONFIG_INT(dbg_focus, 0, 0, 1, CFGFLAG_CLIENT, "")
73
MACRO_CONFIG_INT(dbg_tuning, 0, 0, 1, CFGFLAG_CLIENT, "")
73
MACRO_CONFIG_INT(dbg_tuning, 0, 0, 1, CFGFLAG_CLIENT, "")
74
75
/* instagib */
76
MACRO_CONFIG_INT(sv_laserjumps, 1, 0, 1, CFGFLAG_SERVER, "Enable laser jumps")

Return to bug 206287