/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ /* * Player entity. */ 4 %{ #include "StdH.h" #include #include #include %} class export CPlayerEntity : CMovableModelEntity { name "PlayerEntity"; thumbnail ""; features "AbstractBaseClass"; properties: 1 FLOAT en_tmPing = 0.0f, // ping value in seconds (determined by derived class and distributed by the engine) { CPlayerCharacter en_pcCharacter; // character of the player CPlacement3D en_plViewpoint; // placement of view point relative to the entity CPlacement3D en_plLastViewpoint; // last view point (used for lerping) } components: functions: /* Get name of this player. */ export CTString GetPlayerName(void) { return en_pcCharacter.GetNameForPrinting(); } export const CTString &GetName(void) const { return en_pcCharacter.GetName(); } /* Get index of this player in the game. */ export INDEX GetMyPlayerIndex(void) { CEntity *penMe = this; if (IsPredictor()) { penMe = GetPredicted(); } for (INDEX iPlayer=0; iPlayeren_pcCharacter; en_plViewpoint = ppenOther->en_plViewpoint; en_plLastViewpoint = ppenOther->en_plLastViewpoint; } /* Copy entity from another entity of same class. */ /*CPlayerEntity &operator=(CPlayerEntity &enOther) { CMovableModelEntity::operator=(enOther); en_pcCharacter = enOther.en_pcCharacter; en_plViewpoint = enOther.en_plViewpoint; return *this; }*/ /* Read from stream. */ export void Read_t( CTStream *istr) // throw char * { CMovableModelEntity::Read_t(istr); (*istr)>>en_pcCharacter>>en_plViewpoint; en_plLastViewpoint = en_plViewpoint; } /* Write to stream. */ export void Write_t( CTStream *ostr) // throw char * { CMovableModelEntity::Write_t(ostr); (*ostr)<