--
-- SampleMod16xMap
--
-- @author  Stefan Geiger
-- @date  06/08/12
-- @ edit   sandgroper
-- @date  04/04/2013
--
-- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.

SampleMod16xMap = {}

local SampleMod16xMap_mt = Class(SampleMod16xMap, Mission00);


function SampleMod16xMap:new(baseDirectory, customMt)
    local mt = customMt;
    if mt == nil then
        mt = SampleMod16xMap_mt;
    end;
    local self = SampleMod16xMap:superClass():new(baseDirectory, mt);

--    self.playerStartX = 0;
--    self.playerStartY = 0.1;
--    self.playerStartZ = 0;
--    self.playerRotX = 0;
--    self.playerRotY = Utils.degToRad(90);

    return self;
end;

function SampleMod16xMap:delete()
    SampleMod16xMap:superClass().delete(self);
end;

function SampleMod16xMap:load()
    self:startLoadingTask();

    self.environment = Environment:new(Utils.getFilename("sky/sky_day_night.i3d", self.baseDirectory), true, 8, true, true);

    self.helpIconsBase = nil;
    self.collectableHorseshoesObject = nil;
    self.fieldDefinitionBase = nil;
    self.vehicleShopBase = nil;

    self:loadMap(Utils.getFilename("map01.i3d", self.baseDirectory), true, self.loadMap01Finished, self);
end;

function SampleMod16xMap:loadMap01Finished(node, arguments)

-- own all fields 
	self:playerOwnsAllFields();

    self:loadMapXMLFile(Utils.getFilename("SampleMod16xMap.xml", self.baseDirectory));

    self.missionPDA:loadMap(Utils.getFilename("pda_map.png", self.baseDirectory), 8192, 8192);

    g_inGameMenu:setMapViewsMap(Utils.getFilename("pda_map.png", self.baseDirectory), 8192, 8192);

    local iconSize = self.missionPDA.pdaMapWidth / 15;

    -- ATMs
--    self.missionPDA:createMapHotspot("Bank", Utils.getFilename("$dataS2/missions/hud_pda_spot_bank.png", self.baseDirectory), 1024 - 230, 1024 + 439.5, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Bank", Utils.getFilename("$dataS2/missions/hud_pda_spot_bank.png", self.baseDirectory), 1024 - 144.65, 1024 - 352.25, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Bank", Utils.getFilename("$dataS2/missions/hud_pda_spot_bank.png", self.baseDirectory), 1024 + 513.75, 1024 + 202, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Bank", Utils.getFilename("$dataS2/missions/hud_pda_spot_bank.png", self.baseDirectory), 1024 + 723.9, 1024 + 608.25, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Bank", Utils.getFilename("$dataS2/missions/hud_pda_spot_bank.png", self.baseDirectory), 1024 - 162, 1024 - 679.51, iconSize, iconSize * (4 / 3), false, false, false, 0, true);

    -- Vehicle Shop
--    self.missionPDA:createMapHotspot("Shop", Utils.getFilename("$dataS2/missions/hud_pda_spot_shop.png", self.baseDirectory), 1024 - 130, 1024 - 383, iconSize, iconSize * (4 / 3), false, false, false, 0, true);

    -- Phone Booths
--    self.missionPDA:createMapHotspot("Phone", Utils.getFilename("$dataS2/missions/hud_pda_spot_phone.png", self.baseDirectory), 1024 + 89.6, 1024 - 417.9, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Phone", Utils.getFilename("$dataS2/missions/hud_pda_spot_phone.png", self.baseDirectory), 1024 - 603.4, 1024 - 834, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Phone", Utils.getFilename("$dataS2/missions/hud_pda_spot_phone.png", self.baseDirectory), 1024 - 94, 1024 + 20.1, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Phone", Utils.getFilename("$dataS2/missions/hud_pda_spot_phone.png", self.baseDirectory), 1024 - 560, 1024 - 7.5, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Phone", Utils.getFilename("$dataS2/missions/hud_pda_spot_phone.png", self.baseDirectory), 1024 - 172.25, 1024 - 678.9, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--    self.missionPDA:createMapHotspot("Phone", Utils.getFilename("$dataS2/missions/hud_pda_spot_phone.png", self.baseDirectory), 1024 + 241.1, 1024 + 438, iconSize, iconSize * (4 / 3), false, false, false, 0, true);

    -- farm silos
     self.missionPDA:createMapHotspot("TipPlace", Utils.getFilename("$dataS2/missions/hud_pda_spot_tipPlace.png", self.baseDirectory), 43, -128, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
    -- bga
--    self.missionPDA:createMapHotspot("TipPlace", Utils.getFilename("$dataS2/missions/hud_pda_spot_tipPlace.png", self.baseDirectory), 1024 + 395.1, 1024 - 693.7, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
    
    -- Grass Heaps
--   self.missionPDA:createMapHotspot("TipPlace", Utils.getFilename("$dataS2/missions/hud_pda_spot_tipPlaceGreen.png", self.baseDirectory), 1024 + 888.8 , 1024 + 569.6, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--   self.missionPDA:createMapHotspot("TipPlace", Utils.getFilename("$dataS2/missions/hud_pda_spot_tipPlaceGreen.png", self.baseDirectory), 1024 + 753.5 , 1024 + 864.9, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--   self.missionPDA:createMapHotspot("TipPlace", Utils.getFilename("$dataS2/missions/hud_pda_spot_tipPlaceGreen.png", self.baseDirectory), 1024 + 640.4 , 1024 + 787.2, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
--  self.missionPDA:createMapHotspot("TipPlace", Utils.getFilename("$dataS2/missions/hud_pda_spot_tipPlaceGreen.png", self.baseDirectory), 1024 + 692.7 , 1024 - 842.7, iconSize, iconSize * (4 / 3), false, false, false, 0, true);

    -- livestock
    self.missionPDA:createMapHotspot("Cows", Utils.getFilename("$dataS2/missions/hud_pda_spot_cows.png", self.baseDirectory), 256, 655, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
    self.missionPDA:createMapHotspot("Sheep", Utils.getFilename("$dataS2/missions/hud_pda_spot_sheep.png", self.baseDirectory), - 600, 585, iconSize, iconSize * (4 / 3), false, false, false, 0, true);
    self.missionPDA:createMapHotspot("Chickens", Utils.getFilename("$dataS2/missions/hud_pda_spot_chickens.png", self.baseDirectory), - 12, - 93, iconSize, iconSize * (4 / 3), false, false, false, 0, true);

    SampleMod16xMap:superClass().load(self);

    if not self.missionDynamicInfo.isMultiplayer then
        self:updateFoundHorseshoes();
        self:updateFoundHelpIcons();
        self:updateMeteoriteCrash();
        self:updateRainbow();
    else
        self:removeAllHorseshoes();
        self:removeAllHelpIcons();
    end;

    if g_isGamescomVersion then
        self:playerOwnsAllFields();
    end;

    self:finishLoadingTask();
end;

function SampleMod16xMap:onStartMission()
    SampleMod16xMap:superClass().onStartMission(self);
end;

function SampleMod16xMap:mouseEvent(posX, posY, isDown, isUp, button)
    SampleMod16xMap:superClass().mouseEvent(self, posX, posY, isDown, isUp, button);
end;

function SampleMod16xMap:keyEvent(unicode, sym, modifier, isDown)
    SampleMod16xMap:superClass().keyEvent(self, unicode, sym, modifier, isDown);
end;

function SampleMod16xMap:update(dt)
    SampleMod16xMap:superClass().update(self, dt);
end;

function SampleMod16xMap:draw()
    SampleMod16xMap:superClass().draw(self);
end;