Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8904 in orxonox.OLD


Ignore:
Timestamp:
Jun 29, 2006, 1:40:35 PM (18 years ago)
Author:
bottac
Message:

bugfix

Location:
branches/single_player_map/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/graphics/importer/bsp_file.cc

    r8894 r8904  
    4646BspFile::BspFile()
    4747{}
     48
     49BspFile::~ BspFile()
     50{
     51  delete [] nodes;
     52  delete [] leaves;
     53  delete [] planes;
     54  delete [] bspModels;
     55  delete [] leafFaces;
     56  delete [] faces;
     57  delete [] leafBrushes;
     58  delete [] brushes;
     59  delete [] brushSides;
     60  delete [] vertice;
     61  delete [] meshverts;
     62  delete [] visData;
     63  delete [] textures;
     64  delete [] patchVertice;
     65  delete [] patchIndexes;
     66 // delete [] patchTrianglesPerRow;
     67  delete [] lightMaps;
     68 
     69  for(int i = 0; i < this->numPatches; ++i) delete this->VertexArrayModels[i];
     70 // delete  [] VertexArrayModels;
     71 
     72  for(int i = 0; i < this->numTextures; ++i)
     73  {
     74    delete this->Materials[i].mat;
     75    //delete this->Materials[i].aviMat;
     76  }
     77  delete [] this->Materials;
     78  //delete [] testSurf;
     79 
     80 
     81 
     82}
    4883
    4984/**
     
    294329    this->patchVertice = new char[8*8*44*(this->numPatches+10)];
    295330    this->patchIndexes = new char[7*8*2*4*(this->numPatches+10)];
    296     this->patchRowIndexes = new int*[7*4*this->numPatches];
     331 // this->patchRowIndexes = new int*[7*4*this->numPatches]; Not needed?
    297332    this->patchTrianglesPerRow = new char[7*4*this->numPatches];
    298333    this->VertexArrayModels  = new VertexArrayModel*[this->numPatches];
     
    464499
    465500    if(File(absFileName).exists()) {
    466       PRINTF(0)("BSP FILE: gefunden . \n");
     501      PRINTF(4)("BSP FILE: gefunden . \n");
    467502      this->Materials[i] = this->loadAVI(fileName);
    468503      continue;
     
    553588    }
    554589
    555     PRINTF(0)("BSP FILE: Textur %s nicht  gefunden . \n", &this->textures[8+72*i]);
     590    PRINTF(0)("BSP FILE: Texture %s not found.",&this->textures[8+ 72*i] );
    556591    //  Default Material
    557592    this->Materials[i].mat = new Material();
     
    10121047  Face->meshvert = patchOffset -sz;  //3*(patchOffset-sz)*level1*level1;
    10131048  Face->n_meshverts = sz;
    1014   PRINTF(4)("BSP FILE: sz: %i. \n", sz);
    1015   PRINTF(4)("BSP FILE: Face->meshvert %i . \n", Face->meshvert);
     1049  PRINTF(0)("BSP FILE: sz: %i. \n", sz);
     1050  PRINTF(0)("BSP FILE: Face->meshvert %i . \n", Face->meshvert);
    10161051
    10171052  //Face->n_meshverts = sz;
  • branches/single_player_map/src/lib/graphics/importer/bsp_file.h

    r8490 r8904  
    151151public:
    152152  BspFile();
     153  ~BspFile();
    153154  int read(const char* name );
    154155  void build_tree();
     
    183184
    184185  int** patchRowIndexes;
    185   VertexArrayModel** VertexArrayModels;
     186  VertexArrayModel** VertexArrayModels; 
    186187  int patchOffset;
    187188
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r8894 r8904  
    7777} */
    7878
    79 void BspManager::load(const char* fileName, float scale)
     79BspManager::~BspManager()
     80{
     81  if(this->bspFile)
     82    delete this->bspFile;
     83}
     84 
     85int BspManager::load(const char* fileName, float scale)
    8086{
    8187  // open a BSP file
     88 
     89 
    8290  this->bspFile = new BspFile();
    8391  this->bspFile->scale =  scale;
    84   this->bspFile->read(ResourceManager::getFullName(fileName).c_str());
     92  if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1)
     93    return -1;
    8594  this->bspFile->build_tree();
    8695  this->root  = this->bspFile->get_root();
     
    8897
    8998  this->outputFraction = 1.0f;
     99 
     100  return 0;
    90101}
    91102/*
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.h

    r8724 r8904  
    4141class WorldEntity;
    4242
     43
     44// Obsolete
    4345struct BspCollisionEvent
    4446{
     
    5456
    5557  BspManager(const char* fileName, float scale = 0.4f);
    56   void load(const char* fileName, float scale);
     58 
     59  // Deconstructor
     60  ~BspManager();
     61 
     62 
    5763
    5864  // Functions
     65  int load(const char* fileName, float scale);
    5966  const void draw();
    6067  const void tick(float time);
  • branches/single_player_map/src/world_entities/bsp_entity.cc

    r8490 r8904  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3 
     3 
    44   Copyright (C) 2004 orx
    5 
     5 
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10 
     10 
    1111   ### File Specific:
    1212   main-programmer: Claudio Botta
     
    1515
    1616#include "bsp_entity.h"
     17#include "util/loading/resource_manager.h"
    1718#include "util/loading/resource_manager.h"
    1819
     
    4344
    4445
     46
    4547/**
    4648 * initializes the BspEntity
     
    5052{
    5153  this->setClassID(CL_BSP_ENTITY, "BspEntity");
    52 
    53   this->bspManager = new BspManager(this);
    54   this->toList(OM_ENVIRON);
    55 
     54  this->bspManager = NULL;
    5655  /**
    5756   * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
     
    6463  PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());
    6564
    66   this->bspManager->load(name.c_str(), 0.1f);
     65  // Check wether file exists....
     66  if ( File(ResourceManager::getFullName(name)).exists()  ){
     67    // War das Laden erfolgreich?
     68    this->bspManager = new BspManager(this);
     69    if(this->bspManager->load(name.c_str(), 0.1f) == -1 ) {
     70      this->bspManager = NULL;
     71      // Dont do anything
     72    } else {
     73
     74     
     75      this->toList(OM_ENVIRON); // Success!!!
     76    }
     77  } else {
     78    this->toList(OM_DEAD);
     79  }
    6780}
    6881
     
    7689{
    7790  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
    78  // WorldEntity::loadParam(root);
     91  // WorldEntity::loadParam(root);
    7992
    8093  LoadParam(root, "Name", this, BspEntity, setName)
    81       .describe("Sets the of the BSP file.");
     94  .describe("Sets the of the BSP file.");
    8295
    83 /*  LoadParam(root, "Scale", this, BSpEntity, setScale)
    84       .describe("Sets the scale factore of the bsp level.");
    85 */
     96  /*  LoadParam(root, "Scale", this, BSpEntity, setScale)
     97        .describe("Sets the scale factore of the bsp level.");
     98  */
    8699
    87100  /**
     
    115128 */
    116129void BspEntity::collidesWith (WorldEntity* entity, const Vector& location)
    117 {
    118 
    119 }
     130{}
Note: See TracChangeset for help on using the changeset viewer.