about summary refs log tree commit diff
path: root/src/game/client/components
diff options
context:
space:
mode:
authorChoupom <andycootlapin@hotmail.fr>2011-04-03 10:11:23 +0200
committeroy <Tom_Adams@web.de>2011-04-03 22:57:03 +0200
commit733f0b33905bcd8d2097a302c145707cf29ec0d7 (patch)
treef1c94e3528073eb6b1c0a9bebe32111751588284 /src/game/client/components
parent7a772f4e2053806286df42b2802f616cd4961441 (diff)
downloadzcatch-733f0b33905bcd8d2097a302c145707cf29ec0d7.tar.gz
zcatch-733f0b33905bcd8d2097a302c145707cf29ec0d7.zip
reimplemented extra projectiles
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/items.cpp27
-rw-r--r--src/game/client/components/items.h11
2 files changed, 31 insertions, 7 deletions
diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp
index 526c94d6..db0b8abd 100644
--- a/src/game/client/components/items.cpp
+++ b/src/game/client/components/items.cpp
@@ -15,6 +15,11 @@
 
 #include "items.h"
 
+void CItems::OnReset()
+{
+	ExtraProjectilesNum = 0;
+}
+
 void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
 {
 
@@ -302,15 +307,23 @@ void CItems::OnRender()
 	}
 
 	// render extra projectiles
-	/*
-	for(int i = 0; i < extraproj_num; i++)
+	for(int i = 0; i < ExtraProjectilesNum; i++)
 	{
-		if(extraproj_projectiles[i].start_tick < Client()->GameTick())
+		if(aExtraProjectiles[i].m_StartTick < Client()->GameTick())
 		{
-			extraproj_projectiles[i] = extraproj_projectiles[extraproj_num-1];
-			extraproj_num--;
+			aExtraProjectiles[i] = aExtraProjectiles[ExtraProjectilesNum-1];
+			ExtraProjectilesNum--;
 		}
 		else
-			render_projectile(&extraproj_projectiles[i], 0);
-	}*/
+			RenderProjectile(&aExtraProjectiles[i], 0);
+	}
+}
+
+void CItems::AddExtraProjectile(CNetObj_Projectile *pProj)
+{
+	if(ExtraProjectilesNum != MAX_EXTRA_PROJECTILES)
+	{
+		aExtraProjectiles[ExtraProjectilesNum] = *pProj;
+		ExtraProjectilesNum++;
+	}
 }
diff --git a/src/game/client/components/items.h b/src/game/client/components/items.h
index 17702394..c366b8d9 100644
--- a/src/game/client/components/items.h
+++ b/src/game/client/components/items.h
@@ -6,13 +6,24 @@
 
 class CItems : public CComponent
 {	
+	enum
+	{
+		MAX_EXTRA_PROJECTILES=32,
+	};
+	
+	CNetObj_Projectile aExtraProjectiles[MAX_EXTRA_PROJECTILES];
+	int ExtraProjectilesNum;
+	
 	void RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID);
 	void RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCurrent);
 	void RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent, const CNetObj_GameData *pPrevGameData, const CNetObj_GameData *pCurGameData);
 	void RenderLaser(const struct CNetObj_Laser *pCurrent);
 	
 public:
+	virtual void OnReset();
 	virtual void OnRender();
+	
+	void AddExtraProjectile(CNetObj_Projectile *pProj);
 };
 
 #endif