[Orxonox-commit 6094] r10752 - in code/branches/explosionChunksHS15: data/levels data/levels/templates src/orxonox/worldentities src/orxonox/worldentities/pawns
vaydin at orxonox.net
vaydin at orxonox.net
Mon Nov 2 15:23:04 CET 2015
Author: vaydin
Date: 2015-11-02 15:23:03 +0100 (Mon, 02 Nov 2015)
New Revision: 10752
Added:
code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.cc
code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.h
Modified:
code/branches/explosionChunksHS15/data/levels/emptyLevel.oxw
code/branches/explosionChunksHS15/data/levels/templates/spaceshipEscort.oxt
code/branches/explosionChunksHS15/src/orxonox/worldentities/CMakeLists.txt
code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.h
code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/SpaceShip.cc
Log:
Deleted previously created VaydinExplosion class, created ExplosionPart class
Modified: code/branches/explosionChunksHS15/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/explosionChunksHS15/data/levels/emptyLevel.oxw 2015-11-02 14:19:00 UTC (rev 10751)
+++ code/branches/explosionChunksHS15/data/levels/emptyLevel.oxw 2015-11-02 14:23:03 UTC (rev 10752)
@@ -37,7 +37,9 @@
>
<templates>
<Template link=spaceshipassff />
- </templates>
+ </templates>
+
+
</SpaceShip>
<SpaceShip
team = "1"
@@ -46,6 +48,13 @@
<templates>
<Template link=spaceshipassff />
</templates>
+ <explosion>
+
+ <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
+ <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
+
+ </explosion>
+
</SpaceShip>
<SpaceShip
team = "1"
@@ -54,6 +63,13 @@
<templates>
<Template link=spaceshipassff />
</templates>
+ <explosion>
+
+ <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
+ <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
+
+ </explosion>
+
</SpaceShip>
</Scene>
Modified: code/branches/explosionChunksHS15/data/levels/templates/spaceshipEscort.oxt
===================================================================
--- code/branches/explosionChunksHS15/data/levels/templates/spaceshipEscort.oxt 2015-11-02 14:19:00 UTC (rev 10751)
+++ code/branches/explosionChunksHS15/data/levels/templates/spaceshipEscort.oxt 2015-11-02 14:23:03 UTC (rev 10752)
@@ -4,7 +4,7 @@
camerapositiontemplate = spaceshipescortcameras
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
- explosionchunks = 40
+ explosionchunks = 10
health = 80
maxhealth = 200
Modified: code/branches/explosionChunksHS15/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/explosionChunksHS15/src/orxonox/worldentities/CMakeLists.txt 2015-11-02 14:19:00 UTC (rev 10751)
+++ code/branches/explosionChunksHS15/src/orxonox/worldentities/CMakeLists.txt 2015-11-02 14:23:03 UTC (rev 10752)
@@ -11,7 +11,7 @@
CameraPosition.cc
SpawnPoint.cc
TeamSpawnPoint.cc
- VaydinExplosion.cc
+ ExplosionPart.cc
)
ADD_SUBDIRECTORY(pawns)
Added: code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.cc
===================================================================
--- code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.cc (rev 0)
+++ code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.cc 2015-11-02 14:23:03 UTC (rev 10752)
@@ -0,0 +1,112 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Vedat Aydin
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#include "ExplosionPart.h"
+#include "core/XMLPort.h"
+
+
+namespace orxonox
+{
+
+ RegisterClass(ExplosionPart);
+
+ ExplosionPart::ExplosionPart(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(ExplosionPart);
+ this->bStop_ = false;
+ this->LOD_ = LODParticle::Normal;
+ this->mesh_ = "";
+ this->effect_ = "";
+ this->model_= new Model(this->getContext());
+ this->particleInterface_= NULL;
+ this->explosionEntity_ = new MovableEntity(this->getContext());
+
+ }
+
+
+ void ExplosionPart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ExplosionPart, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ExplosionPart, "mesh", setMesh, getMesh, xmlelement, mode);
+ XMLPortParam(ExplosionPart, "effect", setEffect, getEffect, xmlelement, mode);
+
+
+ }
+
+
+ void ExplosionPart::Explode()
+ {
+ orxout() << "Explode" << endl;
+
+ orxout() << getMesh() << endl;
+ orxout() << getEffect() << endl;
+
+ this->explosionEntity_->setSyncMode(0);
+
+ this->model_->setSyncMode(0);
+
+ this->particleInterface_ = new ParticleInterface(this->getScene()->getSceneManager(), effect_, this->LOD_);
+
+ this->model_->attachOgreObject(this->particleInterface_->getParticleSystem());
+
+ this->model_->setMeshSource(mesh_);
+
+ this->explosionEntity_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
+ this->explosionEntity_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
+ this->explosionEntity_->setScale(4);
+
+ this->explosionEntity_->attach(model_);
+
+ this->attach(explosionEntity_);
+
+ }
+
+
+
+
+ void ExplosionPart::setMesh(const std::string& newString)
+ {
+ this->mesh_ = newString;
+ orxout() << newString << endl;
+ }
+
+ void ExplosionPart::setEffect(const std::string& newString)
+ {
+ this->effect_ = newString;
+ }
+
+ std::string& ExplosionPart::getMesh()
+ { return this->mesh_; }
+
+ std::string& ExplosionPart::getEffect()
+ { return this->effect_; }
+
+
+}
\ No newline at end of file
Added: code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.h
===================================================================
--- code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.h (rev 0)
+++ code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.h 2015-11-02 14:23:03 UTC (rev 10752)
@@ -0,0 +1,79 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Vedat Aydin
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ExplosionPart_H__
+#define _ExplosionPart_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "graphics/Model.h"
+#include "tools/ParticleInterface.h"
+#include "MovableEntity.h"
+#include "graphics/ParticleSpawner.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "util/Exception.h"
+#include "core/command/Executor.h"
+#include "Scene.h"
+
+
+ namespace orxonox
+{
+ class _OrxonoxExport ExplosionPart : public MovableEntity
+ {
+ public:
+ ExplosionPart(Context* context);
+ void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void Explode();
+
+ void setMesh(const std::string& newString);
+ std::string& getMesh();
+ void setEffect(const std::string& newString);
+ std::string& getEffect();
+
+
+ private:
+
+ bool bStop_;
+ LODParticle::Value LOD_;
+
+
+ Model* model_;
+ ParticleInterface* particleInterface_;
+
+ std::string mesh_;
+ std::string effect_;
+
+ MovableEntity* explosionEntity_;
+
+
+
+ };
+}
+
+#endif /* _ExplosionPart_H__ */
\ No newline at end of file
Modified: code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.cc 2015-11-02 14:19:00 UTC (rev 10751)
+++ code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.cc 2015-11-02 14:23:03 UTC (rev 10752)
@@ -41,7 +41,7 @@
#include "graphics/ParticleSpawner.h"
#include "worldentities/ExplosionChunk.h"
#include "worldentities/BigExplosion.h"
-//#include "worldentities/VaydinExplosion.h"
+#include "worldentities/ExplosionPart.h"
#include "weaponsystem/WeaponSystem.h"
#include "weaponsystem/WeaponSlot.h"
#include "weaponsystem/WeaponPack.h"
@@ -85,6 +85,8 @@
this->aimPosition_ = Vector3::ZERO;
+ //this->explosionPartList_ = NULL;
+
if (GameMode::isMaster())
{
this->weaponSystem_ = new WeaponSystem(this->getContext());
@@ -143,7 +145,7 @@
XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
- //XMLPortObject(Pawn, VaydinExplosion, "vaydinexplosion", addVaydinExplosion, getVaydinExplosion, xmlelement, mode);
+ XMLPortObject(Pawn, ExplosionPart, "explosion", addExplosionPart, getExplosionPart, xmlelement, mode);
XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
@@ -384,10 +386,19 @@
this->bAlive_ = false;
this->setDestroyWhenPlayerLeft(false);
- BigExplosion* chunk = new BigExplosion(this->getContext());
+ /*ExplosionPart* chunk = new ExplosionPart(this->getContext());
chunk->setPosition(this->getPosition());
chunk->setVelocity(this->getVelocity());
+ chunk->Explode();*/
+ while(!explosionPartList_.empty())
+ {
+ explosionPartList_.back()->setPosition(this->getPosition());
+ explosionPartList_.back()->setVelocity(this->getVelocity());
+ explosionPartList_.back()->Explode();
+ explosionPartList_.pop_back();
+ }
+
this->explosionSound_->setPosition(this->getPosition());
this->explosionSound_->play();
}
@@ -497,6 +508,16 @@
this->spawneffect();
}
+
+ void Pawn::addExplosionPart(ExplosionPart* ePart)
+ {this->explosionPartList_.push_back(ePart);}
+
+
+ ExplosionPart * Pawn::getExplosionPart()
+ {return this->explosionPartList_.back();}
+
+
+
/* WeaponSystem:
* functions load Slot, Set, Pack from XML and make sure all parent-pointers are set.
* with setWeaponPack you can not just load a Pack from XML but if a Pack already exists anywhere, you can attach it.
Modified: code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.h 2015-11-02 14:19:00 UTC (rev 10751)
+++ code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.h 2015-11-02 14:23:03 UTC (rev 10752)
@@ -32,9 +32,11 @@
#include "OrxonoxPrereqs.h"
#include <string>
+#include <vector>
#include "interfaces/PickupCarrier.h"
#include "interfaces/RadarViewable.h"
#include "worldentities/ControllableEntity.h"
+#include "worldentities/ExplosionPart.h"
namespace orxonox // tolua_export
@@ -146,6 +148,9 @@
virtual void reload();
virtual void postSpawn();
+ void addExplosionPart(ExplosionPart* ePart);
+ ExplosionPart * getExplosionPart();
+
void addWeaponSlot(WeaponSlot * wSlot);
WeaponSlot * getWeaponSlot(unsigned int index) const;
void addWeaponSet(WeaponSet * wSet);
@@ -240,6 +245,8 @@
float spawnparticleduration_;
unsigned int numexplosionchunks_;
+ std::vector<ExplosionPart*> explosionPartList_;
+
private:
void registerVariables();
inline void setWeaponSystem(WeaponSystem* weaponsystem)
Modified: code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/SpaceShip.cc 2015-11-02 14:19:00 UTC (rev 10751)
+++ code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/SpaceShip.cc 2015-11-02 14:23:03 UTC (rev 10752)
@@ -114,6 +114,8 @@
XMLPortParamVariable(SpaceShip, "stallSpeed", stallSpeed_, xmlelement, mode);
XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode);
+
+
}
void SpaceShip::registerVariables()
More information about the Orxonox-commit
mailing list