Changeset 3238 in orxonox.OLD for orxonox/branches/nico/src
- Timestamp:
- Dec 20, 2004, 2:42:54 AM (20 years ago)
- Location:
- orxonox/branches/nico/src
- Files:
-
- 6 deleted
- 50 edited
- 49 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/nico/src/Makefile.am
r2990 r3238 1 AM_CXXFLAGS="-I/usr/X11R6/include"2 AM_LDFLAGS= "-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib -lXt -lX11"$(MWINDOWS)1 #AM_CXXFLAGS="" 2 AM_LDFLAGS= $(MWINDOWS) 3 3 4 4 #"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include" … … 7 7 bin_PROGRAMS=orxonox 8 8 9 orxonox_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 game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc 10 noinst_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 object.h array.h material.h list_template.h story_entity.h story_def.h game_loader.h campaign.h 9 orxonox_SOURCES= orxonox.cc \ 10 world.cc \ 11 player.cc \ 12 collision.cc \ 13 data_tank.cc \ 14 world_entity.cc \ 15 vector.cc \ 16 camera.cc \ 17 command_node.cc \ 18 ini_parser.cc \ 19 keynames.cc \ 20 track.cc \ 21 base_entity.cc \ 22 game_loader.cc \ 23 campaign.cc \ 24 story_entity.cc \ 25 environment.cc \ 26 importer/object.cc \ 27 importer/array.cc \ 28 importer/material.cc \ 29 list.cc 11 30 31 noinst_HEADERS = ability.h \ 32 data_tank.h \ 33 collision.h \ 34 npc.h \ 35 stdincl.h \ 36 ai.h \ 37 environment.h \ 38 orxonox.h \ 39 synchronisable.h \ 40 base_entity.h \ 41 error.h \ 42 player.h \ 43 track.h \ 44 camera.h \ 45 ini_parser.h \ 46 power_up.h \ 47 vector.h \ 48 keynames.h \ 49 proto_class.h \ 50 world.h \ 51 command_node.h \ 52 list.h \ 53 shoot_laser.h \ 54 world_entity.h \ 55 coordinates.h \ 56 message_structures.h \ 57 shoot_rocket.h \ 58 list_template.h \ 59 story_entity.h \ 60 story_def.h \ 61 game_loader.h \ 62 campaign.h 12 63 64 ## orxonox.conf will be used from home-dir instead. 65 EXTRA_DIST = orxonox.conf 13 66 14 # uncomment the following if bencoder requires the math library 67 ### GTK_RELATED 68 if HAVE_GTK2 69 GTK_PROGS =console 70 else 71 GTK_PROGS = 72 endif 73 74 SUBDIRS = . \ 75 importer \ 76 gui \ 77 $(GTK_PROGS) 78 79 # uncomment the following if orxonox requires the math library 15 80 #orxonox_LDADD=-lm 16 81 -
orxonox/branches/nico/src/Makefile.in
r2991 r3238 54 54 PROGRAMS = $(bin_PROGRAMS) 55 55 am_orxonox_OBJECTS = orxonox.$(OBJEXT) world.$(OBJEXT) \ 56 player.$(OBJEXT) data_tank.$(OBJEXT) world_entity.$(OBJEXT) \57 vector.$(OBJEXT) camera.$(OBJEXT) collision.$(OBJEXT) \56 player.$(OBJEXT) collision.$(OBJEXT) data_tank.$(OBJEXT) \ 57 world_entity.$(OBJEXT) vector.$(OBJEXT) camera.$(OBJEXT) \ 58 58 command_node.$(OBJEXT) ini_parser.$(OBJEXT) keynames.$(OBJEXT) \ 59 59 track.$(OBJEXT) base_entity.$(OBJEXT) game_loader.$(OBJEXT) \ 60 campaign.$(OBJEXT) story_entity.$(OBJEXT) object.$(OBJEXT)\61 environment.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \62 list.$(OBJEXT)60 campaign.$(OBJEXT) story_entity.$(OBJEXT) \ 61 environment.$(OBJEXT) object.$(OBJEXT) array.$(OBJEXT) \ 62 material.$(OBJEXT) list.$(OBJEXT) 63 63 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 64 64 orxonox_LDADD = $(LDADD) … … 86 86 SOURCES = $(orxonox_SOURCES) 87 87 DIST_SOURCES = $(orxonox_SOURCES) 88 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ 89 html-recursive info-recursive install-data-recursive \ 90 install-exec-recursive install-info-recursive \ 91 install-recursive installcheck-recursive installdirs-recursive \ 92 pdf-recursive ps-recursive uninstall-info-recursive \ 93 uninstall-recursive 88 94 HEADERS = $(noinst_HEADERS) 89 95 ETAGS = etags 90 96 CTAGS = ctags 97 DIST_SUBDIRS = . importer gui console 91 98 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 92 99 ACLOCAL = @ACLOCAL@ … … 107 114 CXXFLAGS = @CXXFLAGS@ 108 115 CYGPATH_W = @CYGPATH_W@ 116 DEBUG = @DEBUG@ 109 117 DEFS = @DEFS@ 110 118 DEPDIR = @DEPDIR@ 119 DOXYGEN = @DOXYGEN@ 120 DOXYGEN_FALSE = @DOXYGEN_FALSE@ 121 DOXYGEN_TRUE = @DOXYGEN_TRUE@ 111 122 ECHO_C = @ECHO_C@ 112 123 ECHO_N = @ECHO_N@ … … 136 147 PACKAGE_VERSION = @PACKAGE_VERSION@ 137 148 PATH_SEPARATOR = @PATH_SEPARATOR@ 138 PKG_CONFIG = @PKG_CONFIG@139 149 SET_MAKE = @SET_MAKE@ 140 150 SHELL = @SHELL@ … … 183 193 target_os = @target_os@ 184 194 target_vendor = @target_vendor@ 185 AM_CXXFLAGS = "-I/usr/X11R6/include" 186 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS) 187 orxonox_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 game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc 188 noinst_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 object.h array.h material.h list_template.h story_entity.h story_def.h game_loader.h campaign.h 189 all: all-am 195 196 #AM_CXXFLAGS="" 197 AM_LDFLAGS = $(MWINDOWS) 198 orxonox_SOURCES = orxonox.cc \ 199 world.cc \ 200 player.cc \ 201 collision.cc \ 202 data_tank.cc \ 203 world_entity.cc \ 204 vector.cc \ 205 camera.cc \ 206 command_node.cc \ 207 ini_parser.cc \ 208 keynames.cc \ 209 track.cc \ 210 base_entity.cc \ 211 game_loader.cc \ 212 campaign.cc \ 213 story_entity.cc \ 214 environment.cc \ 215 importer/object.cc \ 216 importer/array.cc \ 217 importer/material.cc \ 218 list.cc 219 220 noinst_HEADERS = ability.h \ 221 data_tank.h \ 222 collision.h \ 223 npc.h \ 224 stdincl.h \ 225 ai.h \ 226 environment.h \ 227 orxonox.h \ 228 synchronisable.h \ 229 base_entity.h \ 230 error.h \ 231 player.h \ 232 track.h \ 233 camera.h \ 234 ini_parser.h \ 235 power_up.h \ 236 vector.h \ 237 keynames.h \ 238 proto_class.h \ 239 world.h \ 240 command_node.h \ 241 list.h \ 242 shoot_laser.h \ 243 world_entity.h \ 244 coordinates.h \ 245 message_structures.h \ 246 shoot_rocket.h \ 247 list_template.h \ 248 story_entity.h \ 249 story_def.h \ 250 game_loader.h \ 251 campaign.h 252 253 EXTRA_DIST = orxonox.conf 254 @HAVE_GTK2_FALSE@GTK_PROGS = 255 256 ### GTK_RELATED 257 @HAVE_GTK2_TRUE@GTK_PROGS = console 258 SUBDIRS = . \ 259 importer \ 260 gui \ 261 $(GTK_PROGS) 262 263 all: all-recursive 190 264 191 265 .SUFFIXES: … … 200 274 esac; \ 201 275 done; \ 202 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/Makefile'; \276 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ 203 277 cd $(top_srcdir) && \ 204 $(AUTOMAKE) -- gnusrc/Makefile278 $(AUTOMAKE) --foreign src/Makefile 205 279 .PRECIOUS: Makefile 206 280 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 290 364 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 291 365 @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 366 367 object.o: importer/object.cc 368 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.o -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc; \ 369 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi 370 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/object.cc' object='object.o' libtool=no @AMDEPBACKSLASH@ 371 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@ 372 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 373 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc 374 375 object.obj: importer/object.cc 376 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.obj -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`; \ 377 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi 378 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/object.cc' object='object.obj' libtool=no @AMDEPBACKSLASH@ 379 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@ 380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 381 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi` 382 383 array.o: importer/array.cc 384 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT array.o -MD -MP -MF "$(DEPDIR)/array.Tpo" -c -o array.o `test -f 'importer/array.cc' || echo '$(srcdir)/'`importer/array.cc; \ 385 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/array.Tpo" "$(DEPDIR)/array.Po"; else rm -f "$(DEPDIR)/array.Tpo"; exit 1; fi 386 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/array.cc' object='array.o' libtool=no @AMDEPBACKSLASH@ 387 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/array.Po' tmpdepfile='$(DEPDIR)/array.TPo' @AMDEPBACKSLASH@ 388 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 389 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o array.o `test -f 'importer/array.cc' || echo '$(srcdir)/'`importer/array.cc 390 391 array.obj: importer/array.cc 392 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT array.obj -MD -MP -MF "$(DEPDIR)/array.Tpo" -c -o array.obj `if test -f 'importer/array.cc'; then $(CYGPATH_W) 'importer/array.cc'; else $(CYGPATH_W) '$(srcdir)/importer/array.cc'; fi`; \ 393 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/array.Tpo" "$(DEPDIR)/array.Po"; else rm -f "$(DEPDIR)/array.Tpo"; exit 1; fi 394 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/array.cc' object='array.obj' libtool=no @AMDEPBACKSLASH@ 395 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/array.Po' tmpdepfile='$(DEPDIR)/array.TPo' @AMDEPBACKSLASH@ 396 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 397 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o array.obj `if test -f 'importer/array.cc'; then $(CYGPATH_W) 'importer/array.cc'; else $(CYGPATH_W) '$(srcdir)/importer/array.cc'; fi` 398 399 material.o: importer/material.cc 400 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT material.o -MD -MP -MF "$(DEPDIR)/material.Tpo" -c -o material.o `test -f 'importer/material.cc' || echo '$(srcdir)/'`importer/material.cc; \ 401 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/material.Tpo" "$(DEPDIR)/material.Po"; else rm -f "$(DEPDIR)/material.Tpo"; exit 1; fi 402 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/material.cc' object='material.o' libtool=no @AMDEPBACKSLASH@ 403 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/material.Po' tmpdepfile='$(DEPDIR)/material.TPo' @AMDEPBACKSLASH@ 404 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 405 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.o `test -f 'importer/material.cc' || echo '$(srcdir)/'`importer/material.cc 406 407 material.obj: importer/material.cc 408 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT material.obj -MD -MP -MF "$(DEPDIR)/material.Tpo" -c -o material.obj `if test -f 'importer/material.cc'; then $(CYGPATH_W) 'importer/material.cc'; else $(CYGPATH_W) '$(srcdir)/importer/material.cc'; fi`; \ 409 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/material.Tpo" "$(DEPDIR)/material.Po"; else rm -f "$(DEPDIR)/material.Tpo"; exit 1; fi 410 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/material.cc' object='material.obj' libtool=no @AMDEPBACKSLASH@ 411 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/material.Po' tmpdepfile='$(DEPDIR)/material.TPo' @AMDEPBACKSLASH@ 412 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 413 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.obj `if test -f 'importer/material.cc'; then $(CYGPATH_W) 'importer/material.cc'; else $(CYGPATH_W) '$(srcdir)/importer/material.cc'; fi` 292 414 uninstall-info-am: 415 416 # This directory's subdirectories are mostly independent; you can cd 417 # into them and run `make' without going through this Makefile. 418 # To change the values of `make' variables: instead of editing Makefiles, 419 # (1) if the variable is set in `config.status', edit `config.status' 420 # (which will cause the Makefiles to be regenerated when you run `make'); 421 # (2) otherwise, pass the desired values on the `make' command line. 422 $(RECURSIVE_TARGETS): 423 @set fnord $$MAKEFLAGS; amf=$$2; \ 424 dot_seen=no; \ 425 target=`echo $@ | sed s/-recursive//`; \ 426 list='$(SUBDIRS)'; for subdir in $$list; do \ 427 echo "Making $$target in $$subdir"; \ 428 if test "$$subdir" = "."; then \ 429 dot_seen=yes; \ 430 local_target="$$target-am"; \ 431 else \ 432 local_target="$$target"; \ 433 fi; \ 434 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ 435 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ 436 done; \ 437 if test "$$dot_seen" = "no"; then \ 438 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ 439 fi; test -z "$$fail" 440 441 mostlyclean-recursive clean-recursive distclean-recursive \ 442 maintainer-clean-recursive: 443 @set fnord $$MAKEFLAGS; amf=$$2; \ 444 dot_seen=no; \ 445 case "$@" in \ 446 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ 447 *) list='$(SUBDIRS)' ;; \ 448 esac; \ 449 rev=''; for subdir in $$list; do \ 450 if test "$$subdir" = "."; then :; else \ 451 rev="$$subdir $$rev"; \ 452 fi; \ 453 done; \ 454 rev="$$rev ."; \ 455 target=`echo $@ | sed s/-recursive//`; \ 456 for subdir in $$rev; do \ 457 echo "Making $$target in $$subdir"; \ 458 if test "$$subdir" = "."; then \ 459 local_target="$$target-am"; \ 460 else \ 461 local_target="$$target"; \ 462 fi; \ 463 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ 464 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ 465 done && test -z "$$fail" 466 tags-recursive: 467 list='$(SUBDIRS)'; for subdir in $$list; do \ 468 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ 469 done 470 ctags-recursive: 471 list='$(SUBDIRS)'; for subdir in $$list; do \ 472 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ 473 done 293 474 294 475 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) … … 302 483 tags: TAGS 303 484 304 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \485 TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 305 486 $(TAGS_FILES) $(LISP) 306 487 tags=; \ 307 488 here=`pwd`; \ 489 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ 490 include_option=--etags-include; \ 491 empty_fix=.; \ 492 else \ 493 include_option=--include; \ 494 empty_fix=; \ 495 fi; \ 496 list='$(SUBDIRS)'; for subdir in $$list; do \ 497 if test "$$subdir" = .; then :; else \ 498 test ! -f $$subdir/TAGS || \ 499 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 500 fi; \ 501 done; \ 308 502 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 309 503 unique=`for i in $$list; do \ … … 318 512 fi 319 513 ctags: CTAGS 320 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \514 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 321 515 $(TAGS_FILES) $(LISP) 322 516 tags=; \ … … 367 561 fi; \ 368 562 done 563 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ 564 if test "$$subdir" = .; then :; else \ 565 test -d "$(distdir)/$$subdir" \ 566 || mkdir "$(distdir)/$$subdir" \ 567 || exit 1; \ 568 (cd $$subdir && \ 569 $(MAKE) $(AM_MAKEFLAGS) \ 570 top_distdir="../$(top_distdir)" \ 571 distdir="../$(distdir)/$$subdir" \ 572 distdir) \ 573 || exit 1; \ 574 fi; \ 575 done 369 576 check-am: all-am 370 check: check- am577 check: check-recursive 371 578 all-am: Makefile $(PROGRAMS) $(HEADERS) 372 installdirs: 579 installdirs: installdirs-recursive 580 installdirs-am: 373 581 for dir in "$(DESTDIR)$(bindir)"; do \ 374 582 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 375 583 done 376 install: install- am377 install-exec: install-exec- am378 install-data: install-data- am379 uninstall: uninstall- am584 install: install-recursive 585 install-exec: install-exec-recursive 586 install-data: install-data-recursive 587 uninstall: uninstall-recursive 380 588 381 589 install-am: all-am 382 590 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 383 591 384 installcheck: installcheck- am592 installcheck: installcheck-recursive 385 593 install-strip: 386 594 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ … … 398 606 @echo "This command is intended for maintainers to use" 399 607 @echo "it deletes files that may require special tools to rebuild." 400 clean: clean- am608 clean: clean-recursive 401 609 402 610 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am 403 611 404 distclean: distclean- am612 distclean: distclean-recursive 405 613 -rm -rf ./$(DEPDIR) 406 614 -rm -f Makefile … … 408 616 distclean-tags 409 617 410 dvi: dvi- am618 dvi: dvi-recursive 411 619 412 620 dvi-am: 413 621 414 html: html- am415 416 info: info- am622 html: html-recursive 623 624 info: info-recursive 417 625 418 626 info-am: … … 422 630 install-exec-am: install-binPROGRAMS 423 631 424 install-info: install-info- am632 install-info: install-info-recursive 425 633 426 634 install-man: … … 428 636 installcheck-am: 429 637 430 maintainer-clean: maintainer-clean- am638 maintainer-clean: maintainer-clean-recursive 431 639 -rm -rf ./$(DEPDIR) 432 640 -rm -f Makefile 433 641 maintainer-clean-am: distclean-am maintainer-clean-generic 434 642 435 mostlyclean: mostlyclean- am643 mostlyclean: mostlyclean-recursive 436 644 437 645 mostlyclean-am: mostlyclean-compile mostlyclean-generic 438 646 439 pdf: pdf- am647 pdf: pdf-recursive 440 648 441 649 pdf-am: 442 650 443 ps: ps- am651 ps: ps-recursive 444 652 445 653 ps-am: … … 447 655 uninstall-am: uninstall-binPROGRAMS uninstall-info-am 448 656 449 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ 450 clean-generic ctags distclean distclean-compile \ 451 distclean-generic distclean-tags distdir dvi dvi-am html \ 657 uninstall-info: uninstall-info-recursive 658 659 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ 660 clean clean-binPROGRAMS clean-generic clean-recursive ctags \ 661 ctags-recursive distclean distclean-compile distclean-generic \ 662 distclean-recursive distclean-tags distdir dvi dvi-am html \ 452 663 html-am info info-am install install-am install-binPROGRAMS \ 453 664 install-data install-data-am install-exec install-exec-am \ 454 665 install-info install-info-am install-man install-strip \ 455 installcheck installcheck-am installdirs maintainer-clean \ 456 maintainer-clean-generic mostlyclean mostlyclean-compile \ 457 mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ 458 uninstall-am uninstall-binPROGRAMS uninstall-info-am 459 460 461 # uncomment the following if bencoder requires the math library 666 installcheck installcheck-am installdirs installdirs-am \ 667 maintainer-clean maintainer-clean-generic \ 668 maintainer-clean-recursive mostlyclean mostlyclean-compile \ 669 mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ 670 tags tags-recursive uninstall uninstall-am \ 671 uninstall-binPROGRAMS uninstall-info-am 672 673 674 # uncomment the following if orxonox requires the math library 462 675 #orxonox_LDADD=-lm 463 676 -
orxonox/branches/nico/src/ability.h
r2043 r3238 1 1 2 #ifndef ABILITY_H3 #define ABILITY_H2 #ifndef _ABILITY_H 3 #define _ABILITY_H 4 4 5 5 #include "data_tank.h" … … 14 14 }; 15 15 16 #endif 16 #endif /* _ABILITY_H */ -
orxonox/branches/nico/src/ai.h
r1956 r3238 1 1 2 #ifndef AI_H3 #define AI_H2 #ifndef _AI_H 3 #define _AI_H 4 4 5 5 #include "data_tank.h" … … 13 13 }; 14 14 15 #endif 15 #endif /* _AI_H */ -
orxonox/branches/nico/src/base_entity.h
r2551 r3238 1 1 2 #ifndef BASE_ENTITY_H3 #define BASE_ENTITY_H2 #ifndef _BASE_ENTITY_H 3 #define _BASE_ENTITY_H 4 4 5 5 #include "stdincl.h" … … 14 14 }; 15 15 16 #endif 16 #endif /* _BASE_ENTITY_H */ -
orxonox/branches/nico/src/camera.cc
r2636 r3238 30 30 { 31 31 this->world = world; 32 bound = NULL;32 this->bound = NULL; 33 33 /* give it some physical live */ 34 m = 10;35 a = new Vector(0.0, 0.0, 0.0);36 v = new Vector(0.0, 0.0, 0.0);37 fs = new Vector(0.0, 0.0, 0.0);38 cameraMode = NORMAL;39 deltaTime = 3000.0;40 cameraOffset = 1.0;41 cameraOffsetZ = 10.0;42 t = 0.0;43 44 actual_place.r.x = 0.0;45 actual_place.r.y = 10.0;46 actual_place.r.z = -5.0;34 this->m = 10; 35 this->a = new Vector(0.0, 0.0, 0.0); 36 this->v = new Vector(0.0, 0.0, 0.0); 37 this->fs = new Vector(0.0, 0.0, 0.0); 38 this->cameraMode = NORMAL; 39 this->deltaTime = 3000.0; 40 this->cameraOffset = 1.0; 41 this->cameraOffsetZ = 10.0; 42 this->t = 0.0; 43 44 this->actualPlace.r.x = 0.0; 45 this->actualPlace.r.y = 10.0; 46 this->actualPlace.r.z = -5.0; 47 47 } 48 48 … … 61 61 as smooth camera movement or swaying). 62 62 */ 63 void Camera::time _slice (Uint32 deltaT)64 { 65 if( t <= deltaTime)66 {t += deltaT;}63 void Camera::timeSlice (Uint32 deltaT) 64 { 65 if( this->t <= deltaTime) 66 {this->t += deltaT;} 67 67 //printf("time is: t=%f\n", t ); 68 update _desired_place();69 jump 68 updateDesiredPlace(); 69 jump(NULL); 70 70 } 71 71 … … 76 76 bound entity's position on the track. 77 77 */ 78 void Camera::update _desired_place ()78 void Camera::updateDesiredPlace () 79 79 { 80 80 switch(cameraMode) … … 89 89 if( bound != NULL) 90 90 { 91 bound->get _lookat (&lookat);92 orx->get _world()->calc_camera_pos (&lookat, &plFocus);91 bound->getLookat (&lookat); 92 orx->getWorld()->calcCameraPos (&lookat, &plFocus); 93 93 Quaternion *fr; 94 94 if(t < 20.0) … … 101 101 102 102 Vector op(1.0, 0.0, 0.0); 103 float angle = angle _deg(op, *start);103 float angle = angleDeg(op, *start); 104 104 printf("angle is: %f\n", angle); 105 105 … … 144 144 145 145 Vector ursp(0.0, 0.0, 0.0); 146 desired _place.r = /*plFocus.r -*/ ursp - res->apply(r);147 148 printf("desired place is: %f, %f, %f\n", desired _place.r.x, desired_place.r.y, desired_place.r.z);146 desiredPlace.r = /*plFocus.r -*/ ursp - res->apply(r); 147 148 printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z); 149 149 //plLastBPlace = *bound->get_placement(); 150 150 } … … 153 153 case SMOTH_FOLLOW: 154 154 { 155 Placement *plBound = bound->get _placement();155 Placement *plBound = bound->getPlacement(); 156 156 Location lcBound; 157 157 if(bound != null) 158 158 { 159 bound->get _lookat(&lcBound);159 bound->getLookat(&lcBound); 160 160 Vector vDirection(0.0, 0.0, 1.0); 161 161 vDirection = plBound->w.apply(vDirection); 162 desired _place.r = (vDirection * ((lcBound.dist-10.0)/* / l*/)) + Vector(0,0,5.0);162 desiredPlace.r = (vDirection * ((lcBound.dist-10.0)/* / l*/)) + Vector(0,0,5.0); 163 163 } 164 164 break; … … 169 169 if(bound != null) 170 170 { 171 Placement *plBound = bound->get _placement();171 Placement *plBound = bound->getPlacement(); 172 172 Vector vDirection(0.0, 0.0, 1.0); 173 173 Vector eclipticOffset(0.0, 0.0, 5.0); 174 174 vDirection = plBound->w.apply(vDirection); 175 desired _place.r = plBound->r - vDirection*10 + eclipticOffset;175 desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset; 176 176 } 177 177 break; … … 182 182 if( bound != NULL && world != NULL ) 183 183 { 184 bound->get _lookat (&lookat);185 world->calc _camera_pos (&lookat, &desired_place);184 bound->getLookat (&lookat); 185 world->calcCameraPos (&lookat, &desiredPlace); 186 186 } 187 187 else 188 188 { 189 desired _place.r = Vector (0,0,0);190 desired _place.w = Quaternion ();189 desiredPlace.r = Vector (0,0,0); 190 desiredPlace.w = Quaternion (); 191 191 } 192 192 break; … … 206 206 // view 207 207 // TO DO: implement options for frustum generation 208 glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 250.0); 208 //glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 250.0); 209 gluPerspective(60, 1.2f, 0.1, 250); 210 209 211 //Vector up(0,0,1); 210 212 //Vector dir(1,0,0); … … 235 237 // rotation 236 238 float matrix[4][4]; 237 actual _place.w.conjugate().matrix (matrix);239 actualPlace.w.conjugate().matrix (matrix); 238 240 /* orientation and */ 239 241 glMultMatrixf ((float*)matrix); 240 242 /* translation */ 241 glTranslatef (-actual _place.r.x, -actual_place.r.y,- actual_place.r.z);242 243 glTranslatef (-actualPlace.r.x, -actualPlace.r.y,- actualPlace.r.z); 244 //Placement *plBound = bound->get_placement(); 243 245 244 246 // ===== second camera control calculation option 245 247 /* 246 248 gluLookAt(actual_place.r.x, actual_place.r.y, actual_place.r.z, 247 249 plBound->r.x, plBound->r.y, plBound->r.z, 248 250 0.0, 0.0, 1.0); … … 263 265 if( plc == NULL) 264 266 { 265 actual _place = desired_place;267 actualPlace = desiredPlace; 266 268 //printf("Camera|jump: camer@ %f, %f, %f\n\n", actual_place.r.x, actual_place.r.y, actual_place.r.z); 267 269 } 268 270 else 269 271 { 270 desired _place = *plc;271 actual _place = *plc;272 desiredPlace = *plc; 273 actualPlace = *plc; 272 274 } 273 275 } … … 277 279 \param entity: The enitity to bind the camera to 278 280 279 280 281 281 This sets the focus of the camera to the given entity. This means that it will use the given WorldEntity's 282 Location and get_lookat() to determine the viewpoint the camera will render from. 283 Note that you cannot bind a camera to a free entity. 282 284 */ 283 285 void Camera::bind (WorldEntity* entity) … … 285 287 if( entity != NULL) 286 288 { 287 if( entity->isFree 289 if( entity->isFree()) printf("Cannot bind camera to free entity"); 288 290 else 289 291 { 290 bound = entity;292 this->bound = entity; 291 293 } 292 294 } … … 298 300 this->world = world; 299 301 } 302 303 304 /** 305 \brief destroy, reset the camera so that it doesn't perform anything anymore 306 307 */ 308 void Camera::destroy() 309 { 310 this->bound = NULL; 311 this->world = NULL; 312 } -
orxonox/branches/nico/src/camera.h
r2636 r3238 4 4 */ 5 5 6 #ifndef CAMERA_H7 #define CAMERA_H6 #ifndef _CAMERA_H 7 #define _CAMERA_H 8 8 9 9 #include "stdincl.h" … … 26 26 private: 27 27 WorldEntity* bound; //!< the WorldEntity the Camera is bound to 28 Placement actual _place; //!< the Camera's current position29 Placement desired _place; //!< where the Camera should be according to calculations28 Placement actualPlace; //!< the Camera's current position 29 Placement desiredPlace; //!< where the Camera should be according to calculations 30 30 World* world; 31 31 … … 54 54 CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity 55 55 56 void update _desired_place ();56 void updateDesiredPlace (); 57 57 58 58 public: … … 60 60 ~Camera (); 61 61 62 void time _slice (Uint32 deltaT);62 void timeSlice (Uint32 deltaT); 63 63 void apply (); 64 64 void bind (WorldEntity* entity); 65 65 void jump (Placement* plc); 66 void destroy(); 66 67 67 68 void setWorld(World* world); … … 69 70 }; 70 71 71 #endif 72 #endif /* _CAMERA_H */ -
orxonox/branches/nico/src/campaign.cc
r2816 r3238 34 34 35 35 36 Error Campaign::init()36 ErrorMessage Campaign::init() 37 37 { 38 38 this->isInit = true; … … 48 48 want to queue up in the campaign. 49 49 */ 50 void Campaign::addEntity(StoryEntity* se, Uint32storyID)50 void Campaign::addEntity(StoryEntity* se, int storyID) 51 51 { 52 52 se->setStoryID(storyID); … … 60 60 61 61 62 void Campaign::removeEntity( Uint32storyID)62 void Campaign::removeEntity(int storyID) 63 63 { 64 64 this->removeEntity(this->getStoryEntity(storyID)); … … 73 73 74 74 75 Error Campaign::start()75 ErrorMessage Campaign::start() 76 76 { 77 77 this->start(0); 78 78 } 79 79 80 Error Campaign::start(Uint32storyID = 0)80 ErrorMessage Campaign::start(int storyID = 0) 81 81 { 82 82 printf("World::start() - starting new StoryEntity Nr:%i\n", storyID); 83 Error errorCode;84 if( !this->isInit) return errorCode;85 if( storyID == WORLD_ID_GAMEEND) return errorCode;83 ErrorMessage errorCode; 84 if( !this->isInit) return errorCode; 85 if( storyID == WORLD_ID_GAMEEND) return errorCode; 86 86 this->running = true; 87 87 StoryEntity* se = this->getStoryEntity(storyID); 88 while(se != NULL && this->running) 88 this->currentEntity = se; 89 while( se != NULL && this->running) 89 90 { 90 se = this->getStoryEntity(storyID); 91 this->currentEntity = se; 92 93 se->displayEntityScreen(); 91 se->displayLoadScreen(); 94 92 se->load(); 95 93 se->init(); 96 se->release EntityScreen();94 se->releaseLoadScreen(); 97 95 se->start(); 96 se->destroy(); 97 98 delete se; 98 99 99 100 int nextWorldID = se->getNextStoryID(); 100 if(nextWorldID == WORLD_ID_GAMEEND) return errorCode;101 //printf("Campaing::start() - got nextWorldID = %i\n", nextWorldID); 101 102 se = this->getStoryEntity(nextWorldID); 102 if(se == NULL) 103 printf("Campaign::start() - ERROR: world it not found, oh oh..."); 103 this->currentEntity = se; 104 if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) ) 105 { 106 printf("Campaign::start() - quitting campaing story loop\n"); 107 if(se != NULL) 108 delete se; 109 return errorCode; 110 } 111 104 112 } 105 113 } 106 114 107 Error Campaign::stop()115 ErrorMessage Campaign::stop() 108 116 { 109 117 this->running = false; … … 111 119 { 112 120 this->currentEntity->stop(); 113 delete this->currentEntity;114 this->currentEntity = NULL;121 //delete this->currentEntity; 122 //this->currentEntity = NULL; 115 123 } 116 124 } 117 125 118 Error Campaign::pause()126 ErrorMessage Campaign::pause() 119 127 { 120 128 if(this->currentEntity != NULL) … … 123 131 124 132 125 Error Campaign::resume()133 ErrorMessage Campaign::resume() 126 134 { 127 135 if(this->currentEntity != NULL) … … 130 138 131 139 140 void Campaign::destroy() 141 { 142 if(this->currentEntity != NULL) 143 { 144 this->currentEntity->destroy(); 145 delete this->currentEntity; 146 this->currentEntity = NULL; 147 } 148 } 149 150 /* 151 \brief this changes to the next level 152 */ 132 153 void Campaign::nextLevel() 133 154 { 134 printf("Campaign|nextLevel\n"); 135 int nextID = this->currentEntity->getNextStoryID(); 136 this->stop(); 137 this->start(nextID); 155 printf("Campaign:nextLevel()\n"); 156 //int nextID = this->currentEntity->getNextStoryID(); 157 //this->stop(); 158 //this->start(nextID); 159 this->currentEntity->stop(); 138 160 } 139 161 162 /* 163 \brief change to the previous level - not implemented 164 165 this propably useless 166 */ 140 167 void Campaign::previousLevel() 141 168 {} 142 169 143 170 144 StoryEntity* Campaign::getStoryEntity(Uint32 storyID) 171 /* 172 \brief lookup a entity with a given id 173 \param story id to be lookuped 174 \returns the entity found or NULL if search ended without match 175 */ 176 StoryEntity* Campaign::getStoryEntity(int storyID) 145 177 { 178 //printf("Campaing::getStoryEntity(%i) - getting next Entity\n", storyID); 179 if( storyID == WORLD_ID_GAMEEND) 180 return NULL; 146 181 ListTemplate<StoryEntity>* l; 147 StoryEntity* entity ;148 l = this->entities->get _next();182 StoryEntity* entity = NULL; 183 l = this->entities->getNext(); 149 184 while( l != NULL) 150 185 { 151 entity = l->get_object(); 152 l = l->get_next(); 153 if(entity->getStoryID() == storyID) 154 return entity; 186 entity = l->getObject(); 187 l = l->getNext(); 188 int id = entity->getStoryID(); 189 //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id); 190 if(id == storyID) 191 { 192 //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n"); 193 return entity; 194 } 155 195 } 156 196 return NULL; -
orxonox/branches/nico/src/campaign.h
r2816 r3238 1 1 2 #ifndef CAMPAIGN_H3 #define CAMPAIGN_H2 #ifndef _CAMPAIGN_H 3 #define _CAMPAIGN_H 4 4 5 5 #include "stdincl.h" … … 17 17 StoryEntity* currentEntity; 18 18 19 virtual Error init();20 virtual Error start();21 virtual Error start(Uint32storyID);22 virtual Error stop();23 virtual Error pause();24 virtual Error resume();19 virtual ErrorMessage init(); 20 virtual ErrorMessage start(); 21 virtual ErrorMessage start(int storyID); 22 virtual ErrorMessage stop(); 23 virtual ErrorMessage pause(); 24 virtual ErrorMessage resume(); 25 25 26 void addEntity(StoryEntity* se, Uint32 storyID); 26 virtual void destroy(); 27 28 void addEntity(StoryEntity* se, int storyID); 27 29 void addEntity(StoryEntity* se); 28 void removeEntity( Uint32storyID);30 void removeEntity(int storyID); 29 31 void removeEntity(StoryEntity* se); 30 32 … … 36 38 bool running; 37 39 38 StoryEntity* getStoryEntity( Uint32storyID);40 StoryEntity* getStoryEntity(int storyID); 39 41 }; 40 42 41 #endif 43 #endif /* _CAMPAIGN_H */ -
orxonox/branches/nico/src/collision.cc
r2190 r3238 28 28 CollisionCluster::CollisionCluster (float rad = 1.0, Vector mid = Vector(0,0,0)) 29 29 { 30 root = (CC _Tree*) malloc( sizeof( CC_Tree));30 root = (CCTree*) malloc( sizeof( CCTree)); 31 31 root->n = 0; 32 32 root->data.ID = 0; … … 62 62 } 63 63 64 root = load _CC_Tree (stream);64 root = loadCCTree (stream); 65 65 fclose (stream); 66 66 } … … 71 71 CollisionCluster::~CollisionCluster () 72 72 { 73 free _CC_Tree(root);73 freeCCTree(root); 74 74 } 75 75 … … 85 85 stream = fopen( filename, "wb"); 86 86 if( stream == NULL) return -1; 87 r = save _CC_Tree(root, stream);87 r = saveCCTree(root, stream); 88 88 fclose (stream); 89 89 return r; … … 99 99 \return true on collision, false otherwise. If true is returned, the flag in ahitflags that symbolises the hit subsphere is set, and impactpoint is set to the Location where the intersection occured 100 100 */ 101 bool check _trace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line* trace, Vector* impactpoint)102 { 103 CC _Tree* t;101 bool checkTrace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line* trace, Vector* impactpoint) 102 { 103 CCTree* t; 104 104 if( (t = a->root) == NULL) return false; 105 105 106 return cc tree_trace( pa, t, ahitflags, trace, impactpoint);106 return ccTreeTrace( pa, t, ahitflags, trace, impactpoint); 107 107 } 108 108 … … 118 118 If true is returned, all flags in ahitflags and bhitflags that symbolize intersecting subspheres in the respective CollisionCluster are set 119 119 */ 120 bool check _collision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags)121 { 122 CC _Tree* ta, *tb;120 bool checkCollision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags) 121 { 122 CCTree* ta, *tb; 123 123 if( (ta = a->root) == NULL) return false; 124 124 if( (tb = b->root) == NULL) return false; 125 125 126 return cc tree_iterate(pa, ta, ahitflags, pb, tb, bhitflags);126 return ccTreeIterate(pa, ta, ahitflags, pb, tb, bhitflags); 127 127 } 128 128 … … 135 135 \return true on intersection, false otherwise 136 136 */ 137 bool sphere _sphere_collision( Vector m1, float r1, Vector m2, float r2)137 bool sphereSphereCollision( Vector m1, float r1, Vector m2, float r2) 138 138 { 139 139 if ((m1-m2).len() < r1+r2) return true; … … 149 149 \return true on intersection, false otherwise. If true is returned, impactpoint is set to the loaction where the intersection occured 150 150 */ 151 bool trace _sphere_collision( Vector m, float r, const Line* l, Vector* impactpoint)151 bool traceSphereCollision( Vector m, float r, const Line* l, Vector* impactpoint) 152 152 { 153 153 float A, B, C, D, t[2]; … … 176 176 } 177 177 178 bool cc tree_iterate(const Placement* pa, CC_Tree* ta, unsigned long* ahitflags, const Placement* pb, CC_Tree* tb, unsigned long* bhitflags)178 bool ccTreeIterate(const Placement* pa, CCTree* ta, unsigned long* ahitflags, const Placement* pb, CCTree* tb, unsigned long* bhitflags) 179 179 { 180 180 bool r = false; … … 182 182 Vector mra = pa->r + pa->w.apply(ta->m); 183 183 Vector mrb = pb->r + pb->w.apply(tb->m); 184 CC _Tree* use_a, *use_b;185 186 if( use _a == NULL || use_b== NULL) return false;187 188 if( sphere _sphere_collision( mra, ta->r, mrb, tb->r))184 CCTree* useA, *useB; 185 186 if( useA == NULL || useB == NULL) return false; 187 188 if( sphereSphereCollision( mra, ta->r, mrb, tb->r)) 189 189 { 190 190 if( ta->n == 0 && tb->n == 0) … … 196 196 for( ia = 0; ia < ta->n || ta->n == 0; ia++) 197 197 { 198 if( ta->n == 0) use _a= ta;199 else use _a= ta->data.b[ia];198 if( ta->n == 0) useA = ta; 199 else useA = ta->data.b[ia]; 200 200 for( ib = 0; ib < tb->n || ta->n == 0; ib++) 201 201 { 202 if( ta->n == 0) use _b= ta;203 else use _b= ta->data.b[ib];202 if( ta->n == 0) useB = ta; 203 else useB = ta->data.b[ib]; 204 204 205 r = r || cc tree_iterate( pa, use_a, ahitflags, pb, use_b, bhitflags);205 r = r || ccTreeIterate( pa, useA, ahitflags, pb, useB, bhitflags); 206 206 207 207 if( tb->n == 0) break; … … 233 233 234 234 /** 235 \brief frees the memory allocated in a CC _Tree236 */ 237 void free _CC_Tree( CC_Tree* tree)235 \brief frees the memory allocated in a CCTree 236 */ 237 void freeCCTree( CCTree* tree) 238 238 { 239 239 if (tree == NULL) return; 240 240 for (int i = 0; i < tree->n; i++) 241 241 { 242 free _CC_Tree(tree->data.b[i]);242 freeCCTree(tree->data.b[i]); 243 243 } 244 244 free( tree); … … 246 246 247 247 /** 248 \brief loads a CC _Tree from a stream249 */ 250 CC _Tree* load_CC_Tree (FILE* stream)251 { 252 CC _Tree* tree = NULL;253 CC _Tree** branches = NULL;248 \brief loads a CCTree from a stream 249 */ 250 CCTree* loadCCTree (FILE* stream) 251 { 252 CCTree* tree = NULL; 253 CCTree** branches = NULL; 254 254 float buf[4]; 255 255 unsigned long n; … … 267 267 else 268 268 { 269 branches = (CC _Tree**)malloc( sizeof(CC_Tree*) * n);269 branches = (CCTree**)malloc( sizeof(CCTree*) * n); 270 270 for( int i = 0; i < n; i++) 271 271 { 272 if ((branches[i] = load _CC_Tree (stream)) == NULL)272 if ((branches[i] = loadCCTree (stream)) == NULL) 273 273 { 274 274 for( int j = 0; j < i; j++) 275 275 { 276 free _CC_Tree (branches[j]);277 free 276 freeCCTree (branches[j]); 277 free(branches); 278 278 return NULL; 279 279 } … … 283 283 284 284 // assemble 285 tree = (CC _Tree*) malloc (sizeof(CC_Tree));285 tree = (CCTree*) malloc (sizeof(CCTree)); 286 286 tree->m.x = buf[0]; 287 287 tree->m.y = buf[1]; … … 297 297 298 298 /** 299 \brief saves a CC _Tree to a stream300 */ 301 int save _CC_Tree (CC_Tree* tree, FILE* stream)299 \brief saves a CCTree to a stream 300 */ 301 int saveCCTree (CCTree* tree, FILE* stream) 302 302 { 303 303 float buf[4]; … … 321 321 for( int i = 0; i < tree->n; i++) 322 322 { 323 if ( save _CC_Tree (tree->data.b[i], stream) == -1) return -1;323 if ( saveCCTree (tree->data.b[i], stream) == -1) return -1; 324 324 } 325 325 } … … 329 329 } 330 330 331 bool cc tree_trace( const Placement* p, CC_Tree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint)331 bool ccTreeTrace( const Placement* p, CCTree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint) 332 332 { 333 333 bool r = false; 334 334 int i; 335 335 Vector mr = p->r + p->w.apply (t->m); 336 CC _Tree* use_t;336 CCTree* useT; 337 337 Vector* ips; 338 338 unsigned long* hfs; 339 339 340 if( trace _sphere_collision (mr, t->r, trace, impactpoint))340 if( traceSphereCollision (mr, t->r, trace, impactpoint)) 341 341 { 342 342 if( t->n == 0) … … 352 352 for (i = 0; i < t->n; i++) 353 353 { 354 r = r || cc tree_trace (p, t->data.b[i], &(hfs[i]), trace, &(ips[i]));354 r = r || ccTreeTrace (p, t->data.b[i], &(hfs[i]), trace, &(ips[i])); 355 355 } 356 356 if( r) -
orxonox/branches/nico/src/collision.h
r2190 r3238 4 4 */ 5 5 6 #ifndef COLLISION_H7 #define COLLISION_H6 #ifndef _COLLISION_H 7 #define _COLLISION_H 8 8 9 9 #include "vector.h" … … 14 14 15 15 //! Tree structure used by the CollisionCluster 16 typedef struct CC _Tree16 typedef struct CCTree 17 17 { 18 18 unsigned long n; 19 19 union 20 20 { 21 struct CC _Tree** b;21 struct CCTree** b; 22 22 unsigned long ID; 23 23 } data; 24 24 float r; 25 25 Vector m; 26 } CC _Tree;26 } CCTree; 27 27 28 28 //! Basic collision detection class … … 42 42 class CollisionCluster { 43 43 44 CC _Tree* root;44 CCTree* root; 45 45 46 46 … … 52 52 int store (char* filename); 53 53 54 friend bool cc tree_trace( const Placement* p, CC_Tree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint);55 friend bool cc tree_iterate(const Placement* pa, CC_Tree* ta, unsigned long* ahitflags, const Placement* pb, CC_Tree* tb, unsigned long* bhitflags);56 friend bool check _trace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line* trace, Vector* impactpoint);57 friend bool check _collision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags);54 friend bool ccTreeTrace( const Placement* p, CCTree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint); 55 friend bool ccTreeIterate(const Placement* pa, CCTree* ta, unsigned long* ahitflags, const Placement* pb, CCTree* tb, unsigned long* bhitflags); 56 friend bool checkTrace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line* trace, Vector* impactpoint); 57 friend bool checkCollision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags); 58 58 }; 59 59 60 bool sphere _sphere_collision( Vector m1, float r1, Vector m2, float r2);61 bool trace _sphere_collision( Vector m, float r, const Line* l, Vector* impactpoint);60 bool sphereSphereCollision( Vector m1, float r1, Vector m2, float r2); 61 bool traceSphereCollision( Vector m, float r, const Line* l, Vector* impactpoint); 62 62 63 63 void setflag( unsigned long* flags, unsigned long ID); 64 64 65 void free _CC_Tree( CC_Tree* tree);66 CC _Tree* load_CC_Tree (FILE* stream);67 int save _CC_Tree (CC_Tree* tree, FILE* stream);65 void freeCCTree( CCTree* tree); 66 CCTree* loadCCTree (FILE* stream); 67 int saveCCTree (CCTree* tree, FILE* stream); 68 68 69 #endif 69 #endif /* _COLLISION_H */ -
orxonox/branches/nico/src/command_node.cc
r2816 r3238 20 20 #include "world_entity.h" 21 21 #include "game_loader.h" 22 #include "world.h" 22 23 23 24 #include <stdio.h> … … 33 34 CommandNode::CommandNode (int ID) 34 35 { 35 bound = new List(); 36 aliases = NULL; 37 netID = ID; 38 bLocalInput = false; 36 this->bound = new tList<WorldEntity>(); 37 this->aliases = NULL; 38 this->netID = ID; 39 this->bLocalInput = false; 40 this->bEnabled = true; 41 this->world = NULL; 39 42 } 40 43 … … 45 48 CommandNode::CommandNode (char* filename = DEFAULT_KEYBIND_FILE) 46 49 { 47 aliases = NULL; 48 bLocalInput = true; 49 netID = 0; 50 bound = new List(); 51 load_bindings (filename); 50 this->aliases = NULL; 51 this->bLocalInput = true; 52 this->netID = 0; 53 this->bound = new tList<WorldEntity>(); 54 this->bEnabled = true; 55 this->world = NULL; 56 this->loadBindings (filename); 52 57 } 53 58 … … 58 63 { 59 64 if( aliases != NULL) free (aliases); 60 if( bound != NULL) delete bound; 61 } 62 65 if( bound != NULL) delete bound; /* \todo should this delete bound? dangerous FIX */ 66 } 67 68 69 /** 70 \brief this resets the command node 71 72 deleting all data contained in the command node to fill it up again 73 74 \todo coppling to different game-entities 75 \todo reset/destroy has to be redesigned 76 */ 63 77 64 78 void CommandNode::reset() 65 79 { 66 this->bound->clear(); 67 } 80 this->bound->destroy(); 81 //this->bound = NULL; /* \todo this produces a NULLpointer error.. FIX */ 82 this->bEnabled = false; 83 this->world = NULL; 84 } 85 86 void CommandNode::enable(bool bEnabled) 87 { 88 this->bEnabled = bEnabled; 89 } 90 91 92 /** 93 \brief adds Node to a GameWorld 94 95 this is usefull, if you want to catch events in a world class. usualy 96 this is done automaticaly via GameLoader. Reset it via 97 CommandNode::reset() 98 99 */ 100 void CommandNode::addToWorld(World* world) 101 { 102 this->world = world; 103 } 104 68 105 69 106 /** … … 71 108 \param filename: The path and name of the file to load the bindings from 72 109 */ 73 void CommandNode::load _bindings (char* filename)110 void CommandNode::loadBindings (char* filename) 74 111 { 75 112 FILE* stream; … … 88 125 // create parser 89 126 IniParser parser (filename); 90 if( parser.get _section ("Bindings") == -1)127 if( parser.getSection ("Bindings") == -1) 91 128 { 92 129 printf("Could not find key bindings in %s\n", filename); … … 102 139 int* index; 103 140 104 while( parser.next _var (namebuf, valuebuf) != -1)105 { 106 index = name _to_index (namebuf);141 while( parser.nextVar (namebuf, valuebuf) != -1) 142 { 143 index = nameToIndex (namebuf); 107 144 switch( index[0]) 108 145 { 109 146 case 0: 110 printf("Key binding %d(%s) set to %s\n", index[1], SDLK _to_keyname( index[1]), valuebuf);147 printf("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), valuebuf); 111 148 strcpy (aliases->keys[index[1]], valuebuf); 112 149 break; 113 150 case 1: 114 printf("Button binding %d(%s) set to %s\n", index[1], SDLB _to_buttonname( index[1]), valuebuf);151 printf("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), valuebuf); 115 152 strcpy (aliases->buttons[index[1]], valuebuf); 116 153 break; … … 141 178 } 142 179 143 int* CommandNode::name _to_index (char* name)180 int* CommandNode::nameToIndex (char* name) 144 181 { 145 182 coord[0] = -1; 146 183 coord[1] = -1; 147 184 int c; 148 if( (c = keyname _to_SDLK (name)) != -1)185 if( (c = keynameToSDLK (name)) != -1) 149 186 { 150 187 coord[1] = c; 151 188 coord[0] = 0; 152 189 } 153 if( (c = buttonname _to_SDLB (name)) != -1)190 if( (c = buttonnameToSDLB (name)) != -1) 154 191 { 155 192 coord[1] = c; … … 164 201 void CommandNode::process () 165 202 { 166 if( bLocalInput) process_local (); 167 else process_network (); 168 } 169 170 void CommandNode::process_local () 203 if( this->bEnabled) 204 { 205 if( bLocalInput) processLocal (); 206 else processNetwork (); 207 } 208 } 209 210 void CommandNode::processLocal () 171 211 { 172 212 SDL_Event event; 173 213 Command cmd; 174 175 214 while( SDL_PollEvent (&event)) 176 215 { … … 181 220 strcpy (cmd.cmd, aliases->keys[event.key.keysym.sym]); 182 221 cmd.bUp = false; 183 if( strlen (cmd.cmd) > 0) relay 222 if( strlen (cmd.cmd) > 0) relay(&cmd); 184 223 break; 185 224 case SDL_KEYUP: 186 225 strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]); 187 226 cmd.bUp = true; 188 if( strlen (cmd.cmd) > 0) relay 227 if( strlen (cmd.cmd) > 0) relay(&cmd); 189 228 break; 190 229 case SDL_MOUSEMOTION: … … 198 237 strcpy( cmd.cmd, aliases->buttons[event.button.button]); 199 238 cmd.bUp = true; 200 if( strlen (cmd.cmd) > 0) relay 239 if( strlen (cmd.cmd) > 0) relay(&cmd); 201 240 break; 202 241 case SDL_MOUSEBUTTONDOWN: 203 242 strcpy( cmd.cmd, aliases->buttons[event.button.button]); 204 243 cmd.bUp = false; 205 if( strlen (cmd.cmd) > 0) relay 244 if( strlen (cmd.cmd) > 0) relay(&cmd); 206 245 break; 207 246 case SDL_JOYAXISMOTION: … … 213 252 default: 214 253 Orxonox *orx = Orxonox::getInstance(); 215 orx->event_handler (&event); 216 254 orx->eventHandler(&event); 217 255 break; 218 256 } … … 221 259 222 260 223 void CommandNode::process _network ()261 void CommandNode::processNetwork () 224 262 { 225 263 … … 229 267 void CommandNode::relay (Command* cmd) 230 268 { 231 269 232 270 Orxonox *orx = Orxonox::getInstance(); 233 if( orx->system_command (cmd)) return; 271 if( orx->systemCommand (cmd)) return; 272 234 273 GameLoader* gl = GameLoader::getInstance(); 235 if(gl->worldCommand(cmd)) return; 236 237 if( bLocalInput) send_over_network (cmd); 238 274 if( gl->worldCommand(cmd)) return; 275 276 if( bLocalInput) sendOverNetwork (cmd); 277 278 if( this->world->command(cmd)) return; 279 239 280 WorldEntity* entity = bound->enumerate(); 240 while( 281 while( entity != NULL) 241 282 { 242 283 entity->command (cmd); … … 250 291 \param ID: the new ID to use 251 292 */ 252 void CommandNode::set _netID (int ID)293 void CommandNode::setNetID (int ID) 253 294 { 254 295 netID = ID; 255 296 } 256 297 257 void CommandNode::send _over_network (Command* cmd)258 { 259 } 298 void CommandNode::sendOverNetwork (Command* cmd) 299 { 300 } -
orxonox/branches/nico/src/command_node.h
r2816 r3238 6 6 */ 7 7 8 #ifndef COMMAND_NODE_H9 #define COMMAND_NODE_H8 #ifndef _COMMAND_NODE_H 9 #define _COMMAND_NODE_H 10 10 11 11 #include "stdincl.h" 12 12 13 13 class WorldEntity; 14 class World; 14 15 15 16 #define N_STD_KEYS SDLK_LAST … … 39 40 private: 40 41 bool bLocalInput; //!< Identifies the CommandNode that processes local input 42 bool bEnabled; 41 43 int netID; //!< Unique identifier that is used to determine between remote CommandNodes 42 44 KeyBindings* aliases; 43 List* bound; //!< List of WorldEntites that recieve commands from this CommandNode45 tList<WorldEntity>* bound; //!< List of WorldEntites that recieve commands from this CommandNode 44 46 Sint32 coord[2]; 47 World* world; 45 48 46 49 47 50 void relay (Command* cmd); 48 int* name _to_index (char* name);49 void process _local ();50 void process _network ();51 void send _over_network (Command* cmd);51 int* nameToIndex (char* name); 52 void processLocal (); 53 void processNetwork (); 54 void sendOverNetwork (Command* cmd); 52 55 53 56 public: … … 56 59 ~CommandNode (); 57 60 58 void reset(); 59 void load_bindings (char* filename); 61 void reset (); 62 void enable (bool bEnabled); 63 void loadBindings (char* filename); 60 64 void bind (WorldEntity* entity); 61 65 void unbind (WorldEntity* entity); 66 void addToWorld (World* world); 62 67 void process (); 63 68 64 void set _netID (int ID);69 void setNetID (int ID); 65 70 }; 66 71 67 #endif 72 #endif /* _COMMAND_NODE_H */ -
orxonox/branches/nico/src/coordinates.h
r2551 r3238 4 4 */ 5 5 6 #ifndef COORDINATES_H7 #define COORDINATES_H6 #ifndef _COORDINATES_H 7 #define _COORDINATES_H 8 8 9 9 #include "vector.h" … … 34 34 } Placement; 35 35 36 #endif 36 #endif /* _COORDINATS_H */ -
orxonox/branches/nico/src/data_tank.h
r2190 r3238 1 1 2 #ifndef DATA_TANK_H3 #define DATA_TANK_H2 #ifndef _DATA_TANK_H 3 #define _DATA_TANK_H 4 4 5 5 … … 12 12 }; 13 13 14 #endif 14 #endif /* _DATA_TANK_H */ -
orxonox/branches/nico/src/environment.cc
r2816 r3238 67 67 void Environment::draw () 68 68 { 69 printf("Environment::draw()");70 71 69 glMatrixMode(GL_MODELVIEW); 72 70 glLoadIdentity(); 73 71 float matrix[4][4]; 74 72 75 glTranslatef(get _placement()->r.x,get_placement()->r.y,get_placement()->r.z);76 get _placement()->w.matrix (matrix);73 glTranslatef(getPlacement()->r.x,getPlacement()->r.y,getPlacement()->r.z); 74 getPlacement()->w.matrix (matrix); 77 75 glMultMatrixf ((float*)matrix); 78 76 79 77 glBegin(GL_TRIANGLES); 80 glColor3f(1, 1,1);78 glColor3f(1,0,1); 81 79 glVertex3f(0,0,0.5); 82 80 glVertex3f(-0.5,0,-1); … … 89 87 90 88 glBegin(GL_QUADS); 91 glColor3f( 0,0,1);89 glColor3f(1,0,1); 92 90 glVertex3f(0.5,0.5,-1); 93 91 glVertex3f(0.5,-0.5,-1); -
orxonox/branches/nico/src/environment.h
r2816 r3238 1 #ifndef ENVIRONEMENT_H2 #define ENVIRONEMENT_H1 #ifndef _ENVIRONEMENT_H 2 #define _ENVIRONEMENT_H 3 3 4 4 #include "world_entity.h" … … 29 29 }; 30 30 31 #endif 31 #endif /* _ENVIRONEMENT_H */ -
orxonox/branches/nico/src/error.h
r2644 r3238 22 22 */ 23 23 24 // this are the two undefined error nr. Don't use them ... 25 #define ERROR -1 26 #define NERROR 0 24 25 #ifndef _ERROR_H 26 #define _ERROR_H 27 28 // these are the two undefined error nr. Don't use them ... 29 #define oERROR -1 30 31 #define oNOERROR 0 27 32 28 33 /*! … … 54 59 char* message; 55 60 char* location; 56 } Error; 61 } ErrorMessage; 62 63 #endif /* _ERROR_H */ -
orxonox/branches/nico/src/game_loader.cc
r2636 r3238 42 42 43 43 44 /** 45 \brief this class is a singleton class 46 \returns an instance of itself 47 48 if you are unsure about singleton classes, check the theory out on the internet :) 49 */ 44 50 GameLoader* GameLoader::getInstance() 45 51 { … … 50 56 51 57 52 Error GameLoader::init()58 ErrorMessage GameLoader::init() 53 59 { 54 60 if(this->currentCampaign != NULL) … … 57 63 58 64 59 Error GameLoader::loadCampaign(char* name) 60 { 61 Error errorCode; 65 /** 66 \brief reads a campaign definition file into a campaign class 67 \param filename to be loaded 68 \returns the loaded campaign 69 70 this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns 71 */ 72 ErrorMessage GameLoader::loadCampaign(char* name) 73 { 74 ErrorMessage errorCode; 62 75 63 76 this->currentCampaign = this->fileToCampaign(name); 64 77 } 65 78 66 Error GameLoader::loadDebugCampaign(Uint32 campaignID) 79 80 /** 81 \brief loads a debug campaign for test purposes only. 82 \param the identifier of the campaign. 83 \returns error message if not able to do so. 84 */ 85 ErrorMessage GameLoader::loadDebugCampaign(Uint32 campaignID) 67 86 { 68 87 switch(campaignID) … … 72 91 { 73 92 Campaign* debugCampaign = new Campaign(); 93 74 94 World* world0 = new World(DEBUG_WORLD_0); 75 world0->setNextStoryID( DEBUG_WORLD_1);95 world0->setNextStoryID(WORLD_ID_1); 76 96 debugCampaign->addEntity(world0, WORLD_ID_0); 97 77 98 World* world1 = new World(DEBUG_WORLD_1); 78 99 world1->setNextStoryID(WORLD_ID_GAMEEND); … … 85 106 } 86 107 87 Error GameLoader::start()108 ErrorMessage GameLoader::start() 88 109 { 89 110 if(this->currentCampaign != NULL) … … 92 113 93 114 94 Error GameLoader::stop()115 ErrorMessage GameLoader::stop() 95 116 { 96 117 if(this->currentCampaign != NULL) … … 100 121 101 122 102 Error GameLoader::pause()123 ErrorMessage GameLoader::pause() 103 124 { 104 125 this->isPaused = true; … … 108 129 109 130 110 Error GameLoader::resume()131 ErrorMessage GameLoader::resume() 111 132 { 112 133 this->isPaused = false; … … 115 136 } 116 137 117 Error GameLoader::free() 138 /** 139 \brief release the mem 140 */ 141 ErrorMessage GameLoader::destroy() 118 142 {} 119 143 120 144 121 122 123 145 /** 146 \brief reads a campaign definition file into a campaign class 147 \param filename to be loaded 148 \returns the loaded campaign 149 150 this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns 151 */ 124 152 Campaign* GameLoader::fileToCampaign(char *name) 125 153 { … … 134 162 \brief handle keyboard commands 135 163 \param cmd: the command to handle 136 \return true if the command was handled by the system164 \returns true if the command was handled by the system 137 165 */ 138 166 bool GameLoader::worldCommand (Command* cmd) … … 165 193 return true; 166 194 } 195 else if( !strcmp( cmd->cmd, "quit")) 196 { 197 if( !cmd->bUp) this->stop(); 198 return true; 199 } 167 200 return false; 168 201 } 169 202 203 204 /* 205 \brief this changes to the next level 206 */ 170 207 void GameLoader::nextLevel() 171 208 { … … 174 211 } 175 212 213 214 /* 215 \brief change to the previous level - not implemented 216 217 this propably useless 218 */ 176 219 void GameLoader::previousLevel() 177 220 { -
orxonox/branches/nico/src/game_loader.h
r2636 r3238 1 #ifndef GAME_LOADER_H2 #define GAME_LOADER_H1 #ifndef _GAME_LOADER_H 2 #define _GAME_LOADER_H 3 3 4 4 #include "stdincl.h" … … 20 20 static GameLoader* getInstance(); 21 21 22 Error init();23 Error loadCampaign(char* name);24 Error start();25 Error stop();26 Error pause();27 Error resume();28 Error free();22 ErrorMessage init(); 23 ErrorMessage loadCampaign(char* name); 24 ErrorMessage start(); 25 ErrorMessage stop(); 26 ErrorMessage pause(); 27 ErrorMessage resume(); 28 ErrorMessage destroy(); 29 29 30 30 void nextLevel(); … … 32 32 33 33 bool worldCommand(Command* cmd); 34 Error loadDebugCampaign(Uint32 campaignID);34 ErrorMessage loadDebugCampaign(Uint32 campaignID); 35 35 36 36 private: … … 47 47 }; 48 48 49 #endif 49 #endif /* _GAME_LOADER_H */ -
orxonox/branches/nico/src/ini_parser.cc
r2551 r3238 25 25 IniParser::IniParser (char* filename) 26 26 { 27 28 29 open_file(filename);27 stream = NULL; 28 bInSection = false; 29 openFile(filename); 30 30 } 31 31 … … 35 35 IniParser::~IniParser () 36 36 { 37 37 if( stream != NULL) fclose (stream); 38 38 } 39 39 40 40 /** 41 42 43 41 \brief opens another file to parse 42 \param filename: path and name of the new file to parse 43 \return zero on success or -1 if an error occured; 44 44 */ 45 int IniParser::open _file( char* filename)45 int IniParser::openFile( char* filename) 46 46 { 47 48 49 50 51 52 53 54 55 47 if( filename == NULL) return -1; 48 if( stream != NULL) fclose (stream); 49 if( (stream = fopen (filename, "r")) == NULL) 50 { 51 printf("IniParser could not open %s\n", filename); 52 return -1; 53 } 54 bInSection = false; 55 return 0; 56 56 } 57 57 58 58 /** 59 60 61 59 \brief set the parsing cursor to the specified section 60 \param section: the name of the section to set the cursor to 61 \return zero on success or -1 if the section could not be found 62 62 */ 63 int IniParser::get _section( char* section)63 int IniParser::getSection( char* section) 64 64 { 65 65 bInSection = false; … … 95 95 96 96 /** 97 98 99 100 97 \brief gets the next VarName=VarValue pair from the parsing stream 98 \param name: a pointer to a buffer to store the name of the entry 99 \param value: a pointer to a buffer to store the value of the entry 100 \return zero if the buffers have been filled with data or -1 if there are no entries left in the current section 101 101 */ 102 int IniParser::next _var( char* name, char* value)102 int IniParser::nextVar( char* name, char* value) 103 103 { 104 if( stream == NULL) 104 if( stream == NULL) 105 { 106 bInSection = false; 107 return -1; 108 } 109 if( !bInSection) return -1; 110 111 char linebuffer[PARSELINELENGHT]; 112 char* ptr; 113 114 while( !feof( stream)) 115 { 116 // get next line 117 fgets (linebuffer, PARSELINELENGHT, stream); 118 // remove newline char 119 if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0; 120 if( linebuffer[0] == '[') 105 121 { 106 107 122 bInSection = false; 123 return -1; 108 124 } 109 if( !bInSection) return -1; 110 111 char linebuffer[PARSELINELENGHT]; 112 char* ptr; 113 114 while( !feof( stream)) 125 if( (ptr = strchr( linebuffer, '=')) != NULL) 115 126 { 116 // get next line 117 fgets (linebuffer, PARSELINELENGHT, stream); 118 // remove newline char 119 if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0; 120 if( linebuffer[0] == '[') 121 { 122 bInSection = false; 123 return -1; 124 } 125 if( (ptr = strchr( linebuffer, '=')) != NULL) 126 { 127 if( ptr == linebuffer) continue; 128 strcpy (value, &ptr[1]); 129 strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1); 130 return 0; 131 } 127 if( ptr == linebuffer) continue; 128 strcpy (value, &ptr[1]); 129 strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1); 130 return 0; 132 131 } 133 return -1; 132 } 133 return -1; 134 134 } 135 135 136 136 /** 137 138 139 140 141 142 143 144 137 \brief directly acesses an entry in a section 138 \param name: the name of the entry to find 139 \param section: the section where the entry is to be found 140 \param defvalue: what should be returned in case the entry cannot be found 141 \return a pointer to a buffer conatining the value of the specified entry. This buffer will contain the data specified in defvalue in case the entry wasn't found 142 143 The returned pointer points to an internal buffer, so do not free it on your own. Do not give a NULL pointer to defvalue, this will certainly 144 lead to unwanted behaviour. 145 145 */ 146 char* IniParser::get _var( char* name, char* section, char* defvalue = "")146 char* IniParser::getVar( char* name, char* section, char* defvalue = "") 147 147 { 148 strcpy (internbuf, defvalue); 149 if( get_section (section) == -1) return internbuf; 150 151 char namebuf[PARSELINELENGHT]; 152 char valuebuf[PARSELINELENGHT]; 153 154 while( next_var (namebuf, valuebuf) != -1) 148 strcpy (internbuf, defvalue); 149 if( getSection (section) == -1) return internbuf; 150 151 char namebuf[PARSELINELENGHT]; 152 char valuebuf[PARSELINELENGHT]; 153 154 while( nextVar (namebuf, valuebuf) != -1) 155 { 156 if( !strcmp (name, namebuf)) 155 157 { 156 if( !strcmp (name, namebuf)) 157 { 158 strcpy (internbuf, valuebuf); 159 return internbuf; 160 } 158 strcpy (internbuf, valuebuf); 159 return internbuf; 161 160 } 162 return internbuf; 161 } 162 return internbuf; 163 163 } -
orxonox/branches/nico/src/ini_parser.h
r2190 r3238 6 6 */ 7 7 8 #ifndef INI_PARSER_H9 #define INI_PARSER_H8 #ifndef _INI_PARSER_H 9 #define _INI_PARSER_H 10 10 11 11 #include <stdio.h> … … 29 29 ~IniParser (); 30 30 31 char* get _var( char* name, char* section, char* defvalue);32 int open _file( char* name);33 int get _section( char* section);34 int next _var( char* name, char* value);31 char* getVar( char* name, char* section, char* defvalue); 32 int openFile( char* name); 33 int getSection( char* section); 34 int nextVar( char* name, char* value); 35 35 }; 36 36 37 #endif 37 #endif /* _INI_PARSER_H */ -
orxonox/branches/nico/src/keynames.cc
r2995 r3238 20 20 using namespace std; 21 21 22 int buttonname _to_SDLB( char* name)22 int buttonnameToSDLB( char* name) 23 23 { 24 24 if( !strcmp (name, "BUTTON_LEFT")) return SDL_BUTTON_LEFT; … … 30 30 } 31 31 32 char* SDLB _to_buttonname( int button)32 char* SDLBToButtonname( int button) 33 33 { 34 34 if( button == SDL_BUTTON_LEFT) return "BUTTON_LEFT"; … … 40 40 } 41 41 42 int keyname _to_SDLK( char* name)42 int keynameToSDLK( char* name) 43 43 { 44 44 if( !strcmp (name, "BACKSPACE")) return SDLK_BACKSPACE; … … 178 178 } 179 179 180 char* SDLK _to_keyname( int key)180 char* SDLKToKeyname( int key) 181 181 { 182 182 if( key == SDLK_BACKSPACE) return "BACKSPACE"; -
orxonox/branches/nico/src/keynames.h
r2995 r3238 5 5 Converts strings to SDLK/SDL_BUTTON values and vice versa 6 6 */ 7 #ifndef _KEYNAMES_H 8 #define _KEYNAMES_H 9 7 10 8 11 #ifdef __WIN32__ … … 21 24 \return an int containing the SDL identifier of the mouse button or -1 if the button name is not valid 22 25 */ 23 int buttonname _to_SDLB( char* name);26 int buttonnameToSDLB( char* name); 24 27 25 28 /** … … 28 31 \return a pointer to a string containing the name of the mouse button 29 32 */ 30 char* SDLB _to_buttonname( int button);33 char* SDLBToButtonname( int button); 31 34 32 35 /** … … 35 38 \return the SDLK sym of the named key or -1 if the key name is not valid 36 39 */ 37 int keyname _to_SDLK( char* name);40 int keynameToSDLK( char* name); 38 41 39 42 /** … … 42 45 \return a pointer to a string containig the name of the key 43 46 */ 44 char* SDLK _to_keyname( int key);47 char* SDLKToKeyname( int key); 45 48 49 50 #endif /* _KEYNAMES_H */ -
orxonox/branches/nico/src/list.cc
r2818 r3238 77 77 78 78 79 void List:: clear()79 void List::destroy() 80 80 { 81 81 printf("List::clear() - clearing all world objects, releasing mem\n"); 82 82 this->currentEl = this->first; 83 listElement* le = NULL; 83 84 while(this->currentEl != NULL) 84 85 { 85 l istElement* le = this->currentEl->next;86 le = this->currentEl->next; 86 87 delete this->currentEl->curr; 87 88 delete this->currentEl; -
orxonox/branches/nico/src/list.h
r2822 r3238 1 1 2 #ifndef LIST_H3 #define LIST_H2 #ifndef _LIST_H 3 #define _LIST_H 4 4 5 5 #include "stdincl.h" … … 22 22 void add(WorldEntity* entity); 23 23 void remove(WorldEntity* entity); 24 void clear();24 void destroy(); 25 25 WorldEntity* firstElement(); 26 26 bool isEmpty(); … … 80 80 void add(WorldEntity* entity); 81 81 void remove(WorldEntity* entity); 82 void clear();82 void destroy(); 83 83 T* firstElement(); 84 84 bool isEmpty(); … … 106 106 void tList<T>::add(WorldEntity* entity) 107 107 { 108 printf("tList<T>::add() \n");109 108 listElement* el = new listElement; 110 109 el->prev = this->last; … … 128 127 { 129 128 if( this->currentEl->curr == entity) 130 { 131 printf("tList<T>::remove() - object found\n"); 132 129 { 133 130 if( this->currentEl->prev == NULL ) this->first = this->currentEl->next; 134 131 else this->currentEl->prev->next = this->currentEl->next; … … 148 145 149 146 template<class T> 150 void tList<T>::clear() 151 { 152 printf("tList<T>::clear() - clearing all world objects, releasing mem\n"); 147 void tList<T>::destroy() 148 { 153 149 this->currentEl = this->first; 154 150 while(this->currentEl != NULL) … … 209 205 {} 210 206 211 #endif 207 #endif /* _LIST_H */ -
orxonox/branches/nico/src/list_template.h
r2816 r3238 23 23 */ 24 24 25 #ifndef LIST_TEMPLATE_H26 #define LIST_TEMPLATE_H25 #ifndef _LIST_TEMPLATE_H 26 #define _LIST_TEMPLATE_H 27 27 28 28 #include "stdincl.h" … … 46 46 ~ListTemplate (); 47 47 48 int add 49 T* get _object();50 ListTemplate<T>* get _next();51 ListTemplate<T>* get _previous();52 ListTemplate<T>* get _last();53 ListTemplate<T>* get _first();54 void set _next(ListTemplate<T>* ptr);55 void set _prev(ListTemplate<T>* ptr);48 int add(T* obj, ADDMODE mode, bool bRef); 49 T* getObject(); 50 ListTemplate<T>* getNext(); 51 ListTemplate<T>* getPrevious(); 52 ListTemplate<T>* getLast(); 53 ListTemplate<T>* getFirst(); 54 void setNext(ListTemplate<T>* ptr); 55 void setPrev(ListTemplate<T>* ptr); 56 56 int remove (T* obj, FINDMODE mode); 57 57 int getSize(); 58 void destroy(); 58 59 }; 59 60 … … 100 101 else 101 102 { 102 if (prev != NULL) prev->set _next (next);103 if (next != NULL) next->set _prev (prev);103 if (prev != NULL) prev->setNext (next); 104 if (next != NULL) next->setPrev (prev); 104 105 if (!bReference) delete object; 105 106 } … … 130 131 case LIST_ADD_NEXT: 131 132 p = new ListTemplate<T>( obj, next, this, bRef); 132 if( next != NULL) next->set _prev (p);133 if( next != NULL) next->setPrev (p); 133 134 next = p; 134 135 break; 135 136 case LIST_ADD_PREV: 136 137 p = new ListTemplate<T>( obj, this, prev, bRef); 137 if( prev != NULL) prev->set _next (p);138 if( prev != NULL) prev->setNext (p); 138 139 prev = p; 139 140 break; … … 159 160 */ 160 161 template<class T> 161 ListTemplate<T>* ListTemplate<T>::get _next ()162 ListTemplate<T>* ListTemplate<T>::getNext () 162 163 { 163 164 return next; … … 169 170 */ 170 171 template<class T> 171 ListTemplate<T>* ListTemplate<T>::get _previous ()172 ListTemplate<T>* ListTemplate<T>::getPrevious () 172 173 { 173 174 return prev; … … 179 180 */ 180 181 template<class T> 181 ListTemplate<T>* ListTemplate<T>::get _last ()182 ListTemplate<T>* ListTemplate<T>::getLast () 182 183 { 183 184 if (next == NULL) return this; 184 else return next->get _last();185 else return next->getLast(); 185 186 } 186 187 … … 190 191 */ 191 192 template<class T> 192 ListTemplate<T>* ListTemplate<T>::get _first ()193 ListTemplate<T>* ListTemplate<T>::getFirst () 193 194 { 194 195 if (prev == NULL) return this; 195 else return prev->get _first();196 else return prev->getFirst(); 196 197 } 197 198 … … 220 221 else 221 222 { 222 if( prev->get _object() == obj)223 if( prev->getObject() == obj) 223 224 { 224 225 delete prev; … … 234 235 else 235 236 { 236 if( next->get _object() == obj)237 if( next->getObject() == obj) 237 238 { 238 239 delete next; … … 259 260 */ 260 261 template<class T> 261 void ListTemplate<T>::set _next (ListTemplate<T>* ptr)262 void ListTemplate<T>::setNext (ListTemplate<T>* ptr) 262 263 { 263 264 next = ptr; … … 271 272 */ 272 273 template<class T> 273 void ListTemplate<T>::set _prev (ListTemplate<T>* ptr)274 void ListTemplate<T>::setPrev (ListTemplate<T>* ptr) 274 275 { 275 276 prev = ptr; … … 281 282 */ 282 283 template<class T> 283 T* ListTemplate<T>::get _object()284 T* ListTemplate<T>::getObject() 284 285 { 285 286 return object; … … 297 298 } 298 299 299 #endif 300 300 301 template<class T> 302 void ListTemplate<T>::destroy() 303 { 304 /* \todo at the moment - doing nothing. should delete everything */ 305 } 306 307 #endif /* _LIST_TENMPLATE_H */ 308 -
orxonox/branches/nico/src/message_structures.h
r2551 r3238 4 4 */ 5 5 6 #ifndef _MESSAGE STRUCTURES_H7 #define _MESSAGE STRUCTURES_H6 #ifndef _MESSAGE_STRUCTURES_H 7 #define _MESSAGE_STRUCTURES_H 8 8 9 9 #define CMD_LENGHT 16 … … 26 26 } Command; 27 27 28 #endif 28 #endif /* _MESSAGE_STRUCTURES_H */ -
orxonox/branches/nico/src/npc.h
r2036 r3238 1 1 2 #ifndef NPC_H3 #define NPC_H2 #ifndef _NPC_H 3 #define _NPC_H 4 4 5 5 #include "world_entity.h" … … 41 41 }; 42 42 43 #endif 43 #endif /* _NPC_H */ -
orxonox/branches/nico/src/orxonox.cc
r2817 r3238 47 47 Orxonox::~Orxonox () 48 48 { 49 Orxonox::singleton _ref = NULL;49 Orxonox::singletonRef = NULL; 50 50 if( world != NULL) delete world; 51 51 if( localinput != NULL) delete world; … … 56 56 57 57 /* this is a singleton class to prevent duplicates */ 58 Orxonox* Orxonox::singleton _ref = 0;58 Orxonox* Orxonox::singletonRef = 0; 59 59 60 60 Orxonox* Orxonox::getInstance (void) 61 61 { 62 if (singleton _ref == NULL)63 singleton _ref = new Orxonox();64 return singleton _ref;62 if (singletonRef == NULL) 63 singletonRef = new Orxonox(); 64 return singletonRef; 65 65 } 66 66 … … 72 72 it's path and name into configfilename 73 73 */ 74 void Orxonox::get_config_file (int argc, char** argv) 75 { 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 74 void Orxonox::getConfigFile (int argc, char** argv) 75 { 87 76 strcpy (configfilename, "orxonox.conf"); 88 77 } … … 96 85 // config file 97 86 98 get_config_file (argc, argv); 99 100 // initialize SDL 101 printf("> Initializing SDL\n"); 102 if( SDL_Init (SDL_INIT_EVERYTHING) == -1) 87 getConfigFile (argc, argv); 88 SDL_Init (SDL_INIT_TIMER); 89 // initialize everything 90 if( initVideo() == -1) return -1; 91 if( initSound() == -1) return -1; 92 printf("> Initializing input\n"); 93 if( initInput() == -1) return -1; 94 printf("> Initializing networking\n"); 95 if( initNetworking () == -1) return -1; 96 printf("> Initializing resources\n"); 97 if( initResources () == -1) return -1; 98 //printf("> Initializing world\n"); 99 //if( init_world () == -1) return -1; PB: world will be initialized when started 100 101 return 0; 102 } 103 104 /** 105 \brief initializes SDL and OpenGL 106 */ 107 int Orxonox::initVideo() 108 { 109 printf("> Initializing video\n"); 110 if (SDL_Init(SDL_INIT_VIDEO) == -1) 103 111 { 104 printf (" Could not SDL_Init(): %s\n", SDL_GetError());112 printf ("could not initialize SDL Video\n"); 105 113 return -1; 106 114 } 107 108 // initialize everything109 printf("> Initializing video\n");110 if( init_video () == -1) return -1;111 printf("> Initializing sound\n");112 if( init_sound () == -1) return -1;113 printf("> Initializing input\n");114 if( init_input () == -1) return -1;115 printf("> Initializing networking\n");116 if( init_networking () == -1) return -1;117 printf("> Initializing resources\n");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 started121 122 return 0;123 }124 125 /**126 \brief initializes SDL and OpenGL127 */128 int Orxonox::init_video ()129 {130 115 // Set video mode 131 116 // TO DO: parse arguments for settings 132 SDL_GL_SetAttribute 133 SDL_GL_SetAttribute 134 SDL_GL_SetAttribute 135 SDL_GL_SetAttribute 117 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 118 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 119 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 120 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 136 121 137 122 int bpp = 16; … … 140 125 Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; 141 126 142 if( 127 if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL) 143 128 { 144 printf 129 printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError()); 145 130 SDL_Quit(); 146 131 return -1; … … 148 133 149 134 // Set window labeling 150 // TO DO: Add version information to caption 151 SDL_WM_SetCaption( "Orxonox", "Orxonox"); 135 SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 152 136 153 137 // TO DO: Create a cool icon and use it here … … 176 160 177 161 // create camera 178 localcamera = new Camera(world); 179 180 return 0; 181 } 162 //localcamera = new Camera(world); /* \todo camera/input node not used anymore*/ 163 164 return 0; 165 } 166 182 167 183 168 /** 184 169 \brief initializes the sound engine 185 170 */ 186 int Orxonox::init_sound () 187 { 171 int Orxonox::initSound() 172 { 173 printf("> Initializing sound\n"); 174 // SDL_Init(SDL_INIT_AUDIO); 188 175 printf("Not yet implemented\n"); 189 176 return 0; 190 177 } 191 178 179 192 180 /** 193 181 \brief initializes input functions 194 182 */ 195 int Orxonox::init _input()183 int Orxonox::initInput() 196 184 { 197 185 // create localinput … … 201 189 } 202 190 191 203 192 /** 204 193 \brief initializes network system 205 194 */ 206 int Orxonox::init _networking()195 int Orxonox::initNetworking() 207 196 { 208 197 printf("Not yet implemented\n"); … … 210 199 } 211 200 201 212 202 /** 213 203 \brief initializes and loads resource files 214 204 */ 215 int Orxonox::init _resources()205 int Orxonox::initResources() 216 206 { 217 207 printf("Not yet implemented\n"); … … 219 209 } 220 210 211 221 212 /** 222 213 \brief initializes the world 223 214 */ 224 int Orxonox::init _world()215 int Orxonox::initWorld() 225 216 { 226 217 //world = new World(); … … 250 241 } 251 242 243 252 244 /** 253 245 \brief exits Orxonox … … 258 250 } 259 251 260 /** 261 \brief this runs all of Orxonox 262 */ 263 void Orxonox::mainLoop() 264 { 265 lastframe = SDL_GetTicks(); 266 bQuitOrxonox = false; 267 // This is where everything is run 268 printf("Orxonox|Entering main loop\n"); 269 while( !bQuitOrxonox) 270 { 271 // Network 272 synchronize(); 273 // Process input 274 handle_input(); 275 // Process time 276 time_slice(); 277 // Process collision 278 collision(); 279 // Draw 280 display(); 281 } 282 printf("Orxonox|Exiting the main loop\n"); 283 } 252 284 253 285 254 /** … … 287 256 \param event: an event not handled by the CommandNode 288 257 */ 289 void Orxonox::event _handler(SDL_Event* event)258 void Orxonox::eventHandler(SDL_Event* event) 290 259 { 291 260 // Handle special events such as reshape, quit, focus changes 292 261 } 293 294 /** 295 \brief synchronize local data with remote data 296 */ 297 void Orxonox::synchronize () 298 { 299 // Get remote input 300 // Update synchronizables 301 } 302 303 /** 304 \brief run all input processing 305 */ 306 void Orxonox::handle_input () 307 { 308 // localinput 309 localinput->process(); 310 // remoteinput 311 } 312 313 /** 314 \brief advance the timeline 315 */ 316 void Orxonox::time_slice () 317 { 318 Uint32 curframe = SDL_GetTicks(); 319 if( !pause) 320 { 321 Uint32 dt = curframe - lastframe; 322 323 if(dt > 0) 324 { 325 float fps = 1000/dt; 326 printf("fps = %f\n", fps); 327 } 328 329 world->time_slice (dt); 330 world->update (); 331 localcamera->time_slice (dt); 332 } 333 lastframe = curframe; 334 } 335 336 /** 337 \brief compute collision detection 338 */ 339 void Orxonox::collision () 340 { 341 world->collide (); 342 } 262 343 263 344 264 /** … … 347 267 \return true if the command was handled by the system or false if it may be passed to the WorldEntities 348 268 */ 349 bool Orxonox::system_command (Command* cmd) 350 { 269 bool Orxonox::systemCommand(Command* cmd) 270 { 271 /* 351 272 if( !strcmp( cmd->cmd, "quit")) 352 273 { … … 355 276 } 356 277 return false; 357 } 358 359 /** 360 \brief render the current frame 361 */ 362 void Orxonox::display () 363 { 364 // clear buffer 365 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 366 // set camera 367 localcamera->apply (); 368 // draw world 369 world->draw (); 370 // draw HUD 371 // flip buffers 372 SDL_GL_SwapBuffers(); 373 } 278 */ 279 return false; 280 } 281 374 282 375 283 /** … … 377 285 \return a pointer to localcamera 378 286 */ 379 Camera* Orxonox::get _camera()287 Camera* Orxonox::getCamera() 380 288 { 381 289 return localcamera; 382 290 } 291 383 292 384 293 /** … … 386 295 \return a pointer to localinput 387 296 */ 388 CommandNode* Orxonox::get _localinput()297 CommandNode* Orxonox::getLocalInput() 389 298 { 390 299 return localinput; 391 300 } 301 392 302 393 303 /** … … 395 305 \return a pointer to world 396 306 */ 397 World* Orxonox::get _world()307 World* Orxonox::getWorld() 398 308 { 399 309 return world; 400 310 } 401 311 402 int main (int argc, char** argv) 312 313 314 315 int main(int argc, char** argv) 403 316 { 404 317 printf(">>> Starting Orxonox <<<\n"); 405 318 Orxonox *orx = Orxonox::getInstance(); 406 319 407 if( 320 if((*orx).init(argc, argv) == -1) 408 321 { 409 322 printf("! Orxonox initialization failed\n"); … … 411 324 } 412 325 413 //(*orx).mainLoop();414 415 326 orx->start(); 416 327 -
orxonox/branches/nico/src/orxonox.h
r2995 r3238 4 4 */ 5 5 6 #ifndef ORXONOX_H7 #define ORXONOX_H6 #ifndef _ORXONOX_H 7 #define _ORXONOX_H 8 8 9 9 #include "stdincl.h" … … 22 22 23 23 private: 24 static Orxonox* singleton _ref;24 static Orxonox* singletonRef; 25 25 Orxonox (); 26 26 ~Orxonox (); … … 38 38 Uint32 lastframe; 39 39 40 void get _config_file (int argc, char** argv);40 void getConfigFile (int argc, char** argv); 41 41 42 42 // main loop functions 43 void synchronize ();44 void handle_input ();45 void time_slice ();46 void collision ();47 void display ();43 // void synchronize (); 44 //void handle_input (); 45 //void time_slice (); 46 //void collision (); 47 //void display (); 48 48 49 49 // subsystem initialization 50 int init _video ();51 int init _sound ();52 int init _input ();53 int init _networking ();54 int init _resources ();55 int init _world ();50 int initVideo (); 51 int initSound (); 52 int initInput (); 53 int initNetworking (); 54 int initResources (); 55 int initWorld (); 56 56 57 57 public: … … 60 60 void quitGame(); 61 61 62 void event _handler (SDL_Event* event);63 bool system _command (Command* cmd);62 void eventHandler (SDL_Event* event); 63 bool systemCommand (Command* cmd); 64 64 65 65 int init (int argc, char** argv); 66 66 67 CommandNode* get _localinput();68 Camera* get _camera();69 World* get _world();67 CommandNode* getLocalInput(); 68 Camera* getCamera(); 69 World* getWorld(); 70 70 71 void mainLoop();71 //void mainLoop(); 72 72 }; 73 73 74 #endif 74 #endif /* _ORXONOX_H */ 75 75 -
orxonox/branches/nico/src/player.cc
r2969 r3238 26 26 { 27 27 28 obj = new Object("reaplow.obj");28 this->obj = new Object("reaplow.obj"); 29 29 /* 30 30 objectList = glGenLists(1); … … 54 54 } 55 55 56 Player::~Player () 57 56 Player::~Player() 58 57 { 58 delete this->obj; 59 59 } 60 60 61 void Player::post _spawn()61 void Player::postSpawn() 62 62 { 63 travel _speed = 15.0;63 travelSpeed = 15.0; 64 64 velocity = Vector(); 65 65 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 66 66 bFire = false; 67 67 acceleration = 10.0; 68 set _collision (new CollisionCluster(1.0, Vector(0,0,0)));68 setCollision(new CollisionCluster(1.0, Vector(0,0,0))); 69 69 } 70 70 71 void Player::tick 71 void Player::tick(float time) 72 72 { 73 74 73 // movement 74 move (time); 75 75 } 76 76 77 void Player::hit 77 void Player::hit(WorldEntity* weapon, Vector loc) 78 78 { 79 79 } 80 80 81 void Player::destroy 81 void Player::destroy() 82 82 { 83 83 } 84 84 85 void Player::collide (WorldEntity* other,Uint32 ownhitflags, Uint32 otherhitflags)85 void Player::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) 86 86 { 87 87 } 88 88 89 void Player::command 89 void Player::command(Command* cmd) 90 90 { 91 91 //printf("Player|recieved command [%s]\n", cmd->cmd); … … 97 97 } 98 98 99 void Player::draw 99 void Player::draw() 100 100 { 101 101 glMatrixMode(GL_MODELVIEW); … … 103 103 float matrix[4][4]; 104 104 105 glTranslatef(get _placement()->r.x,get_placement()->r.y,get_placement()->r.z);106 get _placement()->w.matrix (matrix);107 glMultMatrixf 105 glTranslatef(getPlacement()->r.x, getPlacement()->r.y, getPlacement()->r.z); 106 getPlacement()->w.matrix (matrix); 107 glMultMatrixf((float*)matrix); 108 108 109 glMatrixMode 110 glRotatef 109 glMatrixMode(GL_MODELVIEW); 110 glRotatef(-90, 0,1,0); 111 111 obj->draw(); 112 // glCallList(objectList);112 // glCallList(objectList); 113 113 114 114 115 115 116 //printf("Player@%f/%f/%f\n", get_placement()->r.x, get_placement()->r.y, get_placement()->r.z);117 116 } 118 117 119 void Player::get _lookat(Location* locbuf)118 void Player::getLookat(Location* locbuf) 120 119 { 121 *locbuf = *get_location();122 120 *locbuf = *getLocation(); 121 //locbuf->dist += 5.0; 123 122 } 124 123 125 void Player::left _world()124 void Player::leftWorld() 126 125 { 127 126 } 128 127 129 void Player::move 128 void Player::move(float time) 130 129 { 131 130 Vector accel(0.0, 0.0, 0.0); 132 /* FIXME: calculating the direction and orthDirection every time _slice is redundant! save it somewhere */133 Placement *pos = get _placement();131 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 132 Placement *pos = getPlacement(); 134 133 /* calculate the direction in which the craft is heading */ 135 134 Vector direction(0.0, 0.0, 1.0); … … 143 142 if( bRight ) { accel = accel - (orthDirection*acceleration); } 144 143 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 145 if( bDescend) {/* FIXME */} 144 if( bDescend) {/* FIXME */} /* \todo up and down player movement */ 146 145 147 Location* l = get _location();146 Location* l = getLocation(); 148 147 149 148 // r(t) = r(0) + v(0)*t + 1/2*a*t^2 … … 153 152 154 153 /* this the base-speed of the player: determines how fast and how the player follows the track*/ 155 l->dist = l->dist + travel _speed * time;154 l->dist = l->dist + travelSpeed * time; 156 155 157 156 /* this updates the player position on the track - user interaction */ 158 157 l->pos = l->pos + accel*time; 159 158 } 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 -
orxonox/branches/nico/src/player.h
r2811 r3238 4 4 */ 5 5 6 #ifndef PLAYER_H7 #define PLAYER_H6 #ifndef _PLAYER_H 7 #define _PLAYER_H 8 8 9 9 #include "world_entity.h" 10 #include " object.h"10 #include "importer/object.h" 11 11 12 12 //! Basic controllable WorldEntity … … 16 16 17 17 public: 18 Player 19 ~Player 18 Player(bool isFree = false); 19 ~Player(); 20 20 21 virtual void post _spawn();22 virtual void tick 23 virtual void hit 24 virtual void destroy 25 virtual void collide (WorldEntity* other,Uint32 ownhitflags, Uint32 otherhitflags);26 virtual void command 21 virtual void postSpawn(); 22 virtual void tick(float time); 23 virtual void hit(WorldEntity* weapon, Vector loc); 24 virtual void destroy(); 25 virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 26 virtual void command(Command* cmd); 27 27 28 virtual void draw 29 virtual void get _lookat(Location* locbuf);28 virtual void draw(); 29 virtual void getLookat(Location* locbuf); 30 30 31 virtual void left _world();31 virtual void leftWorld(); 32 32 33 33 private: … … 35 35 bool bFire; 36 36 Vector velocity; 37 float travel _speed;37 float travelSpeed; 38 38 float acceleration; 39 39 GLuint objectList; 40 40 Object* obj; 41 41 42 void move 42 void move(float time); 43 43 44 44 }; 45 45 46 #endif 46 #endif /* _PLAYER_H */ -
orxonox/branches/nico/src/power_up.h
r2077 r3238 4 4 */ 5 5 6 #ifndef POWER_UP_H7 #define POWER_UP_H6 #ifndef _POWER_UP_H 7 #define _POWER_UP_H 8 8 9 9 #include "data_tank.h" … … 19 19 }; 20 20 21 #endif 21 #endif /* _POWER_UP_H */ -
orxonox/branches/nico/src/proto_class.h
r2036 r3238 1 1 2 #ifndef PROTO_CLASS_H3 #define PROTO_CLASS_H2 #ifndef _PROTO_CLASS_H 3 #define _PROTO_CLASS_H 4 4 5 5 #include "data_tank.h" … … 14 14 }; 15 15 16 #endif 16 #endif /* _PROTO_CLASS_H */ -
orxonox/branches/nico/src/shoot_laser.h
r2036 r3238 1 1 2 #ifndef SHOOT_LASER_H3 #define SHOOT_LASER_H2 #ifndef _SHOOT_LASER_H 3 #define _SHOOT_LASER_H 4 4 5 5 … … 40 40 }; 41 41 42 #endif 42 #endif /* _SHOOT_LASER_H */ -
orxonox/branches/nico/src/shoot_rocket.h
r2036 r3238 1 1 2 #ifndef SHOOT_ROCKET_H3 #define SHOOT_ROCKET_H2 #ifndef _SHOOT_ROCKET_H 3 #define _SHOOT_ROCKET_H 4 4 5 5 … … 54 54 }; 55 55 56 #endif 56 #endif /* _SHOOT_ROCKET_H */ -
orxonox/branches/nico/src/stdincl.h
r2995 r3238 1 /*! 2 \file stdincl.h 3 \brief This file includes default headers that nearly every Class needs. 4 5 no Class is defined here, but many headers to classes, and more general Headers like the openGL-header. 6 */ 1 7 2 #ifndef STDINCL_H3 #define STDINCL_H8 #ifndef _STDINCL_H 9 #define _STDINCL_H 4 10 5 #define null 0 11 #define null 0 //!< null 12 13 // this includes the information from configure/makefiles 14 #if HAVE_CONFIG_H 15 #include <config.h> 16 #endif 6 17 7 18 #ifdef __WIN32__ … … 11 22 #ifndef __APPLE__ 12 23 #include <SDL/SDL.h> 24 #include <GL/gl.h> 25 #include <GL/glu.h> 13 26 #else 14 27 #include <SDL.h> 28 #include <OpenGL/gl.h> 29 #include <OpenGL/glu.h> 15 30 #endif 16 17 #include <GL/gl.h>18 #include <GL/glu.h>19 31 20 32 #include "vector.h" … … 23 35 #include "list_template.h" 24 36 #include "error.h" 37 #include "debug.h" 25 38 #include "message_structures.h" 26 39 #include "orxonox.h" 27 40 28 #endif 41 #endif /* _STDINCL_H */ -
orxonox/branches/nico/src/story_def.h
r2636 r3238 1 1 2 #ifndef STORY_DEF_H3 #define STORY_DEF_H2 #ifndef _STORY_DEF_H 3 #define _STORY_DEF_H 4 4 5 5 6 #define DEBUG_CAMPAIGN_0 07 #define DEBUG_CAMPAIGN_1 1 8 #define DEBUG_CAMPAIGN_2 26 #define DEBUG_CAMPAIGN_0 1000 7 #define DEBUG_CAMPAIGN_1 1001 8 #define DEBUG_CAMPAIGN_2 1002 9 9 10 #define DEBUG_WORLD_0 011 #define DEBUG_WORLD_1 1 12 #define DEBUG_WORLD_2 210 #define DEBUG_WORLD_0 100 11 #define DEBUG_WORLD_1 101 12 #define DEBUG_WORLD_2 102 13 13 14 14 #define WORLD_ID_0 0 … … 20 20 #define WORLD_ID_GAMEEND 999 21 21 22 #define MAX_STORY_ENTITIES 99 ;//!> maximal StoryEntities in a Campaign22 #define MAX_STORY_ENTITIES 99 //!> maximal StoryEntities in a Campaign 23 23 24 #endif 24 #endif /* _STORY_DEF_H */ -
orxonox/branches/nico/src/story_entity.cc
r2636 r3238 30 30 /** 31 31 \brief initialize the entity before use. 32 \returns an error code if not able to apply. 32 33 33 34 After execution of this function, the Entity is ready to be played/executed, 34 35 this shifts the initialisation work before the execution - very important... 35 36 36 */ 37 Error StoryEntity::init()37 ErrorMessage StoryEntity::init() 38 38 {} 39 39 40 40 41 void StoryEntity::setStoryID(Uint32 storyID) 41 /** 42 \brief sets the story ID 43 44 sets the story id of the current entity, this enables it to be identified in a 45 global context. 46 */ 47 void StoryEntity::setStoryID(int storyID) 42 48 { 43 49 this->storyID = storyID; 44 50 } 45 51 52 53 /** 54 \brief this reads the story id of the current entity 55 \returns the story entity id 56 */ 46 57 int StoryEntity::getStoryID() 47 58 { … … 50 61 51 62 52 void StoryEntity::setNextStoryID(Uint32 nextStoryID) 63 /** 64 \brief sets the id of the next story entity 65 66 StoryEntities can choose their following entity themselfs. the entity id defined here 67 will be startet after this entity ends. this can be convenient if you want to have a 68 non linear story with switches. 69 */ 70 void StoryEntity::setNextStoryID(int nextStoryID) 53 71 { 54 72 this->nextStoryID = nextStoryID; 55 73 } 56 74 57 Uint32 StoryEntity::getNextStoryID() 75 /** 76 \brief gets the story id of the current entity 77 \returns story id 78 */ 79 int StoryEntity::getNextStoryID() 58 80 { 59 81 return this->nextStoryID; … … 61 83 62 84 63 Error StoryEntity::start(Uint32 storyID) 64 {} 85 /** 86 \brief starts the entity with the choosen id. only for entities with lists. 87 \param story id 88 \returns error code if this action has caused a error 65 89 66 Error StoryEntity::start() 67 {} 68 69 Error StoryEntity::stop() 70 {} 71 72 Error StoryEntity::pause() 73 {} 74 75 Error StoryEntity::resume() 90 this simply starts the story with the id storyID. the story with the choosen id has 91 to be part of the current entity else, this doesn't make sense. this is used for 92 campaigns or the GameLoader, they have lists of Campaigns/Worlds with their own 93 storyID. 94 */ 95 ErrorMessage StoryEntity::start(int storyID) 76 96 {} 77 97 78 98 99 /** 100 \brief starts the current entity 101 \returns error code if this action has caused a error 102 */ 103 ErrorMessage StoryEntity::start() 104 {} 105 106 107 /** 108 \brief stops the current entity 109 \returns error code if this action has caused a error 110 111 ATTENTION: this function shouldn't call other functions, or if so, they must return 112 after finishing. If you ignore or forget to do so, the current entity is not able to 113 terminate and it will run in the background or the ressources can't be freed or even 114 worse: are freed and the program will end in a segmentation fault! 115 hehehe, all seen... :) 116 */ 117 ErrorMessage StoryEntity::stop() 118 {} 119 120 121 /** 122 \brief pause the current entity 123 \returns error code if this action has caused a error 124 125 this pauses the current entity or passes this call forth to the running entity. 126 */ 127 ErrorMessage StoryEntity::pause() 128 {} 129 130 131 /** 132 \brief resumes a pause 133 \returns error code if this action has caused a error 134 135 this resumess the current entity or passes this call forth to the running entity. 136 */ 137 ErrorMessage StoryEntity::resume() 138 {} 139 140 141 /** 142 \brief loads the current entity 143 144 this is here to enable you loading maps into the entities. for all other actions you 145 should take the init() function. 146 */ 79 147 void StoryEntity::load() 80 148 {} 81 149 82 150 83 void StoryEntity::displayEntityScreen() 151 /** 152 \brief destroys and cleans up the current entity. 153 154 this cleans up ressources before the deconstructor is called. for terminating 155 the entity please use the stop() function. 156 */ 157 void StoryEntity::destroy() 84 158 {} 85 159 86 void StoryEntity::releaseEntityScreen() 160 161 /** 162 \brief this displays the load screen 163 164 it will need some time to load maps or things like that. to inform the user about 165 progress and to just show him/her something for the eyes, put here this stuff 166 */ 167 void StoryEntity::displayLoadScreen() 87 168 {} 169 170 171 /** 172 \brief undisplay the load screen 173 174 the load process has terminated, you now can release the load screen and start this 175 entity. 176 */ 177 void StoryEntity::releaseLoadScreen() 178 {} -
orxonox/branches/nico/src/story_entity.h
r2636 r3238 1 /*! 2 \file story_entity.h 3 \brief holds the base class of everything that is playable - that is part of the story 4 */ 1 5 2 #ifndef STORY_ENTITY_H 3 #define STORY_ENTITY_H 6 7 #ifndef _STORY_ENTITY_H 8 #define _STORY_ENTITY_H 4 9 5 10 #include "stdincl.h" 6 11 #include "story_def.h" 7 12 13 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... 8 14 class StoryEntity { 9 15 10 16 public: 11 17 StoryEntity (); 12 ~StoryEntity ();18 virtual ~StoryEntity (); 13 19 14 bool isInit; 15 bool isPaused; 20 bool isInit; //! if the entity is initialized, this has to be true 21 bool isPaused; //! is true if the entity is paused 16 22 17 virtual Error init();18 virtual Error start(Uint32storyID);19 virtual Error start();20 virtual Error stop();21 virtual Error pause();22 virtual Error resume();23 virtual ErrorMessage init(); 24 virtual ErrorMessage start(int storyID); 25 virtual ErrorMessage start(); 26 virtual ErrorMessage stop(); 27 virtual ErrorMessage pause(); 28 virtual ErrorMessage resume(); 23 29 24 30 virtual void load(); 31 virtual void destroy(); 25 32 26 virtual void display EntityScreen();27 virtual void release EntityScreen();33 virtual void displayLoadScreen(); 34 virtual void releaseLoadScreen(); 28 35 29 void setStoryID( Uint32storyID);36 void setStoryID(int storyID); 30 37 int getStoryID(); 31 38 32 void setNextStoryID( Uint32nextStoryID);33 Uint32getNextStoryID();39 void setNextStoryID(int nextStoryID); 40 int getNextStoryID(); 34 41 35 42 36 43 private: 37 Uint32 storyID;38 Uint32 nextStoryID;44 int storyID; //! this is the number of this entity, identifying it in a list/tree... 45 int nextStoryID; //! if this entity has finished, this entity shall be called 39 46 }; 40 47 41 #endif 48 #endif /* _STORY_ENTITY_H */ -
orxonox/branches/nico/src/synchronisable.h
r2036 r3238 1 1 2 #ifndef SYNCHRONISABLE_H3 #define SYNCHRONISABLE_H2 #ifndef _SYNCHRONISABLE_H 3 #define _SYNCHRONISABLE_H 4 4 5 5 #include "data_tank.h" … … 22 22 }; 23 23 24 #endif 24 #endif /* _SYNCHRONISABLE_H */ -
orxonox/branches/nico/src/track.cc
r3005 r3238 21 21 22 22 /** 23 23 \brief creates a null Track part 24 24 */ 25 25 Track::Track () 26 26 { 27 28 29 30 27 this->ID = 0; 28 this->offset = NULL; 29 this->end = NULL; 30 this->nextID = 0; 31 31 } 32 32 33 33 /** 34 35 36 37 38 34 \brief creates a functional base Track part 35 \param number: the ID if this Track part 36 \param next: the ID of the next Track part 37 \param start: pointer to an anchor point (Vector) representing the offset of this part 38 \param finish: pointer to an anchor point (Vector) representing the end of this part 39 39 */ 40 40 Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish) 41 41 { 42 43 44 45 42 this->ID = number; 43 this->offset = start; 44 this->end = finish; 45 this->nextID = next; 46 46 } 47 47 48 48 /** 49 49 \brief removes the Track part from memory 50 50 */ 51 51 Track::~Track () … … 68 68 at inside camera boundaries. 69 69 */ 70 void Track::map _camera (Location* lookat, Placement* camplc)70 void Track::mapCamera (Location* lookat, Placement* camplc) 71 71 { 72 72 Line trace(*offset, *end - *offset); … … 103 103 when transfering between track parts. 104 104 */ 105 bool Track::map _coords (Location* loc, Placement* plc)105 bool Track::mapCoords (Location* loc, Placement* plc) 106 106 { 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 107 Line trace(*offset, *end - *offset); 108 float l = trace.len (); 109 110 /* change to the next track? */ 111 if( loc->dist > l) 112 { 113 loc->dist -= l; 114 loc->part = nextID; 115 //FIXME: loc->track = this; 116 return true; 117 } 118 119 /* this quaternion represents the rotation from start-vector (0,0,1) to the direction of 120 * the track */ 121 Quaternion dir(trace.a, Vector(0,0,1)); 122 123 plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos); 124 plc->w = dir * loc->rot; 125 126 return false; 127 127 } 128 128 129 129 130 /** 130 131 132 133 134 131 \brief this is called when a WorldEntity enters a Track part 132 \param entity: pointer to the WorldEntity in question 133 134 You can do stuff like add or remove effects, do some coordinate finetuning 135 or whatever in here. 135 136 */ 136 void Track::post _enter (WorldEntity* entity)137 void Track::postEnter (WorldEntity* entity) 137 138 { 138 139 } 139 140 141 140 142 /** 141 142 143 144 145 143 \brief this is called when a WorldEntity leaves a Track part 144 \param entity: pointer to the WorldEntity in question 145 146 You can do stuff like add or remove effects, do some coordinate finetuning 147 or whatever in here. 146 148 */ 147 void Track::post _leave (WorldEntity* entity)149 void Track::postLeave (WorldEntity* entity) 148 150 { 149 151 } 150 152 153 151 154 /** 152 153 154 155 155 \brief this is called every frame 156 \param deltaT: amount of time passed since the last frame in seconds 157 158 Do time based or polling scripts here. 156 159 */ 157 160 void Track::tick (float deltaT) -
orxonox/branches/nico/src/track.h
r2636 r3238 4 4 */ 5 5 6 #ifndef TRACK_H7 #define TRACK_H6 #ifndef _TRACK_H 7 #define _TRACK_H 8 8 9 9 #include "stdincl.h" … … 25 25 Uint32 nextID; 26 26 27 27 28 28 public: 29 29 Track (); … … 32 32 virtual void init(); 33 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);34 virtual void postEnter (WorldEntity* entity); // handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght) 35 virtual void postLeave (WorldEntity* entity); 36 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 boundaries37 virtual void mapCamera (Location* lookat, Placement* camplc); 38 virtual bool mapCoords (Location* loc, Placement* plc); // this should return true if the entity left track boundaries 39 39 }; 40 40 41 #endif 41 #endif /* _TRACK_H */ -
orxonox/branches/nico/src/vector.cc
r3004 r3238 203 203 \return the angle between the vectors in radians 204 204 */ 205 float angle _rad (const Vector& v1, const Vector& v2)205 float angleRad (const Vector& v1, const Vector& v2) 206 206 { 207 207 return acos( v1 * v2 / (v1.len() * v2.len())); … … 215 215 \return the angle between the vectors in degrees 216 216 */ 217 float angle _deg (const Vector& v1, const Vector& v2)217 float angleDeg (const Vector& v1, const Vector& v2) 218 218 { 219 219 float f; … … 243 243 244 244 /** 245 \brief calculates a look _at rotation245 \brief calculates a lookAt rotation 246 246 \param dir: the direction you want to look 247 247 \param up: specify what direction up should be … … 578 578 Vector axis = x.cross( v); 579 579 axis.normalize(); 580 float angle = angle _rad( x, v);580 float angle = angleRad( x, v); 581 581 float ca = cos(angle); 582 582 float sa = sin(angle); … … 714 714 \return the rotated vector 715 715 */ 716 Vector rotate _vector( const Vector& v, const Rotation& r)716 Vector rotateVector( const Vector& v, const Rotation& r) 717 717 { 718 718 Vector t; … … 745 745 \return the distance between the Line and the point 746 746 */ 747 float Line::distance _point (const Vector& v) const747 float Line::distancePoint (const Vector& v) const 748 748 { 749 749 Vector d = v-r; … … 761 761 Vector* fp = new Vector[2]; 762 762 Plane p = Plane (r + a.cross(l.a), r, r + a); 763 fp[1] = p.intersect _line (l);763 fp[1] = p.intersectLine (l); 764 764 p = Plane (fp[1], l.a); 765 fp[0] = p.intersect _line (*this);765 fp[0] = p.intersectLine (*this); 766 766 return fp; 767 767 } … … 783 783 { 784 784 Vector t = a + r; 785 t = rotate _vector( t, rot);786 r = rotate _vector( r, rot),785 t = rotateVector( t, rot); 786 r = rotateVector( r, rot), 787 787 a = t - r; 788 788 } … … 815 815 \param l: a line 816 816 */ 817 Vector Plane::intersect _line (const Line& l) const817 Vector Plane::intersectLine (const Line& l) const 818 818 { 819 819 if (n.x*l.a.x+n.y*l.a.y+n.z*l.a.z == 0.0) return Vector(0,0,0); … … 827 827 \return the distance between the plane and the point (can be negative) 828 828 */ 829 float Plane::distance _point (const Vector& p) const829 float Plane::distancePoint (const Vector& p) const 830 830 { 831 831 float l = n.len(); … … 839 839 \return 0 if the point is contained within the Plane, positive(negative) if the point is in the positive(negative) semi-space of the Plane 840 840 */ 841 float Plane::locate _point (const Vector& p) const841 float Plane::locatePoint (const Vector& p) const 842 842 { 843 843 return (n.dot(p) + k); -
orxonox/branches/nico/src/vector.h
r3004 r3238 6 6 */ 7 7 8 #ifndef VECTOR_H9 #define VECTOR_H8 #ifndef _VECTOR_H 9 #define _VECTOR_H 10 10 11 11 #include <math.h> … … 40 40 }; 41 41 42 float angle _deg (const Vector& v1, const Vector& v2);43 float angle _rad (const Vector& v1, const Vector& v2);42 float angleDeg (const Vector& v1, const Vector& v2); 43 float angleRad (const Vector& v1, const Vector& v2); 44 44 45 45 //! Quaternion … … 98 98 99 99 //!< Apply a rotation to a vector 100 Vector rotate _vector( const Vector& v, const Rotation& r);100 Vector rotateVector( const Vector& v, const Rotation& r); 101 101 102 102 //! 3D line … … 118 118 119 119 float distance (const Line& l) const; 120 float distance _point (const Vector& v) const;120 float distancePoint (const Vector& v) const; 121 121 Vector* footpoints (const Line& l) const; 122 122 float len () const; … … 144 144 ~Plane () {} 145 145 146 Vector intersect _line (const Line& l) const;147 float distance _point (const Vector& p) const;148 float locate _point (const Vector& p) const;146 Vector intersectLine (const Line& l) const; 147 float distancePoint (const Vector& p) const; 148 float locatePoint (const Vector& p) const; 149 149 }; 150 150 … … 185 185 186 186 187 #endif 187 #endif /* _VECTOR_H */ -
orxonox/branches/nico/src/world.cc
r3005 r3238 51 51 World::~World () 52 52 { 53 Orxonox *orx = Orxonox::getInstance(); 54 orx->get_localinput()->unbind (this->localPlayer); 53 printf("World::~World() - deleting current world\n"); 54 CommandNode* cn = Orxonox::getInstance()->getLocalInput(); 55 cn->unbind(this->localPlayer); 56 cn->reset(); 57 this->localCamera->destroy(); 58 59 WorldEntity* entity = entities->enumerate(); 60 while( entity != NULL ) 61 { 62 entity->destroy(); 63 entity = entities->nextElement(); 64 } 65 this->entities->destroy(); 66 55 67 delete this->entities; 56 68 delete this->localCamera; 57 } 58 59 60 /** 61 \brief initialize the world before use. 62 */ 63 Error World::init() 69 /* this->localPlayer hasn't to be deleted explicitly, it is 70 contained in entities*/ 71 } 72 73 74 ErrorMessage World::init() 64 75 { 65 76 this->bPause = false; 66 } 67 68 Error World::start() 69 { 77 CommandNode* cn = Orxonox::getInstance()->getLocalInput(); 78 cn->addToWorld(this); 79 cn->enable(true); 80 } 81 82 ErrorMessage World::start() 83 { 84 printf("World::start() - starting current World: nr %i\n", this->debugWorldNr); 85 this->bQuitOrxonox = false; 86 this->bQuitCurrentGame = false; 70 87 this->mainLoop(); 71 88 } 72 89 73 Error World::stop() 74 { 90 ErrorMessage World::stop() 91 { 92 printf("World::stop() - got stop signal\n"); 75 93 this->bQuitCurrentGame = true; 76 this->localCamera->setWorld(NULL); 77 this->entities->clear(); 78 Orxonox::getInstance()->get_localinput()->reset(); 79 this->~World(); 80 } 81 82 Error World::pause() 94 } 95 96 ErrorMessage World::pause() 83 97 { 84 98 this->isPaused = true; 85 99 } 86 100 87 Error World::resume()101 ErrorMessage World::resume() 88 102 { 89 103 this->isPaused = false; 90 104 } 91 105 106 void World::destroy() 107 { 108 109 } 110 92 111 void World::load() 93 112 { … … 96 115 switch(this->debugWorldNr) 97 116 { 117 /* 118 this loads the hard-coded debug world. this only for simplicity and will be 119 removed by a reald world-loader, which interprets a world-file. 120 if you want to add an own debug world, just add a case DEBUG_WORLD_[nr] and 121 make whatever you want... 122 */ 98 123 case DEBUG_WORLD_0: 99 124 { … … 114 139 this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]); 115 140 } 116 141 // !\todo old track-system has to be removed 142 117 143 // create a player 118 144 WorldEntity* myPlayer = new Player(); … … 122 148 // bind input 123 149 Orxonox *orx = Orxonox::getInstance(); 124 orx->get _localinput()->bind (myPlayer);150 orx->getLocalInput()->bind (myPlayer); 125 151 126 152 // bind camera … … 154 180 this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]); 155 181 } 156 182 157 183 // create a player 158 //WorldEntity* myPlayer = (WorldEntity*) this->spawn<Player>();159 184 WorldEntity* myPlayer = new Player(); 160 185 this->spawn(myPlayer); 161 this->localPlayer = myPlayer; 186 this->localPlayer = myPlayer; 162 187 163 188 // bind input 164 189 Orxonox *orx = Orxonox::getInstance(); 165 orx->get _localinput()->bind (myPlayer);190 orx->getLocalInput()->bind (myPlayer); 166 191 167 192 // bind camera … … 185 210 glColor3f(1.0,0,0); 186 211 glBegin(GL_QUADS); 187 float height [500][100]; 188 float size = 2.0; 189 for ( int i = 0; i<=200; i+=1) 212 213 int sizeX = 100; 214 int sizeY = 80; 215 float length = 1000; 216 float width = 200; 217 float widthX = float (length /sizeX); 218 float widthY = float (width /sizeY); 219 220 float height [sizeX][sizeY]; 221 Vector normal_vectors[sizeX][sizeY]; 222 223 224 for ( int i = 0; i<sizeX-1; i+=1) 225 for (int j = 0; j<sizeY-1;j+=1) 226 //height[i][j] = rand()/20046 + (j-25)*(j-25)/30; 227 #ifdef __WIN32__ 228 height[i][j]=(sin((float)j/3)*rand()*i/182400)*.5; 229 #else 230 height[i][j]=(sin((float)j/3)*rand()*(long)i/6282450500.0)*.5; 231 #endif 232 233 //Die Hügel ein wenig glätten 234 for (int h=1; h<2;h++) 235 for (int i=1;i<sizeX-2 ;i+=1 ) 236 for(int j=1;j<sizeY-2;j+=1) 237 height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4; 238 239 //Berechnung von normalen Vektoren 240 241 for(int i=1;i<sizeX-2;i+=1) 242 for(int j=1;j<sizeY-2 ;j+=1) 190 243 { 191 for (int j = 0; j<=50;j+=1) 192 { 193 height[i][j] = rand()/200321400 + (j-25)*(j-25)/30; 244 Vector v1 = Vector (widthX*(1), widthY*(j) , height[i][j]); 245 Vector v2 = Vector (widthX*(i-1), widthY*(j) , height[i-1][j]); 246 Vector v3 = Vector (widthX*(i), widthY*(j+1), height[i][j+1]); 247 Vector v4 = Vector (widthX*(i+1), widthY*(j), height[i+1][j]); 248 Vector v5 = Vector (widthX*(i), widthY*(j-1), height[i][j-1]); 249 250 Vector c1 = v2 - v1; 251 Vector c2 = v3 - v1; 252 Vector c3= v4 - v1; 253 Vector c4 = v5 - v1; 254 Vector zero = Vector (0,0,0); 255 normal_vectors[i][j]=c1.cross(v4-v2)+c2.cross(v1-v3)+c3.cross(v2-v4)+c4.cross(v3-v1); 256 normal_vectors[i][j].normalize(); 257 } 258 259 int snowheight=3; 260 for ( int i = 0; i<sizeX; i+=1) 261 for (int j = 0; j<sizeY;j+=1) 262 { 263 Vector v1 = Vector (widthX*(i), widthY*(j) -width/2, height[i][j]-20 ); 264 Vector v2 = Vector (widthX*(i+1), widthY*(j) -width/2, height[i+1][j]-20); 265 Vector v3 = Vector (widthX*(i+1), widthY*(j+1)-width/2, height[i+1][j+1]-20); 266 Vector v4 = Vector (widthX*(i), widthY*(j+1)-width/2, height[i][j+1]-20); 267 float a[3]; 268 if(height[i][j]<snowheight){ 269 a[0]=0; 270 a[1]=1.0-height[i][j]/10-.3; 271 a[2]=0; 272 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 273 } 274 else{ 275 a[0]=1.0; 276 a[1]=1.0; 277 a[2]=1.0; 278 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 194 279 195 } 280 } 281 glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z); 282 glVertex3f(v1.x, v1.y, v1.z); 283 if(height[i+1][j]<snowheight){ 284 a[0]=0; 285 a[1] =1.0-height[i+1][j]/10-.3; 286 a[2]=0; 287 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 288 } 289 else{ 290 a[0]=1.0; 291 a[1]=1.0; 292 a[2]=1.0; 293 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 294 295 } 296 glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z); 297 glVertex3f(v2.x, v2.y, v2.z); 298 if(height[i+1][j+1]<snowheight){ 299 a[0]=0; 300 a[1] =1.0-height[i+1][j+1]/10-.3; 301 a[2]=0; 302 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 303 } 304 else{ 305 a[0]=1.0; 306 a[1]=1.0; 307 a[2]=1.0; 308 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 309 310 311 } 312 glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z); 313 glVertex3f(v3.x, v3.y, v3.z); 314 if(height[i][j+1]<snowheight){ 315 a[0]=0; 316 a[1] =1.0-height[i+1][j+1]/10-.3; 317 a[2]=0; 318 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 319 } 320 else{ 321 a[0]=1.0; 322 a[1]=1.0; 323 a[2]=1.0; 324 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 325 } 326 glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z); 327 glVertex3f(v4.x, v4.y, v4.z); 328 196 329 } 197 for ( int i = 0; i<=200; i+=1) 198 { 199 for (int j = 0; j<=50;j+=1) 200 { 201 Vector* v1 = new Vector (size*i, size*j-25*size, height[i][j] -20); 202 Vector* v2 = new Vector (size*i+size, size*j-25*size, height[i+1][j]-20); 203 Vector* v3 = new Vector (size*i+size, size*j+size-25*size, height[i+1][j+1]-20); 204 Vector* v4 = new Vector (size*i, size*j+size -25*size, height[i][j+1]-20); 205 206 Vector c1 = *v2 - *v1; 207 Vector c2 = *v3 - *v2; 208 Vector c3 = *v4 - *v3; 209 Vector c4 = *v1 - *v4; 210 211 c1.cross(*v4 - *v1); 212 c2.cross(*v1 - *v2); 213 c3.cross(*v2 - *v3); 214 c4.cross(*v3 - *v4); 215 216 217 glVertex3f(v1->x, v1->y, v1->z); 218 219 glVertex3f(v2->x, v2->y, v2->z); 220 221 glVertex3f(v3->x, v3->y, v3->z); 222 glNormal3f(c4.x, c4.y, c4.z); 223 glVertex3f(v4->x, v4->y, v4->z); 224 225 } 226 } 227 glEnd(); 228 /* 330 glEnd(); 331 /* 229 332 glBegin(GL_LINES); 230 333 for( float x = -128.0; x < 128.0; x += 25.0) … … 370 473 if( !entity->isFree() ) 371 474 { 372 loc = entity->get _location();373 plc = entity->get _placement();475 loc = entity->getLocation(); 476 plc = entity->getPlacement(); 374 477 t = loc->part; 375 478 … … 378 481 { 379 482 printf("An entity is out of the game area\n"); 380 entity->left _world ();483 entity->leftWorld (); 381 484 } 382 485 else 383 486 { 384 while( track[t].map _coords( loc, plc) )487 while( track[t].mapCoords( loc, plc) ) 385 488 { 386 track[t].post _leave (entity);489 track[t].postLeave (entity); 387 490 if( loc->part >= tracklen ) 388 491 { 389 492 printf("An entity has left the game area\n"); 390 entity->left _world ();493 entity->leftWorld (); 391 494 break; 392 495 } 393 track[loc->part].post _enter (entity);496 track[loc->part].postEnter (entity); 394 497 } 395 498 } … … 397 500 else 398 501 { 399 /* TO DO: implement check whether this particular free entity502 /* \todo: implement check whether this particular free entity 400 503 is out of the game area 401 TO DO: call function to notify the entity that it left504 \todo: call function to notify the entity that it left 402 505 the game area 403 506 */ … … 413 516 \param deltaT: the time passed since the last frame in milliseconds 414 517 */ 415 void World::time _slice (Uint32 deltaT)518 void World::timeSlice (Uint32 deltaT) 416 519 { 417 520 //List<WorldEntity> *l; 418 521 WorldEntity* entity; 419 float seconds = deltaT; 420 421 seconds /= 1000; 522 float seconds = deltaT / 1000.0; 422 523 423 524 entity = entities->enumerate(); … … 428 529 } 429 530 430 for( int i = 0; i < tracklen; i++) track[i].tick (seconds);531 //for( int i = 0; i < tracklen; i++) track[i].tick (seconds); 431 532 } 432 533 … … 446 547 Camera Placement 447 548 */ 448 void World::calc _camera_pos (Location* loc, Placement* plc)449 { 450 track[loc->part].map _camera (loc, plc);549 void World::calcCameraPos (Location* loc, Placement* plc) 550 { 551 track[loc->part].mapCamera (loc, plc); 451 552 } 452 553 … … 462 563 } 463 564 565 566 567 /** 568 \brief function to put your own debug stuff into it. it can display informations about 569 the current class/procedure 570 */ 464 571 void World::debug() 465 572 { … … 478 585 479 586 587 /* 588 \brief main loop of the world: executing all world relevant function 589 590 in this loop we synchronize (if networked), handle input events, give the heart-beat to 591 all other member-entities of the world (tick to player, enemies etc.), checking for 592 collisions drawing everything to the screen. 593 */ 480 594 void World::mainLoop() 481 595 { 482 596 this->lastFrame = SDL_GetTicks(); 483 this->bQuitOrxonox = false; 484 this->bQuitCurrentGame = false; 485 printf("World|Entering main loop\n"); 486 while(!this->bQuitOrxonox && !this->bQuitCurrentGame) /* pause pause pause ?!?!?*/ 487 { 488 //debug routine 489 //debug(); 597 printf("World::mainLoop() - Entering main loop\n"); 598 while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */ 599 { 490 600 // Network 491 601 synchronize(); 492 602 // Process input 493 handle_input(); 603 handleInput(); 604 if( this->bQuitCurrentGame || this->bQuitOrxonox) 605 { 606 printf("World::mainLoop() - leaving loop earlier...\n"); 607 break; 608 } 494 609 // Process time 495 time _slice();610 timeSlice(); 496 611 // Process collision 497 612 collision(); … … 499 614 display(); 500 615 501 //for(int i = 0; i < 1000000; i++){} 502 503 } 504 printf("World|Exiting the main loop\n"); 616 for(int i = 0; i < 10000000; i++) {} 617 } 618 printf("World::mainLoop() - Exiting the main loop\n"); 505 619 } 506 620 … … 516 630 /** 517 631 \brief run all input processing 518 */ 519 void World::handle_input () 632 633 the command node is the central input event dispatcher. the node uses the even-queue from 634 sdl and has its own event-passing-queue. 635 */ 636 void World::handleInput () 520 637 { 521 638 // localinput 522 Orxonox::getInstance()->get_localinput()->process(); 639 CommandNode* cn = Orxonox::getInstance()->getLocalInput(); 640 cn->process(); 523 641 // remoteinput 524 642 } … … 526 644 /** 527 645 \brief advance the timeline 528 */ 529 void World::time_slice () 646 647 this calculates the time used to process one frame (with all input handling, drawing, etc) 648 the time is mesured in ms and passed to all world-entities and other classes that need 649 a heart-beat. 650 */ 651 void World::timeSlice () 530 652 { 531 653 Uint32 currentFrame = SDL_GetTicks(); … … 541 663 else 542 664 { 543 printf("fps = 1000 but 0ms!\n"); 544 } 545 546 this->time_slice (dt); 665 /* the frame-rate is limited to 100 frames per second, all other things are for 666 nothing. 667 */ 668 printf("fps = 1000 - frame rate is adjusted\n"); 669 SDL_Delay(10); 670 dt = 10; 671 } 672 this->timeSlice (dt); 547 673 this->update (); 548 this->localCamera->time _slice(dt);674 this->localCamera->timeSlice(dt); 549 675 } 550 676 this->lastFrame = currentFrame; 551 677 } 552 678 679 553 680 /** 554 681 \brief compute collision detection … … 559 686 } 560 687 561 /** 562 \brief handle keyboard commands that are not meant for WorldEntities 563 \param cmd: the command to handle 564 \return true if the command was handled by the system or false if it may be passed to the WorldEntities 565 */ 566 bool World::system_command (Command* cmd) 567 { 568 if( !strcmp( cmd->cmd, "quit")) 569 { 570 if( !cmd->bUp) this->bQuitOrxonox = true; 571 return true; 572 } 573 return false; 574 } 575 576 /** 577 \brief render the current frame 688 689 /** 690 \brief render the current frame 691 692 clear all buffers and draw the world 578 693 */ 579 694 void World::display () … … 590 705 } 591 706 707 /** 708 \brief give back active camera 709 710 this passes back the actualy active camera 711 \todo ability to define more than one camera or camera-places 712 */ 592 713 Camera* World::getCamera() 593 714 { … … 596 717 597 718 719 /** 720 \brief add and spawn a new entity to this world 721 \param entity to be added 722 */ 598 723 void World::spawn(WorldEntity* entity) 599 724 { … … 611 736 if (entity->bFree) 612 737 { 613 this->track[loc->part].map_coords( loc, entity->get_placement()); 614 } 615 entity->post_spawn (); 616 } 617 618 738 this->track[loc->part].mapCoords( loc, entity->getPlacement()); 739 } 740 entity->postSpawn (); 741 } 742 743 744 /** 745 \brief add and spawn a new entity to this world 746 \param entity to be added 747 \param location where to add 748 */ 619 749 void World::spawn(WorldEntity* entity, Location* loc) 620 750 { … … 633 763 if (entity->bFree) 634 764 { 635 this->track[loc->part].map _coords( loc, entity->get_placement());636 } 637 entity->post _spawn ();765 this->track[loc->part].mapCoords( loc, entity->getPlacement()); 766 } 767 entity->postSpawn (); 638 768 //return entity; 639 769 } 640 770 641 771 772 /** 773 \brief add and spawn a new entity to this world 774 \param entity to be added 775 \param place where to be added 776 */ 642 777 void World::spawn(WorldEntity* entity, Placement* plc) 643 778 { … … 652 787 this->entities->add (entity); 653 788 entity->init (plc, owner); 654 entity->post _spawn ();789 entity->postSpawn (); 655 790 //return entity; 656 791 } 792 793 794 /* 795 \brief commands that the world must catch 796 \returns false if not used by the world 797 */ 798 bool World::command(Command* cmd) 799 { 800 return false; 801 } -
orxonox/branches/nico/src/world.h
r2822 r3238 4 4 */ 5 5 6 #ifndef WORLD_H7 #define WORLD_H6 #ifndef _WORLD_H 7 #define _WORLD_H 8 8 9 9 #include "stdincl.h" … … 22 22 World (char* name); 23 23 World (int worldID); 24 ~World ();24 virtual ~World (); 25 25 26 26 template<typename T> 27 T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity27 T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity 28 28 template<typename T> 29 T* spawn (Placement* plc, WorldEntity* owner);29 T* spawn (Placement* plc, WorldEntity* owner); 30 30 31 virtual Error init();32 virtual Error start();33 virtual Error stop();34 virtual Error pause();35 virtual Error resume();31 virtual ErrorMessage init (); 32 virtual ErrorMessage start (); 33 virtual ErrorMessage stop (); 34 virtual ErrorMessage pause (); 35 virtual ErrorMessage resume (); 36 36 37 virtual void load(); 37 virtual void load (); 38 virtual void destroy (); 38 39 39 void time _slice (Uint32 deltaT);40 void timeSlice (Uint32 deltaT); 40 41 void collide (); 41 42 void draw (); 42 43 void update (); // maps Locations to Placements 43 void calc _camera_pos (Location* loc, Placement* plc);44 void calcCameraPos (Location* loc, Placement* plc); 44 45 45 46 void unload (); 47 bool command (Command* cmd); 46 48 47 void setTrackLen (Uint32 tracklen);48 int getTrackLen ();49 bool system_command (Command* cmd);50 Camera* getCamera ();49 void setTrackLen (Uint32 tracklen); 50 int getTrackLen (); 51 //bool system_command (Command* cmd); 52 Camera* getCamera (); 51 53 52 void spawn (WorldEntity* entity);53 void spawn (WorldEntity* entity, Location* loc);54 void spawn (WorldEntity* entity, Placement* plc);54 void spawn (WorldEntity* entity); 55 void spawn (WorldEntity* entity, Location* loc); 56 void spawn (WorldEntity* entity, Placement* plc); 55 57 56 58 tList<WorldEntity>* entities; … … 74 76 WorldEntity* localPlayer; 75 77 76 void mainLoop ();77 void synchronize ();78 void handle _input();79 void time _slice();80 void collision ();81 void display ();82 void debug ();78 void mainLoop (); 79 void synchronize (); 80 void handleInput (); 81 void timeSlice (); 82 void collision (); 83 void display (); 84 void debug (); 83 85 }; 84 86 85 /** 86 \brief spawn a new WorldEntity at a Location 87 \param loc: the Location where the Entity should be spawned 88 \param owner: a pointer to the parent of the Entity 89 \return a pointer to the new WorldEntity or NULL if there was an error 90 91 You can use this function to spawn any derivation of WorldEntity you want, just specify the desired 92 class within the template specification brackets. Do not attempt to spawn any classes that have NOT been 93 derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn() 94 works with both free and bound WorldEntities. 95 */ 96 template<typename T> T* World::spawn(Location* loc = NULL, WorldEntity* owner = NULL) 97 { 98 Location zeroloc; 99 T* entity = new T(); 100 entities->add ((WorldEntity*)entity, LIST_ADD_NEXT); 101 if( loc == NULL) 102 { 103 zeroloc.dist = 0; 104 zeroloc.part = 0; 105 zeroloc.pos = Vector(); 106 zeroloc.rot = Quaternion(); 107 loc = &zeroloc; 108 } 109 entity->init (loc, owner); 110 if (entity->bFree) 111 { 112 track[loc->part].map_coords( loc, entity->get_placement()); 113 } 114 entity->post_spawn (); 115 return entity; 116 } 117 118 /** 119 \brief spawn a new WorldEntity at a Placement 120 \param lplc: the placement where the Entity should be spawned 121 \param owner: a pointer to the parent of the Entity 122 \return a pointer to the new WorldEntity or NULL if there was an error 123 124 You can use this function to spawn any FREE derivation of WorldEntity you want, just specify the desired 125 class within the template specification brackets. Do not attempt to spawn any classes that have NOT been 126 derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn() 127 works with free WorldEntities only, you will provoke an error message if you try to spawn a bound Entity with 128 a Placement. 129 */ 130 template<typename T> T* World::spawn(Placement* plc, WorldEntity* owner = NULL) 131 { 132 T* entity = new T(); 133 entities->add ((WorldEntity*)entity, LIST_ADD_NEXT); 134 entity->init (plc, owner); 135 if (!entity->bFree) 136 { 137 printf("Can't spawn unfree entity with placement\n"); 138 entities->remove( (WorldEntity*)entity, LIST_FIND_FW); 139 return NULL; 140 } 141 entity->post_spawn (); 142 return entity; 143 } 144 145 #endif 87 #endif /* _WORLD_H */ -
orxonox/branches/nico/src/world_entity.cc
r2822 r3238 53 53 \return a pointer to location 54 54 */ 55 Location* WorldEntity::get _location ()55 Location* WorldEntity::getLocation () 56 56 { 57 57 return &loc; … … 62 62 \return a pointer to placement 63 63 */ 64 Placement* WorldEntity::get _placement ()64 Placement* WorldEntity::getPlacement () 65 65 { 66 66 return &place; … … 82 82 Any previously assigned collision hull will be deleted on reassignment 83 83 */ 84 void WorldEntity::set _collision (CollisionCluster* newhull)84 void WorldEntity::setCollision (CollisionCluster* newhull) 85 85 { 86 86 if( newhull == NULL) return; … … 159 159 DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted. 160 160 */ 161 void WorldEntity::post _spawn ()161 void WorldEntity::postSpawn () 162 162 { 163 163 } … … 181 181 to look at the location you return with this. 182 182 */ 183 void WorldEntity::get _lookat (Location* locbuf)183 void WorldEntity::getLookat (Location* locbuf) 184 184 { 185 185 } … … 191 191 place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy). 192 192 */ 193 void WorldEntity::left _world ()193 void WorldEntity::leftWorld () 194 194 { 195 195 } -
orxonox/branches/nico/src/world_entity.h
r2551 r3238 4 4 */ 5 5 6 #ifndef WORLD_ENTITY_H7 #define WORLD_ENTITY_H6 #ifndef _WORLD_ENTITY_H 7 #define _WORLD_ENTITY_H 8 8 9 9 #include "stdincl.h" … … 18 18 public: 19 19 WorldEntity (bool isFree = false); 20 ~WorldEntity ();20 virtual ~WorldEntity (); 21 21 22 Location* get _location ();23 Placement* get _placement ();24 void set _collision (CollisionCluster* newhull);22 Location* getLocation (); 23 Placement* getPlacement (); 24 void setCollision (CollisionCluster* newhull); 25 25 26 26 bool isFree (); … … 29 29 //void removeAbility(Ability* ability); 30 30 31 virtual void post _spawn ();31 virtual void postSpawn (); 32 32 virtual void tick (float time); 33 33 virtual void hit (WorldEntity* weapon, Vector loc); … … 37 37 38 38 virtual void draw (); 39 virtual void get _lookat (Location* locbuf);39 virtual void getLookat (Location* locbuf); 40 40 41 virtual void left _world ();41 virtual void leftWorld (); 42 42 43 43 private: … … 55 55 }; 56 56 57 #endif 57 #endif /* _WORLD_ENTITY_H */
Note: See TracChangeset
for help on using the changeset viewer.