Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2707 in orxonox.OLD for orxonox/branches/buerli/src


Ignore:
Timestamp:
Nov 3, 2004, 12:29:03 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/buerli: merged back from trunk, with new configure makefile and so forth.

Location:
orxonox/branches/buerli/src
Files:
15 edited
7 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/buerli/src/Makefile.in

    r2685 r2707  
    1 # Makefile.in generated by automake 1.7.9 from Makefile.am.
     1# Makefile.in generated by automake 1.8.5 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    5 # Free Software Foundation, Inc.
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004  Free Software Foundation, Inc.
    66# This Makefile.in is free software; the Free Software Foundation
    77# gives unlimited permission to copy and/or distribute it,
     
    1414
    1515@SET_MAKE@
     16
     17
     18SOURCES = $(orxonox_SOURCES)
    1619
    1720srcdir = @srcdir@
     
    2225pkgincludedir = $(includedir)/@PACKAGE@
    2326top_builddir = ..
    24 
    2527am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
    2628INSTALL = @INSTALL@
     
    3638PRE_UNINSTALL = :
    3739POST_UNINSTALL = :
     40bin_PROGRAMS = orxonox$(EXEEXT)
     41subdir = src
     42DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
     43        $(srcdir)/Makefile.in INSTALL
     44ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     45am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     46am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
     47        $(ACLOCAL_M4)
     48mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
     49CONFIG_HEADER = $(top_builddir)/config.h
     50CONFIG_CLEAN_FILES =
     51am__installdirs = "$(DESTDIR)$(bindir)"
     52binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
     53PROGRAMS = $(bin_PROGRAMS)
     54am_orxonox_OBJECTS = orxonox.$(OBJEXT) world.$(OBJEXT) \
     55        player.$(OBJEXT) data_tank.$(OBJEXT) world_entity.$(OBJEXT) \
     56        vector.$(OBJEXT) camera.$(OBJEXT) collision.$(OBJEXT) \
     57        command_node.$(OBJEXT) ini_parser.$(OBJEXT) keynames.$(OBJEXT) \
     58        track.$(OBJEXT) base_entity.$(OBJEXT) IPhys.$(OBJEXT)
     59orxonox_OBJECTS = $(am_orxonox_OBJECTS)
     60orxonox_LDADD = $(LDADD)
     61DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
     62depcomp = $(SHELL) $(top_srcdir)/depcomp
     63am__depfiles_maybe = depfiles
     64@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/IPhys.Po \
     65@AMDEP_TRUE@    ./$(DEPDIR)/base_entity.Po ./$(DEPDIR)/camera.Po \
     66@AMDEP_TRUE@    ./$(DEPDIR)/collision.Po \
     67@AMDEP_TRUE@    ./$(DEPDIR)/command_node.Po \
     68@AMDEP_TRUE@    ./$(DEPDIR)/data_tank.Po ./$(DEPDIR)/ini_parser.Po \
     69@AMDEP_TRUE@    ./$(DEPDIR)/keynames.Po ./$(DEPDIR)/orxonox.Po \
     70@AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/track.Po \
     71@AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \
     72@AMDEP_TRUE@    ./$(DEPDIR)/world_entity.Po
     73CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
     74        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     75CXXLD = $(CXX)
     76CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
     77        -o $@
     78SOURCES = $(orxonox_SOURCES)
     79DIST_SOURCES = $(orxonox_SOURCES)
     80HEADERS = $(noinst_HEADERS)
     81ETAGS = etags
     82CTAGS = ctags
     83DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    3884ACLOCAL = @ACLOCAL@
    3985AMDEP_FALSE = @AMDEP_FALSE@
     
    90136am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
    91137am__include = @am__include@
     138am__leading_dot = @am__leading_dot@
    92139am__quote = @am__quote@
    93140bindir = @bindir@
     
    103150localstatedir = @localstatedir@
    104151mandir = @mandir@
     152mkdir_p = @mkdir_p@
    105153oldincludedir = @oldincludedir@
    106154prefix = @prefix@
     
    112160AM_CXXFLAGS = "-I/usr/X11R6/include"
    113161AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib  -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS)
    114 
    115 
    116 #"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include"
    117 bin_PROGRAMS = orxonox
    118162orxonox_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 IPhys.cc
    119 
    120163noinst_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 IPhys.h
    121 subdir = src
    122 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    123 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
    124 CONFIG_HEADER = $(top_builddir)/config.h
    125 CONFIG_CLEAN_FILES =
    126 bin_PROGRAMS = orxonox$(EXEEXT)
    127 PROGRAMS = $(bin_PROGRAMS)
    128 
    129 am_orxonox_OBJECTS = orxonox.$(OBJEXT) world.$(OBJEXT) player.$(OBJEXT) \
    130         data_tank.$(OBJEXT) world_entity.$(OBJEXT) vector.$(OBJEXT) \
    131         camera.$(OBJEXT) collision.$(OBJEXT) command_node.$(OBJEXT) \
    132         ini_parser.$(OBJEXT) keynames.$(OBJEXT) track.$(OBJEXT) \
    133         base_entity.$(OBJEXT) IPhys.$(OBJEXT)
    134 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    135 orxonox_LDADD = $(LDADD)
    136 orxonox_DEPENDENCIES =
    137 orxonox_LDFLAGS =
    138 
    139 DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
    140 depcomp = $(SHELL) $(top_srcdir)/depcomp
    141 am__depfiles_maybe = depfiles
    142 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/IPhys.Po ./$(DEPDIR)/base_entity.Po \
    143 @AMDEP_TRUE@    ./$(DEPDIR)/camera.Po ./$(DEPDIR)/collision.Po \
    144 @AMDEP_TRUE@    ./$(DEPDIR)/command_node.Po \
    145 @AMDEP_TRUE@    ./$(DEPDIR)/data_tank.Po ./$(DEPDIR)/ini_parser.Po \
    146 @AMDEP_TRUE@    ./$(DEPDIR)/keynames.Po ./$(DEPDIR)/orxonox.Po \
    147 @AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/track.Po \
    148 @AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \
    149 @AMDEP_TRUE@    ./$(DEPDIR)/world_entity.Po
    150 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    151         $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
    152 CXXLD = $(CXX)
    153 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
    154         -o $@
    155 DIST_SOURCES = $(orxonox_SOURCES)
    156 HEADERS = $(noinst_HEADERS)
    157 
    158 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in INSTALL \
    159         Makefile.am
    160 SOURCES = $(orxonox_SOURCES)
    161 
    162164all: all-am
    163165
    164166.SUFFIXES:
    165167.SUFFIXES: .cc .o .obj
    166 $(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
     168$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
     169        @for dep in $?; do \
     170          case '$(am__configure_deps)' in \
     171            *$$dep*) \
     172              cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
     173                && exit 0; \
     174              exit 1;; \
     175          esac; \
     176        done; \
     177        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
    167178        cd $(top_srcdir) && \
    168179          $(AUTOMAKE) --gnu  src/Makefile
    169 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
    170         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
    171 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
     180.PRECIOUS: Makefile
     181Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     182        @case '$?' in \
     183          *config.status*) \
     184            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
     185          *) \
     186            echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
     187            cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
     188        esac;
     189
     190$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
     191        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
     192
     193$(top_srcdir)/configure:  $(am__configure_deps)
     194        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
     195$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
     196        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    172197install-binPROGRAMS: $(bin_PROGRAMS)
    173198        @$(NORMAL_INSTALL)
    174         $(mkinstalldirs) $(DESTDIR)$(bindir)
     199        test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
    175200        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    176201          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    178203          ; then \
    179204            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    180            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
    181            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
     205           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
     206           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
    182207          else :; fi; \
    183208        done
     
    187212        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    188213          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    189           echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
    190           rm -f $(DESTDIR)$(bindir)/$$f; \
     214          echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
     215          rm -f "$(DESTDIR)$(bindir)/$$f"; \
    191216        done
    192217
     
    198223
    199224mostlyclean-compile:
    200         -rm -f *.$(OBJEXT) core *.core
     225        -rm -f *.$(OBJEXT)
    201226
    202227distclean-compile:
     
    219244
    220245.cc.o:
    221 @am__fastdepCXX_TRUE@   if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
    222 @am__fastdepCXX_TRUE@     -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
    223 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
    224 @am__fastdepCXX_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
    225 @am__fastdepCXX_TRUE@   fi
     246@am__fastdepCXX_TRUE@   if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
     247@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
    226248@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    227249@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
    228250@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    229 @am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
     251@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ $<
    230252
    231253.cc.obj:
    232 @am__fastdepCXX_TRUE@   if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
    233 @am__fastdepCXX_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
    234 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
    235 @am__fastdepCXX_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
    236 @am__fastdepCXX_TRUE@   fi
     254@am__fastdepCXX_TRUE@   if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
     255@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
    237256@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    238257@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
    239258@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    240 @am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
     259@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    241260uninstall-info-am:
    242 
    243 ETAGS = etags
    244 ETAGSFLAGS =
    245 
    246 CTAGS = ctags
    247 CTAGSFLAGS =
    248 
    249 tags: TAGS
    250261
    251262ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     
    257268               END { for (i in files) print i; }'`; \
    258269        mkid -fID $$unique
     270tags: TAGS
    259271
    260272TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    268280          $(AWK) '    { files[$$0] = 1; } \
    269281               END { for (i in files) print i; }'`; \
    270         test -z "$(ETAGS_ARGS)$$tags$$unique" \
    271           || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    272              $$tags $$unique
    273 
     282        if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
     283          test -n "$$unique" || unique=$$empty_fix; \
     284          $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     285            $$tags $$unique; \
     286        fi
    274287ctags: CTAGS
    275288CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    294307distclean-tags:
    295308        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
    296 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    297 
    298 top_distdir = ..
    299 distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
    300309
    301310distdir: $(DISTFILES)
     
    311320          if test "$$dir" != "$$file" && test "$$dir" != "."; then \
    312321            dir="/$$dir"; \
    313             $(mkinstalldirs) "$(distdir)$$dir"; \
     322            $(mkdir_p) "$(distdir)$$dir"; \
    314323          else \
    315324            dir=''; \
     
    329338check: check-am
    330339all-am: Makefile $(PROGRAMS) $(HEADERS)
    331 
    332340installdirs:
    333         $(mkinstalldirs) $(DESTDIR)$(bindir)
     341        for dir in "$(DESTDIR)$(bindir)"; do \
     342          test -z "$$dir" || $(mkdir_p) "$$dir"; \
     343        done
    334344install: install-am
    335345install-exec: install-exec-am
     
    370380dvi-am:
    371381
     382html: html-am
     383
    372384info: info-am
    373385
     
    405417.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
    406418        clean-generic ctags distclean distclean-compile \
    407         distclean-generic distclean-tags distdir dvi dvi-am info \
    408         info-am install install-am install-binPROGRAMS install-data \
    409         install-data-am install-exec install-exec-am install-info \
    410         install-info-am install-man install-strip installcheck \
    411         installcheck-am installdirs maintainer-clean \
     419        distclean-generic distclean-tags distdir dvi dvi-am html \
     420        html-am info info-am install install-am install-binPROGRAMS \
     421        install-data install-data-am install-exec install-exec-am \
     422        install-info install-info-am install-man install-strip \
     423        installcheck installcheck-am installdirs maintainer-clean \
    412424        maintainer-clean-generic mostlyclean mostlyclean-compile \
    413425        mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
  • orxonox/branches/buerli/src/camera.cc

    r2551 r2707  
    2727   This standard constructor sets all parameters to zero
    2828*/
    29 Camera::Camera ()
    30 {
     29Camera::Camera (World* world)
     30{
     31  this->world = world;
    3132  bound = NULL;
    3233  /* give it some physical live */
     
    3637  fs = new Vector(0.0, 0.0, 0.0);
    3738  cameraMode = NORMAL;
    38 
    3939  deltaTime = 3000.0;
    4040  cameraOffset = 1.0;
     
    179179      /* the camera is handled like an entity and rolls on the track */
    180180    case NORMAL:
    181       Orxonox *orx = Orxonox::getInstance();
    182181      Location lookat; 
    183       if( bound != NULL)
     182      if( bound != NULL && world != NULL )
    184183        {
    185184          bound->get_lookat (&lookat);
    186           orx->get_world()->calc_camera_pos (&lookat, &desired_place);
     185          world->calc_camera_pos (&lookat, &desired_place);
    187186        }
    188187      else
     
    293292    }
    294293}
     294
     295
     296void Camera::setWorld(World* world)
     297{
     298  this->world = world;
     299}
  • orxonox/branches/buerli/src/camera.h

    r2551 r2707  
    1010
    1111class WorldEntity;
     12class World;
    1213
    1314//! Camera
    1415/**
    15         This class controls the viewpoint from which the World is rendered. To use the
    16         Camera it has to be bound to a WorldEntity which serves as the reference focus
    17         point. The Camera itself calls the WorldEntity::get_lookat() and
    18         World::calc_camera_pos() functions to calculate the position it currently should
    19         be in.
     16   This class controls the viewpoint from which the World is rendered. To use the
     17   Camera it has to be bound to a WorldEntity which serves as the reference focus
     18   point. The Camera itself calls the WorldEntity::get_lookat() and
     19   World::calc_camera_pos() functions to calculate the position it currently should
     20   be in.
    2021*/
    2122
     
    2728  Placement actual_place;               //!< the Camera's current position
    2829  Placement desired_place;        //!< where the Camera should be according to calculations
     30  World* world;
    2931 
    3032  /* physical system - not needed yet */
     
    4951  Quaternion *res;
    5052 
     53 
     54  CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity
     55 
     56  void update_desired_place ();
     57 
     58 public:
     59  Camera (World* world);
     60  ~Camera ();
     61 
     62  void time_slice (Uint32 deltaT);
     63  void apply ();
     64  void bind (WorldEntity* entity);
     65  void jump (Placement* plc);
    5166
    52   CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity
    53 
    54         void update_desired_place ();
    55        
    56  public:
    57   Camera ();
    58   ~Camera ();
    59 
    60         void time_slice (Uint32 deltaT);
    61         void apply ();
    62         void bind (WorldEntity* entity);
    63         void jump (Placement* plc);
     67  void setWorld(World* world); 
    6468
    6569};
  • orxonox/branches/buerli/src/command_node.cc

    r2551 r2707  
    1919#include "ini_parser.h"
    2020#include "world_entity.h"
     21#include "game_loader.h"
    2122
    2223#include <stdio.h>
     
    2728
    2829/**
    29         \brief constructs a CommandNode to handle remote input
    30         \param ID: unique denumerator to identify the node in the network
     30   \brief constructs a CommandNode to handle remote input
     31   \param ID: unique denumerator to identify the node in the network
    3132*/
    3233CommandNode::CommandNode (int ID)
    3334{
    34         bound = new List<WorldEntity>();
    35         aliases = NULL;
    36         netID = ID;
    37         bLocalInput = false;
    38 }
    39 
    40 /**
    41         \brief constructs a CommandNode to handle local input
    42         \param filename: The path and name of the file to load the key bindings from
     35  bound = new List<WorldEntity>();
     36  aliases = NULL;
     37  netID = ID;
     38  bLocalInput = false;
     39}
     40
     41/**
     42   \brief constructs a CommandNode to handle local input
     43   \param filename: The path and name of the file to load the key bindings from
    4344*/
    4445CommandNode::CommandNode (char* filename = DEFAULT_KEYBIND_FILE)
    4546{
    46         aliases = NULL;
    47         bLocalInput = true;
    48         netID = 0;
    49         bound = new List<WorldEntity>();
    50         load_bindings (filename);
    51 }
    52 
    53 /**
    54         \brief removes the CommandNode from memory
     47  aliases = NULL;
     48  bLocalInput = true;
     49  netID = 0;
     50  bound = new List<WorldEntity>();
     51  load_bindings (filename);
     52}
     53
     54/**
     55   \brief removes the CommandNode from memory
    5556*/
    5657CommandNode::~CommandNode ()
    5758{
    58         if( aliases != NULL) free (aliases);
    59         if( bound != NULL) delete bound;
    60 }
    61 
    62 /**
    63         \brief loads new key bindings from a file
    64         \param filename: The path and name of the file to load the bindings from
     59  if( aliases != NULL) free (aliases);
     60  if( bound != NULL) delete bound;
     61}
     62
     63/**
     64   \brief loads new key bindings from a file
     65   \param filename: The path and name of the file to load the bindings from
    6566*/
    6667void CommandNode::load_bindings (char* filename)
    6768{
    68         FILE* stream;
    69        
    70         printf("Loading key bindings from %s\n", filename);
    71        
    72         if( filename == NULL) filename = DEFAULT_KEYBIND_FILE;
    73        
    74                 // remove old bindings if present
    75         if( aliases != NULL)
     69  FILE* stream;
     70 
     71  printf("Loading key bindings from %s\n", filename);
     72 
     73  if( filename == NULL) filename = DEFAULT_KEYBIND_FILE;
     74 
     75  // remove old bindings if present
     76  if( aliases != NULL)
     77    {
     78      free (aliases);
     79      aliases = NULL;
     80    }
     81 
     82  // create parser
     83  IniParser parser (filename);
     84  if( parser.get_section ("Bindings") == -1)
     85    {
     86      printf("Could not find key bindings in %s\n", filename);
     87      return;
     88    }
     89  // allocate empty lookup table
     90  aliases = (KeyBindings*) calloc (1, sizeof (KeyBindings));
     91 
     92  char namebuf[256];
     93  char valuebuf[256];
     94  memset (namebuf, 0, 256);
     95  memset (valuebuf, 0, 256);
     96  int* index;
     97 
     98  while( parser.next_var (namebuf, valuebuf) != -1)
     99    {
     100      index = name_to_index (namebuf);
     101      switch( index[0])
    76102        {
    77                 free (aliases);
    78                 aliases = NULL;
     103        case 0:
     104          printf("Key binding %d(%s) set to %s\n", index[1], SDLK_to_keyname( index[1]), valuebuf);
     105          strcpy (aliases->keys[index[1]], valuebuf);
     106          break;
     107        case 1:
     108          printf("Button binding %d(%s) set to %s\n", index[1], SDLB_to_buttonname( index[1]), valuebuf);
     109          strcpy (aliases->buttons[index[1]], valuebuf);
     110          break;
     111        default:
     112          break;
    79113        }
    80                        
    81                 // create parser
    82         IniParser parser (filename);
    83         if( parser.get_section ("Bindings") == -1)
     114      memset (namebuf, 0, 256);
     115      memset (valuebuf, 0, 256);
     116    }
     117}
     118
     119/**
     120   \brief binds a WorldEntity to the CommandNode
     121   \param entity: Pointer to the entity to bind
     122*/
     123void CommandNode::bind (WorldEntity* entity)
     124{
     125  bound->add (entity, LIST_ADD_NEXT, true);
     126}
     127
     128/**
     129   \brief removes an entity from the list of the CommandNode
     130   \param entity: Pointer to the entity to relese
     131*/
     132void CommandNode::unbind (WorldEntity* entity)
     133{
     134  bound->remove (entity, LIST_FIND_FW);
     135}
     136
     137int* CommandNode::name_to_index (char* name)
     138{
     139  coord[0] = -1;
     140  coord[1] = -1;
     141  int c;
     142  if( (c = keyname_to_SDLK (name)) != -1)
     143    {
     144      coord[1] = c;
     145      coord[0] = 0;
     146    }
     147  if( (c = buttonname_to_SDLB (name)) != -1)
     148    {
     149      coord[1] = c;
     150      coord[0] = 1;
     151    }
     152  return coord;
     153}
     154
     155/**
     156   \brief tells the CommandNode to run through all pending events and relay them accordingly
     157*/
     158void CommandNode::process ()
     159{
     160  if( bLocalInput) process_local ();
     161  else process_network ();
     162}
     163
     164void CommandNode::process_local ()
     165{
     166  SDL_Event event;
     167  Command cmd;
     168 
     169  while( SDL_PollEvent (&event))
     170    {
     171      memset (cmd.cmd, 0, CMD_LENGHT);
     172      switch( event.type)
    84173        {
    85                 printf("Could not find key bindings in %s\n", filename);
    86                 return;
     174        case SDL_KEYDOWN:
     175          strcpy (cmd.cmd, aliases->keys[event.key.keysym.sym]);
     176          cmd.bUp = false;
     177          if( strlen (cmd.cmd) > 0) relay (&cmd);
     178          break;
     179        case SDL_KEYUP:
     180          strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]);
     181          cmd.bUp = true;
     182          if( strlen (cmd.cmd) > 0) relay (&cmd);
     183          break;
     184        case SDL_MOUSEMOTION:
     185          strcpy( cmd.cmd, "cursor");
     186          cmd.x = event.motion.x;
     187          cmd.y = event.motion.y;
     188          cmd.xrel = event.motion.xrel;
     189          cmd.yrel = event.motion.yrel;
     190          break;
     191        case SDL_MOUSEBUTTONUP:
     192          strcpy( cmd.cmd, aliases->buttons[event.button.button]);
     193          cmd.bUp = true;
     194          if( strlen (cmd.cmd) > 0) relay (&cmd);
     195          break;
     196        case SDL_MOUSEBUTTONDOWN:
     197          strcpy( cmd.cmd, aliases->buttons[event.button.button]);
     198          cmd.bUp = false;
     199          if( strlen (cmd.cmd) > 0) relay (&cmd);
     200          break;
     201        case SDL_JOYAXISMOTION:
     202        case SDL_JOYBALLMOTION:
     203        case SDL_JOYHATMOTION:
     204        case SDL_JOYBUTTONDOWN:
     205        case SDL_JOYBUTTONUP:
     206          break;
     207        default:
     208          Orxonox *orx = Orxonox::getInstance();
     209          orx->event_handler (&event);
     210         
     211          break;
    87212        }
    88                         // allocate empty lookup table
    89         aliases = (KeyBindings*) calloc (1, sizeof (KeyBindings));
    90        
    91         char namebuf[256];
    92         char valuebuf[256];
    93         memset (namebuf, 0, 256);
    94         memset (valuebuf, 0, 256);
    95         int* index;
    96 
    97         while( parser.next_var (namebuf, valuebuf) != -1)
    98         {
    99                 index = name_to_index (namebuf);
    100                 switch( index[0])
    101                 {
    102                         case 0:
    103                                 printf("Key binding %d(%s) set to %s\n", index[1], SDLK_to_keyname( index[1]), valuebuf);
    104                                 strcpy (aliases->keys[index[1]], valuebuf);
    105                                 break;
    106                         case 1:
    107                                 printf("Button binding %d(%s) set to %s\n", index[1], SDLB_to_buttonname( index[1]), valuebuf);
    108                                 strcpy (aliases->buttons[index[1]], valuebuf);
    109                                 break;
    110                         default:
    111                                 break;
    112                 }
    113                 memset (namebuf, 0, 256);
    114                 memset (valuebuf, 0, 256);
    115         }
    116 }
    117 
    118 /**
    119         \brief binds a WorldEntity to the CommandNode
    120         \param entity: Pointer to the entity to bind
    121 */
    122 void CommandNode::bind (WorldEntity* entity)
    123 {
    124         bound->add (entity, LIST_ADD_NEXT, true);
    125 }
    126 
    127 /**
    128         \brief removes an entity from the list of the CommandNode
    129         \param entity: Pointer to the entity to relese
    130 */
    131 void CommandNode::unbind (WorldEntity* entity)
    132 {
    133         bound->remove (entity, LIST_FIND_FW);
    134 }
    135 
    136 int* CommandNode::name_to_index (char* name)
    137 {
    138         coord[0] = -1;
    139         coord[1] = -1;
    140         int c;
    141         if( (c = keyname_to_SDLK (name)) != -1)
    142         {
    143                 coord[1] = c;
    144                 coord[0] = 0;
    145         }
    146         if( (c = buttonname_to_SDLB (name)) != -1)
    147         {
    148                 coord[1] = c;
    149                 coord[0] = 1;
    150         }
    151         return coord;
    152 }
    153 
    154 /**
    155         \brief tells the CommandNode to run through all pending events and relay them accordingly
    156 */
    157 void CommandNode::process ()
    158 {
    159         if( bLocalInput) process_local ();
    160         else process_network ();
    161 }
    162 
    163 void CommandNode::process_local ()
    164 {
    165         SDL_Event event;
    166         Command cmd;
    167        
    168         while( SDL_PollEvent (&event))
    169         {
    170                 memset (cmd.cmd, 0, CMD_LENGHT);
    171                 switch( event.type)
    172                 {
    173                         case SDL_KEYDOWN:
    174                                 strcpy (cmd.cmd, aliases->keys[event.key.keysym.sym]);
    175                                 cmd.bUp = false;
    176                                 if( strlen (cmd.cmd) > 0) relay (&cmd);
    177                                 break;
    178                         case SDL_KEYUP:
    179                                 strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]);
    180                                 cmd.bUp = true;
    181                                 if( strlen (cmd.cmd) > 0) relay (&cmd);
    182                                 break;
    183                         case SDL_MOUSEMOTION:
    184                                 strcpy( cmd.cmd, "cursor");
    185                                 cmd.x = event.motion.x;
    186                                 cmd.y = event.motion.y;
    187                                 cmd.xrel = event.motion.xrel;
    188                                 cmd.yrel = event.motion.yrel;
    189                                 break;
    190                         case SDL_MOUSEBUTTONUP:
    191                                 strcpy( cmd.cmd, aliases->buttons[event.button.button]);
    192                                 cmd.bUp = true;
    193                                 if( strlen (cmd.cmd) > 0) relay (&cmd);
    194                                 break;
    195                         case SDL_MOUSEBUTTONDOWN:
    196                                 strcpy( cmd.cmd, aliases->buttons[event.button.button]);
    197                                 cmd.bUp = false;
    198                                 if( strlen (cmd.cmd) > 0) relay (&cmd);
    199                                 break;
    200                         case SDL_JOYAXISMOTION:
    201                         case SDL_JOYBALLMOTION:
    202                         case SDL_JOYHATMOTION:
    203                         case SDL_JOYBUTTONDOWN:
    204                         case SDL_JOYBUTTONUP:
    205                                 break;
    206                         default:
    207                                 Orxonox *orx = Orxonox::getInstance();
    208                                 orx->event_handler (&event);
    209                                 break;
    210                 }
    211         }
     213    }
    212214}
    213215
     
    219221void CommandNode::relay (Command* cmd)
    220222{
    221 printf("CommandNode|relay()\n");
    222         List<WorldEntity>* plist = bound;
    223        
    224         Orxonox *orx = Orxonox::getInstance();
    225         if( orx->system_command (cmd)) return;
    226                
    227         if( bLocalInput) send_over_network (cmd);
    228        
    229         while( (plist = plist->get_next()) != NULL)
    230         {
    231                 plist->get_object()->command (cmd);
    232         }
    233 }
    234 
    235 /**
    236         \brief sets the network identifier of the CommandNode
    237         \param ID: the new ID to use
     223  //printf("CommandNode|relay()\n");
     224  List<WorldEntity>* plist = bound;
     225 
     226  Orxonox *orx = Orxonox::getInstance();
     227  if( orx->system_command (cmd)) return;
     228  GameLoader* gl = GameLoader::getInstance();
     229  if(gl->worldCommand(cmd)) return;
     230 
     231  if( bLocalInput) send_over_network (cmd);
     232 
     233  while( (plist = plist->get_next()) != NULL)
     234    {
     235      plist->get_object()->command (cmd);
     236    }
     237}
     238
     239/**
     240   \brief sets the network identifier of the CommandNode
     241   \param ID: the new ID to use
    238242*/
    239243void CommandNode::set_netID (int ID)
    240244{
    241         netID = ID;
     245  netID = ID;
    242246}
    243247
  • orxonox/branches/buerli/src/error.h

    r2551 r2707  
    2222*/
    2323
     24// this are the two undefined error nr. Don't use them ...
     25#define ERROR -1
     26#define NERROR 0
    2427
    25 #define ERROR -1
    26 #define NO_ERROR 0
     28/*!
     29    \brief Error Definitions:
     30
     31    Error Classes:
     32    0xx application framework codes
     33    1xx graphics codes
     34    2xx file/FS codes
     35    3xx network codes
     36    4xx general codes
     37
     38    Error Specifier 1:
     39    x0x action finsished as desired
     40    x1x initialisation error
     41    x2x execution error
     42    x3x uninitialisation error
     43
     44    Error Specifier 2:
     45    xx0 no further informations
     46    xx1 only a warning - feel free to ignore, the program will proceed
     47    xx2 this could lead unexpected behaviour
     48    xx3 this is a fatal error - you are invited to quit the program - panic!
     49*/
     50
     51typedef struct
     52{
     53  int code;
     54  char* message;
     55  char* location;
     56} Error;
  • orxonox/branches/buerli/src/list.h

    r2077 r2707  
     1/*
     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.
     10
     11   ### File Specific:
     12   main-programmer: Christian Meyer
     13
     14   ADDONS/FIXES:
     15 
     16   Patrick Boenzli     :          Implemented getSize() function
     17*/
     18
     19
    120/*!
    221  \file list.h
     
    2140  List<T>* prev;
    2241  bool bReference;
     42  int size;
    2343 
    2444 public:
     
    3555  void set_prev (List<T>* ptr);
    3656  int remove (T* obj, FINDMODE mode);
     57  int getSize();
    3758};
    3859
     
    5273  prev = p;
    5374  bReference = bRef;
     75  if(obj != NULL)
     76    ++size;
    5477}
    5578
     
    127150      break;
    128151  }
     152  ++size;
    129153  return 0;
    130154}
     
    224248    }
    225249  }
     250  --size;
    226251  return 0;
    227252}
     
    262287
    263288
     289/**
     290  \brief Returns the current size of the List
     291  \return Size of List
     292*/
     293template<class T>
     294int List<T>::getSize()
     295{
     296  return this->size;
     297}
    264298
    265299#endif
  • orxonox/branches/buerli/src/orxonox.cc

    r2551 r2707  
    2929#include "data_tank.h"
    3030#include "command_node.h"
     31#include "game_loader.h"
    3132#include <string.h>
    3233
     
    3435
    3536/**
    36         \brief create a new Orxonox
     37   \brief create a new Orxonox
    3738*/
    3839Orxonox::Orxonox ()
     
    4243
    4344/**
    44         \brief remove Orxonox from memory
     45   \brief remove Orxonox from memory
    4546*/
    4647Orxonox::~Orxonox ()
    4748{
    48         Orxonox::singleton_ref = NULL;
    49         if( world != NULL) delete world;
    50         if( localinput != NULL) delete world;
    51         if( localcamera != NULL) delete localcamera;
    52         if( resources != NULL) delete resources;
     49  Orxonox::singleton_ref = NULL;
     50  if( world != NULL) delete world;
     51  if( localinput != NULL) delete world;
     52  if( localcamera != NULL) delete localcamera;
     53  if( resources != NULL) delete resources;
    5354}
    5455
     
    6566
    6667/**
    67         \brief this finds the config file
    68        
    69         Since the config file varies from user to user and since one may want to specify different config files
    70         for certain occasions or platforms this function finds the right config file for every occasion and stores
    71         it's path and name into configfilename
     68   \brief this finds the config file
     69   
     70   Since the config file varies from user to user and since one may want to specify different config files
     71   for certain occasions or platforms this function finds the right config file for every occasion and stores
     72   it's path and name into configfilename
    7273*/
    7374void Orxonox::get_config_file (int argc, char** argv)
    7475{
    75 /*      char* path;
    76         #ifdef __WIN32__
    77         path = getenv("");
    78         #else
    79         path = getenv("HOME");
    80         #endif
    81        
    82         if( path != NULL) strcpy (configfilename, path);
    83         else strcpy (configfilename, "./");
    84         strcat (configfilename, "/.orxonox.conf");*/
    85        
    86         strcpy (configfilename, "orxonox.conf");
    87 }
    88 
    89 /**
    90         \brief initialize Orxonox with command line
     76  /*    char* path;
     77    #ifdef __WIN32__
     78    path = getenv("");
     79    #else
     80    path = getenv("HOME");
     81    #endif
     82   
     83    if( path != NULL) strcpy (configfilename, path);
     84    else strcpy (configfilename, "./");
     85    strcat (configfilename, "/.orxonox.conf");*/
     86 
     87  strcpy (configfilename, "orxonox.conf");
     88}
     89
     90/**
     91   \brief initialize Orxonox with command line
    9192*/
    9293int Orxonox::init (int argc, char** argv)
    9394{
    94                 // parse command line
    95                 // config file
    96                
    97         get_config_file (argc, argv);
    98        
    99                 // initialize SDL
     95  // parse command line
     96  // config file
     97 
     98  get_config_file (argc, argv);
     99 
     100  // initialize SDL
    100101  printf("> Initializing SDL\n");
    101102  if( SDL_Init (SDL_INIT_EVERYTHING) == -1)
    102   {
    103     printf ("Could not SDL_Init(): %s\n", SDL_GetError());
    104     return -1;
    105   }
    106  
    107         // initialize everything
     103    {
     104      printf ("Could not SDL_Init(): %s\n", SDL_GetError());
     105      return -1;
     106    }
     107 
     108  // initialize everything
    108109  printf("> Initializing video\n");
    109         if( init_video () == -1) return -1;
     110  if( init_video () == -1) return -1;
    110111  printf("> Initializing sound\n");
    111         if( init_sound () == -1) return -1;
     112  if( init_sound () == -1) return -1;
    112113  printf("> Initializing input\n");
    113         if( init_input () == -1) return -1;
     114  if( init_input () == -1) return -1;
    114115  printf("> Initializing networking\n");
    115         if( init_networking () == -1) return -1;
     116  if( init_networking () == -1) return -1;
    116117  printf("> Initializing resources\n");
    117         if( init_resources () == -1) return -1;
    118   printf("> Initializing world\n");
    119         if( init_world () == -1) return -1;
    120        
    121         return 0;
    122 }
    123 
    124 /**
    125         \brief initializes SDL and OpenGL
     118  if( init_resources () == -1) return -1;
     119  //printf("> Initializing world\n");
     120  //if( init_world () == -1) return -1; PB: world will be initialized when started
     121 
     122  return 0;
     123}
     124
     125/**
     126   \brief initializes SDL and OpenGL
    126127*/
    127128int Orxonox::init_video ()
     
    161162 
    162163  // create camera
    163   localcamera = new Camera();
    164  
    165   return 0;
    166 }
    167 
    168 /**
    169         \brief initializes the sound engine
     164  localcamera = new Camera(world);
     165 
     166  return 0;
     167}
     168
     169/**
     170   \brief initializes the sound engine
    170171*/
    171172int Orxonox::init_sound ()
    172173{
    173         printf("Not yet implemented\n");
    174         return 0;
    175 }
    176 
    177 /**
    178         \brief initializes input functions
     174  printf("Not yet implemented\n");
     175  return 0;
     176}
     177
     178/**
     179   \brief initializes input functions
    179180*/
    180181int Orxonox::init_input ()
    181182{
    182         // create localinput
    183         localinput = new CommandNode( configfilename);
    184        
    185         return 0;
    186 }
    187 
    188 /**
    189         \brief initializes network system
     183  // create localinput
     184  localinput = new CommandNode( configfilename);
     185 
     186  return 0;
     187}
     188
     189/**
     190   \brief initializes network system
    190191*/
    191192int Orxonox::init_networking ()
    192193{
    193         printf("Not yet implemented\n");
    194         return 0;
    195 }
    196 
    197 /**
    198         \brief initializes and loads resource files
     194  printf("Not yet implemented\n");
     195  return 0;
     196}
     197
     198/**
     199   \brief initializes and loads resource files
    199200*/
    200201int Orxonox::init_resources ()
    201202{
    202         printf("Not yet implemented\n");
    203         return 0;
    204 }
    205 
    206 /**
    207         \brief initializes the world
     203  printf("Not yet implemented\n");
     204  return 0;
     205}
     206
     207/**
     208   \brief initializes the world
    208209*/
    209210int Orxonox::init_world ()
    210211{
    211         world = new World();
    212        
    213         // TO DO: replace this with a menu/intro
    214         world->load_debug_level();
    215        
    216         return 0;
    217 }
    218 
    219 /**
    220         \brief exits Orxonox
     212  //world = new World();
     213 
     214  // TO DO: replace this with a menu/intro
     215  //world->load_debug_level();
     216 
     217  return 0;
     218}
     219
     220
     221/**
     222   \brief starts the orxonox game or menu
     223
     224   here is the central orxonox state manager. There are currently two states
     225   - menu
     226   - game-play
     227   both states manage their states themselfs again.
     228*/
     229void Orxonox::start()
     230{
     231 
     232  this->gameLoader = GameLoader::getInstance();
     233  this->gameLoader->loadDebugCampaign(DEBUG_CAMPAIGN_0);
     234  this->gameLoader->init();
     235  this->gameLoader->start();
     236}
     237
     238/**
     239   \brief exits Orxonox
    221240*/
    222241void Orxonox::quitGame()
    223242{
    224         bQuitOrxonox = true;
    225 }
    226 
    227 /**
    228         \brief this runs all of Orxonox
     243  bQuitOrxonox = true;
     244}
     245
     246/**
     247   \brief this runs all of Orxonox
    229248*/
    230249void Orxonox::mainLoop()
     
    236255  while( !bQuitOrxonox)
    237256    {
    238       printf("<==");
    239 
    240257      // Network
    241258      synchronize();
     
    248265      // Draw
    249266      display();
    250 
    251       printf(">\n");
    252267    }
    253268  printf("Orxonox|Exiting the main loop\n");
     
    255270
    256271/**
    257         \brief handles sprecial events from localinput
    258         \param event: an event not handled by the CommandNode
     272   \brief handles sprecial events from localinput
     273   \param event: an event not handled by the CommandNode
    259274*/
    260275void Orxonox::event_handler (SDL_Event* event)
    261276{
    262         // Handle special events such as reshape, quit, focus changes
    263 }
    264 
    265 /**
    266         \brief synchronize local data with remote data
     277  // Handle special events such as reshape, quit, focus changes
     278}
     279
     280/**
     281   \brief synchronize local data with remote data
    267282*/
    268283void Orxonox::synchronize ()
    269284{
    270         // Get remote input
    271         // Update synchronizables
    272 }
    273 
    274 /**
    275         \brief run all input processing
     285  // Get remote input
     286  // Update synchronizables
     287}
     288
     289/**
     290   \brief run all input processing
    276291*/
    277292void Orxonox::handle_input ()
    278293{
    279         // localinput
    280                 localinput->process();
    281         // remoteinput
    282 }
    283 
    284 /**
    285         \brief advance the timeline
     294  // localinput
     295  localinput->process();
     296  // remoteinput
     297}
     298
     299/**
     300   \brief advance the timeline
    286301*/
    287302void Orxonox::time_slice ()
     
    295310        {
    296311          float fps = 1000/dt;
    297           printf("%f", fps);
     312          printf("fps = %f\n", fps);
    298313        }
    299314     
     
    306321
    307322/**
    308         \brief compute collision detection
     323   \brief compute collision detection
    309324*/
    310325void Orxonox::collision ()
    311326{
    312         world->collide ();
    313 }
    314 
    315 /**
    316         \brief handle keyboard commands that are not meant for WorldEntities
    317         \param cmd: the command to handle
    318         \return true if the command was handled by the system or false if it may be passed to the WorldEntities
     327  world->collide ();
     328}
     329
     330/**
     331   \brief handle keyboard commands that are not meant for WorldEntities
     332   \param cmd: the command to handle
     333   \return true if the command was handled by the system or false if it may be passed to the WorldEntities
    319334*/
    320335bool Orxonox::system_command (Command* cmd)
    321336{
    322         if( !strcmp( cmd->cmd, "quit"))
    323         {
    324                 if( !cmd->bUp) bQuitOrxonox = true;
    325                 return true;
    326         }
    327         return false;
    328 }
    329 
    330 /**
    331         \brief render the current frame
     337  if( !strcmp( cmd->cmd, "quit"))
     338    {
     339      if( !cmd->bUp) this->gameLoader->stop();
     340      return true;
     341    }
     342  return false;
     343}
     344
     345/**
     346   \brief render the current frame
    332347*/
    333348void Orxonox::display ()
    334349{
    335                 // clear buffer
    336         glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    337                 // set camera
    338         localcamera->apply ();
    339                 // draw world
    340         world->draw ();
    341                 // draw HUD
    342                 // flip buffers
    343         SDL_GL_SwapBuffers();
    344 }
    345 
    346 /**
    347         \brief retrieve a pointer to the local Camera
    348         \return a pointer to localcamera
     350  // clear buffer
     351  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     352  // set camera
     353  localcamera->apply ();
     354  // draw world
     355  world->draw ();
     356  // draw HUD
     357  // flip buffers
     358  SDL_GL_SwapBuffers();
     359}
     360
     361/**
     362   \brief retrieve a pointer to the local Camera
     363   \return a pointer to localcamera
    349364*/
    350365Camera* Orxonox::get_camera ()
    351366{
    352         return localcamera;
    353 }
    354 
    355 /**
    356         \brief retrieve a pointer to the local CommandNode
    357         \return a pointer to localinput
     367  return localcamera;
     368}
     369
     370/**
     371   \brief retrieve a pointer to the local CommandNode
     372   \return a pointer to localinput
    358373*/
    359374CommandNode* Orxonox::get_localinput ()
    360375{
    361         return localinput;
    362 }
    363 
    364 /**
    365         \brief retrieve a pointer to the local World
    366         \return a pointer to world
     376  return localinput;
     377}
     378
     379/**
     380   \brief retrieve a pointer to the local World
     381   \return a pointer to world
    367382*/
    368383World* Orxonox::get_world ()
    369384{
    370         return world;
     385  return world;
    371386}
    372387
    373388int main (int argc, char** argv)
    374389
    375         printf(">>> Starting Orxonox <<<\n");
     390  printf(">>> Starting Orxonox <<<\n");
    376391  Orxonox *orx = Orxonox::getInstance();
    377392 
    378393  if( (*orx).init(argc, argv) == -1)
    379   {
    380     printf("! Orxonox initialization failed\n");
    381     return -1;
    382   }
    383        
    384   (*orx).mainLoop();
    385 
     394    {
     395      printf("! Orxonox initialization failed\n");
     396      return -1;
     397    }
     398 
     399  //(*orx).mainLoop();
     400
     401  orx->start();
     402 
    386403  //delete orx;
    387404 
  • orxonox/branches/buerli/src/orxonox.conf

    r2190 r2707  
    66SPACE=fire
    77ESCAPE=quit
     8p=pause
    89q=quit
    910BUTTON_LEFT=fire
    1011BUTTON_RIGHT=altfire
    1112b=benscho
     13x=up_world
     14z=down_world
     15
  • orxonox/branches/buerli/src/orxonox.h

    r2190 r2707  
    1616class World;
    1717class Camera;
     18class GameLoader;
    1819
    1920//! Orxonox core singleton class
     
    3334  Camera* localcamera;
    3435  SDL_Surface* screen;
     36  GameLoader* gameLoader;
    3537 
    3638  bool bQuitOrxonox;
    3739  bool pause;
    38         Uint32 lastframe;
    39 
    40         void get_config_file (int argc, char** argv);
    41        
    42                 // main loop functions
     40  Uint32 lastframe;
     41 
     42  void get_config_file (int argc, char** argv);
     43 
     44  // main loop functions
    4345  void synchronize ();
    4446  void handle_input ();
     
    5759 public:
    5860  static Orxonox* getInstance ();
     61  void start();
    5962  void quitGame();
    6063
     
    6366
    6467  int init (int argc, char** argv);
    65        
    66         CommandNode* get_localinput();
    67         Camera* get_camera();
    68         World* get_world();
    69        
     68 
     69  CommandNode* get_localinput();
     70  Camera* get_camera();
     71  World* get_world();
     72 
    7073  void mainLoop();
    7174};
  • orxonox/branches/buerli/src/player.cc

    r2551 r2707  
    6262void Player::command (Command* cmd)
    6363{
    64         printf("Player|recieved command [%s]\n", cmd->cmd);
    65         if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp;
    66         else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp;
    67         else if( !strcmp( cmd->cmd, "left")) bLeft = !cmd->bUp;
    68         else if( !strcmp( cmd->cmd, "right")) bRight = !cmd->bUp;
    69         else if( !strcmp( cmd->cmd, "fire")) bFire = !cmd->bUp;
     64  //printf("Player|recieved command [%s]\n", cmd->cmd);
     65  if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp;
     66  else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp;
     67  else if( !strcmp( cmd->cmd, "left")) bLeft = !cmd->bUp;
     68  else if( !strcmp( cmd->cmd, "right")) bRight = !cmd->bUp;
     69  else if( !strcmp( cmd->cmd, "fire")) bFire = !cmd->bUp;
    7070}
    7171
    7272void Player::draw ()
    73 {
     73{ 
    7474  glMatrixMode(GL_MODELVIEW);
    7575  glLoadIdentity();
  • orxonox/branches/buerli/src/stdincl.h

    r2551 r2707  
    1515#include "coordinates.h"
    1616#include "list.h"
     17#include "error.h"
    1718#include "message_structures.h"
    1819#include "orxonox.h"
  • orxonox/branches/buerli/src/track.cc

    r2551 r2707  
    5252{
    5353}
     54
     55void Track::init()
     56{
     57 
     58}
     59
    5460
    5561/**
  • orxonox/branches/buerli/src/track.h

    r2551 r2707  
    2727       
    2828 public:
    29         Track ();
     29  Track ();
    3030  Track (Uint32 number, Uint32 next, Vector* start, Vector* finish);
    3131  ~Track ();
    32        
    33         virtual void post_enter (WorldEntity* entity);  // handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
    34         virtual void post_leave (WorldEntity* entity);
    35         virtual void tick (float deltaT);
    36         virtual void map_camera (Location* lookat, Placement* camplc);
    37         virtual bool map_coords (Location* loc, Placement* plc);        // this should return true if the entity left track boundaries
     32  virtual void init();
     33 
     34  virtual void post_enter (WorldEntity* entity);        // handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
     35  virtual void post_leave (WorldEntity* entity);
     36  virtual void tick (float deltaT);
     37  virtual void map_camera (Location* lookat, Placement* camplc);
     38  virtual bool map_coords (Location* loc, Placement* plc);      // this should return true if the entity left track boundaries
    3839};
    3940
  • orxonox/branches/buerli/src/world.cc

    r2551 r2707  
    3131    This creates a new empty world!
    3232*/
    33 World::World ()
    34 {
    35   entities = new List<WorldEntity>();
     33World::World (char* name)
     34{
     35  this->worldName = name;
     36  this->debugWorldNr = -1;
     37  this->entities = new List<WorldEntity>();
     38}
     39
     40World::World (int worldID)
     41{
     42  this->debugWorldNr = worldID;
     43  this->worldName = NULL;
     44  this->entities = new List<WorldEntity>();
    3645}
    3746
     
    4150World::~World ()
    4251{
    43   unload ();
    44   delete entities;
    45 }
     52  Orxonox *orx = Orxonox::getInstance();
     53  orx->get_localinput()->unbind (this->localPlayer);
     54  delete this->entities;
     55  delete this->localCamera;
     56}
     57
     58
     59/**
     60    \brief initialize the world before use.
     61*/
     62Error World::init()
     63{
     64  this->bPause = false;
     65}
     66
     67Error World::start()
     68{
     69  this->mainLoop();
     70}
     71
     72Error World::stop()
     73{
     74  this->bQuitCurrentGame = true;
     75  this->localCamera->setWorld(NULL);
     76  this->~World();
     77}
     78
     79Error World::pause()
     80{
     81  this->isPaused = true;
     82}
     83
     84Error World::resume()
     85{
     86  this->isPaused = false;
     87}
     88
     89void World::load()
     90{
     91  if(this->debugWorldNr != -1)
     92    {
     93      switch(this->debugWorldNr)
     94        {
     95        case DEBUG_WORLD_0:
     96          {
     97            // create some path nodes
     98            this->pathnodes = new Vector[6];
     99            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);
     105           
     106            // create the tracks
     107            this->tracklen = 6;
     108            this->track = new Track[6];
     109            for( int i = 0; i < this->tracklen; i++)
     110              {
     111                this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
     112              }
     113           
     114            // create a player
     115            //WorldEntity* myPlayer = (WorldEntity*) this->spawn<Player>();
     116            WorldEntity* myPlayer = new Player();
     117            this->spawn(myPlayer);
     118            this->localPlayer = myPlayer;           
     119
     120            // bind input
     121            Orxonox *orx = Orxonox::getInstance();
     122            orx->get_localinput()->bind (myPlayer);
     123           
     124            // bind camera
     125            this->localCamera = new Camera(this);
     126            this->getCamera()->bind (myPlayer);
     127            break;
     128          }
     129        case DEBUG_WORLD_1:
     130          {
     131            // create some path nodes
     132            this->pathnodes = new Vector[6];
     133            this->pathnodes[0] = Vector(0, 0, 0);
     134            this->pathnodes[1] = Vector(20, 10, 10);
     135            this->pathnodes[2] = Vector(40, 0, 10);
     136            this->pathnodes[3] = Vector(60, 10, 0);
     137            this->pathnodes[4] = Vector(80, 20, 10);
     138            this->pathnodes[5] = Vector(30, 50, 0);
     139           
     140            // create the tracks
     141            this->tracklen = 6;
     142            this->track = new Track[6];
     143            for( int i = 0; i < this->tracklen; i++)
     144              {
     145                this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
     146              }
     147           
     148            // create a player
     149            //WorldEntity* myPlayer = (WorldEntity*) this->spawn<Player>();
     150            WorldEntity* myPlayer = new Player();
     151            this->spawn(myPlayer);
     152            this->localPlayer = myPlayer;
     153           
     154            // bind input
     155            Orxonox *orx = Orxonox::getInstance();
     156            orx->get_localinput()->bind (myPlayer);
     157           
     158            // bind camera
     159            this->localCamera = new Camera(this);
     160            this->getCamera()->bind (myPlayer);
     161            break;
     162          }
     163        default:
     164          printf("World::load() - no world with ID %i found", this->debugWorldNr );
     165        }
     166    }
     167  else if(this->worldName != NULL)
     168    {
     169
     170    }
     171}
     172
    46173
    47174/**
     
    254381}
    255382
    256 /**
    257    \brief loads a simple level for testing purposes
    258 */
    259 void World::load_debug_level()
    260 {
    261   // create some path nodes
    262   pathnodes = new Vector[6];
    263   pathnodes[0] = Vector(0, 0, 0);
    264   pathnodes[1] = Vector(-100, 40, 0);
    265   pathnodes[2] = Vector(-100, 140, 0);
    266   pathnodes[3] = Vector(0, 180, 0);
    267   pathnodes[4] = Vector(100, 140, 0);
    268   pathnodes[5] = Vector(100, 40, 0);   
    269  
    270   // create the tracks
    271   tracklen = 6;
    272   track = new Track[6];
    273   for( int i = 0; i < tracklen; i++)
    274     {
    275       track[i] = Track( i, (i+1)%tracklen, &pathnodes[i], &pathnodes[(i+1)%tracklen]);
    276     }
    277  
    278   // create a player
    279   WorldEntity* myPlayer = (WorldEntity*) spawn<Player>();
    280  
    281   // bind input
    282   Orxonox *orx = Orxonox::getInstance();
    283   orx->get_localinput()->bind (myPlayer);
    284  
    285   // bind camera
    286   orx->get_camera()->bind (myPlayer);
    287 }
     383
    288384
    289385/**
     
    295391  track[loc->part].map_camera (loc, plc);
    296392}
     393
     394
     395void World::setTrackLen(Uint32 len)
     396{
     397  this->tracklen = len;
     398}
     399
     400int World::getTrackLen()
     401{
     402  return this->tracklen;
     403}
     404
     405void World::debug()
     406{
     407  List<WorldEntity> *l;
     408  WorldEntity* entity;
     409 
     410  printf("counting all entities\n");
     411  l = entities->get_next(); 
     412  while( l != NULL )
     413    {
     414      entity = l->get_object();
     415      if( entity->bDraw ) printf("got an entity\n");
     416      l = l->get_next();
     417    }
     418}
     419
     420
     421void World::mainLoop()
     422{
     423  this->lastFrame = SDL_GetTicks();
     424  this->bQuitOrxonox = false;
     425  this->bQuitCurrentGame = false;
     426  printf("World|Entering main loop\n");
     427  while(!this->bQuitOrxonox && !this->bQuitCurrentGame) /* pause pause pause ?!?!?*/
     428    {
     429      //debug routine
     430      //debug();
     431      // Network
     432      synchronize();
     433      // Process input
     434      handle_input();
     435      // Process time
     436      time_slice();
     437      // Process collision
     438      collision();
     439      // Draw
     440      display();
     441    }
     442  printf("World|Exiting the main loop\n");
     443}
     444
     445/**
     446   \brief synchronize local data with remote data
     447*/
     448void World::synchronize ()
     449{
     450  // Get remote input
     451  // Update synchronizables
     452}
     453
     454/**
     455   \brief run all input processing
     456*/
     457void World::handle_input ()
     458{
     459  // localinput
     460  Orxonox::getInstance()->get_localinput()->process();
     461  // remoteinput
     462}
     463
     464/**
     465   \brief advance the timeline
     466*/
     467void World::time_slice ()
     468{
     469  Uint32 currentFrame = SDL_GetTicks();
     470  if(!this->bPause)
     471    {
     472      Uint32 dt = currentFrame - this->lastFrame;
     473      /*
     474      if(dt > 0)
     475        {
     476          float fps = 1000/dt;
     477          printf("fps = %f\n", fps);
     478        }
     479      else
     480        {
     481          printf("fps = 1000\n");
     482        }
     483      */
     484      this->time_slice (dt);
     485      this->update ();
     486      this->localCamera->time_slice (dt);
     487    }
     488  this->lastFrame = currentFrame;
     489}
     490
     491/**
     492   \brief compute collision detection
     493*/
     494void World::collision ()
     495{
     496  this->collide ();
     497}
     498
     499/**
     500   \brief handle keyboard commands that are not meant for WorldEntities
     501   \param cmd: the command to handle
     502   \return true if the command was handled by the system or false if it may be passed to the WorldEntities
     503*/
     504bool World::system_command (Command* cmd)
     505{
     506  if( !strcmp( cmd->cmd, "quit"))
     507    {
     508      if( !cmd->bUp) this->bQuitOrxonox = true;
     509      return true;
     510    }
     511  return false;
     512}
     513
     514/**
     515        \brief render the current frame
     516*/
     517void World::display ()
     518{
     519  // clear buffer
     520  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     521  // set camera
     522  this->localCamera->apply ();
     523  // draw world
     524  this->draw();
     525  // draw HUD
     526  // flip buffers
     527  SDL_GL_SwapBuffers();
     528}
     529
     530Camera* World::getCamera()
     531{
     532  return this->localCamera;
     533}
     534
     535
     536void World::spawn(WorldEntity* entity)
     537{
     538  Location zeroloc;
     539  Location* loc = NULL;
     540  WorldEntity* owner;
     541  //T* entity = new T();
     542  entities->add (entity, LIST_ADD_NEXT);
     543  //if( loc == NULL)
     544  //{
     545      zeroloc.dist = 0;
     546      zeroloc.part = 0;
     547      zeroloc.pos = Vector();
     548      zeroloc.rot = Quaternion();
     549      loc = &zeroloc;
     550      //}
     551  entity->init (loc, owner);
     552  if (entity->bFree)
     553    {
     554      this->track[loc->part].map_coords( loc, entity->get_placement());
     555    }
     556  entity->post_spawn ();
     557  //return entity;
     558}
  • orxonox/branches/buerli/src/world.h

    r2551 r2707  
    88
    99#include "stdincl.h"
     10#include "story_entity.h"
     11
     12
    1013
    1114class Track;
    1215class WorldEntity;
     16class Camera;
    1317
    1418//! The game environment
    15 class World {
     19class World : public StoryEntity {
    1620
    1721 public:
    18   World ();
     22  World (char* name);
     23  World (int worldID);
    1924  ~World ();
    2025
    21         template<typename T>
    22           T* spawn(Location* loc, WorldEntity* owner);  // template to be able to spawn any derivation of WorldEntity
    23         template<typename T>
    24           T* spawn(Placement* plc, WorldEntity* owner);
     26  template<typename T>
     27    T* spawn(Location* loc, WorldEntity* owner);        // template to be able to spawn any derivation of WorldEntity
     28  template<typename T>
     29    T* spawn(Placement* plc, WorldEntity* owner);
     30 
     31  virtual Error init();
     32  virtual Error start();
     33  virtual Error stop();
     34  virtual Error pause();
     35  virtual Error resume();
    2536
    26         void time_slice (Uint32 deltaT);
    27         void collide ();
    28         void draw ();
    29         void update (); // maps Locations to Placements
    30         void calc_camera_pos (Location* loc, Placement* plc);
     37  virtual void load();
     38
     39  void time_slice (Uint32 deltaT);
     40  void collide ();
     41  void draw ();
     42  void update ();       // maps Locations to Placements
     43  void calc_camera_pos (Location* loc, Placement* plc);
    3144       
    32         void unload ();
    33        
    34         void load_debug_level ();
    35        
     45  void unload ();
     46 
     47  void setTrackLen(Uint32 tracklen);
     48  int getTrackLen();
     49  bool system_command (Command* cmd);
     50  Camera* getCamera();
     51  //private:
     52
     53  void spawn(WorldEntity* entity);
     54
     55  List<WorldEntity>* entities;
     56 
     57  // base level data
     58  Track* track;
     59  Uint32 tracklen;   // number of Tracks the World consist of
     60  Vector* pathnodes;
     61  Camera* localCamera; 
     62
    3663 private:
    37  
    38         List<WorldEntity>* entities;
    39        
    40                 // base level data
    41         Track* track;
    42         Uint32 tracklen;   // number of Tracks the World consist of
    43         Vector* pathnodes;
     64  Uint32 lastFrame; //!> last time of frame
     65  bool bQuitOrxonox; //!> quit this application
     66  bool bQuitCurrentGame; //!> quit only the current game and return to menu
     67  bool bPause;
    4468
     69  char* worldName;
     70  int debugWorldNr;
     71
     72  WorldEntity* localPlayer;
     73 
     74  void mainLoop();
     75  void synchronize();
     76  void handle_input();
     77  void time_slice();
     78  void collision();
     79  void display();
     80  void debug();
    4581};
    4682
     
    5894template<typename T> T* World::spawn(Location* loc = NULL, WorldEntity* owner = NULL)
    5995{
    60         Location zeroloc;
    61         T* entity = new T();
    62         entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
    63         if( loc == NULL)
    64         {
    65                 zeroloc.dist = 0;
    66                 zeroloc.part = 0;
    67                 zeroloc.pos = Vector();
    68                 zeroloc.rot = Quaternion();
    69                 loc = &zeroloc;
    70         }
    71         entity->init (loc, owner);
    72         if (entity->bFree)
    73         {
    74                 track[loc->part].map_coords( loc, entity->get_placement());
    75         }
    76         entity->post_spawn ();
    77         return entity;
     96  Location zeroloc;
     97  T* entity = new T();
     98  entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
     99  if( loc == NULL)
     100    {
     101      zeroloc.dist = 0;
     102      zeroloc.part = 0;
     103      zeroloc.pos = Vector();
     104      zeroloc.rot = Quaternion();
     105      loc = &zeroloc;
     106    }
     107  entity->init (loc, owner);
     108  if (entity->bFree)
     109    {
     110      track[loc->part].map_coords( loc, entity->get_placement());
     111    }
     112  entity->post_spawn ();
     113  return entity;
    78114}
    79115
     
    92128template<typename T> T* World::spawn(Placement* plc, WorldEntity* owner = NULL)
    93129{
    94         T* entity = new T();
    95         entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
    96         entity->init (plc, owner);
    97         if (!entity->bFree)
    98         {
    99                 printf("Can't spawn unfree entity with placement\n");
    100                 entities->remove( (WorldEntity*)entity, LIST_FIND_FW);
    101                 return NULL;
    102         }
    103         entity->post_spawn ();
    104         return entity;
     130  T* entity = new T();
     131  entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
     132  entity->init (plc, owner);
     133  if (!entity->bFree)
     134    {
     135      printf("Can't spawn unfree entity with placement\n");
     136      entities->remove( (WorldEntity*)entity, LIST_FIND_FW);
     137      return NULL;
     138    }
     139  entity->post_spawn ();
     140  return entity;
    105141}
    106142
Note: See TracChangeset for help on using the changeset viewer.