Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4091 in orxonox.OLD


Ignore:
Timestamp:
May 6, 2005, 8:02:26 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now All options get loaded in new style (be aware, quiting only works with ESCAPE, not q, but of corse you can change this now in the GUI

Location:
orxonox/trunk/src
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r4057 r4091  
    131131                 defs/error.h \
    132132                 defs/debug.h \
     133                 defs/globals.h \
    133134                 lib/coord/p_node.h \
    134135                 lib/coord/null_parent.h \
  • orxonox/trunk/src/Makefile.in

    r4061 r4091  
    372372                 defs/error.h \
    373373                 defs/debug.h \
     374                 defs/globals.h \
    374375                 lib/coord/p_node.h \
    375376                 lib/coord/null_parent.h \
  • orxonox/trunk/src/command_node.cc

    r4089 r4091  
    126126  // create parser
    127127  IniParser parser (filename);
    128   if( parser.getSection ("player1") == -1)
    129     {
    130       PRINTF(1)("Could not find key bindings in %s\n", filename);
     128  if( parser.getSection (CONFIG_SECTION_PLAYER "1") == -1)
     129    {
     130      PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1 in %s\n", filename);
    131131      return;
    132132    }
     
    162162
    163163  // PARSE MISC SECTION
    164   if( parser.getSection ("miscKeys") == -1)
     164  if( parser.getSection (CONFIG_SECTION_MISC_KEYS) == -1)
    165165    {
    166166      PRINTF(1)("Could not find key bindings in %s\n", filename);
  • orxonox/trunk/src/defs/stdincl.h

    r4010 r4091  
    2525#include "error.h"
    2626#include "debug.h"
     27#include "globals.h"
    2728
    2829#include "compiler.h"
  • orxonox/trunk/src/game_loader.cc

    r4020 r4091  
    214214bool GameLoader::worldCommand (Command* cmd)
    215215{
    216   if( !strcmp( cmd->cmd, "up_world"))
     216  if( !strcmp( cmd->cmd, CONFIG_NAME_NEXT_WORLD))
    217217    {
    218218      if( !cmd->bUp)
     
    222222      return true;
    223223    }
    224   else if( !strcmp( cmd->cmd, "down_world"))
     224  else if( !strcmp( cmd->cmd, CONFIG_NAME_PREV_WORLD))
    225225    {
    226226      if( !cmd->bUp)
     
    230230      return true;
    231231    }
    232   else if( !strcmp( cmd->cmd, "pause"))
     232  else if( !strcmp( cmd->cmd, CONFIG_NAME_PAUSE))
    233233    {
    234234      if( !cmd->bUp)
     
    241241      return true;
    242242    }
    243   else if( !strcmp( cmd->cmd, "quit"))
     243  else if( !strcmp( cmd->cmd, CONFIG_NAME_QUIT))
    244244    {
    245245      if( !cmd->bUp) this->stop();
  • orxonox/trunk/src/lib/gui/gui/gui_audio.cc

    r4056 r4091  
    3636
    3737  audioFrame = new Frame("Audio-Options:");
    38   audioFrame->setGroupName("audio");
     38  audioFrame->setGroupName(CONFIG_SECTION_AUDIO);
    3939  {
    4040    Box* audioBox;            //!< The Box that holds the audio Options.
     
    4545      Slider* effectsVolume;    //!< A Slider for effects volume.
    4646     
    47       enableSound = new CheckButton("Disable Sound");
     47      enableSound = new CheckButton(CONFIG_NAME_DISABLE_AUDIO);
    4848      enableSound->setFlagName ("no-sound", 0);
    4949      enableSound->saveability();
    5050      audioBox->fill(enableSound);
    51       Label* musicVolumeLabel = new Label("Music Volume");
     51      Label* musicVolumeLabel = new Label(CONFIG_NAME_MUSIC_VOLUME);
    5252      audioBox->fill(musicVolumeLabel);
    5353      musicVolume = new Slider("Music Volume", 0, 100);
     
    5555      musicVolume->saveability();
    5656      audioBox->fill (musicVolume);
    57       Label* effectsVolumeLabel = new Label ("Effects Volume");
     57      Label* effectsVolumeLabel = new Label (CONFIG_NAME_EFFECTS_VOLUME);
    5858      audioBox->fill (effectsVolumeLabel);
    5959      effectsVolume = new Slider ("Effects Volume", 0, 100);
  • orxonox/trunk/src/lib/gui/gui/gui_exec.cc

    r4071 r4091  
    5353
    5454    execBox = new Box('v');
    55     execFrame->setGroupName("misc");
     55    execFrame->setGroupName(CONFIG_SECTION_MISC);
    5656    {
    5757      Button* start;               //!< The start Button of orxonox.
     
    6565#endif /* HAVE_GTK2 */
    6666      execBox->fill(start);
    67       this->saveSettings = new CheckButton("Save Settings");
     67      this->saveSettings = new CheckButton(CONFIG_NAME_SAVE_SETTINGS);
    6868      this->saveSettings->value = 1;
    6969      this->saveSettings->saveability();
    7070      execBox->fill(this->saveSettings);
    7171
    72       verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem");
     72      verboseMode = new Menu(CONFIG_NAME_VERBOSE_MODE, "nothing", "error", "warning", "info", "lastItem");
    7373      verboseMode->setFlagName("verbose", "v", 2);
    7474      verboseMode->saveability();
    7575      execBox->fill(verboseMode);
    7676
    77       alwaysShow = new CheckButton("Always Show this Menu");
     77      alwaysShow = new CheckButton(CONFIG_NAME_ALWAYS_SHOW_GUI);
    7878      alwaysShow->setFlagName("gui", "g", 0);
    7979      alwaysShow->saveability();
  • orxonox/trunk/src/lib/gui/gui/gui_gtk.h

    r4089 r4091  
    1111
    1212#include "debug.h"
     13#include "globals.h"
    1314
    1415#ifdef HAVE_GTK2
  • orxonox/trunk/src/lib/gui/gui/gui_keys.cc

    r4089 r4091  
    5050        PlayerKeys* player2;       //!< The seconds Player's keys.
    5151       
    52         player1 = new PlayerKeys("player1");
    53         player2 = new PlayerKeys("player2");
     52        player1 = new PlayerKeys(CONFIG_SECTION_PLAYER "1");
     53        player2 = new PlayerKeys(CONFIG_SECTION_PLAYER "2");
    5454       
    5555        keysBox1->fill(player1->getOpenButton());
     
    115115
    116116        pKeysBox->setGroupName(player);
    117         pKeysBox->fill(addKey("up", "UP"));
    118         pKeysBox->fill(addKey("down", "DOWN"));
    119         pKeysBox->fill(addKey("left", "LEFT"));
    120         pKeysBox->fill(addKey("right", "RIGHT"));
    121         pKeysBox->fill(addKey("fire", "SPACE"));
     117        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_UP, "UP"));
     118        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_DOWN, "DOWN"));
     119        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_LEFT, "LEFT"));
     120        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_RIGHT, "RIGHT"));
     121        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_FIRE, "SPACE"));
     122        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_NEXT_WEAPON, "m"));
     123        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_PREV_WEAPON, "n"));
    122124        closeButton = new Button("close");
    123125#ifdef HAVE_GTK2
     
    174176        Button* closeButton;    //!< The CloseButton for this key-settings.
    175177
    176         keysBox->setGroupName("miscKeys");
    177         keysBox->fill(addKey( "quit", "ESCAPE"));
    178         keysBox->fill(addKey("pause", "PAUSE"));
    179         keysBox->fill(addKey("up_world", "x"));
    180         keysBox->fill(addKey("down_world", "z"));
    181         keysBox->fill(addKey("view0", "1"));
    182         keysBox->fill(addKey("view1", "2"));
    183         keysBox->fill(addKey("view2", "3"));
    184         keysBox->fill(addKey("view3", "4"));
    185         keysBox->fill(addKey("view4", "5"));
    186         keysBox->fill(addKey("view5", "6"));
     178        keysBox->setGroupName(CONFIG_SECTION_MISC_KEYS);
     179        keysBox->fill(addKey(CONFIG_NAME_QUIT , "ESCAPE"));
     180        keysBox->fill(addKey(CONFIG_NAME_PAUSE, "PAUSE"));
     181        keysBox->fill(addKey(CONFIG_NAME_NEXT_WORLD, "x"));
     182        keysBox->fill(addKey(CONFIG_NAME_PREV_WORLD, "z"));
     183        keysBox->fill(addKey(CONFIG_NAME_VIEW0, "1"));
     184        keysBox->fill(addKey(CONFIG_NAME_VIEW1, "2"));
     185        keysBox->fill(addKey(CONFIG_NAME_VIEW2, "3"));
     186        keysBox->fill(addKey(CONFIG_NAME_VIEW3, "4"));
     187        keysBox->fill(addKey(CONFIG_NAME_VIEW4, "5"));
     188        keysBox->fill(addKey(CONFIG_NAME_VIEW5, "6"));
    187189
    188190        closeButton = new Button("close");
  • orxonox/trunk/src/lib/gui/gui/gui_update.cc

    r4083 r4091  
    5050
    5151  this->updateFrame = new Frame("Update-Options:");
    52   this->updateFrame->setGroupName("update");
     52  this->updateFrame->setGroupName(CONFIG_SECTION_DATA);
    5353  this->updateBox = new Box('v');
    5454
    55   dataDirButton = new Button("Data Directory");
    56   dataDirLabel = new OptionLabel("DataDir", "unknown");
     55  dataDirButton = new Button(CONFIG_NAME_DATADIR);
     56  dataDirLabel = new OptionLabel(CONFIG_NAME_DATADIR, "unknown");
    5757  dataDirLabel->saveability();
    5858  dataDirDialog = new FileDialog("data-Repos-location");
     
    7070
    7171  // the Button for autoUpdating
    72   this->autoUpdate = new CheckButton("auto update");
     72  this->autoUpdate = new CheckButton(CONFIG_NAME_AUTO_UPDATE);
    7373  this->updateBox->fill(this->autoUpdate);
    7474  this->autoUpdate->setFlagName("update", "u", 0);
  • orxonox/trunk/src/lib/gui/gui/gui_video.cc

    r4068 r4091  
    4949      CheckButton* wireframe;   //!< CheckButton for wireframe Mode.
    5050
    51       fullscreen = new CheckButton("Fullscreen-mode");
     51      fullscreen = new CheckButton(CONFIG_NAME_FULLSCREEN);
    5252      fullscreen->setFlagName("windowed", "q", 1);
    5353      fullscreen->saveability();
    5454      videoBox->fill(fullscreen);
    55       resolution = new Menu("Resolution");
     55      resolution = new Menu(CONFIG_NAME_RESOLUTION);
    5656      getResolutions(resolution);
    5757      resolution->saveability();
    5858      resolution->setFlagName("resolution", "r", 0);
    5959      videoBox->fill(resolution);
    60       wireframe = new CheckButton("WireFrame-mode");
     60      wireframe = new CheckButton(CONFIG_NAME_WIREFRAME);
    6161      wireframe->setFlagName("wireframe", "w", 0);
    6262      wireframe->saveability();
     
    9191  // the Window itself
    9292  advancedWindow = new Window("Advanced Video Options");
    93   advancedWindow->setGroupName("advancedVideoOptions");
     93  advancedWindow->setGroupName(CONFIG_SECTION_VIDEO_ADVANCED);
    9494  {
    9595    Box* advancedBox;         //!< A Box to pack the options into.
     
    111111
    112112      // Advanced Performance Options
    113       shadows = new CheckButton("Shadows");
     113      shadows = new CheckButton(CONFIG_NAME_SHADOWS);
    114114      shadows->saveability();
    115115      advancedBox->fill(shadows);
    116116     
    117       fog = new CheckButton("Fog");
     117      fog = new CheckButton(CONFIG_NAME_FOG);
    118118      fog->saveability();
    119119      advancedBox->fill(fog);
    120120     
    121       reflections = new CheckButton("Reflections");
     121      reflections = new CheckButton(CONFIG_NAME_REFLECTIONS);
    122122      reflections->saveability();
    123123      advancedBox->fill(reflections);
    124124     
    125       textures = new CheckButton("Textures");
     125      textures = new CheckButton(CONFIG_NAME_TEXTURES);
    126126      textures->saveability();
    127127      advancedBox->fill(textures);
    128128     
    129       textureDetail = new Menu("Texture Detail", "low", "medium", "high", "lastItem");
     129      textureDetail = new Menu(CONFIG_NAME_TEXTURE_DETAIL, "low", "medium", "high", "lastItem");
    130130      textureDetail->setDefaultValue(1);
    131131      textureDetail->saveability();
    132132      advancedBox->fill(textureDetail);
    133133     
    134       modelDetailLabel = new Label("Model Detail");
     134      modelDetailLabel = new Label(CONFIG_NAME_MODEL_DETAIL);
    135135      advancedBox->fill(modelDetailLabel);
    136       modelDetail = new Menu("Model Detail", "low", "high", "lastItem");
     136      modelDetail = new Menu(CONFIG_NAME_MODEL_DETAIL, "low", "high", "lastItem");
    137137      modelDetail->setDefaultValue(1);
    138138      modelDetail->saveability();
     
    141141      antiAliasingLabel = new Label("Anti-Aliasing-depth:");
    142142      advancedBox->fill(antiAliasingLabel);
    143       antiAliasing = new Menu("Anti Aliasing", "0", "1", "2", "4", "8",  "lastItem");
     143      antiAliasing = new Menu(CONFIG_NAME_ANTI_ALIASING, "0", "1", "2", "4", "8",  "lastItem");
    144144      antiAliasing->setDefaultValue(2);
    145145      antiAliasing->saveability();
     
    148148      filterMethodLabel = new Label("Filtering Method:");
    149149      advancedBox->fill(filterMethodLabel);
    150       filterMethod = new Menu("Filtering Method", "none", "linear", "bilinear", "trilinear", "anisortopic", "lastItem");
     150      filterMethod = new Menu(CONFIG_NAME_FILTER_METHOD, "none", "linear", "bilinear", "trilinear", "anisortopic", "lastItem");
    151151      filterMethod->setDefaultValue(1);
    152152      filterMethod->saveability();
  • orxonox/trunk/src/orxonox.cc

    r4084 r4091  
    3232#include "data_tank.h"
    3333#include "command_node.h"
     34#include "ini_parser.h"
    3435#include "game_loader.h"
    3536#include "graphics_engine.h"
     
    173174int Orxonox::initResources()
    174175{
    175   //  printf("Not yet implemented\n");
    176176  PRINT(3)("initializing ResourceManager\n");
    177177  resourceManager = ResourceManager::getInstance();
    178   if (!resourceManager->setDataDir("../data/"))
    179     {
    180       PRINTF(1)("Data Could not be located\n");
     178
     179  // create parser
     180  IniParser parser (DEFAULT_CONFIG_FILE);
     181  if( parser.getSection (CONFIG_SECTION_DATA) == -1)
     182    {
     183      PRINTF(1)("Could not find Section %s in %s\n", CONFIG_SECTION_DATA, DEFAULT_CONFIG_FILE);
     184      return -1;
     185    }
     186  char namebuf[256];
     187  char valuebuf[256];
     188  memset (namebuf, 0, 256);
     189  memset (valuebuf, 0, 256);
     190 
     191  while( parser.nextVar (namebuf, valuebuf) != -1)
     192    {
     193      if (!strcmp(namebuf, CONFIG_NAME_DATADIR))
     194        {
     195          //  printf("Not yet implemented\n");
     196          if (!resourceManager->setDataDir(valuebuf))
     197            {
     198              PRINTF(1)("Data Could not be located\n");
     199              exit(-1);
     200            }
     201        }
     202     
     203      memset (namebuf, 0, 256);
     204      memset (valuebuf, 0, 256);
     205    }
     206 
     207  if (!resourceManager->checkDataDir(DEFAULT_DATA_DIR_CHECKFILE))
     208    {
     209      PRINTF(1)("The DataDirectory %s could not be verified\nPlease Change in File %s Section %s Entry %s to a suitable value\n",
     210                resourceManager->getDataDir(),
     211                DEFAULT_CONFIG_FILE,
     212                CONFIG_SECTION_DATA,
     213                CONFIG_NAME_DATADIR);
    181214      exit(-1);
    182215    }
     216
    183217
    184218  PRINT(3)("initializing TextEngine\n");
  • orxonox/trunk/src/story_entities/world.cc

    r4015 r4091  
    12191219bool World::command(Command* cmd)
    12201220{
    1221   if( !strcmp( cmd->cmd, "view0")) this->localCamera->setViewMode(VIEW_NORMAL);
    1222   else if( !strcmp( cmd->cmd, "view1")) this->localCamera->setViewMode(VIEW_BEHIND);
    1223   else if( !strcmp( cmd->cmd, "view2")) this->localCamera->setViewMode(VIEW_FRONT);
    1224   else if( !strcmp( cmd->cmd, "view3")) this->localCamera->setViewMode(VIEW_LEFT);
    1225   else if( !strcmp( cmd->cmd, "view4")) this->localCamera->setViewMode(VIEW_RIGHT);
    1226   else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);
     1221  if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW0)) this->localCamera->setViewMode(VIEW_NORMAL);
     1222  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW1)) this->localCamera->setViewMode(VIEW_BEHIND);
     1223  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW2)) this->localCamera->setViewMode(VIEW_FRONT);
     1224  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW3)) this->localCamera->setViewMode(VIEW_LEFT);
     1225  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW4)) this->localCamera->setViewMode(VIEW_RIGHT);
     1226  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW5)) this->localCamera->setViewMode(VIEW_TOP);
    12271227
    12281228  return false;
  • orxonox/trunk/src/util/resource_manager.cc

    r4033 r4091  
    9999      return false;
    100100    }
     101}
     102
     103/**
     104   \brief checks for the DataDirectory, by looking if
     105   \param fileInside is inisde??
     106*/
     107bool ResourceManager::checkDataDir(const char* fileInside)
     108{
     109  bool retVal;
     110  if (!isDir(this->dataDir))
     111    {
     112      PRINTF(1)("%s is not a directory\n", this->dataDir);
     113      return false;
     114    }
     115 
     116  char* testFile = new char[strlen(this->dataDir)+strlen(fileInside)+1];
     117  sprintf(testFile, "%s%s", this->dataDir, fileInside);
     118  retVal = isFile(testFile);
     119  delete testFile;
     120  return retVal;
    101121}
    102122
  • orxonox/trunk/src/util/resource_manager.h

    r4054 r4091  
    6565
    6666  bool setDataDir(const char* dataDir);
     67  /** \returns the Name of the data directory */
     68  const char*  getDataDir(void) {return this->dataDir;}
     69  bool checkDataDir(const char* fileInside);
    6770  bool addImageDir(char* imageDir);
    6871  void* load(const char* fileName, ResourcePriority prio = RP_NO,
  • orxonox/trunk/src/world_entities/player.cc

    r4010 r4091  
    294294{
    295295  PRINTF(3)("recieved command [%s]\n", cmd->cmd);
    296   if( !strcmp( cmd->cmd, "up")) this->bUp = !cmd->bUp;
    297   if( !strcmp( cmd->cmd, "down")) this->bDown = !cmd->bUp;
    298   if( !strcmp( cmd->cmd, "left")) this->bLeft = !cmd->bUp;
    299   if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
    300   if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
    301   if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
    302 }
     296  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_UP)) this->bUp = !cmd->bUp;
     297  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_DOWN)) this->bDown = !cmd->bUp;
     298  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_LEFT)) this->bLeft = !cmd->bUp;
     299  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_RIGHT)) this->bRight = !cmd->bUp;
     300  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_FIRE)) this->bFire = !cmd->bUp;
     301  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_NEXT_WEAPON)) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
     302}
Note: See TracChangeset for help on using the changeset viewer.