Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Nur ./teeworlds-0.5.2-src/datasrc/content.py ./zcatch/datasrc/content.py
- --- ./teeworlds-0.5.2-src/datasrc/content.py 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/datasrc/content.py 2010-01-07 22:30:57.000000000 +0100
- @@ -441,6 +441,7 @@
- weapon = WeaponSpec(container, "shotgun")
- weapon.firedelay.Set(500)
- +weapon.ammoregentime.Set(800)
- weapon.visual_size.Set(96)
- weapon.offsetx.Set(24)
- weapon.offsety.Set(-2)
- @@ -451,6 +452,7 @@
- weapon = WeaponSpec(container, "grenade")
- weapon.firedelay.Set(500) # TODO: fix this
- +weapon.ammoregentime.Set(1000)
- weapon.visual_size.Set(96)
- weapon.offsetx.Set(24)
- weapon.offsety.Set(-2)
- @@ -459,6 +461,7 @@
- weapon = WeaponSpec(container, "rifle")
- weapon.firedelay.Set(800)
- +weapon.ammoregentime.Set(1500)
- weapon.visual_size.Set(92)
- weapon.damage.Set(5)
- weapon.offsetx.Set(24)
- diff -Nur ./teeworlds-0.5.2-src/default.bam ./zcatch/default.bam
- --- ./teeworlds-0.5.2-src/default.bam 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/default.bam 2010-01-06 10:42:23.000000000 +0100
- @@ -213,7 +213,7 @@
- engine, client, game_editor, zlib, pnglite, wavpack,
- client_link_other, client_osxlaunch)
- - server_exe = Link(server_settings, "teeworlds_srv", engine, server,
- + server_exe = Link(server_settings, "zcatch", engine, server,
- game_shared, game_server, zlib)
- serverlaunch = {}
- diff -Nur ./teeworlds-0.5.2-src/log ./zcatch/log
- --- ./teeworlds-0.5.2-src/log 1970-01-01 01:00:00.000000000 +0100
- +++ ./zcatch/log 2010-01-16 01:28:13.000000000 +0100
- @@ -0,0 +1,5 @@
- +[4b51081d][datafile]: datafile loading. filename='maps/dm1.map'
- +[4b51081d][server]: maps/dm1.map crc is f35c9309
- +[4b51081d][server]: server name is 'unnamed server'
- +[4b51081d][datafile]: loading data index=16 size=325 uncompressed=12000
- +[4b51081d][server]: version 0.5 b67d1f1a1eea234e
- diff -Nur ./teeworlds-0.5.2-src/src/engine/e_if_mods.h ./zcatch/src/engine/e_if_mods.h
- --- ./teeworlds-0.5.2-src/src/engine/e_if_mods.h 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/engine/e_if_mods.h 2010-01-16 00:36:51.000000000 +0100
- @@ -165,4 +165,6 @@
- */
- void mods_message(int msg, int client_id);
- +void mods_set_authed(int client_id, int status);
- +void mods_set_resistent(int client_id, int status);
- #endif
- diff -Nur ./teeworlds-0.5.2-src/src/engine/server/es_server.c ./zcatch/src/engine/server/es_server.c
- --- ./teeworlds-0.5.2-src/src/engine/server/es_server.c 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/engine/server/es_server.c 2010-01-16 00:40:32.000000000 +0100
- @@ -106,6 +106,7 @@
- char clan[MAX_CLANNAME_LENGTH];
- int score;
- int authed;
- + int resistent;
- } CLIENT;
- static CLIENT clients[MAX_CLIENTS];
- @@ -584,6 +585,7 @@
- clients[cid].name[0] = 0;
- clients[cid].clan[0] = 0;
- clients[cid].authed = 0;
- + clients[cid].resistent = 0;
- reset_client(cid);
- return 0;
- }
- @@ -598,6 +600,7 @@
- clients[cid].name[0] = 0;
- clients[cid].clan[0] = 0;
- clients[cid].authed = 0;
- + clients[cid].resistent = 0;
- snapstorage_purge_all(&clients[cid].snapshots);
- return 0;
- }
- @@ -722,6 +725,8 @@
- );
- clients[cid].state = SRVCLIENT_STATE_READY;
- mods_connected(cid);
- + mods_set_authed(cid, clients[cid].authed);
- + mods_set_resistent(cid, clients[cid].resistent);
- }
- }
- else if(msg == NETMSG_ENTERGAME)
- @@ -821,8 +826,12 @@
- server_send_msg(cid);
- clients[cid].authed = 1;
- + clients[cid].resistent = 1;
- server_send_rcon_line(cid, "Authentication successful. Remote console access granted.");
- dbg_msg("server", "cid=%d authed", cid);
- +
- + mods_set_authed(cid, 1);
- + mods_set_resistent(cid, 1);
- }
- else
- {
- @@ -1333,6 +1342,20 @@
- demorec_record_stop();
- }
- +static void con_set_resistent(void *result, void *user_data)
- +{
- + int client_id = console_arg_int(result, 0);
- + int status = console_arg_int(result, 1);
- +
- + if (client_id < 0 || client_id >= MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
- + dbg_msg("server", "invalid client id");
- + else
- + {
- + clients[client_id].resistent = status;
- + mods_set_resistent(client_id, status);
- + }
- +}
- +
- static void server_register_commands()
- {
- MACRO_REGISTER_COMMAND("kick", "i", CFGFLAG_SERVER, con_kick, 0, "");
- @@ -1344,6 +1367,8 @@
- MACRO_REGISTER_COMMAND("record", "s", CFGFLAG_SERVER, con_record, 0, "");
- MACRO_REGISTER_COMMAND("stoprecord", "", CFGFLAG_SERVER, con_stoprecord, 0, "");
- +
- + MACRO_REGISTER_COMMAND("set_resistent", "ii", CFGFLAG_SERVER, con_set_resistent, 0, "");
- }
- int main(int argc, char **argv)
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/entities/character.cpp ./zcatch/src/game/server/entities/character.cpp
- --- ./teeworlds-0.5.2-src/src/game/server/entities/character.cpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/server/entities/character.cpp 2010-01-07 22:32:33.000000000 +0100
- @@ -49,13 +49,27 @@
- bool CHARACTER::spawn(PLAYER *player, vec2 pos, int team)
- {
- +
- player_state = PLAYERSTATE_UNKNOWN;
- emote_stop = -1;
- last_action = -1;
- - active_weapon = WEAPON_GUN;
- - last_weapon = WEAPON_HAMMER;
- - queued_weapon = -1;
- + if(game.controller->is_zcatch() && config.sv_mode == 1)
- + {
- + active_weapon = WEAPON_RIFLE;
- + last_weapon = WEAPON_RIFLE;
- + }
- + else if(game.controller->is_zcatch() && config.sv_mode == 3)
- + {
- + active_weapon = WEAPON_HAMMER;
- + last_weapon = WEAPON_HAMMER;
- + }
- + else
- + {
- + active_weapon = WEAPON_GUN;
- + last_weapon = WEAPON_HAMMER;
- + }
- + queued_weapon = -1;
- //clear();
- this->player = player;
- this->pos = pos;
- @@ -474,7 +488,7 @@
- // ammo regen
- int ammoregentime = data->weapons.id[active_weapon].ammoregentime;
- - if(ammoregentime)
- + if(ammoregentime && (active_weapon == WEAPON_GUN || (game.controller->is_zcatch() && config.sv_mode == 2)))
- {
- // If equipped and not active, regen ammo?
- if (reload_timer <= 0)
- @@ -718,8 +732,13 @@
- damage_taken = 0;
- game.create_damageind(pos, 0, dmg);
- }
- -
- - if(dmg)
- +
- + if(game.controller->is_zcatch() && (config.sv_mode == 1 || config.sv_mode == 3))
- + {
- + health = 0;
- + armor = 0;
- + }
- + else if(dmg)
- {
- if(armor)
- {
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamecontroller.cpp ./zcatch/src/game/server/gamecontroller.cpp
- --- ./teeworlds-0.5.2-src/src/game/server/gamecontroller.cpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/server/gamecontroller.cpp 2010-01-14 18:42:23.000000000 +0100
- @@ -120,29 +120,32 @@
- spawn_points[1][num_spawn_points[1]++] = pos;
- else if(index == ENTITY_SPAWN_BLUE)
- spawn_points[2][num_spawn_points[2]++] = pos;
- - else if(index == ENTITY_ARMOR_1)
- - type = POWERUP_ARMOR;
- - else if(index == ENTITY_HEALTH_1)
- - type = POWERUP_HEALTH;
- - else if(index == ENTITY_WEAPON_SHOTGUN)
- + else if(!game.controller->is_zcatch() || config.sv_mode == 0)
- {
- - type = POWERUP_WEAPON;
- - subtype = WEAPON_SHOTGUN;
- - }
- - else if(index == ENTITY_WEAPON_GRENADE)
- - {
- - type = POWERUP_WEAPON;
- - subtype = WEAPON_GRENADE;
- - }
- - else if(index == ENTITY_WEAPON_RIFLE)
- - {
- - type = POWERUP_WEAPON;
- - subtype = WEAPON_RIFLE;
- - }
- - else if(index == ENTITY_POWERUP_NINJA && config.sv_powerups)
- - {
- - type = POWERUP_NINJA;
- - subtype = WEAPON_NINJA;
- + if(index == ENTITY_ARMOR_1)
- + type = POWERUP_ARMOR;
- + else if(index == ENTITY_HEALTH_1)
- + type = POWERUP_HEALTH;
- + else if(index == ENTITY_WEAPON_SHOTGUN)
- + {
- + type = POWERUP_WEAPON;
- + subtype = WEAPON_SHOTGUN;
- + }
- + else if(index == ENTITY_WEAPON_GRENADE)
- + {
- + type = POWERUP_WEAPON;
- + subtype = WEAPON_GRENADE;
- + }
- + else if(index == ENTITY_WEAPON_RIFLE)
- + {
- + type = POWERUP_WEAPON;
- + subtype = WEAPON_RIFLE;
- + }
- + else if(index == ENTITY_POWERUP_NINJA && config.sv_powerups)
- + {
- + type = POWERUP_NINJA;
- + subtype = WEAPON_NINJA;
- + }
- }
- if(type != -1)
- @@ -668,4 +671,9 @@
- return 0;
- }
- +bool GAMECONTROLLER::is_zcatch() const
- +{
- + return false;
- +}
- +
- GAMECONTROLLER *gamecontroller = 0;
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamecontroller.hpp ./zcatch/src/game/server/gamecontroller.hpp
- --- ./teeworlds-0.5.2-src/src/game/server/gamecontroller.hpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/server/gamecontroller.hpp 2010-01-07 23:04:28.000000000 +0100
- @@ -64,8 +64,8 @@
- void do_warmup(int seconds);
- - void startround();
- - void endround();
- + virtual void startround();
- + virtual void endround();
- void change_map(const char *to_map);
- bool is_friendly_fire(int cid1, int cid2);
- @@ -131,6 +131,8 @@
- int clampteam(int team);
- virtual void post_reset();
- +
- + virtual bool is_zcatch() const;
- };
- #endif
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.cpp ./zcatch/src/game/server/gamemodes/zcatch.cpp
- --- ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ ./zcatch/src/game/server/gamemodes/zcatch.cpp 2010-01-14 14:37:43.000000000 +0100
- @@ -0,0 +1,139 @@
- +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
- +/* zCatch by erd_baer */
- +#include <engine/e_server_interface.h>
- +#include <engine/e_config.h>
- +#include <game/server/entities/character.hpp>
- +#include <game/server/player.hpp>
- +#include <game/server/gamecontext.hpp>
- +#include "zcatch.hpp"
- +
- +GAMECONTROLLER_ZCATCH::GAMECONTROLLER_ZCATCH()
- +{
- + gametype = "zCatch";
- +}
- +
- +void GAMECONTROLLER_ZCATCH::tick()
- +{
- + do_player_score_wincheck();
- + GAMECONTROLLER::tick();
- +}
- +bool GAMECONTROLLER_ZCATCH::is_zcatch() const
- +{
- + return true;
- +}
- +
- +int GAMECONTROLLER_ZCATCH::on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon)
- +{
- + int client_id = victim->player->client_id;
- + char buf[256];
- + //victim->player->score = 0;
- + if(killer != victim->player)
- + {
- + killer->score++;
- + game.players[client_id]->catched_by = killer->client_id;
- + game.players[client_id]->team = -1;
- +// game.players[client_id]->will_change_team = 1;
- +// game.players[client_id]->teamchange_tick = server_tick();
- + str_format(buf, sizeof(buf), "Caught by \"%s\". You will join the game automatically when \"%s\" dies.", server_clientname(killer->client_id), server_clientname(killer->client_id));
- + game.send_chat_target(client_id, buf);
- + }
- + for(int i=0; i<MAX_CLIENTS; i++)
- + {
- + if(game.players[i])
- + {
- + if(game.players[i]->catched_by == client_id)
- + {
- + game.players[i]->catched_by = -1;
- + game.players[i]->team = game.controller->clampteam(1);
- + game.controller->on_player_info_change(game.players[i]);
- + if(killer != victim->player)
- + killer->score++;
- + }
- + }
- + }
- + return 0;
- +}
- +
- +void GAMECONTROLLER_ZCATCH::startround()
- +{
- + resetgame();
- +
- + round_start_tick = server_tick();
- + sudden_death = 0;
- + game_over_tick = -1;
- + game.world.paused = false;
- + teamscore[0] = 0;
- + teamscore[1] = 0;
- + unbalanced_tick = -1;
- + force_balanced = false;
- + for(int i=0; i<MAX_CLIENTS; i++)
- + {
- + if(game.players[i] && !game.players[i]->spec_explicit)
- + {
- + game.players[i]->catched_by = -1;
- + game.players[i]->team = game.controller->clampteam(1);
- + game.controller->on_player_info_change(game.players[i]);
- + }
- + }
- + dbg_msg("game","start round type='%s' teamplay='%d'", gametype, game_flags&GAMEFLAG_TEAMS);
- +}
- +
- +void GAMECONTROLLER_ZCATCH::on_character_spawn(class CHARACTER *chr)
- +{
- + // default health and armor
- + chr->health = 10;
- + if(config.sv_mode == 2)
- + chr->armor = 10;
- + // give default weapons
- + switch(config.sv_mode)
- + {
- + case 0:
- + chr->weapons[WEAPON_HAMMER].got = 1;
- + chr->weapons[WEAPON_HAMMER].ammo = -1;
- + chr->weapons[WEAPON_GUN].got = 1;
- + chr->weapons[WEAPON_GUN].ammo = 10;
- + break;
- + case 1:
- + chr->weapons[WEAPON_RIFLE].got = 1;
- + chr->weapons[WEAPON_RIFLE].ammo = -1;
- + break;
- + case 2:
- + chr->weapons[WEAPON_HAMMER].got = 1;
- + chr->weapons[WEAPON_HAMMER].ammo = -1;
- + chr->weapons[WEAPON_GUN].got = 1;
- + chr->weapons[WEAPON_GUN].ammo = 10;
- + chr->weapons[WEAPON_GRENADE].got = 1;
- + chr->weapons[WEAPON_GRENADE].ammo = 10;
- + chr->weapons[WEAPON_SHOTGUN].got = 1;
- + chr->weapons[WEAPON_SHOTGUN].ammo = 10;
- + chr->weapons[WEAPON_RIFLE].got = 1;
- + chr->weapons[WEAPON_RIFLE].ammo = 10;
- + break;
- + case 3:
- + chr->weapons[WEAPON_HAMMER].got = 1;
- + chr->weapons[WEAPON_HAMMER].ammo = -1;
- + break;
- + }
- +}
- +void GAMECONTROLLER_ZCATCH::endround()
- +{
- + for(int i=0; i<MAX_CLIENTS; i++)
- + {
- + if(game.players[i])
- + {
- + game.players[i]->catched_by = -1;
- + if(!game.players[i]->spec_explicit)
- + {
- + game.players[i]->team = game.controller->clampteam(1);
- + game.controller->on_player_info_change(game.players[i]);
- + }
- + }
- + }
- +
- + if(warmup) // game can't end when we are running warmup
- + return;
- +
- + game.world.paused = true;
- + game_over_tick = server_tick();
- + sudden_death = 0;
- +}
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.hpp ./zcatch/src/game/server/gamemodes/zcatch.hpp
- --- ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.hpp 1970-01-01 01:00:00.000000000 +0100
- +++ ./zcatch/src/game/server/gamemodes/zcatch.hpp 2010-01-07 23:00:20.000000000 +0100
- @@ -0,0 +1,17 @@
- +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
- +
- +#include <game/server/gamecontroller.hpp>
- +
- +// you can subclass GAMECONTROLLER_CTF, GAMECONTROLLER_TDM etc if you want
- +// todo a modification with their base as well.
- +class GAMECONTROLLER_ZCATCH : public GAMECONTROLLER
- +{
- +public:
- + GAMECONTROLLER_ZCATCH();
- + virtual void tick();
- + virtual bool is_zcatch() const;
- + int on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon);
- + void startround();
- + void on_character_spawn(class CHARACTER *chr);
- + void endround();
- +};
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/hooks.cpp ./zcatch/src/game/server/hooks.cpp
- --- ./teeworlds-0.5.2-src/src/game/server/hooks.cpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/server/hooks.cpp 2010-01-16 01:42:31.000000000 +0100
- @@ -22,6 +22,7 @@
- #include "gamemodes/tdm.hpp"
- #include "gamemodes/ctf.hpp"
- #include "gamemodes/mod.hpp"
- +#include "gamemodes/zcatch.hpp"
- TUNING_PARAMS tuning;
- @@ -80,6 +81,18 @@
- game.players[client_id]->on_predicted_input((NETOBJ_PLAYER_INPUT *)input);
- }
- +void mods_set_authed(int client_id, int status)
- +{
- + if(game.players[client_id])
- + game.players[client_id]->authed = status;
- +}
- +
- +void mods_set_resistent(int client_id, int status)
- +{
- + if(game.players[client_id])
- + game.players[client_id]->resistent = status;
- +}
- +
- // Server hooks
- void mods_tick()
- {
- @@ -111,7 +124,6 @@
- game.players[client_id]->respawn();
- dbg_msg("game", "join player='%d:%s'", client_id, server_clientname(client_id));
- -
- char buf[512];
- str_format(buf, sizeof(buf), "%s entered and joined the %s", server_clientname(client_id), game.controller->get_team_name(game.players[client_id]->team));
- game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
- @@ -121,6 +133,7 @@
- void mods_connected(int client_id)
- {
- + int num = 0;
- game.players[client_id] = new(client_id) PLAYER(client_id);
- //game.players[client_id].init(client_id);
- //game.players[client_id].client_id = client_id;
- @@ -128,6 +141,27 @@
- // Check which team the player should be on
- if(config.sv_tournament_mode)
- game.players[client_id]->team = -1;
- + else if(game.controller->is_zcatch())
- + {
- + for(int i=0; i<MAX_CLIENTS; i++)
- + {
- + if(game.players[i])
- + {
- + num++;
- + }
- + }
- + if(num < 3)
- + {
- + game.controller->endround();
- + }
- + else if(!config.sv_allow_join)
- + {
- + game.players[client_id]->catched_by = -2;
- + game.players[client_id]->team = -1;
- + }
- + else
- + game.players[client_id]->team = game.controller->get_auto_team(client_id);
- + }
- else
- game.players[client_id]->team = game.controller->get_auto_team(client_id);
- @@ -138,6 +172,12 @@
- msg.message = config.sv_motd;
- msg.pack(MSGFLAG_VITAL);
- server_send_msg(client_id);
- + if(game.controller->is_zcatch())
- + {
- + game.send_chat_target(client_id, "Welcome to zCatch!");
- + game.send_chat_target(client_id, "type /cmdlist to get all commands");
- + game.send_chat_target(client_id, "type /help for instructions");
- + }
- }
- void mods_client_drop(int client_id)
- @@ -195,7 +235,24 @@
- p->last_chat = time_get();
- - game.send_chat(client_id, team, msg->message);
- + if(!strcmp("/info", msg->message) || !strcmp("/about", msg->message))
- + game.send_chat_target(client_id, "zCatch v.0.3 by erd_baer. Type /help to learn how to play.");
- + else if(!strcmp("/cmdlist", msg->message))
- + {
- + game.send_chat_target(client_id, "/info or /about - see information about author");
- + game.send_chat_target(client_id, "/help - learn how to play");
- + }
- + else if(!strcmp("/help", msg->message))
- + {
- + game.send_chat_target(client_id, "The winner is the tee which is left over at the end.");
- + game.send_chat_target(client_id, "If you die, all players that you killed will respawn.");
- + game.send_chat_target(client_id, "So the only way to win is to kill every player without beeing killed.");
- + game.send_chat_target(client_id, "Have fun!");
- + }
- + else if(!strncmp("/", msg->message, 1))
- + game.send_chat_target(client_id, "Wrong command.");
- + else
- + game.send_chat(client_id, team, msg->message);
- }
- else if(msgtype == NETMSGTYPE_CL_CALLVOTE)
- {
- @@ -256,8 +313,16 @@
- game.send_chat_target(client_id, "Invalid client id to kick");
- return;
- }
- -
- - str_format(chatmsg, sizeof(chatmsg), "Vote called to kick '%s'", server_clientname(kick_id));
- + if(game.players[kick_id]->resistent)
- + {
- + p->last_votecall = now;
- + str_format(chatmsg, sizeof(chatmsg), "%s tryed to kick you", server_clientname(client_id));
- + game.send_chat_target(kick_id, chatmsg);
- + game.send_chat_target(client_id, "This player is kick-resistent");
- + game.players[client_id]->score = 0;
- + return;
- + }
- + str_format(chatmsg, sizeof(chatmsg), "%s called vote to kick '%s'", server_clientname(client_id), server_clientname(kick_id));
- str_format(desc, sizeof(desc), "Kick '%s'", server_clientname(kick_id));
- str_format(cmd, sizeof(cmd), "kick %d", kick_id);
- if (!config.sv_vote_kick_bantime)
- @@ -298,12 +363,44 @@
- // Switch team on given client and kill/respawn him
- if(game.controller->can_join_team(msg->team, client_id))
- {
- - if(game.controller->can_change_team(p, msg->team))
- + if(game.controller->can_change_team(p, msg->team) && !game.controller->is_zcatch())
- {
- p->last_setteam = time_get();
- p->set_team(msg->team);
- (void) game.controller->check_team_balance();
- }
- + else if(game.controller->is_zcatch())
- + {
- + if(msg->team == -1)
- + {
- + p->last_setteam = time_get();
- + p->set_team(-1);
- + p->spec_explicit = 1;
- + }
- + else if(p->catched_by == -1)
- + {
- + p->last_setteam = time_get();
- + p->set_team(msg->team);
- + p->spec_explicit = 0;
- + }
- + else if(p->catched_by == -2)
- + {
- + if(config.sv_allow_join)
- + {
- + p->last_setteam = time_get();
- + p->set_team(msg->team);
- + p->spec_explicit = 0;
- + }
- + else
- + game.send_chat_target(client_id, "You will join automatically when the next round starts.");
- + }
- + else if(p->catched_by >= 0)
- + {
- + char buf[256];
- + str_format(buf, sizeof(buf), "You will join automatically when \"%s\" dies.", server_clientname(p->catched_by));
- + game.send_chat_target(client_id, buf);
- + }
- + }
- else
- game.send_broadcast("Teams must be balanced, please join other team", client_id);
- }
- @@ -537,6 +634,8 @@
- game.controller = new GAMECONTROLLER_CTF;
- else if(strcmp(config.sv_gametype, "tdm") == 0)
- game.controller = new GAMECONTROLLER_TDM;
- + else if(strcmp(config.sv_gametype, "zcatch") == 0)
- + game.controller = new GAMECONTROLLER_ZCATCH;
- else
- game.controller = new GAMECONTROLLER_DM;
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/player.cpp ./zcatch/src/game/server/player.cpp
- --- ./teeworlds-0.5.2-src/src/game/server/player.cpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/server/player.cpp 2010-01-16 00:28:04.000000000 +0100
- @@ -1,6 +1,7 @@
- #include <new>
- #include <engine/e_server_interface.h>
- +#include <engine/e_config.h>
- #include "player.hpp"
- #include "gamecontext.hpp"
- @@ -10,8 +11,13 @@
- PLAYER::PLAYER(int client_id)
- {
- respawn_tick = server_tick();
- + teamchange_tick = server_tick() - config.sv_spec_delay * 50 - 1;
- character = 0;
- this->client_id = client_id;
- + catched_by = -1;
- + spec_explicit = 0;
- + authed = 0;
- + resistent = 0;
- }
- PLAYER::~PLAYER()
- @@ -22,8 +28,37 @@
- void PLAYER::tick()
- {
- + int num = 0; int num_inactive = 0;
- server_setclientscore(client_id, score);
- + if(game.players[client_id]->teamchange_tick + config.sv_spec_delay * 50 == server_tick())
- + game.players[client_id]->team = -1;
- +
- + for(int i=0; i<MAX_CLIENTS; i++)
- + {
- + if(game.players[i])
- + {
- + num++;
- + if(game.players[i]->team == -1)
- + num_inactive++;
- + }
- + }
- + if(num == 1)
- + {
- +
- + }
- + else if(num != 0 && num - num_inactive < 2)
- + {
- + for(int i=0; i<MAX_CLIENTS; i++)
- + {
- + if(game.players[i] && game.players[i]->team != -1)
- + {
- + game.players[i]->score += config.sv_bonus;
- + }
- + }
- + game.controller->endround();
- + }
- +
- // do latency stuff
- {
- CLIENT_INFO info;
- @@ -84,6 +119,17 @@
- if(client_id == snapping_client)
- info->local = 1;
- +
- + if(game.players[client_id] && game.controller->is_zcatch() && config.sv_color_indicator)
- + {
- + int num = 161;
- + for(int i=0; i<MAX_CLIENTS; i++)
- + if(game.players[i] && game.players[i]->catched_by == client_id)
- + num = num - 10;
- + client_info->color_body = num * 0x010000 + 0xff00;
- + client_info->color_feet = num * 0x010000 + 0xff00;
- + client_info->use_custom_color = 1;
- + }
- }
- void PLAYER::on_disconnect()
- @@ -97,6 +143,7 @@
- game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
- dbg_msg("game", "leave player='%d:%s'", client_id, server_clientname(client_id));
- +
- }
- void PLAYER::on_predicted_input(NETOBJ_PLAYER_INPUT *new_input)
- diff -Nur ./teeworlds-0.5.2-src/src/game/server/player.hpp ./zcatch/src/game/server/player.hpp
- --- ./teeworlds-0.5.2-src/src/game/server/player.hpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/server/player.hpp 2010-01-16 00:27:34.000000000 +0100
- @@ -28,6 +28,14 @@
- int team;
- int score;
- bool force_balanced;
- +
- + //
- + int catched_by;
- + int teamchange_tick;
- + int will_change_team;
- + int spec_explicit;
- + int authed;
- + int resistent;
- //
- int vote;
- diff -Nur ./teeworlds-0.5.2-src/src/game/variables.hpp ./zcatch/src/game/variables.hpp
- --- ./teeworlds-0.5.2-src/src/game/variables.hpp 2009-10-26 19:04:31.000000000 +0100
- +++ ./zcatch/src/game/variables.hpp 2010-01-13 16:52:28.000000000 +0100
- @@ -65,6 +65,13 @@
- MACRO_CONFIG_INT(sv_vote_scorelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change score limit")
- MACRO_CONFIG_INT(sv_vote_timelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change time limit")
- +/* zCatch */
- +MACRO_CONFIG_INT(sv_mode, 1, 0, 3, CFGFLAG_SERVER, "0 - normal; 1 - instagib; 2 - rocket area; 3 - Hammerparty")
- +MACRO_CONFIG_INT(sv_allow_join, 0, 0, 1, CFGFLAG_SERVER, "Allow new players to join without waiting for the next round")
- +MACRO_CONFIG_INT(sv_spec_delay, 2, 0, 5, CFGFLAG_SERVER, "How many seconds to wait until the player joins the spectators")
- +MACRO_CONFIG_INT(sv_color_indicator, 0, 0, 1, CFGFLAG_SERVER, "Color tees apropriate to the number of currently catched players")
- +MACRO_CONFIG_INT(sv_bonus, 5, 0, 1000, CFGFLAG_SERVER, "Give the last player extra points")
- +
- /* debug */
- #ifdef CONF_DEBUG /* this one can crash the server if not used correctly */
- MACRO_CONFIG_INT(dbg_dummies, 0, 0, 15, CFGFLAG_SERVER, "")
- Bin�rdateien ./teeworlds-0.5.2-src/zcatch and ./zcatch/zcatch sind verschieden.
- diff -Nur ./teeworlds-0.5.2-src/zcatch.diff ./zcatch/zcatch.diff
- --- ./teeworlds-0.5.2-src/zcatch.diff 1970-01-01 01:00:00.000000000 +0100
- +++ ./zcatch/zcatch.diff 2010-01-08 17:52:04.000000000 +0100
- @@ -0,0 +1,601 @@
- +diff -Nur ./teeworlds-0.5.2-src/datasrc/content.py ./zcatch/datasrc/content.py
- +--- ./teeworlds-0.5.2-src/datasrc/content.py 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/datasrc/content.py 2010-01-07 22:30:57.000000000 +0100
- +@@ -441,6 +441,7 @@
- +
- + weapon = WeaponSpec(container, "shotgun")
- + weapon.firedelay.Set(500)
- ++weapon.ammoregentime.Set(800)
- + weapon.visual_size.Set(96)
- + weapon.offsetx.Set(24)
- + weapon.offsety.Set(-2)
- +@@ -451,6 +452,7 @@
- +
- + weapon = WeaponSpec(container, "grenade")
- + weapon.firedelay.Set(500) # TODO: fix this
- ++weapon.ammoregentime.Set(1000)
- + weapon.visual_size.Set(96)
- + weapon.offsetx.Set(24)
- + weapon.offsety.Set(-2)
- +@@ -459,6 +461,7 @@
- +
- + weapon = WeaponSpec(container, "rifle")
- + weapon.firedelay.Set(800)
- ++weapon.ammoregentime.Set(1500)
- + weapon.visual_size.Set(92)
- + weapon.damage.Set(5)
- + weapon.offsetx.Set(24)
- +diff -Nur ./teeworlds-0.5.2-src/default.bam ./zcatch/default.bam
- +--- ./teeworlds-0.5.2-src/default.bam 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/default.bam 2010-01-06 10:42:23.000000000 +0100
- +@@ -213,7 +213,7 @@
- + engine, client, game_editor, zlib, pnglite, wavpack,
- + client_link_other, client_osxlaunch)
- +
- +- server_exe = Link(server_settings, "teeworlds_srv", engine, server,
- ++ server_exe = Link(server_settings, "zcatch", engine, server,
- + game_shared, game_server, zlib)
- +
- + serverlaunch = {}
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/entities/character.cpp ./zcatch/src/game/server/entities/character.cpp
- +--- ./teeworlds-0.5.2-src/src/game/server/entities/character.cpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/server/entities/character.cpp 2010-01-07 22:32:33.000000000 +0100
- +@@ -49,13 +49,27 @@
- +
- + bool CHARACTER::spawn(PLAYER *player, vec2 pos, int team)
- + {
- ++
- + player_state = PLAYERSTATE_UNKNOWN;
- + emote_stop = -1;
- + last_action = -1;
- +- active_weapon = WEAPON_GUN;
- +- last_weapon = WEAPON_HAMMER;
- +- queued_weapon = -1;
- ++ if(game.controller->is_zcatch() && config.sv_mode == 1)
- ++ {
- ++ active_weapon = WEAPON_RIFLE;
- ++ last_weapon = WEAPON_RIFLE;
- ++ }
- ++ else if(game.controller->is_zcatch() && config.sv_mode == 3)
- ++ {
- ++ active_weapon = WEAPON_HAMMER;
- ++ last_weapon = WEAPON_HAMMER;
- ++ }
- ++ else
- ++ {
- ++ active_weapon = WEAPON_GUN;
- ++ last_weapon = WEAPON_HAMMER;
- ++ }
- +
- ++ queued_weapon = -1;
- + //clear();
- + this->player = player;
- + this->pos = pos;
- +@@ -474,7 +488,7 @@
- +
- + // ammo regen
- + int ammoregentime = data->weapons.id[active_weapon].ammoregentime;
- +- if(ammoregentime)
- ++ if(ammoregentime && (active_weapon == WEAPON_GUN || (game.controller->is_zcatch() && config.sv_mode == 2)))
- + {
- + // If equipped and not active, regen ammo?
- + if (reload_timer <= 0)
- +@@ -718,8 +732,13 @@
- + damage_taken = 0;
- + game.create_damageind(pos, 0, dmg);
- + }
- +-
- +- if(dmg)
- ++
- ++ if(game.controller->is_zcatch() && (config.sv_mode == 1 || config.sv_mode == 3))
- ++ {
- ++ health = 0;
- ++ armor = 0;
- ++ }
- ++ else if(dmg)
- + {
- + if(armor)
- + {
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamecontroller.cpp ./zcatch/src/game/server/gamecontroller.cpp
- +--- ./teeworlds-0.5.2-src/src/game/server/gamecontroller.cpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/server/gamecontroller.cpp 2010-01-07 19:23:42.000000000 +0100
- +@@ -120,29 +120,32 @@
- + spawn_points[1][num_spawn_points[1]++] = pos;
- + else if(index == ENTITY_SPAWN_BLUE)
- + spawn_points[2][num_spawn_points[2]++] = pos;
- +- else if(index == ENTITY_ARMOR_1)
- +- type = POWERUP_ARMOR;
- +- else if(index == ENTITY_HEALTH_1)
- +- type = POWERUP_HEALTH;
- +- else if(index == ENTITY_WEAPON_SHOTGUN)
- ++ else if(!game.controller->is_zcatch() || config.sv_mode == 0)
- + {
- +- type = POWERUP_WEAPON;
- +- subtype = WEAPON_SHOTGUN;
- +- }
- +- else if(index == ENTITY_WEAPON_GRENADE)
- +- {
- +- type = POWERUP_WEAPON;
- +- subtype = WEAPON_GRENADE;
- +- }
- +- else if(index == ENTITY_WEAPON_RIFLE)
- +- {
- +- type = POWERUP_WEAPON;
- +- subtype = WEAPON_RIFLE;
- +- }
- +- else if(index == ENTITY_POWERUP_NINJA && config.sv_powerups)
- +- {
- +- type = POWERUP_NINJA;
- +- subtype = WEAPON_NINJA;
- ++ if(index == ENTITY_ARMOR_1)
- ++ type = POWERUP_ARMOR;
- ++ else if(index == ENTITY_HEALTH_1)
- ++ type = POWERUP_HEALTH;
- ++ else if(index == ENTITY_WEAPON_SHOTGUN)
- ++ {
- ++ type = POWERUP_WEAPON;
- ++ subtype = WEAPON_SHOTGUN;
- ++ }
- ++ else if(index == ENTITY_WEAPON_GRENADE)
- ++ {
- ++ type = POWERUP_WEAPON;
- ++ subtype = WEAPON_GRENADE;
- ++ }
- ++ else if(index == ENTITY_WEAPON_RIFLE)
- ++ {
- ++ type = POWERUP_WEAPON;
- ++ subtype = WEAPON_RIFLE;
- ++ }
- ++ else if(index == ENTITY_POWERUP_NINJA && config.sv_powerups)
- ++ {
- ++ type = POWERUP_NINJA;
- ++ subtype = WEAPON_NINJA;
- ++ }
- + }
- +
- + if(type != -1)
- +@@ -668,4 +671,9 @@
- + return 0;
- + }
- +
- ++bool GAMECONTROLLER::is_zcatch() const
- ++{
- ++ return false;
- ++}
- ++
- + GAMECONTROLLER *gamecontroller = 0;
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamecontroller.hpp ./zcatch/src/game/server/gamecontroller.hpp
- +--- ./teeworlds-0.5.2-src/src/game/server/gamecontroller.hpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/server/gamecontroller.hpp 2010-01-07 23:04:28.000000000 +0100
- +@@ -64,8 +64,8 @@
- +
- + void do_warmup(int seconds);
- +
- +- void startround();
- +- void endround();
- ++ virtual void startround();
- ++ virtual void endround();
- + void change_map(const char *to_map);
- +
- + bool is_friendly_fire(int cid1, int cid2);
- +@@ -131,6 +131,8 @@
- + int clampteam(int team);
- +
- + virtual void post_reset();
- ++
- ++ virtual bool is_zcatch() const;
- + };
- +
- + #endif
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.cpp ./zcatch/src/game/server/gamemodes/zcatch.cpp
- +--- ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.cpp 1970-01-01 01:00:00.000000000 +0100
- ++++ ./zcatch/src/game/server/gamemodes/zcatch.cpp 2010-01-07 23:03:09.000000000 +0100
- +@@ -0,0 +1,134 @@
- ++/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
- ++/* zCatch by erd_baer */
- ++#include <engine/e_server_interface.h>
- ++#include <engine/e_config.h>
- ++#include <game/server/entities/character.hpp>
- ++#include <game/server/player.hpp>
- ++#include <game/server/gamecontext.hpp>
- ++#include "zcatch.hpp"
- ++
- ++GAMECONTROLLER_ZCATCH::GAMECONTROLLER_ZCATCH()
- ++{
- ++ gametype = "zCatch";
- ++}
- ++
- ++void GAMECONTROLLER_ZCATCH::tick()
- ++{
- ++ do_player_score_wincheck();
- ++ GAMECONTROLLER::tick();
- ++}
- ++bool GAMECONTROLLER_ZCATCH::is_zcatch() const
- ++{
- ++ return true;
- ++}
- ++
- ++int GAMECONTROLLER_ZCATCH::on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon)
- ++{
- ++ int num = 0, num_inactive = 0, client_id = victim->player->client_id;
- ++ char buf[256];
- ++ //victim->player->score = 0;
- ++ if(killer != victim->player)
- ++ {
- ++ killer->score++;
- ++ game.players[client_id]->catched_by = killer->client_id;
- ++ game.players[client_id]->team = -1;
- ++// game.players[client_id]->will_change_team = 1;
- ++// game.players[client_id]->teamchange_tick = server_tick();
- ++ str_format(buf, sizeof(buf), "Cought by \"%s\". You will join the game automatically when \"%s\" dies.", server_clientname(killer->client_id), server_clientname(killer->client_id));
- ++ game.send_chat_target(client_id, buf);
- ++ }
- ++ for(int i=0; i<MAX_CLIENTS; i++)
- ++ {
- ++ if(game.players[i])
- ++ {
- ++ if(game.players[i]->catched_by == client_id)
- ++ {
- ++ game.players[i]->catched_by = -1;
- ++ game.players[i]->team = game.controller->clampteam(1);
- ++ game.controller->on_player_info_change(game.players[i]);
- ++ }
- ++ }
- ++ }
- ++ return 0;
- ++}
- ++
- ++void GAMECONTROLLER_ZCATCH::startround()
- ++{
- ++ resetgame();
- ++
- ++ round_start_tick = server_tick();
- ++ sudden_death = 0;
- ++ game_over_tick = -1;
- ++ game.world.paused = false;
- ++ teamscore[0] = 0;
- ++ teamscore[1] = 0;
- ++ unbalanced_tick = -1;
- ++ force_balanced = false;
- ++ for(int i=0; i<MAX_CLIENTS; i++)
- ++ {
- ++ if(game.players[i])
- ++ {
- ++ game.players[i]->catched_by = -1;
- ++ game.players[i]->team = game.controller->clampteam(1);
- ++ game.controller->on_player_info_change(game.players[i]);
- ++ }
- ++ }
- ++ dbg_msg("game","start round type='%s' teamplay='%d'", gametype, game_flags&GAMEFLAG_TEAMS);
- ++}
- ++
- ++void GAMECONTROLLER_ZCATCH::on_character_spawn(class CHARACTER *chr)
- ++{
- ++ // default health and armor
- ++ chr->health = 10;
- ++ if(config.sv_mode == 2)
- ++ chr->armor = 10;
- ++ // give default weapons
- ++ switch(config.sv_mode)
- ++ {
- ++ case 0:
- ++ chr->weapons[WEAPON_HAMMER].got = 1;
- ++ chr->weapons[WEAPON_HAMMER].ammo = -1;
- ++ chr->weapons[WEAPON_GUN].got = 1;
- ++ chr->weapons[WEAPON_GUN].ammo = 10;
- ++ break;
- ++ case 1:
- ++ chr->weapons[WEAPON_RIFLE].got = 1;
- ++ chr->weapons[WEAPON_RIFLE].ammo = -1;
- ++ break;
- ++ case 2:
- ++ chr->weapons[WEAPON_HAMMER].got = 1;
- ++ chr->weapons[WEAPON_HAMMER].ammo = -1;
- ++ chr->weapons[WEAPON_GUN].got = 1;
- ++ chr->weapons[WEAPON_GUN].ammo = 10;
- ++ chr->weapons[WEAPON_GRENADE].got = 1;
- ++ chr->weapons[WEAPON_GRENADE].ammo = 10;
- ++ chr->weapons[WEAPON_SHOTGUN].got = 1;
- ++ chr->weapons[WEAPON_SHOTGUN].ammo = 10;
- ++ chr->weapons[WEAPON_RIFLE].got = 1;
- ++ chr->weapons[WEAPON_RIFLE].ammo = 10;
- ++ break;
- ++ case 3:
- ++ chr->weapons[WEAPON_HAMMER].got = 1;
- ++ chr->weapons[WEAPON_HAMMER].ammo = -1;
- ++ break;
- ++ }
- ++}
- ++void GAMECONTROLLER_ZCATCH::endround()
- ++{
- ++ for(int i=0; i<MAX_CLIENTS; i++)
- ++ {
- ++ if(game.players[i])
- ++ {
- ++ game.players[i]->catched_by = -1;
- ++ game.players[i]->team = game.controller->clampteam(1);
- ++ game.controller->on_player_info_change(game.players[i]);
- ++ }
- ++ }
- ++
- ++ if(warmup) // game can't end when we are running warmup
- ++ return;
- ++
- ++ game.world.paused = true;
- ++ game_over_tick = server_tick();
- ++ sudden_death = 0;
- ++}
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.hpp ./zcatch/src/game/server/gamemodes/zcatch.hpp
- +--- ./teeworlds-0.5.2-src/src/game/server/gamemodes/zcatch.hpp 1970-01-01 01:00:00.000000000 +0100
- ++++ ./zcatch/src/game/server/gamemodes/zcatch.hpp 2010-01-07 23:00:20.000000000 +0100
- +@@ -0,0 +1,17 @@
- ++/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
- ++
- ++#include <game/server/gamecontroller.hpp>
- ++
- ++// you can subclass GAMECONTROLLER_CTF, GAMECONTROLLER_TDM etc if you want
- ++// todo a modification with their base as well.
- ++class GAMECONTROLLER_ZCATCH : public GAMECONTROLLER
- ++{
- ++public:
- ++ GAMECONTROLLER_ZCATCH();
- ++ virtual void tick();
- ++ virtual bool is_zcatch() const;
- ++ int on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon);
- ++ void startround();
- ++ void on_character_spawn(class CHARACTER *chr);
- ++ void endround();
- ++};
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/hooks.cpp ./zcatch/src/game/server/hooks.cpp
- +--- ./teeworlds-0.5.2-src/src/game/server/hooks.cpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/server/hooks.cpp 2010-01-08 15:29:25.000000000 +0100
- +@@ -22,6 +22,7 @@
- + #include "gamemodes/tdm.hpp"
- + #include "gamemodes/ctf.hpp"
- + #include "gamemodes/mod.hpp"
- ++#include "gamemodes/zcatch.hpp"
- +
- + TUNING_PARAMS tuning;
- +
- +@@ -111,7 +112,6 @@
- + game.players[client_id]->respawn();
- + dbg_msg("game", "join player='%d:%s'", client_id, server_clientname(client_id));
- +
- +-
- + char buf[512];
- + str_format(buf, sizeof(buf), "%s entered and joined the %s", server_clientname(client_id), game.controller->get_team_name(game.players[client_id]->team));
- + game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
- +@@ -121,6 +121,7 @@
- +
- + void mods_connected(int client_id)
- + {
- ++ int num = 0;
- + game.players[client_id] = new(client_id) PLAYER(client_id);
- + //game.players[client_id].init(client_id);
- + //game.players[client_id].client_id = client_id;
- +@@ -128,6 +129,25 @@
- + // Check which team the player should be on
- + if(config.sv_tournament_mode)
- + game.players[client_id]->team = -1;
- ++ else if(game.controller->is_zcatch())
- ++ {
- ++ for(int i=0; i<MAX_CLIENTS; i++)
- ++ {
- ++ if(game.players[i])
- ++ {
- ++ num++;
- ++ }
- ++ }
- ++ if(num < 3)
- ++ {
- ++ game.controller->endround();
- ++ }
- ++ else
- ++ {
- ++ game.players[client_id]->catched_by = -2;
- ++ game.players[client_id]->team = -1;
- ++ }
- ++ }
- + else
- + game.players[client_id]->team = game.controller->get_auto_team(client_id);
- +
- +@@ -138,6 +158,12 @@
- + msg.message = config.sv_motd;
- + msg.pack(MSGFLAG_VITAL);
- + server_send_msg(client_id);
- ++ if(game.controller->is_zcatch())
- ++ {
- ++ game.send_chat_target(client_id, "Welcome to zCatch!");
- ++ game.send_chat_target(client_id, "type /cmdlist to get all commands");
- ++ game.send_chat_target(client_id, "type /help for instructions");
- ++ }
- + }
- +
- + void mods_client_drop(int client_id)
- +@@ -195,7 +221,24 @@
- +
- + p->last_chat = time_get();
- +
- +- game.send_chat(client_id, team, msg->message);
- ++ if(!strcmp("/info", msg->message) || !strcmp("/about", msg->message))
- ++ game.send_chat_target(client_id, "zCatch v.0.2 by erd_baer. Type /help to learn how to play.");
- ++ else if(!strcmp("/cmdlist", msg->message))
- ++ {
- ++ game.send_chat_target(client_id, "/info or /about - see information about author");
- ++ game.send_chat_target(client_id, "/help - learn how to play");
- ++ }
- ++ else if(!strcmp("/help", msg->message))
- ++ {
- ++ game.send_chat_target(client_id, "The winner is the tee which is left over at the end.");
- ++ game.send_chat_target(client_id, "If you die, all players that you killed will respawn.");
- ++ game.send_chat_target(client_id, "So the only way to win is to kill every player without beeing killed.");
- ++ game.send_chat_target(client_id, "Have fun!");
- ++ }
- ++ else if(!strncmp("/", msg->message, 1))
- ++ game.send_chat_target(client_id, "Wrong command.");
- ++ else
- ++ game.send_chat(client_id, team, msg->message);
- + }
- + else if(msgtype == NETMSGTYPE_CL_CALLVOTE)
- + {
- +@@ -256,8 +299,7 @@
- + game.send_chat_target(client_id, "Invalid client id to kick");
- + return;
- + }
- +-
- +- str_format(chatmsg, sizeof(chatmsg), "Vote called to kick '%s'", server_clientname(kick_id));
- ++ str_format(chatmsg, sizeof(chatmsg), "%s called vote to kick '%s'", server_clientname(client_id), server_clientname(kick_id));
- + str_format(desc, sizeof(desc), "Kick '%s'", server_clientname(kick_id));
- + str_format(cmd, sizeof(cmd), "kick %d", kick_id);
- + if (!config.sv_vote_kick_bantime)
- +@@ -298,12 +340,35 @@
- + // Switch team on given client and kill/respawn him
- + if(game.controller->can_join_team(msg->team, client_id))
- + {
- +- if(game.controller->can_change_team(p, msg->team))
- ++ if(game.controller->can_change_team(p, msg->team) && !game.controller->is_zcatch())
- + {
- + p->last_setteam = time_get();
- + p->set_team(msg->team);
- + (void) game.controller->check_team_balance();
- + }
- ++ else if(game.controller->is_zcatch())
- ++ {
- ++ if(msg->team == -1)
- ++ {
- ++ p->last_setteam = time_get();
- ++ p->set_team(-1);
- ++ }
- ++ else if(p->catched_by == -1 || config.sv_allow_join)
- ++ {
- ++ p->last_setteam = time_get();
- ++ p->set_team(msg->team);
- ++ }
- ++ else if(p->catched_by == -2 && !config.sv_allow_join)
- ++ {
- ++ game.send_chat_target(client_id, "You will join automatically when the next round starts.");
- ++ }
- ++ else if(p->catched_by >= 0)
- ++ {
- ++ char buf[256];
- ++ str_format(buf, sizeof(buf), "You will join automatically when \"%s\" dies.", server_clientname(p->catched_by));
- ++ game.send_chat_target(client_id, buf);
- ++ }
- ++ }
- + else
- + game.send_broadcast("Teams must be balanced, please join other team", client_id);
- + }
- +@@ -537,6 +602,8 @@
- + game.controller = new GAMECONTROLLER_CTF;
- + else if(strcmp(config.sv_gametype, "tdm") == 0)
- + game.controller = new GAMECONTROLLER_TDM;
- ++ else if(strcmp(config.sv_gametype, "zcatch") == 0)
- ++ game.controller = new GAMECONTROLLER_ZCATCH;
- + else
- + game.controller = new GAMECONTROLLER_DM;
- +
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/player.cpp ./zcatch/src/game/server/player.cpp
- +--- ./teeworlds-0.5.2-src/src/game/server/player.cpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/server/player.cpp 2010-01-08 14:55:09.000000000 +0100
- +@@ -1,6 +1,7 @@
- + #include <new>
- +
- + #include <engine/e_server_interface.h>
- ++#include <engine/e_config.h>
- +
- + #include "player.hpp"
- + #include "gamecontext.hpp"
- +@@ -10,8 +11,10 @@
- + PLAYER::PLAYER(int client_id)
- + {
- + respawn_tick = server_tick();
- ++ teamchange_tick = server_tick() - config.sv_spec_delay * 50 - 1;
- + character = 0;
- + this->client_id = client_id;
- ++ catched_by = -1;
- + }
- +
- + PLAYER::~PLAYER()
- +@@ -22,8 +25,26 @@
- +
- + void PLAYER::tick()
- + {
- ++ int num = 0; int num_inactive = 0;
- + server_setclientscore(client_id, score);
- +
- ++ if(game.players[client_id]->teamchange_tick + config.sv_spec_delay * 50 == server_tick())
- ++ game.players[client_id]->team = -1;
- ++
- ++ for(int i=0; i<MAX_CLIENTS; i++)
- ++ {
- ++ if(game.players[i])
- ++ {
- ++ num++;
- ++ if(game.players[i]->team == -1)
- ++ num_inactive++;
- ++ }
- ++ }
- ++ if(num - num_inactive < 2)
- ++ {
- ++ game.controller->endround();
- ++ }
- ++
- + // do latency stuff
- + {
- + CLIENT_INFO info;
- +@@ -84,6 +105,17 @@
- +
- + if(client_id == snapping_client)
- + info->local = 1;
- ++
- ++ if(game.players[client_id] && game.controller->is_zcatch() && config.sv_color_indicator)
- ++ {
- ++ int num = 161;
- ++ for(int i=0; i<MAX_CLIENTS; i++)
- ++ if(game.players[i] && game.players[i]->catched_by == client_id)
- ++ num = num - 10;
- ++ client_info->color_body = num * 0x010000 + 0xff00;
- ++ client_info->color_feet = num * 0x010000 + 0xff00;
- ++ client_info->use_custom_color = 1;
- ++ }
- + }
- +
- + void PLAYER::on_disconnect()
- +@@ -97,6 +129,7 @@
- + game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
- +
- + dbg_msg("game", "leave player='%d:%s'", client_id, server_clientname(client_id));
- ++
- + }
- +
- + void PLAYER::on_predicted_input(NETOBJ_PLAYER_INPUT *new_input)
- +diff -Nur ./teeworlds-0.5.2-src/src/game/server/player.hpp ./zcatch/src/game/server/player.hpp
- +--- ./teeworlds-0.5.2-src/src/game/server/player.hpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/server/player.hpp 2010-01-07 21:10:15.000000000 +0100
- +@@ -28,6 +28,11 @@
- + int team;
- + int score;
- + bool force_balanced;
- ++
- ++ //
- ++ int catched_by;
- ++ int teamchange_tick;
- ++ int will_change_team;
- +
- + //
- + int vote;
- +diff -Nur ./teeworlds-0.5.2-src/src/game/variables.hpp ./zcatch/src/game/variables.hpp
- +--- ./teeworlds-0.5.2-src/src/game/variables.hpp 2009-10-26 19:04:31.000000000 +0100
- ++++ ./zcatch/src/game/variables.hpp 2010-01-08 14:45:36.000000000 +0100
- +@@ -64,6 +64,10 @@
- + MACRO_CONFIG_INT(sv_vote_kick_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time to ban a player if kicked by vote. 0 makes it just use kick")
- + MACRO_CONFIG_INT(sv_vote_scorelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change score limit")
- + MACRO_CONFIG_INT(sv_vote_timelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change time limit")
- ++MACRO_CONFIG_INT(sv_mode, 1, 0, 3, CFGFLAG_SERVER, "0 - normal; 1 - instagib; 2 - rocket area; 3 - Hammerparty")
- ++MACRO_CONFIG_INT(sv_allow_join, 0, 0, 1, CFGFLAG_SERVER, "Allow new players to join without waiting for the next round")
- ++MACRO_CONFIG_INT(sv_spec_delay, 2, 0, 5, CFGFLAG_SERVER, "How many seconds to wait until the player joins the spectators")
- ++MACRO_CONFIG_INT(sv_color_indicator, 0, 0, 1, CFGFLAG_SERVER, "Color tees apropriate to the number of currently catched players")
- +
- + /* debug */
- + #ifdef CONF_DEBUG /* this one can crash the server if not used correctly */
- +Bin�rdateien ./teeworlds-0.5.2-src/zcatch and ./zcatch/zcatch sind verschieden.
- Bin�rdateien ./teeworlds-0.5.2-src/zcatch.exe and ./zcatch/zcatch.exe sind verschieden.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement