/* Copyright (c) 2002-2012 Croteam Ltd. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation 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. */ /* * 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)<