Address comments on commit d7bc28a
parent
596bb49de0
commit
0c9cf51d81
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "graphics/engine/planet.h"
|
||||
|
||||
#include "common/event.h"
|
||||
|
||||
#include "graphics/core/device.h"
|
||||
|
||||
#include "graphics/engine/engine.h"
|
||||
|
@ -31,7 +33,7 @@ namespace Gfx
|
|||
|
||||
namespace
|
||||
{
|
||||
const int PLANET_PREALLOCATE_COUNT = 10;
|
||||
const int PLANET_PREALLOCATE_COUNT = 20;
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
|
@ -39,7 +41,6 @@ CPlanet::CPlanet(CEngine* engine)
|
|||
: m_engine(engine)
|
||||
{
|
||||
m_planets.reserve(PLANET_PREALLOCATE_COUNT);
|
||||
|
||||
}
|
||||
|
||||
CPlanet::~CPlanet()
|
||||
|
@ -143,17 +144,13 @@ void CPlanet::Draw()
|
|||
}
|
||||
}
|
||||
|
||||
void CPlanet::Create(int mode, Math::Point start, float dim, float speed,
|
||||
void CPlanet::Create(PlanetType type, Math::Point start, float dim, float speed,
|
||||
float dir, const std::string& name, Math::Point uv1, Math::Point uv2,
|
||||
bool transparent)
|
||||
{
|
||||
if (mode < 0) mode = 0;
|
||||
if (mode > 1) mode = 1;
|
||||
|
||||
Planet planet;
|
||||
|
||||
// TODO: refactor mode to planet type in interface
|
||||
planet.type = (mode == 0) ? PlanetType::Sky : PlanetType::OuterSpace;
|
||||
planet.type = type;
|
||||
planet.start = start;
|
||||
planet.angle = start;
|
||||
planet.dim = dim;
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/event.h"
|
||||
#include "graphics/engine/planet_type.h"
|
||||
|
||||
#include "math/point.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct Event;
|
||||
|
||||
// Graphics module namespace
|
||||
namespace Gfx
|
||||
|
@ -37,16 +38,6 @@ namespace Gfx
|
|||
|
||||
class CEngine;
|
||||
|
||||
/**
|
||||
* \enum PlanetType
|
||||
* \brief Type of planet which determines when it is displayed
|
||||
*/
|
||||
enum PlanetType
|
||||
{
|
||||
Sky, //!< normal planets, orbiting in the sky
|
||||
OuterSpace //!< only visible during spaceship flight
|
||||
};
|
||||
|
||||
/**
|
||||
* \class CPlanet
|
||||
* \brief Planet manager
|
||||
|
@ -66,7 +57,7 @@ public:
|
|||
//! Management of an event
|
||||
bool EventProcess(const Event &event);
|
||||
//! Creates a new planet
|
||||
void Create(int mode, Math::Point start, float dim, float speed, float dir,
|
||||
void Create(PlanetType type, Math::Point start, float dim, float speed, float dir,
|
||||
const std::string& name, Math::Point uv1, Math::Point uv2,
|
||||
bool transparent);
|
||||
//! Indicates if there is at least one planet
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* This file is part of the Colobot: Gold Edition source code
|
||||
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Gfx
|
||||
{
|
||||
|
||||
/**
|
||||
* \enum PlanetType
|
||||
* \brief Type of planet which determines when it is displayed
|
||||
*/
|
||||
enum PlanetType
|
||||
{
|
||||
Sky, //!< normal planets, orbiting in the sky
|
||||
OuterSpace //!< only visible during spaceship flight
|
||||
};
|
||||
|
||||
} // namespace Gfx
|
|
@ -895,6 +895,17 @@ MissionType CLevelParserParam::AsMissionType(MissionType def)
|
|||
return AsMissionType();
|
||||
}
|
||||
|
||||
Gfx::PlanetType CLevelParserParam::AsPlanetType()
|
||||
{
|
||||
Gfx::PlanetType planetType{};
|
||||
|
||||
if (m_value == "0")
|
||||
planetType = Gfx::PlanetType::Sky;
|
||||
else if (m_value == "1")
|
||||
planetType = Gfx::PlanetType::OuterSpace;
|
||||
|
||||
return planetType;
|
||||
}
|
||||
|
||||
void CLevelParserParam::ParseArray()
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "graphics/core/color.h"
|
||||
|
||||
#include "graphics/engine/camera.h"
|
||||
#include "graphics/engine/planet_type.h"
|
||||
#include "graphics/engine/pyro_type.h"
|
||||
#include "graphics/engine/water.h"
|
||||
|
||||
|
@ -88,6 +89,7 @@ public:
|
|||
Gfx::CameraType AsCameraType();
|
||||
MissionType AsMissionType();
|
||||
const CLevelParserParamVec& AsArray();
|
||||
Gfx::PlanetType AsPlanetType();
|
||||
//@}
|
||||
|
||||
//! Get value (returns default if not found, throws exception if unable to process)
|
||||
|
|
|
@ -3152,7 +3152,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
ppos = line->GetParam("pos")->AsPoint();
|
||||
uv1 = line->GetParam("uv1")->AsPoint();
|
||||
uv2 = line->GetParam("uv2")->AsPoint();
|
||||
m_planet->Create(line->GetParam("mode")->AsInt(0),
|
||||
m_planet->Create(line->GetParam("mode")->AsPlanetType(),
|
||||
Math::Point(ppos.x, ppos.z),
|
||||
line->GetParam("dim")->AsFloat(0.2f),
|
||||
line->GetParam("speed")->AsFloat(0.0f),
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the Colobot: Gold Edition source code
|
||||
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#include "sound/oalsound/check.h"
|
||||
|
||||
namespace
|
||||
|
|
Loading…
Reference in New Issue