Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/story_entities/single_player_world.cc @ 6371

Last change on this file since 6371 was 6365, checked in by patrick, 18 years ago

network: the network branche works again

File size: 2.7 KB
RevLine 
[4555]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
[1853]13*/
14
[3590]15#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
16
[6358]17#include "single_player_world.h"
[3608]18
[4347]19#include "state.h"
[6358]20#include "class_list.h"
[4347]21
[4726]22#include "load_param.h"
[4940]23#include "fast_factory.h"
[4261]24#include "factory.h"
[4245]25
[6360]26#include "world_entity.h"
27#include "npcs/npc_test1.h"
[4504]28
[4747]29
[6358]30using namespace std;
[4820]31
[6358]32//! This creates a Factory to fabricate a SinglePlayerWorld
[6360]33CREATE_FACTORY(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD);
[5915]34
[5996]35
[5205]36
[6358]37SinglePlayerWorld::SinglePlayerWorld(const TiXmlElement* root)
38  : GameWorld(root)
[4010]39{
[4261]40  this->loadParams(root);
[4010]41}
42
[6358]43
[4555]44/**
[6358]45 *  remove the SinglePlayerWorld from memory
[6150]46 *
47 *  delete everything explicitly, that isn't contained in the parenting tree!
48 *  things contained in the tree are deleted automaticaly
[4838]49 */
[6358]50SinglePlayerWorld::~SinglePlayerWorld ()
[1872]51{
[6358]52  PRINTF(3)("SinglePlayerWorld::~SinglePlayerWorld() - deleting current world\n");
53}
[3677]54
[5115]55
[3526]56/**
[4978]57 * initializes the world.
58 * @param name the name of the world
59 * @param worldID the ID of this world
60 *
61 * set all stuff here that is world generic and does not use to much memory
62 * because the real init() function StoryEntity::init() will be called
63 * shortly before start of the game.
64 * since all worlds are initiated/referenced before they will be started.
65 * NO LEVEL LOADING HERE - NEVER!
[3526]66*/
[6358]67void SinglePlayerWorld::constuctorInit(const char* name, int worldID)
[3526]68{
[6358]69  this->setClassID(CL_SINGLE_PLAYER_WORLD, "SinglePlayerSinglePlayerWorld");
70  this->setName(name);
[2636]71
[5211]72  this->gameTime = 0.0f;
[5205]73  this->setSpeed(1.0);
[4961]74  this->music = NULL;
[5211]75  this->shell = NULL;
[5915]76  this->localPlayer = NULL;
77  this->localCamera = NULL;
[5389]78
79  this->showPNodes = false;
[5429]80  this->showBV = false;
[3629]81}
[3526]82
[6358]83
[4978]84/**
[6358]85 * loads the parameters of a SinglePlayerWorld from an XML-element
[4978]86 * @param root the XML-element to load from
87 */
[6358]88void SinglePlayerWorld::loadParams(const TiXmlElement* root)
[4261]89{
[6364]90  static_cast<GameWorld*>(this)->loadParams(root);
[4261]91
[6358]92  PRINTF(4)("Creating a SinglePlayerWorld\n");
93}
[4834]94
95
[4261]96
[4829]97
[6365]98// ErrorMessage SinglePlayerWorld::load()
99// {
100//   static_cast<GameWorld*>(this)->load();
101//
102//   /* the the single player specific stuff here */
103//
104//   /* some static world entities */
105//   for(int i = 0; i < 100; i++)
106//   {
107//     WorldEntity* tmp = new NPCTest1();
108//     char npcChar[10];
109//     sprintf (npcChar, "NPC_%d", i);
110//     tmp->setName(npcChar);
111//     tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
112//     this->spawn(tmp);
113//   }
114// }
[3526]115
Note: See TracBrowser for help on using the repository browser.