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. */
|
2010-10-29 21:28:15 +00:00
|
|
|
/*Based on rajh's, Redix's & Sushi Tee's, DDRace mod stuff and tweaked byt btd and GreYFoX@GTi with STL to fit our DDRace needs*/
|
2010-07-29 05:21:18 +00:00
|
|
|
#include <engine/server.h>
|
|
|
|
#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
|
|
|
|
2010-11-13 13:22:19 +00:00
|
|
|
CGameControllerDDRace::CGameControllerDDRace(class CGameContext *pGameServer) : IGameController(pGameServer), m_Teams(pGameServer)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2011-02-08 16:35:48 +00:00
|
|
|
m_pGameType = 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()
|
|
|
|
{
|
2010-10-07 13:22:03 +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()
|
|
|
|
{
|
2010-10-04 19:17:56 +00:00
|
|
|
if(!GameServer()->Collision()->Layers()->TeleLayer()) return;
|
|
|
|
int Width = GameServer()->Collision()->Layers()->TeleLayer()->m_Width;
|
|
|
|
int Height = GameServer()->Collision()->Layers()->TeleLayer()->m_Height;
|
2010-10-07 13:22:03 +00:00
|
|
|
|
2010-10-04 07:59:16 +00:00
|
|
|
for(int i = 0; i < Width*Height; i++)
|
2010-09-27 03:15:56 +00:00
|
|
|
{
|
2011-02-13 04:45:17 +00:00
|
|
|
if(GameServer()->Collision()->TeleLayer()[i].m_Number > 0
|
2010-10-04 18:37:39 +00:00
|
|
|
&& GameServer()->Collision()->TeleLayer()[i].m_Type == TILE_TELEOUT)
|
2010-09-27 03:15:56 +00:00
|
|
|
{
|
2011-02-13 04:45:17 +00:00
|
|
|
m_TeleOuts[GameServer()->Collision()->TeleLayer()[i].m_Number-1].push_back(vec2(i % GameServer()->Collision()->Layers()->TeleLayer()->m_Width*32+16,
|
2010-10-04 19:17:56 +00:00
|
|
|
i/GameServer()->Collision()->Layers()->TeleLayer()->m_Width*32+16));
|
2010-09-27 03:15:56 +00:00
|
|
|
}
|
2010-08-10 04:28:17 +00:00
|
|
|
}
|
2010-08-27 23:30:50 +00:00
|
|
|
}
|