2011-02-02 10:49:19 +00:00
|
|
|
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
2011-12-25 13:33:05 +00:00
|
|
|
/* Based on Race mod stuff and tweaked by GreYFoX@GTi and others to fit our DDRace needs. */
|
2010-07-29 05:21:18 +00:00
|
|
|
#include <engine/server.h>
|
2013-07-22 22:15:50 +00:00
|
|
|
#include <engine/shared/config.h>
|
2010-07-29 05:21:18 +00:00
|
|
|
#include <game/mapitems.h>
|
|
|
|
#include <game/server/entities/character.h>
|
|
|
|
#include <game/server/player.h>
|
|
|
|
#include <game/server/gamecontext.h>
|
2010-07-29 14:53:25 +00:00
|
|
|
#include "DDRace.h"
|
2011-02-08 16:35:48 +00:00
|
|
|
#include "gamemode.h"
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
CGameControllerDDRace::CGameControllerDDRace(class CGameContext *pGameServer) :
|
|
|
|
IGameController(pGameServer), m_Teams(pGameServer)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2013-07-31 17:08:07 +00:00
|
|
|
m_pGameType = g_Config.m_SvTestingCommands ? TEST_NAME : GAME_NAME;
|
2010-09-06 11:37:20 +00:00
|
|
|
|
2010-08-10 04:28:17 +00:00
|
|
|
InitTeleporter();
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
|
|
|
|
2010-08-10 04:28:17 +00:00
|
|
|
CGameControllerDDRace::~CGameControllerDDRace()
|
|
|
|
{
|
2011-08-13 00:11:06 +00:00
|
|
|
// Nothing to clean
|
2010-08-10 04:28:17 +00:00
|
|
|
}
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2010-07-29 14:53:25 +00:00
|
|
|
void CGameControllerDDRace::Tick()
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
|
|
|
IGameController::Tick();
|
|
|
|
}
|
2010-08-10 04:28:17 +00:00
|
|
|
|
|
|
|
void CGameControllerDDRace::InitTeleporter()
|
|
|
|
{
|
2011-12-25 13:51:04 +00:00
|
|
|
if (!GameServer()->Collision()->Layers()->TeleLayer())
|
|
|
|
return;
|
2010-10-04 19:17:56 +00:00
|
|
|
int Width = GameServer()->Collision()->Layers()->TeleLayer()->m_Width;
|
|
|
|
int Height = GameServer()->Collision()->Layers()->TeleLayer()->m_Height;
|
2010-10-07 13:22:03 +00:00
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
for (int i = 0; i < Width * Height; i++)
|
2010-09-27 03:15:56 +00:00
|
|
|
{
|
2017-06-02 17:44:01 +00:00
|
|
|
int Number = GameServer()->Collision()->TeleLayer()[i].m_Number;
|
|
|
|
int Type = GameServer()->Collision()->TeleLayer()[i].m_Type;
|
|
|
|
if (Number > 0)
|
2010-09-27 03:15:56 +00:00
|
|
|
{
|
2017-06-02 17:44:01 +00:00
|
|
|
if (Type == TILE_TELEOUT)
|
2011-05-17 23:12:39 +00:00
|
|
|
{
|
2017-06-02 17:44:01 +00:00
|
|
|
m_TeleOuts[Number - 1].push_back(
|
2011-12-25 13:51:04 +00:00
|
|
|
vec2(i % Width * 32 + 16, i / Width * 32 + 16));
|
2011-05-17 23:12:39 +00:00
|
|
|
}
|
2017-06-02 17:44:01 +00:00
|
|
|
else if (Type == TILE_TELECHECKOUT)
|
2011-05-17 23:12:39 +00:00
|
|
|
{
|
2017-06-02 17:44:01 +00:00
|
|
|
m_TeleCheckOuts[Number - 1].push_back(
|
2011-12-25 13:51:04 +00:00
|
|
|
vec2(i % Width * 32 + 16, i / Width * 32 + 16));
|
2011-05-17 23:12:39 +00:00
|
|
|
}
|
2010-09-27 03:15:56 +00:00
|
|
|
}
|
2010-08-10 04:28:17 +00:00
|
|
|
}
|
2010-08-27 23:30:50 +00:00
|
|
|
}
|