Changeset 2860 in orxonox.OLD for orxonox/branches/dave/src
- Timestamp:
- Nov 15, 2004, 11:13:21 PM (20 years ago)
- Location:
- orxonox/branches/dave/src
- Files:
-
- 17 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/dave/src/Makefile.am
r2636 r2860 6 6 7 7 bin_PROGRAMS=orxonox 8 orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc9 8 10 noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h 9 orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc 10 noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h 11 11 12 12 13 -
orxonox/branches/dave/src/Makefile.in
r2711 r2860 57 57 command_node.$(OBJEXT) ini_parser.$(OBJEXT) keynames.$(OBJEXT) \ 58 58 track.$(OBJEXT) base_entity.$(OBJEXT) game_loader.$(OBJEXT) \ 59 campaign.$(OBJEXT) story_entity.$(OBJEXT) 59 campaign.$(OBJEXT) story_entity.$(OBJEXT) object.$(OBJEXT) \ 60 environment.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \ 61 list.$(OBJEXT) 60 62 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 61 63 orxonox_LDADD = $(LDADD) … … 63 65 depcomp = $(SHELL) $(top_srcdir)/depcomp 64 66 am__depfiles_maybe = depfiles 65 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ base_entity.Po \66 @AMDEP_TRUE@ ./$(DEPDIR)/ camera.Po ./$(DEPDIR)/campaign.Po \67 @AMDEP_TRUE@ ./$(DEPDIR)/c ollision.Po \67 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \ 68 @AMDEP_TRUE@ ./$(DEPDIR)/base_entity.Po ./$(DEPDIR)/camera.Po \ 69 @AMDEP_TRUE@ ./$(DEPDIR)/campaign.Po ./$(DEPDIR)/collision.Po \ 68 70 @AMDEP_TRUE@ ./$(DEPDIR)/command_node.Po \ 69 71 @AMDEP_TRUE@ ./$(DEPDIR)/data_tank.Po \ 72 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po \ 70 73 @AMDEP_TRUE@ ./$(DEPDIR)/game_loader.Po \ 71 74 @AMDEP_TRUE@ ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \ 72 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/player.Po \ 73 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/track.Po \ 74 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \ 75 @AMDEP_TRUE@ ./$(DEPDIR)/world_entity.Po 75 @AMDEP_TRUE@ ./$(DEPDIR)/list.Po ./$(DEPDIR)/material.Po \ 76 @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/orxonox.Po \ 77 @AMDEP_TRUE@ ./$(DEPDIR)/player.Po ./$(DEPDIR)/story_entity.Po \ 78 @AMDEP_TRUE@ ./$(DEPDIR)/track.Po ./$(DEPDIR)/vector.Po \ 79 @AMDEP_TRUE@ ./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po 76 80 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 77 81 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 163 167 AM_CXXFLAGS = "-I/usr/X11R6/include" 164 168 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS) 165 orxonox_SOURCES = orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc 166 noinst_HEADERS = ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h 169 orxonox_SOURCES = orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc 170 noinst_HEADERS = ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h 167 171 all: all-am 168 172 … … 231 235 -rm -f *.tab.c 232 236 237 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 233 238 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@ 234 239 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@ … … 237 242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_node.Po@am__quote@ 238 243 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@ 244 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@ 239 245 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@ 240 246 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@ 241 247 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@ 248 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ 249 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ 250 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@ 242 251 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@ 243 252 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@ -
orxonox/branches/dave/src/campaign.cc
r2636 r2860 27 27 Campaign::Campaign () 28 28 { 29 this->entities = new List <StoryEntity>();29 this->entities = new ListTemplate<StoryEntity>(); 30 30 this->isInit = false; 31 31 } … … 144 144 StoryEntity* Campaign::getStoryEntity(Uint32 storyID) 145 145 { 146 List <StoryEntity>* l;146 ListTemplate<StoryEntity>* l; 147 147 StoryEntity* entity; 148 148 l = this->entities->get_next(); -
orxonox/branches/dave/src/campaign.h
r2636 r2860 33 33 34 34 private: 35 List <StoryEntity>* entities;35 ListTemplate<StoryEntity>* entities; 36 36 bool running; 37 37 -
orxonox/branches/dave/src/command_node.cc
r2636 r2860 11 11 ### File Specific: 12 12 main-programmer: Christian Meyer 13 co-programmer: ...13 co-programmer: Patrick Boenzli 14 14 */ 15 15 … … 33 33 CommandNode::CommandNode (int ID) 34 34 { 35 bound = new List <WorldEntity>();35 bound = new List(); 36 36 aliases = NULL; 37 37 netID = ID; … … 48 48 bLocalInput = true; 49 49 netID = 0; 50 bound = new List <WorldEntity>();50 bound = new List(); 51 51 load_bindings (filename); 52 52 } … … 59 59 if( aliases != NULL) free (aliases); 60 60 if( bound != NULL) delete bound; 61 } 62 63 64 void CommandNode::reset() 65 { 66 this->bound->clear(); 61 67 } 62 68 … … 123 129 void CommandNode::bind (WorldEntity* entity) 124 130 { 125 bound->add (entity , LIST_ADD_NEXT, true);131 bound->add (entity); 126 132 } 127 133 … … 132 138 void CommandNode::unbind (WorldEntity* entity) 133 139 { 134 bound->remove (entity , LIST_FIND_FW);140 bound->remove (entity); 135 141 } 136 142 … … 214 220 } 215 221 222 216 223 void CommandNode::process_network () 217 224 { … … 219 226 } 220 227 228 221 229 void CommandNode::relay (Command* cmd) 222 230 { 223 //printf("CommandNode|relay()\n");224 List<WorldEntity>* plist = bound;225 231 226 232 Orxonox *orx = Orxonox::getInstance(); … … 231 237 if( bLocalInput) send_over_network (cmd); 232 238 233 while( (plist = plist->get_next()) != NULL) 234 { 235 plist->get_object()->command (cmd); 236 } 237 } 239 WorldEntity* entity = bound->enumerate(); 240 while( entity != NULL) 241 { 242 entity->command (cmd); 243 entity = bound->nextElement(); 244 } 245 } 246 238 247 239 248 /** -
orxonox/branches/dave/src/command_node.h
r2190 r2860 19 19 //! Key aliasing structure 20 20 /** 21 22 21 This structure contains the key aliasing information, e.g. the command strings that 22 have been bound to the keys. 23 23 */ 24 24 typedef struct 25 25 { 26 27 26 char keys[N_STD_KEYS][CMD_LENGHT]; 27 char buttons[N_BUTTONS][CMD_LENGHT]; 28 28 } KeyBindings; 29 29 30 30 //! Command Node 31 31 /** 32 33 34 35 36 32 This class gathers all incoming SDL_Events and processes them. Keyboard, mouse and joystick input is 33 captured and translated into command messages which are passed down to the bound WorldEntities (via WorldEntity::command()). 34 Other SDL_Events are passed to Orxonox::event_handler() to deal with them. If the CommandNode has been created 35 with bLocalInput set to false, it will query the network class for incoming commands that match his netID and pass 36 them on to it's WorldEntities. 37 37 */ 38 38 class CommandNode { 39 39 private: 40 bool bLocalInput; //!< Identifies the CommandNode that processes local input 41 int netID; //!< Unique identifier that is used to determine between remote CommandNodes 42 KeyBindings* aliases; 43 List<WorldEntity>* bound; //!< List of WorldEntites that recieve commands from this CommandNode 44 Sint32 coord[2]; 45 46 void relay (Command* cmd); 47 int* name_to_index (char* name); 48 void process_local (); 49 void process_network (); 50 void send_over_network (Command* cmd); 51 40 bool bLocalInput; //!< Identifies the CommandNode that processes local input 41 int netID; //!< Unique identifier that is used to determine between remote CommandNodes 42 KeyBindings* aliases; 43 List* bound; //!< List of WorldEntites that recieve commands from this CommandNode 44 Sint32 coord[2]; 45 46 47 void relay (Command* cmd); 48 int* name_to_index (char* name); 49 void process_local (); 50 void process_network (); 51 void send_over_network (Command* cmd); 52 52 53 public: 53 54 CommandNode (int ID); 54 55 CommandNode (char* filename); 55 56 ~CommandNode (); 56 57 58 void reset(); 57 59 void load_bindings (char* filename); 58 60 void bind (WorldEntity* entity); -
orxonox/branches/dave/src/environment.cc
r2036 r2860 16 16 */ 17 17 18 #include <iostream>19 #include <GL/glut.h>20 #include <stdlib.h>21 22 #include "data_tank.h"23 18 24 19 #include "environment.h" 20 #include "stdincl.h" 21 #include "world_entity.h" 22 #include "vector.h" 25 23 26 24 using namespace std; … … 30 28 #define LEVEL_LENGTH 500 31 29 32 Environment::Environment () 33 : WorldEntity() 30 Environment::Environment () : WorldEntity() 34 31 { 35 32 … … 60 57 Environment::~Environment () {} 61 58 59 void Environment::tick (float time) {} 62 60 61 void Environment::hit (WorldEntity* weapon, Vector loc) {} 62 63 void Environment::destroy () {} 64 65 void Environment::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} 66 67 void Environment::draw () 68 { 69 printf("Environment::draw()"); 70 71 glMatrixMode(GL_MODELVIEW); 72 glLoadIdentity(); 73 float matrix[4][4]; 74 75 glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z); 76 get_placement()->w.matrix (matrix); 77 glMultMatrixf ((float*)matrix); 78 79 glBegin(GL_TRIANGLES); 80 glColor3f(1,1,1); 81 glVertex3f(0,0,0.5); 82 glVertex3f(-0.5,0,-1); 83 glVertex3f(0.5,0,-1); 84 85 glVertex3f(0,0,0.5); 86 glVertex3f(0,0.5,-1); 87 glVertex3f(0,-0.5,-1); 88 glEnd(); 89 90 glBegin(GL_QUADS); 91 glColor3f(0,0,1); 92 glVertex3f(0.5,0.5,-1); 93 glVertex3f(0.5,-0.5,-1); 94 glVertex3f(-0.5,-0.5,-1); 95 glVertex3f(-0.5,0.5,-1); 96 glEnd(); 97 } 98 99 /* 63 100 void Environment::paint() 64 101 { 65 /*102 66 103 glPushMatrix(); 67 104 //glScalef(0.5, 0.5, 1.0); … … 95 132 96 133 glPopMatrix(); 97 */134 98 135 } 99 136 … … 103 140 } 104 141 142 */ -
orxonox/branches/dave/src/environment.h
r2036 r2860 1 2 3 4 1 #ifndef ENVIRONEMENT_H 5 2 #define ENVIRONEMENT_H 6 3 7 8 4 #include "world_entity.h" 9 5 10 class Environment : public WorldEntity { 6 7 class Environment : public WorldEntity 8 { 9 friend class World; 11 10 12 11 private: … … 21 20 ~Environment (); 22 21 23 void paint(void); 24 void drawEnvironment(void); 25 void setEnvPosition(void); 26 void getEnvPosition(void); 22 23 virtual void tick (float time); 24 virtual void hit (WorldEntity* weapon, Vector loc); 25 virtual void destroy (); 26 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 27 virtual void draw (); 27 28 28 29 }; -
orxonox/branches/dave/src/list.h
r2636 r2860 1 /*2 orxonox - the future of 3D-vertical-scrollers3 4 Copyright (C) 2004 orx5 6 This program is free software; you can redistribute it and/or modify7 it under the terms of the GNU General Public License as published by8 the Free Software Foundation; either version 2, or (at your option)9 any later version.10 11 ### File Specific:12 main-programmer: Christian Meyer13 14 ADDONS/FIXES:15 16 Patrick Boenzli : Implemented getSize() function17 */18 19 20 /*!21 \file list.h22 \brief Contains a template for a doubly linked list23 */24 1 25 2 #ifndef LIST_H 26 3 #define LIST_H 27 4 28 #include "std lib.h"5 #include "stdincl.h" 29 6 30 7 //! An enum to list all the modes available when adding an object to a List 31 enum ADDMODE {LIST_ADD_NEXT, LIST_ADD_PREV,LIST_ADD_FIRST, LIST_ADD_LAST};8 //enum ADDMODE {LIST_ADD_FIRST, LIST_ADD_LAST}; 32 9 //! An enum to list the two searching directions available when removing an object from a List 33 enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW}; 34 35 //! A generic doubly linked list 36 template<class T> class List 37 { 38 T* object; 39 List<T>* next; 40 List<T>* prev; 41 bool bReference; 42 int size; 10 //enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW}; 11 12 13 14 class WorldEntity; 15 16 class List { 17 18 public: 19 List (); 20 ~List (); 21 22 void add(WorldEntity* entity); 23 void remove(WorldEntity* entity); 24 void clear(); 25 WorldEntity* firstElement(); 26 bool isEmpty(); 27 int getSize(); 28 WorldEntity* enumerate(); 29 WorldEntity* nextElement(); 30 WorldEntity* toArray(); 31 void debug(); 32 33 private: 34 struct listElement 35 { 36 listElement* prev; 37 WorldEntity* curr; 38 listElement* next; 39 }; 40 Uint32 size; 41 listElement* first; 42 listElement* last; 43 listElement* currentEl; 44 45 46 }; 47 48 class Iterator 49 { 50 51 public: 52 bool hasNext(); 53 WorldEntity* next(); 54 55 private: 56 57 }; 58 59 60 template<class T> class tList 61 { 62 private: 63 struct listElement 64 { 65 listElement* prev; 66 T* curr; 67 listElement* next; 68 }; 69 70 Uint32 size; 71 listElement* first; 72 listElement* last; 73 listElement* currentEl; 43 74 44 75 public: 45 List (T* obj, List<T>* n, List<T>* p, bool bRef);46 ~ List ();76 tList (); 77 ~tList (); 47 78 48 int add (T* obj, ADDMODE mode, bool bRef); 49 T* get_object(); 50 List<T>* get_next (); 51 List<T>* get_previous (); 52 List<T>* get_last (); 53 List<T>* get_first (); 54 void set_next (List<T>* ptr); 55 void set_prev (List<T>* ptr); 56 int remove (T* obj, FINDMODE mode); 79 80 void add(WorldEntity* entity); 81 void remove(WorldEntity* entity); 82 void clear(); 83 T* firstElement(); 84 bool isEmpty(); 57 85 int getSize(); 86 T* enumerate(); 87 T* nextElement(); 88 T* toArray(); 89 void debug(); 58 90 }; 59 91 60 92 61 /** 62 \brief Standard constructor 63 64 Call this without any parameters to generate a new List which can be filled with content. 65 DO NOT create a List element that contains an object on your own, you'll lose the data 66 contained in that object and will have trouble removing the list from your memory. 67 */ 68 template<class T> 69 List<T>::List (T* obj = NULL, List<T>* n = NULL, List<T>* p = NULL, bool bRef = false) 70 { 71 object = obj; 72 next = n; 73 prev = p; 74 bReference = bRef; 75 if(obj != NULL) 76 ++size; 77 } 78 79 /** 80 \brief Standard destructor 81 82 Call this on the initially generated base List element to remove the whole List from the memory. 83 You can safely do this to any List element you want without messing up the rest of the List, but keep in mind 84 that the contained object will be deleted as well when bRef had been set to false. 85 */ 86 template<class T> 87 List<T>::~List () 88 { 89 if (object == NULL) // deleted foot node => disband the list 90 { 91 while( next != NULL) 93 template<class T> 94 tList<T>::tList () 95 { 96 this->first = NULL; 97 this->last = NULL; 98 this->size = 0; 99 } 100 101 template<class T> 102 tList<T>::~tList () 103 {} 104 105 template<class T> 106 void tList<T>::add(WorldEntity* entity) 107 { 108 printf("tList<T>::add() \n"); 109 listElement* el = new listElement; 110 el->prev = this->last; 111 el->curr = entity; 112 el->next = NULL; 113 114 this->last = el; 115 116 if(this->size == 0) this->first = el; 117 else el->prev->next = el; 118 this->size++; 119 } 120 121 122 template<class T> 123 void tList<T>::remove(WorldEntity* entity) 124 { 125 this->currentEl = this->first; 126 listElement* te; 127 while( this->currentEl != NULL) 92 128 { 93 delete next; 129 if( this->currentEl->curr == entity) 130 { 131 printf("tList<T>::remove() - object found\n"); 132 133 if( this->currentEl->prev == NULL ) this->first = this->currentEl->next; 134 else this->currentEl->prev->next = this->currentEl->next; 135 136 if( this->currentEl->next == NULL) this->last = this->currentEl->prev; 137 else this->currentEl->next->prev = this->currentEl->prev; 138 139 te = this->currentEl->next; 140 delete this->currentEl; 141 this->currentEl = te; 142 return; 143 } 144 this->currentEl = this->currentEl->next; 94 145 } 95 while( prev != NULL) 146 } 147 148 149 template<class T> 150 void tList<T>::clear() 151 { 152 printf("tList<T>::clear() - clearing all world objects, releasing mem\n"); 153 this->currentEl = this->first; 154 while(this->currentEl != NULL) 96 155 { 97 delete prev; 156 listElement* le = this->currentEl->next; 157 delete this->currentEl->curr; 158 delete this->currentEl; 159 this->currentEl = le; 98 160 } 99 } 100 else 101 { 102 if (prev != NULL) prev->set_next (next); 103 if (next != NULL) next->set_prev (prev); 104 if (!bReference) delete object; 105 } 106 } 107 108 /** 109 \brief Add an object to the List 110 \param obj: A pointer to an allocated object 111 \param mode: A Value of ADDMODE (default: LIST_ADD_NEXT) 112 \param bRef: Sets whether the element is serving as a storage point or a simple listing (default: false) 113 \return 0 if the operation succeded, -1 if the element could not be added 114 115 This adds a new List element to the chain. The mode parameter can be used to specify 116 the location where the element should be added. LIST_ADD_NEXT will add the new element directly 117 after the base element. LIST_ADD_PREV will add the new element directly before the base element. 118 LIST_ADD_FIRST will add the element at the beginning of the List whereas LIST_ADD_LAST will add 119 it to the end of the chain. If the bRef parameter is set to true, the object pointer will not be deleted 120 when the element containing that object is deleted, thus the List can be used for temporary listings as 121 well as permanent data storage. 122 */ 123 template<class T> 124 int List<T>::add (T* obj, ADDMODE mode = LIST_ADD_NEXT, bool bRef = false) 125 { 126 List<T>* p; 127 if( obj == NULL) return -1; 128 switch (mode) 129 { 130 case LIST_ADD_NEXT: 131 p = new List<T>( obj, next, this, bRef); 132 if( next != NULL) next->set_prev (p); 133 next = p; 134 break; 135 case LIST_ADD_PREV: 136 p = new List<T>( obj, this, prev, bRef); 137 if( prev != NULL) prev->set_next (p); 138 prev = p; 139 break; 140 case LIST_ADD_FIRST: 141 if (prev == NULL) prev = new List<T> (obj, this, NULL, bRef); 142 else return prev->add (obj, mode, bRef); 143 break; 144 case LIST_ADD_LAST: 145 if (next == NULL) next = new List<T> (obj, NULL, this, bRef); 146 else return next->add (obj, mode, bRef); 147 break; 148 default: 149 return -1; 150 break; 151 } 152 ++size; 153 return 0; 154 } 155 156 /** 157 \brief Get the next element of the List 158 \return The List element after the current List element 159 */ 160 template<class T> 161 List<T>* List<T>::get_next () 162 { 163 return next; 164 } 165 166 /** 167 \brief Get the previous element of the List 168 \return The List element before the current List element 169 */ 170 template<class T> 171 List<T>* List<T>::get_previous () 172 { 173 return prev; 174 } 175 176 /** 177 \brief Get the last element of the List 178 \return The last List element 179 */ 180 template<class T> 181 List<T>* List<T>::get_last () 182 { 183 if (next == NULL) return this; 184 else return next->get_last(); 185 } 186 187 /** 188 \brief Get the first element of the List 189 \return The first List element 190 */ 191 template<class T> 192 List<T>* List<T>::get_first () 193 { 194 if (prev == NULL) return this; 195 else return prev->get_first(); 196 } 197 198 /** 199 \brief Removes a certain element from the List 200 \param obj: A pointer to the object that should be removed 201 \param mode: A value of FINDMODE 202 \return 0 if the element was found and removed, -1 if the element was not found 203 204 This searches the part of the List specified with mode for the object in question. 205 When the object is found it is deleted and the List element is removed from the chain. 206 If mode is LIST_FIND_FW all elements AFTER the base element are searched, if mode is 207 LIST_FIND_BW all elements BEFORE the base element are searched. Note that the object 208 contained within the List element is NOT deleted when bRef was set to true. 209 */ 210 template<class T> 211 int List<T>::remove (T* obj, FINDMODE mode = LIST_FIND_FW) 212 { 213 if (obj == NULL) return -1; 214 else 215 { 216 switch (mode) 217 { 218 case LIST_FIND_BW: 219 if (prev == NULL) return -1; 220 else 221 { 222 if( prev->get_object() == obj) 223 { 224 delete prev; 225 } 226 else 227 { 228 return prev->remove( obj, mode); 229 } 230 } 231 break; 232 case LIST_FIND_FW: 233 if (next == NULL) return -1; 234 else 235 { 236 if( next->get_object() == obj) 237 { 238 delete next; 239 } 240 else 241 { 242 return next->remove( obj, mode); 243 } 244 } 245 break; 246 default: 247 return -1; 248 } 249 } 250 --size; 251 return 0; 252 } 253 254 /** 255 \brief Set the next element of a List element 256 \param ptr: A pointer to the new next element 257 258 Sets the next element of a List element... Better not touch this, it can really mess up a List. 259 */ 260 template<class T> 261 void List<T>::set_next (List<T>* ptr) 262 { 263 next = ptr; 264 } 265 266 /** 267 \brief Set the prev element of a List element 268 \param ptr: A pointer to the new previous element 269 270 Sets the previous element of a List element... Better not touch this, it can really mess up a List. 271 */ 272 template<class T> 273 void List<T>::set_prev (List<T>* ptr) 274 { 275 prev = ptr; 276 } 277 278 /** 279 \brief Get the pointer to the object the element is containing 280 \return The contained object (will be NULL if called on the base element). 281 */ 282 template<class T> 283 T* List<T>::get_object() 284 { 285 return object; 286 } 287 288 289 /** 290 \brief Returns the current size of the List 291 \return Size of List 292 */ 293 template<class T> 294 int List<T>::getSize() 161 this->first = NULL; 162 this->last = NULL; 163 this->size = 0; 164 } 165 166 167 template<class T> 168 T* tList<T>::firstElement() 169 { 170 return this->first->curr; 171 } 172 173 174 template<class T> 175 bool tList<T>::isEmpty() 176 { 177 return (this->size==0)?true:false; 178 } 179 180 181 template<class T> 182 int tList<T>::getSize() 295 183 { 296 184 return this->size; 297 185 } 298 186 187 188 template<class T> 189 T* tList<T>::enumerate() 190 { 191 if(this->size == 0) return NULL; 192 this->currentEl = this->first; 193 return this->currentEl->curr; 194 } 195 196 197 template<class T> 198 T* tList<T>::nextElement() 199 { 200 if(this->size == 0) return NULL; 201 this->currentEl = this->currentEl->next; 202 if(this->currentEl == NULL) return NULL; 203 return this->currentEl->curr; 204 } 205 206 207 template<class T> 208 T* tList<T>::toArray() 209 {} 210 299 211 #endif 300 -
orxonox/branches/dave/src/orxonox.cc
r2636 r2860 158 158 glClearColor(0.0, 0.0, 0.0, 0.0); 159 159 glEnable(GL_DEPTH_TEST); 160 glEnable(GL_COLOR); 161 glShadeModel(GL_FLAT); 160 161 // LIGHTING 162 GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0}; 163 GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0}; 164 GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0}; 165 166 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 167 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight); 168 glEnable(GL_LIGHTING); 169 glEnable(GL_LIGHT0); 170 glEnable(GL_DEPTH_TEST); 171 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); 172 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 173 174 // glEnable(GL_COLOR); 175 // glShadeModel(GL_SMOOTH); 162 176 163 177 // create camera -
orxonox/branches/dave/src/player.cc
r2730 r2860 25 25 Player::Player(bool isFree) : WorldEntity(isFree) 26 26 { 27 28 obj = new Object ("reaphigh.obj"); 29 /* 27 30 objectList = glGenLists(1); 28 31 glNewList (objectList, GL_COMPILE); … … 48 51 49 52 glEndList (); 50 53 */ 51 54 } 52 55 … … 58 61 void Player::post_spawn () 59 62 { 60 61 62 63 64 65 63 travel_speed = 15.0; 64 velocity = Vector(); 65 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 66 bFire = false; 67 acceleration = 10.0; 68 set_collision (new CollisionCluster (1.0, Vector(0,0,0))); 66 69 } 67 70 … … 104 107 glMultMatrixf ((float*)matrix); 105 108 106 glCallList (objectList); 109 glMatrixMode (GL_MODELVIEW); 110 glRotatef (-90, 0,1,0); 111 obj->draw(); 112 // glCallList (objectList); 107 113 114 108 115 109 116 //printf("Player@%f/%f/%f\n", get_placement()->r.x, get_placement()->r.y, get_placement()->r.z); -
orxonox/branches/dave/src/player.h
r2730 r2860 8 8 9 9 #include "world_entity.h" 10 #include "object.h" 10 11 11 12 //! Basic controllable WorldEntity … … 37 38 float acceleration; 38 39 GLuint objectList; 40 Object* obj; 39 41 40 42 void move (float time); -
orxonox/branches/dave/src/stdincl.h
r2636 r2860 15 15 #include "coordinates.h" 16 16 #include "list.h" 17 #include "list_template.h" 17 18 #include "error.h" 18 19 #include "message_structures.h" -
orxonox/branches/dave/src/vector.cc
r2551 r2860 33 33 { 34 34 Vector r; 35 35 36 36 r.x = x + v.x; 37 37 r.y = y + v.y; -
orxonox/branches/dave/src/world.cc
r2731 r2860 22 22 #include "command_node.h" 23 23 #include "camera.h" 24 #include "environment.h" 24 25 25 26 using namespace std; … … 35 36 this->worldName = name; 36 37 this->debugWorldNr = -1; 37 this->entities = new List<WorldEntity>();38 this->entities = new tList<WorldEntity>(); 38 39 } 39 40 … … 42 43 this->debugWorldNr = worldID; 43 44 this->worldName = NULL; 44 this->entities = new List<WorldEntity>();45 this->entities = new tList<WorldEntity>(); 45 46 } 46 47 … … 74 75 this->bQuitCurrentGame = true; 75 76 this->localCamera->setWorld(NULL); 77 this->entities->clear(); 78 Orxonox::getInstance()->get_localinput()->reset(); 76 79 this->~World(); 77 80 } … … 98 101 this->pathnodes = new Vector[6]; 99 102 this->pathnodes[0] = Vector(0, 0, 0); 100 this->pathnodes[1] = Vector( -100, 40, 0);101 this->pathnodes[2] = Vector(-100, 140, 0);102 this->pathnodes[3] = Vector(0, 180, 0);103 this->pathnodes[4] = Vector(100, 140, 0);104 this->pathnodes[5] = Vector(100, 40, 0);103 this->pathnodes[1] = Vector(1000, 0, 0); 104 // this->pathnodes[2] = Vector(-100, 140, 0); 105 // this->pathnodes[3] = Vector(0, 180, 0); 106 // this->pathnodes[4] = Vector(100, 140, 0); 107 // this->pathnodes[5] = Vector(100, 40, 0); 105 108 106 109 // create the tracks 107 this->tracklen = 6;108 this->track = new Track[ 6];110 this->tracklen = 2; 111 this->track = new Track[2]; 109 112 for( int i = 0; i < this->tracklen; i++) 110 113 { … … 113 116 114 117 // create a player 115 //WorldEntity* myPlayer = (WorldEntity*) this->spawn<Player>();116 118 WorldEntity* myPlayer = new Player(); 117 119 this->spawn(myPlayer); … … 125 127 this->localCamera = new Camera(this); 126 128 this->getCamera()->bind (myPlayer); 129 130 Placement* plc = new Placement; 131 plc->r = Vector(100, 10, 10); 132 plc->w = Quaternion(); 133 WorldEntity* env = new Environment(); 134 this->spawn(env, plc); 135 127 136 break; 128 137 } … … 174 183 glNewList (objectList, GL_COMPILE); 175 184 glLoadIdentity(); 185 glColor3f(1.0,0,0); 186 glBegin(GL_QUADS); 187 float height [500][50]; 188 Vector normal_vectors[500][50]; 189 float size = 2; 190 for(int i=0;i<400;i+=1){ 191 for(int j=0;j<50;j+=1){ 192 normal_vectors[i][j].x=0; 193 normal_vectors[i][j].y=1; 194 normal_vectors[i][j].z=0; 195 196 197 198 } 199 } 200 201 202 for ( int i = 0; i<400; i+=1) 203 { 204 for (int j = 0; j<50;j+=1) 205 { 206 //height[i][j] = rand()/20046 + (j-25)*(j-25)/30; 207 height[i][j]=(sin((float)j/3)*rand()*i/182400)*.2; 208 } 209 } 210 for(int a=0;a<2;a+=1){ 211 for (int i=1;i<399 ;i+=1 ){ 212 for(int j=1;j<49;j+=1){ 213 height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4; 214 215 } 216 } 217 } 218 //Berechnung von normalen Vektoren 219 220 for(int i=1;i<399;i+=1){ 221 for(int j=1;j<49 ;j+=1) 222 223 { 224 Vector* v1 = new Vector (size*i, size*(j-25), height[i][j]-20 ); 225 Vector* v2 = new Vector (size*(i+1), size*(j-25), height[i+1][j]-20); 226 Vector* v3 = new Vector (size*(i), size*(j-24), height[i][j+1]-20); 227 Vector* v4 = new Vector (size*(i-1), size*(j-25), height[i-1][j]-20); 228 Vector* v5 = new Vector (size*(i), size*(j-26), height[i][j-1]-20); 229 230 Vector c1 = *v1 - *v2; 231 Vector c2 = *v1 - *v3; 232 Vector c3= *v1 - *v4; 233 Vector c4 = *v1 - *v5; 234 normal_vectors[i][j]=c1.cross(*v1-*v3)+c2.cross(*v1-*v4)+c3.cross(*v1-*v5)+c4.cross(*v1-*v2); 235 normal_vectors[i][j].normalize(); 236 237 238 239 240 } 241 } 242 int snowheight=3; 243 for ( int i = 0; i<400; i+=1) 244 { 245 for (int j = 0; j<50;j+=1) 246 { 247 Vector* v1 = new Vector (size*i, size*(j-25), height[i][j]-20 ); 248 Vector* v2 = new Vector (size*(i+1), size*(j-25), height[i+1][j]-20); 249 Vector* v3 = new Vector (size*(i+1), size*(j-24), height[i+1][j+1]-20); 250 Vector* v4 = new Vector (size*(i), size*(j-24), height[i][j+1]-20); 251 float a[3]; 252 if(height[i][j]<snowheight){ 253 a[0]=0; 254 a[1]=1.0-height[i][j]/10-.3; 255 a[2]=0; 256 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 257 } 258 else{ 259 a[0]=1.0; 260 a[1]=1.0; 261 a[2]=1.0; 262 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 263 264 } 265 glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z); 266 glVertex3f(v1->x, v1->y, v1->z); 267 if(height[i+1][j]<snowheight){ 268 a[0]=0; 269 a[1] =1.0-height[i+1][j]/10-.3; 270 a[2]=0; 271 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 272 } 273 else{ 274 a[0]=1.0; 275 a[1]=1.0; 276 a[2]=1.0; 277 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 278 279 } 280 glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z); 281 glVertex3f(v2->x, v2->y, v2->z); 282 if(height[i+1][j+1]<snowheight){ 283 a[0]=0; 284 a[1] =1.0-height[i+1][j+1]/10-.3; 285 a[2]=0; 286 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 287 } 288 else{ 289 a[0]=1.0; 290 a[1]=1.0; 291 a[2]=1.0; 292 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 293 294 295 } 296 glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z); 297 glVertex3f(v3->x, v3->y, v3->z); 298 if(height[i][j+1]<snowheight){ 299 a[0]=0; 300 a[1] =1.0-height[i+1][j+1]/10-.3; 301 a[2]=0; 302 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 303 } 304 else{ 305 a[0]=1.0; 306 a[1]=1.0; 307 a[2]=1.0; 308 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 309 } 310 glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z); 311 glVertex3f(v4->x, v4->y, v4->z); 312 313 } 314 } 315 glEnd(); 316 /* 176 317 glBegin(GL_LINES); 177 178 318 for( float x = -128.0; x < 128.0; x += 25.0) 179 319 { … … 213 353 214 354 } 215 355 */ 216 356 //draw track 357 glBegin(GL_LINES); 217 358 glColor3f(0,1,1); 218 359 for( int i = 0; i < tracklen; i++) … … 235 376 void World::collide () 236 377 { 237 List<WorldEntity> *a, *b; 378 /* 379 List *a, *b; 238 380 WorldEntity *aobj, *bobj; 239 240 a = entities ->get_next();381 382 a = entities; 241 383 242 384 while( a != NULL) 243 385 { 244 aobj = a-> get_object();386 aobj = a->nextElement(); 245 387 if( aobj->bCollide && aobj->collisioncluster != NULL) 246 388 { 247 b = a-> get_next();389 b = a->nextElement(); 248 390 while( b != NULL ) 249 391 { 250 bobj = b-> get_object();392 bobj = b->nextElement(); 251 393 if( bobj->bCollide && bobj->collisioncluster != NULL ) 252 394 { … … 260 402 } 261 403 } 262 b = b-> get_next();404 b = b->nextElement(); 263 405 } 264 406 } 265 a = a->get_next(); 266 } 407 a = a->enumerate(); 408 } 409 */ 267 410 } 268 411 … … 275 418 276 419 // draw entities 277 List<WorldEntity> *l;278 420 WorldEntity* entity; 279 421 280 l = entities->get_next();281 while( l!= NULL )422 entity = this->entities->enumerate(); 423 while( entity != NULL ) 282 424 { 283 entity = l->get_object();284 425 if( entity->bDraw ) entity->draw(); 285 l = l->get_next();426 entity = this->entities->nextElement(); 286 427 } 287 428 … … 303 444 void World::update () 304 445 { 305 List<WorldEntity> *l;446 //List<WorldEntity> *l; 306 447 WorldEntity* entity; 307 448 Location* loc; … … 309 450 Uint32 t; 310 451 311 l = entities->get_next(); 312 while( l != NULL ) 452 // l = entities->enumerate(); 453 entity = this->entities->enumerate(); 454 while( entity != NULL ) 313 455 { 314 entity = l->get_object(); 456 315 457 316 458 if( !entity->isFree() ) … … 350 492 } 351 493 352 l = l->get_next();494 entity = entities->nextElement(); 353 495 } 354 496 … … 361 503 void World::time_slice (Uint32 deltaT) 362 504 { 363 List<WorldEntity> *l;505 //List<WorldEntity> *l; 364 506 WorldEntity* entity; 365 507 float seconds = deltaT; … … 367 509 seconds /= 1000; 368 510 369 l = entities->get_next();370 while( l!= NULL)511 entity = entities->enumerate(); 512 while( entity != NULL) 371 513 { 372 entity = l->get_object();373 514 entity->tick (seconds); 374 l = l->get_next();375 } 376 515 entity = entities->nextElement(); 516 } 517 377 518 for( int i = 0; i < tracklen; i++) track[i].tick (seconds); 378 519 } … … 411 552 void World::debug() 412 553 { 413 List<WorldEntity> *l;554 //List<WorldEntity> *l; 414 555 WorldEntity* entity; 415 556 416 557 printf("counting all entities\n"); 417 l = entities->get_next(); 418 while( l != NULL ) 558 printf("World::debug() - enumerate()\n"); 559 entity = entities->enumerate(); 560 while( entity != NULL ) 419 561 { 420 entity = l->get_object();421 562 if( entity->bDraw ) printf("got an entity\n"); 422 l = l->get_next();563 entity = entities->nextElement(); 423 564 } 424 565 } … … 445 586 // Draw 446 587 display(); 588 589 //for(int i = 0; i < 1000000; i++){} 590 447 591 } 448 592 printf("World|Exiting the main loop\n"); … … 477 621 { 478 622 Uint32 dt = currentFrame - this->lastFrame; 479 /*623 480 624 if(dt > 0) 481 625 { … … 485 629 else 486 630 { 487 printf("fps = 1000 \n");488 } 489 */631 printf("fps = 1000 but 0ms!\n"); 632 } 633 490 634 this->time_slice (dt); 491 635 this->update (); … … 545 689 Location* loc = NULL; 546 690 WorldEntity* owner; 547 //T* entity = new T(); 548 entities->add (entity, LIST_ADD_NEXT); 549 //if( loc == NULL) 550 //{ 551 zeroloc.dist = 0; 552 zeroloc.part = 0; 553 zeroloc.pos = Vector(); 554 zeroloc.rot = Quaternion(); 555 loc = &zeroloc; 556 //} 691 692 entities->add (entity); 693 zeroloc.dist = 0; 694 zeroloc.part = 0; 695 zeroloc.pos = Vector(); 696 zeroloc.rot = Quaternion(); 697 loc = &zeroloc; 557 698 entity->init (loc, owner); 558 699 if (entity->bFree) … … 561 702 } 562 703 entity->post_spawn (); 704 } 705 706 707 void World::spawn(WorldEntity* entity, Location* loc) 708 { 709 Location zeroLoc; 710 WorldEntity* owner; 711 this->entities->add (entity); 712 if( loc == NULL) 713 { 714 zeroLoc.dist = 0; 715 zeroLoc.part = 0; 716 zeroLoc.pos = Vector(); 717 zeroLoc.rot = Quaternion(); 718 loc = &zeroLoc; 719 } 720 entity->init (loc, owner); 721 if (entity->bFree) 722 { 723 this->track[loc->part].map_coords( loc, entity->get_placement()); 724 } 725 entity->post_spawn (); 563 726 //return entity; 564 727 } 728 729 730 void World::spawn(WorldEntity* entity, Placement* plc) 731 { 732 Placement zeroPlc; 733 WorldEntity* owner; 734 if( plc == NULL) 735 { 736 zeroPlc.r = Vector(); 737 zeroPlc.w = Quaternion(); 738 plc = &zeroPlc; 739 } 740 this->entities->add (entity); 741 entity->init (plc, owner); 742 entity->post_spawn (); 743 //return entity; 744 } -
orxonox/branches/dave/src/world.h
r2731 r2860 49 49 bool system_command (Command* cmd); 50 50 Camera* getCamera(); 51 //private:52 51 53 52 void spawn(WorldEntity* entity); 53 void spawn(WorldEntity* entity, Location* loc); 54 void spawn(WorldEntity* entity, Placement* plc); 54 55 55 List<WorldEntity>* entities;56 tList<WorldEntity>* entities; 56 57 57 58 // base level data -
orxonox/branches/dave/src/world_entity.cc
r2190 r2860 36 36 WorldEntity::WorldEntity (bool isFree) : bFree(isFree) 37 37 { 38 collisioncluster = NULL; 39 owner = NULL; 38 this->bDraw = true; 39 collisioncluster = NULL; 40 owner = NULL; 40 41 } 41 42 … … 45 46 WorldEntity::~WorldEntity () 46 47 { 47 48 if( collisioncluster != NULL) delete collisioncluster; 48 49 } 49 50 50 51 /** 51 52 52 \brief get the Location of the WorldEntity 53 \return a pointer to location 53 54 */ 54 55 Location* WorldEntity::get_location () 55 56 { 56 57 return &loc; 57 58 } 58 59 59 60 /** 60 61 61 \brief get the Placement of the WorldEntity 62 \return a pointer to placement 62 63 */ 63 64 Placement* WorldEntity::get_placement () 64 65 { 65 66 return &place; 66 67 } 67 68 68 69 /** 69 70 70 \brief query whether the WorldEntity in question is free 71 \return true if the WorldEntity is free or false if it isn't 71 72 */ 72 73 bool WorldEntity::isFree () … … 76 77 77 78 /** 78 79 80 81 79 \brief set the WorldEntity's collision hull 80 \param newhull: a pointer to a completely assembled CollisionCluster 81 82 Any previously assigned collision hull will be deleted on reassignment 82 83 */ 83 84 void WorldEntity::set_collision (CollisionCluster* newhull) 84 85 { 85 86 87 86 if( newhull == NULL) return; 87 if( collisioncluster != NULL) delete collisioncluster; 88 collisioncluster = newhull; 88 89 } 89 90 90 91 /** 91 92 93 94 92 \brief this method is called every frame 93 \param time: the time in seconds that has passed since the last tick 94 95 Handle all stuff that should update with time inside this method (movement, animation, etc.) 95 96 */ 96 97 void WorldEntity::tick(float time) … … 100 101 /** 101 102 \brief the entity is drawn onto the screen with this function 102 103 103 104 This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn. 104 105 */ … … 108 109 109 110 /** 110 111 112 113 111 \brief this function is called, when two entities collide 112 \param other: the world entity with whom it collides 113 \param ownhitflags: flags to the CollisionCluster subsections that registered an impact 114 \param otherhitflags: flags to the CollisionCluster subsections of the other entity that registered an impact 114 115 115 116 Implement behaviour like damage application or other miscellaneous collision stuff in this function 116 117 */ 117 118 void WorldEntity::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} … … 135 136 136 137 /** 137 138 \brief basic initialisation for bound Entities 138 139 */ 139 140 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner) 140 141 { 141 142 142 loc = *spawnloc; 143 owner = spawnowner; 143 144 } 144 145 145 146 /** 146 147 \brief basic initialisation for free Entities 147 148 */ 148 149 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner) 149 150 { 150 151 151 place = *spawnplc; 152 owner = spawnowner; 152 153 } 153 154 154 155 /** 155 156 157 158 156 \brief this is called immediately after the Entity has been constructed and initialized 157 158 Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here. 159 DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted. 159 160 */ 160 161 void WorldEntity::post_spawn () … … 163 164 164 165 /** 165 166 167 168 169 166 \brief this handles incoming command messages 167 \param cmd: a pointer to the incoming Command structure 168 169 Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used 170 to send commands from one WorldEntity to another. 170 171 */ 171 172 void WorldEntity::command (Command* cmd) … … 174 175 175 176 /** 176 177 177 \brief this is called by the local Camera to determine the point it should look at on the WorldEntity 178 \param locbuf: a pointer to the buffer to fill with a location to look at 178 179 179 180 180 You may put any Location you want into locbuf, the Camera will determine via the corresponding Track how 181 to look at the location you return with this. 181 182 */ 182 183 void WorldEntity::get_lookat (Location* locbuf) … … 185 186 186 187 /** 187 188 189 190 188 \brief this method is called by the world if the WorldEntity leaves valid gamespace 189 190 For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a 191 place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy). 191 192 */ 192 193 void WorldEntity::left_world ()
Note: See TracChangeset
for help on using the changeset viewer.