Ich arbeite grad an einem "LaserBeam"-Firemode. Allerdings habe ich das problem das er nicht geht.
Source:
LaserBeam.h
Code:
#ifndef __LASERBEAM_H__
#define __LASERBEAM_H__
#if _MSC_VER > 1000
# pragma once
#endif
#include "Beam.h"
class CLaserBeam :
public CBeam
{
public:
/*typedef struct SLaserBeamParams
{
SLaserBeamParams() { Reset(); };
void Reset(const IItemParamsNode *params=0, bool defaultInit=true)
{
CItemParamReader reader(params);
//ResetValue(freeze_speed, 0.f);
};
void GetMemoryStatistics(ICrySizer * s)
{
//s->Add(freeze_speed);
}
//float freeze_speed;
} SLaserBeamParams;*/
CLaserBeam();
virtual ~CLaserBeam();
virtual void ResetParams(const struct IItemParamsNode *params);
virtual void PatchParams(const struct IItemParamsNode *patch);
virtual void Hit(ray_hit &hit, const Vec3 &dir);
virtual void Tick(ray_hit &hit, const Vec3 &dir);
virtual void GetMemoryStatistics(ICrySizer * s);
protected:
//SLaserBeamParams m_freezeparams;
};
#endif //__LASERBEAM_H__
LaserBeam.cpp
Code:
#include "StdAfx.h"
#include "LaserBeam.h"
#include "Game.h"
#include "GameRules.h"
#include "WeaponSystem.h"
//------------------------------------------------------------------------
CLaserBeam::CLaserBeam()
{
}
//------------------------------------------------------------------------
CLaserBeam::~CLaserBeam()
{
}
//------------------------------------------------------------------------
void CLaserBeam::ResetParams(const struct IItemParamsNode *params)
{
CBeam::ResetParams(params);
}
//------------------------------------------------------------------------
void CLaserBeam::PatchParams(const struct IItemParamsNode *patch)
{
CBeam::PatchParams(patch);
}
//------------------------------------------------------------------------
void CLaserBeam::Hit(ray_hit &hit, const Vec3 &dir)
{
if (gEnv->bMultiplayer)
if (CActor *pActor=m_pWeapon->GetOwnerActor())
if (pActor && !pActor->IsClient())
return;
/*
IEntity *pEntity = gEnv->pEntitySystem->GetEntityFromPhysics(hit.pCollider);
float frost = m_freezeparams.freeze_speed>0.0f?m_freezeparams.freeze_speed*m_beamparams.tick:1.0f;
int type=hit.pCollider->GetType();
if (pEntity && (type==PE_RIGID || type==PE_ARTICULATED || type==PE_LIVING || type==PE_WHEELEDVEHICLE ||
(type==PE_STATIC && g_pGame->GetWeaponSystem()->GetProjectile(pEntity->GetId())))) // static projectiles are allowed to be frozen
{
SimpleHitInfo info(m_pWeapon->GetOwnerId(), pEntity->GetId(), m_pWeapon->GetEntityId(), 0xe);
info.value=frost;
g_pGame->GetGameRules()->ClientSimpleHit(info);
}
*/
}
//------------------------------------------------------------------------
void CLaserBeam::Tick(ray_hit &hit, const Vec3 &dir)
{
}
//------------------------------------------------------------------------
void CLaserBeam::GetMemoryStatistics(ICrySizer * s)
{
s->Add(*this);
CBeam::GetMemoryStatistics(s);
// m_freezeparams.GetMemoryStatistics(s);
}
In weaponsystem.cpp hab ich es so implementiert
Code:
RegisterFireMode("LaserBeam", &CreateIt<CLaserBeam, IFireMode>);
Kann mir da jemand helfen?