Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6404 in orxonox.OLD


Ignore:
Timestamp:
Jan 4, 2006, 1:49:20 AM (18 years ago)
Author:
patrick
Message:

network: working on the last steps, completion is in reach. sadly the world isn't loaded anymore at the moment. continue work later. work flush

Location:
branches/network/src
Files:
7 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/Makefile.am

    r6402 r6404  
    5252                  story_entities/game_world_data.cc \
    5353                  story_entities/single_player_world.cc \
     54                  story_entities/single_player_world_data.cc \
    5455                  story_entities/multi_player_world.cc \
     56                  story_entities/multi_player_world_data.cc \
    5557                  world_entities/world_entity.cc \
    5658                  world_entities/camera.cc \
     
    103105                 story_entities/game_world_data.h \
    104106                 story_entities/single_player_world.h \
     107                 story_entities/single_player_world_data.h \
    105108                 story_entities/multi_player_world.h \
     109                 story_entities/multi_player_world_data.h \
    106110                 world_entities/world_entity.h \
    107111                 world_entities/camera.h \
  • branches/network/src/lib/Makefile.am

    r6074 r6404  
    3636                        lang/base_object.cc \
    3737                        lang/class_list.cc \
     38                        data/data_tank.cc \
    3839                        util/substring.cc \
    3940                        util/color.cc \
     
    4748noinst_HEADERS =        coord/p_node.h \
    4849                        lang/base_object.h \
     50                        data/data_tank.h \
    4951                        graphics/render2D/element_2d.h \
    5052                        graphics/render2D/render_2d.h \
     
    7072          particles \
    7173          collision_detection \
    72           network \
     74                network \
    7375          parser \
    7476          shell \
  • branches/network/src/story_entities/campaign_data.cc

    r6402 r6404  
    5858 * @param root: The XML-element to load from
    5959 */
    60 void CampaignData::loadParams(const TiXmlElement* root)
     60void CampaignData::loadData(const TiXmlElement* root)
    6161{
    6262  LoadParamXML(root, "WorldList", this, CampaignData, loadParamsWorldList)
    6363      .describe("A List of Worlds to be loaded in this Campaign");
    64 
    6564}
    6665
  • branches/network/src/story_entities/campaign_data.h

    r6402 r6404  
    88
    99
    10 #include "base_object.h"
     10#include "data_tank.h"
    1111#include <list>
    1212
     
    1414
    1515//! A class that contains the data of the Campaign object
    16 class CampaignData : public BaseObject
     16class CampaignData : public DataTank
    1717{
    1818
     
    2121    virtual ~CampaignData();
    2222
    23     void loadParams(const TiXmlElement* root);
     23    void loadData(const TiXmlElement* root);
    2424
    2525    void addStoryEntity(StoryEntity* se);
  • branches/network/src/story_entities/game_world.cc

    r6402 r6404  
    2020#include "game_world_data.h"
    2121
    22 #include "shell_command.h"
    2322#include "resource_manager.h"
    2423#include "state.h"
     24#include "class_list.h"
     25#include "substring.h"
     26
     27#include "game_loader.h"
    2528
    2629#include "p_node.h"
     
    3033#include "environment.h"
    3134#include "terrain.h"
    32 
    3335#include "test_entity.h"
    3436#include "terrain.h"
     37#include "md2Model.h"
     38#include "weapons/projectile.h"
     39#include "npcs/npc_test1.h"
     40#include "playable.h"
     41
    3542#include "light.h"
     43
     44#include "factory.h"
     45#include "fast_factory.h"
    3646#include "load_param.h"
    37 #include "shell.h"
    38 
    39 #include "fast_factory.h"
    40 #include "animation_player.h"
     47#include "shell_command.h"
     48
    4149#include "particle_engine.h"
    4250#include "graphics_engine.h"
     51#include "event_handler.h"
     52#include "sound_engine.h"
     53#include "cd_engine.h"
     54#include "network_manager.h"
    4355#include "physics_engine.h"
    4456#include "fields.h"
    4557
    46 #include "md2Model.h"
    47 
    4858#include "glmenu_imagescreen.h"
    49 #include "game_loader.h"
    50 
     59#include "shell.h"
     60
     61#include "animation_player.h"
    5162#include "animation3d.h"
    5263
    53 #include "substring.h"
    54 
    55 #include "factory.h"
    56 
    57 #include "weapons/projectile.h"
    58 #include "event_handler.h"
    59 #include "sound_engine.h"
    6064#include "ogg_player.h"
    61 
    62 #include "class_list.h"
    63 
    64 #include "cd_engine.h"
    65 #include "npcs/npc_test1.h"
    6665#include "shader.h"
    6766
    68 #include "playable.h"
    69 #include "network_manager.h"
    70 #include "playable.h"
     67
     68using namespace std;
    7169
    7270
     
    7472SHELL_COMMAND(togglePNodeVisibility, GameWorld, togglePNodeVisibility);
    7573SHELL_COMMAND(toggleBVVisibility, GameWorld, toggleBVVisibility);
    76 
    77 using namespace std;
    78 
    79 //! This creates a Factory to fabricate a GameWorld
    80 //CREATE_FACTORY(GameWorld, CL_GAME_WORLD);
    8174
    8275
  • branches/network/src/story_entities/game_world_data.cc

    r6402 r6404  
    9292 */
    9393GameWorldData::~GameWorldData()
    94 {
    95 }
     94{}
    9695
    9796
     
    180179
    181180/**
    182  *  loads the GUI data
     181 *  unloads the GUI data
    183182 */
    184183ErrorMessage GameWorldData::unloadGUI()
     
    242241
    243242/**
    244  *  unloads the world entities from the xml file
     243 *  unloads the world entities
    245244 */
    246245ErrorMessage GameWorldData::unloadWorldEntities()
  • branches/network/src/story_entities/game_world_data.h

    r6402 r6404  
    88
    99#include "sdlincl.h"
    10 #include "base_object.h"
     10#include "data_tank.h"
    1111#include "error.h"
    1212
     
    2929 * the game start/stop process is not contained here and can be found in the GameWorld class.
    3030 */
    31 class GameWorldData : public BaseObject
     31class GameWorldData : public DataTank
    3232{
    3333
     
    4141
    4242
    43   private:
     43  protected:
    4444    virtual ErrorMessage loadGUI(TiXmlElement* root);
    4545    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
  • branches/network/src/story_entities/multi_player_world.cc

    r6402 r6404  
    1616
    1717#include "multi_player_world.h"
     18#include "multi_player_world_data.h"
    1819
    19 #include "state.h"
    20 #include "class_list.h"
    21 
     20#include "factory.h"
    2221#include "load_param.h"
    23 #include "fast_factory.h"
    24 #include "factory.h"
    25 
    26 
    27 #include "shell_command.h"
    28 #include "resource_manager.h"
    29 #include "state.h"
    30 
    31 #include "game_loader.h"
    32 #include "glmenu_imagescreen.h"
    33 
    34 #include "p_node.h"
    35 #include "world_entity.h"
    36 #include "player.h"
    37 #include "camera.h"
    38 #include "environment.h"
    39 #include "terrain.h"
    40 
    41 
    4222
    4323
    4424using namespace std;
     25
    4526
    4627//! This creates a Factory to fabricate a MultiPlayerWorld
     
    5334  this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");
    5435
    55   this->path = NULL;
    56 
     36  this->multiPlayerWorldData = new MultiPlayerWorldData();
    5737  this->loadParams(root);
    5838}
     
    6848{
    6949  PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
    70 }
    71 
    72 
    73 /**
    74  * initializes the world.
    75  * @param name the name of the world
    76  * @param worldID the ID of this world
    77  *
    78  * set all stuff here that is world generic and does not use to much memory
    79  * because the real init() function StoryEntity::init() will be called
    80  * shortly before start of the game.
    81  * since all worlds are initiated/referenced before they will be started.
    82  * NO LEVEL LOADING HERE - NEVER!
    83 */
    84 void MultiPlayerWorld::constuctorInit(const char* name, int worldID)
    85 {
    86   this->gameTime = 0.0f;
    87   this->setSpeed(1.0);
    88   this->shell = NULL;
    89 
    90   this->showPNodes = false;
    91   this->showBV = false;
     50  if( this->multiPlayerWorldData)
     51    delete this->multiPlayerWorldData;
    9252}
    9353
     
    10767
    10868
    109 /**
    110  *  loads the GameWorld by initializing all resources, and set their default values.
    111  */
    112 ErrorMessage MultiPlayerWorld::load()
    113 {
    114 
    115   ////////////////////////////
    116   // Loading Spawning Point //
    117   ////////////////////////////
    118 //   element = root->FirstChildElement("SpawningPoints");
    119 //   if( element == NULL)
    120 //   {
    121 //     PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
    122 //   }
    123 //   else
    124 //   {
    125 //     element = element->FirstChildElement();
    126 //       // load Players/Objects/Whatever
    127 //     PRINTF(4)("Loading Spawning Points\n");
    128 //     while( element != NULL)
    129 //     {
    130 //       BaseObject* created = Factory::fabricate(element);
    131 //       if( created != NULL )
    132 //       {
    133 // //        if(created->isA(CL_SPAWNING_POINT))
    134 // //          this->spawn(dynamic_cast<WorldEntity*>(created));
    135 //         printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
    136 //       }
    137 //
    138 //
    139 //       element = element->NextSiblingElement();
    140 //       glmis->step(); //! @todo temporary
    141 //     }
    142 //     PRINTF(4)("Done loading NetworkWorldEntities\n");
    143 //   }
    144 //
    145 //
    146 //   ////////////////////////
    147 //   // find WorldEntities //
    148 //   ////////////////////////
    149 //   element = root->FirstChildElement("WorldEntities");
    150 //   if( element == NULL)
    151 //   {
    152 //     PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");
    153 //   }
    154 //   else
    155 //   {
    156 //     element = element->FirstChildElement();
    157 //       // load Players/Objects/Whatever
    158 //     PRINTF(4)("Loading NetworkWorldEntities\n");
    159 //     while( element != NULL)
    160 //     {
    161 //       if( NetworkManager::getInstance()->isGameServer())
    162 //       {
    163 //
    164 //         BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);
    165 //         if( created != NULL )
    166 //         {
    167 // //          if(created->isA(CL_WORLD_ENTITY))
    168 // //            this->spawn(dynamic_cast<WorldEntity*>(created));
    169 //           printf("Created a %s: %s\n", created->getClassName(), created->getName());
    170 //         }
    171 //         else
    172 //           PRINTF(1)("NetworkWorld: could not create this entity\n");
    173 //
    174 //           // if we load a 'Player' we use it as localPlayer
    175 //
    176 //
    177 //           //todo do this more elegant
    178 //         if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
    179 //           sky = dynamic_cast<WorldEntity*>(created);
    180 //         if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    181 //         {
    182 //           terrain = dynamic_cast<Terrain*>(created);
    183 //           CDEngine::getInstance()->setTerrain(terrain);
    184 //
    185 //         }
    186 //
    187 //       }
    188 //       else if( /* !strcmp( element->Value(), "SkyBox") || */ /* !strcmp( element->Value(), "Terrain") || */ !strcmp( element->Value(), "SpaceShip"))
    189 //       {
    190 //         BaseObject* created = Factory::fabricate(element);
    191 //         if( created != NULL )
    192 //         {
    193 // //          if(created->isA(CL_WORLD_ENTITY))
    194 // //            this->spawn(dynamic_cast<WorldEntity*>(created));
    195 //           printf("Created a %s: %s\n", created->getClassName(), created->getName());
    196 //         }
    197 //         else
    198 //           PRINTF(1)("NetworkWorld: could not create this entity\n");
    199 //
    200 //           // if we load a 'Player' we use it as localPlayer
    201 //
    202 //
    203 //           //todo do this more elegant
    204 //         if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
    205 //           sky = dynamic_cast<WorldEntity*>(created);
    206 //         if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    207 //         {
    208 //           terrain = dynamic_cast<Terrain*>(created);
    209 //           CDEngine::getInstance()->setTerrain(terrain);
    210 //         }
    211 //       }
    212 //       element = element->NextSiblingElement();
    213 //       glmis->step(); //! @todo temporary
    214 //       PRINTF(4)("Done loading NetworkWorldEntities\n");
    215 //     }
    216   }
    21769
    21870
    219 
    220 
  • branches/network/src/story_entities/multi_player_world.h

    r6366 r6404  
    1111
    1212class TiXmlElement;
     13class MultiPlayerWorldData;
    1314
    1415
     
    2627  void loadParams(const TiXmlElement* root);
    2728
    28   virtual ErrorMessage load();
    29 
    3029  private:
    31     void constuctorInit(const char* name, int worldID);
    32 
     30    MultiPlayerWorldData*    multiPlayerWorldData;    //!< reference to the datatank
    3331};
    3432
  • branches/network/src/story_entities/single_player_world.cc

    r6402 r6404  
    1616
    1717#include "single_player_world.h"
     18#include "single_player_world_data.h"
    1819
    1920#include "state.h"
     
    4243
    4344  this->loadParams(root);
     45
     46  this->singlePlayerWorldData = new SinglePlayerWorldData();
    4447}
    4548
     
    6871}
    6972
    70 
    71 
    72 
    73 // ErrorMessage SinglePlayerWorld::load()
    74 // {
    75 //   static_cast<GameWorld*>(this)->load();
    76 //
    77 //   /* the the single player specific stuff here */
    78 //
    79 //   /* some static world entities */
    80 //   for(int i = 0; i < 100; i++)
    81 //   {
    82 //     WorldEntity* tmp = new NPCTest1();
    83 //     char npcChar[10];
    84 //     sprintf (npcChar, "NPC_%d", i);
    85 //     tmp->setName(npcChar);
    86 //     tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
    87 //     this->spawn(tmp);
    88 //   }
    89 // }
    90 
  • branches/network/src/story_entities/single_player_world.h

    r6374 r6404  
    1111
    1212class TiXmlElement;
     13class SinglePlayerWorldData;
    1314
    1415
     
    2829
    2930  private:
    30 
     31    SinglePlayerWorldData*        singlePlayerWorldData;             //!< reference to the data tank
    3132};
    3233
Note: See TracChangeset for help on using the changeset viewer.