/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */ /* Based on Race mod stuff and tweaked by GreYFoX@GTi and others to fit our DDRace needs. */ #include #include #include #include #include #include "DDRace.h" #include "gamemode.h" CGameControllerDDRace::CGameControllerDDRace(class CGameContext *pGameServer) : IGameController(pGameServer), m_Teams(pGameServer) { m_pGameType = GAME_NAME; InitTeleporter(); } CGameControllerDDRace::~CGameControllerDDRace() { // Nothing to clean } void CGameControllerDDRace::Tick() { IGameController::Tick(); } void CGameControllerDDRace::InitTeleporter() { if (!GameServer()->Collision()->Layers()->TeleLayer()) return; int Width = GameServer()->Collision()->Layers()->TeleLayer()->m_Width; int Height = GameServer()->Collision()->Layers()->TeleLayer()->m_Height; for (int i = 0; i < Width * Height; i++) { if (GameServer()->Collision()->TeleLayer()[i].m_Number > 0) { if (GameServer()->Collision()->TeleLayer()[i].m_Type == TILE_TELEOUT) { m_TeleOuts[GameServer()->Collision()->TeleLayer()[i].m_Number - 1].push_back( vec2(i % Width * 32 + 16, i / Width * 32 + 16)); } else if (GameServer()->Collision()->TeleLayer()[i].m_Type == TILE_TELECHECKOUT) { m_TeleCheckOuts[GameServer()->Collision()->TeleLayer()[i].m_Number - 1].push_back( vec2(i % Width * 32 + 16, i / Width * 32 + 16)); } } } }