/* 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. */ 704 %{ #include "StdH.h" #include "EntitiesMP/Common/PathFinding.h" #define MAX_TARGETS 6 %} uses "EntitiesMP/Marker"; %{ // info structure static EntityInfo eiMarker = { EIBT_ROCK, 10.0f, 0.0f, 1.0f, 0.0f, // source (eyes) 0.0f, 1.0f, 0.0f, // target (body) }; %} class export CNavigationMarker : CEntity { name "NavigationMarker"; thumbnail "Thumbnails\\NavigationMarker.tbn"; features "HasName", "IsTargetable"; properties: 1 CTString m_strName "Name" 'N' = "Marker", 2 RANGE m_fMarkerRange "Marker Range" 'M' = 1.0f, // range around marker (marker doesn't have to be hit directly) 100 CEntityPointer m_penTarget0 "Target 0" 'T' COLOR(C_dBLUE|0xFF), 101 CEntityPointer m_penTarget1 "Target 1" COLOR(C_dBLUE|0xFF), 102 CEntityPointer m_penTarget2 "Target 2" COLOR(C_dBLUE|0xFF), 103 CEntityPointer m_penTarget3 "Target 3" COLOR(C_dBLUE|0xFF), 104 CEntityPointer m_penTarget4 "Target 4" COLOR(C_dBLUE|0xFF), 105 CEntityPointer m_penTarget5 "Target 5" COLOR(C_dBLUE|0xFF), { CPathNode *m_ppnNode; // for pathfinding algorithm } components: 1 model MODEL_MARKER "Models\\Editor\\NavigationMarker.mdl", 2 texture TEXTURE_MARKER "Models\\Editor\\NavigationMarker.tex" functions: void CNavigationMarker(void) { m_ppnNode = NULL; } void ~CNavigationMarker(void) { ASSERT(m_ppnNode == NULL); } /* Read from stream. */ void Read_t( CTStream *istr) // throw char * { CEntity::Read_t(istr); m_ppnNode = NULL; } CEntity *GetTarget(void) const { return m_penTarget0; }; /* Entity info */ void *GetEntityInfo(void) { return &eiMarker; }; // get node used for pathfinding algorithm CPathNode *GetPathNode(void) { if (m_ppnNode==NULL) { m_ppnNode = new CPathNode(this); } return m_ppnNode; } CEntityPointer &TargetPointer(INDEX i) { ASSERT(i>=0 && iStretchModel(FLOAT3D(fSize, fSize, fSize)); SetModel(MODEL_MARKER); ModelChangeNotify(); SetModelMainTexture(TEXTURE_MARKER); // for each non-empty target for (INDEX iTarget=0; iTarget