[Orxonox-commit 6526] r11168 - in code/branches/tgidronFS16: data/levels data/levels/includes data/levels/templates data/overlays src/modules/hover src/modules/pickup
tgidron at orxonox.net
tgidron at orxonox.net
Thu Apr 14 16:05:48 CEST 2016
Author: tgidron
Date: 2016-04-14 16:05:48 +0200 (Thu, 14 Apr 2016)
New Revision: 11168
Added:
code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.cc
code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.h
Modified:
code/branches/tgidronFS16/data/levels/Hover.oxw
code/branches/tgidronFS16/data/levels/includes/weaponSettingsHover.oxi
code/branches/tgidronFS16/data/levels/templates/spaceshipHover.oxt
code/branches/tgidronFS16/data/overlays/HoverHUD.oxo
code/branches/tgidronFS16/src/modules/hover/CMakeLists.txt
code/branches/tgidronFS16/src/modules/hover/Hover.cc
code/branches/tgidronFS16/src/modules/hover/Hover.h
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h
code/branches/tgidronFS16/src/modules/pickup/PickupSpawner.h
Log:
Pickups + Flags HUD
Modified: code/branches/tgidronFS16/data/levels/Hover.oxw
===================================================================
--- code/branches/tgidronFS16/data/levels/Hover.oxw 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/data/levels/Hover.oxw 2016-04-14 14:05:48 UTC (rev 11168)
@@ -2,7 +2,7 @@
name = "Hover level"
description = "Level for Minigame Hover"
tags = "minigame"
- screenshot = "emptylevel.png"
+ screenshot = "Hover.png"
/>
<?lua
@@ -24,6 +24,11 @@
MAZE_SIZE = MAZE_NUM_CELLS*MAZE_CELL_SIZE
?>
+<?lua
+ include("templates/pickupRepresentationTemplates.oxt")
+ include("includes/pickups.oxi")
+ ?>
+
<Template name=destroyhoverpickupRepresentation>
<PickupRepresentation>
<spawner-representation>
@@ -40,6 +45,10 @@
</PickupRepresentation>
</Template>
+<Template name=destroymetapickup baseclass=MetaPickup>
+ <MetaPickup representation="destroy" metaType="destroy" />
+</Template>
+
<PickupRepresentation
name = "destroyhover"
pickupName = "Destroy Carrier Pickup"
@@ -73,6 +82,8 @@
numCells="<?lua print(MAZE_NUM_CELLS)?>"
cellSize="<?lua print(MAZE_CELL_SIZE)?>"
cellHeight="<?lua print(MAZE_CELL_HEIGHT)?>"
+ pickuptemplate=destroyhoverpickupRepresentation
+ pickupbase=destroymetapickup
/>
<Model
position="<?lua print(MAZE_SIZE/2)?>,-16,<?lua print(MAZE_SIZE/2)?>"
Modified: code/branches/tgidronFS16/data/levels/includes/weaponSettingsHover.oxi
===================================================================
--- code/branches/tgidronFS16/data/levels/includes/weaponSettingsHover.oxi 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/data/levels/includes/weaponSettingsHover.oxi 2016-04-14 14:05:48 UTC (rev 11168)
@@ -13,10 +13,10 @@
<DefaultWeaponmodeLink firemode=1 weaponmode=1 />
</links>
<Weapon>
- <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="LaserBeam2.mesh" />
+ <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1, 1,-18 " projectileMesh="LaserBeam2.mesh" />
</Weapon>
<Weapon>
- <IceGun mode=0 munitionpershot=0 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" />
+ <EnergyDrink mode=0 munitionpershot=0 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.8, 1, -18.0" projectileMesh="LaserBeam2.mesh" />
</Weapon>
</WeaponPack>
<WeaponPack>
@@ -26,5 +26,6 @@
</WeaponPack>
</weaponpacks>
<munition>
- <IceMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
+ <LaserMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
+ <FusionMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
</munition>
Modified: code/branches/tgidronFS16/data/levels/templates/spaceshipHover.oxt
===================================================================
--- code/branches/tgidronFS16/data/levels/templates/spaceshipHover.oxt 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/data/levels/templates/spaceshipHover.oxt 2016-04-14 14:05:48 UTC (rev 11168)
@@ -17,11 +17,11 @@
reloadrate = 2
reloadwaittime = 0.5
- primaryThrust = 100
+ primaryThrust = 200
auxilaryThrust = 1
- rotationThrust = 40
+ rotationThrust = 45
- jumpBoost = 120
+ jumpBoost = 110
lift = 1;
stallSpeed = 220;
Modified: code/branches/tgidronFS16/data/overlays/HoverHUD.oxo
===================================================================
--- code/branches/tgidronFS16/data/overlays/HoverHUD.oxo 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/data/overlays/HoverHUD.oxo 2016-04-14 14:05:48 UTC (rev 11168)
@@ -54,5 +54,36 @@
aimMarkerSize = 0.02
/>
+
+ <OverlayText
+ position = "0.02, 0.02"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ caption = "Total Flags: "
+ />
+
+ <TotalFlagsHUD
+ position = "0.14, 0.02"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+
+ showpoints = true
+ />
+
+
+ </OverlayGroup>
+
</OverlayGroup>
+
+
</Template>
+
+
+
+
Modified: code/branches/tgidronFS16/src/modules/hover/CMakeLists.txt
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/CMakeLists.txt 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/src/modules/hover/CMakeLists.txt 2016-04-14 14:05:48 UTC (rev 11168)
@@ -16,5 +16,6 @@
orxonox
objects
overlays
+ pickup
SOURCE_FILES ${Hover_SRC_FILES}
)
Modified: code/branches/tgidronFS16/src/modules/hover/Hover.cc
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/Hover.cc 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/src/modules/hover/Hover.cc 2016-04-14 14:05:48 UTC (rev 11168)
@@ -61,6 +61,8 @@
cellSize = 0;
cellHeight = 0;
+ totFlags = 0;
+
this->setHUDTemplate("HoverHUD");
}
@@ -114,15 +116,21 @@
}
- //Generate 10 Pickups randomly
- for (int i = 0; i<10; i++)
+ //Generate 5 PickupSpawners randomly
+ for (int i = 0; i<5; i++)
{
PickupSpawner* pickup = new PickupSpawner(origin_->getContext());
- //PickupSpawner(this->getContext());
- //pickup->createDroppedPickup(this->getContext(), pickup , this, 10);
+ pickup->setPosition(rand()%numCells, rand()%numCells, cellSize);
+ //pickup->setPickupTemplateName(origin_->getPickupMeta());
+ //pickup->setPickupTemplateName("destroymetapickup");
+ pickup->setMaxSpawnedItems(5);
+ pickup->setRespawnTime(30);
+ pickup->setTriggerDistance(5);
+ //pickup->createDroppedPickup(this->getContext(), pickup , this, 5);
pickups_.push_back(pickup);
}
+
}
}
@@ -137,6 +145,15 @@
flags_.push_back(flag);
}
+ //Generate 5 PickupSpawners randomly
+ for (int i = 0; i<5; i++)
+ {
+ PickupSpawner* pickup = new PickupSpawner(origin_->getContext());
+ //PickupSpawner->setPosition(rand()%numCells, rand()%numCells, cellSize);
+ //pickup->createDroppedPickup(this->getContext(), pickup , this, 5);
+ pickups_.push_back(pickup);
+ }
+
}
void Hover::tick(float dt)
@@ -149,6 +166,7 @@
if(flags_[i]->getCollided()){
flags_[i]->destroyLater();
flags_.erase (flags_.begin()+i);
+ totFlags++;
if(flags_.size()<=0){
ChatManager::message("Level Up!");
Modified: code/branches/tgidronFS16/src/modules/hover/Hover.h
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/Hover.h 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/src/modules/hover/Hover.h 2016-04-14 14:05:48 UTC (rev 11168)
@@ -78,6 +78,8 @@
int cellHeight;
int numCells;
+ int totFlags;
+
std::vector<PickupSpawner*> pickups_;
};
}
Modified: code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc 2016-04-14 14:05:48 UTC (rev 11168)
@@ -53,6 +53,8 @@
XMLPortParam(HoverOrigin, "numCells", setNumCells, getNumCells, xmlelement, mode);
XMLPortParam(HoverOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode);
XMLPortParam(HoverOrigin, "cellHeight", setCellHeight, getCellHeight, xmlelement, mode);
+ XMLPortParam(HoverOrigin, "pickuptemplate", setPickup, getPickup, xmlelement, mode);
+ XMLPortParam(HoverOrigin, "pickupbase", setPickupMeta, getPickupMeta, xmlelement, mode);
}
void HoverOrigin::checkGametype()
Modified: code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h 2016-04-14 14:05:48 UTC (rev 11168)
@@ -65,12 +65,24 @@
inline int getCellHeight() const
{ return this->cellHeight_; }
+ inline void setPickup(std::string pickuptemplate)
+ { this->pickupTemplate_ = pickuptemplate; }
+ inline std::string getPickup() const
+ { return this->pickupTemplate_; }
+
+ inline void setPickupMeta(std::string pickupbase)
+ { this->pickupMeta_ = pickupbase; }
+ inline std::string getPickupMeta() const
+ { return this->pickupMeta_; }
+
private:
void checkGametype();
int numCells_;
int cellSize_;
int cellHeight_;
+ std::string pickupTemplate_;
+ std::string pickupMeta_;
};
}
Added: code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.cc
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.cc (rev 0)
+++ code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.cc 2016-04-14 14:05:48 UTC (rev 11168)
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * Tomer Gidron
+ *
+ */
+
+#include "TotFlagsHUD.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ RegisterClass(TotFlagsHUD);
+
+ TotFlagsHUD::TotFlagsHUD(Context* context) : OverlayText(context)
+ {
+ RegisterObject(TotFlagsHUD);
+
+ this->hoverGame_ = nullptr;
+ this->totFlags_ = 0;
+ }
+
+ void TotFlagsHUD::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(TotFlagsHUD, XMLPort, xmlelement, mode);
+
+ XMLPortParam(TotFlagsHUD,"showPoints", setShowTot, getShowTot, xmlelement, mode);
+ }
+
+ void TotFlagsHUD::tick(float dt)
+ {
+ SUPER(TotFlagsHUD, tick, dt);
+
+ const std::string& points = multi_cast<std::string>(this->DodgeRaceGame->getPoints());
+ setTextSize(0.04);
+ setPosition(Vector2(0.14, 0.02));
+ this->setColour(ColourValue(1, 1, 1, 1));
+ this->setCaption(points);
+
+ }
+
+ void TotFlagsHUD::changedOwner()
+ {
+ SUPER(TotFlagsHUD, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->TotFlagsHUD = orxonox_cast<Hover*>(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->DodgeRaceGame = nullptr;
+ }
+ }
+}
Added: code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.h
===================================================================
--- code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.h (rev 0)
+++ code/branches/tgidronFS16/src/modules/hover/TotFlagsHUD.h 2016-04-14 14:05:48 UTC (rev 11168)
@@ -0,0 +1,61 @@
+/*
+ * 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:
+ * Cyrill Burgener
+ *
+ */
+
+ /**
+ @file TimeHUD.h
+ @brief Declaration of the TimeHUD class.
+*/
+
+#include "HoverPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _HoverExport TotFlagsHUD : public OverlayText, public Tickable
+ {
+ public:
+ TotFlagsHUD(Context* context);
+
+ virtual void tick(float dt) override;
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ virtual void changedOwner() override;
+
+ /// sets TOTAL flags taken
+ inline void setShowTot(int totFlags)
+ { this->totFlags_ = totFlags; }
+ /// returns total flags >=0
+ inline int getShowTot() const
+ { return this->totFlags_; }
+
+
+ private:
+ Hover* hoverGame_;
+ int totFlags_;
+ };
+}
+#endif /* _TimeHUD_H__ */
Modified: code/branches/tgidronFS16/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/branches/tgidronFS16/src/modules/pickup/PickupSpawner.h 2016-04-14 14:03:16 UTC (rev 11167)
+++ code/branches/tgidronFS16/src/modules/pickup/PickupSpawner.h 2016-04-14 14:05:48 UTC (rev 11168)
@@ -113,6 +113,26 @@
inline Template* getPickupTemplate() const
{return this->pickupTemplate_; }
+
+ void setPickupTemplateName(const std::string& name);
+ void setPickupTemplate(Template* temp);
+
+
+/**
+ @brief Set the distance in which to trigger.
+ @param value The new distance in which to trigger.
+ */
+ inline void setTriggerDistance(float value)
+ { this->triggerDistance_ = value; }
+ /**
+ @brief Set the time to respawn.
+ @param time New time after which this gets re-actived.
+ */
+ inline void setRespawnTime(float time)
+ { this->respawnTime_ = time; }
+
+ void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
+
private:
void initialize(void);
@@ -130,24 +150,10 @@
void block(PickupCarrier* carrier, unsigned int time = DEFAULT_BLOCKED_TIME)
{ this->blocked_.insert(std::pair<PickupCarrier*, std::time_t>(carrier, std::time(0)+time)); }
- /**
- @brief Set the distance in which to trigger.
- @param value The new distance in which to trigger.
- */
- inline void setTriggerDistance(float value)
- { this->triggerDistance_ = value; }
- /**
- @brief Set the time to respawn.
- @param time New time after which this gets re-actived.
- */
- inline void setRespawnTime(float time)
- { this->respawnTime_ = time; }
+
+
- void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
- void setPickupTemplateName(const std::string& name);
- void setPickupTemplate(Template* temp);
-
Pickupable* createPickup(void); //!< Creates a new Pickupable.
void setPickupable(Pickupable* pickup); //!< Sets a Pickupable for the PickupSpawner to spawn.
More information about the Orxonox-commit
mailing list