Remove PyroType

pyro-refactor
immibis 2021-07-04 13:02:20 +02:00
parent e539228618
commit 1b384d0eec
19 changed files with 42 additions and 81 deletions

View File

@ -282,7 +282,6 @@ set(BASE_SOURCES
graphics/pyro/pyro.h
graphics/pyro/pyro_manager.cpp
graphics/pyro/pyro_manager.h
graphics/pyro/pyro_type.h
graphics/pyro/pyro_type_burn.cpp
graphics/pyro/pyro_type_dead.cpp
graphics/pyro/pyro_type_egg.cpp

View File

@ -45,10 +45,9 @@ namespace Gfx
{
CPyro::CPyro(PyroType type, CObject *obj)
CPyro::CPyro(CObject *obj)
{
m_object = obj;
m_type = type;
m_engine = CEngine::GetInstancePointer();
m_main = CRobotMain::GetInstancePointer();
m_terrain = m_main->GetTerrain();

View File

@ -29,8 +29,6 @@
#include "graphics/core/color.h"
#include "graphics/pyro/pyro_type.h"
#include "math/sphere.h"
#include "object/object_type.h"
@ -74,7 +72,7 @@ protected:
virtual void AfterEnd();
public:
CPyro(PyroType type, CObject *obj);
CPyro(CObject *obj);
virtual ~CPyro();
//! Indicates whether the pyrotechnic effect is complete
@ -120,7 +118,6 @@ protected:
Math::Vector m_pos; // center of the effect
Math::Vector m_posPower; // center of the battery
bool m_power = false; // battery exists?
PyroType m_type = PT_NULL;
float m_size = 0.0f;
float m_progress = 0.0f;
float m_speed = 0.0f;
@ -310,11 +307,31 @@ public:
void AfterEnd() override;
};
/**
* \enum FragExploOrShotPyroType
* \brief Type of CFragExploOrShotPyro
*/
enum FragExploOrShotPyroType
{
PT_FRAGT, //! < fragmentation of technical object
PT_FRAGO, //! < fragmentation of organic object
PT_FRAGW, //! < fragmentation of object under water
PT_EXPLOT, //! < explosion of technical object
PT_EXPLOO, //! < explosion of organic object
PT_EXPLOW, //! < explosion of object under water
PT_SHOTT, //! < hit technical object
PT_SHOTH, //! < hit human
PT_SHOTM, //! < hit queen
PT_SHOTW, //! < hit under water (TODO: check if unused)
};
class CFragExploOrShotPyro : public CPyro
{
float m_force;
FragExploOrShotPyroType m_type;
public:
CFragExploOrShotPyro(PyroType type, CObject *obj, float force = 1.0f);
CFragExploOrShotPyro(FragExploOrShotPyroType type, CObject *obj, float force = 1.0f);
void AfterCreate() override;
bool EventProcess(const Event& event) override;
void UpdateEffect() override;

View File

@ -24,8 +24,6 @@
#pragma once
#include "graphics/pyro/pyro_type.h"
#include <memory>
#include <set>

View File

@ -1,53 +0,0 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.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
*/
/**
* \file graphics/pyro/pyro_type.h
* \brief PyroType enum
*/
#pragma once
namespace Gfx
{
/**
* \enum PyroType
* \brief Type of pyro effect
*/
enum PyroType
{
PT_NULL = 0,
// CFragExploOrShotPyro
PT_FRAGT = 1, //! < fragmentation of technical object
PT_FRAGO = 2, //! < fragmentation of organic object
PT_FRAGW = 4, //! < fragmentation of object under water
PT_EXPLOT = 5, //! < explosion of technical object
PT_EXPLOO = 6, //! < explosion of organic object
PT_EXPLOW = 8, //! < explosion of object under water
PT_SHOTT = 9, //! < hit technical object
PT_SHOTH = 10, //! < hit human
PT_SHOTM = 11, //! < hit queen
PT_SHOTW = 12, //! < hit under water (TODO: check if unused)
PT_OTHER = 100, //! < No special type code; behaviour is decided by subclass
};
} // namespace Gfx

View File

@ -33,7 +33,7 @@
using namespace Gfx;
CBurnPyro::CBurnPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
, m_organicBurn(obj->GetType() == OBJECT_MOTHER ||
obj->GetType() == OBJECT_ANT ||
obj->GetType() == OBJECT_SPIDER ||

View File

@ -35,7 +35,7 @@ using namespace Gfx;
CDeadGPyro::CDeadGPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CDeadGPyro::AfterCreate()
@ -58,7 +58,7 @@ void CDeadGPyro::AfterCreate()
}
CDeadWPyro::CDeadWPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CDeadWPyro::AfterCreate()

View File

@ -28,7 +28,7 @@
using namespace Gfx;
CEggPyro::CEggPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
bool CEggPyro::EventProcess(const Event& event)

View File

@ -34,7 +34,7 @@
using namespace Gfx;
CFallPyro::CFallPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CFallPyro::AfterCreate()

View File

@ -30,7 +30,7 @@
using namespace Gfx;
CFindingPyro::CFindingPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CFindingPyro::AfterCreate()

View File

@ -30,7 +30,7 @@
using namespace Gfx;
CFlagCreatePyro::CFlagCreatePyro(CObject *pObj)
: CPyro(PT_OTHER, pObj)
: CPyro(pObj)
{}
void CFlagCreatePyro::AfterCreate()

View File

@ -30,7 +30,7 @@
using namespace Gfx;
CFlagDeletePyro::CFlagDeletePyro(CObject *pObj)
: CPyro(PT_OTHER, pObj)
: CPyro(pObj)
{}
void CFlagDeletePyro::AfterCreate()

View File

@ -32,9 +32,10 @@
using namespace Gfx;
CFragExploOrShotPyro::CFragExploOrShotPyro(PyroType type, CObject *obj, float force)
: CPyro(type, obj),
m_force(force)
CFragExploOrShotPyro::CFragExploOrShotPyro(FragExploOrShotPyroType type, CObject *obj, float force)
: CPyro(obj),
m_force(force),
m_type(type)
{}
void CFragExploOrShotPyro::AfterCreate()

View File

@ -29,7 +29,7 @@ using namespace Gfx;
CFragVPyro::CFragVPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
bool CFragVPyro::EventProcess(const Event& event)

View File

@ -27,7 +27,7 @@
using namespace Gfx;
CResetPyro::CResetPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CResetPyro::AfterCreate()

View File

@ -34,7 +34,7 @@
using namespace Gfx;
CSpiderPyro::CSpiderPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
bool CSpiderPyro::EventProcess(const Event& event)

View File

@ -27,7 +27,7 @@
using namespace Gfx;
CSquashPyro::CSquashPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CSquashPyro::AfterCreate()

View File

@ -29,7 +29,7 @@
using namespace Gfx;
CWaypointHitPyro::CWaypointHitPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CWaypointHitPyro::AfterCreate()

View File

@ -29,11 +29,11 @@
using namespace Gfx;
CWinPyro::CWinPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
CLostPyro::CLostPyro(CObject *obj)
: CPyro(PT_OTHER, obj)
: CPyro(obj)
{}
void CWinPyro::UpdateEffect()