berusky2-0.12/0000755000175000017500000000000013676433304010214 500000000000000berusky2-0.12/Makefile.am0000644000175000017500000000107213661530741012165 00000000000000## Process this file with automake to produce Makefile.in ## Created by Anjuta - will be overwritten ## If you don't want it to overwrite it, ## Please disable it in the Anjuta project configuration SUBDIRS = po src data berusky2docdir = ${prefix}/doc/berusky2 berusky2doc_DATA = \ README\ COPYING\ AUTHORS\ ChangeLog\ INSTALL\ NEWS\ TODO EXTRA_DIST = $(berusky2doc_DATA) # Copy all the spec files. Of cource, only one is actually used. dist-hook: for specfile in *.spec; do \ if test -f $$specfile; then \ cp -p $$specfile $(distdir); \ fi \ done berusky2-0.12/ChangeLog0000644000175000017500000000000013661530711011666 00000000000000berusky2-0.12/NEWS0000644000175000017500000000277413676427547010661 00000000000000* 0.12 - Allow held-down keys to be processed immediately after an animation finishes - Enable Unicode support - Eliminate y-axis fighting in shadows and burnt spots - Fix drawing footsteps, water ripples, exit effect, and explosion smoke - Replace APAK files with directories - Enable screenshots - Allow spaces and '=' in INI file entries - Enable save and demo file deletion - Don't allow duplicate player names * 0.11 - Added berusky2-data install script - New icon - Fixed more crashes and a hang - Enable demo recording - Don't show a duplicate cursor after playing a level * 0.10 - Incompatible save game format! - Builds/run with fortified sources - Fixed crashes at level end (am_Do_Exit_Efects) * 0.9 - game window can be resized on the fly - fullscreen/windowed mode switch in menu - fixed some texts in menu - set game fps (60 fps by default) - level load/save support - fullscreen runs in native desktop resolution - fixed menu in fullscreen and cursor rendering - fixed more crashes * 0.8 - fixed crash at level end (rhbz#858887) * 0.7 - sound and music * 0.5 - fixed 64-bit builds * 0.4 - local installation fixes - build script updated (better directory configuration, build flags from pkg-config) * 0.3 - added game menu, new levels/tutorial, first "playable" release * 0.2 - switched to english version, fixed help/settings/hints rendering * 0.1 - first linux release berusky2-0.12/AUTHORS0000644000175000017500000000274413657105067011214 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky2 (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ Thanks to another contributors: Asher Gordon https://notabug.org/AsDaGo/berusky2 Markus Koschany and Bernhard Übelacker (Debian) berusky2-0.12/po/0000755000175000017500000000000013676433303010631 500000000000000berusky2-0.12/po/ChangeLog0000644000175000017500000000000013661530340012302 00000000000000berusky2-0.12/po/Makefile.in.in0000644000175000017500000001760413661530340013224 00000000000000# Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # # This file file be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. # # - Modified by Owen Taylor to use GETTEXT_PACKAGE # instead of PACKAGE and to look for po2tbl in ./ not in intl/ # # - Modified by jacob berkman to install # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = @SHELL@ @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ datadir = @datadir@ libdir = @libdir@ localedir = $(libdir)/locale gnulocaledir = $(datadir)/locale gettextsrcdir = $(datadir)/glib-2.0/gettext/po subdir = po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = mkdir -p CC = @CC@ GENCAT = @GENCAT@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ XGETTEXT = @XGETTEXT@ MSGMERGE = msgmerge DEFS = @DEFS@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ INCLUDES = -I.. -I$(top_srcdir)/intl COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) SOURCES = POFILES = @POFILES@ GMOFILES = @GMOFILES@ DISTFILES = LINGUAS ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ $(POFILES) $(GMOFILES) $(SOURCES) POTFILES = \ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ INSTOBJEXT = @INSTOBJEXT@ .SUFFIXES: .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat .c.o: $(COMPILE) $< .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: $(MSGFMT) -o $@ $< .po.gmo: $(AM_V_GEN) file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $< .po.cat: sed -f ../intl/po2msg.sed < $< > $*.msg \ && rm -f $@ && $(GENCAT) $@ $*.msg all: all-@USE_NLS@ all-yes: $(CATALOGS) all-no: $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \ --msgid-bugs-address='http://bugzilla.gnome.org/enter_bug.cgi?product=glib&keywords=I18N+L10N&component=general' \ --add-comments --keyword=_ --keyword=N_ \ --keyword=C_:1c,2 \ --keyword=NC_:1c,2 \ --keyword=g_dcgettext:2 \ --keyword=g_dngettext:2,3 \ --keyword=g_dpgettext2:2c,3 \ --flag=N_:1:pass-c-format \ --flag=C_:2:pass-c-format \ --flag=NC_:2:pass-c-format \ --flag=g_dngettext:2:pass-c-format \ --flag=g_strdup_printf:1:c-format \ --flag=g_string_printf:2:c-format \ --flag=g_string_append_printf:2:c-format \ --flag=g_error_new:3:c-format \ --flag=g_set_error:4:c-format \ --flag=g_markup_printf_escaped:1:c-format \ --flag=g_log:3:c-format \ --flag=g_print:1:c-format \ --flag=g_printerr:1:c-format \ --flag=g_printf:1:c-format \ --flag=g_fprintf:2:c-format \ --flag=g_sprintf:2:c-format \ --flag=g_snprintf:3:c-format \ --flag=g_scanner_error:2:c-format \ --flag=g_scanner_warn:2:c-format \ $(POTFILES) \ && test ! -f $(GETTEXT_PACKAGE).po \ || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \ && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot ) install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ case "$$cat" in \ *.gmo) destdir=$(gnulocaledir);; \ *) destdir=$(localedir);; \ esac; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ $(MKINSTALLDIRS) $$dir; \ if test -r $$cat; then \ $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ else \ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ echo "installing $(srcdir)/$$cat as" \ "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ fi; \ if test -r $$cat.m; then \ $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ else \ if test -r $(srcdir)/$$cat.m ; then \ $(INSTALL_DATA) $(srcdir)/$$cat.m \ $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ echo "installing $(srcdir)/$$cat as" \ "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ else \ true; \ fi; \ fi; \ done if test "$(PACKAGE)" = "glib"; then \ $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ else \ : ; \ fi # Define this as empty until I found a useful application. installcheck: uninstall: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ done if test "$(PACKAGE)" = "glib"; then \ rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ fi check: all dvi info tags TAGS ID: mostlyclean: rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp rm -fr *.o clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f $(GMOFILES) distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ for file in $$dists; do \ ln $(srcdir)/$$file $(distdir) 2> /dev/null \ || cp -p $(srcdir)/$$file $(distdir); \ done update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ cd $(srcdir); \ catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ echo "$$lang:"; \ if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$cat failed!"; \ rm -f $$tmpdir/$$lang.new.po; \ fi; \ done # POTFILES is created from POTFILES.in by stripping comments, empty lines # and Intltool tags (enclosed in square brackets), and appending a full # relative path to them POTFILES: POTFILES.in ( if test 'x$(srcdir)' != 'x.'; then \ posrcprefix='$(top_srcdir)/'; \ else \ posrcprefix="../"; \ fi; \ rm -f $@-t $@ \ && (sed -e '/^#/d' \ -e "s/^\[.*\] +//" \ -e '/^[ ]*$$/d' \ -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ | sed -e '$$s/\\$$//') > $@-t \ && chmod a-w $@-t \ && mv $@-t $@ ) Makefile: Makefile.in.in ../config.status POTFILES cd .. \ && $(SHELL) ./config.status $(subdir)/$@.in # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: berusky2-0.12/po/berusky2.pot0000644000175000017500000000000013627631446013035 00000000000000berusky2-0.12/po/LINGUAS0000644000175000017500000000000013627631446011570 00000000000000berusky2-0.12/po/POTFILES.in0000644000175000017500000002010713661533170012323 00000000000000# List of source files containing translatable strings. ## Created by Anjuta - will be overwritten ## If you don't want it to overwrite it, ## Please disable it in the Anjuta project configuration # Source files src/kofola/3D_graphic.cpp src/kofola/3D_graphic.h src/kofola/3D_menus.cpp src/kofola/3D_menus.h src/kofola/3d_math.cpp src/kofola/3d_math.h src/kofola/Bind.cpp src/kofola/Bind.h src/kofola/Camera.cpp src/kofola/Comics.cpp src/kofola/Comics.h src/kofola/Command.cpp src/kofola/Command.h src/kofola/Dda.cpp src/kofola/Dda.h src/kofola/Demo.cpp src/kofola/Demo.h src/kofola/Init.cpp src/kofola/Menu.cpp src/kofola/Menu.h src/kofola/Menu2.cpp src/kofola/Menu2.h src/kofola/Object.h src/kofola/Setup.h src/kofola/Tools.cpp src/kofola/Tools.h src/kofola/animend_functions.cpp src/kofola/animend_functions.h src/kofola/camera.h src/kofola/codec.h src/kofola/config_types.h src/kofola/controls.cpp src/kofola/controls.h src/kofola/controls3d.cpp src/kofola/controls3d.h src/kofola/credits.cpp src/kofola/credits.h src/kofola/font.cpp src/kofola/font.h src/kofola/font3d.cpp src/kofola/font3d.h src/kofola/game_init.cpp src/kofola/game_init.h src/kofola/game_logic.cpp src/kofola/game_logic.h src/kofola/game_main.cpp src/kofola/game_main.h src/kofola/grammar.cpp src/kofola/grammar.h src/kofola/init.h src/kofola/level_environment.h src/kofola/load_level.cpp src/kofola/load_level.h src/kofola/menu_def.h src/kofola/menu_script.cpp src/kofola/menu_script.h src/kofola/profiles.cpp src/kofola/profiles.h src/kofola/secure.h src/kofola/setup.cpp src/kofola/square_cut.cpp src/kofola/square_cut.h src/kofola/trigers.cpp src/kofola/trigers.h src/kofola/volume.cpp src/kofola/volume.h src/kofola/water.cpp src/kofola/water.h src/komat/3d_all.h src/komat/3d_typy.h src/komat/3dinterface.cpp src/komat/3dinterface.h src/komat/Berusky3d.cpp src/komat/Berusky3d.h src/komat/Berusky3d_castice.cpp src/komat/Berusky3d_castice.h src/komat/Berusky3d_castice2.h src/komat/Berusky3d_ini.cpp src/komat/Berusky3d_ini.h src/komat/Berusky3d_kamery.cpp src/komat/Berusky3d_kamery.h src/komat/Berusky3d_kofola2d.cpp src/komat/Berusky3d_kofola2d.h src/komat/Berusky3d_kofola_interface.cpp src/komat/Berusky3d_kofola_interface.h src/komat/Berusky3d_light.cpp src/komat/Berusky3d_light.h src/komat/Berusky3d_load.cpp src/komat/Berusky3d_load.h src/komat/Berusky3d_render.cpp src/komat/Berusky3d_render.h src/komat/Berusky_universal.h src/komat/Ddx.h src/komat/Di.cpp src/komat/Di.h src/komat/Load.cpp src/komat/Load.h src/komat/Load_chunks.cpp src/komat/Load_chunks.h src/komat/Load_out.cpp src/komat/Load_out.h src/komat/kfile.h src/komat/mmalloc.h src/komat/zlib_io.h src/tmp/compat.cpp src/tmp/compat.h src/kofola/2D_graphic.cpp src/kofola/2D_graphic.h src/age/graph/age.cpp src/age/graph/age.h src/age/graph/alpha.cpp src/age/graph/alpha.h src/age/graph/animation.cpp src/age/graph/animation.h src/age/graph/animation_time.cpp src/age/graph/animation_time.h src/age/graph/animation_track.cpp src/age/graph/animation_track.h src/age/graph/animation_track_bezier.cpp src/age/graph/animation_track_bezier.h src/age/graph/animation_track_linear.cpp src/age/graph/animation_track_linear.h src/age/graph/bitmap.cpp src/age/graph/bitmap.h src/age/graph/box.cpp src/age/graph/box.h src/age/graph/camera.cpp src/age/graph/camera.h src/age/graph/camera_interface.cpp src/age/graph/camera_interface.h src/age/graph/color.cpp src/age/graph/color.h src/age/graph/color_helpers.h src/age/graph/color_hsv.cpp src/age/graph/color_hsv.h src/age/graph/color_operators.h src/age/graph/draw.cpp src/age/graph/draw.h src/age/graph/ferguson.cpp src/age/graph/ferguson.h src/age/graph/gext.cpp src/age/graph/gext.h src/age/graph/glwrapper.cpp src/age/graph/glwrapper.h src/age/graph/gpipe.cpp src/age/graph/gpipe.h src/age/graph/graph3d.cpp src/age/graph/graph3d.h src/age/graph/intersect.cpp src/age/graph/intersect.h src/age/graph/lighting.cpp src/age/graph/lighting.h src/age/graph/material.cpp src/age/graph/material.h src/age/graph/material_texture.cpp src/age/graph/material_texture.h src/age/graph/matrix.cpp src/age/graph/matrix.h src/age/graph/matrix_animated.cpp src/age/graph/matrix_animated.h src/age/graph/matrix_notified.cpp src/age/graph/matrix_notified.h src/age/graph/mesh.cpp src/age/graph/mesh.h src/age/graph/normals.cpp src/age/graph/normals.h src/age/graph/obb.cpp src/age/graph/obb.h src/age/graph/object_base.cpp src/age/graph/object_base.h src/age/graph/object_box.cpp src/age/graph/object_box.h src/age/graph/object_geometry.cpp src/age/graph/object_geometry.h src/age/graph/object_hierarchy.cpp src/age/graph/object_hierarchy.h src/age/graph/object_list.cpp src/age/graph/object_list.h src/age/graph/object_mark.h src/age/graph/object_name.h src/age/graph/object_render_list.cpp src/age/graph/object_render_list.h src/age/graph/object_scene.cpp src/age/graph/object_scene.h src/age/graph/object_select.h src/age/graph/object_transformation.cpp src/age/graph/object_transformation.h src/age/graph/object_world.cpp src/age/graph/object_world.h src/age/graph/polar.cpp src/age/graph/polar.h src/age/graph/print.cpp src/age/graph/print.h src/age/graph/quat.h src/age/graph/scene.cpp src/age/graph/scene.h src/age/graph/scene_import_3ds.cpp src/age/graph/scene_import_3ds.h src/age/graph/scene_import_b2m.cpp src/age/graph/scene_import_b2m.h src/age/graph/scene_import_txt.cpp src/age/graph/scene_import_txt.h src/age/graph/scene_load.cpp src/age/graph/scene_load.h src/age/graph/scene_reference.h src/age/graph/selection.cpp src/age/graph/selection.h src/age/graph/surface.cpp src/age/graph/surface.h src/age/graph/surface_height.cpp src/age/graph/surface_height.h src/age/graph/surface_mask.cpp src/age/graph/surface_mask.h src/age/graph/surface_sdl.cpp src/age/graph/surface_sdl.h src/age/graph/surface_sw.cpp src/age/graph/surface_sw.h src/age/graph/texture_func.cpp src/age/graph/texture_func.h src/age/graph/texture_unit.cpp src/age/graph/texture_unit.h src/age/graph/triangle.cpp src/age/graph/triangle.h src/age/graph/vector.cpp src/age/graph/vector.h src/age/graph/vector_operators.h src/age/graph/vertex_arrays.cpp src/age/graph/vertex_arrays.h src/age/graph/world_interface.cpp src/age/graph/world_interface.h src/age/include/compatibility.h src/age/include/defs.h src/age/include/defs_config.h src/age/include/floats.h src/age/include/opengl.h src/age/include/typ.h src/age/include/typ_graph.h src/age/support/age_main.cpp src/age/support/age_main.h src/age/support/events.cpp src/age/support/events.h src/age/support/events_types.h src/age/support/input.cpp src/age/support/input.h src/age/support/timer.cpp src/age/support/timer.h src/age/utils/array.h src/age/utils/barray.h src/age/utils/btree.h src/age/utils/change.cpp src/age/utils/change.h src/age/utils/data_file.cpp src/age/utils/data_file.h src/age/utils/flag.h src/age/utils/ini.cpp src/age/utils/ini.h src/age/utils/llist.h src/age/utils/llist_named.h src/age/utils/lock.h src/age/utils/log.cpp src/age/utils/log.h src/age/utils/mem_alloc.cpp src/age/utils/mem_alloc.h src/age/utils/mtree.cpp src/age/utils/mtree.h src/age/utils/mtree_named.h src/age/utils/stack.h src/age/utils/types.h src/age/utils/utils.cpp src/age/utils/utils.h src/kofola/animationk.cpp src/kofola/animationk.h src/generator/generator_random.cpp src/generator/generator_random.h src/komat/Ddx.cpp src/komat/kfile.cpp src/komat/Mat3d.h src/komat/3dmath.h src/komat/3dproject.h src/komat/Keyframe.h src/komat/Quat.h src/komat/Berusky3d_animace.cpp src/komat/Berusky3d_animace.h src/komat/3dmath.cpp src/komat/3dproject.cpp src/komat/Mat3d.cpp src/komat/Keyframe.cpp src/komat/Texture.cpp src/komat/Texture.h src/komat/Texture_import.cpp src/komat/Texture_import.h src/komat/obbo.cpp src/komat/obbo.h src/komat/Kdtree.cpp src/komat/Kdtree.h src/komat/Matrix.h src/komat/Vektor.h src/kofola/ambient_sounds.h src/komat/json_export.cpp src/komat/json_export.h src/kofola/ambient_sounds.cpp src/kofola/audio_plug-in.cpp src/kofola/audio_plug-in.h src/adas/3d_math_k.c src/adas/3d_math_k.h src/adas/adas.c src/adas/adas.h src/adas/adas_types.h src/adas/ogg_io.c src/adas/ogg_io.h src/adas/ogg_stream.c src/adas/ogg_stream.h src/tmp/compat_mini.cpp src/tmp/compat_mini.h src/tmp/alut_test.cpp src/age/graph/aabb.cpp src/age/graph/aabb.h berusky2-0.12/ltmain.sh0000644000175000017500000117716713657111457012001 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.6 Debian-2.4.6-14" package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd _G_rc_run_hooks=false case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do if eval $_G_hook '"$@"'; then # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift _G_rc_run_hooks=: fi done $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, you may remove/edit # any options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. In this case you also must return $EXIT_SUCCESS to let the # hook's caller know that it should pay attention to # '_result'. Returning $EXIT_FAILURE signalizes that # arguments are left untouched by the hook and therefore caller will ignore the # result variable. # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). There is # # no need to do the equivalent (but slower) action: # # func_quote_for_eval ${1+"$@"} # # my_options_prep_result=$func_quote_for_eval_result # false # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: # args_changed=: # ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@", we could need that later # # if $args_changed is true. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # if $args_changed; then # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # fi # # $args_changed # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # false # } # func_add_hook func_validate_options my_option_validation # # You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd _G_func_options_finish_exit=false if func_run_hooks func_options ${1+"$@"}; then func_options_finish_result=$func_run_hooks_result _G_func_options_finish_exit=: fi $_G_func_options_finish_exit } # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd _G_rc_options=false for my_func in options_prep parse_options validate_options options_finish do if eval func_$my_func '${1+"$@"}'; then eval _G_res_var='$'"func_${my_func}_result" eval set dummy "$_G_res_var" ; shift _G_rc_options=: fi done # Save modified positional parameters for caller. As a top-level # options-parser function we always need to set the 'func_options_result' # variable (regardless the $_G_rc_options value). if $_G_rc_options; then func_options_result=$_G_res_var else func_quote_for_eval ${1+"$@"} func_options_result=$func_quote_for_eval_result fi $_G_rc_options } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= _G_rc_options_prep=false if func_run_hooks func_options_prep ${1+"$@"}; then _G_rc_options_prep=: # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result fi $_G_rc_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. if func_run_hooks func_parse_options ${1+"$@"}; then eval set dummy "$func_run_hooks_result"; shift _G_rc_parse_options=: fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_rc_parse_options=: break fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac $_G_match_parse_options && _G_rc_parse_options=: done if $_G_rc_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result fi $_G_rc_parse_options } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd _G_rc_validate_options=false # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" if func_run_hooks func_validate_options ${1+"$@"}; then # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result _G_rc_validate_options=: fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE $_G_rc_validate_options } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname $scriptversion Debian-2.4.6-14 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= _G_rc_lt_options_prep=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result fi $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"} ; shift _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result fi $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -static-* direct GCC to link specific libraries statically # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: berusky2-0.12/TODO0000644000175000017500000001040513672523355010626 00000000000000valgrind --db-attach=yes --free-fill=0x50 ./berusky2 level47 - f1 - key binding help - Test local game root - Easy root configuration (in INI file) - root config? - Reduce number of ini entries - split ini files - game, controls, files - read ini files only once join Menu and Menu2 co_delete - TODO - faster comix - vertex arrays - are they on? comics does not work! - Bump mapping? valgrind --db-attach=yes ./berusky2 valgrind --track-origins=yes --free-fill=0x50 --db-attach=yes ./berusky2 --leak-check=full -> Switch from pos[3] to VECT - Stand-alone linux binaries - Easy installation, easy run - Default key settings, icons - 90degree rotation? - transparency on by default? - no menu by default, one icon to turn it on/off - icons for rotation and so? - CC icons? - game tip -> show again - more game tips - more hints? - keys and so - game console - level center - better camera (remove the camera obstructions) - automatic camera on/off -> icon for it? TODO: - Scroll help on mouse wheel am_Init_Zhave_Castice -> what are the array sizes? Tread crash - better lighting (no-lighting mode?) - screen icons? (for quick set-up) - better side menu? - fix configure script, fix install from sources (make install) - use that in rpm - web info - co to je za verze a co obsahuji - roztridit to Web: - wiki page with debugging info - troubleshooting - on-line manual/help (Web) - All hints on web - Web help/tutorial - nefunguje pruhledne veci - stopy, flares a podobne - Wait for game tip to load (wait for a key?) - better camera - lighting - better effects - window version? - ini file - see all saves options (regardless the profile) - Grey beetle can't be selected by mouse when screen is resized - Tips - wait for click (Load screen) - space to continue? - Missing/wrong Transparent 3D objects (marks on ground, water in underground) - Enable music/sound by default? - Camera center -> rotate to follow bug sight? - remove unnecessary options from ini files - transform settings from setup to text config - split ini file - per-pixel lighting - textures are not sharp - better camera (automatic?) - Why menu is not animated? - in-game menu - to menu je nejake hnusne? - defaultne je vypla/zakazana hudba/zvuky? - defaultni klavesy sou tragedie!! (delam novy profil) - fix water ripples - fix fog effects on dynamic elements -D_DEBUG -Wall -Wno-write-strings -Wsign-conversion Valgrind setup: valgrind --suppressions=suppress.txt -v --leak-check=full ./berusky2 level7.lv6 > run.txt 2>&1 Efence setup: 1) (as root) echo 200000 > /proc/sys/vm/max_map_count 2)as user, run gdb, for example: gdb ./berusky2/src/berusky2 3) copy and paste into gdb following : set env DISPLAY=:0 set env LD_PRELOAD=libefence.so.0.0 set env EF_ALLOW_MALLOC_0=1 run Tips: - disable sound&music -> set volume to 0 - rozdelit ini soubory na 2? nastaveni uzivatelu + globalni datove soubory? - nefunguji animace!! (z menu) - spatne data soubory - nikde!! (ani ve fedore) -> chyba v ini souboru?? > asm code in lighting -> writting to ligtmap updates > hwconf -> game resolution/fulscreen > wchar_windows_to_linux -> mem leaks? stransky, nastaveni nefunguje, a je v nem jeden text cesky stransky, neukazuji se popisky klaves v nastaveni, treba pro sipky stransky, jak ma fungovat 2d ovladani berdy? hadam, ze sipka doleva/doprava s ni tak i hybe, ale tim, ze se mi nedrzi nastaveni, tak se porad krouti jak motovidlo. stransky, zajimavy je, ze z hlavniho menu nastaveni vypada tak, jak jsem ho nechal, ale kdyz to zavolam ze "hry", tak to nastaveni je v kyblu, vsechno je odskrtnuty stransky, no to tvy default berusky3d,ini ani nemluv, ja nedival, jak jsi resil GetPrivateProfileString, ale treba uvod nema jmeno sekce, na konci mas dve sekce stejnyho jmena [soundengine] sekce v nem neexistuje - jo mimochodem, zvuky nehraji stransky, u decek na jakysi ATI taky nerenderuje dobre, treba ve hre to menu vlevo nahore se ukaze "nerozmazane" jen, kdyz je nad nim mys. A ten jakoze "kour kvuli zime" jim kresli jako ctverecky stransky, File komat/Keyframe.cpp Line 3137 Chyba otevreni souboru '/usr/share/berusky2/game_data/tu_01.sik' v /usr/share/berusky2/game_data - spatne ovladani b1, pri ruznych smerech to je blbe (jen po c ->center na berusku) berusky2-0.12/data/0000755000175000017500000000000013676433304011125 500000000000000berusky2-0.12/data/Makefile.am0000644000175000017500000000066613627631446013114 00000000000000## Process this file with automake to produce Makefile.in ## Created by Anjuta - will be overwritten ## If you don't want it to overwrite it, ## Please disable it in the Anjuta project configuration berusky2_datadir = $(prefix)/@NO_PREFIX_PACKAGE_DATA_DIR@/@PACKAGE@ berusky2_data_DATA = \ berusky2-data.spec\ berusky2.desktop\ berusky2.png\ berusky2.spec\ berusky3d.ini\ berusky3d-local.ini EXTRA_DIST = $(berusky2_data_DATA) berusky2-0.12/data/berusky3d.ini0000644000175000017500000000670113674766375013504 00000000000000; Game configuration file when data are installed ; in global location (/usr/share/berusky2) ; Game installation location ; you can use "." and "~" directories [install] ; those directories/files has to be read/write save_dir=~/.berusky2/Save profile_dir=~/.berusky2/Save/profiles ; unset if you don't want logs log_file=~/.berusky2/b2gamelog.txt ; this directory can be read-only game_root=/usr/share/berusky2 [game] fullscreen=0 no_sound=0 camera_type=1 ovladani=1 posouvat_kameru=0 bugs_highlight=0 items_highlight=0 p_kamera_radius=3.000000 p_kamera_alfa=0.350000 cursor=cursor last_profile=0002.prf ditering=0 ovladani=1 ovladani_rohy=0 ovladani_rohy_default=1 ovladani_rohy_smer=0 ovladani_rohy_rychlost=0.500000 ovladani_pr_posun=1 camera_intro=1 bInventory=0 mirror_effects=1 [textures] text_ans_stupen=1 text_detail0=0 text_detail1=0 text_detail2=0 text_detail3=0 text_detail4=0 text_kvalita=0 text_komprese=1 text_komprese_format=0 ; Format DXT (DXT1,....) text_mip_mapping=1 text_mip_filtr=1 text_detail=0 text_bpp=32 text_perspective=1 text_max=0 ; Automaticke orezavani textur na tyto rozmery, pokud karta umi mene, automaticky se to zapne text_max_x=2048 ; max sirka textur (pokud karta umi min, zmensi se to) text_max_y=2048 ; max vyska textur text_detail_light=0 text_ostrost=1.000000 text_bpp_plocha=0 text_hi_res=1 text_ans=0 text_ans_level=0 [debug] debug_vypisy=0 debug_light=0 debug_fps=0 debug_draty=0 debug_kamery=0 start-konzole=1 [files] prvky_dir=items level_dir=levely out_dir=out material_dir=materials data_dir=data scene_dir=sceny bitmap_dir=bitmap game_level_dir=game game_data_dir=game_data texture_dir0=textures/general texture_dir0_class=1 texture_dir1=textures/stul texture_dir1_class=3 texture_dir2=textures/balkon texture_dir2_class=3 texture_dir3=textures/kanal texture_dir3_class=3 texture_dir4=textures/voda texture_dir4_class=3 texture_dir5=textures/silnice texture_dir5_class=3 texture_dir6=textures/zahrada texture_dir6_class=3 texture_dir7=textures/bazina texture_dir7_class=3 texture_dir8=textures/les texture_dir8_class=3 texture_dir9=textures/tutorial texture_dir9_class=3 texture_dir10=textures/strom texture_dir10_class=3 texture_dir11=textures/detska texture_dir11_class=3 texture_dir12=textures/items texture_dir12_class=2 system_material_1=fleky.b2t system_material_2=mraky.b2t system_material_3=flare.b2t system_material_4=castice.b2t 3dmenu_dir=3dmenu bitmap_subdir=bitmap font_dir1=font_en font_dir2=font3d_en font_dir3=font_system_en font_dir4=font_system2_en font_dir5=font_system3d_en [soundengine] channels=16 sound_dir=sound music_dir=music pre_load=16000000 soundvolume=100 musicvolume=53 ambientvolume=100 [controls] ;ovladani berusek move_forward=273 turn_back=274 turn_left=276 turn_right=275 next_beatle=9 beatle1=49 beatle2=50 beatle3=51 beatle4=52 beatle5=53 beatle6=54 ;inventorar disable_inventory=292 inventory=23 inventory_select=28 inventory_left=75 inventory_right=77 inventory_cancel=1 item1=0 item2=0 item3=0 item4=0 ;ovladani kamery camera_move_left=0 camera_move_right=0 camera_move_forward=0 camera_move_back=0 camera_zoom_in=61 camera_zoom_out=45 camera_turn_left=0 camera_turn_right=0 camera_turn_up=0 camera_turn_down=0 camera_fast_turn_left=120 camera_fast_turn_right=118 camera_center=99 ;game menu=27 item_lock=38 blow_detonation_pack=48 next_song=49 disable_top_ledge=293 screenshot=316 visibility=32 hint=104 raitracing=52 camera_rotation=306 camera_move=304 help=282 restart=114 highlight=108 pause=25 berusky2-0.12/data/berusky2-data.spec0000644000175000017500000000247713627631446014413 00000000000000%global game_name berusky2 Summary: A datafile for Berusky Name: berusky2-data Version: 0.6 Release: 1%{?dist} License: GPLv2+ Group: Amusements/Games Source: http://downloads.sourceforge.net/%{game_name}/%{name}-%{version}.tar.bz2 URL: http://www.anakreon.cz/en/Berusky2.htm BuildArch: noarch %description This package contains the game data for %{game_name}, i.e. files with graphics, levels, game rules and configuration. %prep %setup -q %install mkdir -p %{buildroot}%{_datadir}/%{game_name} mv bitmap \ data \ game \ game_data \ items \ materials \ out \ textures \ music \ sound \ %{buildroot}%{_datadir}/%{game_name} %files %{_datadir}/%{game_name} %changelog * Sun Mar 4 2012 Martin Stransky 0.6-1 - new upstream tarball * Thu Jan 12 2012 Fedora Release Engineering - 0.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Tue Aug 30 2011 Martin Stransky 0.5-1 - new upstream tarball - spec clean up (by Richard Shaw) * Sat Aug 20 2011 Martin Stransky 0.4-1 - ini file and save/profile dir were moved to binary package * Mon Aug 15 2011 Martin Stransky 0.3-1 - initial build berusky2-0.12/data/berusky2.spec0000644000175000017500000000575413627631446013505 00000000000000Name: berusky2 Version: 0.6 Release: 1%{?dist} License: GPLv2+ Summary: Sokoban clone Group: Amusements/Games Source: http://www.anakreon.cz/download/%{name}-%{version}.tar.gz URL: http://www.anakreon.cz/en/Berusky2.htm Requires: berusky2-data >= 0.5 BuildRequires: SDL-devel BuildRequires: SDL_image-devel BuildRequires: gtk2-devel BuildRequires: desktop-file-utils BuildRequires: freealut-devel BuildRequires: openal-soft-devel BuildRequires: libvorbis-devel ExclusiveArch: %{ix86} x86_64 %description Berusky 2 is a game that challenges your visual/spatial thinking and ability to find a way to resolve a logic task. Using five bugs, you'll go through an adventure full of various puzzles spread across nine episodes. Individual episodes differ in appearance and difficulty, which increases throughout the game. %prep %setup -q %build %configure CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} %install make DESTDIR=%{buildroot} install # Move documentation so it can get installed to the right place. mkdir _tmpdoc mv %{buildroot}%{_usr}/doc/%{name}/* _tmpdoc/ rm -f _tmpdoc/INSTALL # Install ini file mkdir -p %{buildroot}%{_var}/games/%{name} install -pm 644 %{buildroot}/%{_datadir}/%{name}/berusky3d.ini \ %{buildroot}%{_var}/games/%{name} # Install icon and desktop file mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/32x32/apps cp -p %{buildroot}/%{_datadir}/%{name}/berusky2.png \ %{buildroot}/%{_datadir}/icons/hicolor/32x32/apps desktop-file-install --dir %{buildroot}/%{_datadir}/applications \ --add-category X-Fedora %{buildroot}/%{_datadir}/%{name}/berusky2.desktop # Remove directory that will be owned by data package. rm -rf %{buildroot}/%{_datadir}/%{name} %post touch --no-create %{_datadir}/icons/hicolor || : if [ -x %{_bindir}/gtk-update-icon-cache ]; then %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : fi %postun touch --no-create %{_datadir}/icons/hicolor || : if [ -x %{_bindir}/gtk-update-icon-cache ]; then %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : fi %files %doc _tmpdoc/* %{_bindir}/berusky2 %{_datadir}/applications/berusky2.desktop %{_datadir}/icons/hicolor/32x32/apps/berusky2.png %dir %{_var}/games/%{name} %{_var}/games/%{name}/* %changelog * Sun Mar 4 2012 Martin Stransky 0.6-1 - Updated to 0.6 * Thu Jan 12 2012 Fedora Release Engineering - 0.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Wed Sep 7 2011 Martin Stransky 0.5-1 - Updated to 0.5 * Tue Aug 30 2011 Martin Stransky 0.4-1 - new upstream version - spec clean-up (by Richard Shaw) * Mon Aug 22 2011 Martin Stransky 0.3-3 - spec polished * Mon Aug 15 2011 Martin Stransky 0.3-2 - fixed ini file location * Mon Aug 15 2011 Martin Stransky 0.3-1 - initial build berusky2-0.12/data/berusky2.png0000644000175000017500000003730413647160466013334 00000000000000PNG  IHDR>abKGD pHYs  ~tIME $/ uiTXtCommentCreated with GIMPd.e IDATxyGug[MŒ- W8ఘ`f!odyfL& 0If$0x aI Ync˒tUQsu261 ٪ϧ?Ro[Y~wN ,??m wG4Y{YO%OO$x:/kx;#P(@fO;k0paO9`*#2,g, ~`9M7~$MV 0l(~ڹ3 4I^`%gXD~Zv tHv3 8H?}ʛ' NG1~ijgEn133GOyXXh?K,YP.\uj)LdjU~nNlQm4Wx* 3 p{Ag)SN)o`bb)GqzFzx.&'7S 6[mg໭319ԱB Ow>,(wY_!wV^«m7{8%Ӈ;WpZ+8rt}SRv  x"닷< fY/%wFx8Op/t9zlg;Lzz= wJ< ;G ܫN+?wڽ8>tn[4Ml:/\"{o>n;p;vQ){^}J[w̏7D>7GOvS^> 7ʏcNt|=创Fn{`0ϼ^ty/$O_q6c:˛ (AH/)!XM\o< u/^tڿL/J4IR p .o'"_'J]CVT2::NX e,zhZlwص ^ʩ:r@WH!3_hru'w}OveK.>Mgm8|c ΢62JRC!J<!֐&1ֺiIq`(BYkXf8p]% _<JynۊTR-gMQU ]yx~N8a:K1YƑc-ߦP)j,ߺjgo)5Vk'톕Lp%219+(Ka / 2s7 ](1eӔcs{{s?do=|7>emƻ`zIɺ5bm96X7BT>~X&,P~b XZ!B -DXz>jfݚ\{E~nϿe!K6M+*[7c^\2: cN<.3 *`!u,̒D}Qfc4Io<'o8c~Em^k/=z ٶulXE\Fx;i:V.)·bL:eR<? 5*QʕrRX&Ɵg4D-R=J{>^Pry<߁>k|2H"'$9pd:#MRRIg~g_mW_jJBP*!=Ei$#2.i% kS!\|Ԥ?_xsc|bm 1%1OT<2>9ŪUh/@YŰILȲ~C1CզiZ@?vRL{.7޶ /hn\T$ wrA@IŵmVy6֬]O>FP*bXkjY{p^gB!K U?|'^wJvn{#}BQcx՗\ea$ _vzε/ kAkCηfdt4:%KS>ʞGvstvoJJV!vyA*x+M|}Ή3 $S< nsٵq! _#nJ$cH4Mh\l۶Ϣ:6A\CYF]vP O|`rrr\fϞ=o@HɆ+݃,tST=]w;`DXnQ.V݄?[w#ϳuVeY~ϟ]GUXE()=\z}]z>OQyRxQghe.|Xna1zI`yg#}k-_|/gy៞-& 6׿{uk-ΨVlٲ+ C.2>/GZh9Z(ؑ#\\~[}v*w}͛7STHҌ^x Ηgq^sw|`ц+o(W>ħi+ ccc pv4s}$t:.b֯_sQ7Sy_ݻ9!lZRcPJ-;>.[XwA?mgD>i`tFk'1Yz ~^GXV&''t:YvwpX_%GY 5Ri֮%ϳg> >|C˺W 8<NyOI䬳:N.3juN1?e_8kܗ`0299l'~m$o?q"j ˭g16keƍihcf>ֲwśL Þ%~תξ}x_!A DV54+v7|=pxNѣG1ZnYkgr,>ٯRV&e7=~mof~~={, ,` W5 R_H uc#o BnvnOn~ֆo:Jm)+g^Xomc뮻t:'m!"ZM7{ܼ蹗?w#s=095i}Gk}[q3s pŞ=(ZJBۥq;+xB=.ՄJ^ ic~&'ٰaWEoZ4Mvɻ~W9gz>'KϾ~?DE~u إe +/z;(KhOR~މE( 3?9|&$Z?BeQf_6vceDk͑#G8r_\8k>Oׇou )׮|o èx?(q% _]VK 55\M!BmʍӻR.q(۞56{Ktю$ (WOdx)[~,1dF{=)I9,Q <^zVɇra=)O0 I[ov R9T?_PmW*lt>iu//-%]&WT*D}&Kb1FǧRSXg_ʵky3a=L4MH J$4f9N%=bq+g_t IU_46,#, *T')Z̗7s,$I0Pcm2ء]7Mb:(vL` Gt_과-ST!Jy %+ֲ <Z㬍,롵F)0R::Aedae?(a&whmD[5^RV<(FE|?ɺsQ]1W*!rR2Iٵ9@uj_+7Y2.j GF+T"=RL\]Ǐ/8`'k o}5MꓓR`4YRI&#c`ꓫjPQ6=n&5,WRi6t/~ Dy2JNb3A}&)E&Q-?՚C339ƹ3Sފ'K g 095iۿRRT6c:n4M1qLqdN:MZ~Qk=<׽*W]{I}r tG0R_Ϋn@Tvm~pyXY+F)q#KbN3fniaf>'/=YVXܴ͛I2K+Ƥk+6=J}//W]*g||m-cӏ`1$叮vsYal@WȅdIu#k @I\ FAvL'N1$R =D}caߣlaL(-=ޫCedVsl.r:(€{oX{}z2, ymXXj|Z޽Lۏl"yi4o|6=k ݻ'%1?M`^<щIo_:?n&of0 L|ua+By`ܤfhuJ4ZȢ~Vc} kW_i(m7hIFj~<$TzGw$ cuV8l.&!0>Φ<t<I"\i,%-H&CVMMqQ,#6>1Oj5J*W`2 f$U?`2,cf ex/DJwޅo>S2##+eŊ)֮; /pxaW,K@&>RXe6Zgh+0X.زs]z #[˥H$1~$0 oVy(T u<a ^v |!W80>nŸjJbn{=:ss}A 0# ydv~Ztb06ߏ%}Z6h$nGHsFF鞳s7LnVˮB)°B,%/\.SKx(!QBš4MÐX[Ⴋng+-5kD  .`>BVcQLkh۶L%V^rgB$z>,4h4P)W|>"~21Ru1caT T@?sdFkUJ~LA~2Msgaa-XdxP.1&wk;(DFӜ_څ B5ԒCCX!0RbȰ<Ѡ^?FcC1qCaf|X_NI%2RcLFk4xy<:QDj#5<;KXSBBjq`C ۯ5L/,R 2.C |H6md,t:>iK`4)4b)1D/,KI1Q|B& :th礔T*<IFg>R:ރ_R ", FƊ9`,gYa`#z>GfT|M 0RIDAT\t9(قN]#  +XY2Z.SBe꾏/-IpdnlܶU##i6 +//X)!ټW_fVZi3N>?qs_KۥG[h! ՐXS^ߵpӄNщ(<0slRL& :k@g;@En |X .3İ'j;k2j5A)@$?bMF Ϫ*eףS2f|ԧe|unQ8J)Rj"bs%"7sytmaV+"ڽxY[#0 ᮢ1֢DXh |4ϘZA#X+&X3VgRazt 46l`b֯[@237C|>pV>2J .E\\r)XL#MO#$18bHC3}tQgj]yޢzW4%'$CL)! ֘J9-O @beLmzCbشH,z 0X#@ 1Hk0bcFFRGs<2gpf(:k#^{=z+W8&">,@H%1WkWY#q(v1rݡً݃Q+6V;@&/Iu6~P'cx繟c\RP$dDlCE~H}ݘ PAg'9dV8sc ºDm8 3ZPd s0gOL06 LcnjLMa6Hz=GҘ9Fu8ʎpuI@ |$\~598e@d|b%~mW"ʠQC(|)K/8)j ֍Mӄdmf[]0\*R|Bϙ\``%xZXVt@A/4sVL&IVhMZ!v~Nړ<,nʫQK&?鶘=|x~VG;80pK;ve٢S/zP@\]ߡzP.g1XɊO?ic#Ry!(GkBHip.OR yg+.P:}:ffˑ~V:oJoAN=ָ eZHtn<5̢He e윝cDZccsxl&y&GGLDA?& /%B93ӔݦݘyxNEa>겯fO˗~xPԀ<)xR"=@"=? >@26L Ðr)`XfF*kA PAE B!Xx!so7Z $i jLowٿg/5H% ='hX\W ȷwz| kUs Rb80#h{DIBV_ޱc LfKϣq RH'sYR.Z,b/$ C̴̷=2M6(ba^;x"TF\]A;@Ԑ}9#{r<93Bd7@u|)ax!Rei F*RH6G3 pA8iKutVJ}ͮ&;nF.$"g&uj &Y.]GB9)C7\bѮf_vn%@)"j 2gZK,&j{|厇9,aYk(Cʕ:G2G T:fDIGF4=<45(|%|Ben)Ýq2=p{i`KZ(~ĎÇz>%?M0>g}nz|vՇZ($$WR;l$>sl72HsZKeXQ RL|>)$rM,Ȳ(r07rmy>e`a ,%3xw>ؿw'B#7z/YjNn/鐥)JJTGO"8X3؄4\o 1fKq;^xsA_8k>'K<7~B m,P)hcHa4aH) Vwل ϙew}[2 5i1~(VcG,#@ ظ׮hϗsɔ`YBfFE>L)XSRQ JMq,QES ]N>1>A;iZbO+,:ꓒHuyGFX!)sEuR%M,xS ?oJ Iu/ҹ-b)RJ%4tCv"EZ G!@g89ns+`js'>G "r< O)+QRQU)B||֮_'}5fY0"uO q m2D){^?(/F!n]FlN H岆@* 0)P)Lґ0KOgqȮ&TI ,ACFHAR!,I3j+B!c2(MȒn֚Wg>uXb4Np'G͋&}kVfggvxc|NRg aF1Ϣ>)RI<ǗUMSHcDŃ &I2h[X\q<2t~}ag K] Ϣ@$ B3jrm,Y$?q N!B^:ax3!~8 oPZ% Á5q$PnϯsoJ\TrM!rfQa*ð]riraeDQ(###`3YPZMZwЇG?;АxPL<$2AP pP޲e o|F s*}<3HH&ߛ[".bGyy_)G dK2X|yI*fp oEq399980 U#ObVM?&O,zUONocbylѭ>z}o-'>N֜5e`2dVCkM!8(D( PG)g9\GK' sxаB,VXV"C(vX*Q:?֯[X{ $">.zSEt2,[-"*ŀhc NU+|D&(\ + G̸uwl(+IKO|Q*2^J¾}ȲlqL't^җӈ'mXݻگ .~3 z(,C#d7}FFFeΝAY.12jtbp06~kve(JK%}@(p7|w)}NaE\r%CSk?uu?N~[qKT QL*|jl߾g=YܹVE|ySc.c` ڕ pa?\0]J)ٷo[n_h|q<)r{{x]?<-.`]q(GTjy$Q$ >ZALN/JՆ*7:F B-JzqBoX)la@`Ck笳rرn'u\往腶=0FGNjRB)$&,̰RTT*J%M*I8~کT*TՁ;9%N(4Ow. ϗ(Uʫ,jf-a+PB?3\ܸq#J'}Vˆ_|4OƛCsqukQ$N,\9~]Z;x5MXFFFR mq%AM}M{>B!}Ed'|ihr84>KKկL r"G/p3n8Y "kݺu4 L Qt*Y#΅[6hMADjZesWmKO^:u gLY'\q5;W\z٥vxnrᖰ&rLVqeqn~L!bg`S g9pRDRaŊ%Dsu)^>yVd"Inȭ!+cKʨذ,6@ luWAYzGӥ8M8otL偵0!Q/b-WZPD(Dםw)ss iieKj*?|ǹ;44%nH:A.ZˀMRiP\;|* wI/W.u]?K~h\tEv/}Ujʚ5k}ERJ7N&'pSQq 8}v{Yϰr.MkðR$Pa X?TXN!WW'dH&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = data ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(berusky2_datadir)" DATA = $(berusky2_data_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NM = @NM@ NMEDIT = @NMEDIT@ NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@ NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@ NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@ NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@ NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENGL_CFLAGS = @OPENGL_CFLAGS@ OPENGL_LIBS = @OPENGL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@ PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@ PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@ PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOUND_CFLAGS = @SOUND_CFLAGS@ SOUND_LIBS = @SOUND_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ X11_CFLAGS = @X11_CFLAGS@ X11_LIBS = @X11_LIBS@ XGETTEXT = @XGETTEXT@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ berusky2_datadir = $(prefix)/@NO_PREFIX_PACKAGE_DATA_DIR@/@PACKAGE@ berusky2_data_DATA = \ berusky2-data.spec\ berusky2.desktop\ berusky2.png\ berusky2.spec\ berusky3d.ini\ berusky3d-local.ini EXTRA_DIST = $(berusky2_data_DATA) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu data/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-berusky2_dataDATA: $(berusky2_data_DATA) @$(NORMAL_INSTALL) @list='$(berusky2_data_DATA)'; test -n "$(berusky2_datadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(berusky2_datadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(berusky2_datadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(berusky2_datadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(berusky2_datadir)" || exit $$?; \ done uninstall-berusky2_dataDATA: @$(NORMAL_UNINSTALL) @list='$(berusky2_data_DATA)'; test -n "$(berusky2_datadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(berusky2_datadir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(berusky2_datadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-berusky2_dataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-berusky2_dataDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-berusky2_dataDATA install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-berusky2_dataDATA .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: berusky2-0.12/data/berusky3d-local.ini0000644000175000017500000000673313674766375014601 00000000000000; Game configuration file when data are installed ; in global location (/usr/share/berusky2) ; Game installation location ; you can use "." and "~" directories [install] ; those directories/files has to be read/write save_dir=~/.berusky2/Save profile_dir=~/.berusky2/Save/profiles ; unset if you don't want logs log_file=~/.berusky2/b2gamelog.txt ; this directory can be read-only game_root=/usr/share/berusky2 [game] fullscreen=0 no_sound=0 camera_type=1 ovladani=1 posouvat_kameru=0 bugs_highlight=0 items_highlight=0 p_kamera_radius=3.000000 p_kamera_alfa=0.350000 cursor=cursor last_profile=0002.prf ditering=0 ovladani=1 ovladani_rohy=0 ovladani_rohy_default=1 ovladani_rohy_smer=0 ovladani_rohy_rychlost=0.500000 ovladani_pr_posun=1 camera_intro=1 bInventory=0 mirror_effects=1 [textures] text_ans_stupen=1 text_detail0=0 text_detail1=0 text_detail2=0 text_detail3=0 text_detail4=0 text_kvalita=0 text_komprese=1 text_komprese_format=0 ; Format DXT (DXT1,....) text_mip_mapping=1 text_mip_filtr=1 text_detail=0 text_bpp=32 text_perspective=1 text_max=0 ; Automaticke orezavani textur na tyto rozmery, pokud karta umi mene, automaticky se to zapne text_max_x=2048 ; max sirka textur (pokud karta umi min, zmensi se to) text_max_y=2048 ; max vyska textur text_detail_light=0 text_ostrost=1.000000 text_bpp_plocha=0 text_hi_res=1 text_ans=0 text_ans_level=0 [debug] debug_vypisy=0 debug_light=0 debug_fps=0 debug_draty=0 debug_kamery=0 start-konzole=1 [files] prvky_dir=items level_dir=levely out_dir=out material_dir=materials data_dir=data scene_dir=sceny bitmap_dir=bitmap game_level_dir=game game_data_dir=game_data texture_dir0=./textures/general texture_dir0_class=1 texture_dir1=./textures/stul texture_dir1_class=3 texture_dir2=./textures/balkon texture_dir2_class=3 texture_dir3=./textures/kanal texture_dir3_class=3 texture_dir4=./textures/voda texture_dir4_class=3 texture_dir5=./textures/silnice texture_dir5_class=3 texture_dir6=./textures/zahrada texture_dir6_class=3 texture_dir7=./textures/bazina texture_dir7_class=3 texture_dir8=./textures/les texture_dir8_class=3 texture_dir9=./textures/tutorial texture_dir9_class=3 texture_dir10=./textures/strom texture_dir10_class=3 texture_dir11=./textures/detska texture_dir11_class=3 texture_dir12=./textures/items texture_dir12_class=2 system_material_1=fleky.b2t system_material_2=mraky.b2t system_material_3=flare.b2t system_material_4=castice.b2t 3dmenu_dir=3dmenu bitmap_subdir=bitmap font_dir1=font_en font_dir2=font3d_en font_dir3=font_system_en font_dir4=font_system2_en font_dir5=font_system3d_en [soundengine] channels=16 sound_dir=sound music_dir=music pre_load=16000000 soundvolume=100 musicvolume=53 ambientvolume=100 [controls] ;ovladani berusek move_forward=273 turn_back=274 turn_left=276 turn_right=275 next_beatle=9 beatle1=49 beatle2=50 beatle3=51 beatle4=52 beatle5=53 beatle6=54 ;inventorar disable_inventory=292 inventory=23 inventory_select=28 inventory_left=75 inventory_right=77 inventory_cancel=1 item1=0 item2=0 item3=0 item4=0 ;ovladani kamery camera_move_left=0 camera_move_right=0 camera_move_forward=0 camera_move_back=0 camera_zoom_in=61 camera_zoom_out=45 camera_turn_left=0 camera_turn_right=0 camera_turn_up=0 camera_turn_down=0 camera_fast_turn_left=120 camera_fast_turn_right=118 camera_center=99 ;game menu=27 item_lock=38 blow_detonation_pack=48 next_song=49 disable_top_ledge=293 screenshot=316 visibility=32 hint=104 raitracing=52 camera_rotation=306 camera_move=304 help=282 restart=114 highlight=108 pause=25 berusky2-0.12/data/berusky2.desktop0000644000175000017500000000034013635711012014171 00000000000000[Desktop Entry] Version=1.0 Name=Berusky2 Comment=Rescue the bugs! Exec=berusky2 StartupNotify=false Terminal=false Type=Application Icon=berusky2 Categories=Game;LogicGame; Keywords=logic;game;bugs;3D;camera;level;zooming; berusky2-0.12/missing0000755000175000017500000001533613657111465011543 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: berusky2-0.12/install-sh0000755000175000017500000003643513657111465012153 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: berusky2-0.12/Makefile.in0000644000175000017500000007216713676430206012214 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(berusky2docdir)" DATA = $(berusky2doc_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \ COPYING ChangeLog INSTALL NEWS README TODO acconfig.h compile \ config.guess config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NM = @NM@ NMEDIT = @NMEDIT@ NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@ NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@ NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@ NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@ NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENGL_CFLAGS = @OPENGL_CFLAGS@ OPENGL_LIBS = @OPENGL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@ PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@ PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@ PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOUND_CFLAGS = @SOUND_CFLAGS@ SOUND_LIBS = @SOUND_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ X11_CFLAGS = @X11_CFLAGS@ X11_LIBS = @X11_LIBS@ XGETTEXT = @XGETTEXT@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = po src data berusky2docdir = ${prefix}/doc/berusky2 berusky2doc_DATA = \ README\ COPYING\ AUTHORS\ ChangeLog\ INSTALL\ NEWS\ TODO EXTRA_DIST = $(berusky2doc_DATA) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(top_srcdir)/acconfig.h ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-berusky2docDATA: $(berusky2doc_DATA) @$(NORMAL_INSTALL) @list='$(berusky2doc_DATA)'; test -n "$(berusky2docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(berusky2docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(berusky2docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(berusky2docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(berusky2docdir)" || exit $$?; \ done uninstall-berusky2docDATA: @$(NORMAL_UNINSTALL) @list='$(berusky2doc_DATA)'; test -n "$(berusky2docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(berusky2docdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(berusky2docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-berusky2docDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-berusky2docDATA .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \ dist-tarZ dist-xz dist-zip dist-zstd distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-berusky2docDATA install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-berusky2docDATA .PRECIOUS: Makefile # Copy all the spec files. Of cource, only one is actually used. dist-hook: for specfile in *.spec; do \ if test -f $$specfile; then \ cp -p $$specfile $(distdir); \ fi \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: berusky2-0.12/config.sub0000755000175000017500000010645013657111465012125 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: berusky2-0.12/configure0000755000175000017500000244065213676430205012055 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="configure.ac" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS PACKAGE_MENU_DIR NO_PREFIX_PACKAGE_MENU_DIR PACKAGE_HELP_DIR NO_PREFIX_PACKAGE_HELP_DIR PACKAGE_PIXMAPS_DIR NO_PREFIX_PACKAGE_PIXMAPS_DIR PACKAGE_DOC_DIR NO_PREFIX_PACKAGE_DOC_DIR PACKAGE_DATA_DIR NO_PREFIX_PACKAGE_DATA_DIR SOUND_LIBS SOUND_CFLAGS ZLIB_LIBS ZLIB_CFLAGS X11_LIBS X11_CFLAGS OPENGL_LIBS OPENGL_CFLAGS SDL_LIBS SDL_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG CXXCPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL MKINSTALLDIRS POSUB POFILES PO_IN_DATADIR_FALSE PO_IN_DATADIR_TRUE INTLLIBS INSTOBJEXT GMOFILES DATADIRNAME CATOBJEXT CATALOGS XGETTEXT GMSGFMT MSGFMT_OPTS MSGFMT INTL_MACOSX_LIBS USE_NLS GETTEXT_PACKAGE am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_user_directory with_saves_directory with_profile_directory with_ini_file with_ini_file_global_dir ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC LT_SYS_LIBRARY_PATH CXXCPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR SDL_CFLAGS SDL_LIBS OPENGL_CFLAGS OPENGL_LIBS X11_CFLAGS X11_LIBS ZLIB_CFLAGS ZLIB_LIBS SOUND_CFLAGS SOUND_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-user-directory=DIR User directory location (default is ~/.berusky2) --with-saves-directory=DIR Game saves dir (default is ~/.berusky2/Save) --with-profile-directory=DIR User profiles dir (default is ~/.berusky2/Save/profiles) --with-ini-file=NAME Define ini file name (default is berusky3d.ini) --with-ini-file-global-dir=DIR Location of global ini file (default is /var/games/berusky2) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags LT_SYS_LIBRARY_PATH User-defined run-time library search path. CXXCPP C++ preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path SDL_CFLAGS C compiler flags for SDL, overriding pkg-config SDL_LIBS linker flags for SDL, overriding pkg-config OPENGL_CFLAGS C compiler flags for OPENGL, overriding pkg-config OPENGL_LIBS linker flags for OPENGL, overriding pkg-config X11_CFLAGS C compiler flags for X11, overriding pkg-config X11_LIBS linker flags for X11, overriding pkg-config ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config ZLIB_LIBS linker flags for ZLIB, overriding pkg-config SOUND_CFLAGS C compiler flags for SOUND, overriding pkg-config SOUND_LIBS linker flags for SOUND, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=berusky2 VERSION=0.12 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers config.h" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_strerror+:} false; then : break fi done if ${ac_cv_search_strerror+:} false; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi GETTEXT_PACKAGE=berusky2 cat >>confdefs.h <<_ACEOF #define GETTEXT_PACKAGE "$GETTEXT_PACKAGE" _ACEOF ALL_LINGUAS="" # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in locale.h do : ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" if test "x$ac_cv_header_locale_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LOCALE_H 1 _ACEOF fi done if test $ac_cv_header_locale_h = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5 $as_echo_n "checking for LC_MESSAGES... " >&6; } if ${am_cv_val_LC_MESSAGES+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return LC_MESSAGES ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_val_LC_MESSAGES=yes else am_cv_val_LC_MESSAGES=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_val_LC_MESSAGES" >&5 $as_echo "$am_cv_val_LC_MESSAGES" >&6; } if test $am_cv_val_LC_MESSAGES = yes; then $as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h fi fi USE_NLS=yes gt_cv_have_gettext=no CATOBJEXT=NONE XGETTEXT=: INTLLIBS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 $as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_CFPreferencesCopyAppValue=yes else gt_cv_func_CFPreferencesCopyAppValue=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 $as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then $as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 $as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { CFLocaleCopyCurrent(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_CFLocaleCopyCurrent=yes else gt_cv_func_CFLocaleCopyCurrent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 $as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then $as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" if test "x$ac_cv_header_libintl_h" = xyes; then : gt_cv_func_dgettext_libintl="no" libintl_extra_libs="" # # First check in libc # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in libc" >&5 $as_echo_n "checking for ngettext in libc... " >&6; } if ${gt_cv_func_ngettext_libc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return !ngettext ("","", 1) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_ngettext_libc=yes else gt_cv_func_ngettext_libc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_ngettext_libc" >&5 $as_echo "$gt_cv_func_ngettext_libc" >&6; } if test "$gt_cv_func_ngettext_libc" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in libc" >&5 $as_echo_n "checking for dgettext in libc... " >&6; } if ${gt_cv_func_dgettext_libc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return !dgettext ("","") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_dgettext_libc=yes else gt_cv_func_dgettext_libc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_dgettext_libc" >&5 $as_echo "$gt_cv_func_dgettext_libc" >&6; } fi if test "$gt_cv_func_ngettext_libc" = "yes" ; then for ac_func in bind_textdomain_codeset do : ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BIND_TEXTDOMAIN_CODESET 1 _ACEOF fi done fi # # If we don't have everything we want, check in libintl # if test "$gt_cv_func_dgettext_libc" != "yes" \ || test "$gt_cv_func_ngettext_libc" != "yes" \ || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bindtextdomain in -lintl" >&5 $as_echo_n "checking for bindtextdomain in -lintl... " >&6; } if ${ac_cv_lib_intl_bindtextdomain+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char bindtextdomain (); int main () { return bindtextdomain (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_bindtextdomain=yes else ac_cv_lib_intl_bindtextdomain=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_bindtextdomain" >&5 $as_echo "$ac_cv_lib_intl_bindtextdomain" >&6; } if test "x$ac_cv_lib_intl_bindtextdomain" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5 $as_echo_n "checking for ngettext in -lintl... " >&6; } if ${ac_cv_lib_intl_ngettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ngettext (); int main () { return ngettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_ngettext=yes else ac_cv_lib_intl_ngettext=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_ngettext" >&5 $as_echo "$ac_cv_lib_intl_ngettext" >&6; } if test "x$ac_cv_lib_intl_ngettext" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5 $as_echo_n "checking for dgettext in -lintl... " >&6; } if ${ac_cv_lib_intl_dgettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dgettext (); int main () { return dgettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_dgettext=yes else ac_cv_lib_intl_dgettext=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dgettext" >&5 $as_echo "$ac_cv_lib_intl_dgettext" >&6; } if test "x$ac_cv_lib_intl_dgettext" = xyes; then : gt_cv_func_dgettext_libintl=yes fi fi fi if test "$gt_cv_func_dgettext_libintl" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -liconv is needed to use gettext" >&5 $as_echo_n "checking if -liconv is needed to use gettext... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5 $as_echo_n "checking for ngettext in -lintl... " >&6; } if ${ac_cv_lib_intl_ngettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl -liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ngettext (); int main () { return ngettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_ngettext=yes else ac_cv_lib_intl_ngettext=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_ngettext" >&5 $as_echo "$ac_cv_lib_intl_ngettext" >&6; } if test "x$ac_cv_lib_intl_ngettext" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dcgettext in -lintl" >&5 $as_echo_n "checking for dcgettext in -lintl... " >&6; } if ${ac_cv_lib_intl_dcgettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl -liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dcgettext (); int main () { return dcgettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_dcgettext=yes else ac_cv_lib_intl_dcgettext=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dcgettext" >&5 $as_echo "$ac_cv_lib_intl_dcgettext" >&6; } if test "x$ac_cv_lib_intl_dcgettext" = xyes; then : gt_cv_func_dgettext_libintl=yes libintl_extra_libs=-liconv else : fi else : fi fi # # If we found libintl, then check in it for bind_textdomain_codeset(); # we'll prefer libc if neither have bind_textdomain_codeset(), # and both have dgettext and ngettext # if test "$gt_cv_func_dgettext_libintl" = "yes" ; then glib_save_LIBS="$LIBS" LIBS="$LIBS -lintl $libintl_extra_libs" unset ac_cv_func_bind_textdomain_codeset for ac_func in bind_textdomain_codeset do : ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BIND_TEXTDOMAIN_CODESET 1 _ACEOF fi done LIBS="$glib_save_LIBS" if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then gt_cv_func_dgettext_libc=no else if test "$gt_cv_func_dgettext_libc" = "yes" \ && test "$gt_cv_func_ngettext_libc" = "yes"; then gt_cv_func_dgettext_libintl=no fi fi fi fi if test "$gt_cv_func_dgettext_libc" = "yes" \ || test "$gt_cv_func_dgettext_libintl" = "yes"; then gt_cv_have_gettext=yes fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS" fi if test "$gt_cv_have_gettext" = "yes"; then $as_echo "#define HAVE_GETTEXT 1" >>confdefs.h # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case "$MSGFMT" in /*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$MSGFMT" != "no"; then glib_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" for ac_func in dcgettext do : ac_fn_c_check_func "$LINENO" "dcgettext" "ac_cv_func_dcgettext" if test "x$ac_cv_func_dcgettext" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DCGETTEXT 1 _ACEOF fi done MSGFMT_OPTS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking if msgfmt accepts -c" >&5 $as_echo_n "checking if msgfmt accepts -c... " >&6; } cat >conftest.foo <<_ACEOF msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: test 1.0\n" "PO-Revision-Date: 2007-02-15 12:01+0100\n" "Last-Translator: test \n" "Language-Team: C \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" _ACEOF if { { $as_echo "$as_me:${as_lineno-$LINENO}: \$MSGFMT -c -o /dev/null conftest.foo"; } >&5 ($MSGFMT -c -o /dev/null conftest.foo) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then MSGFMT_OPTS=-c; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } echo "$as_me: failed input was:" >&5 sed 's/^/| /' conftest.foo >&5 fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GMSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XGETTEXT+:} false; then : $as_echo_n "(cached) " >&6 else case "$XGETTEXT" in /*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : CATOBJEXT=.gmo DATADIRNAME=share else case $host in *-*-solaris*) ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : CATOBJEXT=.gmo DATADIRNAME=share else CATOBJEXT=.mo DATADIRNAME=lib fi ;; *-*-openbsd*) CATOBJEXT=.mo DATADIRNAME=share ;; *) CATOBJEXT=.mo DATADIRNAME=lib ;; esac fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$glib_save_LIBS" INSTOBJEXT=.mo else gt_cv_have_gettext=no fi fi fi if test "$gt_cv_have_gettext" = "yes" ; then $as_echo "#define ENABLE_NLS 1" >>confdefs.h fi if test "$XGETTEXT" != ":"; then if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5 $as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; } XGETTEXT=":" fi fi # We need to process the po/ directory. POSUB=po ac_config_commands="$ac_config_commands default-1" for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done if test "$gt_cv_have_gettext" = "yes"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5 $as_echo_n "checking for catalogs to be installed... " >&6; } NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then NEW_LINGUAS="$NEW_LINGUAS $presentlang" fi done LINGUAS=$NEW_LINGUAS { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5 $as_echo "$LINGUAS" >&6; } fi if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then posrcprefix="$srcdir/" else posrcprefix="../$srcdir/" fi else posrcprefix="../" fi rm -f po/POTFILES sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cr} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cr libconftest.a conftest.o" >&5 $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl SDL_image" >&5 $as_echo_n "checking for sdl SDL_image... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl SDL_image\""; } >&5 ($PKG_CONFIG --exists --print-errors "sdl SDL_image") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl SDL_image" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$SDL_LIBS"; then pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl SDL_image\""; } >&5 ($PKG_CONFIG --exists --print-errors "sdl SDL_image") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl SDL_image" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sdl SDL_image" 2>&1` else SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sdl SDL_image" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SDL_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (sdl SDL_image) were not met: $SDL_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SDL_CFLAGS and SDL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables SDL_CFLAGS and SDL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else SDL_CFLAGS=$pkg_cv_SDL_CFLAGS SDL_LIBS=$pkg_cv_SDL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gl glu" >&5 $as_echo_n "checking for gl glu... " >&6; } if test -n "$OPENGL_CFLAGS"; then pkg_cv_OPENGL_CFLAGS="$OPENGL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gl glu\""; } >&5 ($PKG_CONFIG --exists --print-errors "gl glu") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENGL_CFLAGS=`$PKG_CONFIG --cflags "gl glu" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$OPENGL_LIBS"; then pkg_cv_OPENGL_LIBS="$OPENGL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gl glu\""; } >&5 ($PKG_CONFIG --exists --print-errors "gl glu") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENGL_LIBS=`$PKG_CONFIG --libs "gl glu" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then OPENGL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gl glu" 2>&1` else OPENGL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gl glu" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$OPENGL_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (gl glu) were not met: $OPENGL_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables OPENGL_CFLAGS and OPENGL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables OPENGL_CFLAGS and OPENGL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else OPENGL_CFLAGS=$pkg_cv_OPENGL_CFLAGS OPENGL_LIBS=$pkg_cv_OPENGL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for x11" >&5 $as_echo_n "checking for x11... " >&6; } if test -n "$X11_CFLAGS"; then pkg_cv_X11_CFLAGS="$X11_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 ($PKG_CONFIG --exists --print-errors "x11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_X11_CFLAGS=`$PKG_CONFIG --cflags "x11" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$X11_LIBS"; then pkg_cv_X11_LIBS="$X11_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 ($PKG_CONFIG --exists --print-errors "x11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_X11_LIBS=`$PKG_CONFIG --libs "x11" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then X11_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11" 2>&1` else X11_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$X11_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (x11) were not met: $X11_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables X11_CFLAGS and X11_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables X11_CFLAGS and X11_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else X11_CFLAGS=$pkg_cv_X11_CFLAGS X11_LIBS=$pkg_cv_X11_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5 $as_echo_n "checking for zlib... " >&6; } if test -n "$ZLIB_CFLAGS"; then pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$ZLIB_LIBS"; then pkg_cv_ZLIB_LIBS="$ZLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1` else ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$ZLIB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (zlib) were not met: $ZLIB_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables ZLIB_CFLAGS and ZLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables ZLIB_CFLAGS and ZLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else ZLIB_CFLAGS=$pkg_cv_ZLIB_CFLAGS ZLIB_LIBS=$pkg_cv_ZLIB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openal freealut vorbisfile" >&5 $as_echo_n "checking for openal freealut vorbisfile... " >&6; } if test -n "$SOUND_CFLAGS"; then pkg_cv_SOUND_CFLAGS="$SOUND_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openal freealut vorbisfile\""; } >&5 ($PKG_CONFIG --exists --print-errors "openal freealut vorbisfile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SOUND_CFLAGS=`$PKG_CONFIG --cflags "openal freealut vorbisfile" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$SOUND_LIBS"; then pkg_cv_SOUND_LIBS="$SOUND_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openal freealut vorbisfile\""; } >&5 ($PKG_CONFIG --exists --print-errors "openal freealut vorbisfile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SOUND_LIBS=`$PKG_CONFIG --libs "openal freealut vorbisfile" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then SOUND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openal freealut vorbisfile" 2>&1` else SOUND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openal freealut vorbisfile" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SOUND_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (openal freealut vorbisfile) were not met: $SOUND_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SOUND_CFLAGS and SOUND_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables SOUND_CFLAGS and SOUND_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else SOUND_CFLAGS=$pkg_cv_SOUND_CFLAGS SOUND_LIBS=$pkg_cv_SOUND_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi CFLAGS="$CFLAGS $SDL_CFLAGS $OPENGL_CFLAGS $X11_CFLAGS $SOUND_CFLAGS $ZLIB_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS $OPENGL_CFLAGS $X11_CFLAGS $SOUND_CFLAGS $ZLIB_CFLAGS" LDFLAGS="$LDFLAGS $SDL_LIBS $OPENGL_LIBS $X11_LIBS $SOUND_LIBS $ZLIB_LIBS" # https://github.com/stransky/berusky2/issues/23 LDFLAGS="$LDFLAGS -lpthread" # Check whether --with-user_directory was given. if test "${with_user_directory+set}" = set; then : withval=$with_user_directory; fi if test "x$with_user_directory" != x; then cat >>confdefs.h <<_ACEOF #define INI_USER_DIRECTORY $with_user_directory _ACEOF else cat >>confdefs.h <<_ACEOF #define INI_USER_DIRECTORY "~/.berusky2" _ACEOF fi # Check whether --with-saves_directory was given. if test "${with_saves_directory+set}" = set; then : withval=$with_saves_directory; fi if test "x$with_saves_directory" != x; then cat >>confdefs.h <<_ACEOF #define INI_SAVES_DIRECTORY $with_saves_directory _ACEOF else cat >>confdefs.h <<_ACEOF #define INI_SAVES_DIRECTORY "~/.berusky2/Save" _ACEOF fi # Check whether --with-profile_directory was given. if test "${with_profile_directory+set}" = set; then : withval=$with_profile_directory; fi if test "x$with_profile_directory" != x; then cat >>confdefs.h <<_ACEOF #define INI_PROFILE_DIRECTORY $with_profile_directory _ACEOF else cat >>confdefs.h <<_ACEOF #define INI_PROFILE_DIRECTORY "~/.berusky2/Save/profiles" _ACEOF fi # Check whether --with-ini_file was given. if test "${with_ini_file+set}" = set; then : withval=$with_ini_file; fi if test "x$with_ini_file" != x; then cat >>confdefs.h <<_ACEOF #define INI_FILE_NAME $with_ini_file _ACEOF else cat >>confdefs.h <<_ACEOF #define INI_FILE_NAME "berusky3d.ini" _ACEOF fi # Check whether --with-ini_file_global_dir was given. if test "${with_ini_file_global_dir+set}" = set; then : withval=$with_ini_file_global_dir; fi if test "x$with_ini_file_global_dir" != x; then cat >>confdefs.h <<_ACEOF #define INI_FILE_GLOBAL_DIR $with_ini_file_global_dir _ACEOF else cat >>confdefs.h <<_ACEOF #define INI_FILE_GLOBAL_DIR "/var/games/berusky2" _ACEOF fi if test "x${prefix}" = "xNONE"; then cat >>confdefs.h <<_ACEOF #define PACKAGE_LOCALE_DIR "${ac_default_prefix}/${DATADIRNAME}/locale" _ACEOF else cat >>confdefs.h <<_ACEOF #define PACKAGE_LOCALE_DIR "${prefix}/${DATADIRNAME}/locale" _ACEOF fi packagesrcdir=`cd $srcdir && pwd` if test "x${prefix}" = "xNONE"; then packageprefix=${ac_default_prefix} else packageprefix=${prefix} fi packagedatadir=share packagedocdir=doc/${PACKAGE} packagepixmapsdir=${packagedatadir}/pixmaps packagehelpdir=${packagedatadir}/help packagemenudir=${packagedatadir} NO_PREFIX_PACKAGE_DATA_DIR="${packagedatadir}" PACKAGE_DATA_DIR="${packageprefix}/${packagedatadir}" NO_PREFIX_PACKAGE_DOC_DIR="${packagedocdir}" PACKAGE_DOC_DIR="${packageprefix}/${packagedocdir}" NO_PREFIX_PACKAGE_PIXMAPS_DIR="${packagepixmapsdir}" PACKAGE_PIXMAPS_DIR="${packageprefix}/${packagepixmapsdir}" NO_PREFIX_PACKAGE_HELP_DIR="${packagehelpdir}" PACKAGE_HELP_DIR="${packageprefix}/${packagehelpdir}" NO_PREFIX_PACKAGE_MENU_DIR="${packagemenudir}" PACKAGE_MENU_DIR="${packageprefix}/${packagemenudir}" cat >>confdefs.h <<_ACEOF #define PACKAGE_DATA_DIR "${packageprefix}/${packagedatadir}" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_DOC_DIR "${packageprefix}/${packagedocdir}" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_PIXMAPS_DIR "${packageprefix}/${packagepixmapsdir}" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_HELP_DIR "${packageprefix}/${packagehelpdir}" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_MENU_DIR "${packageprefix}/${packagemenudir}" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_SOURCE_DIR "${packagesrcdir}" _ACEOF ac_config_files="$ac_config_files Makefile po/Makefile.in src/Makefile data/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "default-1":C) case "$CONFIG_FILES" in *po/Makefile.in*) sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile esac ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi berusky2-0.12/config.h.in0000644000175000017500000000606113657111464012161 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ #undef ENABLE_NLS #undef HAVE_CATGETS #undef HAVE_GETTEXT #undef HAVE_LC_MESSAGES #undef HAVE_STPCPY #undef HAVE_LIBSM #undef PACKAGE_LOCALE_DIR #undef PACKAGE_DOC_DIR #undef PACKAGE_DATA_DIR #undef PACKAGE_PIXMAPS_DIR #undef PACKAGE_HELP_DIR #undef PACKAGE_MENU_DIR #undef PACKAGE_SOURCE_DIR #undef GETTEXT_PACKAGE /* always defined to indicate that i18n is enabled */ #undef ENABLE_NLS /* Package name for gettext */ #undef GETTEXT_PACKAGE /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #undef HAVE_BIND_TEXTDOMAIN_CODESET /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYCURRENT /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define to 1 if you have the `dcgettext' function. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Global ini file dir. */ #undef INI_FILE_GLOBAL_DIR /* Game ini file */ #undef INI_FILE_NAME /* User profile dir. */ #undef INI_PROFILE_DIRECTORY /* Game saves dir */ #undef INI_SAVES_DIRECTORY /* Default user directory location. */ #undef INI_USER_DIRECTORY /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Package local directory */ #undef PACKAGE_LOCALE_DIR /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION berusky2-0.12/INSTALL0000644000175000017500000003661413657111415011172 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this 'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a 'Makefile' in each directory of the package. It may also create one or more '.h' files containing system-dependent definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a file 'config.log' containing compiler output (useful mainly for debugging 'configure'). It can also use an optional file (typically called 'config.cache' and enabled with '--cache-file=config.cache' or simply '-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how 'configure' could check whether to do them, and mail diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at some point 'config.cache' contains results you don't want to keep, you may remove or edit it. The file 'configure.ac' (or 'configure.in') is used to create 'configure' by a program called 'autoconf'. You need 'configure.ac' if you want to change it or regenerate 'configure' using a newer version of 'autoconf'. The simplest way to compile this package is: 1. 'cd' to the directory containing the package's source code and type './configure' to configure the package for your system. Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type 'make' to compile the package. 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the 'make install' phase executed with root privileges. 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing 'make clean'. To also remove the files that 'configure' created (so you can compile the package for a different kind of computer), type 'make distclean'. There is also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. You can give 'configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run the 'configure' script. 'configure' automatically checks for the source code in the directory that 'configure' is in and in '..'. This is known as a "VPATH" build. With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple '-arch' options to the compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the 'lipo' tool if you have problems. Installation Names ================== By default, 'make install' installs the package's commands under '/usr/local/bin', include files under '/usr/local/include', etc. You can specify an installation prefix other than '/usr/local' by giving 'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like '--bindir=DIR' to specify different values for particular kinds of files. Run 'configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of '${prefix}', so that specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the 'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of '${prefix}'. Any directories that were specified during 'configure', but not in terms of '${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the 'DESTDIR' variable. For example, 'make install DESTDIR=/alternate/directory' will prepend '/alternate/directory' before all installation names. The approach of 'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of '${prefix}' at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving 'configure' the option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. Some packages pay attention to '--enable-FEATURE' options to 'configure', where FEATURE indicates an optional part of the package. They may also pay attention to '--with-PACKAGE' options, where PACKAGE is something like 'gnu-as' or 'x' (for the X Window System). The 'README' should mention any '--enable-' and '--with-' options that the package recognizes. For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, you can use the 'configure' options '--x-includes=DIR' and '--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be overridden with 'make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX 'make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its '' header file. The option '-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in '/usr/bin'. So, if you need '/usr/ucb' in your 'PATH', put it _after_ '/usr/bin'. On Haiku, software installed for all users goes in '/boot/common', not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the '--build=TYPE' option. TYPE can either be a short name for the system type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file 'config.sub' for the possible values of each field. If 'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with '--host=TYPE'. Sharing Defaults ================ If you want to set default values for 'configure' scripts to share, you can create a site shell script called 'config.site' that gives default values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' looks for 'PREFIX/share/config.site' if it exists, then 'PREFIX/etc/config.site' if it exists. Or, you can set the 'CONFIG_SITE' environment variable to the location of the site script. A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 'configure' Invocation ====================== 'configure' recognizes the following options to control how it operates. '--help' '-h' Print a summary of all of the options to 'configure', and exit. '--help=short' '--help=recursive' Print a summary of the options unique to this package's 'configure', and exit. The 'short' variant lists options used only in the top level, while the 'recursive' variant lists options also present in any nested packages. '--version' '-V' Print the version of Autoconf used to generate the 'configure' script, and exit. '--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. '--config-cache' '-C' Alias for '--cache-file=config.cache'. '--quiet' '--silent' '-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). '--srcdir=DIR' Look for the package's source code in directory DIR. Usually 'configure' can determine that directory automatically. '--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. '--no-create' '-n' Run the configure checks, but stop before creating any output files. 'configure' also accepts some other, not widely useful, options. Run 'configure --help' for more details. berusky2-0.12/depcomp0000755000175000017500000005602013657111465011514 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: berusky2-0.12/aclocal.m40000644000175000017500000142071413676430176012011 00000000000000# generated automatically by aclocal 1.16.2 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 1995-2002 Free Software Foundation, Inc. # Copyright (C) 2001-2003,2004 Red Hat, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License # but which still want to provide support for the GNU gettext functionality. # # Macro to add for using GNU gettext. # Ulrich Drepper , 1995, 1996 # # Modified to never use included libintl. # Owen Taylor , 12/15/1998 # # Major rework to remove unused code # Owen Taylor , 12/11/2002 # # Added better handling of ALL_LINGUAS from GNU gettext version # written by Bruno Haible, Owen Taylor 5/30/3002 # # Modified to require ngettext # Matthias Clasen 08/06/2004 # Increment this whenever this file is changed. #serial 1 # We need this here as well, since someone might use autoconf-2.5x # to configure GLib then an older version to configure a package # using AM_GLIB_GNU_GETTEXT AC_PREREQ(2.53) dnl dnl We go to great lengths to make sure that aclocal won't dnl try to pull in the installed version of these macros dnl when running aclocal in the glib directory. dnl m4_copy([AC_DEFUN],[glib_DEFUN]) m4_copy([AC_REQUIRE],[glib_REQUIRE]) dnl dnl At the end, if we're not within glib, we'll define the public dnl definitions in terms of our private definitions. dnl # GLIB_LC_MESSAGES #-------------------- glib_DEFUN([GLIB_LC_MESSAGES], [AC_CHECK_HEADERS([locale.h]) if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi fi]) # GLIB_PATH_PROG_WITH_TEST #---------------------------- dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) glib_DEFUN([GLIB_PATH_PROG_WITH_TEST], [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) dnl Checks for special options needed on Mac OS X. dnl Defines INTL_MACOSX_LIBS. dnl dnl Copied from intlmacosx.m4 in gettext, GPL. dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. glib_DEFUN([glib_gt_INTL_MACOSX], [ dnl Check for API introduced in Mac OS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], [gt_cv_func_CFPreferencesCopyAppValue], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[CFPreferencesCopyAppValue(NULL, NULL)]])], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Check for API introduced in Mac OS X 10.3. AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[CFLocaleCopyCurrent();]])], [gt_cv_func_CFLocaleCopyCurrent=yes], [gt_cv_func_CFLocaleCopyCurrent=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyCurrent = yes; then AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) # GLIB_WITH_NLS #----------------- glib_DEFUN([GLIB_WITH_NLS], dnl NLS is obligatory [USE_NLS=yes AC_SUBST(USE_NLS) gt_cv_have_gettext=no CATOBJEXT=NONE XGETTEXT=: INTLLIBS= glib_gt_INTL_MACOSX AC_CHECK_HEADER(libintl.h, [gt_cv_func_dgettext_libintl="no" libintl_extra_libs="" # # First check in libc # AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, [AC_TRY_LINK([ #include ], [return !ngettext ("","", 1)], gt_cv_func_ngettext_libc=yes, gt_cv_func_ngettext_libc=no) ]) if test "$gt_cv_func_ngettext_libc" = "yes" ; then AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, [AC_TRY_LINK([ #include ], [return !dgettext ("","")], gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no) ]) fi if test "$gt_cv_func_ngettext_libc" = "yes" ; then AC_CHECK_FUNCS(bind_textdomain_codeset) fi # # If we don't have everything we want, check in libintl # if test "$gt_cv_func_dgettext_libc" != "yes" \ || test "$gt_cv_func_ngettext_libc" != "yes" \ || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then AC_CHECK_LIB(intl, bindtextdomain, [AC_CHECK_LIB(intl, ngettext, [AC_CHECK_LIB(intl, dgettext, gt_cv_func_dgettext_libintl=yes)])]) if test "$gt_cv_func_dgettext_libintl" != "yes" ; then AC_MSG_CHECKING([if -liconv is needed to use gettext]) AC_MSG_RESULT([]) AC_CHECK_LIB(intl, ngettext, [AC_CHECK_LIB(intl, dcgettext, [gt_cv_func_dgettext_libintl=yes libintl_extra_libs=-liconv], :,-liconv)], :,-liconv) fi # # If we found libintl, then check in it for bind_textdomain_codeset(); # we'll prefer libc if neither have bind_textdomain_codeset(), # and both have dgettext and ngettext # if test "$gt_cv_func_dgettext_libintl" = "yes" ; then glib_save_LIBS="$LIBS" LIBS="$LIBS -lintl $libintl_extra_libs" unset ac_cv_func_bind_textdomain_codeset AC_CHECK_FUNCS(bind_textdomain_codeset) LIBS="$glib_save_LIBS" if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then gt_cv_func_dgettext_libc=no else if test "$gt_cv_func_dgettext_libc" = "yes" \ && test "$gt_cv_func_ngettext_libc" = "yes"; then gt_cv_func_dgettext_libintl=no fi fi fi fi if test "$gt_cv_func_dgettext_libc" = "yes" \ || test "$gt_cv_func_dgettext_libintl" = "yes"; then gt_cv_have_gettext=yes fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS" fi if test "$gt_cv_have_gettext" = "yes"; then AC_DEFINE(HAVE_GETTEXT,1, [Define if the GNU gettext() function is already present or preinstalled.]) GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl if test "$MSGFMT" != "no"; then glib_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" AC_CHECK_FUNCS(dcgettext) MSGFMT_OPTS= AC_MSG_CHECKING([if msgfmt accepts -c]) GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[ msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: test 1.0\n" "PO-Revision-Date: 2007-02-15 12:01+0100\n" "Last-Translator: test \n" "Language-Team: C \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" ], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_SUBST(MSGFMT_OPTS) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr], [CATOBJEXT=.gmo DATADIRNAME=share], [case $host in *-*-solaris*) dnl On Solaris, if bind_textdomain_codeset is in libc, dnl GNU format message catalog is always supported, dnl since both are added to the libc all together. dnl Hence, we'd like to go with DATADIRNAME=share and dnl and CATOBJEXT=.gmo in this case. AC_CHECK_FUNC(bind_textdomain_codeset, [CATOBJEXT=.gmo DATADIRNAME=share], [CATOBJEXT=.mo DATADIRNAME=lib]) ;; *-*-openbsd*) CATOBJEXT=.mo DATADIRNAME=share ;; *) CATOBJEXT=.mo DATADIRNAME=lib ;; esac]) LIBS="$glib_save_LIBS" INSTOBJEXT=.mo else gt_cv_have_gettext=no fi fi ]) if test "$gt_cv_have_gettext" = "yes" ; then AC_DEFINE(ENABLE_NLS, 1, [always defined to indicate that i18n is enabled]) fi dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is not GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi # We need to process the po/ directory. POSUB=po AC_OUTPUT_COMMANDS( [case "$CONFIG_FILES" in *po/Makefile.in*) sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile esac]) dnl These rules are solely for the distribution goal. While doing this dnl we only have to keep exactly one list of the available catalogs dnl in configure.ac. for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done dnl Make all variables we use known to autoconf. AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) AC_SUBST(DATADIRNAME) AC_SUBST(GMOFILES) AC_SUBST(INSTOBJEXT) AC_SUBST(INTLLIBS) AC_SUBST(PO_IN_DATADIR_TRUE) AC_SUBST(PO_IN_DATADIR_FALSE) AC_SUBST(POFILES) AC_SUBST(POSUB) ]) # AM_GLIB_GNU_GETTEXT # ------------------- # Do checks necessary for use of gettext. If a suitable implementation # of gettext is found in either in libintl or in the C library, # it will set INTLLIBS to the libraries needed for use of gettext # and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable # gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST() # on various variables needed by the Makefile.in.in installed by # glib-gettextize. dnl AU_DEFUN([GLIB_GNU_GETTEXT], [AC_REQUIRE([AC_PROG_CC])dnl GLIB_LC_MESSAGES GLIB_WITH_NLS if test "$gt_cv_have_gettext" = "yes"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then NEW_LINGUAS="$NEW_LINGUAS $presentlang" fi done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but ($top_srcdir). dnl Try to locate is. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) dnl Generate list of files to be processed by xgettext which will dnl be included in po/Makefile. test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then posrcprefix="$srcdir/" else posrcprefix="../$srcdir/" fi else posrcprefix="../" fi rm -f po/POTFILES sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES ], [[$0: This macro is deprecated. You should use upstream gettext instead.]]) # AM_GLIB_DEFINE_LOCALEDIR(VARIABLE) # ------------------------------- # Define VARIABLE to the location where catalog files will # be installed by po/Makefile. glib_DEFUN([GLIB_DEFINE_LOCALEDIR], [glib_REQUIRE([GLIB_GNU_GETTEXT])dnl glib_save_prefix="$prefix" glib_save_exec_prefix="$exec_prefix" glib_save_datarootdir="$datarootdir" test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix=$prefix datarootdir=`eval echo "${datarootdir}"` if test "x$CATOBJEXT" = "x.mo" ; then localedir=`eval echo "${libdir}/locale"` else localedir=`eval echo "${datadir}/locale"` fi prefix="$glib_save_prefix" exec_prefix="$glib_save_exec_prefix" datarootdir="$glib_save_datarootdir" AC_DEFINE_UNQUOTED($1, "$localedir", [Define the location where the catalogs will be installed]) ]) dnl dnl Now the definitions that aclocal will find dnl ifdef(glib_configure_ac,[],[ AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)]) AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) ])dnl # GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL]) # # Create a temporary file with TEST-FILE as its contents and pass the # file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with # 0 and perform ACTION-IF-FAIL for any other exit status. AC_DEFUN([GLIB_RUN_PROG], [cat >conftest.foo <<_ACEOF $2 _ACEOF if AC_RUN_LOG([$1 conftest.foo]); then m4_ifval([$3], [$3], [:]) m4_ifvaln([$4], [else $4])dnl echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD fi]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cr} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 12 (pkg-config-0.29.2) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR # Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR berusky2-0.12/config.guess0000755000175000017500000012637313657111465012470 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: berusky2-0.12/README0000644000175000017500000000624013627631446011021 00000000000000 0. Homepage http://anakreon.cz/en/Berusky2.htm 1. Compilation Berusky2 is developed on Fedora 14. It may or may not build/run on other distros/platform. Feel free to send feedback/patches to stransky@anakreon.cz. 1.1 - Build of berusky2 code from tar.gz: * Install devel packages for libraries (SDL, SDL_Image, GL, GLU, X11, zlib). * Download berusky2-version.tar.gz and extract it and rebuild by: $tar xzf berusky2-version.tar.gz $cd berusky2-version $./configure $make 1.2 - Build of berusky2 code from src.rpm package: * Download berusky2-version.src.rpm and run: $rpmbuild --rebuild berusky2-version.src.rpm * Install the built game binary as root by: $su - #rpm -ihv berusky2-version.arch.rpm 2. Configuration 2.1 - Configuration/installation from tar.gz: * Download berusky2-data-version.tar.gz and extract it somewhere: $tar xzf berusky2-data-version.tar.gz $cd berusky2-data-version * Grab berusky3d-local.ini from berusky2-version.tar.gz (it's in the data dir) and copy it to created berusky2-data-version directory. * Grab the binary (from 1.1) and copy it to your berusky2-data-version dir. 2.2 - Configuration/installation from src.rpm: * Download berusky2-data-version.src.rpm and run: $rpmbuild --rebuild berusky2-data-version.src.rpm * Install the built rpm file as root by: $su - #rpm -ihv berusky2-data-version.arch.rpm 3. Game run 3.1 - Run from local installation (in berusky2-data-version dir): $./berusky2 -i berusky3d-local.ini -l - runs main game $./berusky2 -i berusky3d-local.ini -l level_name.lv6 - runs user level named "level_name" from game directory. 3.2. - Run from installed rpm packages: $berusky2 - runs main game $berusky2 level_name.lv6 - runs user level named "level_name" from game directory. 4. Game Rules In order to leave each level it is necessary to reach exit with all bugs. You will be meeting miscellaneous game elements while completing individual missions, we will try to explain their meaning now. Box/Light Box - It is possible to push it. Explosive - Can destroy the boxes. Exit - A gate to next level/exit. Stone - Can be broken by a pickax. Pickax - A tool for stone crushing. There are some other elements, a comple list is available in help - pres F1 for it. 5. Game keys Arrows - Move selected bug Tabulator - Switch among the bugs Space - On/Off bug visibility 1 - Choose the first bug 2 - Choose the second bug 3 - Choose the third bug 4 - Choose the fourth bug 5 - Choose the fifth bug F1 - In game help F2 - Save level F3 - Load level Mouse: left shift + mouse motion - camera move left ctrl + mouse motion - camera rotation mouse wheel - camera zoom mouse left button - select bug mouse right button - print element type (wall, box...) berusky2-0.12/COPYING0000644000175000017500000010451313657111415011166 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . berusky2-0.12/acconfig.h0000644000175000017500000000047413631265471012062 00000000000000#undef ENABLE_NLS #undef HAVE_CATGETS #undef HAVE_GETTEXT #undef HAVE_LC_MESSAGES #undef HAVE_STPCPY #undef HAVE_LIBSM #undef PACKAGE_LOCALE_DIR #undef PACKAGE_DOC_DIR #undef PACKAGE_DATA_DIR #undef PACKAGE_PIXMAPS_DIR #undef PACKAGE_HELP_DIR #undef PACKAGE_MENU_DIR #undef PACKAGE_SOURCE_DIR #undef GETTEXT_PACKAGE berusky2-0.12/src/0000755000175000017500000000000013676433304011003 500000000000000berusky2-0.12/src/Makefile.am0000644000175000017500000001743713657111415012766 00000000000000## Process this file with automake to produce Makefile.in ## Created by Anjuta - will be overwritten ## If you don't want it to overwrite it, ## Please disable it in the Anjuta project configuration INCLUDES =\ -Ikomat -Ikofola -Itmp -Iage/graph -Iage/include -Iage/support -Iage/utils -Igenerator -Iadas AM_CFLAGS =\ -D_FORTIFY_SOURCE=2\ -D_DEBUG -Wall -Wno-write-strings\ -g AM_CXXFLAGS =\ -D_FORTIFY_SOURCE=2\ -D_DEBUG -Wall -Wno-write-strings\ -g bin_PROGRAMS = berusky2 berusky2_SOURCES = \ kofola/3D_graphic.cpp\ kofola/3D_graphic.h\ kofola/3D_menus.cpp\ kofola/3D_menus.h\ kofola/3d_math.cpp\ kofola/3d_math.h\ kofola/Bind.cpp\ kofola/Bind.h\ kofola/Camera.cpp\ kofola/Comics.cpp\ kofola/Comics.h\ kofola/Command.cpp\ kofola/Command.h\ kofola/Dda.cpp\ kofola/Dda.h\ kofola/Demo.cpp\ kofola/Demo.h\ kofola/Init.cpp\ kofola/Menu.cpp\ kofola/Menu.h\ kofola/Menu2.cpp\ kofola/Menu2.h\ kofola/Object.h\ kofola/Setup.h\ kofola/Tools.cpp\ kofola/Tools.h\ kofola/animend_functions.cpp\ kofola/animend_functions.h\ kofola/camera.h\ kofola/codec.h\ kofola/config_types.h\ kofola/controls.cpp\ kofola/controls.h\ kofola/controls3d.cpp\ kofola/controls3d.h\ kofola/credits.cpp\ kofola/credits.h\ kofola/font.cpp\ kofola/font.h\ kofola/font3d.cpp\ kofola/font3d.h\ kofola/game_init.cpp\ kofola/game_init.h\ kofola/game_logic.cpp\ kofola/game_logic.h\ kofola/game_main.cpp\ kofola/game_main.h\ kofola/grammar.cpp\ kofola/grammar.h\ kofola/init.h\ kofola/level_environment.h\ kofola/load_level.cpp\ kofola/load_level.h\ kofola/menu_def.h\ kofola/menu_script.cpp\ kofola/menu_script.h\ kofola/profiles.cpp\ kofola/profiles.h\ kofola/secure.h\ kofola/setup.cpp\ kofola/square_cut.cpp\ kofola/square_cut.h\ kofola/trigers.cpp\ kofola/trigers.h\ kofola/volume.cpp\ kofola/volume.h\ kofola/water.cpp\ kofola/water.h\ komat/3d_all.h\ komat/3d_typy.h\ komat/3dinterface.cpp\ komat/3dinterface.h\ komat/Berusky3d.cpp\ komat/Berusky3d.h\ komat/Berusky3d_castice.cpp\ komat/Berusky3d_castice.h\ komat/Berusky3d_castice2.h\ komat/Berusky3d_ini.cpp\ komat/Berusky3d_ini.h\ komat/Berusky3d_kamery.cpp\ komat/Berusky3d_kamery.h\ komat/Berusky3d_kofola2d.cpp\ komat/Berusky3d_kofola2d.h\ komat/Berusky3d_kofola_interface.cpp\ komat/Berusky3d_kofola_interface.h\ komat/Berusky3d_light.cpp\ komat/Berusky3d_light.h\ komat/Berusky3d_load.cpp\ komat/Berusky3d_load.h\ komat/Berusky3d_render.cpp\ komat/Berusky3d_render.h\ komat/Berusky_universal.h\ komat/Ddx.h\ komat/Di.cpp\ komat/Di.h\ komat/Load.cpp\ komat/Load.h\ komat/Load_chunks.cpp\ komat/Load_chunks.h\ komat/Load_out.cpp\ komat/Load_out.h\ komat/kfile.h\ komat/mmalloc.h\ komat/zlib_io.h\ tmp/compat.cpp\ tmp/compat.h\ kofola/2D_graphic.cpp\ kofola/2D_graphic.h\ age/graph/age.cpp\ age/graph/age.h\ age/graph/alpha.cpp\ age/graph/alpha.h\ age/graph/animation.cpp\ age/graph/animation.h\ age/graph/animation_time.cpp\ age/graph/animation_time.h\ age/graph/animation_track.cpp\ age/graph/animation_track.h\ age/graph/animation_track_bezier.cpp\ age/graph/animation_track_bezier.h\ age/graph/animation_track_linear.cpp\ age/graph/animation_track_linear.h\ age/graph/bitmap.cpp\ age/graph/bitmap.h\ age/graph/box.cpp\ age/graph/box.h\ age/graph/camera.cpp\ age/graph/camera.h\ age/graph/camera_interface.cpp\ age/graph/camera_interface.h\ age/graph/color.cpp\ age/graph/color.h\ age/graph/color_helpers.h\ age/graph/color_hsv.cpp\ age/graph/color_hsv.h\ age/graph/color_operators.h\ age/graph/draw.cpp\ age/graph/draw.h\ age/graph/ferguson.cpp\ age/graph/ferguson.h\ age/graph/gext.cpp\ age/graph/gext.h\ age/graph/glwrapper.cpp\ age/graph/glwrapper.h\ age/graph/gpipe.cpp\ age/graph/gpipe.h\ age/graph/graph3d.cpp\ age/graph/graph3d.h\ age/graph/intersect.cpp\ age/graph/intersect.h\ age/graph/lighting.cpp\ age/graph/lighting.h\ age/graph/material.cpp\ age/graph/material.h\ age/graph/material_texture.cpp\ age/graph/material_texture.h\ age/graph/matrix.cpp\ age/graph/matrix.h\ age/graph/matrix_animated.cpp\ age/graph/matrix_animated.h\ age/graph/matrix_notified.cpp\ age/graph/matrix_notified.h\ age/graph/mesh.cpp\ age/graph/mesh.h\ age/graph/normals.cpp\ age/graph/normals.h\ age/graph/obb.cpp\ age/graph/obb.h\ age/graph/object_base.cpp\ age/graph/object_base.h\ age/graph/object_box.cpp\ age/graph/object_box.h\ age/graph/object_geometry.cpp\ age/graph/object_geometry.h\ age/graph/object_hierarchy.cpp\ age/graph/object_hierarchy.h\ age/graph/object_list.cpp\ age/graph/object_list.h\ age/graph/object_mark.h\ age/graph/object_name.h\ age/graph/object_render_list.cpp\ age/graph/object_render_list.h\ age/graph/object_scene.cpp\ age/graph/object_scene.h\ age/graph/object_select.h\ age/graph/object_transformation.cpp\ age/graph/object_transformation.h\ age/graph/object_world.cpp\ age/graph/object_world.h\ age/graph/polar.cpp\ age/graph/polar.h\ age/graph/print.cpp\ age/graph/print.h\ age/graph/quat.h\ age/graph/scene.cpp\ age/graph/scene.h\ age/graph/scene_import_3ds.cpp\ age/graph/scene_import_3ds.h\ age/graph/scene_import_b2m.cpp\ age/graph/scene_import_b2m.h\ age/graph/scene_import_txt.cpp\ age/graph/scene_import_txt.h\ age/graph/scene_load.cpp\ age/graph/scene_load.h\ age/graph/scene_reference.h\ age/graph/selection.cpp\ age/graph/selection.h\ age/graph/surface.cpp\ age/graph/surface.h\ age/graph/surface_height.cpp\ age/graph/surface_height.h\ age/graph/surface_mask.cpp\ age/graph/surface_mask.h\ age/graph/surface_sdl.cpp\ age/graph/surface_sdl.h\ age/graph/surface_sw.cpp\ age/graph/surface_sw.h\ age/graph/texture_func.cpp\ age/graph/texture_func.h\ age/graph/texture_unit.cpp\ age/graph/texture_unit.h\ age/graph/triangle.cpp\ age/graph/triangle.h\ age/graph/vector.cpp\ age/graph/vector.h\ age/graph/vector_operators.h\ age/graph/vertex_arrays.cpp\ age/graph/vertex_arrays.h\ age/graph/world_interface.cpp\ age/graph/world_interface.h\ age/include/compatibility.h\ age/include/defs.h\ age/include/defs_config.h\ age/include/floats.h\ age/include/opengl.h\ age/include/typ.h\ age/include/typ_graph.h\ age/support/age_main.cpp\ age/support/age_main.h\ age/support/events.cpp\ age/support/events.h\ age/support/events_types.h\ age/support/input.cpp\ age/support/input.h\ age/support/timer.cpp\ age/support/timer.h\ age/utils/array.h\ age/utils/barray.h\ age/utils/btree.h\ age/utils/change.cpp\ age/utils/change.h\ age/utils/data_file.cpp\ age/utils/data_file.h\ age/utils/flag.h\ age/utils/ini.cpp\ age/utils/ini.h\ age/utils/llist.h\ age/utils/llist_named.h\ age/utils/lock.h\ age/utils/log.cpp\ age/utils/log.h\ age/utils/mem_alloc.cpp\ age/utils/mem_alloc.h\ age/utils/mtree.cpp\ age/utils/mtree.h\ age/utils/mtree_named.h\ age/utils/stack.h\ age/utils/types.h\ age/utils/utils.cpp\ age/utils/utils.h\ kofola/animationk.cpp\ kofola/animationk.h\ generator/generator_random.cpp\ generator/generator_random.h\ komat/Ddx.cpp\ komat/kfile.cpp\ komat/Mat3d.h\ komat/3dmath.h\ komat/3dproject.h\ komat/Keyframe.h\ komat/Quat.h\ komat/Berusky3d_animace.cpp\ komat/Berusky3d_animace.h\ komat/3dmath.cpp\ komat/3dproject.cpp\ komat/Mat3d.cpp\ komat/Keyframe.cpp\ komat/Texture.cpp\ komat/Texture.h\ komat/Texture_import.cpp\ komat/Texture_import.h\ komat/obbo.cpp\ komat/obbo.h\ komat/Kdtree.cpp\ komat/Kdtree.h\ komat/Matrix.h\ komat/Vektor.h\ kofola/ambient_sounds.h\ komat/json_export.cpp\ komat/json_export.h\ kofola/ambient_sounds.cpp\ kofola/audio_plug-in.cpp\ kofola/audio_plug-in.h\ adas/3d_math_k.c\ adas/3d_math_k.h\ adas/adas.c\ adas/adas.h\ adas/adas_types.h\ adas/ogg_io.c\ adas/ogg_io.h\ adas/ogg_stream.c\ adas/ogg_stream.h\ tmp/compat_mini.cpp\ tmp/compat_mini.h\ tmp/alut_test.cpp\ age/graph/aabb.cpp\ age/graph/aabb.h berusky2_LDFLAGS = berusky2_LDADD = berusky2-0.12/src/komat/0000755000175000017500000000000013676433304012116 500000000000000berusky2-0.12/src/komat/Berusky3d_kamery.h0000644000175000017500000000227113674426075015441 00000000000000/* Animace.h */ #ifndef __BERUSKY_3D_KAMERY #define __BERUSKY_3D_KAMERY /* Init vsech animaci */ void kani_updatuj(G_KONFIG * p_ber); void ber_zpruhledni_prvky(G_KONFIG * p_ber); void ber_zpruhlednuj_scenu_polylist_rec(G_KONFIG * p_ber, OBB_TREE_OLD * p_prvni, GLMATRIX * p_m, BOD * p, BOD * t); void ber_zpruhledni_prvky_reset(G_KONFIG * p_ber); int ber_kamera_korekce_vzdalenosti(G_KONFIG * p_ber, int korekce, int korekce_vzdal); void ber_kamera_zpruhledni_objekty(G_KONFIG * p_ber); void ber_kamera_zpruhledni_objekty_reset(G_KONFIG * p_ber); void kam_set_kino_screen(G_KONFIG * p_ber); void kam_set_normal_screen(G_KONFIG * p_ber); void kam_set_last(G_KONFIG * p_ber); void kam_kino_set_clear(G_KONFIG * p_ber); void kam_game_set_clear(G_KONFIG * p_ber); inline static void ber_reset_mesh(BODRGBA * p_d, BODRGBA * p_src, int num) { int v; for (v = 0; v < num; v++) { p_d->a = p_src->a; p_src++; p_d++; } } inline static void ber_reset_poly(TEXT_KOORD * p_d, int num) { int v; for (v = 0; v < num; v++) { p_d[v].da = p_d[v].mda; } } #endif berusky2-0.12/src/komat/Load_out.cpp0000644000175000017500000003225013674426075014317 00000000000000/* Load/save out souboru */ #include #include #include "3d_all.h" int lo_nacti_word_matrix_out(FFILE f, GLMATRIX * p_mat); int lo_nahraj_objekty_out(EDIT_MATERIAL ** p_mat, int max_mat, FFILE f, EDIT_KONTEJNER * p_kont, int mat); typedef struct _KONTEJNER_KONFIG { dword flag; // flagy konteneru BOD zrcadlo[4]; // 4 body zrcadla char rezerved[52]; } KONTEJNER_KONFIG; typedef struct _KONTEJNER_KONFIG_OLD { char flag; // flagy konteneru char rezerved[2000]; } KONTEJNER_KONFIG_OLD; typedef struct _GENERIC_HEAD { //typicka hlavicka char h[4]; //flag (VVVV,FFFF,MMMM) word pocet; //pocet elementu } GENERIC_HEAD; int lo_je_tag(FFILE f, char *p_tag) { long t = fftell(f); char string[10]; ffgets(string, 5, f); string[4] = 0; if (strcmp(string, p_tag) != 0) { ffseek(f, t, SEEK_SET); return ((int) NULL); } return (TRUE); } int lo_nahraj_konfiguraci_kontejneru_out(FFILE f, EDIT_KONTEJNER * p_kont) { KONTEJNER_KONFIG kkonf; KONTEJNER_KONFIG_OLD kkonf_old; if (lo_je_tag(f, KONFIG_TAG)) { // nacti nove info ffread(&kkonf, sizeof(kkonf), 1, f); p_kont->m1flag = kkonf.flag & 0xffff; p_kont->kflag = kkonf.flag & 0xffff0000; return (TRUE); } else if (lo_je_tag(f, KONFIG_TAG_OLD)) { // nacti stare info ffread(&kkonf_old, sizeof(kkonf_old), 1, f); p_kont->m1flag |= kkonf_old.flag ? MAT_PRUHLEDNY : 0; return (TRUE); } else return (FALSE); } int lo_nacti_word_matrix_out(FFILE f, GLMATRIX * p_mat) { GENERIC_HEAD head; int t = fftell(f); if (!ffread(&head, sizeof(head), 1, f)) { ffseek(f, t, SEEK_SET); return (FALSE); } if (head.h[0] != 'W' || head.h[1] != 'W' || head.h[2] != 'W' || head.h[3] != 'W') { ffseek(f, t, SEEK_SET); return (FALSE); } if (!ffread(p_mat, sizeof(GLMATRIX), 1, f)) { ffseek(f, t, SEEK_SET); return (FALSE); } return (TRUE); } void nahraj_texturu_fc(FFILE f, EDIT_MATERIAL * p_mat, EDIT_TEXT * p_text, int max, int cislo_text, int save) { OLD_MULTITEXT_FLAG mt; char string[100]; int t; if (lo_je_tag(f, TEXT_TAG)) { str_read(string, f); strlwr(string); if (!strcmp(string, S_NIC)) { p_mat->p_text[cislo_text] = NULL; p_mat->textfile[cislo_text][0] = 0; } else { if (save) { if ((t = lo_najdi_texturu(p_text, max, string, FALSE)) == K_CHYBA) { if ((t = lo_najdi_volnou_texturu(p_text, max)) == K_CHYBA) chyba("Textury"); strcpy(p_text[t].jmeno, string); } p_mat->p_text[cislo_text] = p_text + t; strcpy(p_mat->textfile[cislo_text], string); } } } if (lo_je_tag(f, MULTI_TAG)) ffread(&mt, sizeof(mt), 1, f); } EDIT_MATERIAL *lo_nahraj_material_out(FFILE f, EDIT_TEXT * p_text, int max, int save) { EDIT_MATERIAL *p_mat; MATERIAL *p_dxmat; OLD_MULTITEXT_FLAG mt; char string[50]; dword tmp; if (!lo_je_tag(f, MTRL_TAG)) return (NULL); else { p_mat = vyrob_material(); str_read(p_mat->jmeno, f); } ffread(string, sizeof(char), 9, f); // nacteni grb if (save) { p_dxmat = &p_mat->dxmat; p_dxmat->ambient_r = (float) string[0] / MAX_BYTE; p_dxmat->ambient_g = (float) string[1] / MAX_BYTE; p_dxmat->ambient_b = (float) string[2] / MAX_BYTE; p_dxmat->diffuse_r = (string[3]) ? ((float) string[3]) / MAX_BYTE : 1.0f; p_dxmat->diffuse_g = (string[4]) ? ((float) string[4]) / MAX_BYTE : 1.0f; p_dxmat->diffuse_b = (string[5]) ? ((float) string[4]) / MAX_BYTE : 1.0f; p_dxmat->diffuse_a = 1.0f; p_dxmat->specular_r = (float) string[6] / MAX_BYTE; p_dxmat->specular_g = (float) string[7] / MAX_BYTE; p_dxmat->specular_b = (float) string[8] / MAX_BYTE; p_dxmat->faktor_r = 1.0f; p_dxmat->faktor_g = 1.0f; p_dxmat->faktor_b = 1.0f; p_dxmat->faktor_a = 1.0f; } // nacte soubor s animacema if (lo_je_tag(f, MATANIM_TAG)) { str_read(p_mat->anim.jmeno, f); //lo_vyrob_animaci_list(p_mat,p_mat->anim.jmeno,p_text,max,ANIM_LOAD_ALL); } // nacte alfa tag if (lo_je_tag(f, FAKTOR_TAG)) { ffread(&tmp, sizeof(dword), 1, f); } // Nacte stage blok if (lo_je_tag(f, STAG_TAG)) { ffread(string, sizeof(char), 1, f); ffread(&tmp, sizeof(dword), 1, f); ffread(&tmp, sizeof(dword), 1, f); p_mat->alfa_state = 0; p_mat->text_state[0].text_stage = 0; p_mat->text_state[1].text_stage = 0; } // nacteni nuloveho blendu if (lo_je_tag(f, MULTI_TAG)) ffread(&mt, sizeof(mt), 1, f); nahraj_texturu_fc(f, p_mat, p_text, max, 0, save); nahraj_texturu_fc(f, p_mat, p_text, max, 1, save); nahraj_texturu_fc(f, p_mat, p_text, max, 1, save); strlwr(p_mat->jmeno); if (save) return (p_mat); else { zrus_material(&p_mat); return ((EDIT_MATERIAL *) 1); } } int lo_nahraj_materialy_out(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, FFILE f, int save) { EDIT_MATERIAL *p_tmp; int i = 0; int m = 0, nm; while (1) { if (save) { if ((m = lo_najdi_prazdny_material(p_mat, max_mat)) == K_CHYBA) chyba("Malo materialu!"); } p_tmp = lo_nahraj_material_out(f, p_text, max_text, save); if (!p_tmp) { break; } if (save) { if ((nm = lo_najdi_material(p_mat, max_mat, p_tmp->jmeno)) == K_CHYBA) p_mat[m] = p_tmp; else { /* Nahravany material byl nalezen na pozici nm */ if (hlasit_kolize) { ddw("Kolize materialu - krizi se materialy %d \"%s\" a %d \"%s\"!", m, p_tmp->jmeno, nm, p_mat[nm]->jmeno); //p_mat[nm] - puvodni material //doe_cti_jmeno(NULL,p_mat[nm]->jmeno); //} } zrus_material(&p_tmp); } } i++; } return (i); } int lo_nahraj_materialy_out_jmeno(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file, int save) { EDIT_KONTEJNER *p_kont = NULL; FFILE f; if ((f = ffopen(p_file, "rb")) == NULL) { //ddw("Chyba nahrani materialu %s chyba '%s'",p_file,strerror(errno)); return (FALSE); } p_kont = vyrob_kontejner(); lo_nahraj_konfiguraci_kontejneru_out(f, p_kont); lo_nacti_word_matrix_out(f, &p_kont->world); lo_nahraj_materialy_out(p_mat, max_mat, p_text, max_text, f, save); ffclose(f); // neni treba premapovat svetla zrus_kontejner_rec(&p_kont, NULL); return (TRUE); } int lo_nacti_vertexlist_out(FFILE f, OBJEKT_BOD ** p_vert) { GENERIC_HEAD head; long t = fftell(f); float v[3]; int i; if (*p_vert != NULL) { return ((int) NULL); } if (!ffread(&head, sizeof(head), 1, f)) { ffseek(f, t, SEEK_SET); return ((int) NULL); } if ((head.h[0] != 'V') || (head.h[1] != 'V') || (head.h[2] != 'V') || (head.h[3] != 'V')) { ffseek(f, t, SEEK_SET); return ((int) NULL); } if ((*p_vert = (OBJEKT_BOD *) mmalloc(sizeof(OBJEKT_BOD) * head.pocet)) == NULL) { chyba("Nedostatek pameti..."); } memset(*p_vert, 0, sizeof(OBJEKT_BOD) * head.pocet); for (i = 0; i < head.pocet; i++) { if (!ffread(&v, sizeof(v), 1, f)) { ffseek(f, t, SEEK_SET); null_free((void **) p_vert); return ((int) NULL); } (*p_vert)[i].x = v[0]; (*p_vert)[i].y = v[1]; (*p_vert)[i].z = v[2]; (*p_vert)[i].dr = (*p_vert)[i].dg = (*p_vert)[i].db = 1.0f; } return (head.pocet); } int lo_nacti_maplist_out(FFILE f, OBJEKT_BOD ** p_vert, int c_text) { GENERIC_HEAD head; long t = fftell(f); float *p_map; float m[2]; int i; if (*p_vert == NULL) return ((int) NULL); if (!ffread(&head, sizeof(head), 1, f)) { ffseek(f, t, SEEK_SET); return ((int) NULL); } if ((head.h[0] != 'M') || (head.h[1] != 'M') || (head.h[2] != 'M') || (head.h[3] != 'M')) { ffseek(f, t, SEEK_SET); return ((int) NULL); } if (c_text >= 2) { c_text = 1; } for (i = 0; i < head.pocet; i++) { if (!ffread(&m, sizeof(m), 1, f)) { ffseek(f, t, SEEK_SET); return ((int) NULL); } p_map = &(*p_vert)[i].tu1; p_map[0 + c_text * 2] = m[0]; p_map[1 + c_text * 2] = -m[1]; } return (head.pocet); } int lo_nacti_facelist_out(FFILE f, FACE ** p_face) { GENERIC_HEAD head; long t = fftell(f); if (*p_face != NULL) return ((int) NULL); if (!ffread(&head, sizeof(head), 1, f)) { ffseek(f, t, SEEK_SET); return ((int) NULL); } if ((head.h[0] != 'F') || (head.h[1] != 'F') || (head.h[2] != 'F') || (head.h[3] != 'F')) { ffseek(f, t, SEEK_SET); return ((int) NULL); } head.pocet *= 3; if (!head.pocet) chyba("load facelist -> 0 facu !"); if ((*p_face = (FACE *) mmalloc(sizeof(FACE) * head.pocet)) == NULL) { chyba("Nedostatek pameti..."); } if (!ffread(*p_face, sizeof(FACE), head.pocet, f)) { null_free((void **) p_face); ffseek(f, t, SEEK_SET); return ((int) NULL); } return (head.pocet); } int lo_nacti_barvy_out(FFILE f, OBJ_VERTEX * p_vert, word pocet) { GENERIC_HEAD head; dword barva; long t = fftell(f); int i; if (p_vert == NULL) return (FALSE); for (i = 0; i < pocet; i++) { p_vert[i].dr = p_vert[i].dg = p_vert[i].db = 1.0f; } if (!ffread(&head, sizeof(head), 1, f)) { ffseek(f, t, SEEK_SET); return (FALSE); } if ((head.h[0] != 'D') || (head.h[1] != 'D') || (head.h[2] != 'D') || (head.h[3] != 'D')) { ffseek(f, t, SEEK_SET); return (FALSE); } for (i = 0; i < head.pocet; i++) { if (!ffread(&barva, sizeof(dword), 1, f)) { ffseek(f, t, SEEK_SET); return (FALSE); } else { rgb_float(barva, &p_vert[i].dr); } } return (head.pocet); } EDIT_OBJEKT *lo_nacti_vec_FILE_out(FFILE f) { EDIT_OBJEKT *p_obj = vyrob_objekt(); int i = 0; if ((p_obj->vertexnum = lo_nacti_vertexlist_out(f, &p_obj->p_vertex)) == (int) NULL) { zrus_objekt(&p_obj); ffclose(f); return (NULL); } while (lo_nacti_maplist_out(f, &p_obj->p_vertex, i++)); if ((p_obj->facenum = lo_nacti_facelist_out(f, &p_obj->p_face)) == (int) NULL) { zrus_objekt(&p_obj); ffclose(f); return (NULL); } lo_nacti_barvy_out(f, p_obj->p_vertex, p_obj->vertexnum); return (p_obj); } EDIT_OBJEKT *lo_nacti_vec_out(char *p_filename) { EDIT_OBJEKT *p_obj; FFILE f; if ((f = ffopen(p_filename, "rb")) == NULL) return (NULL); p_obj = lo_nacti_vec_FILE_out(f); ffclose(f); return (p_obj); } int lo_nahraj_objekty_out(EDIT_MATERIAL ** p_mat, int max_mat, FFILE f, EDIT_KONTEJNER * p_kont, int mat) { char string[50]; int i, j, k; word r1; for (i = 0; i < p_kont->max_objektu; i++) { if (!lo_je_tag(f, "JMOB")) break; else str_read(string, f); if (!lo_je_tag(f, "TMSH")) continue; //je to objekt ale neni to mes if ((p_kont->p_obj[i] = lo_nacti_vec_FILE_out(f)) == NULL) chyba("Nacitani objektu..."); strcpy(p_kont->p_obj[i]->jmeno, string); for (k = 0; k < 2; k++) { //nactenej jeden objekt - pricist jeste material if (!lo_je_tag(f, "FMAT")) { break; // neni material - na dalsi objekt } else str_read(string, f); if (mat) { if (!k) { if (!strcasecmp(string, S_NIC)) { p_kont->p_obj[i]->material = 0; p_kont->p_obj[i]->m1flag = 0; p_kont->p_obj[i]->m2flag = 0; p_kont->p_obj[i]->oflag = 0; } else { for (j = 0; j < max_mat; j++) { if (p_mat[j] && !strcasecmp(string, p_mat[j]->jmeno)) { p_kont->p_obj[i]->material = (word) j; p_kont->p_obj[i]->m1flag = p_mat[j]->flag; p_kont->p_obj[i]->m2flag = p_mat[j]->flag2; break; } } if (j == max_mat) { ddw("Neznamy material '%s' v objektu '%s'", string, p_kont->p_obj[i]->jmeno); p_kont->p_obj[i]->material = 0; p_kont->p_obj[i]->m1flag = 0; p_kont->p_obj[i]->m2flag = 0; } } } } else { p_kont->p_obj[i]->material = 0; p_kont->p_obj[i]->m1flag = 0; p_kont->p_obj[i]->m2flag = 0; } } if (lo_je_tag(f, "RECT")) { // sou tam recy ffread(&r1, sizeof(word), 1, f); ffread(&r1, sizeof(word), 1, f); } } return (i); } EDIT_KONTEJNER *lo_nahraj_kontejner_out(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_jmeno, int mat) { EDIT_KONTEJNER *p_kont = NULL; FFILE f; int i = 0; p_kont = vyrob_kontejner(); if ((f = ffopen(p_jmeno, "rb")) == NULL) { /* if(TVRDE_CHYBY) tiskni_chybu(__LINE__,__FILE__,NULL,"Chyba '%s' file '%s'",strerror(errno),p_jmeno); else { ddw("Chyba nahrani kontejneru %s chyba '%s'",p_jmeno,strerror(errno)); return(NULL); } */ return (NULL); } lo_nahraj_konfiguraci_kontejneru_out(f, p_kont); lo_nacti_word_matrix_out(f, &p_kont->world); lo_nahraj_materialy_out(p_mat, max_mat, p_text, max_text, f, mat); i = lo_nahraj_objekty_out(p_mat, max_mat, f, p_kont, mat); ffclose(f); if (i) updatuj_kontejner_statistika(p_kont, FALSE); return (p_kont); } berusky2-0.12/src/komat/Berusky3d_kofola2d.h0000644000175000017500000002654413674426075015663 00000000000000/* -------------------------------------------------- Rozhrani k 2D grafice -------------------------------------------------- */ #ifndef __BERUSKY3D_KOFOLA2D_H__ #define __BERUSKY3D_KOFOLA2D_H__ #include "2D_graphic.h" #define DDX2_BACK_BUFFER (-1) #define NO_SURFACE (-1) typedef void (* DDX2_DEVICE_SCREEN_CALLBACK)(void); typedef struct _DDX2_SURFACE { bitmapa *p_bmp; } DDX2_SURFACE; typedef struct _DDX2_SURFACE_DEVICE_3D { int text; int filtr; int format; BODUV map[4]; // Mapovaci koordinaty v texture int back_dx, // Rozmery back-bufferu back_dy; int text_x, // Pozice a rozmery textury v Back-bufferu text_y, text_dx, text_dy, text_real_dx, text_real_dy; int scr_x, // Rozmery a pozice device na obrazovce scr_y, scr_dx, scr_dy; } DDX2_SURFACE_DEVICE_3D; typedef struct _DDX2_SURFACE_DEVICE { struct _DDX2_SURFACE_DEVICE *p_next; bitmapa *p_back_buffer; DDX2_SURFACE_DEVICE_3D hw; int rnum; RECT *p_rlist; int draw; DDX2_DEVICE_SCREEN_CALLBACK p_resize_callback; } DDX2_SURFACE_DEVICE; typedef struct _DDX2_SURFACE_LIST { int surf_num; int surf_max; DDX2_SURFACE *p_slist; dword pruhledna_barva; } DDX2_SURFACE_LIST; typedef size_ptr DeviceHandle; typedef int SurfaceHandle; //------------------------------------------------------------------------------------------------ // Name: ddx2Init() // Desc: Vyrobi rezervoar na surfacy //------------------------------------------------------------------------------------------------ int ddx2Init(int max_surfacu, dword pruhledna_barva); //------------------------------------------------------------------------------------------------ // Name: ddx2Release() // Desc: Zrusi rezervovar na surfacy //------------------------------------------------------------------------------------------------ void ddx2Release(void); //----------------------------------------------------------------------------- // Name: ddx2DeviceCreate() // Desc: Vyrobi renderovaci device a vlozi ho to seznamu devicu // filtr - TRUE - linear, FALSE - near // bpp - 16/32 //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceCreate(int linear_filtr, int bpp, bool cursor_device = FALSE); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetActive() // Desc: Nastavi renderovaci device jako aktivni //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetActive(DeviceHandle handle); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetCursor() // Desc: Set this device as a cursor device //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetCursor(DeviceHandle handle); //----------------------------------------------------------------------------- // Name: ddx2DeviceRemove() // Desc: Zrusi zarizeni, pokud je aktivni nastavi aktivni prvni v seznamu //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceRemove(DeviceHandle handle); //----------------------------------------------------------------------------- // Name: ddx2DeviceResBackBuffer(int back_dx, int back_dy) // Desc: Nastavi rozmer back-bufferu //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetBackBufferSize(int back_dx, int back_dy); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetBackBufferRect(int text_x, int text_y, int text_dx, int text_dy) // Desc: Nastavi pozici a rozmery textury v back-bufferu //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetBackBufferRect(int text_x, int text_y, int text_dx, int text_dy); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetTextRenderRec(int vx, int vy, int v_dx, int v_dy) // Desc: Nastavi oblast textury, ktera se bude prenaset na obrazovku //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetTextRenderRec(int vx, int vy, int v_dx, int v_dy); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetScreenRec(int scr_x, int scr_y, int scr_dx, int scr_dy) // Desc: Nastavi pozici textury na obrazovce (umisteni + rozmer) //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetScreenRec(int scr_x, int scr_y, int scr_dx = 0, int scr_dy = 0); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetScreenRecCallback(DDX2DEVICESCREENRECCALLBACK p_callback) // Desc: Sets a callback for screen resize //----------------------------------------------------------------------------- void ddx2ScreenResDefaultCallback(void); DeviceHandle ddx2DeviceSetScreenRecCallback(DDX2_DEVICE_SCREEN_CALLBACK p_callback); //----------------------------------------------------------------------------- // Name: ddx2DeviceDeaktivuj() // Desc: Odmapuje aktivni zarizeni zobrazovky (smaze texturu a pod.) //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceDeaktivuj(void); //----------------------------------------------------------------------------- // Name: ddx2DeviceSetRender(int draw) // Desc: Povoli/zakaze kresleni device (na zacatku je kresleni zakazano) //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetRender(int draw); //----------------------------------------------------------------------------- // Name: ddx2DeviceGetInfo() // Desc: Cte informace o velikost obsazene pameti a poctu surfacu (vsech) //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceGetInfo(int *p_surfacu, int *p_mem); //----------------------------------------------------------------------------- // Name: ddx2SetRect() // Desc: Nastavi seznam recu na kresleni, NULL = nic nekreslit //----------------------------------------------------------------------------- void ddx2SetRect(RECT * p_rlist, int rnum); //------------------------------------------------------------------------------------------------ // finds first free index //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2FindFreeSurface(void); //------------------------------------------------------------------------------------------------ // release bitmap //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2ReleaseBitmap(SurfaceHandle iSurface); //------------------------------------------------------------------------------------------------ // load bitmap from a directory na pozici //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmapPos(SurfaceHandle handle, char *pFileName, char *pDirName); //------------------------------------------------------------------------------------------------ // load bitmap from a directory //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmap(char *pFileName, char *pDirName); //------------------------------------------------------------------------------------------------ // load bitmap from DISK //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmapDisk(char *pFileName); //------------------------------------------------------------------------------------------------ // load bitmap from DISK na pozici //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmapPosDisk(SurfaceHandle handle, char *pFileName); //------------------------------------------------------------------------------------------------ // load list of bitmaps from a directory //------------------------------------------------------------------------------------------------ int ddx2LoadList(char *pFileName, char *pBmpDir, char *p_bmp_dir); //------------------------------------------------------------------------------------------------ // Create Surface //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2CreateSurface(int x, int y, int idx); void ddx2DrawSurfaceColorKey(int iSurface, int *com, int layer, COLORREF color); void ddx2DrawDisplayColorKey(int *com, int layer, COLORREF color); void ddx2DrawSurface(int iSurface, int *com, int layer); void ddx2DrawDisplay(int *com, int layer); BOOL ddx2TransparentBlt(SurfaceHandle dst, int dx, int dy, int dsirka, int dvyska, SurfaceHandle src, int sx, int sy, dword pruhledna); BOOL ddx2TransparentBltDisplay(int dx, int dy, int dsirka, int dvyska, int dcSrcSurface, int sx, int sy, int ssirka, int svyska, UINT crTransparent); BOOL ddx2TransparentBltFull(SurfaceHandle dst, int dx, int dy, SurfaceHandle src, dword barva); BOOL ddx2BitBlt(SurfaceHandle dst, int dx, int dy, int sirka, int vyska, SurfaceHandle src, int sx, int sy); BOOL ddx2BitBltStretch(SurfaceHandle dst, int dx, int dy, int dst_width, int dst_height, SurfaceHandle src, int sx, int sy, int src_width, int src_height); BOOL ddx2BitBltDisplay(int dx, int dy, int sirka, int vyska, int dcSrcSurface, int sx, int sy); BOOL ddx2BitBltFull(SurfaceHandle dst, int dx, int dy, SurfaceHandle src); int ddx2GetWidth(SurfaceHandle src); int ddx2GetHeight(SurfaceHandle src); void ddx2CleareSurfaceColor(SurfaceHandle iSurface, COLORREF color); void ddx2FillRect(SurfaceHandle iSurface, RECT * rect, COLORREF color); void ddx2CleareSurface(SurfaceHandle iSurface); void ddx2AddRectItem(RECT_LINE * p_rl, RECT rect, int iLayer = 0); void ddx2DrawCursor(SurfaceHandle iSurface, int x, int y, int dx, int dy, dword pruhledna); void ddx2DrawCursorSetDraw(int draw); //------------------------------------------------------------------------------------------------ // Povoli/zakaze rendering hry (3D modelu a pod.) //------------------------------------------------------------------------------------------------ void ddx2GameRender(int render); // ---------------------------------------------------------------------------- // Name: ddx2RenderDevices() // Desc: Vykresli menu pouze menu, bez mazani obrazovky a flipu // Vola se pokud se menu ma kreslit jako soucast hry (volat po renderingu // menu s listim) // ---------------------------------------------------------------------------- void ddx2RenderDevices(G_KONFIG * p_ber); // ---------------------------------------------------------------------------- // Name: ddx2RenderujVse() // Desc: Vykresli menu // Kresli menu vcetne vymazani obrazovky // ---------------------------------------------------------------------------- void ddx2RenderujVse(G_KONFIG * p_ber); #endif berusky2-0.12/src/komat/Berusky3d_load.cpp0000644000175000017500000006025613674766375015444 00000000000000/* Berusky loaders */ #include #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_render.h" #include "json_export.h" /* Voda ma guid 12 */ int ber_je_objekt_voda(int guid) { return (guid / 1000 == 12); } /* Prace s levelem (vyrobeni/zruseni) */ void ber_vyrob_level(G_KONFIG * p_ber, int x, int y, int z) { p_ber->x_num = x; p_ber->y_num = y; p_ber->z_num = z; p_ber->prvnum = 0; } void ber_zrus_level(G_KONFIG * p_ber) { int i; // vymazni vsechny prvky for (i = 0; i < MAX_PRVKU_LEVEL; i++) { if (p_ber->p_prv_lev[i]) { free(p_ber->p_prv_lev[i]); p_ber->p_prv_lev[i] = NULL; } } // vymazni level p_ber->z_num = p_ber->y_num = p_ber->x_num = 0; } /* Loady levelu */ PRVEK_LEVELU_GAME *ber_vyrob_prvek_levelu(void) { PRVEK_LEVELU_GAME *p_prv = (PRVEK_LEVELU_GAME *) mmalloc(sizeof(PRVEK_LEVELU_GAME)); init_matrix(&p_prv->mg); init_matrix(&p_prv->mp); return (p_prv); } /* Load meshe */ int ber_najdi_mesh_id(GAME_MESH_OLD ** p_mesh, int max, int id) { int i; for (i = 0; i < max; i++) { if (p_mesh[i] && p_mesh[i]->p_data->mesh_ID == id) return (i); } return (K_CHYBA); } /* Prida regulerni mesh z disku */ int ber_prvek_disk_do_bunky(G_KONFIG * p_ber, BUNKA_LEVELU_DISK * p_disk, MeshHandle *p_handle, int ID, int x, int y, int z) { PRVEK_LEVELU_GAME *p_lev; GAME_MESH_OLD *p_mesh; GLMATRIX *p_m, tmp1; int guid = p_disk->guid; int mesh; int i; if (!guid) { return (TRUE); } for (i = 0; i < MAX_PRVKU_LEVEL; i++) { if (!p_ber->p_prv_lev[i]) { p_lev = p_ber->p_prv_lev[i] = ber_vyrob_prvek_levelu(); p_lev->guid = p_disk->guid; p_lev->rotace = p_disk->Rotace; p_lev->staticky = ber_je_objekt_staticky(p_disk->guid); if (p_lev->staticky && !ber_je_objekt_voda(p_disk->guid)) { assert(ber_pozice_v_levelu(x, y >> 1, z, p_ber->x_num, p_ber->z_num) < p_ber->hitnum); p_ber->p_hit_list[ber_pozice_v_levelu(x, y >> 1, z, p_ber->x_num, p_ber->z_num)] = TRUE; } if (ID && p_disk->mesh != -1) { mesh = ber_najdi_mesh_id(p_ber->p_mesh, p_ber->meshnum, p_disk->mesh); if (mesh == K_CHYBA) { mesh = p_disk->mesh; } } else { mesh = p_disk->mesh; } p_lev->mesh = mesh; if (mesh != K_CHYBA && p_ber->p_mesh[mesh]) { p_mesh = p_ber->p_mesh[mesh]; p_lev->p_mesh_data = p_mesh->p_data; p_lev->mp = p_mesh->m; p_m = &p_lev->mp; // Nacti umisteni meshe na mape p_lev->x = p_m->_41; p_lev->y = p_m->_42 + (Y_PRVEK / 2); // stred prvku je vyse p_lev->z = p_m->_43; p_lev->rotace = p_disk->Rotace; // Vyrob obalku prvku ve world-space transformuj_bod_matici(&p_lev->x, &p_lev->y, &p_lev->z, &p_mesh->m); init_matrix(&p_lev->mg); // Nastav pozici prvku if (p_mesh->p_data->kflag & KONT_KEYFRAME) { mat_mult_dir(&p_mesh->world, &p_mesh->m, &tmp1); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp1); } else { key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } p_mesh->p_data->kflag |= KONT_POHYB; p_mesh->p_data->mesh_handle = p_disk->mesh; } else { p_lev->mesh = K_CHYBA; } *p_handle = i; p_ber->prvnum++; return (TRUE); } } return (FALSE); } /* #define ber_pozice_v_levelu( _x,_y,_z,_x_num,_z_num) #define ber_pozice_na_disku(_i,_x,_y,_z,_x_num,_z_num) */ /* Prida divoky mesh */ int ber_mesh_do_bunky(G_KONFIG * p_ber, int mesh, int *p_handle) { PRVEK_LEVELU_GAME *p_lev; GAME_MESH_OLD *p_mesh = p_ber->p_mesh[mesh]; GLMATRIX tmp1; int i; if (!p_ber->p_mesh[mesh]) { return (K_CHYBA); } for (i = 0; i < MAX_PRVKU_LEVEL; i++) { if (!p_ber->p_prv_lev[i]) { p_lev = p_ber->p_prv_lev[i] = ber_vyrob_prvek_levelu(); p_lev->mesh = mesh; p_mesh = p_ber->p_mesh[mesh]; p_lev->p_mesh_data = p_mesh->p_data; p_lev->mp = p_mesh->m; p_lev->pivot = p_mesh->kofola_pivot; init_matrix(&p_lev->mg); if (p_mesh->p_data->kflag & KONT_KEYFRAME) { mat_mult_dir(&p_mesh->world, &p_mesh->m, &tmp1); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp1); } else { key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } p_mesh->p_data->kflag |= KONT_POHYB; p_mesh->p_data->mesh_handle = mesh; *p_handle = i; p_ber->prvnum++; return (TRUE); } } return (FALSE); } void ber_umisti_prvek(MeshHandle handle, int x, int y, int z, int rotace) { PRVEK_LEVELU_GAME *p_lev = p_ber->p_prv_lev[handle]; GAME_MESH_OLD *p_mesh; GLMATRIX *p_m, tmp1; if (p_lev) { p_m = &p_lev->mp; if (ber_je_objekt_staticky(p_lev->guid)) { p_lev->x = (float) (p_ber->x_start + x * X_PRVEK + X_PRVEK / 2); p_lev->y = (float) (p_ber->y_start + (y >> 1) * Y_PRVEK + Y_PRVEK / 2); p_lev->z = (float) (p_ber->z_start + z * Z_PRVEK + Z_PRVEK / 2); p_lev->rotace = rotace; init_matrix(&p_lev->mp); init_matrix(&p_lev->mg); if (p_lev->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_lev->mesh]; init_matrix(&p_mesh->m); key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } } else { ber_position_matrix(p_ber, p_m, x, y, z, rotace); ber_position_level(p_lev, p_m, rotace); if (p_lev->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_lev->mesh]; p_mesh->m = p_lev->mp; init_matrix(&p_lev->mg); p_mesh->p_data->kflag |= KONT_POHYB; if (p_mesh->p_data->kflag & KONT_KEYFRAME) { mat_mult(&p_mesh->world, &p_mesh->m, &tmp1); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp1); } else { key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } } } } } void ber_umisti_prvek_abs(PRVEK_LEVELU_GAME * p_lev, float x, float y, float z, int rotace) { GAME_MESH_OLD *p_mesh; GLMATRIX *p_m, tmp1; if (p_lev) { p_m = &p_lev->mp; ber_position_matrix_abs(p_ber, p_m, x, y, z, rotace); ber_position_level(p_lev, p_m, rotace); if (p_lev->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_lev->mesh]; p_mesh->m = p_lev->mp; init_matrix(&p_lev->mg); p_mesh->p_data->kflag |= KONT_POHYB; if (p_mesh->p_data->kflag & KONT_KEYFRAME) { mat_mult(&p_mesh->world, &p_mesh->m, &tmp1); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp1); } else { key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } } } } /* Nahraje materialy */ int ber_nahraj_materialy(G_KONFIG * p_ber, char *p_jmeno, char *p_dir) { char pom[200]; strcpy(pom, p_jmeno); zamen_koncovku(pom, KONCOVKA_MATERIAL); if (chdir(p_dir)) { kprintf(1, "Unable to change directory to %s", p_dir); return (FALSE); } if (!lo_nahraj_materialy(p_ber->p_mat, MAX_CELKEM_MATERIALU, p_ber->p_text, MAX_CELKEM_TEXTUR, pom)) { kprintf(1, "Unable to load materials %s", p_jmeno); return (FALSE); } else return (TRUE); } /* Rozkopiruje materialy -> pouze prvni material!!! */ void ber_materialy_rozkopiruj(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh, int restart) { EDIT_MATERIAL **p_imat = p_ber->p_mat; EDIT_MATERIAL *p_mat; char pom[MAX_JMENO]; int mat, mnew = K_CHYBA; int i; if (p_mesh->p_data->m1flag & MAT_ANIM_FRAME) { for (i = 0; i < p_mesh->objektu; i++) { mat = p_mesh->p_mat[i]; p_mat = p_imat[mat]; if (p_mat->flag & MAT_ANIM_FRAME) { int ret; if (restart) { ret = snprintf(pom, sizeof(pom), "%s_%d", p_mat->jmeno, i); assert(ret < (int) sizeof(pom)); mnew = lo_najdi_material(p_ber->p_mat, MAX_CELKEM_MATERIALU, pom); assert(mnew != K_CHYBA); p_mesh->p_mat[i] = mnew; } else { mnew = lo_najdi_prazdny_material(p_ber->p_mat, MAX_CELKEM_MATERIALU); assert(mnew != K_CHYBA); p_imat[mnew] = kopiruj_material(p_mat); p_mesh->p_mat[i] = mnew; ret = snprintf(p_imat[mnew]->jmeno, sizeof(p_imat[mnew]->jmeno), "%s_%d", p_mat->jmeno, i); assert(ret < (int) sizeof(p_imat[mnew]->jmeno)); } } } } } /* Nahraje jeden mesh */ bool ber_nahraj_mesh(G_KONFIG * p_ber, char *p_jmeno, GAME_MESH_OLD ** p_mesh, int json_export) { if (chdir(p_ber->dir.out_dir)) return (FALSE); p_mesh[0] = lo_nahraj_mesh(p_ber->p_mat, MAX_CELKEM_MATERIALU, p_ber->p_text, MAX_CELKEM_TEXTUR, p_jmeno, TRUE, p_ber->conf_extra_light_vertex, json_export); return (p_mesh[0] != NULL); } inline int najdi_volnou_texturu_mat(EDIT_MATERIAL * p_mat) { int i; for (i = 0; i < MAT_TEXTUR; i++) { if (!p_mat->textfile[i][0]) { return (i); } } return (K_CHYBA); } #define AUTO_STAGE 0 int ber_mat_vloz_dot3(EDIT_TEXT * p_text, int textnum, EDIT_MATERIAL * p_mat) { MATERIAL_TEXT_OLD state_stary; int btext, t, mat_text; // Nahradim prvni blok dot-3 a skopiruju operaci if ((t = najdi_volnou_texturu_mat(p_mat)) == K_CHYBA) return (FALSE); state_stary = p_mat->text_state[AUTO_STAGE]; if (text_stage_edit_blok[state_stary.text_stage].textur > 1) return (FALSE); p_mat->text_state[AUTO_STAGE].text_stage = AUTO_BUMP_DOT3; p_mat->text_state[AUTO_STAGE].textury[DOT3_TEXT] = mat_text = state_stary.textury[0]; p_mat->text_state[AUTO_STAGE].text_funkce[DOT3_TEXT] = state_stary.text_funkce[0]; p_mat->text_state[AUTO_STAGE].text_koord[DOT3_TEXT] = state_stary.text_koord[0]; p_mat->text_state[AUTO_STAGE].textury[DOT3_BUMP] = t; p_mat->text_state[AUTO_STAGE].text_funkce[DOT3_BUMP] = BLOK_DOT3_BUMP; p_mat->text_state[AUTO_STAGE].text_koord[DOT3_BUMP] = state_stary.text_koord[0]; // Pridam texturu stejneho jmena ale dot-3 if ((btext = lo_najdi_texturu(p_text, textnum, p_mat->textfile[mat_text], TEXT_GEN_DOT3)) == K_CHYBA) { if ((btext = lo_najdi_volnou_texturu(p_text, textnum)) == K_CHYBA) chyba("Textury"); txt_kopiruj(p_text + btext, p_mat->p_text[mat_text]); p_text[btext].flag = TEXT_GEN_DOT3; txt_to_dot3(p_text + btext, FALSE); } p_mat->textflag[t] = TEXT_GEN_DOT3; p_mat->p_text[t] = p_text + btext; strcpy(p_mat->textfile[t], p_mat->textfile[mat_text]); p_mat->flag2 |= MAT2_BUMP; return (TRUE); } #define BUMP_ENV_TEXT "bumpflare.png" int ber_mat_vloz_dot3_env(EDIT_TEXT * p_text, int textnum, EDIT_MATERIAL * p_mat) { MATERIAL_TEXT_OLD state_stary; int btext, t, mat_text; /* Nahradim prvni blok dot-3 a skopiruju operaci */ state_stary = p_mat->text_state[AUTO_STAGE]; if (text_stage_edit_blok[state_stary.text_stage].textur > 1) return (FALSE); p_mat->text_state[AUTO_STAGE].text_stage = AUTO_BUMP_DOT3ENV; p_mat->text_state[AUTO_STAGE].textury[DOT3_TEXT] = mat_text = state_stary.textury[0]; p_mat->text_state[AUTO_STAGE].text_funkce[DOT3_TEXT] = state_stary.text_funkce[0]; p_mat->text_state[AUTO_STAGE].text_koord[DOT3_TEXT] = state_stary.text_koord[0]; // Pridam bump-mapu if ((t = najdi_volnou_texturu_mat(p_mat)) == K_CHYBA) { p_mat->text_state[AUTO_STAGE] = state_stary; return (FALSE); } p_mat->text_state[AUTO_STAGE].textury[DOT3_BUMP] = t; p_mat->text_state[AUTO_STAGE].text_funkce[DOT3_BUMP] = BLOK_DOT3_BUMP; p_mat->text_state[AUTO_STAGE].text_koord[DOT3_BUMP] = state_stary.text_koord[0]; // Pridam texturu stejneho jmena ale dot-3 if ((btext = lo_najdi_texturu(p_text, textnum, p_mat->textfile[mat_text], TEXT_GEN_DOT3)) == K_CHYBA) { if ((btext = lo_najdi_volnou_texturu(p_text, textnum)) == K_CHYBA) chyba("Textury"); txt_kopiruj(p_text + btext, p_mat->p_text[mat_text]); p_text[btext].flag = TEXT_GEN_DOT3; txt_to_dot3(p_text + btext, FALSE); } p_mat->textflag[t] = TEXT_GEN_DOT3; p_mat->p_text[t] = p_text + btext; strcpy(p_mat->textfile[t], p_mat->textfile[mat_text]); // Pridam env mapu if ((t = najdi_volnou_texturu_mat(p_mat)) == K_CHYBA) { p_mat->text_state[AUTO_STAGE] = state_stary; return (FALSE); } p_mat->text_state[AUTO_STAGE].textury[DOT3_ENV] = t; p_mat->text_state[AUTO_STAGE].text_funkce[DOT3_ENV] = BLOK_MODULACE; p_mat->text_state[AUTO_STAGE].text_koord[DOT3_ENV] = state_stary.text_koord[0]; if ((btext = lo_najdi_texturu(p_text, textnum, BUMP_ENV_TEXT, FALSE)) == K_CHYBA) { if ((btext = lo_najdi_volnou_texturu(p_text, textnum)) == K_CHYBA) chyba("Textury"); strcpy(p_text[btext].jmeno, BUMP_ENV_TEXT); p_text[btext].flag = FALSE; } p_mat->textflag[t] = FALSE; p_mat->p_text[t] = p_text + btext; p_mat->flag2 |= glstav_texgen_on[t]; strcpy(p_mat->textfile[t], BUMP_ENV_TEXT); p_mat->flag2 |= MAT2_BUMP; return (TRUE); } // SMAT je bez bump-mappingu!!! int ber_uprava_materialu_bump_mapping(G_KONFIG * p_ber) { return (TRUE); } void ber_load_pridej_smat(G_KONFIG * p_ber, int reload) { int m; if (p_ber->conf_caustic && !reload && glstav_multitext_units > 2) { p_ber->p_smat = NULL; for (m = 0; m < MAX_CELKEM_MATERIALU; m++) { if (p_ber->p_mat[m] && p_ber->p_mat[m]->flag & MAT_SCENE) { p_ber->p_smat = p_ber->p_mat[m]; amat_pridej_material(p_ber, p_ber->p_smat); p_ber->p_smat->flag &= ~MAT_SCENE_NUTNY; kprintf(TRUE, " - Scene-Material %s", p_ber->p_smat->jmeno); return; } } kprintf(TRUE, " - Scene-Material neni"); } } int ber_nahraj_kurzor(G_KONFIG * p_ber) { int l; l = lo_najdi_volny_mesh(p_ber->p_mesh, MAX_BERUSKY_KONTEJNERU); if (l == K_CHYBA) return (FALSE); if (ber_nahraj_mesh(p_ber, JMENO_KURZOR, p_ber->p_mesh + l)) { if (l >= p_ber->meshnum) p_ber->meshnum = l + 1; p_ber->p_mesh[l]->p_data->k2flag |= KONT2_BERUSKA; return (TRUE); } else { return (FALSE); } } /* Zluta Hneda Cervena Modra Zelena */ static char ber_list[][50] = { "beruska_zluta_game.b2m", "beruska_hneda_game.b2m", "beruska_cervena_game.b2m", "beruska_modra_game.b2m", "beruska_zelena_game.b2m" }; int ber_je_mesh_beruska(int kont, BUNKA_LEVELU_DISK * p_berusky, int bernum, char *p_jmeno) { int i, br; for (i = 0; i < bernum; i++, p_berusky++) { if (p_berusky->mesh == kont) { br = p_berusky->guid % 10; strcpy(p_jmeno, ber_list[br]); return (TRUE); } } return (FALSE); } /* Nahraje scenu */ int ber_nahraj_scenu(G_KONFIG * p_ber, char *p_jmeno, char *p_dir, int reload, BUNKA_LEVELU_DISK * p_berusky, int bernum) { EDIT_KONTEJNER *p_kont[MAX_BERUSKY_KONTEJNERU]; NASTAVENI_KAMER kam; LENS_FLARE flare[MAX_FLARE_SVETEL]; LEVEL_KONFIG lc; char file[200], tmp[200]; dword ambient; int k, f, kflag, m, ret; memset(p_kont, 0, sizeof(p_kont[0]) * MAX_BERUSKY_KONTEJNERU); memset((void *) flare, 0, sizeof(flare[0]) * MAX_FLARE_SVETEL); strcpy(file, p_jmeno); zamen_koncovku(file, KONCOVKA_SCENY); if (chdir(p_dir)) return (FALSE); kprintf(1, " - Load project...."); if (lo_nahraj_projekt(p_ber->p_mat, MAX_CELKEM_MATERIALU, p_kont, MAX_BERUSKY_KONTEJNERU, p_ber->p_text, MAX_CELKEM_TEXTUR, file, p_ber->p_slight, MAX_FLARE_SVETEL, &p_ber->zrc, &p_ber->zrc_akt, flare, MAX_FLARE_SVETEL, &ambient, &p_ber->p_mlha, p_ber->p_dlight, MAX_FLARE_SVETEL, p_ber->p_edlight, MAX_FLARE_SVETEL, &p_ber->env, &kam, &lc, LOAD_ALL, FALSE)) { p_ber->conf_barva_pozadi = lc.barva_pozadi; p_ber->conf_barva_pozadi_pouzit = p_ber->conf_barva_pozadi_pouzit_default ? TRUE : lc.barva_pozadi_aktivni; p_ber->zm = lc.zm; p_ber->kam.min = kam.min; p_ber->kam.max = kam.max; p_ber->kam.max_uhel = MAX_UHEL_KAMERY; p_ber->kam.min_uhel = MIN_UHEL_KAMERY; p_ber->kam.max_vzdal = MAX_VZDAL_KAMERY; p_ber->kam.min_vzdal = MIN_VZDAL_KAMERY; // Nahodim scene-material ber_load_pridej_smat(p_ber, reload); p_ber->dl_lightnum = lo_najdi_prepocitej_dsvetlo(p_ber->p_dlight, MAX_FLARE_SVETEL); p_ber->edl_lightnum = lo_najdi_prepocitej_extra_svetlo(p_ber->p_edlight, MAX_FLARE_SVETEL); rgb_float(ambient, p_ber->dl_ambient); f = lo_najdi_volny_flare(flare, MAX_FLARE_SVETEL); if (f) { p_ber->p_flare = lo_flare2linear(flare, f); } p_ber->slightnum = lo_posledni_svetlo(p_ber->p_slight, MAX_FLARE_SVETEL); // Smazu materialy mazanych objektu for (k = 0; k < MAX_BERUSKY_KONTEJNERU; k++) { if (p_kont[k]) { if (ber_je_mesh_beruska(k, p_berusky, bernum, tmp)) { lo_zrus_material_kont(p_kont[k], p_ber->p_mat, MAX_CELKEM_MATERIALU); } } } if(export_level) { json_export_light(p_ber->p_slight, MAX_FLARE_SVETEL); } // prekopiruje kontejnery-meshe 1:1 for (k = 0, m = 0; k < MAX_BERUSKY_KONTEJNERU; k++) { if (p_kont[k]) { if(export_level) { json_export_kont_single(p_kont[k], p_ber->p_mat, MAX_CELKEM_MATERIALU); } if (ber_je_mesh_beruska(k, p_berusky, bernum, tmp)) { ret = ber_nahraj_mesh(p_ber, tmp, p_ber->p_mesh + m, export_level); assert(ret); zrus_kontejner_rec(p_kont + k, NULL); p_ber->p_mesh[m]->p_data->kflag |= KONT_PRVEK; p_ber->p_mesh[m]->p_data->k2flag |= KONT2_BERUSKA; } else { p_ber->p_mesh[m] = lo_kontejner_to_mesh(p_kont + k, p_ber->p_mat, MAX_CELKEM_MATERIALU, p_ber->conf_extra_light_vertex); } if (!p_ber->p_mesh[m]) continue; // Kvuli animacim rozkopiruj materialy ber_materialy_rozkopiruj(p_ber, p_ber->p_mesh[m], reload); // Pridam do animacniho listu materialu amat_pridej_mesh(p_ber, m); kflag = p_ber->p_mesh[m]->p_data->kflag; // roztridit to na prvky/ne prvky if (!(kflag & (KONT_PRVEK | KONT_KEYFRAME))) { p_ber->p_mesh[m]->m = p_ber->p_mesh[m]->world; } // Kontejner je zrcadlo - zkusim ho najit if (p_ber->zrc_akt && kflag & KONT_ZRCADLO) { ZDRCADLO_DESC_POLY *p_poly = p_ber->zrc.p_poly; while (p_poly) { if (p_ber->p_mesh[m]->p_data->mesh_ID == p_poly->id_kont) { p_poly->zrcadlo_k = m; p_poly->poly = K_CHYBA; break; } p_poly = p_poly->p_next; } if (!p_poly) p_ber->p_mesh[m]->p_data->kflag &= ~KONT_ZRCADLO; } m++; } } p_ber->meshnum = m + 1; if(export_level) { json_export_materialy(p_ber->p_mat, MAX_CELKEM_MATERIALU); } p_ber->conf_kurzor_mesh = ber_nahraj_kurzor(p_ber); p_ber->dl_lightnum = lo_najdi_prepocitej_dsvetlo(p_ber->p_dlight, MAX_FLARE_SVETEL); return (TRUE); } else { return (FALSE); } } /* ber_load_poly */ void ber_nahraj_poly(G_KONFIG * p_ber, char *p_jmeno, char *p_dir) { MLZNA_KOSTKA *p_tmp; char file[200]; int i; if (chdir(p_dir)) return; strcpy(file, p_jmeno); zamen_koncovku(file, ".ply"); // Load poly p_ber->p_poly = lo_nahraj_poly_list(file, &p_ber->polynum, p_ber->p_lightmap, p_ber->p_mat, MAX_CELKEM_MATERIALU); for (i = 0; i < p_ber->polynum; i++) { poly_pridej_vertex_array(p_ber->p_poly + i); amat_pridej_poly(p_ber, i); lo_poly_flaguj_materialy(p_ber->p_poly + i, p_ber->p_mat); } /* Flagovani zrcadla */ { ZDRCADLO_DESC_POLY *p_poly = p_ber->zrc.p_poly; while (p_poly) { if (p_poly->poly != K_CHYBA) { p_ber->p_poly[p_poly->poly].kflag |= KONT_ZRCADLO; } p_poly = p_poly->p_next; } } /* Prismazeni mlho-kostek */ if (p_ber->polynum) { p_tmp = p_ber->p_mlha; while (p_tmp) { if (p_tmp->poly != K_CHYBA) { p_ber->p_poly[p_tmp->poly].p_mlha = p_tmp; p_tmp->p_kont = p_ber->p_poly + p_tmp->poly; } p_tmp = p_tmp->p_next; } } } /* nahraje lightmapy */ void ber_nahraj_lightmap(G_KONFIG * p_ber, char *p_jmeno, char *p_dir) { TXT_KONFIG zal; char pom[200]; KFILE *f; int i, r, loaded; int ret; if (chdir(p_dir)) return; strcpy(pom, p_jmeno); zamen_koncovku(pom, KONCOVKA_LIGHTMAPY); zal = txconf; txconf.text_trida = TEXT_LIGHT; txconf.text_mip_mapping = FALSE; txconf.text_filtr = FALSE; loaded = 0; if ((f = kopen(NULL, pom, "rb"))) { while (!keof(f)) { if (kread(&i, sizeof(i), 1, f)) { assert(i >= 0 && i < MAX_RAY_TEXTUR); ret = snprintf(p_ber->p_lightmap[i].jmeno, sizeof(p_ber->p_lightmap[i].jmeno), "%s_lp%.3d.png", pom, i); assert(ret < (int) sizeof(p_ber->p_lightmap[i].jmeno)); kprintf(TRUE, "Lightmap %s...", p_ber->p_lightmap[i].jmeno); r = txt_nahraj_lightmapu_z_bmp(NULL, f, p_ber->p_lightmap + i, TRUE); assert(r); loaded++; } } kclose(f); } else { // stara verze lightmap for (i = 0; i < MAX_RAY_TEXTUR; i++) { ret = snprintf(p_ber->p_lightmap[i].jmeno, sizeof(p_ber->p_lightmap[i].jmeno), "%s\\%s_lp%.3d.png", p_dir, pom, i); assert(ret < (int) sizeof(p_ber->p_lightmap[i].jmeno)); if (efile(p_ber->p_lightmap[i].jmeno)) { kprintf(TRUE, "Lightmap %s...", p_ber->p_lightmap[i].jmeno); txt_nahraj_lightmapu_z_bmp(p_ber->p_lightmap[i].jmeno, NULL, p_ber->p_lightmap + i, TRUE); loaded++; } } } kprintf(TRUE, "Loaded %d lightmaps.", loaded); txconf = zal; if(export_level) { json_export_poly(p_ber->p_poly, p_ber->polynum, p_ber->p_mat, MAX_CELKEM_MATERIALU, p_ber->p_lightmap); } /* Prepocitej lightmapy */ for (i = 0; i < p_ber->polynum; i++) { lo_poly_calc_lightmap_face(p_ber->p_poly + i); } /* Zrus prebytecne bitmapy */ for (i = 0; i < MAX_RAY_TEXTUR; i++) { if (p_ber->p_lightmap[i].p_bmp) { if(export_level) { json_export_lightmap(i, p_ber->p_lightmap[i].p_bmp); } bmp_zrus(&p_ber->p_lightmap[i].p_bmp); } } } inline void bod_min_max(BOD * p_ref, BOD * p_min, BOD * p_max) { if (p_ref->x < p_min->x) p_min->x = p_ref->x; if (p_ref->y < p_min->y) p_min->y = p_ref->y; if (p_ref->z < p_min->z) p_min->z = p_ref->z; if (p_ref->x > p_max->x) p_max->x = p_ref->x; if (p_ref->y > p_max->y) p_max->y = p_ref->y; if (p_ref->z > p_max->z) p_max->z = p_ref->z; } void ber_velikost_sceny(G_KONFIG * p_ber) { GAME_MESH_OLD *p_mesh; BOD min, max; int i; float vzdal; min.x = min.y = min.z = FLT_MAX; max.x = max.y = max.z = -FLT_MAX; // Spocitam obalky vsech meshu for (i = 0; i < p_ber->meshnum; i++) { p_mesh = p_ber->p_mesh[i]; if (p_mesh) { bod_min_max(&p_mesh->obb_world.aabb_min, &min, &max); bod_min_max(&p_mesh->obb_world.aabb_max, &min, &max); } } for (i = 0; i < p_ber->polynum; i++) { bod_min_max(&p_ber->p_poly[i].obb.aabb_min, &min, &max); bod_min_max(&p_ber->p_poly[i].obb.aabb_max, &min, &max); } vzdal = vzdal_bodu_bod(&min, &max) * 1.3f; if (vzdal > p_ber->kam.far_plane) p_ber->kam.far_plane = vzdal; kprintf(TRUE, "Z-Buffer range %.3f", p_ber->kam.far_plane); } GAME_MESH_OLD **ber_mesh_vyber_staticke(G_KONFIG * p_ber, int *p_snum, int **p_indexy) { GAME_MESH_OLD **p_list = p_ber->p_mesh; int listnum = p_ber->meshnum; GAME_MESH_OLD **p_stat; int i, snum; int *p_ind; snum = 0; for (i = 0; i < listnum; i++) { if (p_list[i] && p_list[i]->p_data->kflag & KONT_STATIC) snum++; } if (!snum) { *p_snum = 0; *p_indexy = NULL; return (NULL); } p_stat = (GAME_MESH_OLD **) mmalloc(sizeof(p_stat[0]) * snum); p_ind = (int *) mmalloc(sizeof(p_ind[0]) * snum); snum = 0; for (i = 0; i < listnum; i++) { if (p_list[i] && p_list[i]->p_data->kflag & KONT_STATIC) { p_stat[snum] = p_list[i]; p_ind[snum] = i; snum++; } } *p_snum = snum; *p_indexy = p_ind; return (p_stat); } berusky2-0.12/src/komat/Mat3d.cpp0000644000175000017500000016706613674426075013537 00000000000000/* Engine - samotna parba */ #include "3d_all.h" GLMATRIX __kont_world_matrix; void transformuj_kontejner_matici(EDIT_KONTEJNER * p_kont, GLMATRIX * p_m) { OBJ_VERTEX *p_vert; BOD *p_kost; int i, j; int pocet; if (p_kont == NULL) return; for (j = 0; j < p_kont->max_objektu; j++) { if (!p_kont->p_obj[j]) continue; p_vert = p_kont->p_obj[j]->p_vertex; pocet = p_kont->p_obj[j]->vertexnum; for (i = 0; i < pocet; i++) { transformuj_bod_matici(&p_vert[i].x, &p_vert[i].y, &p_vert[i].z, p_m); } p_kost = p_kont->p_obj[j]->p_vertex_kosti; if (p_kost) { for (i = 0; i < pocet; i++) { transformuj_bod_matici(&p_kost[i].x, &p_kost[i].y, &p_kost[i].z, p_m); } } } } // Vymaze key-frame!!! void transformuj_kontejner_keyframe(EDIT_KONTEJNER * p_kont) { EDIT_OBJEKT *p_obj; int i, o; if (p_kont->kflag & KONT_KEYFRAME) { oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { transformuj_objekt_matici(p_obj, &p_obj->m); init_matrix(&p_obj->m); } init_matrix(&p_kont->world); init_matrix(&p_kont->mpmatrix); p_kont->kflag &= ~KONT_KEYFRAME; for (i = 0; i < KONT_MAX_ANIM; i++) { key_sim_root_zrus(p_kont->sim + i); } } } void transformuj_kontejner(EDIT_KONTEJNER * p_kont) { if (!(p_kont->kflag & KONT_KEYFRAME)) { lo_transformuj_svetla_do_wordspace(p_kont); transformuj_kontejner_matici(p_kont, kont_world_matrix(p_kont)); init_matrix(&p_kont->world); init_matrix(&p_kont->mpmatrix); } } void transformuj_mesh(GAME_MESH_OLD * p_mesh) { dword i; if (!(p_mesh->p_data->kflag & KONT_KEYFRAME)) { for (i = 0; i < p_mesh->vertexnum; i++) { transformuj_bod_bod_matici(p_mesh->p_vertex_pos + i, &p_mesh->m); } init_matrix(&p_mesh->m); } } void calc_norm_vec_inter_object(EDIT_OBJEKT * p_obj) { int j, i, v, v1, k; float p_x, p_y, p_z, p; ROVINA r; byte *p_hv = (byte *) mmalloc(p_obj->vertexnum); word *p_nasle = (word *) mmalloc(p_obj->vertexnum * sizeof(word)); word naslych = 0; for (v = 0; v < p_obj->vertexnum; v++) { if (p_hv[v]) // pokud byl pouzit -> preskoc ho continue; else p_hv[v] = 1; p_nasle[0] = v; naslych = 1; for (v1 = 0; v1 < p_obj->vertexnum; v1++) { if (v == v1) continue; if (stejny_vertex(p_obj->p_vertex[v], p_obj->p_vertex[v1])) { p_nasle[naslych++] = v1; p_hv[v1] = 1; } } // mam seznam vsech stejnych vertexu -> najdu k nim facy p_x = p_y = p_z = p = 0; for (k = 0; k < naslych; k++) { j = p_nasle[k]; for (i = 0; i < p_obj->facenum; i += 3) { if ((p_obj->p_face[i] == j) || (p_obj->p_face[i + 1] == j) || (p_obj->p_face[i + 2] == j)) { // spocitat rovinu calc_rovinu(p_obj->p_vertex + p_obj->p_face[i], p_obj->p_vertex + p_obj->p_face[i + 1], p_obj->p_vertex + p_obj->p_face[i + 2], &r); p_x += r.x; p_y += r.y; p_z += r.z; p++; } } } p_x /= p; p_y /= p; p_z /= p; norm_vect(&p_x, &p_y, &p_z); if (p) { for (k = 0; k < naslych; k++) { j = p_nasle[k]; p_obj->p_vertex[j].nx = p_x; p_obj->p_vertex[j].ny = p_y; p_obj->p_vertex[j].nz = p_z; } } } free(p_hv); free(p_nasle); } void texturuj_zemi(EDIT_OBJEKT * p_obj, int rect_x, int rect_y, int c_text, int flag, int mat, float skok_u, float skok_v) { float *p_fl; int x, y, i; rect_x++; rect_y++; p_obj->material = mat; if (flag & T_MIRROR) { for (y = 0; y < rect_y - 1; y += 2) { for (x = 0; x < rect_x - 1; x += 2) { // spodni rada i = x + y * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 0.0f; //text x p_fl[1 + c_text * 2] = 0.0f; //text y i = x + 1 + y * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 1.0f; p_fl[1 + c_text * 2] = 0.0f; i = x + 2 + y * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 0.0f; p_fl[1 + c_text * 2] = 0.0f; // stredni rada i = x + (y + 1) * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 0.0f; p_fl[1 + c_text * 2] = 1.0f; i = x + 1 + (y + 1) * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 1.0f; p_fl[1 + c_text * 2] = 1.0f; i = x + 2 + (y + 1) * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 0.0f; p_fl[1 + c_text * 2] = 1.0f; // horni rada i = x + (y + 2) * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 0.0f; p_fl[1 + c_text * 2] = 0.0f; i = x + 1 + (y + 2) * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 1.0f; p_fl[1 + c_text * 2] = 0.0f; i = x + 2 + (y + 2) * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = 0.0f; p_fl[1 + c_text * 2] = 0.0f; } } } if (flag & T_WRAP) { for (y = 0; y < rect_y; y++) { for (x = 0; x < rect_x; x++) { i = x + y * rect_x; p_fl = &p_obj->p_vertex[i].tu1; p_fl[0 + c_text * 2] = ((float) x) * skok_u; //text x p_fl[1 + c_text * 2] = ((float) y) * skok_v; //text y } } } } EDIT_OBJEKT *vyrob_zemi(int rect_x, int rect_y, float skok) { return (vyrob_zemi_start(rect_x, rect_y, skok, 0.0f, 0.0f)); } EDIT_OBJEKT *vyrob_zemi_start(int rect_x, int rect_y, float skok, float start_x, float start_y) { int num_x = rect_x + 1; int num_y = rect_y + 1; int vertexnum = num_x * num_y; int facenum = rect_x * rect_y * 2 * 3; EDIT_OBJEKT *p_obj = vyrob_objekt(); int i, x, y; p_obj->vertexnum = vertexnum; if ((p_obj->p_vertex = (OBJ_VERTEX *) mmalloc(sizeof(p_obj->p_vertex[0]) * p_obj->vertexnum)) == NULL) { zrus_objekt(&p_obj); return (NULL); } p_obj->facenum = facenum; if ((p_obj->p_face = (word *) mmalloc(sizeof(p_obj->p_face[0]) * p_obj->facenum)) == NULL) { zrus_objekt(&p_obj); return (NULL); } for (y = 0, i = 0; y < num_y; y++) { for (x = 0; x < num_x; x++) { p_obj->p_vertex[i].x = ((float) x) * skok; p_obj->p_vertex[i].z = ((float) y) * skok; p_obj->p_vertex[i].y = 0.0f; p_obj->p_vertex[i].db = p_obj->p_vertex[i].dg = p_obj->p_vertex[i].dr = 1.0f; i++; } } for (y = 0, i = 0; y < rect_y; y++) { for (x = 0; x < rect_x; x++) { p_obj->p_face[i++] = x + y * num_x; p_obj->p_face[i++] = x + 1 + y * num_x; p_obj->p_face[i++] = x + 1 + (y + 1) * num_x; p_obj->p_face[i++] = x + (y + 1) * num_x; p_obj->p_face[i++] = x + y * num_x; p_obj->p_face[i++] = x + 1 + (y + 1) * num_x; } } return (p_obj); } void rozloz_zemi(EDIT_OBJEKT ** p_src, int ctvercu) { EDIT_OBJEKT *p_obj = *p_src; float skok; if (!p_obj->x_rect || !p_obj->y_rect) return; if (p_obj->x_rect != 1 || p_obj->y_rect != 1) return; skok = p_obj->p_vertex[1].x - p_obj->p_vertex[0].x; skok /= (float) ctvercu; p_obj = vyrob_zemi_start(ctvercu, ctvercu, skok, p_obj->p_vertex[0].x, p_obj->p_vertex[0].z); zrus_objekt(p_src); *p_src = p_obj; } /* mirror == 1 - v ose x == 2 - v ose y == 3 - v ose z */ EDIT_OBJEKT *mirror_objekt(EDIT_OBJEKT * p_src, int st, int mx, int my, int mz) { EDIT_OBJEKT *p_dest = vyrob_objekt(); int i; float stred = 0; *p_dest = *p_src; /* Skopiruju vertexy */ if ((p_dest->p_vertex = (OBJ_VERTEX *) mmalloc(sizeof(OBJ_VERTEX) * p_dest->vertexnum)) == NULL) { zrus_objekt(&p_dest); return (NULL); } memcpy(p_dest->p_vertex, p_src->p_vertex, sizeof(OBJ_VERTEX) * p_dest->vertexnum); if (st) { if (mx) { for (i = 0; i < p_dest->vertexnum; i++) stred += p_src->p_vertex[i].x; stred /= (float) p_dest->vertexnum; for (i = 0; i < p_dest->vertexnum; i++) p_dest->p_vertex[i].x = (stred - p_src->p_vertex[i].x); } if (my) { for (i = 0; i < p_dest->vertexnum; i++) stred += p_src->p_vertex[i].y; stred /= (float) p_dest->vertexnum; for (i = 0; i < p_dest->vertexnum; i++) p_dest->p_vertex[i].y = (stred - p_src->p_vertex[i].y); } if (mz) { for (i = 0; i < p_dest->vertexnum; i++) stred += p_src->p_vertex[i].z; stred /= (float) p_dest->vertexnum; for (i = 0; i < p_dest->vertexnum; i++) p_dest->p_vertex[i].z = (stred - p_src->p_vertex[i].z); } } else { for (i = 0; i < p_dest->vertexnum; i++) { if (mx) p_dest->p_vertex[i].x = -p_src->p_vertex[i].x; if (my) p_dest->p_vertex[i].y = -p_src->p_vertex[i].y; if (mz) p_dest->p_vertex[i].z = -p_src->p_vertex[i].z; } } /* Skopiruju facy */ if ((p_dest->p_face = (FACE *) mmalloc(sizeof(FACE) * p_dest->facenum)) == NULL) { zrus_objekt(&p_dest); return (NULL); } memcpy(p_dest->p_face, p_src->p_face, sizeof(FACE) * p_dest->facenum); p_dest->p_line = NULL; return (p_dest); } /* mirror == 1 - v ose u == 2 - v ose v */ void mirror_text(EDIT_OBJEKT * p_src, int t, int mu, int mv) { int i; float *p_fl; if (!mu && !mv) return; for (i = 0; i < p_src->vertexnum; i++) { p_fl = &p_src->p_vertex[i].tu1; if (mu) p_fl[0 + t * 2] = -p_fl[0 + t * 2]; if (mv) p_fl[1 + t * 2] = -p_fl[1 + t * 2]; } } /* rotace == 1 - 90 == 2 - 180 == 3 - 270 */ void rotuj_text(EDIT_OBJEKT * p_obj, int t, int uhel) { OBJ_VERTEX *p_vertex; int x, y, x_num = p_obj->x_rect + 1, y_num = p_obj->y_rect + 1; float *p_fls, *p_fld; if (!p_obj->x_rect || !p_obj->y_rect || !uhel || (p_obj->x_rect != p_obj->y_rect)) { return; } if ((p_vertex = (OBJ_VERTEX *) mmalloc(sizeof(OBJ_VERTEX) * p_obj->vertexnum)) == NULL) { return; } memcpy(p_vertex, p_obj->p_vertex, sizeof(OBJ_VERTEX) * p_obj->vertexnum); if (uhel == 1) { // 90 for (y = 0; y < x_num; y++) { for (x = 0; x < y_num; x++) { p_fld = &p_obj->p_vertex[(y_num - x - 1) * x_num + y].tu1; p_fls = &p_vertex[y * x_num + x].tu1; p_fld[0 + t * 2] = p_fls[0 + t * 2]; p_fld[1 + t * 2] = p_fls[1 + t * 2]; } } } else if (uhel == 2) { // 180 for (y = 0; y < x_num; y++) { for (x = 0; x < y_num; x++) { p_fld = &p_obj->p_vertex[(y_num - y - 1) * x_num + (x_num - x - 1)].tu1; p_fls = &p_vertex[y * x_num + x].tu1; p_fld[0 + t * 2] = p_fls[0 + t * 2]; p_fld[1 + t * 2] = p_fls[1 + t * 2]; } } } else if (uhel == 3) { // 270 for (y = 0; y < x_num; y++) { for (x = 0; x < y_num; x++) { p_fld = &p_obj->p_vertex[x * x_num + (y_num - y - 1)].tu1; p_fls = &p_vertex[y * x_num + x].tu1; p_fld[0 + t * 2] = p_fls[0 + t * 2]; p_fld[1 + t * 2] = p_fls[1 + t * 2]; } } } free(p_vertex); } void dopln_cary(EDIT_OBJEKT * p_obj) { word j, k, mf; word *p_line, *p_face; mf = p_obj->facenum; if (p_obj->p_line != NULL) { free(p_obj->p_line); p_obj->p_line = NULL; } if ((p_line = (word *) mmalloc(sizeof(word) * mf * 2)) == NULL) chyba("pamet"); p_face = p_obj->p_face; for (j = 0, k = 0; j < p_obj->facenum; j += 3, k += 6) { p_line[k + 5] = p_line[k] = p_face[j]; p_line[k + 2] = p_line[k + 1] = p_face[j + 1]; p_line[k + 4] = p_line[k + 3] = p_face[j + 2]; } p_obj->p_line = p_line; p_obj->linenum = mf * 2; } void kresli_ctverec_2d(int x1, int y1, int x2, int y2, float r, float g, float b) { glColor3f(r, g, b); glBegin(GL_LINE_STRIP); glVertex2d(x1, y1); glVertex2d(x2, y1); glVertex2d(x2, y2); glVertex2d(x1, y2); glVertex2d(x1, y1); glEnd(); } void kresli_ctverec_2d_diff(int x1, int y1, int dx, int dy, float r, float g, float b) { kresli_ctverec_2d(x1 - dx, y1 - dy, x1 + dx, y1 + dy, r, g, b); } void kresli_ctverec_2d_plnej(int x1, int y1, int x2, int y2, float r, float g, float b) { glColor3f(r, g, b); glBegin(GL_QUADS); glVertex2d(x1, y1); glVertex2d(x1, y2); glVertex2d(x2, y2); glVertex2d(x2, y1); glEnd(); } void kresli_caru(BOD * p_s, BOD * p_k, dword barva) { glColor4ubv((byte *) & barva); glBegin(GL_LINES); glVertex3f(p_s->x, p_s->y, p_s->z); glVertex3f(p_k->x, p_k->y, p_k->z); glEnd(); } void kresli_kurzor_mysi_kriz(int xres, int yres) { glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_LINES); glVertex2i(mi.x, 0); glVertex2i(mi.x, yres); glVertex2i(0, mi.y); glVertex2i(xres, mi.y); glEnd(); } /* Stredovy bod + dx,dy,dz */ EDIT_OBJEKT *vyrob_krychli(BOD * p_bod, float x, float y, float z, dword barva) { EDIT_OBJEKT *p_obj = vyrob_objekt_komplet(8, 12 * 3); int i; x /= 2; y /= 2; z /= 2; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = -z; p_obj->p_vertex[2].x = x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = -z; p_obj->p_vertex[3].x = -x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = -z; p_obj->p_vertex[4].x = -x; p_obj->p_vertex[4].y = -y; p_obj->p_vertex[4].z = z; p_obj->p_vertex[5].x = x; p_obj->p_vertex[5].y = -y; p_obj->p_vertex[5].z = z; p_obj->p_vertex[6].x = x; p_obj->p_vertex[6].y = y; p_obj->p_vertex[6].z = z; p_obj->p_vertex[7].x = -x; p_obj->p_vertex[7].y = y; p_obj->p_vertex[7].z = z; for (i = 0; i < 8; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; rgb_float(barva, &p_obj->p_vertex[i].dr); } // predni strana p_obj->p_face[0] = 0; p_obj->p_face[1] = 1; p_obj->p_face[2] = 2; p_obj->p_face[3] = 2; p_obj->p_face[4] = 3; p_obj->p_face[5] = 0; //zadni strana p_obj->p_face[6] = 5; p_obj->p_face[7] = 6; p_obj->p_face[8] = 7; p_obj->p_face[9] = 7; p_obj->p_face[10] = 4; p_obj->p_face[11] = 5; // bok pravej p_obj->p_face[12] = 1; p_obj->p_face[13] = 5; p_obj->p_face[14] = 6; p_obj->p_face[15] = 6; p_obj->p_face[16] = 2; p_obj->p_face[17] = 1; // bok levej p_obj->p_face[18] = 4; p_obj->p_face[19] = 0; p_obj->p_face[20] = 3; p_obj->p_face[21] = 3; p_obj->p_face[22] = 7; p_obj->p_face[23] = 4; // vrsek p_obj->p_face[24] = 3; p_obj->p_face[25] = 2; p_obj->p_face[26] = 6; p_obj->p_face[27] = 6; p_obj->p_face[28] = 7; p_obj->p_face[29] = 3; // spodek p_obj->p_face[30] = 4; p_obj->p_face[31] = 0; p_obj->p_face[32] = 1; p_obj->p_face[33] = 1; p_obj->p_face[34] = 5; p_obj->p_face[35] = 4; return (p_obj); } EDIT_OBJEKT *vyrob_krychli_dratovou(BOD * p_bod, float x, float y, float z, dword barva) { EDIT_OBJEKT *p_obj = vyrob_objekt_komplet(8, 1); int i, mf; x /= 2; y /= 2; z /= 2; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = -z; p_obj->p_vertex[2].x = x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = -z; p_obj->p_vertex[3].x = -x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = -z; p_obj->p_vertex[4].x = -x; p_obj->p_vertex[4].y = -y; p_obj->p_vertex[4].z = z; p_obj->p_vertex[5].x = x; p_obj->p_vertex[5].y = -y; p_obj->p_vertex[5].z = z; p_obj->p_vertex[6].x = x; p_obj->p_vertex[6].y = y; p_obj->p_vertex[6].z = z; p_obj->p_vertex[7].x = -x; p_obj->p_vertex[7].y = y; p_obj->p_vertex[7].z = z; for (i = 0; i < 8; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_obj->linenum = mf = 12 * 2; if ((p_obj->p_line = (word *) mmalloc(sizeof(word) * mf * 2)) == NULL) chyba("pamet"); p_obj->p_line[0] = 0; p_obj->p_line[1] = 1; p_obj->p_line[2] = 1; p_obj->p_line[3] = 2; p_obj->p_line[4] = 2; p_obj->p_line[5] = 3; p_obj->p_line[6] = 3; p_obj->p_line[7] = 0; p_obj->p_line[8] = 4; p_obj->p_line[9] = 5; p_obj->p_line[10] = 5; p_obj->p_line[11] = 6; p_obj->p_line[12] = 6; p_obj->p_line[13] = 7; p_obj->p_line[14] = 7; p_obj->p_line[15] = 4; p_obj->p_line[16] = 0; p_obj->p_line[17] = 4; p_obj->p_line[18] = 1; p_obj->p_line[19] = 5; p_obj->p_line[20] = 2; p_obj->p_line[21] = 6; p_obj->p_line[22] = 3; p_obj->p_line[23] = 7; nastav_barvu_bodu_obj_dword(p_obj, barva); return (p_obj); } void krychli_dratovou_recalc(EDIT_OBJEKT * p_obj, BOD * p_bod, float x, float y, float z, dword barva) { int i; x /= 2; y /= 2; z /= 2; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = -z; p_obj->p_vertex[2].x = x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = -z; p_obj->p_vertex[3].x = -x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = -z; p_obj->p_vertex[4].x = -x; p_obj->p_vertex[4].y = -y; p_obj->p_vertex[4].z = z; p_obj->p_vertex[5].x = x; p_obj->p_vertex[5].y = -y; p_obj->p_vertex[5].z = z; p_obj->p_vertex[6].x = x; p_obj->p_vertex[6].y = y; p_obj->p_vertex[6].z = z; p_obj->p_vertex[7].x = -x; p_obj->p_vertex[7].y = y; p_obj->p_vertex[7].z = z; for (i = 0; i < 8; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } nastav_barvu_bodu_obj_dword(p_obj, barva); } EDIT_OBJEKT *umisti_krychli_dratovou(EDIT_OBJEKT * p_obj, BOD * p_bod) { int i; for (i = 0; i < p_obj->vertexnum; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } return (p_obj); } EDIT_OBJEKT *kameru_dratovou_calc(EDIT_OBJEKT * p_obj, BOD * p_p, BOD * p_t, float fov, float roll, dword barva) { BOD p; float z = vektor_velikost(vektor_sub(p_p, p_t, &p)); float s = (float) tan(fov) * z / 2; p_obj->p_vertex[0].x = 0.0f; p_obj->p_vertex[0].y = 0.0f; p_obj->p_vertex[0].z = 0.0f; rgb_float(barva, &p_obj->p_vertex[0].dr); p_obj->p_vertex[1].x = s; p_obj->p_vertex[1].y = -s; p_obj->p_vertex[1].z = z; rgb_float(barva, &p_obj->p_vertex[1].dr); p_obj->p_vertex[2].x = s; p_obj->p_vertex[2].y = s; p_obj->p_vertex[2].z = z; rgb_float(barva, &p_obj->p_vertex[2].dr); p_obj->p_vertex[3].x = -s; p_obj->p_vertex[3].y = s; p_obj->p_vertex[3].z = z; rgb_float(barva, &p_obj->p_vertex[3].dr); p_obj->p_vertex[4].x = -s; p_obj->p_vertex[4].y = -s; p_obj->p_vertex[4].z = z; rgb_float(barva, &p_obj->p_vertex[4].dr); p_obj->linenum = 16; assert(p_obj->p_line); p_obj->p_line[0] = 0; p_obj->p_line[1] = 1; p_obj->p_line[2] = 0; p_obj->p_line[3] = 2; p_obj->p_line[4] = 0; p_obj->p_line[5] = 3; p_obj->p_line[6] = 0; p_obj->p_line[7] = 4; p_obj->p_line[8] = 4; p_obj->p_line[9] = 1; p_obj->p_line[10] = 1; p_obj->p_line[11] = 2; p_obj->p_line[12] = 2; p_obj->p_line[13] = 3; p_obj->p_line[14] = 3; p_obj->p_line[15] = 4; nastav_barvu_bodu_obj_dword(p_obj, barva); return (p_obj); } EDIT_OBJEKT *kameru_dratovou_vyrob(BOD * p_p, BOD * p_t, float fov, float roll) { EDIT_OBJEKT *p_obj = vyrob_objekt_komplet(5, 0); GLMATRIX m; if ((p_obj->p_line = (word *) mmalloc(sizeof(word) * 16)) == NULL) chyba("pamet"); kameru_dratovou_calc(p_obj, p_p, p_t, fov, roll, DDRGB(0, 0, 1)); calc_camera_3ds(&m, &p_obj->m, p_p, p_t, roll); return (p_obj); } int vyrob_kameru_indir(KAMERA * p_kam, char *p_jmeno, BOD * p_p, BOD * p_t, float fov, float roll) { BOD p(0, 0, 0); strcpy(p_kam->jmeno, p_jmeno); p_kam->p = *p_p; p_kam->t = *p_t; p_kam->roll = roll; p_kam->fov = fov; p_kam->p_objekt = kameru_dratovou_vyrob(p_p, p_t, fov, roll); p_kam->p_pos = vyrob_krychli_dratovou(&p, 0.2f, 0.2f, 0.2f, 0xffffffff); p.z = vzdal_bodu_bod(&p_kam->p, &p_kam->t); p_kam->p_target = vyrob_krychli_dratovou(&p, 0.2f, 0.2f, 0.2f, 0xffffffff); return (TRUE); } void kameru_dratovou_reanimuj(KAMERA * p_kam) { GLMATRIX m; BOD p(0, 0, 0); kameru_dratovou_calc(p_kam->p_objekt, &p_kam->p, &p_kam->t, p_kam->fov, 0.0f, 0xff0000); krychli_dratovou_recalc(p_kam->p_pos, &p, 0.2f, 0.2f, 0.2f, 0xffffffff); p.z = vzdal_bodu_bod(&p_kam->p, &p_kam->t); krychli_dratovou_recalc(p_kam->p_target, &p, 0.2f, 0.2f, 0.2f, 0xffffffff); calc_camera_3ds(&m, &p_kam->p_objekt->m, &p_kam->p, &p_kam->t, p_kam->roll); } // invertuje poradi plosek void invertuj_face_objektu(EDIT_OBJEKT * p_obj) { word fcp[3]; int f; for (f = 0; f < p_obj->facenum; f += 3) { fcp[0] = p_obj->p_face[f]; fcp[1] = p_obj->p_face[f + 1]; p_obj->p_face[f] = fcp[1]; p_obj->p_face[f + 1] = fcp[0]; } } void invertuj_face_kontejner(EDIT_KONTEJNER * p_kont) { int o; for (o = 0; o < p_kont->max_objektu; o++) { if (p_kont->p_obj[o]) invertuj_face_objektu(p_kont->p_obj[o]); } } EDIT_KONTEJNER *vyrob_krychli_rozlozenou(BOD * p_bod, float x, float y, float z) { EDIT_KONTEJNER *p_kont = vyrob_kontejner(); EDIT_OBJEKT *p_obj; int i; x /= 2; y /= 2; z /= 2; // predni strana p_obj = vyrob_objekt_komplet(4, 6); strcpy(p_obj->jmeno, "obj1"); p_obj->x_rect = p_obj->y_rect = 1; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[0].tu1 = 0; p_obj->p_vertex[0].tv1 = 0; p_obj->p_vertex[0].tu2 = 0; p_obj->p_vertex[0].tv2 = 0; p_obj->p_vertex[0].tu3 = 0; p_obj->p_vertex[0].tv3 = 0; p_obj->p_vertex[0].tu4 = 0; p_obj->p_vertex[0].tv4 = 0; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = -z; p_obj->p_vertex[1].tu1 = 1; p_obj->p_vertex[1].tv1 = 0; p_obj->p_vertex[1].tu2 = 1; p_obj->p_vertex[1].tv2 = 0; p_obj->p_vertex[1].tu3 = 1; p_obj->p_vertex[1].tv3 = 0; p_obj->p_vertex[1].tu4 = 1; p_obj->p_vertex[1].tv4 = 0; p_obj->p_vertex[2].x = -x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = -z; p_obj->p_vertex[2].tu1 = 0; p_obj->p_vertex[2].tv1 = 1; p_obj->p_vertex[2].tu2 = 0; p_obj->p_vertex[2].tv2 = 1; p_obj->p_vertex[2].tu3 = 0; p_obj->p_vertex[2].tv3 = 1; p_obj->p_vertex[2].tu4 = 0; p_obj->p_vertex[2].tv4 = 1; p_obj->p_vertex[3].x = x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = -z; p_obj->p_vertex[3].tu1 = 1; p_obj->p_vertex[3].tv1 = 1; p_obj->p_vertex[3].tu2 = 1; p_obj->p_vertex[3].tv2 = 1; p_obj->p_vertex[3].tu3 = 1; p_obj->p_vertex[3].tv3 = 1; p_obj->p_vertex[3].tu4 = 1; p_obj->p_vertex[3].tv4 = 1; p_obj->p_face[0] = 0; p_obj->p_face[1] = 1; p_obj->p_face[2] = 3; p_obj->p_face[3] = 3; p_obj->p_face[4] = 2; p_obj->p_face[5] = 0; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_kont->p_obj[0] = p_obj; // Bocni strana p_obj = vyrob_objekt_komplet(4, 6); strcpy(p_obj->jmeno, "obj2"); p_obj->x_rect = p_obj->y_rect = 1; p_obj->p_vertex[0].x = x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[0].tu1 = 0; p_obj->p_vertex[0].tv1 = 0; p_obj->p_vertex[0].tu2 = 0; p_obj->p_vertex[0].tv2 = 0; p_obj->p_vertex[0].tu3 = 0; p_obj->p_vertex[0].tv3 = 0; p_obj->p_vertex[0].tu4 = 0; p_obj->p_vertex[0].tv4 = 0; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = z; p_obj->p_vertex[1].tu1 = 1; p_obj->p_vertex[1].tv1 = 0; p_obj->p_vertex[1].tu2 = 1; p_obj->p_vertex[1].tv2 = 0; p_obj->p_vertex[1].tu3 = 1; p_obj->p_vertex[1].tv3 = 0; p_obj->p_vertex[1].tu4 = 1; p_obj->p_vertex[1].tv4 = 0; p_obj->p_vertex[3].x = x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = z; p_obj->p_vertex[3].tu1 = 1; p_obj->p_vertex[3].tv1 = 1; p_obj->p_vertex[3].tu2 = 1; p_obj->p_vertex[3].tv2 = 1; p_obj->p_vertex[3].tu3 = 1; p_obj->p_vertex[3].tv3 = 1; p_obj->p_vertex[3].tu4 = 1; p_obj->p_vertex[3].tv4 = 1; p_obj->p_vertex[2].x = x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = -z; p_obj->p_vertex[2].tu1 = 0; p_obj->p_vertex[2].tv1 = 1; p_obj->p_vertex[2].tu2 = 0; p_obj->p_vertex[2].tv2 = 1; p_obj->p_vertex[2].tu3 = 0; p_obj->p_vertex[2].tv3 = 1; p_obj->p_vertex[2].tu4 = 0; p_obj->p_vertex[2].tv4 = 1; p_obj->p_face[0] = 0; p_obj->p_face[1] = 1; p_obj->p_face[2] = 3; p_obj->p_face[3] = 3; p_obj->p_face[4] = 2; p_obj->p_face[5] = 0; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_kont->p_obj[1] = p_obj; // Zadni strana p_obj = vyrob_objekt_komplet(4, 6); strcpy(p_obj->jmeno, "obj3"); p_obj->x_rect = p_obj->y_rect = 1; p_obj->p_vertex[2].x = -x; p_obj->p_vertex[2].y = -y; p_obj->p_vertex[2].z = z; p_obj->p_vertex[2].tu1 = 1; p_obj->p_vertex[2].tv1 = 0; p_obj->p_vertex[2].tu2 = 1; p_obj->p_vertex[2].tv2 = 0; p_obj->p_vertex[2].tu3 = 1; p_obj->p_vertex[2].tv3 = 0; p_obj->p_vertex[2].tu4 = 1; p_obj->p_vertex[2].tv4 = 0; p_obj->p_vertex[3].x = x; p_obj->p_vertex[3].y = -y; p_obj->p_vertex[3].z = z; p_obj->p_vertex[3].tu1 = 0; p_obj->p_vertex[3].tv1 = 0; p_obj->p_vertex[3].tu2 = 0; p_obj->p_vertex[3].tv2 = 0; p_obj->p_vertex[3].tu3 = 0; p_obj->p_vertex[3].tv3 = 0; p_obj->p_vertex[3].tu4 = 0; p_obj->p_vertex[3].tv4 = 0; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = y; p_obj->p_vertex[1].z = z; p_obj->p_vertex[1].tu1 = 0; p_obj->p_vertex[1].tv1 = 1; p_obj->p_vertex[1].tu2 = 0; p_obj->p_vertex[1].tv2 = 1; p_obj->p_vertex[1].tu3 = 0; p_obj->p_vertex[1].tv3 = 1; p_obj->p_vertex[1].tu4 = 0; p_obj->p_vertex[1].tv4 = 1; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = y; p_obj->p_vertex[0].z = z; p_obj->p_vertex[0].tu1 = 1; p_obj->p_vertex[0].tv1 = 1; p_obj->p_vertex[0].tu2 = 1; p_obj->p_vertex[0].tv2 = 1; p_obj->p_vertex[0].tu3 = 1; p_obj->p_vertex[0].tv3 = 1; p_obj->p_vertex[0].tu4 = 1; p_obj->p_vertex[0].tv4 = 1; p_obj->p_face[0] = 2; p_obj->p_face[1] = 0; p_obj->p_face[2] = 3; p_obj->p_face[3] = 3; p_obj->p_face[4] = 0; p_obj->p_face[5] = 1; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_kont->p_obj[2] = p_obj; // Dalsi bocni strana p_obj = vyrob_objekt_komplet(4, 6); strcpy(p_obj->jmeno, "obj4"); p_obj->x_rect = p_obj->y_rect = 1; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = z; p_obj->p_vertex[0].tu1 = 0; p_obj->p_vertex[0].tv1 = 0; p_obj->p_vertex[0].tu2 = 0; p_obj->p_vertex[0].tv2 = 0; p_obj->p_vertex[0].tu3 = 0; p_obj->p_vertex[0].tv3 = 0; p_obj->p_vertex[0].tu4 = 0; p_obj->p_vertex[0].tv4 = 0; p_obj->p_vertex[1].x = -x; p_obj->p_vertex[1].y = y; p_obj->p_vertex[1].z = z; p_obj->p_vertex[1].tu1 = 0; p_obj->p_vertex[1].tv1 = 1; p_obj->p_vertex[1].tu2 = 0; p_obj->p_vertex[1].tv2 = 1; p_obj->p_vertex[1].tu3 = 0; p_obj->p_vertex[1].tv3 = 1; p_obj->p_vertex[1].tu4 = 0; p_obj->p_vertex[1].tv4 = 1; p_obj->p_vertex[3].x = -x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = -z; p_obj->p_vertex[3].tu1 = 1; p_obj->p_vertex[3].tv1 = 1; p_obj->p_vertex[3].tu2 = 1; p_obj->p_vertex[3].tv2 = 1; p_obj->p_vertex[3].tu3 = 1; p_obj->p_vertex[3].tv3 = 1; p_obj->p_vertex[3].tu4 = 1; p_obj->p_vertex[3].tv4 = 1; p_obj->p_vertex[2].x = -x; p_obj->p_vertex[2].y = -y; p_obj->p_vertex[2].z = -z; p_obj->p_vertex[2].tu1 = 1; p_obj->p_vertex[2].tv1 = 0; p_obj->p_vertex[2].tu2 = 1; p_obj->p_vertex[2].tv2 = 0; p_obj->p_vertex[2].tu3 = 1; p_obj->p_vertex[2].tv3 = 0; p_obj->p_vertex[2].tu4 = 1; p_obj->p_vertex[2].tv4 = 0; p_obj->p_face[0] = 1; p_obj->p_face[1] = 0; p_obj->p_face[2] = 3; p_obj->p_face[3] = 3; p_obj->p_face[4] = 0; p_obj->p_face[5] = 2; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_kont->p_obj[3] = p_obj; // vrchni strana p_obj = vyrob_objekt_komplet(4, 6); strcpy(p_obj->jmeno, "obj5"); p_obj->x_rect = p_obj->y_rect = 1; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[0].tu1 = 0; p_obj->p_vertex[0].tv1 = 0; p_obj->p_vertex[0].tu2 = 0; p_obj->p_vertex[0].tv2 = 0; p_obj->p_vertex[0].tu3 = 0; p_obj->p_vertex[0].tv3 = 0; p_obj->p_vertex[0].tu4 = 0; p_obj->p_vertex[0].tv4 = 0; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = y; p_obj->p_vertex[1].z = -z; p_obj->p_vertex[1].tu1 = 1; p_obj->p_vertex[1].tv1 = 0; p_obj->p_vertex[1].tu2 = 1; p_obj->p_vertex[1].tv2 = 0; p_obj->p_vertex[1].tu3 = 1; p_obj->p_vertex[1].tv3 = 0; p_obj->p_vertex[1].tu4 = 1; p_obj->p_vertex[1].tv4 = 0; p_obj->p_vertex[3].x = x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = z; p_obj->p_vertex[3].tu1 = 1; p_obj->p_vertex[3].tv1 = 1; p_obj->p_vertex[3].tu2 = 1; p_obj->p_vertex[3].tv2 = 1; p_obj->p_vertex[3].tu3 = 1; p_obj->p_vertex[3].tv3 = 1; p_obj->p_vertex[3].tu4 = 1; p_obj->p_vertex[3].tv4 = 1; p_obj->p_vertex[2].x = -x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = z; p_obj->p_vertex[2].tu1 = 0; p_obj->p_vertex[2].tv1 = 1; p_obj->p_vertex[2].tu2 = 0; p_obj->p_vertex[2].tv2 = 1; p_obj->p_vertex[2].tu3 = 0; p_obj->p_vertex[2].tv3 = 1; p_obj->p_vertex[2].tu4 = 0; p_obj->p_vertex[2].tv4 = 1; p_obj->p_face[0] = 0; p_obj->p_face[1] = 1; p_obj->p_face[2] = 3; p_obj->p_face[3] = 3; p_obj->p_face[4] = 2; p_obj->p_face[5] = 0; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_kont->p_obj[4] = p_obj; // dolni strana p_obj = vyrob_objekt_komplet(4, 6); strcpy(p_obj->jmeno, "obj6"); p_obj->x_rect = p_obj->y_rect = 1; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = -z; p_obj->p_vertex[0].tu1 = 0; p_obj->p_vertex[0].tv1 = 0; p_obj->p_vertex[0].tu2 = 0; p_obj->p_vertex[0].tv2 = 0; p_obj->p_vertex[0].tu3 = 0; p_obj->p_vertex[0].tv3 = 0; p_obj->p_vertex[0].tu4 = 0; p_obj->p_vertex[0].tv4 = 0; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = -z; p_obj->p_vertex[1].tu1 = 1; p_obj->p_vertex[1].tv1 = 0; p_obj->p_vertex[1].tu2 = 1; p_obj->p_vertex[1].tv2 = 0; p_obj->p_vertex[1].tu3 = 1; p_obj->p_vertex[1].tv3 = 0; p_obj->p_vertex[1].tu4 = 1; p_obj->p_vertex[1].tv4 = 0; p_obj->p_vertex[3].x = x; p_obj->p_vertex[3].y = -y; p_obj->p_vertex[3].z = z; p_obj->p_vertex[3].tu1 = 1; p_obj->p_vertex[3].tv1 = 1; p_obj->p_vertex[3].tu2 = 1; p_obj->p_vertex[3].tv2 = 1; p_obj->p_vertex[3].tu3 = 1; p_obj->p_vertex[3].tv3 = 1; p_obj->p_vertex[3].tu4 = 1; p_obj->p_vertex[3].tv4 = 1; p_obj->p_vertex[2].x = -x; p_obj->p_vertex[2].y = -y; p_obj->p_vertex[2].z = z; p_obj->p_vertex[2].tu1 = 0; p_obj->p_vertex[2].tv1 = 1; p_obj->p_vertex[2].tu2 = 0; p_obj->p_vertex[2].tv2 = 1; p_obj->p_vertex[2].tu3 = 0; p_obj->p_vertex[2].tv3 = 1; p_obj->p_vertex[2].tu4 = 0; p_obj->p_vertex[2].tv4 = 1; p_obj->p_face[0] = 1; p_obj->p_face[1] = 0; p_obj->p_face[2] = 3; p_obj->p_face[3] = 3; p_obj->p_face[4] = 0; p_obj->p_face[5] = 2; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } p_kont->p_obj[5] = p_obj; updatuj_kontejner_statistika(p_kont, TRUE); nastav_barvu_bodu_kont_dword(p_kont, 0xffffffff, COLOR_SET); kont_norm_vect(p_kont); return (p_kont); } /* Stredovy bod + dx,dy,dz */ void pridej_krychli(EDIT_OBJEKT ** p_src, BOD * p_bod, float x, float y, float z) { EDIT_OBJEKT *p_obj = vyrob_krychli(p_bod, x, y, z, 0xffffffff); EDIT_OBJEKT *p_obj2; p_obj2 = slep_objekty(*p_src, p_obj); zrus_objekt(p_src); zrus_objekt(&p_obj); *p_src = p_obj2; } /* Vyrobi billboard na BOD + dx,dy */ EDIT_OBJEKT *vyrob_billboard(BOD * p_bod, float x, float y) { EDIT_OBJEKT *p_obj = vyrob_objekt_komplet(4, 6); int i; p_obj->p_vertex[0].x = -x; p_obj->p_vertex[0].y = -y; p_obj->p_vertex[0].z = 0; p_obj->p_vertex[1].x = x; p_obj->p_vertex[1].y = -y; p_obj->p_vertex[1].z = 0; p_obj->p_vertex[2].x = x; p_obj->p_vertex[2].y = y; p_obj->p_vertex[2].z = 0; p_obj->p_vertex[3].x = -x; p_obj->p_vertex[3].y = y; p_obj->p_vertex[3].z = 0; p_obj->p_vertex[0].tu1 = 0; p_obj->p_vertex[0].tv1 = 0; p_obj->p_vertex[1].tu1 = 1; p_obj->p_vertex[1].tv1 = 0; p_obj->p_vertex[2].tu1 = 1; p_obj->p_vertex[2].tv1 = 1; p_obj->p_vertex[3].tu1 = 0; p_obj->p_vertex[3].tv1 = 1; for (i = 0; i < 4; i++) { p_obj->p_vertex[i].x += p_bod->x; p_obj->p_vertex[i].y += p_bod->y; p_obj->p_vertex[i].z += p_bod->z; } // predni strana p_obj->p_face[0] = 0; p_obj->p_face[1] = 1; p_obj->p_face[2] = 2; p_obj->p_face[3] = 2; p_obj->p_face[4] = 3; p_obj->p_face[5] = 0; return (p_obj); } // Spocita obalku objektu void objekt_obalka(EDIT_OBJEKT * p_obj, GLMATRIX * p_m, BOD * p_min, BOD * p_max) { MUJ_BOD *p_vert; BOD a; int v; p_vert = p_obj->p_vertex; assert(p_vert && p_obj->vertexnum); mujbod2bod(&a, p_obj->p_vertex); if (p_m) transformuj_bod_bod_matici(&a, p_m); *p_min = *p_max = a; for (v = 1; v < p_obj->vertexnum; v++) { mujbod2bod(&a, p_obj->p_vertex + v); if (p_m) transformuj_bod_bod_matici(&a, p_m); if (a.x < p_min->x) p_min->x = a.x; if (a.y < p_min->y) p_min->y = a.y; if (a.z < p_min->z) p_min->z = a.z; if (a.x > p_max->x) p_max->x = a.x; if (a.y > p_max->y) p_max->y = a.y; if (a.z > p_max->z) p_max->z = a.z; } } void poly_obalka(EDIT_MESH_POLY * p_poly, GLMATRIX * p_mat, BOD * p_min, BOD * p_max) { BOD max(-FLT_MAX, -FLT_MAX, -FLT_MAX), min(FLT_MAX, FLT_MAX, FLT_MAX), a; int f; for (f = 0; f < p_poly->facenum; f++) { a.x = p_poly->p_koord[f].x; a.y = p_poly->p_koord[f].y; a.z = p_poly->p_koord[f].z; if (p_mat) transformuj_bod_bod_matici(&a, p_mat); if (a.x < min.x) min.x = a.x; if (a.y < min.y) min.y = a.y; if (a.z < min.z) min.z = a.z; if (a.x > max.x) max.x = a.x; if (a.y > max.y) max.y = a.y; if (a.z > max.z) max.z = a.z; } *p_max = max; *p_min = min; } // spocita obalku kontejneru - spocita z matic objektu void kontejner_obalka(EDIT_KONTEJNER * p_kont) { EDIT_OBJEKT *p_obj; OBB_OLD *p_obb = &p_kont->obb; BOD max(-FLT_MAX, -FLT_MAX, -FLT_MAX), min(FLT_MAX, FLT_MAX, FLT_MAX); int k; for (k = 0; k < MAX_KONT_OBJEKTU; k++) { p_obj = p_kont->p_obj[k]; if (p_obj) { kd_min_max_bod(&p_obj->obb.aabb_min, &min, &max); kd_min_max_bod(&p_obj->obb.aabb_max, &min, &max); } } vektor_set_all(p_obb->obb, 1, 0, 0); vektor_set_all(p_obb->obb + 1, 0, 1, 0); vektor_set_all(p_obb->obb + 2, 0, 0, 1); kd_stred_bunky(&min, &max, &p_kont->obb.obb_stred); kd_len_bunky(&min, &max, &p_kont->obb.obb_len); } void kontejner_obalka_aabb(EDIT_KONTEJNER * p_kont, BOD * p_min, BOD * p_max) { EDIT_OBJEKT *p_obj; int k; vektor_set(p_min, FLT_MAX); vektor_set(p_max, -FLT_MAX); for (k = 0; k < MAX_KONT_OBJEKTU; k++) { p_obj = p_kont->p_obj[k]; if (p_obj) { kd_min_max_bod(&p_obj->obb.aabb_min, p_min, p_max); kd_min_max_bod(&p_obj->obb.aabb_max, p_min, p_max); } } } // cte velikost objektu v bytech int cti_velikost_objektu(EDIT_OBJEKT * p_obj) { if (p_obj) return (sizeof(EDIT_OBJEKT) + p_obj->vertexnum * sizeof(p_obj->p_vertex[0]) + p_obj->facenum * sizeof(p_obj->p_face[0]) + p_obj->linenum * sizeof(p_obj->p_line[0])); else return (0); } void cti_velikost_kontejneru(EDIT_KONTEJNER * p_kont, int *p_size, int *p_objektu) { int o; int size; int objektu = 0; size = sizeof(EDIT_KONTEJNER); for (o = 0; o < p_kont->max_objektu; o++) { if (p_kont->p_obj[o]) { size += cti_velikost_objektu(p_kont->p_obj[o]); objektu++; } } *p_size += size; *p_objektu += objektu; } int intersect_ray_koule(BOD * p_stred, float radius, BOD * p_orig, BOD * p_dir) { BOD q = *p_dir; BOD p(p_orig->x - p_stred->x, p_orig->y - p_stred->y, p_orig->z - p_stred->z); float a, b2, c; float D4, sqD4, t2; a = q.x * q.x + q.y * q.y + q.z * q.z; b2 = (skal_soucin(q, p)) / 2; c = (q.x - p_stred->x) * (q.x - p_stred->x) + (q.y - p_stred->y) * (q.y - p_stred->y) + (q.z - p_stred->z) * (q.z - p_stred->z) - radius * radius; // att + bt + c = 0 D4 = b2 * b2 - a * c; if (D4 < 0) return (FALSE); sqD4 = (float) sqrt(D4); t2 = (sqD4 - b2) / a; if (t2 < 0) return (FALSE); else return (TRUE); } // FACE_SOUS *p_fsous; /* static int _num_pass(word * p_f1, word * p_f2) { int i, j; int hit = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { if (p_f1[i] == p_f2[j]) hit++; } } return (hit); } */ // importovat z 3ds modelama !!!! // toto je moje berlicka void obj_vyrob_list_sousednosti(EDIT_OBJEKT * p_obj) { /* int f, fi; int hit; */ if (p_obj->p_fsous) { free(p_obj->p_fsous); } /* p_obj->p_fsous = mmalloc(sizeof(p_obj->p_fsous[0])*p_obj->facenum); memset(p_obj->p_fsous,K_CHYBA,sizeof(p_obj->p_fsous[0])*p_obj->facenum); for(f = 0; f < p_obj->facenum; f+=3) { hit = 0; for(fi = 0; fi < p_obj->facenum; fi+=3) { if(f == fi) continue; // face maji 2 spolecne body if(_num_pass(p_obj->p_face+f, p_obj->p_face+fi) == 2) { assert(hit < 3); p_obj->p_fsous[f+hit] = fi; hit++; } } } */ } /* static int _num_pass_vertex(OBJ_VERTEX ** p_f1, OBJ_VERTEX ** p_f2) { int i, j; int hit = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { if (stejny_vertex_point((BOD *) (p_f1[i]), (BOD *) (p_f2[j]))) hit++; } } return (hit); } */ void obj_vyrob_list_sousednosti_full(EDIT_OBJEKT * p_obj) { /* OBJ_VERTEX *p_face1[3]; OBJ_VERTEX *p_face2[3]; int f, fi; int hit; */ if (p_obj->p_fsous) { free(p_obj->p_fsous); } /* p_obj->p_fsous = mmalloc(sizeof(p_obj->p_fsous[0])*p_obj->facenum); memset(p_obj->p_fsous,K_CHYBA,sizeof(p_obj->p_fsous[0])*p_obj->facenum); for(f = 0; f < p_obj->facenum; f+=3) { hit = 0; for(fi = 0; fi < p_obj->facenum; fi+=3) { if(f == fi) continue; // face maji 2 spolecne body p_face1[0] = p_obj->p_vertex+(p_obj->p_face[f]); p_face1[1] = p_obj->p_vertex+(p_obj->p_face[f+1]); p_face1[2] = p_obj->p_vertex+(p_obj->p_face[f+2]); p_face2[0] = p_obj->p_vertex+(p_obj->p_face[fi]); p_face2[1] = p_obj->p_vertex+(p_obj->p_face[fi+1]); p_face2[2] = p_obj->p_vertex+(p_obj->p_face[fi+2]); if(_num_pass_vertex(p_face1, p_face2) == 2) { assert(hit < 3); p_obj->p_fsous[f+hit++] = fi; } } } */ } void scale_normal_roh(MUJ_BOD * p_vertex, FACE * p_face, int v1, int v2, int v3, BOD * p_normal) { BOD vektor1, vektor2, p1, p2; float uhel; // 180 stupnu = 1.0f vektor_sub(mujbod2bod(&p1, p_vertex + p_face[v2]), mujbod2bod(&p2, p_vertex + p_face[v1]), &vektor1); vektor_norm(&vektor1); vektor_sub(mujbod2bod(&p1, p_vertex + p_face[v3]), mujbod2bod(&p2, p_vertex + p_face[v1]), &vektor2); vektor_norm(&vektor2); uhel = acosf(vektor_uhel(&vektor1, &vektor2)); if (finite(uhel) && !isnan(uhel)) vektor_scale(p_normal, uhel / PI); else vektor_set(p_normal, 0.0f); } typedef struct _NORM_INDICIE { // popisuje vertex BOD *p_vert; BOD norm; int vertex; } NORM_INDICIE; typedef struct _FACE_INDICIE { // popisuje face int vertex; BOD norm; } FACE_INDICIE; typedef struct _NORM_INT_PROC { int ind_akt; // Pole vertexu int ind_max; NORM_INDICIE *p_ind; int fn_akt; // Pole facu int fn_max; FACE_INDICIE *p_fn; } NORM_INT_PROC; void ind_init(NORM_INT_PROC * p_prc, int vert, int facu) { memset(p_prc, 0, sizeof(p_prc[0])); /* p_prc->p_ind = mmalloc(sizeof(p_prc->p_ind[0])*vert); p_prc->ind_max = vert; p_prc->p_fn = mmalloc(sizeof(p_prc->p_fn[0])*facu); p_prc->fn_max = facu; */ } void ind_smaz(NORM_INT_PROC * p_prc) { /* null_free(&p_prc->p_ind); null_free(&p_prc->p_fn); memset(p_prc,0,sizeof(p_prc[0])); */ } BOD *ind_calc_fnorm(EDIT_OBJEKT * p_obj) { BOD *p_fnorm; int i; p_fnorm = (BOD *) mmalloc(sizeof(p_fnorm[0]) * p_obj->facenum); for (i = 0; i < p_obj->facenum; i += 3) { vektor_norm(calc_face_normal((BOD *) (p_obj->p_vertex + p_obj->p_face[i]), (BOD *) (p_obj->p_vertex + p_obj->p_face[i + 1]), (BOD *) (p_obj->p_vertex + p_obj->p_face[i + 2]), p_fnorm + i / 3)); } return (p_fnorm); } int ind_add_obj(NORM_INT_PROC * p_prc, EDIT_OBJEKT * p_obj) { int i, vnum = p_obj->vertexnum, fnum = p_obj->facenum; int handle; NORM_INDICIE *p_ind; FACE_INDICIE *p_fn; BOD *p_fnorm; if (p_prc->ind_akt + vnum > p_prc->ind_max) return (K_CHYBA); if (p_prc->fn_akt + fnum > p_prc->fn_max) return (K_CHYBA); p_fnorm = ind_calc_fnorm(p_obj); handle = p_prc->ind_akt; p_ind = p_prc->p_ind + handle; p_prc->ind_akt += vnum; for (i = 0; i < vnum; i++, p_ind++) { p_ind->p_vert = (BOD *) (p_obj->p_vertex + i); p_ind->vertex = handle + i; } p_fn = p_prc->p_fn + p_prc->fn_akt; p_prc->fn_akt += fnum; for (i = 0; i < fnum; i += 3) { p_fn->norm = p_fnorm[i / 3]; scale_normal_roh(p_obj->p_vertex, p_obj->p_face + i, 0, 1, 2, &p_fn->norm); p_fn->vertex = handle + p_obj->p_face[i]; p_fn++; p_fn->norm = p_fnorm[i / 3]; scale_normal_roh(p_obj->p_vertex, p_obj->p_face + i, 1, 0, 2, &p_fn->norm); p_fn->vertex = handle + p_obj->p_face[i + 1]; p_fn++; p_fn->norm = p_fnorm[i / 3]; scale_normal_roh(p_obj->p_vertex, p_obj->p_face + i, 2, 0, 1, &p_fn->norm); p_fn->vertex = handle + p_obj->p_face[i + 2]; p_fn++; } free(p_fnorm); return (handle); } // Kopiruje normaly zpet do objektu int ind_vypln_obj(NORM_INT_PROC * p_prc, EDIT_OBJEKT * p_obj, int handle) { NORM_INDICIE *p_ind; int i, vnum = p_obj->vertexnum; if (handle + vnum > p_prc->ind_akt) return (K_CHYBA); p_ind = p_prc->p_ind + handle; for (i = 0; i < vnum; i++, p_ind++) { norm2mujbod(p_obj->p_vertex + i, &p_ind->norm); } return (handle); } inline int porovnej_vertexy(BOD * p_v1, BOD * p_v2) { if (p_v1->x > p_v2->x) { return (1); } else if (p_v1->x < p_v2->x) { return (-1); } else if (p_v1->y > p_v2->y) { return (1); } else if (p_v1->y < p_v2->y) { return (-1); } else if (p_v1->z > p_v2->z) { return (1); } else if (p_v1->z < p_v2->z) { return (-1); } else { return (0); } } int ind_sort_rec(const void *p_m1, const void *p_m2) { const NORM_INDICIE *p_i1 = (NORM_INDICIE *) p_m1; const NORM_INDICIE *p_i2 = (NORM_INDICIE *) p_m2; return (porovnej_vertexy(p_i1->p_vert, p_i2->p_vert)); } int ind_sort_rec2(const void *p_m1, const void *p_m2) { const FACE_INDICIE *p_i1 = (FACE_INDICIE *) p_m1; const FACE_INDICIE *p_i2 = (FACE_INDICIE *) p_m2; return (p_i1->vertex - p_i2->vertex); } void ind_sort(NORM_INT_PROC * p_prc, int brutal) { if (brutal) qsort(p_prc->p_ind, p_prc->ind_akt, sizeof(p_prc->p_ind[0]), ind_sort_rec); qsort(p_prc->p_fn, p_prc->fn_akt, sizeof(p_prc->p_fn[0]), ind_sort_rec2); } int ind_sort_obj_rec(const void *p_m1, const void *p_m2) { const NORM_INDICIE *p_i1 = (NORM_INDICIE *) p_m1; const NORM_INDICIE *p_i2 = (NORM_INDICIE *) p_m2; return (p_i1->vertex - p_i2->vertex); } void ind_sort_obj(NORM_INT_PROC * p_prc) { qsort(p_prc->p_ind, p_prc->ind_akt, sizeof(p_prc->p_ind[0]), ind_sort_obj_rec); } BOD *ind_najdi_normal(NORM_INT_PROC * p_prc, int vertex, BOD * p_norm) { FACE_INDICIE *p_face = p_prc->p_fn; int i, start = 0, stop = p_prc->fn_akt, stred; do { stred = start + ((stop - start) >> 1); if (p_face[stred].vertex == vertex) { break; } else { if (start + 1 >= stop) { return (NULL); } else if (p_face[stred].vertex > vertex) { stop = stred; } else { start = stred; } } } while (1); for (i = stred; i < p_prc->fn_akt && p_face[i].vertex == vertex; i++) { vektor_add(p_norm, &p_face[i].norm, p_norm); } for (i = stred - 1; i > -1 && p_face[i].vertex == vertex; i--) { vektor_add(p_norm, &p_face[i].norm, p_norm); } return (p_norm); } inline int stejny_ind(NORM_INDICIE * p_ind1, NORM_INDICIE * p_ind2) { return (stejny_vertex_point(p_ind1->p_vert, p_ind2->p_vert)); } void ind_calc_norm(NORM_INT_PROC * p_prc, int brutal) { NORM_INDICIE *p_first; NORM_INDICIE *p_last; BOD norm; int i, j, num = 0; ind_sort(p_prc, brutal); p_last = p_prc->p_ind; i = 0; do { p_first = p_last; if (brutal) { for (; (i < p_prc->ind_akt) && stejny_ind(p_first, p_last); i++, p_last++); num = p_last - p_first; } else { if (i < p_prc->ind_akt) { i++; p_last++; num = 1; } } vektor_set(&norm, 0.0f); for (j = 0; j < num; j++) { ind_najdi_normal(p_prc, p_first[j].vertex, &norm); } vektor_norm(&norm); for (j = 0; j < num; j++) { p_first[j].norm = norm; } } while (i < p_prc->ind_akt); ind_sort_obj(p_prc); } void calc_norm_vec(EDIT_OBJEKT * p_obj) { NORM_INT_PROC prc; int h1; ind_init(&prc, p_obj->vertexnum, p_obj->facenum); h1 = ind_add_obj(&prc, p_obj); ind_calc_norm(&prc, FALSE); ind_vypln_obj(&prc, p_obj, h1); ind_smaz(&prc); } void kont_norm_vect_iobject(EDIT_KONTEJNER * p_kont) { EDIT_OBJEKT *p_obj; NORM_INT_PROC prc; int *p_handle; int i, o; updatuj_kontejner_statistika(p_kont, FALSE); ind_init(&prc, p_kont->bodu, p_kont->facu); p_handle = (int *) mmalloc(sizeof(p_handle[0]) * p_kont->objektu); i = 0; oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { p_handle[i] = ind_add_obj(&prc, p_obj); i++; } ind_calc_norm(&prc, TRUE); i = 0; oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { ind_vypln_obj(&prc, p_obj, p_handle[i]); i++; } ind_smaz(&prc); free(p_handle); } void kont_norm_vect(EDIT_KONTEJNER * p_kont_top) { EDIT_KONTEJNER *p_kont = p_kont_top; int i; while (p_kont) { if (p_kont->kflag & KONT_BRUTALNORMAL) { kont_norm_vect_iobject(p_kont); } else { for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) calc_norm_vec(p_kont->p_obj[i]); } } p_kont = p_kont->p_next; } } /* Rendering linelistu */ void kresli_objekt_dratove_jednoduse(EDIT_OBJEKT * p_obj) { int i, l1, l2; assert(p_obj); glBegin(GL_LINES); for (i = 0; i < p_obj->linenum; i += 2) { l1 = p_obj->p_line[i]; l2 = p_obj->p_line[i + 1]; glColor3fv(&p_obj->p_vertex[l1].dr); glVertex3f(p_obj->p_vertex[l1].x, p_obj->p_vertex[l1].y, p_obj->p_vertex[l1].z); glColor3fv(&p_obj->p_vertex[l2].dr); glVertex3f(p_obj->p_vertex[l2].x, p_obj->p_vertex[l2].y, p_obj->p_vertex[l2].z); } glEnd(); } void nastav_material_rgb_MAT(RGB_M * p_rgb) { MATERIAL mtrl; ZeroMemory(&mtrl, sizeof(mtrl)); mtrl.ambient_r = p_rgb->r; mtrl.ambient_g = p_rgb->g; mtrl.ambient_b = p_rgb->b; glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, (float *) p_rgb); } void nastav_material(float r, float g, float b) { MATERIAL mtrl; ZeroMemory(&mtrl, sizeof(mtrl)); mtrl.ambient_r = r; mtrl.ambient_g = g; mtrl.ambient_b = b; glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, &mtrl.ambient_r); } void kresli_kosoctverec(GLMATRIX * p_project, GLMATRIX * p_camera, GLMATRIX * p_world, BOD * p_p, float r, float dr, float dg, float db) { GLMATRIX rr; BOD p, vrc[6]; p.x = p_p->x; p.y = p_p->y; p.z = p_p->z; calc_3d_2d_matrix(p_world, p_camera, p_project, &rr); transformuj_bod_matici(&p.x, &p.y, &p.z, &rr); r = r * p.z * 0.1f; vrc[0].x = p_p->x + r; vrc[0].y = p_p->y; vrc[0].z = p_p->z; vrc[1].x = p_p->x; vrc[1].y = p_p->y; vrc[1].z = p_p->z + r; vrc[2].x = p_p->x - r; vrc[2].y = p_p->y; vrc[2].z = p_p->z; vrc[3].x = p_p->x; vrc[3].y = p_p->y; vrc[3].z = p_p->z - r; vrc[4].x = p_p->x; vrc[4].y = p_p->y + r; vrc[4].z = p_p->z; vrc[5].x = p_p->x; vrc[5].y = p_p->y - r; vrc[5].z = p_p->z; glColor3f(dr, dg, db); glBegin(GL_LINE_LOOP); glVertex3fv((float *) &vrc[0]); glVertex3fv((float *) &vrc[1]); glVertex3fv((float *) &vrc[2]); glVertex3fv((float *) &vrc[3]); glVertex3fv((float *) &vrc[0]); glVertex3fv((float *) &vrc[4]); glVertex3fv((float *) &vrc[2]); glVertex3fv((float *) &vrc[5]); glVertex3fv((float *) &vrc[0]); glEnd(); glBegin(GL_LINE_LOOP); glVertex3fv((float *) &vrc[3]); glVertex3fv((float *) &vrc[4]); glVertex3fv((float *) &vrc[1]); glVertex3fv((float *) &vrc[5]); glVertex3fv((float *) &vrc[3]); glEnd(); glFlush(); } void kresli_kosoctverec_word(BOD * p_p, float r, dword barva) { BOD vrc[6]; vrc[0].x = p_p->x + r; vrc[0].y = p_p->y; vrc[0].z = p_p->z; vrc[1].x = p_p->x; vrc[1].y = p_p->y; vrc[1].z = p_p->z + r; vrc[2].x = p_p->x - r; vrc[2].y = p_p->y; vrc[2].z = p_p->z; vrc[3].x = p_p->x; vrc[3].y = p_p->y; vrc[3].z = p_p->z - r; vrc[4].x = p_p->x; vrc[4].y = p_p->y + r; vrc[4].z = p_p->z; vrc[5].x = p_p->x; vrc[5].y = p_p->y - r; vrc[5].z = p_p->z; glColor4ubv((byte *) & barva); glBegin(GL_LINE_LOOP); glVertex3fv((float *) (&vrc[0])); glVertex3fv((float *) (&vrc[1])); glVertex3fv((float *) (&vrc[2])); glVertex3fv((float *) (&vrc[3])); glVertex3fv((float *) (&vrc[0])); glVertex3fv((float *) (&vrc[4])); glVertex3fv((float *) (&vrc[2])); glVertex3fv((float *) (&vrc[5])); glVertex3fv((float *) (&vrc[0])); glEnd(); glBegin(GL_LINE_LOOP); glVertex3fv((float *) (&vrc[3])); glVertex3fv((float *) (&vrc[4])); glVertex3fv((float *) (&vrc[1])); glVertex3fv((float *) (&vrc[5])); glVertex3fv((float *) (&vrc[3])); glEnd(); glFlush(); } void kresli_oktanovou_bunku_minmax(BOD * p_min, BOD * p_max, dword barva) { glColor3ubv((byte *) & barva); glBegin(GL_LINES); glVertex3f(p_min->x, p_min->y, p_min->z); glVertex3f(p_min->x, p_max->y, p_min->z); glVertex3f(p_min->x, p_min->y, p_min->z); glVertex3f(p_max->x, p_min->y, p_min->z); glVertex3f(p_min->x, p_min->y, p_min->z); glVertex3f(p_min->x, p_min->y, p_max->z); glVertex3f(p_max->x, p_max->y, p_max->z); glVertex3f(p_min->x, p_max->y, p_max->z); glVertex3f(p_max->x, p_max->y, p_max->z); glVertex3f(p_max->x, p_min->y, p_max->z); glVertex3f(p_max->x, p_max->y, p_max->z); glVertex3f(p_max->x, p_max->y, p_min->z); glVertex3f(p_min->x, p_max->y, p_min->z); glVertex3f(p_min->x, p_max->y, p_max->z); glVertex3f(p_min->x, p_max->y, p_min->z); glVertex3f(p_max->x, p_max->y, p_min->z); glVertex3f(p_max->x, p_min->y, p_max->z); glVertex3f(p_min->x, p_min->y, p_max->z); glVertex3f(p_max->x, p_min->y, p_max->z); glVertex3f(p_max->x, p_min->y, p_min->z); glVertex3f(p_max->x, p_min->y, p_min->z); glVertex3f(p_max->x, p_max->y, p_min->z); glVertex3f(p_min->x, p_min->y, p_max->z); glVertex3f(p_min->x, p_max->y, p_max->z); glEnd(); } void konfiguruj_look_up(int *p_looksqrt_linear, int *p_looksqrt_quadratic, float *p_looksqrt_linear_float, float *p_looksqrt_quadratic_float) { int x, y, i; float vzdal; float fx, fy, fz, m1, m2, qk = (float) sqrt(255.0f); // 0 = max // 255 = min -> tak to nastavit // koeficienty utlumu si schovat !! for (x = 0; x < MAX_LOOK_TABLE; x++) { for (y = 0; y < MAX_LOOK_TABLE; y++) { i = y * MAX_LOOK_TABLE + x; // intenzity ve fixed-point fx = (float) (x); fy = (float) (y); fz = 0.0f; vzdal = sqrtf((float) (fx * fx + fy * fy + fz * fz)); // vzdal if ((m1 = (255.0f - vzdal) / 255.0f) < 0.0f) m1 = 0.0f; vzdal = (qk / 255.0f) * vzdal; if ((m2 = (255.0f - vzdal * vzdal) / 255.0f) < 0.0f) m2 = 0.0f; p_looksqrt_linear[i] = ftoi(((float) (0xffffff)) * m1); if (p_looksqrt_linear[i] > 0x01000000) p_looksqrt_linear[i] = 0x01000000; p_looksqrt_quadratic[i] = ftoi(((float) (0xffffff)) * m2); if (p_looksqrt_quadratic[i] > 0x01000000) p_looksqrt_quadratic[i] = 0x01000000; } } for (i = 0; i < MAX_LOOK_TABLE; i++) { vzdal = (float) (i); if ((m1 = (255.0f - vzdal) / 255.0f) < 0.0f) m1 = 0.0f; vzdal = qk / 255.0f * vzdal; if ((m2 = (255.0f - vzdal * vzdal) / 255.0f) < 0.0f) m2 = 0.0f; p_looksqrt_linear_float[i] = m1; p_looksqrt_quadratic_float[i] = m2; } } void transformuj_objekt_text_coord(EDIT_OBJEKT * p_obj, GLMATRIX * p_mat, int coord) { int i; float z; for (i = 0; i < p_obj->vertexnum; i++) { if (coord & 0x1) { z = 0.0f; transformuj_bod_matici(&p_obj->p_vertex[i].tu1, &p_obj->p_vertex[i].tv1, &z, p_mat); } if (coord & 0x2) { z = 0.0f; transformuj_bod_matici(&p_obj->p_vertex[i].tu2, &p_obj->p_vertex[i].tv2, &z, p_mat); } } } void transformuj_kontejner_text_coord(EDIT_KONTEJNER * p_kont, GLMATRIX * p_mat, int coord) { EDIT_OBJEKT *p_obj; int o; oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { transformuj_objekt_text_coord(p_obj, p_mat, coord); } } /* Spekularni ENV mapping na vybrany */ void mesh_env_maping_spec(GAME_MESH_OLD * p_mesh, GLMATRIX * p_cam, EDIT_MATERIAL ** p_mt) { EDIT_MATERIAL *p_mat, *p_mat_prev = NULL; float tx, ty, tz; float px, py, pz; float v1, v2, v3; float r = 0, g = 0, b = 0, uhel = 0; BOD *p_norm; BODRGB *p_spec; BODRGB *p_spec_src; float add1 = 0.0f, add2 = 0.0f, scale = 1.0f; int os = 0, v, vertexnum; int i, kframe; GLMATRIX *p_kw = NULL; int flag2; p_mesh->p_data->k2flag |= KONT2_UPDATE_SPEC; kframe = p_mesh->p_data->kflag & KONT_KEYFRAME; if (!kframe) p_kw = &p_mesh->m; v1 = p_cam->_13; v2 = p_cam->_23; v3 = p_cam->_33; for (i = 0; i < p_mesh->objektu; i++) { p_mat = p_mt[p_mesh->p_mat[i]]; flag2 = p_mat->flag2; if (flag2 & MAT2_ENV_SPEC) { if (p_mat_prev != p_mat) { // test na zmenu materialu os = p_mat->flag2 & MAT2_ENV_SPEC_OBE; r = p_mat->env_r; g = p_mat->env_g; b = p_mat->env_b; add1 = p_mat->env_add1; add2 = p_mat->env_add2; scale = p_mat->env_scale; p_mat_prev = p_mat; } vertexnum = p_mesh->objektnum[i]; v = p_mesh->objektstart[i]; p_norm = p_mesh->p_vertex_norm + v; p_spec = p_mesh->p_vertex_spec + v; //p_spec_src = p_mesh->p_vertex_spec ? p_mesh->p_vertex_spec+v : NULL; p_spec_src = NULL; if (kframe) p_kw = p_mesh->p_key + i; for (v = 0; v < vertexnum; v++) { px = p_norm->x; py = p_norm->y; pz = p_norm->z; p_norm++; tx = p_kw->_11 * px + p_kw->_21 * py + p_kw->_31 * pz; ty = p_kw->_12 * px + p_kw->_22 * py + p_kw->_32 * pz; tz = p_kw->_13 * px + p_kw->_23 * py + p_kw->_33 * pz; norm_vect(&tx, &ty, &tz); uhel = (scale * (add1 + tx * v1 + ty * v2 + tz * v3)) + add2; if (p_spec_src) { if (os) { uhel = fabsf(uhel); p_spec->r = (r * uhel) + p_spec_src->r; p_spec->g = (g * uhel) + p_spec_src->g; p_spec->b = (b * uhel) + p_spec_src->b; } else { if (uhel > 0) { p_spec->r = (r * uhel) + p_spec_src->r; p_spec->g = (g * uhel) + p_spec_src->g; p_spec->b = (b * uhel) + p_spec_src->b; } } p_spec_src++; p_spec++; } else { if (os) { uhel = fabsf(uhel); p_spec->r = r * uhel; p_spec->g = g * uhel; p_spec->b = b * uhel; } else { if (uhel > 0) { p_spec->r = r * uhel; p_spec->g = g * uhel; p_spec->b = b * uhel; } } p_spec++; } } } } } /* Env-mapping na poly */ void poly_env_maping_spec(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL * p_mat, GLMATRIX * p_cam) { TEXT_KOORD *p_koord; int os = p_mat->flag2 & MAT2_ENV_SPEC_OBE; float tx, ty, tz; float v1, v2, v3; int v, vertexnum; float uhel; float r, g, b; float add1, add2, scale; r = p_mat->env_r; g = p_mat->env_g; b = p_mat->env_b; v1 = p_cam->_13; v2 = p_cam->_23; v3 = p_cam->_33; add1 = p_mat->env_add1; add2 = p_mat->env_add2; scale = p_mat->env_scale; vertexnum = p_poly->facenum; p_koord = p_poly->p_koord; for (v = 0; v < vertexnum; v++) { tx = p_koord->nx; ty = p_koord->ny; tz = p_koord->nz; uhel = (scale * (add1 + (tx * v1 + ty * v2 + tz * v3))) + add2; if (os) uhel = fabsf(uhel); else if (uhel < 0) continue; p_koord->sr = r * uhel + p_koord->msr; p_koord->sg = g * uhel + p_koord->msr; p_koord->sb = b * uhel + p_koord->msr; p_koord++; } p_poly->kflag |= KONT_UPLOAD; } int intersect_poly(EDIT_MESH_POLY * p_poly, BOD * p_orig, BOD * p_dir) { TEXT_KOORD *p_face; int f, facenum = p_poly->facenum; float t, u, v; p_face = p_poly->p_koord; for (f = 0; f < facenum; f += 3, p_face += 3) { if (intersect_triangle_ncull(p_orig, p_dir, (BOD *) p_face, (BOD *) (p_face + 2), (BOD *) (p_face + 1), &t, &u, &v) && t > 0.0f && t < 1.0f) return (TRUE); } return (FALSE); } int intersect_mesh_objekt(GAME_MESH_OLD * p_mesh, int o, BOD * p_orig, BOD * p_dir) { BOD *p_vertex_pos; int j, d, facenum, fnum2; int *p_face, typ; int *p_face_prvni; float t, u, v; // Dynamicke meshe - automaticky uspech if (p_mesh->p_data->kflag & KONT_STATIC || p_mesh->p_data->kflag & KONT_NORMAL_ANIM) { assert(o < p_mesh->objektu); p_vertex_pos = p_mesh->p_vertex_pos; p_face = p_mesh->p_face + p_mesh->facestart[o]; facenum = p_mesh->facenum[o]; for (j = 0; j < facenum; j++) { fnum2 = *p_face++; typ = *p_face++; switch (typ) { case GL_TRIANGLES: for (d = 0; d < fnum2; d += 3, p_face += 3) { if (intersect_triangle_ncull(p_orig, p_dir, p_vertex_pos + p_face[0], p_vertex_pos + p_face[2], p_vertex_pos + p_face[1], &t, &u, &v) && t > 0.0f && t < 1.0f) return (TRUE); } break; case GL_TRIANGLE_STRIP: if (intersect_triangle_ncull(p_orig, p_dir, p_vertex_pos + p_face[0], p_vertex_pos + p_face[2], p_vertex_pos + p_face[1], &t, &u, &v) && t > 0.0f && t < 1.0f) return (TRUE); p_face += 3; for (d = 3; d < fnum2; d++, p_face++) { if (intersect_triangle_ncull(p_orig, p_dir, p_vertex_pos + p_face[-2], p_vertex_pos + p_face[-1], p_vertex_pos + p_face[0], &t, &u, &v) && t > 0.0f && t < 1.0f) return (TRUE); } break; case GL_TRIANGLE_FAN: if (intersect_triangle_ncull(p_orig, p_dir, p_vertex_pos + p_face[0], p_vertex_pos + p_face[2], p_vertex_pos + p_face[1], &t, &u, &v) && t > 0.0f && t < 1.0f) return (TRUE); p_face_prvni = p_face; p_face += 3; fnum2 -= 3; for (d = 3; d < fnum2; d++, p_face++) { if (intersect_triangle_ncull(p_orig, p_dir, p_vertex_pos + p_face_prvni[0], p_vertex_pos + p_face[0], p_vertex_pos + p_face[-1], &t, &u, &v) && t > 0.0f && t < 1.0f) return (TRUE); } break; } } return (FALSE); } else { return (TRUE); } } berusky2-0.12/src/komat/Kdtree.cpp0000644000175000017500000006265213674426075014000 00000000000000#include #include "3d_all.h" /* OBB -> AABB */ void kd_analizuj_scenu(EDIT_MESH_POLY * p_upoly, int polynum, EDIT_KONTEJNER ** p_ukont, int kontnum, BOD * p_min, BOD * p_max) { EDIT_MESH_POLY *p_poly; EDIT_KONTEJNER *p_kont; BOD kon(-FLT_MAX, -FLT_MAX, -FLT_MAX), zac(FLT_MAX, FLT_MAX, FLT_MAX), a; GLMATRIX *p_mat; int p, f; *p_min = zac; *p_max = kon; for (p = 0; p < polynum; p++) { p_poly = p_upoly + p; for (f = 0; f < p_poly->facenum; f++) { kd_min_max_bod(&p_poly->obb.aabb_min, p_min, p_max); kd_min_max_bod(&p_poly->obb.aabb_max, p_min, p_max); } } for (p = 0; p < kontnum; p++) { p_kont = p_ukont[p]; p_mat = kont_world_matrix(p_kont); transformuj_bod_matici_bod(&p_kont->obb.aabb_min, p_mat, &a); kd_min_max_bod(&a, p_min, p_max); transformuj_bod_matici_bod(&p_kont->obb.aabb_max, p_mat, &a); kd_min_max_bod(&a, p_min, p_max); } } /* Reprezentace sceny: - Prepracovat na KD stromy - KD strom + obalky pro dynamicke objekty */ void kd_poly_interval(EDIT_MESH_POLY * p_poly, int rovina, float *p_min, float *p_max, float h1, float h2) { float a, max = -FLT_MAX, min = FLT_MAX; int f; switch (rovina) { case 0: for (f = 0; f < p_poly->facenum; f++) { a = p_poly->p_koord[f].x; if (a < h1) a = h1; else if (a > h2) a = h2; if (a < min) min = a; if (a > max) max = a; } break; case 1: for (f = 0; f < p_poly->facenum; f++) { a = p_poly->p_koord[f].y; if (a < h1) a = h1; else if (a > h2) a = h2; if (a < min) min = a; if (a > max) max = a; } break; case 2: for (f = 0; f < p_poly->facenum; f++) { a = p_poly->p_koord[f].z; if (a < h1) a = h1; else if (a > h2) a = h2; if (a < min) min = a; if (a > max) max = a; } break; } *p_min = min; *p_max = max; } void kd_kont_interval(EDIT_KONTEJNER * p_kont, int rovina, float *p_min, float *p_max, float h1, float h2) { EDIT_OBJEKT *p_obj; float a, max = -FLT_MAX, min = FLT_MAX; int i, f; for (i = 0; i < p_kont->objektu; i++) { p_obj = p_kont->p_obj[i]; if (p_obj) { switch (rovina) { case 0: for (f = 0; f < p_obj->vertexnum; f++) { a = p_obj->p_vertex[f].x; if (a < h1) a = h1; else if (a > h2) a = h2; if (a < min) min = a; if (a > max) max = a; } break; case 1: for (f = 0; f < p_obj->vertexnum; f++) { a = p_obj->p_vertex[f].y; if (a < h1) a = h1; else if (a > h2) a = h2; if (a < min) min = a; if (a > max) max = a; } break; case 2: for (f = 0; f < p_obj->vertexnum; f++) { a = p_obj->p_vertex[f].z; if (a < h1) a = h1; else if (a > h2) a = h2; if (a < min) min = a; if (a > max) max = a; } break; } } else assert(0); } *p_min = min; *p_max = max; } /* Vrati rozmery sceny v min a max */ typedef struct _MIN_MAX { float min, max; int facu; int poly; int kont; } MIN_MAX; static int kd_comp_hrana(const void *p_hrana1, const void *p_hrana2) { return (ftoi((((MIN_MAX *) p_hrana1)->min - ((MIN_MAX *) p_hrana2)->min) * 10000.0f)); } #define MIN_X 2.0f #define MIN_Y 2.0f #define MIN_Z 2.0f #define MEZNI_KOEFICIENT 10.0f // 5 procent mezni odchylka #define MIN_OBJEKTU 4 #define MAX_HLOUBKA 100 #define DELTA_HRANICE 0.00001f // Vetsi cislo -> vyssi vaha u toho parametru // Mensi cislo -> parametr je mene vyznamny #define KOEF_FACE 1.0f #define KOEF_OBJEKT 3.0f int kd_hloubka_stromu; void kd_strom_vyrob_rec(EDIT_MESH_POLY ** p_poly, int polynum, EDIT_KONTEJNER ** p_kont, int kontnum, KD_BUNKA * p_prvni, int hloubka) { int objnum = polynum + kontnum; MIN_MAX *p_hran = (MIN_MAX *) alloca(sizeof(MIN_MAX) * objnum); EDIT_MESH_POLY **p_poly1; EDIT_KONTEJNER **p_kont1; float dx, dy, dz, h1, h2, koeficient; float best_koeficient, lajna; float pomer_face; float pomer_objektu; int best_p, best_strana; int p, f, dolni, celkem_facu, rovina; int z, z1, z2, objektu_dole, objektu_hore, facu_dole, facu_hore; dx = p_prvni->max.x - p_prvni->min.x; dy = p_prvni->max.y - p_prvni->min.y; dz = p_prvni->max.z - p_prvni->min.z; p_prvni->cislo = kd_hloubka_stromu++; /* Vloz vsechny objekty do jedne bunky */ if (objnum <= MIN_OBJEKTU || (dx <= MIN_X && dy <= MIN_Y && dz <= MIN_Z) || hloubka > MAX_HLOUBKA) { assert(objnum); p_prvni->polozek = objnum; p_prvni->p_polozka = (void **) mmalloc(sizeof(p_prvni->p_polozka[0]) * objnum); p_prvni->p_polozka_typ = (int *) mmalloc(sizeof(p_prvni->p_polozka_typ[0]) * objnum); p_prvni->rovina = 0; p_prvni->vzdal = 0.0f; p_prvni->p_next = NULL; for (p = 0; p < polynum; p++) { p_prvni->p_polozka[p] = p_poly[p]; p_prvni->p_polozka_typ[p] = KD_POLY; } for (f = 0; f < kontnum; f++) { p_prvni->p_polozka[p + f] = p_kont[f]; p_prvni->p_polozka_typ[p + f] = KD_MESH; } } else { // podle rozmeru bunky spocitam delici stranu // bude to ta nejdelsi if (dx > dy) { rovina = (dx > dz) ? 0 : 2; h1 = (dx > dz) ? p_prvni->min.x : p_prvni->min.z; h2 = (dx > dz) ? p_prvni->max.x : p_prvni->max.z; } else { rovina = (dy > dz) ? 1 : 2; h1 = (dy > dz) ? p_prvni->min.y : p_prvni->min.z; h2 = (dy > dz) ? p_prvni->max.y : p_prvni->max.z; } // podle souradnic rozdelim objekty do jedne roviny // Znam rovinu -> nasypu to do intervalu celkem_facu = 0; for (p = 0; p < polynum; p++) { kd_poly_interval(p_poly[p], rovina, &p_hran[p].min, &p_hran[p].max, h1, h2); p_hran[p].poly = p; p_hran[p].kont = K_CHYBA; celkem_facu += (p_hran[p].facu = p_poly[p]->facenum); } for (f = 0; f < kontnum; f++) { kd_kont_interval(p_kont[f], rovina, &p_hran[p + f].min, &p_hran[p + f].max, h1, h2); p_hran[p + f].poly = K_CHYBA; p_hran[p + f].kont = f; celkem_facu += (p_hran[p + f].facu = p_kont[f]->facu); } // setridim to qsort(p_hran, objnum, sizeof(p_hran[0]), kd_comp_hrana); // Spocitam pocty facu best_p = K_CHYBA; best_koeficient = 100.0f; for (p = 0; p < objnum - 1; p++) { if (p_hran[p + 1].min - p_hran[p].max > 0.0f) { for (f = 0, dolni = 0; f <= p; f++) dolni += p_hran[f].facu; // pouziju procentni koeficienty koeficient = ((float) dolni / (float) celkem_facu) * 100.0f; if (best_koeficient > fabs(50.0f - koeficient)) { best_koeficient = fabsf(50.0f - koeficient); best_p = p; best_strana = 3; } } } // Rozdelim to uprosted objektu if (best_p == K_CHYBA || best_koeficient > MEZNI_KOEFICIENT) { best_p = K_CHYBA; best_koeficient = 200.0f; for (p = 0; p < objnum; p++) { lajna = p_hran[p].min; facu_dole = objektu_dole = 0; facu_hore = objektu_hore = 0; for (z = 0; z < objnum; z++) { if (p_hran[z].max < lajna) { // cisty horni objekt objektu_dole++; facu_dole += p_hran[z].facu; // kolik je dole facu } if (p_hran[z].min > lajna) { // cisty dolni objekt objektu_hore++; facu_hore += p_hran[z].facu; // kolik je nahore facu } } if (facu_dole && objektu_dole && facu_hore && objektu_hore) { /* Zohlednit v koeficientu take pomer uspesnych objektu vzledem ke vsem objektum */ // procentualni odchylka poctu facu pomer_face = ((float) abs(facu_dole - facu_hore) / (float) celkem_facu) * 100.0f; // pomer rozdeleni pomer_objektu = ((float) abs(objektu_dole - objektu_hore) / (float) objnum) * 100.0f; // pomer uspesnosti // Jednotlive odchylky chceme mit co nejmensi koeficient = KOEF_OBJEKT * pomer_objektu + KOEF_FACE * pomer_face; if (best_koeficient > koeficient) { best_koeficient = koeficient; best_p = p; best_strana = 0; } } lajna = p_hran[p].max; facu_dole = objektu_dole = 0; facu_hore = objektu_hore = 0; for (z = 0; z < objnum; z++) { if (p_hran[z].max < lajna) { // cisty horni objekt objektu_dole++; facu_dole += p_hran[z].facu; // kolik je dole facu } if (p_hran[z].min > lajna) { // cisty dolni objekt objektu_hore++; facu_hore += p_hran[z].facu; // kolik je nahore facu } } if (facu_dole && objektu_dole && facu_hore && objektu_hore) { // procentualni odchylka poctu facu pomer_face = ((float) abs(facu_dole - facu_hore) / (float) celkem_facu) * 100.0f; // pomer rozdeleni pomer_objektu = ((float) abs(objektu_dole - objektu_hore) / (float) objnum) * 100.0f; // pomer uspesnosti // Jednotlive odchylky chceme mit co nejmensi koeficient = KOEF_OBJEKT * pomer_objektu + KOEF_FACE * pomer_face; if (best_koeficient > koeficient) { best_koeficient = koeficient; best_p = p; best_strana = 1; } } } } if (best_p == K_CHYBA) { // nepodarilo se najit vhodne rozdeleni - strcim to do jedne a hotovo p_prvni->polozek = objnum; p_prvni->p_polozka = (void **) mmalloc(sizeof(p_prvni->p_polozka[0]) * objnum); p_prvni->p_polozka_typ = (int *) mmalloc(sizeof(p_prvni->p_polozka_typ[0]) * objnum); p_prvni->rovina = 0; p_prvni->vzdal = 0.0f; p_prvni->p_next = NULL; for (p = 0; p < polynum; p++) { p_prvni->p_polozka[p] = p_poly[p]; p_prvni->p_polozka_typ[p] = KD_POLY; } for (f = 0; f < kontnum; f++) { p_prvni->p_polozka[p + f] = p_kont[f]; p_prvni->p_polozka_typ[p + f] = KD_MESH; } kprintf(1, "Shit-miss, depth %d num %d(%d/%d)", hloubka, objnum, polynum, kontnum); } else { /* Mam to rozdeleny 0 .. best_p -> spodni vetev best_p+1 .. polynum -> vrchni vetev */ p_prvni->polozek = 0; p_prvni->p_polozka = NULL; p_prvni->rovina = rovina; if (best_strana == 3) { p_prvni->vzdal = p_hran[best_p].max + fabsf(p_hran[best_p + 1].min - p_hran[best_p].max) * 0.5f; } else { p_prvni->vzdal = (best_strana) ? p_hran[best_p].max : p_hran[best_p].min; } p_prvni->p_next = (KD_BUNKA *) mmalloc(sizeof(p_prvni->p_next[0]) * 2); p_prvni->p_next[0].p_up = p_prvni; p_prvni->p_next[1].p_up = p_prvni; p_prvni->p_next[0].min = p_prvni->p_next[1].min = p_prvni->min; p_prvni->p_next[0].max = p_prvni->p_next[1].max = p_prvni->max; switch (rovina) { case 0: // osa x p_prvni->p_next[0].max.x = p_prvni->vzdal; p_prvni->p_next[1].min.x = p_prvni->vzdal; break; case 1: // osa y p_prvni->p_next[0].max.y = p_prvni->vzdal; p_prvni->p_next[1].min.y = p_prvni->vzdal; break; case 2: // osa z p_prvni->p_next[0].max.z = p_prvni->vzdal; p_prvni->p_next[1].min.z = p_prvni->vzdal; break; default: break; } // Poly-list 1 p_poly1 = (EDIT_MESH_POLY **) mmalloc(sizeof(p_poly1[0]) * polynum); p_kont1 = (EDIT_KONTEJNER **) mmalloc(sizeof(p_kont1[0]) * kontnum); for (z1 = 0, z2 = 0, p = 0; p < objnum; p++) { if (p_hran[p].min < p_prvni->vzdal) { if (p_hran[p].poly != K_CHYBA) { p_poly1[z1++] = p_poly[p_hran[p].poly]; } else { p_kont1[z2++] = p_kont[p_hran[p].kont]; } } } kd_strom_vyrob_rec(p_poly1, z1, p_kont1, z2, p_prvni->p_next, hloubka + 1); // Poly-list 2 for (z1 = 0, z2 = 0, p = 0; p < objnum; p++) { if (p_hran[p].max > p_prvni->vzdal) { if (p_hran[p].poly != K_CHYBA) { p_poly1[z1++] = p_poly[p_hran[p].poly]; } else { p_kont1[z2++] = p_kont[p_hran[p].kont]; } } } kd_strom_vyrob_rec(p_poly1, z1, p_kont1, z2, p_prvni->p_next + 1, hloubka + 1); free(p_poly1); free(p_kont1); } } } // Vyrobi kvadraticky strom -> prvni bunka je obalka cele sceny void kd_strom_vyrob(EDIT_MESH_POLY * p_upoly, int polynum, EDIT_KONTEJNER ** p_kont, int kontnum, KD_BUNKA * p_prvni) { EDIT_MESH_POLY **p_poly = (EDIT_MESH_POLY **) alloca(sizeof(p_poly[0]) * polynum); BOD min, max; int i, num; kd_hloubka_stromu = 0; kd_analizuj_scenu(p_upoly, polynum, p_kont, kontnum, &min, &max); p_prvni->min = min; p_prvni->max = max; num = 0; for (i = 0; i < polynum; i++) { if (!(p_upoly[i].kflag & KONT_NO_DRAW_SHADOW)) { p_poly[num++] = p_upoly + i; } } if (num || kontnum) kd_strom_vyrob_rec(p_poly, num, p_kont, kontnum, p_prvni, 1); else memset((void *) p_prvni, 0, sizeof(p_prvni[0])); p_prvni->cislo = kd_hloubka_stromu++; } /* typedef struct _KD_BUNKA { int polozek; void **p_polozka; //pole polozek (poly/kont) int *p_polozka_typ; // typy polozek (kontejner/poly) struct _KD_BUNKA *p_up; // otec stromu struct _KD_BUNKA *p_next; // dalsich 2 podstromu nebo nic } KD_BUNKA; */ void kd_strom_zrus(KD_BUNKA * p_prvni) { //KD_BUNKA *p_next = p_prvni->p_next; //free(p_prvni); } void kd_strom_tiskni(KD_BUNKA * p_prvni, int hloubka) { char pom[300]; int i; for (i = 0; i < hloubka; i++) pom[i] = ' '; pom[i] = 0; if (!p_prvni->p_next) { kprintf(1, "%sH %d P %d", pom, hloubka, p_prvni->polozek); } else { kprintf(1, "%sH", pom); kd_strom_tiskni(p_prvni->p_next, hloubka + 1); kd_strom_tiskni(p_prvni->p_next + 1, hloubka + 1); } } int kd_intersect_kostku(BOD * p_a, BOD * p_b, BOD * p_min, BOD * p_max) { // primka a->b float tn = 0.0f, tf = FLT_MAX; float t1, t2, t; BOD Q; int hits; hits = kd_je_bod_v_kostce(p_a, p_min, p_max) + kd_je_bod_v_kostce(p_b, p_min, p_max); if (hits) { return (hits); } // p_a->p_b --- blizkost k a vektor_sub(p_b, p_a, &Q); // X-Souradnice t1 = p_max->x - p_a->x; // defaultne Tf t2 = p_min->x - p_a->x; // defaultne Tn if (Q.x < 0.0f) { t = t1; t1 = t2; t2 = t; } if (Q.x != 0) { tn = MAX(t2 / Q.x, tn); tf = MIN(t1 / Q.x, tf); } if (tn > tf || tf < 0.0f) return (FALSE); // Y-Souradnice t1 = p_max->y - p_a->y; // defaultne Tf t2 = p_min->y - p_a->y; // defaultne Tn if (Q.y < 0.0f) { t = t1; t1 = t2; t2 = t; } if (Q.y != 0) { tn = MAX(t2 / Q.y, tn); tf = MIN(t1 / Q.y, tf); } if (tn > tf || tf < 0.0f) return (FALSE); // Z-Souradnice t1 = p_max->z - p_a->z; // defaultne Tf t2 = p_min->z - p_a->z; // defaultne Tn if (Q.z < 0.0f) { t = t1; t1 = t2; t2 = t; } if (Q.z != 0) { tn = MAX(t2 / Q.z, tn); tf = MIN(t1 / Q.z, tf); } if (tn > tf || tf < 0.0f) return (FALSE); return (1); } int kd_intersect_kostku_bod(BOD * p_a, BOD * p_b, BOD * p_min, BOD * p_max, BOD * p_p, float *p_t) { // primka a->b float tn = 0.0f, tf = FLT_MAX; float t1, t2, t; BOD Q; *p_t = 0.0f; if (kd_je_bod_v_kostce(p_a, p_min, p_max)) { *p_p = *p_a; return (kd_je_bod_v_kostce(p_b, p_min, p_max) ? 2 : 1); } // p_a->p_b --- blizkost k a vektor_sub(p_b, p_a, &Q); // X-Souradnice t1 = p_max->x - p_a->x; // defaultne Tf t2 = p_min->x - p_a->x; // defaultne Tn if (Q.x < 0.0f) { t = t1; t1 = t2; t2 = t; } if (Q.x != 0) { tn = MAX(t2 / Q.x, tn); tf = MIN(t1 / Q.x, tf); } if (tn > tf || tf < 0.0f) return (FALSE); // Y-Souradnice t1 = p_max->y - p_a->y; // defaultne Tf t2 = p_min->y - p_a->y; // defaultne Tn if (Q.y < 0.0f) { t = t1; t1 = t2; t2 = t; } if (Q.y != 0) { tn = MAX(t2 / Q.y, tn); tf = MIN(t1 / Q.y, tf); } if (tn > tf || tf < 0.0f) return (FALSE); // Z-Souradnice t1 = p_max->z - p_a->z; // defaultne Tf t2 = p_min->z - p_a->z; // defaultne Tn if (Q.z < 0.0f) { t = t1; t1 = t2; t2 = t; } if (Q.z != 0) { tn = MAX(t2 / Q.z, tn); tf = MIN(t1 / Q.z, tf); } if (tn > tf || tf < 0.0f) return (FALSE); *p_t = tn; p_p->x = p_a->x + Q.x * tn; p_p->y = p_a->y + Q.y * tn; p_p->z = p_a->z + Q.z * tn; return (3); } int kd_intersect_kostku_bod_inter(BOD * p_a, BOD * p_b, BOD * p_min, BOD * p_max, BOD * p_p, float *p_t) { // primka a->b float tn = 0.0f, tf = FLT_MAX; float t1, t2, t; BOD Q; // p_a->p_b --- blizkost k a vektor_sub(p_b, p_a, &Q); // X-Souradnice t1 = p_max->x - p_a->x; // defaultne Tf t2 = p_min->x - p_a->x; // defaultne Tn if (Q.x < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2 / Q.x, tn); tf = MIN(t1 / Q.x, tf); if (tn > tf || tf < 0.0f) return (FALSE); // Y-Souradnice t1 = p_max->y - p_a->y; // defaultne Tf t2 = p_min->y - p_a->y; // defaultne Tn if (Q.y < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2 / Q.y, tn); tf = MIN(t1 / Q.y, tf); if (tn > tf || tf < 0.0f) return (FALSE); // Z-Souradnice t1 = p_max->z - p_a->z; // defaultne Tf t2 = p_min->z - p_a->z; // defaultne Tn if (Q.z < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2 / Q.z, tn); tf = MIN(t1 / Q.z, tf); if (tn > tf || tf < 0.0f) return (FALSE); *p_t = tf; p_p->x = p_a->x + Q.x * tf; p_p->y = p_a->y + Q.y * tf; p_p->z = p_a->z + Q.z * tf; return (TRUE); } int kd_intersect_kostku_dir(BOD * p_orig, BOD * p_dir, BOD * p_min, BOD * p_max) { BOD p; vektor_add(p_orig, p_dir, &p); return (kd_intersect_kostku(p_orig, &p, p_min, p_max)); } /* float kd_vzdal_bod_kostka(BOD *p_a, BOD *p_min, BOD *p_max) { BOD stred,v1,v2; BOD delka; float len; kd_stred_bunky(p_min,p_max,&stred); vektor_sub(p_max,&stred,&delka); vektor_sub(p_a,&stred,&v1); v2 = v1; len = vektor_norm_mult_vektor(&v2,&delka); if(fabsf(v1.x) <= fabsf(v2.x) && fabsf(v1.y) <= fabsf(v2.y) && fabsf(v1.z) <= fabsf(v2.z)) { return(0.0f); // je uvnitr } else { return(vektor_velikost(vektor_sub(&v1,&v2,&v1))); } } */ /* Udela strom z poly */ int kd_visibility(BOD * p_min, BOD * p_max, GLMATRIX * p_m) { int i, j, xplane, yplane, xa, ya, m; float x, y, z, xt, yt, zt, w, fx, fy, fw; if (!kd_min_max_valid(p_min, p_max)) return (FALSE); // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for (i = 0, j = 0; i < 8; i++) { xt = (i & 0x1) ? p_max->x : p_min->x; yt = (i & 0x2) ? p_max->y : p_min->y; zt = (i & 0x4) ? p_max->z : p_min->z; x = p_m->_11 * xt + p_m->_21 * yt + p_m->_31 * zt + p_m->_41; y = p_m->_12 * xt + p_m->_22 * yt + p_m->_32 * zt + p_m->_42; z = p_m->_13 * xt + p_m->_23 * yt + p_m->_33 * zt + p_m->_43; w = p_m->_14 * xt + p_m->_24 * yt + p_m->_34 * zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if (m) j++; // bod lezi v obrazovce -> automaticky uspech if (m && -w <= x && x <= w && -w <= y && y <= w) { return (TRUE); } fx = (float) fabs(x); fy = (float) fabs(y); fw = (float) fabs(w); if (fx / fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if (fy / fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; } // if(!j) // dbgprintf("j = 0"); return ((j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } int kd_visibility_full(BOD * p_min, BOD * p_max, GLMATRIX * p_m) { int i, j, xplane, yplane, xa, ya, m; int hits = 0; float x, y, z, xt, yt, zt, w, fx, fy, fw; if (!kd_min_max_valid(p_min, p_max)) return (FALSE); // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for (i = 0, j = 0; i < 8; i++) { xt = (i & 0x1) ? p_max->x : p_min->x; yt = (i & 0x2) ? p_max->y : p_min->y; zt = (i & 0x4) ? p_max->z : p_min->z; x = p_m->_11 * xt + p_m->_21 * yt + p_m->_31 * zt + p_m->_41; y = p_m->_12 * xt + p_m->_22 * yt + p_m->_32 * zt + p_m->_42; z = p_m->_13 * xt + p_m->_23 * yt + p_m->_33 * zt + p_m->_43; w = p_m->_14 * xt + p_m->_24 * yt + p_m->_34 * zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if (m) j++; // bod lezi v obrazovce -> automaticky uspech if (m && -w <= x && x <= w && -w <= y && y <= w) { hits++; continue; } fx = (float) fabs(x); fy = (float) fabs(y); fw = (float) fabs(w); if (fx / fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if (fy / fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; } // if(!j) // dbgprintf("j = 0"); return ((hits == 8) ? hits : (j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } void kresli_obalku(BOD min, BOD max, dword barva, GLMATRIX * p_tr) { BOD stred, body[8 * 6]; float dx, dy, dz; int i; vektor_sub(&max, &min, &stred); vektor_mult_skalar(&stred, 0.05f, &stred); vektor_sub(&min, &stred, &min); vektor_add(&max, &stred, &max); dx = max.x - min.x, dy = max.y - min.y, dz = max.z - min.z; dx *= 0.3f; dy *= 0.3f; dz *= 0.3f; vektor_set_all(body + (0 * 6), min.x, min.y, min.z); vektor_set_all(body + (0 * 6 + 1), min.x + dx, min.y, min.z); vektor_set_all(body + (0 * 6 + 2), min.x, min.y, min.z); vektor_set_all(body + (0 * 6 + 3), min.x, min.y + dy, min.z); vektor_set_all(body + (0 * 6 + 4), min.x, min.y, min.z); vektor_set_all(body + (0 * 6 + 5), min.x, min.y, min.z + dz); vektor_set_all(body + (1 * 6), max.x, min.y, min.z); vektor_set_all(body + (1 * 6 + 1), max.x - dx, min.y, min.z); vektor_set_all(body + (1 * 6 + 2), max.x, min.y, min.z); vektor_set_all(body + (1 * 6 + 3), max.x, min.y + dy, min.z); vektor_set_all(body + (1 * 6 + 4), max.x, min.y, min.z); vektor_set_all(body + (1 * 6 + 5), max.x, min.y, min.z + dz); vektor_set_all(body + (2 * 6), min.x, min.y, max.z); vektor_set_all(body + (2 * 6 + 1), min.x + dx, min.y, max.z); vektor_set_all(body + (2 * 6 + 2), min.x, min.y, max.z); vektor_set_all(body + (2 * 6 + 3), min.x, min.y + dy, max.z); vektor_set_all(body + (2 * 6 + 4), min.x, min.y, max.z); vektor_set_all(body + (2 * 6 + 5), min.x, min.y, max.z - dz); vektor_set_all(body + (3 * 6), max.x, min.y, max.z); vektor_set_all(body + (3 * 6 + 1), max.x - dx, min.y, max.z); vektor_set_all(body + (3 * 6 + 2), max.x, min.y, max.z); vektor_set_all(body + (3 * 6 + 3), max.x, min.y + dy, max.z); vektor_set_all(body + (3 * 6 + 4), max.x, min.y, max.z); vektor_set_all(body + (3 * 6 + 5), max.x, min.y, max.z - dz); vektor_set_all(body + (4 * 6), min.x, max.y, min.z); vektor_set_all(body + (4 * 6 + 1), min.x + dx, max.y, min.z); vektor_set_all(body + (4 * 6 + 2), min.x, max.y, min.z); vektor_set_all(body + (4 * 6 + 3), min.x, max.y - dy, min.z); vektor_set_all(body + (4 * 6 + 4), min.x, max.y, min.z); vektor_set_all(body + (4 * 6 + 5), min.x, max.y, min.z + dz); vektor_set_all(body + (5 * 6), max.x, max.y, min.z); vektor_set_all(body + (5 * 6 + 1), max.x - dx, max.y, min.z); vektor_set_all(body + (5 * 6 + 2), max.x, max.y, min.z); vektor_set_all(body + (5 * 6 + 3), max.x, max.y - dy, min.z); vektor_set_all(body + (5 * 6 + 4), max.x, max.y, min.z); vektor_set_all(body + (5 * 6 + 5), max.x, max.y, min.z + dz); vektor_set_all(body + (6 * 6), min.x, max.y, max.z); vektor_set_all(body + (6 * 6 + 1), min.x + dx, max.y, max.z); vektor_set_all(body + (6 * 6 + 2), min.x, max.y, max.z); vektor_set_all(body + (6 * 6 + 3), min.x, max.y - dy, max.z); vektor_set_all(body + (6 * 6 + 4), min.x, max.y, max.z); vektor_set_all(body + (6 * 6 + 5), min.x, max.y, max.z - dz); vektor_set_all(body + (7 * 6), max.x, max.y, max.z); vektor_set_all(body + (7 * 6 + 1), max.x - dx, max.y, max.z); vektor_set_all(body + (7 * 6 + 2), max.x, max.y, max.z); vektor_set_all(body + (7 * 6 + 3), max.x, max.y - dy, max.z); vektor_set_all(body + (7 * 6 + 4), max.x, max.y, max.z); vektor_set_all(body + (7 * 6 + 5), max.x, max.y, max.z - dz); glColor4ubv((byte *) & barva); if (p_tr) { glBegin(GL_LINES); for (i = 0; i < 8 * 6; i++) glVertex3fv((const float *) transformuj_bod_bod_matici(body + i, p_tr)); glEnd(); } else { glBegin(GL_LINES); for (i = 0; i < 8 * 6; i++) glVertex3fv((const float *) (body + i)); glEnd(); } } berusky2-0.12/src/komat/3dproject.h0000644000175000017500000001265013674426075014115 00000000000000/* Projekcni funkce */ #ifndef __3D_PROJECT_H_ #define __3D_PROJECT_H_ int transf_3d_2d(float p_x, float p_y, float p_z, int *p_tx, int *p_ty, float *p_tz, GLMATRIX * p_word, GLMATRIX * p_cam, GLMATRIX * p_proj, int x_c, int y_c, int xs, int ys, float z_near, float z_far); int transf_3d_2d_word(float p_x, float p_y, float p_z, int *p_tx, int *p_ty, float *p_tz, GLMATRIX * p_cam, GLMATRIX * p_proj, int x_c, int y_c, int xs, int ys, float z_near, float z_far); inline int transf_3d_2d_matrix(float p_x, float p_y, float p_z, int *p_tx, int *p_ty, float *p_tz, GLMATRIX * p_mat, int x_c, int y_c, int xs, int ys, float z_near, float z_far); void transf_2d_3d(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys); void transf_2d_3d_world(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_world, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys); inline void transf_2d_3d_matrix(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_m, dword x_c, dword y_c, dword xs, dword ys); void transf_2d_3d_z(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far); void transf_2d_3d_z_world(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_world, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far); inline void transf_2d_3d_z_matrix(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_m, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far); //void transf_2d_3d_z_matrix(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX *p_mat, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far) //void calc_2d_3d_z_matrix(GLMATRIX *p_cam, GLMATRIX *p_proj, GLMATRIX *p_vysl) inline int transf_3d_2d_matrix(float p_x, float p_y, float p_z, int *p_tx, int *p_ty, float *p_tz, GLMATRIX * p_mat, int x_c, int y_c, int xs, int ys, float z_near, float z_far) { float x, y, z, w; x_c >>= 1; y_c >>= 1; x = p_mat->_11 * (p_x) + p_mat->_21 * (p_y) + p_mat->_31 * (p_z) + p_mat->_41; y = p_mat->_12 * (p_x) + p_mat->_22 * (p_y) + p_mat->_32 * (p_z) + p_mat->_42; z = p_mat->_13 * (p_x) + p_mat->_23 * (p_y) + p_mat->_33 * (p_z) + p_mat->_43; w = p_mat->_14 * (p_x) + p_mat->_24 * (p_y) + p_mat->_34 * (p_z) + p_mat->_44; if (w == 0.0f) return (FALSE); if (-w <= z && z <= w && -w <= x && x <= w && -w < y && y <= w) { *p_tx = ftoi(x_c * (x / w + 1)) + xs; *p_ty = ftoi(y_c * (1 - y / w)) + ys; *p_tz = z_near + ((z / w + 1) * 0.5f) * (z_far - z_near); return (TRUE); } else { return (FALSE); } } inline void transf_2d_3d_matrix(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_m, dword x_c, dword y_c, dword xs, dword ys) { float x, y, z; float x3, y3, z3, w3; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_x / x_c - 1; y = 1 - p_y / y_c; z = 2 * p_z - 1; x3 = p_m->_11 * x + p_m->_21 * y + p_m->_31 * z + p_m->_41; y3 = p_m->_12 * x + p_m->_22 * y + p_m->_32 * z + p_m->_42; z3 = p_m->_13 * x + p_m->_23 * y + p_m->_33 * z + p_m->_43; w3 = p_m->_14 * x + p_m->_24 * y + p_m->_34 * z + p_m->_44; *p_tx = x3 / w3; *p_ty = y3 / w3; *p_tz = z3 / w3; } inline void transf_2d_3d_z_matrix(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_m, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far) { float a, b, c; float x, y, z; float x3, y3, z3, w3; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_x / x_c - 1; y = 1 - p_y / y_c; c = z_far - z_near; a = (z_near + z_far) / c; b = -(z_near * z_far) / c; z = a + b / p_z; x3 = p_m->_11 * x + p_m->_21 * y + p_m->_31 * z + p_m->_41; y3 = p_m->_12 * x + p_m->_22 * y + p_m->_32 * z + p_m->_42; z3 = p_m->_13 * x + p_m->_23 * y + p_m->_33 * z + p_m->_43; w3 = p_m->_14 * x + p_m->_24 * y + p_m->_34 * z + p_m->_44; *p_tx = x3 / w3; *p_ty = y3 / w3; *p_tz = z3 / w3; } inline void transf_3d_2d_matrix_float_text(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_mat, float faktor) { float x, y, z, w; x = p_mat->_11 * (p_x) + p_mat->_21 * (p_y) + p_mat->_31 * (p_z) + p_mat->_41; y = p_mat->_12 * (p_x) + p_mat->_22 * (p_y) + p_mat->_32 * (p_z) + p_mat->_42; z = p_mat->_13 * (p_x) + p_mat->_23 * (p_y) + p_mat->_33 * (p_z) + p_mat->_43; w = p_mat->_14 * (p_x) + p_mat->_24 * (p_y) + p_mat->_34 * (p_z) + p_mat->_44; *p_tx = (x / w) * faktor; *p_ty = (y / w) * faktor; *p_tz = (z / w) * faktor; } inline void transf_2d_3d_matrix_float_text(float p_tx, float p_ty, float p_tz, float *p_x, float *p_y, float *p_z, GLMATRIX * p_mat, float faktor) { float x, y, z, w; w = 1; x = (p_tx * w) / faktor; y = (p_ty * w) / faktor; z = (p_tz * w) / faktor; *p_x = p_mat->_11 * x + p_mat->_21 * y + p_mat->_31 * z + p_mat->_41; *p_y = p_mat->_12 * x + p_mat->_22 * y + p_mat->_32 * z + p_mat->_42; *p_z = p_mat->_13 * x + p_mat->_23 * y + p_mat->_33 * z + p_mat->_43; //*p_w = p_mat->_14*x + p_mat->_24*y + p_mat->_34*z + p_mat->_44; } #endif berusky2-0.12/src/komat/Berusky3d_ini.h0000644000175000017500000000163413674426075014732 00000000000000/* H */ #ifndef __BERINI_H #define __BERINI_H extern int mouse_move; extern bool export_level; int spracuj_spravy(int param); int nahraj_konfig(void); void konec(int konec); #define XRES_MENU 1024 #define YRES_MENU 768 /* Moved to config.h #ifndef INI_FILE_NAME #define INI_FILE_NAME "berusky3d.ini" #endif #ifdef LINUX #ifndef INI_USER_DIRECTORY #define INI_USER_DIRECTORY "~/.berusky2" #endif #ifndef INI_SAVES_DIRECTORY #define INI_SAVES_DIRECTORY "~/.berusky2/Save" #endif #ifndef INI_PROFILE_DIRECTORY #define INI_PROFILE_DIRECTORY "~/.berusky2/Save/profiles" #endif #ifndef INI_FILE_GLOBAL_DIR #define INI_FILE_GLOBAL_DIR "/var/games/berusky2/" #endif #endif */ #ifdef LINUX #define INI_FILE_GLOBAL INI_FILE_GLOBAL_DIR "/" INI_FILE_NAME #define INI_FILE_USER INI_USER_DIRECTORY "/" INI_FILE_NAME #define INI_FILE_LOCAL "./" INI_FILE_NAME #endif #endif berusky2-0.12/src/komat/obbo.cpp0000644000175000017500000006766613674426075013515 00000000000000/* OBB a jeho stromy */ #include #include "3d_all.h" #define stejny_bod(a,b) (a->x == b->x && a->y == b->y && a->z == b->z) /* By Miguel Gomez,Gamasutra,October 18, 1999 */ int obb_intersect_obb(OBB_OLD * p_obb1, OBB_OLD * p_obb2) { BOD *p_a = &p_obb1->obb_len; BOD *p_A = p_obb1->obb; BOD *p_Pa = &p_obb1->obb_stred; BOD *p_b = &p_obb2->obb_len; BOD *p_B = p_obb2->obb; BOD *p_Pb = &p_obb2->obb_stred; /* BOD a; // delky ve smerech BOD Ax,Ay,Az;// jednotkovy smery BOD Pa; // pozice BOD b; // delky ve smerech BOD Bx,By,Bz;// jednotkovy smery BOD Pb; // pozice */ //ALGORITHM: Use the separating axis test for all 15 potential //separating axes. If a separating axis could not be found, the two //boxes overlap. BOD v, T, Rx, Ry, Rz; float ra, rb, t; vektor_sub(p_Pb, p_Pa, &v); T.x = vektor_dot_product(&v, p_A); Rx.x = vektor_dot_product(p_A, p_B); Rx.y = vektor_dot_product(p_A, p_B + 1); Rx.z = vektor_dot_product(p_A, p_B + 2); ra = p_a->x; rb = p_b->x * fabsf(Rx.x) + p_b->y * fabsf(Rx.y) + p_b->z * fabsf(Rx.z); t = fabsf(T.x); if (t > ra + rb) return (FALSE); T.y = vektor_dot_product(&v, p_A + 1); Ry.x = vektor_dot_product(p_A + 1, p_B); Ry.y = vektor_dot_product(p_A + 1, p_B + 1); Ry.z = vektor_dot_product(p_A + 1, p_B + 2); ra = p_a->y; rb = p_b->x * fabsf(Ry.x) + p_b->y * fabsf(Ry.y) + p_b->z * fabsf(Ry.z); t = fabsf(T.y); if (t > ra + rb) return (FALSE); T.z = vektor_dot_product(&v, p_A + 2); Rz.x = vektor_dot_product(p_A + 2, p_B); Rz.y = vektor_dot_product(p_A + 2, p_B + 1); Rz.z = vektor_dot_product(p_A + 2, p_B + 2); ra = p_a->z; rb = p_b->x * fabsf(Rz.x) + p_b->y * fabsf(Rz.y) + p_b->z * fabsf(Rz.z); t = fabsf(T.z); if (t > ra + rb) return (FALSE); //B->A v(x) ra = p_a->x * fabsf(Rx.x) + p_a->y * fabsf(Ry.x) + p_a->z * fabsf(Rz.x); rb = p_b->x; t = fabsf(T.x * Rx.x + T.y * Ry.x + T.z * Rz.x); if (t > ra + rb) return (FALSE); //B->A v(y) ra = p_a->x * fabsf(Rx.y) + p_a->y * fabsf(Ry.y) + p_a->z * fabsf(Rz.y); rb = p_b->y; t = fabsf(T.y * Rx.y + T.y * Ry.y + T.z * Rz.y); if (t > ra + rb) return (FALSE); //B->A v(z) ra = p_a->x * fabsf(Rx.z) + p_a->y * fabsf(Ry.z) + p_a->z * fabsf(Rz.z); rb = p_b->z; t = fabsf(T.z * Rx.z + T.y * Ry.z + T.z * Rz.z); if (t > ra + rb) return (FALSE); //9 cross products //L = A0 x B0 ra = p_a->y * fabsf(Rz.x) + p_a->z * fabsf(Ry.z); rb = p_b->y * fabsf(Rx.z) + p_b->z * fabsf(Rx.y); t = fabsf(T.z * Ry.x - T.y * Rz.x); if (t > ra + rb) return (FALSE); //L = A0 x B1 ra = p_a->y * fabsf(Rz.y) + p_a->z * fabsf(Ry.y); rb = p_b->x * fabsf(Rx.z) + p_b->z * fabsf(Rx.x); t = fabsf(T.z * Ry.y - T.y * Rz.y); if (t > ra + rb) return (FALSE); //L = A0 x B2 ra = p_a->y * fabsf(Rz.z) + p_a->z * fabsf(Ry.z); rb = p_b->x * fabsf(Rx.y) + p_b->y * fabsf(Rx.x); t = fabsf(T.z * Ry.z - T.y * Rz.z); if (t > ra + rb) return (FALSE); //L = A1 x B0 ra = p_a->x * fabsf(Rz.x) + p_a->z * fabsf(Rx.x); rb = p_b->y * fabsf(Ry.z) + p_b->z * fabsf(Ry.y); t = fabsf(T.x * Rz.x - T.z * Rx.x); if (t > ra + rb) return (FALSE); //L = A1 x B1 ra = p_a->x * fabsf(Rz.y) + p_a->z * fabsf(Rx.y); rb = p_b->x * fabsf(Ry.z) + p_b->z * fabsf(Ry.x); t = fabsf(T.x * Rz.y - T.z * Rx.y); if (t > ra + rb) return (FALSE); //L = A1 x B2 ra = p_a->x * fabsf(Rz.z) + p_a->z * fabsf(Rx.z); rb = p_b->x * fabsf(Ry.y) + p_b->y * fabsf(Ry.x); t = fabsf(T.x * Rz.z - T.z * Rx.z); if (t > ra + rb) return (FALSE); //L = A2 x B0 ra = p_a->x * fabsf(Ry.x) + p_a->y * fabsf(Rx.x); rb = p_b->y * fabsf(Rz.z) + p_b->z * fabsf(Rz.y); t = fabsf(T.y * Rx.x - T.x * Ry.x); if (t > ra + rb) return (FALSE); //L = A2 x B1 ra = p_a->x * fabsf(Ry.y) + p_a->y * fabsf(Rx.y); rb = p_b->x * fabsf(Rz.z) + p_b->z * fabsf(Rz.x); t = fabsf(T.y * Rx.y - T.x * Ry.y); if (t > ra + rb) return (FALSE); //L = A2 x B2 ra = p_a->x * fabsf(Ry.z) + p_a->y * fabsf(Rx.z); rb = p_b->x * fabsf(Rz.y) + p_b->y * fabsf(Rz.x); t = fabsf(T.y * Rx.z - T.x * Ry.z); if (t > ra + rb) return (FALSE); return (TRUE); } // Prusecik obalky OBB_OLD a primky int obb_intersect_line(OBB_OLD * p_obb, BOD * p_orig, BOD * p_dir) { BOD *p_a = &p_obb->obb_len; BOD *p_A = p_obb->obb; BOD *p_Pa = &p_obb->obb_stred; BOD t, o, dir, min; vektor_sub(p_orig, p_Pa, &t); o.x = vektor_dot_product(p_A, &t); o.y = vektor_dot_product(p_A + 1, &t); o.z = vektor_dot_product(p_A + 2, &t); dir.x = vektor_dot_product(p_A, p_dir); dir.y = vektor_dot_product(p_A + 1, p_dir); dir.z = vektor_dot_product(p_A + 2, p_dir); vektor_add(&o, &dir, &t); return (kd_intersect_kostku(&o, &t, vektor_mult_skalar(p_a, -1.0f, &min), p_a)); } int obb_intersect_line_dist(OBB_OLD * p_obb, BOD * p_orig, BOD * p_dir) { BOD *p_a = &p_obb->obb_len; BOD *p_A = p_obb->obb; BOD *p_Pa = &p_obb->obb_stred; BOD p; float tn; BOD t, o, dir, min; int ret; vektor_sub(p_orig, p_Pa, &t); o.x = vektor_dot_product(p_A, &t); o.y = vektor_dot_product(p_A + 1, &t); o.z = vektor_dot_product(p_A + 2, &t); dir.x = vektor_dot_product(p_A, p_dir); dir.y = vektor_dot_product(p_A + 1, p_dir); dir.z = vektor_dot_product(p_A + 2, p_dir); vektor_add(&o, &dir, &t); ret = kd_intersect_kostku_bod(&o, &t, vektor_mult_skalar(p_a, -1.0f, &min), p_a, &p, &tn); return ((tn < 1.0f) ? ret : FALSE); } // prevod kostky na hranicni body void obb_body(OBB_OLD * p_obbs) { BOD *p_len = &p_obbs->obb_len; BOD *p_obb = p_obbs->obb; BOD *p_stred = &p_obbs->obb_stred; BOD *p_hran = p_obbs->obb_hran; BOD a1, a2, a3; BOD a12, a22, a32; vektor_mult_skalar(p_obb + 0, p_len->x, &a1); vektor_mult_skalar(p_obb + 1, p_len->y, &a2); vektor_mult_skalar(p_obb + 2, p_len->z, &a3); vektor_mult_skalar(&a1, 2.0f, &a12); vektor_mult_skalar(&a2, 2.0f, &a22); vektor_mult_skalar(&a3, 2.0f, &a32); vektor_sub(p_stred, &a1, p_hran); vektor_sub(p_hran, &a2, p_hran); vektor_sub(p_hran, &a3, p_hran); vektor_add(p_hran, &a12, p_hran + 1); vektor_add(p_hran, &a32, p_hran + 2); vektor_add(p_hran + 1, &a32, p_hran + 3); vektor_add(p_hran, &a22, p_hran + 4); vektor_add(p_hran + 1, &a22, p_hran + 5); vektor_add(p_hran + 2, &a22, p_hran + 6); vektor_add(p_hran + 3, &a22, p_hran + 7); } void obb_obalka(GLMATRIX * p_mat, OBB_OLD * p_obb, BOD * p_min, BOD * p_max) { BOD a; int i; if (p_mat) { transformuj_bod_matici_bod(p_obb->obb_hran, p_mat, &a); } else { a = p_obb->obb_hran[0]; } *p_min = *p_max = a; for (i = 1; i < 8; i++) { if (p_mat) { transformuj_bod_matici_bod(p_obb->obb_hran + i, p_mat, &a); } else { a = p_obb->obb_hran[i]; } kd_min_max_bod(&a, p_min, p_max); } } // slepi OBB_OLD do vysledneho OBB_OLD void obb_slep(OBB_OLD * p_vys, OBB_OLD * p_list, int num) { GLMATRIX m; BOD bmin, bmax; BOD nmin, nmax; BOD min, max; OBB_OLD *p_obb; int i, j; float obsah, bobsah = FLT_MAX; int bi = -1; if (num == 1) { *p_vys = p_list[0]; return; } /* 1. Test AABB obalky */ init_matrix(&m); vektor_set_all(&bmin, FLT_MAX, FLT_MAX, FLT_MAX); vektor_set_all(&bmax, -FLT_MAX, -FLT_MAX, -FLT_MAX); for (j = 0; j < num; j++) { kd_min_max_bod(&p_list[j].aabb_min, &bmin, &bmax); kd_min_max_bod(&p_list[j].aabb_max, &bmin, &bmax); } obsah = kd_bunka_obsah(&bmin, &bmax); if (obsah < bobsah) { bi = -1; bobsah = obsah; nmin = bmin; nmax = bmax; } /* 2. Test OBB_OLD obalky */ for (i = 0; i < num; i++) { p_obb = p_list + i; // Transformuje World Space -> OBB_OLD mat_rot(&m, p_obb->obb, p_obb->obb + 1, p_obb->obb + 2); vektor_set_all(&bmin, FLT_MAX, FLT_MAX, FLT_MAX); vektor_set_all(&bmax, -FLT_MAX, -FLT_MAX, -FLT_MAX); // Transformuje ostatni obalky do teto obalky for (j = 0; j < num; j++) { obb_obalka(&m, p_list + j, &min, &max); kd_min_max_bod(&min, &bmin, &bmax); kd_min_max_bod(&max, &bmin, &bmax); } obsah = kd_bunka_obsah(&bmin, &bmax); if (obsah < bobsah) { bi = i; bobsah = obsah; nmin = bmin; nmax = bmax; } } assert(bi < num); if (bi == -1) { p_vys->aabb_min = nmin; p_vys->aabb_max = nmax; kd_stred_bunky(&nmin, &nmax, &p_vys->obb_stred); kd_len_bunky(&nmin, &nmax, &p_vys->obb_len); vektor_set_all(p_vys->obb, 1, 0, 0); vektor_set_all(p_vys->obb + 1, 0, 1, 0); vektor_set_all(p_vys->obb + 2, 0, 0, 1); obb_body(p_vys); } else { p_obb = p_list + bi; mat_rot(&m, p_obb->obb, p_obb->obb + 1, p_obb->obb + 2); invert_matrix_copy(&m, &m); kd_stred_bunky(&nmin, &nmax, &min); transformuj_bod_matici_bod(&min, &m, &p_vys->obb_stred); kd_len_bunky(&nmin, &nmax, &p_vys->obb_len); p_vys->obb[0] = p_list[bi].obb[0]; p_vys->obb[1] = p_list[bi].obb[1]; p_vys->obb[2] = p_list[bi].obb[2]; obb_body(p_vys); obb_aabb(p_vys); } } void obb_slep_aabb(OBB_OLD * p_vys, OBB_OLD * p_list, int num) { BOD *p_min, *p_max; OBB_OLD *p_obb; int i; if (num == 1) { *p_vys = p_list[0]; return; } p_min = &p_vys->aabb_min; p_max = &p_vys->aabb_max; p_obb = p_list; *p_min = p_obb->aabb_min; *p_max = p_obb->aabb_max; for (i = 1; i < num; i++) { p_obb = p_list + i; kd_min_max_bod(&p_obb->aabb_min, p_min, p_max); kd_min_max_bod(&p_obb->aabb_max, p_min, p_max); } kd_korekce_bunky(p_min, p_max); kd_stred_bunky(p_min, p_max, &p_vys->obb_stred); kd_len_bunky(p_min, p_max, &p_vys->obb_len); vektor_set_all(p_vys->obb, 1, 0, 0); vektor_set_all(p_vys->obb + 1, 0, 1, 0); vektor_set_all(p_vys->obb + 2, 0, 0, 1); obb_body(p_vys); } float obb_calc_obalka_obj(EDIT_OBJEKT * p_obj, BOD * p_vx, BOD * p_vy, BOD * p_vz, BOD * p_dist, BOD * p_stred) { BOD min, max, tmp; GLMATRIX m; if (!p_obj->p_vertex) return (0); mat_rot(&m, p_vx, p_vy, p_vz); objekt_obalka(p_obj, &m, &min, &max); vektor_sub(&max, &min, &tmp); vektor_mult_skalar(&tmp, 0.5f, p_dist); vektor_add(&min, p_dist, p_stred); invert_matrix_copy(&m, &m); transformuj_bod_bod_matici(p_stred, &m); return (tmp.x * tmp.x + tmp.y * tmp.y + tmp.z * tmp.z); } void obb_prvek(OBB_OLD * p_obb) { memset((void *) p_obb, 0, sizeof(p_obb[0])); vektor_set_all(p_obb->obb, 1, 0, 0); vektor_set_all(p_obb->obb + 1, 0, 1, 0); vektor_set_all(p_obb->obb + 2, 0, 0, 1); p_obb->obb_len.x = p_obb->obb_len.y = p_obb->obb_len.z = 1.0f; p_obb->obb_stred.y = 1.0f; obb_aabb(p_obb); obb_body(p_obb); } void obb_calc_obj(EDIT_OBJEKT * p_obj) { BOD bnorm, bv1, bv2, bdist, bstred; BOD norm, v1, v2, dist, stred; OBB_OLD *p_obb = &p_obj->obb; int f0, f1, f2, f; float obsah, bobsah; vektor_set_all(&bv1, 1, 0, 0); vektor_set_all(&bnorm, 0, 1, 0); vektor_set_all(&bv2, 0, 0, 1); bobsah = obb_calc_obalka_obj(p_obj, &bv1, &bnorm, &bv2, &bdist, &bstred); for (f = 0; f < p_obj->facenum; f += 3) { f0 = p_obj->p_face[f]; f1 = p_obj->p_face[f + 1]; f2 = p_obj->p_face[f + 2]; calc_face_normal((BOD *) (p_obj->p_vertex + f0), (BOD *) (p_obj->p_vertex + f1), (BOD *) (p_obj->p_vertex + f2), &norm); if (vektor_velikost(&norm) == 0.0f) continue; // f0->f1 vektor_sub((BOD *) (p_obj->p_vertex + f1), (BOD *) (p_obj->p_vertex + f0), &v1); vektor_soucin(&v1, &norm, &v2); vektor_norm(&v1); vektor_norm(&v2); vektor_norm(&norm); obsah = obb_calc_obalka_obj(p_obj, &v1, &norm, &v2, &dist, &stred); if (obsah < bobsah) { bobsah = obsah; bv1 = v1; bv2 = v2; bnorm = norm; bdist = dist; bstred = stred; } // f0->f2 vektor_sub((BOD *) (p_obj->p_vertex + f2), (BOD *) (p_obj->p_vertex + f0), &v1); vektor_soucin(&v1, &norm, &v2); vektor_norm(&v1); vektor_norm(&v2); vektor_norm(&norm); obsah = obb_calc_obalka_obj(p_obj, &v1, &norm, &v2, &dist, &stred); if (obsah < bobsah) { bobsah = obsah; bv1 = v1; bv2 = v2; bnorm = norm; bdist = dist; bstred = stred; } // f1->f2 vektor_sub((BOD *) (p_obj->p_vertex + f2), (BOD *) (p_obj->p_vertex + f1), &v1); vektor_soucin(&v1, &norm, &v2); vektor_norm(&v1); vektor_norm(&v2); vektor_norm(&norm); obsah = obb_calc_obalka_obj(p_obj, &v1, &norm, &v2, &dist, &stred); if (obsah < bobsah) { bobsah = obsah; bv1 = v1; bv2 = v2; bnorm = norm; bdist = dist; bstred = stred; } } // Matice transfromujici word-space -> obalka-space p_obb->obb[0] = bv1; p_obb->obb[1] = bnorm; p_obb->obb[2] = bv2; p_obb->obb_len = bdist; p_obb->obb_stred = bstred; obb_body(p_obb); obb_aabb_obj(p_obj, p_obb); } void obb_calc_obj_fast(EDIT_OBJEKT * p_obj) { BOD vx, vy, vz; vx.x = 1; vx.y = 0; vx.z = 0; vy.x = 0; vy.y = 1; vy.z = 0; vz.x = 0; vz.y = 0; vz.z = 1; p_obj->obb.obb[0] = vx; p_obj->obb.obb[1] = vy; p_obj->obb.obb[2] = vz; obb_calc_obalka_obj(p_obj, &vx, &vy, &vz, &p_obj->obb.obb_len, &p_obj->obb.obb_stred); obb_body(&p_obj->obb); obb_aabb_obj(p_obj, &p_obj->obb); } /* Vola se pouze pri exportu sceny - pocitam prave OBB_OLD */ void obb_calc_kont_keyframe(EDIT_KONTEJNER * p_kont, int num) { HIERARCHY_SIM *p_sim; GLMATRIX m; OBB_OLD *p_list; OBB_OLD vysl; int prvni; int *p_ind, o; int i, j, k; p_list = (OBB_OLD *) mmalloc(sizeof(p_list[0]) * (num + 1)); p_ind = (int *) mmalloc(sizeof(p_ind[0]) * num); num = 0; oe_olist_reset(&o); while (oe_olist_next(p_kont, &o)) { p_ind[num++] = o; } prvni = TRUE; init_matrix(&m); /* Pomoci animaci tansformuju obalky */ for (k = 0; k < KONT_MAX_ANIM; k++) { p_sim = p_kont->sim + k; if (p_sim->keynum) { kprintf(TRUE, "KEY-Animace %d...", k); for (i = 0; i < p_sim->keynum; i++) { key_sim_root_to_matrix(p_kont, p_sim, frame2time(i), &m); for (j = 0; j < num; j++) { obb_transformuj(&p_kont->p_obj[p_ind[j]]->obb, &p_kont->p_obj[p_ind[j]]->m, p_list + j); } if (prvni) { obb_slep(&vysl, p_list, num); prvni = FALSE; } else { p_list[j] = vysl; obb_slep(&vysl, p_list, num + 1); } } } } p_kont->obb = vysl; free(p_ind); free(p_list); // Reanimuju to na puvodni velikost for (k = 0; k < KONT_MAX_ANIM; k++) { p_sim = p_kont->sim + k; if (p_sim->keynum) { key_sim_root_to_matrix(p_kont, p_sim, 0, kont_world_matrix(p_kont)); break; } } } // Prepocita objekt na tuto animaci void obb_calc_obj_kosti_anim(EDIT_OBJEKT * p_obj, JOINT_ANIMACE * p_anim, OBB_OLD * p_obb, int precizne) { OBB_OLD *p_list; int k; p_list = (OBB_OLD *) mmalloc(sizeof(p_list[0]) * p_anim->framenum); for (k = 0; k < p_anim->framenum; k++) { p_anim->time = frame2time(k); key_kosti_animuj(p_anim); key_kosti_updatuj_vertexy(p_obj, p_anim); if (precizne) obb_calc_obj(p_obj); else obb_calc_obj_fast(p_obj); p_list[k] = p_obj->obb; } obb_slep(p_obb, p_list, p_anim->framenum); free(p_list); } void obb_calc_obj_kosti(EDIT_OBJEKT * p_obj, int precizne) { JOINT_ANIMACE *p_anim; OBB_OLD *p_list; int num; if (!p_obj->p_joit_animace) { obb_calc_obj(p_obj); } else { num = 0; p_anim = p_obj->p_joit_animace; while (p_anim) { p_anim = p_anim->p_next; num++; } p_list = (OBB_OLD *) mmalloc(sizeof(p_list[0]) * num); num = 0; p_anim = p_obj->p_joit_animace; while (p_anim) { obb_calc_obj_kosti_anim(p_obj, p_anim, p_list + num++, precizne); p_anim = p_anim->p_next; } obb_slep(&p_obj->obb, p_list, num); } } /* Vola se pouze pri exportu sceny - pocitam prave OBB_OLD */ void obb_calc_kont(EDIT_KONTEJNER * p_kont_top, int precizne) { EDIT_KONTEJNER *p_kont; EDIT_OBJEKT *p_obj; OBB_OLD *p_list; int o, num = 0; p_kont = p_kont_top; while (p_kont) { oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { kprintf(TRUE, "calc-OBB-Objekt %s...", p_obj->jmeno); obb_calc_obj_kosti(p_obj, precizne); num++; } if (p_kont->kflag & KONT_KEYFRAME) { obb_calc_kont_keyframe(p_kont, num); } else { p_list = (OBB_OLD *) mmalloc(sizeof(p_list[0]) * num); num = 0; oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { p_list[num] = p_obj->obb; num++; } obb_slep(&p_kont->obb, p_list, num); free(p_list); } p_kont = p_kont->p_next; } } float obb_calc_poly_obalka(EDIT_MESH_POLY * p_poly, BOD * p_vx, BOD * p_vy, BOD * p_vz, BOD * p_dist, BOD * p_stred) { BOD min, max, tmp; GLMATRIX m, mi; mat_rot(&m, p_vx, p_vy, p_vz); bool inv = invert_matrix(&m, &mi); assert(inv); poly_obalka(p_poly, &m, &min, &max); vektor_sub(&max, &min, &tmp); // lokalni stred !!! vektor_mult_skalar(&tmp, 0.5f, p_dist); transformuj_bod_matici_bod(vektor_add(&min, p_dist, p_stred), &mi, p_stred); // Globalni stred return (tmp.x * tmp.x + tmp.y * tmp.y + tmp.z * tmp.z); } void obb_calc_poly(EDIT_MESH_POLY * p_poly) { BOD bnorm, bv1, bv2, bdist, bstred; BOD norm, v1, v2, dist, stred; OBB_OLD *p_obb = &p_poly->obb; int f; BOD a, b, c; float obsah, bobsah = FLT_MAX; for (f = 0; f < p_poly->facenum; f += 3) { a.x = p_poly->p_koord[f].x; a.y = p_poly->p_koord[f].y; a.z = p_poly->p_koord[f].z; b.x = p_poly->p_koord[f + 1].x; b.y = p_poly->p_koord[f + 1].y; b.z = p_poly->p_koord[f + 1].z; c.x = p_poly->p_koord[f + 2].x; c.y = p_poly->p_koord[f + 2].y; c.z = p_poly->p_koord[f + 2].z; calc_face_normal(&a, &b, &c, &norm); // f0->f1 vektor_sub(&a, &b, &v1); vektor_soucin(&v1, &norm, &v2); vektor_norm(&v1); vektor_norm(&v2); vektor_norm(&norm); obsah = obb_calc_poly_obalka(p_poly, &v1, &norm, &v2, &dist, &stred); if (obsah < bobsah) { bobsah = obsah; bv1 = v1; bv2 = v2; bnorm = norm; bdist = dist; bstred = stred; } // f0->f2 vektor_sub(&a, &c, &v1); vektor_soucin(&v1, &norm, &v2); vektor_norm(&v1); vektor_norm(&v2); vektor_norm(&norm); obsah = obb_calc_poly_obalka(p_poly, &v1, &norm, &v2, &dist, &stred); if (obsah < bobsah) { bobsah = obsah; bv1 = v1; bv2 = v2; bnorm = norm; bdist = dist; bstred = stred; } // f1->f2 vektor_sub(&b, &c, &v1); vektor_soucin(&v1, &norm, &v2); vektor_norm(&v1); vektor_norm(&v2); vektor_norm(&norm); obsah = obb_calc_poly_obalka(p_poly, &v1, &norm, &v2, &dist, &stred); if (obsah < bobsah) { bobsah = obsah; bv1 = v1; bv2 = v2; bnorm = norm; bdist = dist; bstred = stred; } } // Matice transfromujici word-space -> obalka-space p_obb->obb[0] = bv1; p_obb->obb[1] = bnorm; p_obb->obb[2] = bv2; p_obb->obb_len = bdist; p_obb->obb_stred = bstred; obb_body(p_obb); obb_aabb_poly(p_poly, p_obb); } void obb_calc_item(OBB_OLD * p_vys, OBB_TREE_ITEM_OLD * p_item, int itemnum) { OBB_OLD *p_list = (OBB_OLD *) mmalloc(sizeof(OBB_OLD) * itemnum); int i; for (i = 0; i < itemnum; i++) { p_list[i] = *(p_item[i].p_obb); } obb_slep_aabb(p_vys, p_list, itemnum); free(p_list); } void obb_kresli_obalku(OBB_OLD * p_obb, dword barva, GLMATRIX * p_mat) { BOD *p_dir = p_obb->obb; BOD min, max; GLMATRIX m; // Transformuje World Space->OBB mat_rot(&m, p_dir, p_dir + 1, p_dir + 2); if (matrix_det(&m)) { // OBB->World Space invert_matrix_copy(&m, &m); translate_matrix_set(&m, &p_obb->obb_stred); if (p_mat) mat_mult(p_mat, &m, &m); kd_bunka_expanze2(&p_obb->obb_len, &min, &max); kresli_obalku(min, max, barva, &m); } } void obbtree_kresli(OBB_TREE_OLD * p_prvni, dword barva) { int i; if (p_prvni) { obb_kresli_obalku(&p_prvni->obb, barva, NULL); for (i = 0; i < p_prvni->nextnum; i++) obbtree_kresli(p_prvni->p_next + i, barva); } } void obbtree_calc_obalky(OBB_TREE_OLD * p_prvni) { OBB_TREE_ITEM_OLD *p_itn; OBB_OLD *p_list; int p, i; p_list = (OBB_OLD *) mmalloc(sizeof(p_list[0]) * (p_prvni->nextnum + p_prvni->itnum)); for (i = 0; i < p_prvni->nextnum; i++) { obbtree_calc_obalky(p_prvni->p_next + i); p_list[i] = p_prvni->p_next[i].obb; } p_itn = p_prvni->p_item; for (p = 0; p < p_prvni->itnum; p++, p_itn++) { if (p_itn->p_mesh) { p_list[i + p] = p_itn->p_mesh->obb_world; } else { p_list[i + p] = p_itn->p_poly->obb; } } obb_slep(&p_prvni->obb, p_list, i + p); free(p_list); } #define MAX_VZDAL_OBALEK 20.0f #define MIN_PODOBALEK_OBJ 10 #define MIN_PODOBALEK_OBJ_ZBYTEK 10 /* Kazdy polygon ma uz implicitne obalku */ static EDIT_MATERIAL **p_mat; void obbtree_vyrob(OBB_TREE_OLD * p_prvni, EDIT_MESH_POLY * p_poly, int polynum, GAME_MESH_OLD ** p_mesh, int meshnum, int *p_ind, EDIT_MATERIAL ** p_matlist) { int i, j, itnum = polynum + meshnum; p_mat = p_matlist; memset((void *) p_prvni, 0, sizeof(p_prvni[0])); p_prvni->p_item = (OBB_TREE_ITEM_OLD *) mmalloc(sizeof(p_prvni->p_item[0]) * itnum); p_prvni->itnum = itnum; for (i = 0; i < polynum; i++) { p_prvni->p_item[i].p_poly = p_poly + i; p_prvni->p_item[i].p_obb = &p_poly[i].obb; } for (j = 0; j < meshnum; j++) { if (p_ind) p_prvni->p_item[i + j].mesh = p_ind[j]; p_prvni->p_item[i + j].p_mesh = p_mesh[j]; p_prvni->p_item[i + j].p_obb = &p_mesh[j]->obb_world; } obbtree_vyrob_rec(p_prvni, MAX_VZDAL_OBALEK); obbtree_calc_obalky(p_prvni); } static int obbtree_vyrob_rec_comp(const void *p_1, const void *p_2) { OBB_TREE_ITEM_OLD *p_it1 = (OBB_TREE_ITEM_OLD *) p_1; OBB_TREE_ITEM_OLD *p_it2 = (OBB_TREE_ITEM_OLD *) p_2; EDIT_MESH_POLY *p_poly1, *p_poly2; if (p_it1->p_mesh && p_it2->p_poly) return (-1); else if (p_it2->p_mesh && p_it1->p_poly) return (1); if (p_it1->p_mesh && p_it2->p_mesh) return (0); p_poly1 = p_it1->p_poly; p_poly2 = p_it2->p_poly; if (p_mat[p_poly1->material]->p_text[0] && p_mat[p_poly2->material]->p_text[0]) return (p_mat[p_poly1->material]->p_text[0]->text - p_mat[p_poly2->material]->p_text[0]->text); else return (p_mat[p_poly1->material]->p_text[0] - p_mat[p_poly2->material]->p_text[0]); } /* typedef struct _OBB_TREE_ITEM_OLD { OBB *p_obb; EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; int mesh; } OBB_TREE_ITEM_OLD; typedef struct _OBB_TREE { int mail; OBB obb; int itnum; // polozky bunky - vsechny OBB_TREE_ITEM_OLD *p_item; struct _OBB_TREE *p_up; // otec stromu int nextnum; // pocet podobalek struct _OBB_TREE *p_next; // podobalky } OBB_TREE; */ /* Ze seznamu polylistu vybere ty co se daji do obalky a zbytek se soupne do te hlavni */ /* p_prvni -> pointer na prvni obalku, do ktere se strci vsechny globalni poly a ty podobalky se strci do pod_obalek */ void obbtree_vyrob_rec(OBB_TREE_OLD * p_prvni, float max_vzdal) { OBB_TREE_ITEM_OLD *p_item = p_prvni->p_item; int itemnum = p_prvni->itnum; int itemzbyva = p_prvni->itnum; OBB_TREE_ITEM_OLD *p_tmp_item = (OBB_TREE_ITEM_OLD *) alloca(sizeof(p_tmp_item[0]) * itemnum); int tmp_itemnum; OBB_TREE_OLD *p_obalky = (OBB_TREE_OLD *) alloca(sizeof(p_obalky[0]) * itemnum); int obalnum = 0; int *p_hits = (int *) alloca(sizeof(p_hits[0]) * itemnum); // globalni hity int *p_lhits = (int *) alloca(sizeof(p_lhits[0]) * itemnum); // lokalni hity OBB_OLD obb; int p, i, itemzustava; if (p_prvni->itnum <= MIN_PODOBALEK_OBJ) return; memset(p_tmp_item, 0, sizeof(p_tmp_item[0]) * itemnum); memset((void *) p_obalky, 0, sizeof(p_obalky[0]) * itemnum); memset(p_hits, 0, sizeof(p_hits[0]) * itemnum); memset(p_lhits, 0, sizeof(p_lhits[0]) * itemnum); /* Cyklus pres vsechny poly, ktere nejsou jesne vyrazeny ze seznamu volnych - hit-list */ for (p = 0; p < itemnum; p++) { if (p_hits[p]) continue; /* seznam tmp poly -> zacatek seznamu potencialni obalky momentalne to je pouze ten 1 prvek */ p_tmp_item[0] = p_item[p]; tmp_itemnum = 1; p_lhits[p] = TRUE; /* rozmery minimalni obalky o 1 poly */ obb = *p_item[p].p_obb; /* Pridani vsech blizskych poly do 1 obalky */ for (i = 0; i < itemnum; i++) { if (i == p || p_hits[i]) continue; p_lhits[i] = (vzdal_bodu_bod(&obb.obb_stred, &p_item[i].p_obb->obb_stred) <= max_vzdal); if (p_lhits[i]) { p_tmp_item[tmp_itemnum++] = p_item[i]; obb_calc_item(&obb, p_tmp_item, tmp_itemnum); } } /* Pokud je blizko sebe vice objektu nez co je minimum jedne obalky -> - udelej tuto samostanou pod-obalku se shluku objektu -> vyber je - a to pouze pokud jeste neco zbyde v puvodni obalce */ if (tmp_itemnum >= MIN_PODOBALEK_OBJ && itemzbyva - tmp_itemnum >= MIN_PODOBALEK_OBJ_ZBYTEK) { itemzbyva -= tmp_itemnum; p_obalky[obalnum].obb = obb; p_obalky[obalnum].p_item = (OBB_TREE_ITEM_OLD *) kopiruj_pole(p_tmp_item, sizeof(p_tmp_item[0]) * tmp_itemnum); p_obalky[obalnum].itnum = tmp_itemnum; p_obalky[obalnum].p_up = p_prvni; obalnum++; for (i = 0; i < itemnum; i++) // Prekopiruje hit-list p_hits[i] |= p_lhits[i]; } } /* Spocitam pocet neumistenych polozek */ memcpy(p_tmp_item, p_item, sizeof(p_item[0]) * itemnum); itemzustava = 0; for (i = 0; i < itemnum; i++) { if (!p_hits[i]) itemzustava++; } free(p_prvni->p_item); p_prvni->p_item = (OBB_TREE_ITEM_OLD *) mmalloc(sizeof(p_prvni->p_item[0]) * itemzustava); p_prvni->itnum = itemzustava; /* Skopiruju neumistene polozky */ for (i = 0, itemzustava = 0; i < itemnum; i++) { if (!p_hits[i]) p_prvni->p_item[itemzustava++] = p_tmp_item[i]; } /* Setridim polozky podle pouzitych textur */ qsort(p_prvni->p_item, p_prvni->itnum, sizeof(p_prvni->p_item[0]), obbtree_vyrob_rec_comp); /* Skopiruji se obalky */ p_prvni->nextnum = obalnum; if (obalnum) { p_prvni->p_next = (OBB_TREE_OLD *) kopiruj_pole(p_obalky, sizeof(p_prvni->p_next[0]) * obalnum); /* Pro kazdou pod-obalku zavolej delicku... */ max_vzdal /= 2.0f; for (i = 0; i < obalnum; i++) { obbtree_vyrob_rec(p_prvni->p_next + i, max_vzdal); } } } void obbtree_zrus(OBB_TREE_OLD * p_ob) { int i; if (p_ob->p_item) { free(p_ob->p_item); p_ob->p_item = NULL; } if (p_ob->p_next) { for (i = 0; i < p_ob->nextnum; i++) { obbtree_zrus(p_ob->p_next + i); } free(p_ob->p_next); } } /* Udela strom z poly */ int obb_visibility(OBB_OLD * p_obb, GLMATRIX * p_m) { int i, j, xplane, yplane, xa, ya, m; float x, y, z, xt, yt, zt, w, fx, fy, fw; BOD *p_bod = p_obb->obb_hran; // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for (i = 0, j = 0; i < 8; i++) { xt = p_bod->x; yt = p_bod->y; zt = p_bod->z; x = p_m->_11 * xt + p_m->_21 * yt + p_m->_31 * zt + p_m->_41; y = p_m->_12 * xt + p_m->_22 * yt + p_m->_32 * zt + p_m->_42; z = p_m->_13 * xt + p_m->_23 * yt + p_m->_33 * zt + p_m->_43; w = p_m->_14 * xt + p_m->_24 * yt + p_m->_34 * zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if (m) j++; // bod lezi v obrazovce -> automaticky uspech if (m && -w <= x && x <= w && -w <= y && y <= w) { return (TRUE); } fx = (float) fabs(x); fy = (float) fabs(y); fw = (float) fabs(w); if (fx / fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if (fy / fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; p_bod++; } return ((j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } berusky2-0.12/src/komat/Berusky3d_render.h0000644000175000017500000001225013674426075015426 00000000000000/* Rendering berusek */ #ifndef __BERUSKY3D_RENDER_H__ #define __BERUSKY3D_RENDER_H__ void ber_renderuj_scenu(void); void ber_zrcadlo_nastav(void); void ber_zrcadlo_zrus(void); /******************************************************************* Postaveni dynamickeho render-listu ****************************************************************** */ inline void ber_dynamic_mesh_list_vyrob(G_KONFIG * p_ber) { int i; memset(p_ber->p_dyn_meshlist, 0, sizeof(p_ber->p_dyn_meshlist[0]) * MAX_BERUSKY_KONTEJNERU); p_ber->dyn_meshlistnum = 0; for (i = 0; i < MAX_BERUSKY_KONTEJNERU; i++) { if (p_ber->p_mesh[i] && !(p_ber->p_mesh[i]->p_data->kflag & KONT_STATIC)) p_ber->p_dyn_meshlist[p_ber->dyn_meshlistnum++] = &p_ber->p_mesh[i]; } } inline void ber_dynamic_mesh_list_vloz_mesh(G_KONFIG * p_ber, int meshnum) { p_ber->p_dyn_meshlist[p_ber->dyn_meshlistnum++] = &p_ber->p_mesh[meshnum]; } inline void ber_dynamic_mesh_list_zrus(G_KONFIG * p_ber) { memset(p_ber->p_dyn_meshlist, 0, sizeof(p_ber->p_dyn_meshlist[0]) * MAX_BERUSKY_KONTEJNERU); p_ber->dyn_meshlistnum = 0; } /******************************************************************* Postaveni statickeho render-listu ****************************************************************** */ void ber_render_list_vyrob(G_KONFIG * p_ber, int zrcadlo, int kamera_zmena); /******************************************************************* Prochazeni mesh render listu ****************************************************************** */ inline void ber_mesh_render_list_reset(G_KONFIG * p_ber) { p_ber->mesh_renderakt = 0; } inline GAME_MESH_OLD *ber_mesh_render_list_next(G_KONFIG * p_ber) { GAME_MESH_OLD **p_tmp; while (p_ber->mesh_renderakt < p_ber->mesh_rendernum) { p_tmp = p_ber->p_mesh_renderlist[p_ber->mesh_renderakt++]; if (p_tmp && *p_tmp) { return (*p_tmp); } } return (NULL); } inline GAME_MESH_OLD *ber_mesh_render_list_next_flag(G_KONFIG * p_ber, int flag, int not_flag) { GAME_MESH_OLD **p_tmp, *p_mesh; int kflag; while (p_ber->mesh_renderakt < p_ber->mesh_rendernum) { p_tmp = p_ber->p_mesh_renderlist[p_ber->mesh_renderakt++]; if (p_tmp && *p_tmp) { p_mesh = *p_tmp; kflag = p_mesh->p_data->kflag; if ((kflag & flag) == flag && !(kflag & not_flag)) return (p_mesh); } } return (NULL); } /******************************************************************* Prochazeni poly render listu ****************************************************************** */ inline void ber_poly_render_list_zrus(G_KONFIG * p_ber) { null_free((void **) &p_ber->p_poly_renderlist); p_ber->poly_rendernum = 0; p_ber->poly_renderakt = 0; } inline void ber_poly_render_list_reset(G_KONFIG * p_ber) { p_ber->poly_renderakt = 0; } inline EDIT_MESH_POLY *ber_poly_render_list_next(G_KONFIG * p_ber) { return (p_ber->poly_renderakt < p_ber->poly_rendernum ? p_ber-> p_poly_renderlist[p_ber->poly_renderakt++] : NULL); } inline EDIT_MESH_POLY *ber_poly_render_list_next_flag(G_KONFIG * p_ber, int flag, int not_flag) { EDIT_MESH_POLY *p_poly; int kflag; while (p_ber->poly_renderakt < p_ber->poly_rendernum) { p_poly = p_ber->p_poly_renderlist[p_ber->poly_renderakt++]; kflag = p_poly->kflag; if ((kflag & flag) == flag && !(kflag & not_flag)) return (p_poly); } return (NULL); } void ber_render_list_setrid(G_KONFIG * p_ber); void ber_kresli_fleky(G_KONFIG * p_ber, FLEK * p_topflek); void ber_renderuj_mlhu(G_KONFIG * p_ber); void ber_nahod_render_funkce(void); void ber_kresli_poly_vertex(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat); void ber_kresli_poly_vertex_multitext(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat); void ber_kresli_poly_vertex_multitext_specular(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat); void ber_kresli_poly_array(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat); void ber_kresli_poly_array_multitext(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat, int spec); void ber_kresli_mesh_vertex(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt); void ber_kresli_mesh_vertex_multitext(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt); void ber_kresli_mesh_vertex_multitext_specular(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt); void ber_kresli_mesh_array(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt); int ber_nastav_material_single_multi_spec(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); int ber_nastav_material_single_poly_multi_spec(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); int ber_nastav_material_single_multi(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); int ber_nastav_material_single_poly_multi(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); int ber_nastav_material_single_nic(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); int ber_nastav_material_single_poly_nic(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); void ber_ini_vertex_arrays(void); void ber_test_render_mysi(void); extern EDIT_MATERIAL *__p_last_mat; void pe_renderuj(G_KONFIG * p_ber); void ber_render_list_vyrob_pruhlist(G_KONFIG * p_ber); /* Tabulka pointerovych funkci -> podle videokarty vyberu aktualni funkci */ #endif berusky2-0.12/src/komat/3dmath.h0000644000175000017500000001673013674426075013403 00000000000000/* 3D matematicke funkce */ #ifndef __3D_MATH_H_ #define __3D_MATH_H_ #ifndef PI #define PI 3.14159265358979323846f #endif GLMATRIX *calc_reflex_matrix(GLMATRIX * p_mat, BOD * p_a, BOD * p_b, BOD * p_c); int calc_prusek(ROVINA * r, OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * p); int calc_prusek_bod(ROVINA * r, BOD * a, BOD * b, BOD * p); int prusek_face(OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * p, ROVINA * p_r, OBJ_VERTEX * _1, OBJ_VERTEX * _2, OBJ_VERTEX * _3); int prusek_face_editor(OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * p, OBJ_VERTEX * _1, OBJ_VERTEX * _2, OBJ_VERTEX * _3); int intersect_triangle_point(OBJ_VERTEX * _1, OBJ_VERTEX * _2, OBJ_VERTEX * _3, BOD * p); int je_uvnitr(float ax, float ay, float bx, float by, float cx, float cy, float px, float py); int intersect_triangle(BOD * p_orig, BOD * p_dir, BOD * p_v0, BOD * p_v1, BOD * p_v2, FLOAT * p_t, FLOAT * p_u, FLOAT * p_v); int intersect_triangle_ncull(BOD * p_orig, BOD * p_dir, BOD * p_v0, BOD * p_v1, BOD * p_v2, FLOAT * p_t, FLOAT * p_u, FLOAT * p_v); GLMATRIX *calc_camera_3ds(GLMATRIX * p_cam, GLMATRIX * p_invcam, BOD * p_p, BOD * p_t, float roll); void calc_camera(GLMATRIX * p_cmatrix, GLMATRIX * r_bod_matrix, float vzdal, float fi); void calc_camera_bod(GLMATRIX * p_cmatrix, GLMATRIX * p_inv, BOD * p_p, float vzdal, float fi, float rfi); void calc_r_bod(GLMATRIX * p_cmatrix, GLMATRIX * r_bod_matrix, float vzdal, float fi); void prusecik(BOD * p_a, BOD * p_b, BOD * p_p, BOD * p_I); void prusecik_mujbod(MUJ_BOD * p_a, MUJ_BOD * p_b, MUJ_BOD * p_p, MUJ_BOD * p_I); GLMATRIX *calc_camera_polar(GLMATRIX * p_cam, GLMATRIX * p_invcam, BOD * p_p, QUAT * p_quat, float vzdal); /* Bodove funkce */ inline void bod2mujbod(OBJ_VERTEX * p_obj, BOD * p_bod) { p_obj->x = p_bod->x; p_obj->y = p_bod->y; p_obj->z = p_bod->z; } inline void norm2mujbod(OBJ_VERTEX * p_obj, BOD * p_bod) { p_obj->nx = p_bod->x; p_obj->ny = p_bod->y; p_obj->nz = p_bod->z; } inline BOD *mujbod2bod(BOD * p_bod, OBJ_VERTEX * p_obj) { p_bod->x = p_obj->x; p_bod->y = p_obj->y; p_bod->z = p_obj->z; return (p_bod); } inline ROVINA *calc_rovinu(OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * c, ROVINA * r) { r->x = (b->y - a->y) * (c->z - a->z) - (c->y - a->y) * (b->z - a->z); r->y = (b->z - a->z) * (c->x - a->x) - (c->z - a->z) * (b->x - a->x); r->z = (b->x - a->x) * (c->y - a->y) - (c->x - a->x) * (b->y - a->y); r->e = -(r->x * a->x + r->y * a->y + r->z * a->z); return (r); } inline ROVINA *calc_rovinu_bod(BOD * a, BOD * b, BOD * c, ROVINA * r) { r->x = (b->y - a->y) * (c->z - a->z) - (c->y - a->y) * (b->z - a->z); r->y = (b->z - a->z) * (c->x - a->x) - (c->z - a->z) * (b->x - a->x); r->z = (b->x - a->x) * (c->y - a->y) - (c->x - a->x) * (b->y - a->y); r->e = -(r->x * a->x + r->y * a->y + r->z * a->z); return (r); } inline ROVINA *calc_rovinu_bod_vektor(BOD * p, BOD * v, ROVINA * r) { r->x = v->x; r->y = v->y; r->z = v->z; r->e = -v->x * p->x - v->y * p->y - v->z * p->z; return (r); } inline ROVINAD *calc_drovinu_bod(BOD * a, BOD * b, BOD * c, ROVINAD * r) { r->x = (b->y - a->y) * (c->z - a->z) - (c->y - a->y) * (b->z - a->z); r->y = (b->z - a->z) * (c->x - a->x) - (c->z - a->z) * (b->x - a->x); r->z = (b->x - a->x) * (c->y - a->y) - (c->x - a->x) * (b->y - a->y); r->e = -(r->x * a->x + r->y * a->y + r->z * a->z); return (r); } inline BOD *calc_face_normal(BOD * a, BOD * b, BOD * c, BOD * n) { n->x = (b->y - a->y) * (c->z - a->z) - (c->y - a->y) * (b->z - a->z); n->y = (b->z - a->z) * (c->x - a->x) - (c->z - a->z) * (b->x - a->x); n->z = (b->x - a->x) * (c->y - a->y) - (c->x - a->x) * (b->y - a->y); return (n); } inline BOD *calc_face_stred(BOD * a, BOD * b, BOD * c, BOD * s) { s->x = (a->x + b->x + c->x) / 3.0f; s->y = (a->y + b->y + c->y) / 3.0f; s->z = (a->z + b->z + c->z) / 3.0f; return (s); } inline GLMATRIX *calc_3d_2d_matrix(GLMATRIX * p_word, GLMATRIX * p_cam, GLMATRIX * p_proj, GLMATRIX * p_mat) { return (mat_mult(mat_mult(p_word, p_cam, p_mat), p_proj, p_mat)); } inline void matrix_to_scale(GLMATRIX * p_m, BOD * p_s) { p_s->x = norm_vect(&p_m->_11, &p_m->_21, &p_m->_31); p_s->y = norm_vect(&p_m->_12, &p_m->_22, &p_m->_32); p_s->z = norm_vect(&p_m->_13, &p_m->_23, &p_m->_33); } inline void matrix_to_pos(GLMATRIX * p_m, BOD * p_p) { p_p->x = p_m->_41; p_p->y = p_m->_42; p_p->z = p_m->_43; } inline float matrix_to_float(GLMATRIX * p_mat) { if (fabs(p_mat->_11) > fabs(p_mat->_21)) return ((float) acos(p_mat->_11)); else return ((float) asin(p_mat->_21)); } inline void matrix_to_scale_2d(GLMATRIX * p_m, BOD * p_s) { p_s->x = norm_vect(&p_m->_11, &p_m->_21, &p_m->_31); p_s->y = norm_vect(&p_m->_12, &p_m->_22, &p_m->_32); } inline void matrix_to_pos_2d(GLMATRIX * p_m, BOD * p_p) { p_p->x = p_m->_41; p_p->y = p_m->_42; } inline GLMATRIX *calc_transf_3d_2d_matrix(GLMATRIX * p_w, GLMATRIX * p_c, GLMATRIX * p_p, GLMATRIX * p_v) { GLMATRIX m; return ((GLMATRIX *) glu_invert_matrix(mat_mult(mat_mult(p_w, p_c, p_v), p_p, &m), p_v)); } inline GLMATRIX *calc_transf_3d_2d_matrix_smpl(GLMATRIX * p_c, GLMATRIX * p_p, GLMATRIX * p_v) { GLMATRIX m; return ((GLMATRIX *) glu_invert_matrix(mat_mult(p_c, p_p, &m), p_v)); } inline void stred_to_obalka(BOD * p_prv, BOD * p_min, BOD * p_max, float dx, float dy, float dz) { p_min->x = p_prv->x - dx; p_min->y = p_prv->y - dy; p_min->z = p_prv->z - dz; p_max->x = p_prv->x + dx; p_max->y = p_prv->y + dy; p_max->z = p_prv->z + dz; } #define DEG2RAD(fi) (((fi)*PI)/180.0f) #define RAD2DEG(fi) (((fi)/PI)*180.0f) #define atoff(s) ((float)atof(s)) /* #define sqrtf(s) ((float)sqrt((float)(s))) #define sinf(s) ((float)sin((float)(s))) #define cosf(s) ((float)cos((float)(s))) #define asinf(s) ((float)asin((float)(s))) #define acosf(s) ((float)acos((float)(s))) #define fabsf(s) ((float)fabs((float)(s))) */ #define EPSILON 0.000001f inline void kar2polar(BOD * p_car, float *p_r, float *p_fi, float *p_vzdal) { BOD z = *p_car; float p; *p_vzdal = vektor_norm(&z); *p_fi = asinf((fabsf(z.y) > 1.0f) ? ftoi(z.y) : z.y); *p_r = copysign(acosf((fabsf(p = (-z.z) / cosf(*p_fi)) > 1.0f) ? ftoi(p) : p), z.x); } // polarni souradnice -> kartezske souradnice inline void polar2kar(float r, float fi, float vzdal, BOD * p_car) { p_car->x = vzdal * sinf(r) * cosf(fi); p_car->z = -(vzdal * cosf(r) * cosf(fi)); p_car->y = vzdal * sinf(fi); } // odriznuti periody 2PI + normalizace na +PI..-PI inline float normalizuj_uhel(float uhel) { if (fabs(uhel) > 2 * PI) { uhel = (float) fmod((float) uhel, (float) 2 * PI); } if (fabs(uhel) > PI) { return ((uhel = (uhel > 0.0f) ? -(2 * PI - uhel) : (2 * PI + uhel))); } else { return (uhel); } } #define DELTA_MIN_ROZDIL 0.00000001f #define stejny_vertex(v1,v2) (fabsf(v1.x-v2.x) < DELTA_MIN_ROZDIL &&\ fabsf(v1.y-v2.y) < DELTA_MIN_ROZDIL &&\ fabsf(v1.z-v2.z) < DELTA_MIN_ROZDIL)\ inline int stejny_vertex_point(BOD * v1, BOD * v2) { return (fabsf(v1->x - v2->x) < DELTA_MIN_ROZDIL && fabsf(v1->y - v2->y) < DELTA_MIN_ROZDIL && fabsf(v1->z - v2->z) < DELTA_MIN_ROZDIL); } /* Funkce vcetne Delta-Planu */ inline int stejny_vertex_point_delta(BOD * v1, BOD * v2, float delta) { return (fabsf(v1->x - v2->x) < delta && fabsf(v1->y - v2->y) < delta && fabsf(v1->z - v2->z) < delta); } #endif berusky2-0.12/src/komat/Di.h0000644000175000017500000000264413674426075012556 00000000000000/* h pro dir imput */ #ifndef __DI_H #define __DI_H #ifdef __cplusplus extern "C" { #endif #define POCET_KLAVES SDLK_LAST+3 /* Definice klaves v pole_key */ #define K_ZAV_L K_BRACKET_L #define K_ZAV_P K_BRACKET_R #define K_STREDNIK K_SEMICOL #define K_UVOZ K_QUOTE #define K_SHFT_L SDLK_LSHIFT #define K_SHFT_P SDLK_RSHIFT #define K_CARKA K_COMMA #define K_TECKA K_PERIOD #define K_PTRSCR SDLK_PRINT #define K_CAPSLOCK SDLK_CAPSLOCK #define K_NUMLOCK SDLK_NUMLOCK #define K_SCRLOCK SDLK_SCROLLOCK #define K_NAHORU K_UP #define K_K_MINUS SDLK_KP_MINUS #define K_DOLEVA K_LEFT #define K_K_5 KP_5 #define K_DOPRAVA K_RIGHT #define K_K_PLUS SDLK_KP_PLUS #define K_DOLU K_DOWN #define K_INS K_INSERT #define K_SHIFT SDLK_LAST #define K_CTRL SDLK_LAST+1 #define K_ALT SDLK_LAST+2 extern int key[POCET_KLAVES]; extern int key_pressed; typedef struct _MYSI_INFO { int x_min, x_max; int y_min, y_max; int x_res, y_res; int x, y; int dx, dy; int t1, t2; int dt1, dt2; int ot1, ot2; int d1, d2; } MYSI_INFO; #define stisk_mys() (spracuj_spravy(TRUE) && !(mi.t1 || mi.t2)) #define nuluj_mys() { mi.t1 = mi.t2 = 0; mi.dx = mi.dy = 0; mi.dt1 = mi.dt2 = 0; } #define nuluj_dif() { mi.dx = mi.dy = 0; } extern MYSI_INFO mi; int zapni_kurzor(void); int vypni_kurzor(void); #ifdef __cplusplus } #endif #endif berusky2-0.12/src/komat/Texture.cpp0000644000175000017500000006164713674426075014225 00000000000000/* Modul s texturama - Load BMP */ #include "3d_all.h" #include "Texture_import.h" bitmapa *surface2bmp(SURFACE_SDL * p_surf); /* int uloz_aux(FILE *f, AUX_RGBImageRec *p_bmp) { BITMAPFILEHEADER head; BITMAPINFOHEADER info; dword sirka,sirka_q,vyska,bpp = 3; int n; sirka = p_bmp->sizeX; vyska = p_bmp->sizeY; assert(sirka && vyska); sirka_q = sirka*bpp + ((sirka*bpp%4) ? sirka*bpp%4 : 0); n = sirka_q*vyska; // Ulozeni bitmapy memset(&head,0,sizeof(head)); memset(&info,0,sizeof(info)); head.bfType = 'MB'; head.bfSize = sizeof(head)+sizeof(info)+sirka_q*vyska; head.bfOffBits = sizeof(info)+sizeof(head); info.biSize = sizeof(info); info.biWidth = sirka; info.biHeight = vyska; info.biPlanes = 1; info.biBitCount = (unsigned short)bpp*8; info.biCompression = BI_RGB; info.biSizeImage = n; fwrite(&head,sizeof(head),1,f); fwrite(&info,sizeof(info),1,f); fwrite(p_bmp->data,sizeof(byte),n,f); return(TRUE); } int uloz_aux_pack(FFILE f, AUX_RGBImageRec *p_bmp) { BITMAPFILEHEADER head; BITMAPINFOHEADER info; dword sirka,sirka_q,vyska,bpp = 3; int n; sirka = p_bmp->sizeX; vyska = p_bmp->sizeY; assert(sirka && vyska); sirka_q = sirka*bpp + ((sirka*bpp%4) ? sirka*bpp%4 : 0); n = sirka_q*vyska; // Ulozeni bitmapy memset(&head,0,sizeof(head)); memset(&info,0,sizeof(info)); head.bfType = 'MB'; head.bfSize = sizeof(head)+sizeof(info)+sirka_q*vyska; head.bfOffBits = sizeof(info)+sizeof(head); info.biSize = sizeof(info); info.biWidth = sirka; info.biHeight = vyska; info.biPlanes = 1; info.biBitCount = (unsigned short)bpp*8; info.biCompression = BI_RGB; info.biSizeImage = n; ffwrite(&head,sizeof(head),1,f); ffwrite(&info,sizeof(info),1,f); ffwrite(p_bmp->data,sizeof(byte),n,f); return(TRUE); } */ bitmapa *txt_alfa2bmp(bitmapa * p_bmp, bitmapa * p_alfa) { int x, y, dx, dy; if (p_bmp->x != p_alfa->x || p_bmp->y != p_alfa->y) { kprintf(TRUE, "txt_alfa2bmp: wrong alpha texture size! (%dx%d)", p_alfa->x, p_alfa->y); abort(); } dx = p_alfa->x; dy = p_alfa->y; for (y = 0; y < dy; y++) { for (x = 0; x < dx; x++) { dword src_a = bmp_getpixel(p_alfa, x, y); dword src_b = bmp_getpixel(p_bmp, x, y); bmp_putpixel(p_bmp, x, y, byte_a(src_b, (int) (rgb_intensity(src_a) * 255))); } } return (p_bmp); } bitmapa *bmp_scale(bitmapa * p_bmp, int nx, int ny) { if (nx == p_bmp->x && ny == p_bmp->y) { return (bmp_kopituj(p_bmp)); } else { if (nx < 1) nx = 1; if (ny < 1) ny = 1; { bitmapa *p_new = bmp_vyrob(nx, ny); dword *p_src, *p_dest; float px, py, dx, dy; int x, y, ys; dx = (float) p_bmp->x / (float) nx; dy = (float) p_bmp->y / (float) ny; p_src = p_bmp->data; py = 0; for (y = 0; y < ny; y++) { ys = ftoi(py) * p_bmp->x; px = 0; p_dest = p_new->data + y * nx; for (x = 0; x < nx; x++) { p_dest[x] = p_src[ys + ftoi(px)]; px += dx; } py += dy; } return (p_new); } } } void txt_build_2D_mip_map(bitmapa * p_bmp, int format) { bitmapa *p_scs; int x = p_bmp->x, y = p_bmp->y, i = 0; while (x > 0 || y > 0) { p_scs = bmp_scale(p_bmp, x, y); glTexImage2D(GL_TEXTURE_2D, i, format, p_scs->x, p_scs->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, p_scs->data); bmp_zrus(&p_scs); x /= 2; y /= 2; i++; } } /* Prevod vcetne alfa mapy */ bitmapa *txt_bmp2textura(bitmapa * p_bmp, EDIT_TEXT_OLD * p_text, EDIT_TEXT_KONFIG * p_konf, int _2d_text) { int dx, dy, x, y, scale = FALSE; int wrap = GL_REPEAT; if (p_konf) { p_text->typ = p_konf->typ; } glGenTextures(1, &p_text->text); glBindTexture(p_text->typ, p_text->text); if (p_konf) { p_text->mip = p_konf->mip; p_text->mip_filtr = p_konf->mip_filtr; p_text->format = p_konf->format; p_text->std_filtr = p_konf->std_filtr; p_text->wrap_x = p_konf->wrap_x; p_text->wrap_y = p_konf->wrap_y; p_text->alfa_stage = p_konf->alfa_stage; p_text->trida = txconf.text_trida; p_text->bump = (txconf.text_bump[txconf.text_trida] && p_konf->bump); p_text->floyd = p_konf->floyd; p_text->floyd_transp = p_konf->floyd_transp; p_text->no_cull = p_konf->no_cull; } x = txconf.text_max_x; y = txconf.text_max_y; if (p_bmp->x <= x) x = p_bmp->x; else scale = TRUE; if (p_bmp->y <= y) y = p_bmp->y; else scale = TRUE; for (dx = 2; dx < txconf.text_max_x && x > dx; dx <<= 1); for (dy = 2; dy < txconf.text_max_y && y > dy; dy <<= 1); if (x != dx || y != dy) { x = dx; y = dy; scale = TRUE; } if (txconf.text_detail[p_text->trida] > 0) { scale = TRUE; x >>= txconf.text_detail[p_text->trida]; y >>= txconf.text_detail[p_text->trida]; } if (!_2d_text && scale) { bitmapa *p_scs = bmp_scale(p_bmp, x, y); bmp_zrus(&p_bmp); p_bmp = p_scs; } if (p_text->mip) { if (p_text->typ == GL_TEXTURE_2D) { txt_build_2D_mip_map(p_bmp, p_text->format); } else if (p_text->typ == GL_TEXTURE_1D) { gluBuild1DMipmaps(GL_TEXTURE_1D, p_text->format, p_bmp->x, GL_RGBA, GL_UNSIGNED_BYTE, p_bmp->data); } glTexParameteri(p_text->typ, GL_TEXTURE_MIN_FILTER, (p_text->mip_filtr) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(p_text->typ, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } else { if (p_text->typ == GL_TEXTURE_2D) { glTexImage2D(GL_TEXTURE_2D, 0, p_text->format, p_bmp->x, p_bmp->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, p_bmp->data); } else if (p_text->typ == GL_TEXTURE_1D) { glTexImage1D(GL_TEXTURE_1D, 0, p_text->format, p_bmp->x, 0, GL_RGBA, GL_UNSIGNED_BYTE, p_bmp->data); } if (!p_text->std_filtr) { glTexParameteri(p_text->typ, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(p_text->typ, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } else { glTexParameteri(p_text->typ, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(p_text->typ, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } } if (txconf.text_anis) { glTexParameterfv(p_text->typ, GL_TEXTURE_MAX_ANISOTROPY_EXT, &txconf.text_anis_level); } switch (p_text->wrap_x) { case 0: if (gl_ext::extlist_text_edge_clamp) { wrap = GL_CLAMP_TO_EDGE; } else { wrap = GL_CLAMP; } break; case 1: wrap = GL_REPEAT; break; } glTexParameteri(p_text->typ, GL_TEXTURE_WRAP_S, wrap); switch (p_text->wrap_y) { case 0: if (gl_ext::extlist_text_edge_clamp) { wrap = GL_CLAMP_TO_EDGE; } else { wrap = GL_CLAMP; } break; case 1: wrap = GL_REPEAT; break; } glTexParameteri(p_text->typ, GL_TEXTURE_WRAP_T, wrap); return (p_bmp); } // filtr - Linear/Nearest // bpp - 16/32 int txt_vyrob_2D_texturu(int x, int y, int filtr, int format) { int wrap, text; bitmapa *p_bmp; glGenTextures(1, (GLuint *) & text); glBindTexture(GL_TEXTURE_2D, text); p_bmp = bmp_vyrob(x, y); glTexImage2D(GL_TEXTURE_2D, 0, format, p_bmp->x, p_bmp->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, p_bmp->data); bmp_zrus(&p_bmp); if (filtr) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } if (gl_ext::extlist_text_edge_clamp) { wrap = GL_CLAMP_TO_EDGE; } else { wrap = GL_CLAMP; } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap); return (text); } int txt_kopiruj(EDIT_TEXT_OLD * p_dest, EDIT_TEXT_OLD * p_src) { *p_dest = *p_src; p_dest->load = FALSE; p_dest->p_bmp = bmp_kopituj(p_src->p_bmp); return (TRUE); } int txt_reload_lightmap(EDIT_TEXT_OLD * p_text, bitmapa * p_bmp) { EDIT_TEXT_KONFIG cnf; txt_lightmap_konfig(&cnf); glBindTexture(p_text->typ, p_text->text); glTexSubImage2D(p_text->typ, 0, 0, 0, p_bmp->x, p_bmp->y, GL_RGBA, GL_UNSIGNED_BYTE, p_bmp->data); return (TRUE); } // load ok int txt_nahraj_format(char *p_dir, char *p_file, EDIT_TEXT_KONFIG * p_text) { char jmeno[200]; char *p_znak; int format = -1; KFILE *f; strcpy(jmeno, p_file); zamen_koncovku(jmeno, KONCOVKA_TEXT_INFO); p_text->alfa = kefile(p_dir, p_text->alfamap); p_text->alfa_stage = K_CHYBA; if ((f = kopen(p_dir, jmeno, (char *) "r"))) { while (kgets(jmeno, 200, f)) { fgets_korekce(jmeno); if (jmeno[0] == ';') continue; // Bump-mapping if (strstr(jmeno, "nobump")) { p_text->bump = FALSE; continue; } // culling if (strstr(jmeno, "no_cull")) { p_text->no_cull = TRUE; continue; } // Floyd-steinberg if (strstr(jmeno, "floyd")) { p_text->floyd = TRUE; continue; } // Floyd-steinberg s pruhlednyma if (strstr(jmeno, "floyd_transp")) { p_text->floyd_transp = TRUE; continue; } if ((p_znak = strchr(jmeno, '='))) { *p_znak++ = 0; if (strstr(jmeno, "format")) { if (!preloz_texture_format(&format, p_znak)) { //kprintfl(TRUE,"Texture format %d",format); //} else { kprintfl(TRUE, "Bad texture format %s", p_znak); } continue; } // Repeat/clamp mody if (strstr(jmeno, "wrap_x")) { p_text->wrap_x = atoi(p_znak); continue; } // Repeat/clamp mody if (strstr(jmeno, "wrap_y")) { p_text->wrap_y = atoi(p_znak); continue; } // Mip-mapping if (strstr(jmeno, "mip_map")) { p_text->mip = atoi(p_znak); continue; } // Typ 1D/2D if (strstr(jmeno, "typ")) { p_text->typ = (atoi(p_znak) == 1) ? GL_TEXTURE_1D : GL_TEXTURE_2D; continue; } // alfa-stage if (strstr(jmeno, "alfa_stage")) { p_text->alfa_stage = atoi(p_znak); continue; } } } kclose(f); } if (p_text->typ == GL_TEXTURE_1D) { p_text->format = (format != K_CHYBA) ? txconf.format1d[format] : (p_text-> alfa) ? txconf.format1d[FORMAT_RGBA1] : txconf.format1d[FORMAT_RGB]; } else { p_text->format = (format != K_CHYBA) ? txconf.format2d[format] : (p_text-> alfa) ? txconf.format2d[FORMAT_RGBA1] : txconf.format2d[FORMAT_RGB]; } return (TRUE); } void txt_default_konfig(char *p_file, EDIT_TEXT_KONFIG * p_konf, char *p_koncovka) { char pom[200] = "_a"; strcpy(p_konf->bitmapa, p_file); strcpy(p_konf->alfamap, p_file); zamen_koncovku(p_konf->bitmapa, p_koncovka); strcat(pom, p_koncovka); zamen_koncovku(p_konf->alfamap, pom); p_konf->typ = GL_TEXTURE_2D; p_konf->format = txconf.format2d[FORMAT_RGB]; p_konf->mip = txconf.text_mip_mapping; p_konf->mip_filtr = txconf.text_mip_filtr; p_konf->std_filtr = txconf.text_filtr; p_konf->wrap_x = txconf.text_wrap_x; p_konf->wrap_y = txconf.text_wrap_y; p_konf->bump = TRUE; p_konf->alfa_stage = K_CHYBA; p_konf->floyd = FALSE; p_konf->no_cull = FALSE; } void txt_lightmap_konfig(EDIT_TEXT_KONFIG * p_konf) { p_konf->typ = GL_TEXTURE_2D; p_konf->format = txconf.format2d[FORMAT_LIGHTMAPY]; p_konf->std_filtr = txconf.text_filtr; p_konf->mip = FALSE; p_konf->mip_filtr = FALSE; p_konf->wrap_x = 0; p_konf->wrap_y = 0; p_konf->bump = FALSE; } /* Textury +scale textur, je-li to potreba */ int txt_nahraj_texturu_z_func(char *p_dir, char *p_file, EDIT_TEXT_OLD * p_text, int save, int load, EDIT_TEXT_KONFIG * p_konf, bitmapa * (*p_load) (char *p_dir, char *p_file)) { EDIT_TEXT_KONFIG konf; txt_default_konfig(p_file, &konf, cti_koncovku(p_file)); txt_nahraj_format(p_dir, p_file, &konf); if (!konf.alfa) { if (!(p_text->p_bmp = p_load(p_dir, konf.bitmapa))) return (FALSE); p_text->load = TRUE; } else { bitmapa *p_tmp = p_load(p_dir, konf.bitmapa); bitmapa *p_alf = p_load(p_dir, konf.alfamap); if (!p_tmp || !p_alf) { /* if(!p_tmp) kprintf(TRUE,"txt_nahraj_texturu_z_func(): Error, unable to load %s",konf.bitmapa); if(!p_alf) kprintf(TRUE,"txt_nahraj_texturu_z_func(): Error, unable to load %s",konf.alfamap); */ bmp_zrus(&p_tmp); bmp_zrus(&p_alf); p_text->load = FALSE; return (FALSE); } p_text->load = TRUE; p_text->p_bmp = p_tmp; p_text->p_bmp = txt_alfa2bmp(p_text->p_bmp, p_alf); bmp_zrus(&p_alf); } if (p_text->flag & TEXT_GEN_DOT3) { bitmapa *p_dot; p_dot = txt_bmp2dot3(p_text->p_bmp); bmp_zrus(&p_text->p_bmp); p_text->p_bmp = p_dot; } if (load) { p_text->p_bmp = txt_bmp2textura(p_text->p_bmp, p_text, &konf, FALSE); } if (p_konf) *p_konf = konf; if (!save) { bmp_zrus(&p_text->p_bmp); } return (p_text->load); } int txt_to_dot3(EDIT_TEXT_OLD * p_text, int save) { bitmapa *p_dot; p_dot = txt_bmp2dot3(p_text->p_bmp); bmp_zrus(&p_text->p_bmp); p_text->p_bmp = txt_bmp2textura(p_dot, p_text, NULL, FALSE); p_text->load = TRUE; if (!save) { bmp_zrus(&p_text->p_bmp); } return (TRUE); } int txt_nahraj_texturu_do_vram(EDIT_TEXT_OLD * p_text, EDIT_TEXT_KONFIG * p_konf) { return (p_text->p_bmp = txt_bmp2textura(p_text->p_bmp, p_text, p_konf, TRUE), TRUE); } int txt_zrus_texturu_ram(EDIT_TEXT_OLD * p_text) { bmp_zrus(&p_text->p_bmp); return (TRUE); } int txt_nahraj_lightmapu_z_bmp(char *p_file, KFILE * f, EDIT_TEXT_OLD * p_text, int save) { EDIT_TEXT_KONFIG konf; txt_lightmap_konfig(&konf); if (p_file) { if (!(p_text->p_bmp = bmp_nahraj(NULL, p_file))) return (FALSE); } else { if (!(p_text->p_bmp = bmp_nahraj(f))) return (FALSE); } p_text->load = TRUE; p_text->p_bmp = txt_bmp2textura(p_text->p_bmp, p_text, &konf, FALSE); if (!save) { bmp_zrus(&p_text->p_bmp); } return (p_text->load); } int txt_nahraj_texturu_z_dds(char *p_dir, char *p_file, EDIT_TEXT_OLD * p_text, int save) { /* Not implemented */ assert(0); return (FALSE); } /* int txt_nahraj_texturu_z_tga(APAK_HANDLE * pHandle, char *p_file, EDIT_TEXT_OLD * p_text) { int ret; if ((ret = tgaLoad(pHandle, p_file, FALSE, GL_DUDV_ATI))) { p_text->load = TRUE; p_text->text = ret; p_text->p_bmp = NULL; strcpy(p_text->jmeno, p_file); glTexParameterf(p_text->typ, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(p_text->typ, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(p_text->typ, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(p_text->typ, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } return (p_text->load); } */ int txt_zrus_2D_texturu(int *p_text) { if (glIsTexture(*p_text)) { glDeleteTextures(1, (GLuint *) p_text); *p_text = 0; return (TRUE); } else { return (FALSE); } } int txt_zrus_texturu(EDIT_TEXT_OLD * p_text) { int ret; ret = glIsTexture(p_text->text); if (ret) { glDeleteTextures(1, &p_text->text); } memset(p_text, 0, sizeof(p_text[0])); return (ret); } int txt_zrus_lightmapu(EDIT_TEXT_OLD * p_text) { int ret; ret = glIsTexture(p_text->text); if (ret) { glDeleteTextures(1, &p_text->text); } if (p_text->p_bmp) bmp_zrus(&p_text->p_bmp); memset(p_text, 0, sizeof(p_text[0])); return (ret); } int txt_zrus_texturu_z_vram(EDIT_TEXT_OLD * p_text) { int ret; ret = glIsTexture(p_text->text); if (ret) { glDeleteTextures(1, &p_text->text); p_text->text = 0; } return (ret); } /***************************************************************** RGBA Bitmapy ***************************************************************** */ bitmapa *bmp_vyrob(int x, int y) { bitmapa *p_bmp; p_bmp = (bitmapa *) mmalloc(sizeof(*p_bmp)); p_bmp->x = x; p_bmp->y = y; p_bmp->data = (dword *) mmalloc(sizeof(dword) * x * y); return (p_bmp); } void bmp_zrus(bitmapa ** p_bmp) { if (*p_bmp) { free((*p_bmp)->data); free((*p_bmp)); *p_bmp = NULL; } } bitmapa *bmp_kopituj(bitmapa * p_bmp) { if (p_bmp) { bitmapa *p_new = bmp_vyrob(p_bmp->x, p_bmp->y); memcpy(p_new->data, p_bmp->data, sizeof(dword) * p_bmp->x * p_bmp->y); return (p_new); } else { return (NULL); } } int bmp_uloz(char *p_file, bitmapa * p_bmp) { SURFACE_SDL surf; bmp2surface(p_bmp, &surf); return(surf.save(p_file)); } int bmp_uloz_pack(FFILE f, bitmapa * p_bmp) { /* AUX_RGBImageRec *p_aux = bmp2aux(p_bmp); uloz_aux_pack(f,p_aux); zrus_aux(&p_aux); */ assert(0); return (TRUE); } bitmapa *bmp_nahraj(char *p_dir, char *p_file) { byte *p_mem; int vel; p_mem = file_read(p_dir, p_file, &vel); if (!p_mem) return (NULL); SURFACE_SDL srf(IMG_Load_RW(SDL_RWFromMem((void *) p_mem, vel), TRUE), SURFACE_TEXTURE, TRUE); bitmapa *p_bmp = surface2bmp(&srf); free(p_mem); return (p_bmp); } int rwseek(struct SDL_RWops *context, int offset, int whence) { return (kseek((KFILE *) context->hidden.unknown.data1, offset, whence)); } int rwread(struct SDL_RWops *context, void *ptr, int size, int maxnum) { return (kread(ptr, size, maxnum, (KFILE *) context->hidden.unknown.data1)); } int rwwrite(struct SDL_RWops *context, const void *ptr, int size, int num) { return (kwrite((void *) ptr, size, num, (KFILE *) context->hidden.unknown.data1)); } int rwclose(struct SDL_RWops *context) { assert(0); } bitmapa *bmp_nahraj(KFILE * f) { SDL_RWops *rw_ops = SDL_AllocRW(); rw_ops->hidden.unknown.data1 = (void *) f; rw_ops->seek = rwseek; rw_ops->read = rwread; rw_ops->write = rwwrite; rw_ops->close = rwclose; SURFACE_SDL srf(IMG_Load_RW(rw_ops, FALSE), SURFACE_TEXTURE, TRUE); bitmapa *p_bmp = surface2bmp(&srf); SDL_FreeRW(rw_ops); return (p_bmp); } bitmapa *bmp_nahraj(char *p_file) { SURFACE_SDL srf(IMG_Load(p_file), SURFACE_TEXTURE, TRUE); bitmapa *p_bmp = surface2bmp(&srf); return (p_bmp); } bitmapa *bmp_prehod(bitmapa * p_bmp) { bitmapa *p_src = bmp_kopituj(p_bmp); tpos y; tpos dx, dy; bmp_cti_rozmery(p_src, &dx, &dy); for (y = 0; y < dy; y++) { memcpy(bmp_getpixel_ref(p_bmp, 0, y), bmp_getpixel_ref(p_src, 0, dy - y - 1), sizeof(dword) * dx); } bmp_zrus(&p_src); return (p_bmp); } /* Prevede standartni lightmapu na dot3 lightmapu */ bitmapa *txt_bmp2dot3(bitmapa * p_bmp) { bitmapa *p_dot = bmp_kopituj(p_bmp); bitmapa_pixel pix; float dX, dY, nX, nY, nZ, oolen; int x, y; for (y = 0; y < p_bmp->y; y++) { for (x = 0; x < p_bmp->x; x++) { // Do Y Sobel filter pix = bmp_getpixel_pix(p_bmp, (x - 1 + p_bmp->x) % p_bmp->x, (y + 1) % p_bmp->y); dY = ((float) pix.r) / 255.0f * -1.0f; pix = bmp_getpixel_pix(p_bmp, x % p_bmp->x, (y + 1) % p_bmp->y); dY += ((float) pix.r) / 255.0f * -2.0f; pix = bmp_getpixel_pix(p_bmp, (x + 1) % p_bmp->x, (y + 1) % p_bmp->y); dY += ((float) pix.r) / 255.0f * -1.0f; pix = bmp_getpixel_pix(p_bmp, (x - 1 + p_bmp->x) % p_bmp->x, (y - 1 + p_bmp->y) % p_bmp->y); dY += ((float) pix.r) / 255.0f * 1.0f; pix = bmp_getpixel_pix(p_bmp, x % p_bmp->x, (y - 1 + p_bmp->y) % p_bmp->y); dY += ((float) pix.r) / 255.0f * 2.0f; pix = bmp_getpixel_pix(p_bmp, (x + 1) % p_bmp->x, (y - 1 + p_bmp->y) % p_bmp->y); dY += ((float) pix.r) / 255.0f * 1.0f; // Do X Sobel filter pix = bmp_getpixel_pix(p_bmp, (x - 1 + p_bmp->x) % p_bmp->x, (y - 1 + p_bmp->y) % p_bmp->y); dX = ((float) pix.r) / 255.0f * -1.0f; pix = bmp_getpixel_pix(p_bmp, (x - 1 + p_bmp->x) % p_bmp->x, y % p_bmp->y); dX += ((float) pix.r) / 255.0f * -2.0f; pix = bmp_getpixel_pix(p_bmp, (x - 1 + p_bmp->x) % p_bmp->x, (y + 1) % p_bmp->y); dX += ((float) pix.r) / 255.0f * -1.0f; pix = bmp_getpixel_pix(p_bmp, (x + 1) % p_bmp->x, (y - 1 + p_bmp->y) % p_bmp->y); dX += ((float) pix.r) / 255.0f * 1.0f; pix = bmp_getpixel_pix(p_bmp, (x + 1) % p_bmp->x, y % p_bmp->y); dX += ((float) pix.r) / 255.0f * 2.0f; pix = bmp_getpixel_pix(p_bmp, (x + 1) % p_bmp->x, (y + 1) % p_bmp->y); dX += ((float) pix.r) / 255.0f * 1.0f; // Cross Product of components of gradient reduces to nX = -dX; nY = -dY; nZ = 1; // Normalize oolen = 1.0f / ((float) sqrt(nX * nX + nY * nY + nZ * nZ)); nX *= oolen; nY *= oolen; nZ *= oolen; pix.r = (byte) PackFloatInByte(nX); pix.g = (byte) PackFloatInByte(nY); pix.b = (byte) PackFloatInByte(nZ); add_color_rgb_byte((byte *) & pix, 60, 60, 60); bmp_putpixel_pix(p_dot, x, y, pix); } } return (p_dot); } byte *file_read(char *p_dir, char *p_file, int *p_read) { char *p_buffer; FILE *f; long v; char filename[MAX_FILENAME]; construct_path(filename, MAX_FILENAME, 2, p_dir, p_file); f = fopen(filename, "rb"); if (!f) return (NULL); fseek(f, 0, SEEK_END); v = ftell(f); fseek(f, 0, SEEK_SET); p_buffer = (char *) mmalloc(sizeof(byte) * v); *p_read = fread(p_buffer, sizeof(byte), v, f); fclose(f); if (*p_read != v) { free(p_buffer); return NULL; } return ((byte *) p_buffer); } bitmapa *surface2bmp(SURFACE_SDL * p_surf) { int dx = p_surf->width_get(), dy = p_surf->height_get(); int x, y; bitmapa *p_vysl = bmp_vyrob(dx, dy); p_surf->lock(); for (y = 0; y < dy; y++) { for (x = 0; x < dx; x++) { tcolor color = p_surf->pixel_get(x, dy - y - 1) & 0xffffff; bmp_putpixel(p_vysl, x, y, color); } } p_surf->unlock(); return (p_vysl); } void bmp2surface(bitmapa *p_bmp, SURFACE_SDL * p_surf) { int dx = p_bmp->x, dy = p_bmp->y; int x, y; p_surf->create(dx, dy); p_surf->lock(); for (y = 0; y < dy; y++) { for (x = 0; x < dx; x++) { tcolor color = bmp_getpixel(p_bmp, x, y); p_surf->pixel_set(x, dy - y - 1, color); } } p_surf->unlock(); } int txt_uloz_btx(char *p_file, int typ, int wrap_x, int wrap_y) { FILE *f = fopen(p_file, "w"); if (!f) return (FALSE); fprintf(f, "wrap_x=%d\n", wrap_x); fprintf(f, "wrap_y=%d\n", wrap_y); fprintf(f, "typ=%d\n", typ == GL_TEXTURE_1D ? 1 : 2); fclose(f); return (TRUE); } /* Nastavi tridu nahravanych textur */ void txt_trida(int trida) { txconf.text_trida = trida; } /* Filtrace bmp pomoci floyd-stemberga -> prevod na 16K do 8,8,8 -> 5,5,5 */ #define MASKA 0x7 #define PRAH (MASKA>>1) inline void bmp_pix_to_16b(byte * p_baze, int *p_er, int *p_eg, int *p_eb) { *p_er = (p_baze[0] & MASKA) - PRAH; *p_eg = (p_baze[1] & MASKA) - PRAH; *p_eb = (p_baze[2] & MASKA) - PRAH; p_baze[0] &= ~MASKA; p_baze[1] &= ~MASKA; p_baze[2] &= ~MASKA; } inline void add_posun_rgba(byte * p_baze, int r, int g, int b, int posun) { r = (r < 0) ? p_baze[0] - ((-r) >> posun) : p_baze[0] + (r >> posun); g = (g < 0) ? p_baze[1] - ((-g) >> posun) : p_baze[1] + (g >> posun); b = (b < 0) ? p_baze[2] - ((-b) >> posun) : p_baze[2] + (b >> posun); if (r > MAX_BYTE) r = MAX_BYTE; if (g > MAX_BYTE) g = MAX_BYTE; if (b > MAX_BYTE) b = MAX_BYTE; if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; p_baze[0] = r; p_baze[1] = g; p_baze[2] = b; } /* 255, 0, 255 0, 0, 0 54, 47, 45 237, 77, 0 238, 77, 0 */ #define BARVA1 (RGB(255,0,255)) #define BARVA2 (RGB(238,77,0)) #define BARVA3 (RGB(237,77,0)) #define BARVA4 (RGB(0,0,0)) #define BARVA5 (RGB(54,47,45)) #define pruhledna_barva(pruhl, barva) (barva = barva&0xffffff, (pruhl && (barva == BARVA1 || barva == BARVA2 || barva == BARVA3 || barva == BARVA4 ||barva == BARVA5))) void bmp_to_16bit(bitmapa * p_bmp, byte maska, int pruhl) { dword *p_pix; dword barva; int r, g, b; int x, y, dx = p_bmp->x, dy = p_bmp->y; for (y = 0; y < dy; y++) { p_pix = p_bmp->data + (y * p_bmp->x); for (x = 0; x < dx; x++, p_pix++) { barva = *p_pix; if (pruhledna_barva(pruhl, barva)) continue; bmp_pix_to_16b((byte *) p_pix, &r, &g, &b); if (x + 1 < dx) { barva = p_pix[1]; if (!pruhledna_barva(pruhl, barva)) add_posun_rgba((byte *) (p_pix + 1), r, g, b, 1); } if (y + 1 < dy) { p_pix += dx; barva = *p_pix; if (!pruhledna_barva(pruhl, barva)) add_posun_rgba((byte *) (p_pix), r, g, b, 2); if (x + 1 < dx) { barva = p_pix[1]; if (!pruhledna_barva(pruhl, barva)) add_posun_rgba((byte *) (p_pix + 1), r, g, b, 4); } if (x > 0) { barva = p_pix[-1]; if (!pruhledna_barva(pruhl, barva)) add_posun_rgba((byte *) (p_pix - 1), r, g, b, 3); } p_pix -= dx; } } } } void edit_text_from_disk(EDIT_TEXT_DISK *p_src, EDIT_TEXT *p_desc) { memcpy(p_desc->jmeno, p_src->jmeno, sizeof(p_src->jmeno)); memcpy(&p_desc->text, &p_src->text, sizeof(EDIT_TEXT_DISK)-offsetof(EDIT_TEXT_DISK,text)); } berusky2-0.12/src/komat/Load.h0000644000175000017500000003317113674772056013103 00000000000000/* Header k load.c :-) funkce pro praci s databazi materialu a textur a nacitanim x1 a out souboru... */ #ifndef __LOAD_H #define __LOAD_H #define TVRDE_CHYBY 0 #define S_NIC "nic" #define MTRL_TAG "MTRL" #define FAKTOR_TAG "AFCT" #define STAG_TAG "STGT" #define TEXT_TAG "TEXT" #define MULTI_TAG "MLTT" #define MRIZKA_TAG "MRIZ" #define MRIZKA_SIG "0001" #define KONFIG_TAG "KNFG" #define MATANIM_TAG "MTAN" #define KONFIG_TAG_OLD "CNFG" #define ANIM_LOAD_ALL 0 #define ANIM_LOAD_FRAME 1 #define ANIM_LOAD_POSUN 2 #define COPY_GEOMETRY 0x0001 #define COPY_DIFFUSE 0x0002 #define COPY_SPECULAR 0x0004 #define COPY_MAP1 0x0008 #define COPY_MAP2 0x0010 #define COPY_MATERIAL 0x0020 #define LOAD_GEOM 0x0001 #define LOAD_MATERIALY 0x0002 #define LOAD_TEXTURY 0x0004 #define LOAD_STAT_LIGHT 0x0008 #define LOAD_DYN_LIGHT 0x0010 #define LOAD_EXTRA_DYN_LIGHT 0x0020 #define LOAD_AMBIENT 0x0040 #define LOAD_MLHA 0x0080 #define LOAD_ZRCADLO 0x0100 #define LOAD_FLARE 0x0200 #define LOAD_LEVEL_ENV 0x0400 #define LOAD_KAMERY 0x0800 #define LOAD_LEVEL_CONF 0x1000 #define SAVE_GEOM_VYBR 0x2000 #define LOAD_ALL (LOAD_GEOM|LOAD_MATERIALY|LOAD_TEXTURY|LOAD_STAT_LIGHT|LOAD_DYN_LIGHT|LOAD_EXTRA_DYN_LIGHT|LOAD_AMBIENT|LOAD_MLHA|LOAD_ZRCADLO|LOAD_FLARE|LOAD_LEVEL_ENV|LOAD_LEVEL_CONF|LOAD_KAMERY) inline void lo_vloz_mezery(FILE * f, int pocet) { int i; for (i = 0; i < pocet; i++) fwrite(" ", sizeof(byte), 1, f); } extern int hlasit_kolize; inline void str_read(char *p_string, FFILE f) { int ret; while ((ret = ffread(p_string, sizeof(char), 1, f)) && ret > 0 && *p_string) p_string++; } /* Koncovky */ char *zamen_koncovku(char *p_file, const char *p_koncovka); char *zamen_koncovku_znak(char *p_file, char znak, const char *p_koncovka); char *cti_koncovku(char *p_file); /* Mlha */ MLZNA_KOSTKA *vyrob_mlhokostku(char *p_jmeno); MLZNA_KOSTKA *kopiruj_mlhokostku(MLZNA_KOSTKA * p_src, char *p_jmeno); void zrus_mlhokostku(MLZNA_KOSTKA ** p_first, MLZNA_KOSTKA * p_maz); MLZNA_KOSTKA *zrus_mlhokostku_all(MLZNA_KOSTKA * p_first); /* Objekty */ int smaz_divoke_vertexy_objektu_dir(EDIT_OBJEKT * p_obj); void zrus_objekt(EDIT_OBJEKT ** p_obj); void kopiruj_objekt_geometrie(EDIT_OBJEKT * p_src, EDIT_OBJEKT * p_cil); EDIT_OBJEKT *vyrob_objekt(void); EDIT_OBJEKT *vyrob_objekt_komplet(int v, int f); EDIT_OBJEKT *kopiruj_objekt(EDIT_OBJEKT * p_src); EDIT_OBJEKT *slep_objekty(EDIT_OBJEKT * p_obj1, EDIT_OBJEKT * p_obj2); /* Kontejnery */ EDIT_KONTEJNER *vyrob_kontejner(void); void zrus_kontejner(EDIT_KONTEJNER ** pp_kont, MLZNA_KOSTKA ** p_first); void zrus_kontejner_rec(EDIT_KONTEJNER ** pp_kont, MLZNA_KOSTKA ** p_first); void vyprazdni_kontejner(EDIT_KONTEJNER * p_kont); void updatuj_kontejner_flag(EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_mat); void updatuj_kontejner_statistika(EDIT_KONTEJNER * p_kont, int obalky); void updatuj_obalku_kontejner(EDIT_KONTEJNER * p_kont); void smaz_divoke_vertexy_kontejneru(EDIT_KONTEJNER * p_kont); void vycisti_kontejner(EDIT_KONTEJNER * p_kont); void preindexuj_kontejner(EDIT_KONTEJNER * p_kont); int slep_kontejner(EDIT_KONTEJNER * p_kont); int slep_kontejner_dist(EDIT_KONTEJNER * p_kont, float min_dist); EDIT_KONTEJNER *kopiruj_kontejner(EDIT_KONTEJNER * p_src, EDIT_MATERIAL ** p_smat, EDIT_MATERIAL ** p_dmat, int dmatnum, STATIC_LIGHT * p_slight, int slightnum, DYN_LIGHT * p_dlight, int dlightnum, EXTRA_DYN_LIGHT * p_elight, int elightnum, LENS_FLARE * p_flare, int maxflares); EDIT_KONTEJNER *kopiruj_kontejner_indir_vyber(EDIT_KONTEJNER * p_src, EDIT_KONTEJNER * p_dest, int flag); int lo_setrid_kontejner(EDIT_KONTEJNER * p_kont); void lo_setrid_kontejner_materialy(EDIT_KONTEJNER * p_kont); void kont_extra_light(EDIT_KONTEJNER * p_kont); /* Animace */ void zrus_tri_vnitrek(HIERARCHY_TRACK_INFO * p_tri); void zrus_tri(HIERARCHY_TRACK_INFO ** p_trii); void key_root_zrus_rec(HIERARCHY_TRACK_INFO * p_tri); void key_root_zrus(HIERARCHY_ROOT * p_root); /* Materialy */ EDIT_MATERIAL *vyrob_material(void); void zrus_material(EDIT_MATERIAL ** p_mat); EDIT_MATERIAL *kopiruj_material(EDIT_MATERIAL * p_src); EDIT_MATERIAL *kopiruj_material_indir(EDIT_MATERIAL * p_src, EDIT_MATERIAL * p_dest); int lo_pocet_materialu(EDIT_MATERIAL ** p_mat, int max); EDIT_MATERIAL *lo_najdi_material_text_point(EDIT_MATERIAL ** p_mat, int max, EDIT_TEXT * p_text); void lo_zrus_material_kont(EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_list, int num); /* Soubor */ int efile(char *p_file); int efiledir(char *p_dir, char *p_file); /* Meshe */ GAME_MESH_OLD *kopiruj_mesh(GAME_MESH_OLD * p_src, GAME_MESH_DATA * p_data); GAME_MESH_OLD *edit_to_mesh(GAME_MESH_DATA * p_mesh_data, EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_mat, int max_mat, int shadow_volume); GAME_MESH_OLD *vyrob_mesh(int objektu, GAME_MESH_DATA * p_data); GAME_MESH_DATA *vyrob_mesh_data(void); GAME_MESH_DATA *kopiruj_mesh_data(GAME_MESH_DATA * p_src, GAME_MESH_OLD * p_mesh_top, GAME_MESH_DATA * p_desc); void zrus_mesh(GAME_MESH_OLD ** p_mesh); void mesh_pridej_vodavertexy(GAME_MESH_OLD * p_mesh); void mesh_pridej_vertex_array(GAME_MESH_OLD * p_mesh); /* Polylisty */ void poly_pridej_vertex_array(EDIT_MESH_POLY * p_poly); EDIT_MESH_POLY *vyrob_poly(void); void zrus_poly(EDIT_MESH_POLY ** p_poly); void zrus_vnitrek_poly(EDIT_MESH_POLY * p_poly); EDIT_MESH_POLY *edit_to_poly_indir(EDIT_KONTEJNER * p_kont, EDIT_MESH_POLY * p_poly, int kID); FFILE lo_poly_file_vyrob(char *p_file, int filenum, int velikost); FFILE lo_poly_file_otevri(char *p_file, int *p_filenum, int velikost); void lo_poly_file_zavri(FFILE f); void lo_poly_uloz(FFILE f, EDIT_MESH_POLY * p_poly, EDIT_TEXT * p_light); void lo_poly_nahraj_indir(FFILE f, EDIT_MESH_POLY * p_poly, EDIT_TEXT * p_light); EDIT_MESH_POLY *lo_nahraj_poly_list(char *p_file, int *p_polynum, EDIT_TEXT * p_light, EDIT_MATERIAL ** p_mat, int matnum); void lo_uloz_poly_list(char *p_file, EDIT_MESH_POLY * p_poly, int polynum, EDIT_TEXT * p_light, EDIT_MATERIAL ** p_mat, int matnum); /* Animacni list */ void lo_vyrob_animaci_list(EDIT_MATERIAL * p_mat, char *p_list, EDIT_TEXT * p_text, int max, char komplet, char *p_dir); void lo_uloz_animaci_list(EDIT_MATERIAL * p_mat, char *p_list, char *p_dir); /* Hledaci funkce */ int lo_najdi_texturu(EDIT_TEXT * p_text, int max, char *p_file, int flag); int lo_najdi_volnou_texturu(EDIT_TEXT * p_text, int max); int lo_najdi_material(EDIT_MATERIAL ** p_mat, int max, char *p_text); int lo_najdi_prazdny_material(EDIT_MATERIAL ** p_mat, int max); int lo_najdi_volny_kontejner(EDIT_KONTEJNER ** p_kont, int max); int lo_najdi_volny_kontejner_up(EDIT_KONTEJNER ** p_kont, int max, int up); int lo_najdi_volny_kontejner_zpet(EDIT_KONTEJNER ** p_kont, int max); int lo_najdi_kontejner(EDIT_KONTEJNER ** p_kont, int max, char *p_jmeno); int lo_najdi_volny_objekt_kont(EDIT_KONTEJNER * p_kont); int lo_najdi_volny_mesh(GAME_MESH_OLD ** p_mesh, int max); int lo_najdi_prazdnou_animaci(ANIM_MATERIAL * p_anim, int max); void lo_zrus_animaci(ANIM_MATERIAL * p_amat); int lo_najdi_kameru(KAMERA * p_kam, int max, char *p_jmeno); int lo_najdi_volnou_kameru(KAMERA * p_kam, int max); int lo_najdi_volny_flare(LENS_FLARE * p_flare, int max); int lo_posledni_svetlo(STATIC_LIGHT * p_light, int max); int lo_najdi_objekt_kont_ID(EDIT_KONTEJNER * p_kont, int ID); EDIT_OBJEKT *lo_najdi_objekt_kont_poiter_ID(EDIT_KONTEJNER * p_kont, int ID); /* Loady */ void lo_poly_calc_lightmap_face(EDIT_MESH_POLY * p_poly); EDIT_KONTEJNER *lo_nahraj_kontejner(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_jmeno, int mat); int lo_reload_textur_dir(EDIT_TEXT * p_text, int max, char *p_dir, int save); int lo_smaz_textury(EDIT_TEXT * p_text, int max); int lo_nahraj_materialy(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file); int lo_uloz_material(EDIT_MATERIAL * p_mat, char *p_file, char *p_dir); int lo_uloz_materialy(EDIT_MATERIAL ** p_mat, int max_mat, char *p_file, char *p_dir); int lo_uloz_materialy_pouzite(EDIT_MATERIAL ** p_mat, int max_mat, char *p_file, char *p_dir); FFILE lo_uloz_kontejner(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER * p_kont_top, char *p_jmeno, int file, FFILE f); void lo_vymaz_materialy(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text); GAME_MESH_OLD *lo_nahraj_mesh(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file, int mat, int extra_light, int json_export = FALSE); int lo_najdi_objekt_kont(EDIT_KONTEJNER * p_kont, char *p_jmeno); EDIT_OBJEKT *lo_najdi_objekt_kont_poiter(EDIT_KONTEJNER * p_kont, char *p_jmeno); EDIT_MESH_POLY *lo_nahraj_poly_list(char *p_file, int *p_polynum, EDIT_TEXT * p_light, EDIT_MATERIAL ** p_mat, int matnum); void lo_uloz_poly_list(char *p_file, EDIT_MESH_POLY * p_poly, int polynum, EDIT_TEXT * p_light, EDIT_MATERIAL ** p_mat, int matnum); void lo_poly_flaguj_materialy(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat); void lo_poly_oznac_zrcadlo(EDIT_MESH_POLY * p_poly); int lo_velikost_textur(EDIT_TEXT * p_text, int max); void lo_kontejner_jedinecne_jmena(EDIT_KONTEJNER * p_kont, int ds3); GAME_MESH_OLD *lo_kontejner_to_mesh(EDIT_KONTEJNER ** p_kont_top, EDIT_MATERIAL ** p_mat, int max_mat, int extra_light); int lo_reload_textur(TEXT_DIR * p_dir, EDIT_TEXT * p_text, int num, int save); int lo_reload_textur_chyby(EDIT_TEXT * p_text, int num); int lo_velikost_meshu(GAME_MESH_OLD ** p_mesh, int num, int *p_facu, int *p_vertexu); int lo_velikost_poly(EDIT_MESH_POLY * p_poly, int num, int *p_facu, int *p_vertexu); void zrus_fleky(FLEK ** p_flek); void zrus_flare(LENS_FLARE ** p_flare); int lo_najdi_volne_dsvetlo(DYN_LIGHT * p_dlight, int max); int lo_najdi_plne_dsvetlo(DYN_LIGHT * p_dlight, int max); DYN_LIGHT *lo_najdi_volne_dsvetlo_point(DYN_LIGHT * p_dlight, int max); int lo_najdi_prepocitej_dsvetlo(DYN_LIGHT * p_dlight, int max); int lo_najdi_prepocitej_extra_svetlo(EXTRA_DYN_LIGHT * p_dlight, int max); int lo_najdi_volne_extra_svetlo(EXTRA_DYN_LIGHT * p_dlight, int max); int lo_najdi_plne_extra_svetlo(EXTRA_DYN_LIGHT * p_dlight, int max); EXTRA_DYN_LIGHT *lo_najdi_volne_extra_svetlo_point(EXTRA_DYN_LIGHT * p_dlight, int max); int lo_najdi_volne_stat_svetlo(STATIC_LIGHT * p_light, int max); int lo_najdi_plne_stat_svetlo(STATIC_LIGHT * p_light, int max); LENS_FLARE *lo_flare2linear(LENS_FLARE * p_flare, int max); void lo_kontlist_jedinecne_jmena(EDIT_KONTEJNER ** p_kont, int listnum); char *cti_za_znak(char *p_string, char znak); #define smaz_face_bez_vertexu(p_face,facenum,f) \ { \ if(f < facenum) \ memmove(p_face+f,p_face+(f+3),(facenum-f-1)*sizeof(p_face[0]));\ facenum -= 3; \ } #define smaz_vertex_bez_facu(p_vert,vertexnum,v)\ { \ if(v+1 < vertexnum) \ memmove(p_vert+v,p_vert+v+1,(vertexnum-v-1)*sizeof(p_vert[0]));\ vertexnum--; \ } inline void mat_default_stage_bloky(EDIT_MATERIAL * p_mat) { MATERIAL_TEXT_OLD *p_stg; int i, j; p_mat->alfa_state = 0; memset(p_mat->text_state, 0, sizeof(p_mat->text_state[0]) * MAT_TEXTUR); for (i = 0; i < MAT_TEXTUR; i++) { p_stg = p_mat->text_state + i; p_stg->text_stage = !i ? 0 : K_CHYBA; for (j = 0; j < MAT_TEXTUR; j++) p_stg->textury[j] = j; /* Defaultni bump-mapping */ p_stg->text_ati_bump_matrix[0] = 2.0f / 256.0f; p_stg->text_ati_bump_matrix[1] = 0.0f; p_stg->text_ati_bump_matrix[2] = 2.0f / 256.0f; p_stg->text_ati_bump_matrix[3] = 0.0f; } } /* Prevod svetel do sceny */ void lo_preved_svetla_do_sceny(EDIT_KONTEJNER * p_kont, STATIC_LIGHT * p_light, int lightnum, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum); void lo_kopiruj_svetla_do_sceny(EDIT_KONTEJNER * p_kont, STATIC_LIGHT * p_light, int lightnum, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum, LENS_FLARE * p_flares, int maxflares); void lo_kopiruj_svetla_do_sceny_mesh(GAME_MESH_DATA * p_data, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum); void lo_preved_svetla_do_sceny_mesh(GAME_MESH_DATA * p_data, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum); void lo_preved_flare_do_sceny(STATIC_LIGHT * p_light, LENS_FLARE * p_flarelist, int flaremax); void lo_vymaz_svetla_ze_sceny(EDIT_KONTEJNER * p_kont); void lo_vymaz_svetla(EDIT_KONTEJNER * p_kont); void lo_vymaz_svetla_ze_sceny_mesh(GAME_MESH_DATA * p_data); void lo_vymaz_svetla_mesh(GAME_MESH_DATA * p_data); void lo_premapuj_svetla_kont(EDIT_KONTEJNER * p_src, EDIT_KONTEJNER * p_dest); void lo_premapuj_svetla_kont_mesh(EDIT_KONTEJNER * p_src, GAME_MESH_OLD * p_dest); void lo_premapuj_svetla_mesh(GAME_MESH_OLD * p_src, GAME_MESH_OLD * p_dest); void lo_transformuj_svetla_do_wordspace(EDIT_KONTEJNER * p_src); void lo_premapuj_svetla_do_wordspace(EDIT_KONTEJNER * p_src); LENS_FLARE *lo_kopiruj_flare(LENS_FLARE * p_flarelist, int max, LENS_FLARE * p_flare); int lo_najdi_objekt_kont_plny(EDIT_KONTEJNER * p_kont); void zrus_kosti_rec(JOINT ** p_joint); void zrus_kosti(EDIT_OBJEKT * p_obj); void zrus_kosti_key(JOINT_KEYS ** p_key); void zrus_kosti_prs_rec(JOINT * p_joint); int lo_reload_textur_vypis(EDIT_TEXT * p_text, int num); int lo_pocet_textur(EDIT_TEXT * p_text, int max); int lo_smaz_textury_bmp(EDIT_TEXT * p_text, int max); void lo_reload_stage(EDIT_MATERIAL ** p_mat, int num); #endif berusky2-0.12/src/komat/kfile.h0000644000175000017500000000271613674454665013322 00000000000000/* K-file - komati soubory */ #ifndef __KFILE_H__ #define __KFILE_H__ typedef struct _KFILE { FFILE fz; } KFILE; inline int efile(char *p_file) { return (file_exists(NULL, p_file)); } inline int efiledir(char *p_dir, char *p_file) { char filename[MAX_FILENAME]; return efile(construct_path(filename, MAX_FILENAME, 2, p_dir, p_file)); } inline int kefile(char *p_dir, char *p_file) { return efiledir(p_dir, p_file); } inline int kread(void *buffer, size_t size, size_t count, KFILE * f) { return (ffread(buffer, size, count, f->fz)); } inline int kwrite(void *buffer, size_t size, size_t count, KFILE * f) { return (ffwrite(buffer, size, count, f->fz)); } inline int kclose(KFILE * f) { ffclose(f->fz); free(f); return (TRUE); } inline KFILE *kopen(char *p_dir, char *p_file, char *p_mod) { KFILE *p_fl = NULL; char filename[MAX_FILENAME]; p_fl = (KFILE *) mmalloc(sizeof(p_fl[0])); if (!p_fl) { return (NULL); } memset(p_fl, 0, sizeof(p_fl[0])); construct_path(filename, MAX_FILENAME, 2, p_dir, p_file); p_fl->fz = ffopen(filename, p_mod); if (!p_fl->fz) { free(p_fl); return (NULL); } return (p_fl); } inline char *kgets(char *string, int n, KFILE * f) { return (ffgets(string, n, f->fz)); } inline int ktell(KFILE * f) { return (fftell(f->fz)); } inline int kseek(KFILE * f, long offset, int origin) { return (ffseek(f->fz, offset, origin)); } inline int keof(KFILE * f) { return (ffeof(f->fz)); } #endif berusky2-0.12/src/komat/Ddx.h0000644000175000017500000000673013674426075012741 00000000000000/* Headr fajl */ #ifndef __DDX_H #define __DDX_H typedef struct _HW_KONFIG { int fullscreen; int screen_width; int screen_height; int bpp; int game_fps; int ditering; int typ_mlhy; int pn_triangles; int pn_triangles_detail; int bump_mapping; int bump_mapping_typ; char **p_ext; int extnum; int perspective; GLuint font_baze; } HW_KONFIG; #define SCREEN_XRES hwconf.screen_width #define SCREEN_YRES hwconf.screen_height #define SCREEN_XSTART 0 #define SCREEN_YSTART 0 #define FORMAT_POCET 8 #define FORMAT_RGB 0 // format pro standartni rgb texturu #define FORMAT_RGBA1 1 // format pro rgb texturu s jednoduchou alfou #define FORMAT_RGBA4 2 // format pro rgb texturu s jemnou alfou #define FORMAT_LUM 3 // format pro svetlou/tmavou texturu #define FORMAT_LUM_ALFA1 4 // format pro svetlou/tmavou texturu + alfa #define FORMAT_LUM_ALFA4 5 // format pro svetlou/tmavou texturu + alfa #define FORMAT_ALFA 6 // format pouze s alfa slozkou textury #define FORMAT_LIGHTMAPY 7 // format pro standartni rgb texturu #define TEXT_MENU 0 #define TEXT_SYSTEM 1 #define TEXT_PRVKY 2 #define TEXT_SCENA 3 #define TEXT_LIGHT 4 #define TEXT_TRID 5 // Konfigurace textur typedef struct _TXT_KONFIG { int text_kvalita; int text_komprese; int text_mip_mapping; int text_mip_filtr; int text_filtr; int text_detail[TEXT_TRID]; int text_bump[TEXT_TRID]; int text_trida; int text_bpp; int text_perspective; int text_max_x; int text_max_y; int text_bpp_plocha; int text_wrap_x; int text_wrap_y; int text_anis; float text_anis_level; float text_ostrost; int format1d[FORMAT_POCET]; // format pro texturu int format2d[FORMAT_POCET]; // format pro texturu } TXT_KONFIG; extern HW_KONFIG hwconf; extern TXT_KONFIG txconf; #define TXT_HI_RES_LOW_X 128 #define TXT_HI_RES_LOW_Y 128 #define TXT_SEKCE "textures" int grf_start(char *p_file); int grf_stop(); void nastav_konfig(HW_KONFIG * p_hwconf, TXT_KONFIG * p_txt); int nahraj_device_config(char *p_file, char *p_sekce); int nahraj_universal_device_config(char *p_file, char *p_sekce); int nahraj_texture_config(char *p_file, TXT_KONFIG * p_txt); void ddw_surf(int x, int y, const char *fmt, ...); void ddw_surf_xy(int x, int y, const char *fmt, ...); int input_surf(int x, int y, char *p_text, int max); int input_surf_ddw(int x, int y, char *p_text, void *p_1, void *p_2, void *p_3, void *p_4, void *p_5, void *p_6, void *p_7, void *p_8, void *p_9); int ddwqueto(char *p_text, ...); int ddwquetot(char *p_title, char *p_text, ...); void tiskni_chybu(int line, char *p_file, char *p_text, ...); void tiskni_chybu_bez_exit(int line, char *p_file, char *p_text, ...); void rozeber_chybu(void); int cti_texture_format(int format, char *p_string); int preloz_texture_format(int *p_format, char *p_string); void BuildFont(void); void KillFont(void); void glPrint(char *fmt, ...); void glChyba(void); #define printfs ddw_surf #define printfsx ddw_surf_xy void anisotropic_filtr_init(TXT_KONFIG * p_txt); #define VYSKA_FONTU 15 #define SIRKA_FONTU 12 void mfree(void **p_mem); void gl_texture_scan(void); void flip(void); inline int fgets_korekce(char *p_kor) { int delka = strlen(const_cast(p_kor)); if (p_kor[delka - 1] == '\n') { p_kor[delka - 1] = 0; return (delka - 1); } else { return (delka); } } #define MAX_FREKVENCE 85 #define SAFE_FREKVENCE 60 #endif berusky2-0.12/src/komat/Berusky3d.h0000644000175000017500000003744713674426075014106 00000000000000/* Berusky GL */ #ifndef __BERUSKY_3D_H #define __BERUSKY_3D_H typedef struct _KOFOLOVA_CARA { BOD p1, p2; BODRGB b1, b2; } KOFOLOVA_CARA; typedef struct _VODOVERTEX { BOD *p_pos; BODRGBA *p_diff_mat; BODRGBA *p_diff; BODRGB *p_spec_mat; BODRGB *p_spec; float vyska; // puvodni vyska vertexu (pricita se k ni aktualni) float sinus; // argument sinusu (podle toho se udelaji barvy) } VODOVERTEX; typedef struct _VODNIK { VODOVERTEX *p_vert; float *p_vzdal; int vertexnum; int flag; // flagy vlnotvoru BOD p; // umisteni vlnotvoru float fi; // poc. faze float perioda; // frekvence float amplituda; // amplituda kmitu float dfi; // poc. faze float dperioda; // frekvence float damplituda; // amplituda kmitu float dr, dg, db, da; float adr, adg, adb, ada; float sr, sg, sb; float asr, asg, asb; struct _VODNIK *p_next; } VODNIK; typedef struct _VODA2 { int meshnum; // meshe privazany k vode (co se vlni) int meshmax; // max pocty meshu ve vodnim dile GAME_MESH_OLD **p_mesh; int vertexu; VODOVERTEX *p_vertexy; VODNIK *p_vodnik; struct _VODA2 *p_next; struct _VODA2 *p_prev; } VODA2; typedef struct _GAME_KAMERA { /* Mod kamery - poly/3ds */ int aktivni; /* Aktualni nastaveni kamery */ GLMATRIX project, word, camera, invcam; // inverzni viev matrix s normalizovanejma vektorama /* Aktualni animace */ KAMERA_TRACK_INFO *p_anim; // animace kamery int a_handle; /* Aktualni hodnoty kamery - 3ds */ BOD p, t; // umisteni kamery float fov; // field-of-view float roll; // nejakej jinej ? /* Aktualni hodnoty kamery - polarni */ float vzdal; // vzdal kamery float vzdal_kor; // korigovana vzdalenost kamery float fi; // uhel kamery float r; // rotace kamery int zmena; // kamera se zmenila/posunula int zmena_last; // kamera se zmenila/posunula v poslednim framu /* Flagy kontrolujici animaci */ int flag; // flag animace int time; // cas animace (0-1) int time_stop; int time_start; // start-time animace int time_delka; // stop-time animace (delka) int *p_flag; // kofoluv flag int start; // frame start int stop; // frame konec } GAME_KAMERA; /* Material-animacni cast */ #define MAX_MAT_ANIMACI 100 // setridim list techto animaci typedef struct _MATERIAL_ANIM_LIST_BUNKA { EDIT_MATERIAL *p_anim; // material int mesh; // odkaz k mesh int objekt; // odkaz k objektu meshe int next_time; // cas pristi aktualizace animace int event; // ceka na udalost } MAL_BUNKA; /* Kontejner-animacni cast */ #define MAX_KONT_ANIMACI 100 #define MAX_SIM_ANIMACI 500 #define MAX_RUN_ANIMACI 200 #define MAX_ANIM_MATIC 20 #define GK_POUZITA 0x1 // Run-animace je pouzivana #define GK_AKTIVNI 0x10 // Run-animace je aktivni #define GK_LOOP 0x100 // Run-animace se prehrava furt dokola #define GK_REMOVE 0x200 // Animace se po dobehnuti automaticky smaze #define ANIM_FLAG_KONEC (-1) typedef struct _GKA_MATICE { GLMATRIX *p_mat; // matice int *p_notify; // notify flag int flagy; // flagy size_ptr fce_param; // promena predavana funkcim void (*funkce_start) (size_ptr prom); // funkce volana na konci animace void (*funkce_frame) (size_ptr prom); // funkce volana kazdy frame void (*funkce_end) (size_ptr prom); // funkce volana na konci animace } GKA_MATICE; typedef struct _GLOBALNI_KONT_ANIMACE { int flag; // flag animace SIMPLE_TRACK_INFO *p_sim; // sim-animace dword time; // cas animace dword time_stop; // stop-cas animace dword time_start; // start-time animace dword time_delka; // delka animace int matic; // pocet matic GKA_MATICE p_mat[MAX_ANIM_MATIC]; // animacni matice BOD p, s; // vysledky aktualni interpolace QUAT q; int *p_flag; // kofoluv flag void *p_param; // kofolova end funkce size_ptr param; size_ptr param2; END_FUNKCE p_endfce; int konec; dword start; // frame start/stop dword stop; size_ptr next_ah; // nastaveni dalsi animace v poradi int next_flag; int next_start; int next_stop; struct _GLOBALNI_KONT_ANIMACE *p_next; // nasledujici polozka renderovaciho seznamu struct _GLOBALNI_KONT_ANIMACE *p_prev; // predchozi polozka renderovaciho seznamu // odmazani = setrideni seznamu } GK_ANIM; typedef struct _GK_TEXTANIM { int material; ANIM_TEXT *p_track; GLMATRIX *p_mat; int flag; // flagy animace (loop a pod) int *p_flag; // strkani vysleku animovani dword time; // aktualni cas dword time_start; dword time_stop; dword time_delka; dword start; // start dword stop; // stop struct _GK_TEXTANIM *p_next; struct _GK_TEXTANIM *p_prev; } GK_TEXTANIM; #define PRUHLEDNY_MESH 0x1 #define PRUHLEDNY_POLY 0x2 #define PRUHLEDNY_FLARE 0x3 typedef struct _PRUHLEDNY_OBJEKT { void *p_objekt; // pointer na objekt int typ; // mesh/poly/flare float vzdal; // vzdalenost od kamery float vzdal_zrc; // vzdalenost od kamery } PRUHLEDNY_OBJEKT; /* Debug-cast */ typedef struct _DEBUG_STATISTIKA { int bodu, facu, objektu, meshu; int hernich_prvku; int poly; int alfa_stage_change; int text_stage_change; int light_meshu; int light_vertexu; int hnizd, hnizd_vid; int lani_vid; int vertex_obj; } DEBUG_STATISTIKA; typedef struct _EDIT_OKNO { GLMATRIX project, word, camera, invcam; // inverzni viev matrix s normalizovanejma vektorama BOD p; // pomene pro prepocitani kamery float vzdal; float fi; float rfi; float roll; char fs; // full-scrren -> pojeho deaktivaci prekresli zbyvajici okna char vp; // jakej pouziva view-port } EDIT_OKNO; #define SFL_POSUN 0x0001 #define SFL_ROTACE 0x0002 #define SFL_ZOOM 0x0004 typedef struct g_config { // Interface to 3D engine AGE_MAIN *p_age; GLMATRIX *p_project, *p_word, *p_camera, *p_invcam; // inverzni viev matrix s normalizovanejma vektorama float *p_vzdal; // vzdal kamery float *p_vzdal_kor; // korigovana vzdalenost kamery float *p_fi; // uhel kamery float *p_rfi; // rotace kamery BOD *p_target; // target-point kamery BOD *p_pos; // pozice kamery float *p_roll; // roll kamery int *p_mod; // mod kamery int kam_omezeni; GAME_KAMERA kamera; NASTAVENI_KAMER kam; KONFIG_DIR dir; TEXT_DIR tdir; /* Informace o levelu */ int prvnum; // pocet prvku na mape PRVEK_LEVELU_GAME *p_prv_lev[MAX_PRVKU_LEVEL]; // seznam prvku umistenych nekde v levelu int hitnum; // mrizka levelu-staticke prvky - steny int *p_hit_list; int prvnum_top; // pocet top prvku na mape PRVEK_LEVELU_GAME *p_prv_lev_top[MAX_PRVKU_LEVEL_TOP]; // seznam top prvku umistenych nekde v levelu int prvnum_low; // pocet low prvku na mape PRVEK_LEVELU_GAME *p_prv_lev_low[MAX_PRVKU_LEVEL_LOW]; // seznam low prvku umistenych nekde v levelu int x_num; int y_num; int z_num; // rozmery levelu float x_start; float y_start; float z_start; BOD level_min; BOD level_max; /* Seznamy pro kresleni */ int dyn_meshlistnum; GAME_MESH_OLD **p_dyn_meshlist[MAX_BERUSKY_KONTEJNERU]; /* Standartni scena */ int mesh_rendernum; int mesh_renderakt; GAME_MESH_OLD **p_mesh_renderlist[MAX_BERUSKY_KONTEJNERU]; int poly_rendernum; int poly_renderakt; EDIT_MESH_POLY **p_poly_renderlist; int meshnum; GAME_MESH_OLD *p_mesh[MAX_BERUSKY_KONTEJNERU]; // seznam dynamickych hernich objektu int mdatanum; GAME_MESH_OLD *p_mdata[MAX_BERUSKY_DATABAZE]; // seznam databaze int polynum; EDIT_MESH_POLY *p_poly; // seznam statickych objektu EDIT_MATERIAL *p_mat[MAX_CELKEM_MATERIALU]; // seznam materialu EDIT_MATERIAL *p_smat; // scene-material EDIT_TEXT p_text[MAX_CELKEM_TEXTUR]; // seznam textur EDIT_TEXT p_lightmap[MAX_RAY_TEXTUR]; // seznam lightmap OBB_TREE_OLD obbtree; // obb-tree levelu /* Fleky v levelu */ FLEK *p_fleky; FLEK *p_fleky_mesh; /* Casticove systemy */ PARMETAC *p_par; /* Materialove animace -> animace materialu */ MAL_BUNKA p_man[MAX_MAT_ANIMACI]; // materialove animace int mannum; /* Animacni mail */ int anim_mail; /* Seznam animaci materialu */ GK_TEXTANIM *p_textanim; /* Globalni kontejnerove anmimace a jejich simple tracky */ HIERARCHY_TRACK_INFO p_track[MAX_SIM_ANIMACI]; SIMPLE_TRACK_INFO p_sim[MAX_SIM_ANIMACI]; int simnum; /* Svazane traky */ GK_ANIM *p_gkanim; // seznam bezicich animaci GK_ANIM p_gkzas[MAX_RUN_ANIMACI]; // zasobnik animaci int gknum; /* Lokalni animacni traky */ GAME_MESH_OLD *p_lokal[MAX_RUN_ANIMACI]; int lokalnum; /* Animace kamer */ KAMERA_TRACK_INFO kamery[KAM_MAX_ANIM]; int kamnum; /* Animace kosti */ JOINT_ANIMACE *p_chap; // seznam aktivnich joint-animaci /* Flare - linearni seznam */ LENS_FLARE *p_flare; /* Staticka svetla */ int slightnum; STATIC_LIGHT p_slight[MAX_FLARE_SVETEL]; /* Dynamicke svetla */ float dl_ambient[4]; // ambientni svetlo pro scenu int dl_recalc; // flag - prepocitat svetla (neco se posunulo) int dl_new; // flag - zmenil se pocet svetel (pribylo/ubylo) int dl_lightnum; int dl_on; // zapnute prepocty statickych svetel DYN_LIGHT p_dlight[MAX_FLARE_SVETEL]; /* Extra dynamicke svetla */ int edl_recalc; // flag - prepocitat svetla (neco se posunulo) int edl_new; // flag - zmenil se pocet svetel (pribylo/ubylo) int edl_lightnum; EXTRA_DYN_LIGHT p_edlight[MAX_FLARE_SVETEL]; /* Linearni seznam mlznych kostek */ MLZNA_KOSTKA *p_mlha; MLZNA_KOSTKA *p_mlha_akt; // aktnivni mlzna kostka ZEMNI_MLHA zm; // zemni mlha /* Linearni seznam vod */ VODA2 *p_voda; /* Zasobnik na pruhledne objektu */ int prhlnum; PRUHLEDNY_OBJEKT prhl[MAX_PRHL_OBJEKTU]; /* Kofolovy cary */ int car_a_kouzel; KOFOLOVA_CARA *p_cary; /* Zrcadlo */ int zrc_akt; // zrcadlo aktivni ZDRCADLO_DESC zrc; // struktura zrcadla #ifdef DEBUG_MOD DEBUG_STATISTIKA debug; int debug_vypisy; int debug_fps; int debug_light; int debug_frame; int debug_draty; #endif FILE *debug_file; int TimeBase; // cas spusteni programu -> casova zakladna (v milisec) int TimeEndLastFrame; // cas na konci posledniho framu (v milisec) int TimeLastFrame; // delka posledniho framu (obracena hodnota je fps) float fps; // fps = 1000/TimeLongLastFrame int frame; // aktualni farme hry // predpocitana data dword conf_barva_pozadi; int conf_barva_pozadi_pouzit; int conf_barva_pozadi_pouzit_default; int conf_extra_light_vertex; int conf_pruhledna_kamera; float conf_pruhledna_kamera_radius; int conf_zpruhlednovac; int conf_menu_render; int conf_p_key; int conf_r_key; int conf_full_light; int conf_full_light_last; int conf_ovladani_rohy; int conf_ovladani_rohy_default; int conf_ovladani_rohy_smer; float conf_ovladani_rohy_rychlost; int conf_animace_okoli; int conf_dyn_light; int conf_dyn_rychlost; int conf_dyn_light_update_all; int conf_dyn_light_beruska; // TRUE - pouze beruska int conf_dyn_light_prvky; // TRUE - pouze prvky int conf_dyn_light_mesh; // TRUE - meshe int conf_dyn_light_poly; // TRUE - poly int conf_caustic; int conf_kurzor_handle; int conf_kurzor_mesh; int conf_load_tiku; int conf_load_tik; int conf_load_krok; void (*p_tik_fce) (void); // look-up tabulka pro druhou odmocninu #define MAX_LOOK_TABLE 256 int p_looksqrt_linear[MAX_LOOK_TABLE * MAX_LOOK_TABLE]; int p_looksqrt_quadratic[MAX_LOOK_TABLE * MAX_LOOK_TABLE]; // Jednorozmerne look-up tabulky float p_looksqrt_linear_float[MAX_LOOK_TABLE]; float p_looksqrt_quadratic_float[MAX_LOOK_TABLE]; #define SIN_TABLE_SIZE 360 // Sinus tabulka float sinus_table[SIN_TABLE_SIZE]; // Flag sceny 1 int sflag1; int mail; // environment sceny LEVEL_ENVIRONMENT env; int ref_pos; int ref_rot; int ref_zmena; // local config int system_kurzor; int mouse_move; char level_name[MAX_FILENAME]; g_config(void) { memset((void *) this, 0, sizeof(*this)); } } G_KONFIG; void ber_projection_set(G_KONFIG * p_ber); void ber_screen_size_set(G_KONFIG * p_ber); void ber_updatuj_fps(G_KONFIG * p_ber); void ber_konfiguruj_berusky(G_KONFIG * p_ber); void ber_init_level(G_KONFIG * p_ber); void ber_klavesy_hra(G_KONFIG * p_ber); void ber_tiskni_statistiku(G_KONFIG * p_ber); void ber_prikaz_zvyraznovac(G_KONFIG * p_ber); void ber_rekonfiguruj_hra(G_KONFIG * p_ber); void ber_rekonfiguruj_3D(G_KONFIG * p_ber); void ber_rekonfiguruj_3D_aplikuj(G_KONFIG * p_ber); #define KONST_KVAD_UTLUM 0.00392156862745098039215686274509804f /* Nastavi kurzor na zadanou pozici */ void ber_nastav_kurzor(int x, int y); /* Vyrobi pozicni matici prvku */ inline GLMATRIX *ber_position_matrix(G_KONFIG * p_ber, GLMATRIX * p_m, int x, int y, int z, int rotace) { init_matrix(p_m); p_m->_41 = (float) (p_ber->x_start + x * X_PRVEK + X_PRVEK / 2); p_m->_42 = (float) (p_ber->y_start + (y >> 1) * Y_PRVEK); p_m->_43 = (float) (p_ber->z_start + z * Z_PRVEK + Z_PRVEK / 2); if (rotace) rotate_matrix_y(p_m, -(rotace * PI / 2)); return (p_m); } /* Vyrobi pozicni matici divokeho prvku */ inline GLMATRIX *ber_position_matrix_abs(G_KONFIG * p_ber, GLMATRIX * p_m, float x, float y, float z, int rotace) { init_matrix(p_m); p_m->_41 = x; p_m->_42 = y; p_m->_43 = z; if (rotace) rotate_matrix_y(p_m, -(rotace * PI / 2)); return (p_m); } inline void ber_position_level(PRVEK_LEVELU_GAME * p_lev, GLMATRIX * p_m, int rotace) { if (p_lev) { p_lev->x = p_m->_41; p_lev->y = p_m->_42 + (Y_PRVEK / 2); // stred prvku je vyse p_lev->z = p_m->_43; p_lev->rotace = rotace; } } #define ber_pozice_v_levelu(_x, _y, _z,_x_num,_z_num) ((_x_num)*(_z_num)*(_y) + (_x_num)*(_z) + (_x)) #define ber_pozice_na_disku(_i,_x,_y,_z,_x_num,_z_num)\ {\ int zb;\ _y = (_i)/((_z_num)*(_x_num));\ zb = (_i)%((_z_num)*(_x_num));\ _z = zb/(_x_num);\ _x = zb%(_x_num);\ }\ #define PRV_LOW 0x01 // Low-prvek #define PRV_TOP 0x02 // Tow-prvek #define PRV_ANIM_END 0x04 // Konec top-animace prvku #define PRVKY_DIR (p_ber->dir.prvky_dir) #define DATA_DIR (p_ber->dir.data_dir) #define SAVE_DIR (p_ber->dir.save_dir) #define BITMAP_DIR (p_ber->dir.bitmap_dir) #define PROFILE_DIR (p_ber->dir.profile_dir) #define GAME_LEVEL_DIR (p_ber->dir.game_level_dir) #define GAME_DATA_DIR (p_ber->dir.game_data_dir) #endif berusky2-0.12/src/komat/Berusky_universal.h0000644000175000017500000001150613674426075015733 00000000000000/* Universalni definice pro berusky - do editoru a do hry Kofola: ------- adas_ -> sound system gl_ -> logika lsi_ -> load/save/init gi_ -> game init ko_ -> kofolovy fce v editoru Komat: ------ be_ -> berusky editor ber_ -> berusky hra */ #ifndef __BERUSKY_UNIVERSAL #define __BERUSKY_UNIVERSAL #define VERZE_KOMAT "MASTER 1.2" #ifdef _DEBUG #define DEBUG_MOD // sbiraji se citlive informace //#define DEBUG_MOD_OBALKY // sbiraji se citlive informace #endif #define MAX_VZDAL_KAMERY 70 #define MIN_VZDAL_KAMERY 10 #define MAX_UHEL_KAMERY DEG2RAD(85.0f) //max uhel 85 stupnu #define MIN_UHEL_KAMERY DEG2RAD(30.0f) //min uhel 35 stupnu #define MAX_CELKEM_MATERIALU 1000 #define MAX_CELKEM_TEXTUR 500 #define MAX_RAY_TEXTUR 1000 #define MAX_BERUSKY_KONTEJNERU 2000 #define MAX_TOP_KONTEJNERU 100 #define MAX_BERUSKY_DATABAZE 100 #define MAX_PRVKU_DATABAZE 1000 #define MAX_PRVKU_LEVEL 1000 #define MAX_PRVKU_LEVEL_TOP 100 #define MAX_PRVKU_LEVEL_LOW 200 #define MAX_PATER 100 #define MAX_FLARE_SVETEL 100 #define MAX_STATE_BLOKU 100 // celkovy pocet state bloku #define MAX_PRHL_OBJEKTU 1000 #define X_ZACATEK (p_bnf->x_start) #define Y_ZACATEK (p_bnf->y_start) #define Z_ZACATEK (p_bnf->z_start) #define X_PRVEK 2 #define Y_PRVEK 2 #define Z_PRVEK 2 #define X_PRVEK2 (X_PRVEK>>1) #define Y_PRVEK2 (Y_PRVEK>>1) #define Z_PRVEK2 (Z_PRVEK>>1) typedef struct _LEVEL_HEADER { int magic; // magicke cislo int x, z, y; // rozmery levelu // LV 6 int prvku; // pocet prvku v levelu float x_start, // starty levelu y_start, z_start; int rezerved[97]; // rezervovano } LEVEL_HEADER; typedef struct _BUNKA_LEVELU_DISK { int guid; int Vazba1; int Vazba2; int Rotace; int mesh; // provazani se scenou int rez[10]; // rezerva } BUNKA_LEVELU_DISK; typedef int MeshHandle; // handle to mesh/item typedef int ExMeshHandle; // handle extra-mesh (neni to prvek ale jen mesh) typedef int DataHandle; // handle meshe/prvku v datazazi typedef int AnimHandle; // handle simple animace (polotovaru animace) typedef size_ptr RunHandle; // handle bezici animace typedef size_ptr MatrixHandle; // handle matice typedef int MatHandle; // handle animovaneho materialu typedef int LightHandle; // handle bezneho dynamickeho svetla typedef int ExtraLightHandle; // handle extra-dynamickeho svetla typedef size_ptr FlekHandle; // handle na fleky typedef size_ptr ParHandle; // handle na casticovac typedef size_ptr FlareHandle; // handle na flare typedef size_ptr HnizdoHandle; // handle na hnizdo typedef size_ptr TextHandle; // handle na texturovou animaci typedef size_ptr VodaHandle; // handle na vodni system typedef size_ptr VodnikHandle; // handle na vodnika ve vodnim systemu typedef size_ptr ChapadelnikHandle; // handle na chapadelnika s chapadlama typedef size_ptr ChapadloHandle; // handle na chapadlo #define FRAMU_PER_SEC 20 #define DELKA_SEC 1000 #define KONCOVKA_LEVELU ".lv6" #define MASKA_LEVELU "*.lv6" #define KONCOVKA_SCENY_OLD ".sc2" #define KONCOVKA_SCENY ".bpr" #define MASKA_SCENY "*.bpr" #define KONCOVKA_MESH_OLD ".out" #define MASKA_MESH_OLD "*.out" #define KONCOVKA_MESH ".b2m" #define MASKA_MESH "*.b2m" #define KONCOVKA_MATERIAL_OLD ".mnt" #define MASKA_MATERIAL_OLD "*.mnt" #define KONCOVKA_MATERIAL ".b2t" #define MASKA_MATERIAL "*.b2t" #define KONCOVKA_LIGHTMAPY ".b2l" #define MASKA_LIGHTMAPY "*.b2l" #define LIST_PRVKU "prvky.txt" #define DEFAULT_LEVEL "a.lv6" #define GUID_PRAZDNA_STENA 21000 // guid neviditelne steny (bez modelu) #define KONT_NEVID_STENA 0 #define KONT_NEVID_PRVEK 1 #define MAX_TRID 30 #define MAX_PODTRID 30 #define MAX_TRID_JMENO 50 #define DELICKA_CASU 1 // pokud je objekt s guid staticky vraci 1 // inline int ber_je_objekt_staticky(int guid) { int trida = guid / 1000; return (trida == 2 || trida == 4 || trida == 9 || trida == 17 || trida == 19 || trida == 20 || trida == 12); } inline int ber_je_objekt_beruska(int guid) { int trida = guid / 1000; return (trida == 1); } inline int ber_je_objekt_staticky_bez_exitu(int guid) { int trida = guid / 1000; return (trida == 2 || trida == 9 || trida == 17 || trida == 19 || trida == 20 || trida == 12); } #endif berusky2-0.12/src/komat/Mat3d.h0000644000175000017500000017561513674454655013210 00000000000000/* Header k enginu */ #ifndef __MAT_3D_H #define __MAT_3D_H #define MAT_TEXTUR 4 #define T_WRAP 0x1 #define T_MIRROR 0x2 #define K_CHYBA (-1) #define NIC K_CHYBA #define MAX_TEXT_ANIM 50 #ifndef GK_LOOP #define GK_LOOP 0x100 // Run-animace se prehrava furt dokola #endif /* */ #ifndef GK_REMOVE #define GK_REMOVE 0x200 // Animace se po dobehnuti automaticky smaze #endif /* */ #define STATE_ADD 2 #define STATE_PRUHLEDNY 3 /* Definice typu */ typedef struct _MUJ_BOD { float x, y, z; float px, py, pz; float nx, ny, nz; float mdr, mdg, mdb, mda; float dr, dg, db, da; float msr, msg, msb; float sr, sg, sb; float tu1, tv1; // 4 textury float tu2, tv2; float tu3, tv3; float tu4, tv4; // lightmapa float tul, tvl; } MUJ_BOD, OBJ_VERTEX, OBJEKT_BOD; /* Definice vertexovych poli */ typedef struct _VERTEX_ARRAYS { int ati_handle; // handle na ati vertex-pole int ati_velikost; // velikost pole - pro cely objekt int ati_start_pos; int ati_start_norm; int ati_start_diff; int ati_start_spec; int ati_start_text[MAT_TEXTUR]; int arb_handle_indicie; } VERTEX_ARRAYS; typedef struct _NORMALBOD { float x, y, z; dword diff; } NORMALBOD; typedef struct _MUJ_BOD_FLARE { float x, y, z, rhw; dword diff; float tu1, tv1; } MUJ_BOD_FLARE; typedef struct _DXBOD { float x, y, z; float r, g, b; } DXBOD; /* Animation key settings */ typedef struct _KEY_POINT_3DS { word frame; /* Key's frame position */ word flags; /* Spline terms used flag */ float tension; /* Flagged with 0x01 */ float continuity; /* Flagged with 0x02 */ float bias; /* Flagged with 0x04 */ float easeto; /* Flagged with 0x08 */ float easefrom; /* Flagged with 0x10 */ } KEY_POINT_3DS; typedef struct _KEY_POINT_BRS { dword time; /* cas tohoto klice */ float tension; /* Flagged with 0x01 */ float continuity; /* Flagged with 0x02 */ float bias; /* Flagged with 0x04 */ float easeto; /* Flagged with 0x08 */ float easefrom; /* Flagged with 0x10 */ } KEY_POINT_BRS; /* Rotation key */ typedef struct _ROTKEY { float angle; /* angle of rotation */ float x; /* rotation axis vector */ float y; float z; } ROTKEY; typedef struct _MATERIAL { float ambient_r; float ambient_g; float ambient_b; float diffuse_r; // difusni barva float diffuse_g; float diffuse_b; float diffuse_a; float specular_r; // zrcadlova barva float specular_g; float specular_b; float faktor_r; // barva na dalsi fligny float faktor_g; float faktor_b; float faktor_a; } MATERIAL; typedef struct _ZDRCADLO_DESC_POLY { int zrcadlo_k; // kontejner zrcadla int zrcadlo_o; // objekt zrcadla int id_kont; // id kontejneru int poly; // poly ktereho se to tyka struct _ZDRCADLO_DESC_POLY *p_next; } ZDRCADLO_DESC_POLY; typedef struct _ZDRCADLO_DESC { // Zustava - popisuje rovine zrcadlo GLMATRIX ref; // reflexni matice BOD p[4]; // 4 body roviny zrcadla ROVINAD r[5]; // 4 plochy klipovaci pyramidy ZDRCADLO_DESC_POLY *p_poly; } ZDRCADLO_DESC; typedef struct _OBB_OLD { BOD obb[3]; // obb smerovy vektory BOD obb_stred; BOD obb_len; BOD obb_hran[8]; // 8 hranicnich bodu obalky BOD aabb_min; // aabb obalka BOD aabb_max; // aabb obalka } OBB_OLD; // Multitextuing pro 1 texturu typedef struct _MULTITEXT_FLAG { GLenum cil; GLenum mod; GLint param; } MULTITEXT_FLAG; typedef struct _OLD_MULTITEXT_FLAG { dword a_arg1, a_op, a_arg2; dword c_arg1, c_op, c_arg2; dword src, dest; } OLD_MULTITEXT_FLAG; // preddefinovany hodnoty pro alfa blending/ michani textur a pod. // nastaveni michanice typedef struct _EDIT_STATE_ALFA_BLOK { char jmeno[MAX_JMENO]; int alfa_pruhledny; int funkce; } EDIT_STATE_ALFA_BLOK; typedef struct _EDIT_STATE_TEXT_BLOK { char jmeno[MAX_JMENO]; // jmeno bloku int funkce; // michaci funkce int edit_funkce; // editacni funkce (-1 pro default) int textur; // pocet porebnych textur 1 (2,3,4 po trebuji extra dialog) int delka; // delka bloku (pocet textur) int textury_typ[MAT_TEXTUR]; // pozadovany typ textur pro dany efekt int text_funkce[MAT_TEXTUR]; // pozadovany typ textur pro dany efekt } EDIT_STATE_TEXT_BLOK; /* 1 renderovaci blok materialu */ typedef struct _MATERIAL_TEXT_OLD { int text_stage; // stage_funkce pro tento blok int textury[MAT_TEXTUR]; // seznam textur pro dany efekt int text_koord[MAT_TEXTUR]; // cislo koordinatu textur int text_funkce[MAT_TEXTUR]; // cisla env funkci float text_ati_bump_matrix[4]; // Ati-bump-map parametry //float parametry... } MATERIAL_TEXT_OLD; #define MLHA_AKTIVNI 0x1 typedef struct _MLZNA_KOSTKA { char jmeno[MAX_JMENO]; // jmeno mlzne kostky BOD min, max; // rozmery kostky int flag; // flagy mlhy int mod; // mod mlhy (linear/exp/exp2) int priorita; // priorita mlzne kostky float start; // zacatek float stop; // konec float intenzita; // intenzita float r, g, b, a; // barva void *p_kont; // pointer na kontejner ke kteremu je privazana int poly; // zazba na poly struct _MLZNA_KOSTKA *p_next; } MLZNA_KOSTKA; #define SL2_DYNAMIC 0x1 // svetlo se aplikuje i na dynamicke veci #define SL2_MESH 0x2 // svetlo pouziva mesh typedef struct _STATIC_LIGHT { int akt; // aktivni svetlo char jmeno[MAX_JMENO]; // jmeno svetla int index; // index svetla (pozice + ID) BOD p; float r, g, b; float k1, k2, k3; // tlumici koeficienty float dosah; // max. dosah svetla char uhel; // tlumit podle uhlu svetla char utlum; // tlumit podle vzdalenosti void *p_flare; // flare svetla - pointer na nej int last_poly; // posledni hitovany poly int last_kont; // posledni hitovany kontejner int flag; // flag vlasnosti svetla -> update a podobne int flag2; // druhy flag -> vlastnosti void *p_mesh_data; // privazany mesh, ke kterymu to patri int bez_prev; // vyjmout z dyn osvetlovani struct _STATIC_LIGHT *p_next; // nasledujici svetlo (v seznamu u kontejneru) struct _STATIC_LIGHT *p_prev; // predchozi svetlo } STATIC_LIGHT; typedef struct _DYN_LIGHT_ANIM { dword endtime; // posledni cas int pos_keys; // klice posunu KEY_POINT_BRS *p_pkeys; BOD *p_pos; int trg_keys; // klice cile KEY_POINT_BRS *p_tkeys; BOD *p_trg; int dos_keys; // klice dosah/min/max KEY_POINT_BRS *p_dskeys; BOD *p_dosah; int diff_keys; // diffusni klice KEY_POINT_BRS *p_dfkeys; BARVA_RGBA *p_diff; int alfa_keys; // alfa klice KEY_POINT_BRS *p_akeys; float *p_alfa; int spec_keys; // spekularni klice KEY_POINT_BRS *p_spkeys; BARVA_RGBA *p_spec; } DYN_LIGHT_ANIM; #define SDL_MESH 0x00000100 // svetlo patri k urcitemu meshi #define SDL_ADD_SUB 0x00000080 // svetlo pracuje v komplementarnim add/sub modu #define SDL_SUB 0x00000200 // svetla se nepricitaji ale moduluji #define SDL_UTLUM_LINEAR 0x00000400 // linearni utlum - defaultni #define SDL_UTLUM_KVADRATIC 0x00000800 // kvadraticky utlum typedef struct _DYN_LIGHT { char jmeno[MAX_JMENO]; int aup; // aktualni upload float avzdal; // aktualni vzdalenost int akt; // svetlo je aktivni/neaktivni dword flag; // flagy svetla dword ktrida; // kofolova trida pouziti dword pflag; // editacni flagy svetla int index; BOD np; // netransformovana pozice BOD tp; // transformovana pozice BOD dir; // umisteni a rozsahy svetla float look_max; // konec kuzele (default = 255 -> prepocitam podle vzdalenosi) float dosah; // konec svetla float min; // zacatek tlumeni kuzele float max; // konec tlumeni kuzele float theta; // sirka kuzele svetla float dr, dg, db; // diffusni barva svetla ve floatu float sr, sg, sb; // diffusni barva svetla ve floatu - odecitaci void *p_mesh_data; // pointer meshe, ke kteremu je svetlo pripojeny dword time; dword time_stop; dword time_start; dword time_delka; dword start; dword stop; int *p_flag; // pointer kam hazu prubeh animace dword an_flag; // animacni flagy (loop/auto remove) DYN_LIGHT_ANIM an; struct _DYN_LIGHT *p_next; struct _DYN_LIGHT *p_prev; } DYN_LIGHT; #define EDL_BODOVE 0x00000001 // Bodove svetlo //#define EDL_REFLEKTOR 0x00000002 // Reflektor #define EDL_PLOSNE_X 0x00000004 // Sviti pouze plosne #define EDL_PLOSNE_Y 0x00000008 #define EDL_PLOSNE_Z 0x00000010 #define EDL_MESH 0x00000020 // Svetlo je privazane na meshe #define EDL_SCENA 0x00000040 // Svetlo je privazane na scenu #define EDL_ZEMNI_MLHA 0x00000080 // je to zemni mlha #define EDL_GOURAND 0x00000100 // pocitat uhly #define EDL_UTLUM_LIN 0x00000200 // pocita se utlumove faktory #define EDL_UTLUM_KVAD 0x00000400 // pocita se utlumove faktory #define EDL_DOSAH 0x00000800 // svetlo ma omezeny dosah #define EDL_MAPPING 0x00001000 // Pouzije se na texturove koordinaty #define EDL_MESH_LIGHT 0x00002000 // Svetlo sviti pouze na vybrane meshe (seznam meshu) #define EDL_PRUHL_LIGHT 0x00004000 // "Zpruhlednovaci" svetlo #define EDL_CAMERA_POINT 0x00008000 // svetlo je umistene ke kamere #define EDL_ALFA_MOD 0x00100000 // Alfa kanal se bude modulovat #define EDL_ALFA_SET 0x00200000 // Alfa kanal se nastavi (prepise puvodni hodnoty) #define EDL_ALFA_ADD 0x00400000 // Alfa kanal se pricte #define EDL_ALFA_SUB 0x00800000 // Alfa kanal se odecita #define EDL_SPEC_MOD 0x01000000 // Spekularni Sveto se bude modulovat #define EDL_SPEC_SET 0x02000000 // Spekularni Svetlo se nastavi (prepise puvodni hodnoty) #define EDL_SPEC_ADD 0x04000000 // Spekularni Svetlo se pricte #define EDL_SPEC_SUB 0x08000000 // Spekularni Svetlo se odecita #define EDL_ZMENA_CAMERA 0x10000000 // Pozemni mlha - pri zmene kamery #define EDL_ANIMACE 0x20000000 // svetlo se prave animuje #define EDL_ZMENA_LOKAL 0x40000000 // lokalni zmena svetla #define EDL_ZMENA_GLOBAL 0x80000000 // globalni zmena svetla typedef struct _EXTRA_DYN_LIGHT { char jmeno[MAX_JMENO]; int akt; // svetlo je aktivni/neaktivni dword flag; // flagy svetla dword pflag; // posunovaci flag dword mflag; // map-flagy svetla dword ktrida; // kofolova trida svetla int index; BOD tp; BOD np; BOD dir; float dosah; // dosah svetla float theta; // sirka kuzele svetla float utlum; // utlum svetla float gourand; // koeficient gourandu -> lesk //float dr,dg,db,da; // diffusni barva svetla float da; // diffusni alfa svetla float sr, sg, sb; // diffusni barva svetla void *p_mesh_data; // zavisly mesh int *p_lmesh; // seznam privazanych meshu int lmeshnum; // max pocet meshu int lmeshakt; // aktualni pocet meshu dword time; dword time_stop; dword time_start; dword time_delka; dword start; dword stop; int *p_flag; // pointer kam hazu prubeh animace dword an_flag; // animacni flagy (loop/auto remove) DYN_LIGHT_ANIM an; float v_start; // zemni mlha - parametry float v_stop; float h_start; float h_stop; struct _EXTRA_DYN_LIGHT *p_next; struct _EXTRA_DYN_LIGHT *p_prev; } EXTRA_DYN_LIGHT; /* Flagy materialu */ #define MAT_MATERIAL 0x00000001 // na objektu je material #define MAT_PRUHLEDNY 0x00000002 // pruhledny material #define MAT_ANIM_FRAME 0x00000010 // material je animovany framama #define MAT_POSUN2D 0x00000100 // posun textury - u animovanych textur #define MAT_3DS_FLAGS 0x00000200 // modifikace textur #define MAT_POUZITY 0x00002000 // pouzity material #define MAT_SYSTEM 0x00004000 // systemovy material #define MAT_LIB 0x00008000 // knihovni material #define MAT_NO_ZMASK 0x01000000 #define MAT_NO_ZTEST 0x02000000 #define MAT_NO_CULL 0x04000000 #define MAT_NO_BUMP 0x08000000 // nepouzit automaticky bump-maping #define MAT_SCENE 0x10000000 // material sceny #define MAT_SCENE_NUTNY 0x20000000 // material sceny nutny #define MAT_NO_SCMT 0x40000000 // material bez causticu #define MAT_T1_EYE_LIN 0x00000800 #define MAT_T2_EYE_LIN 0x00001000 #define MAT_T3_EYE_LIN 0x00100000 #define MAT_T4_EYE_LIN 0x00200000 #define MAT_T1_SPHERE 0x00400000 #define MAT_T2_SPHERE 0x00800000 #define MAT_T3_SPHERE 0x40000000 #define MAT_T4_SPHERE 0x80000000 /* Flagy 2 */ #define MAT2_DIFFUSE 0x00000001 // objekt pouziva difusni barvu, ma se kreslit #define MAT2_SPECULAR 0x00000002 // objekt pouziva spekularni barvu, ma se kreslit #define MAT2_DIFFUSE_RAY 0x00000010 // material se pouzije pro raytracing #define MAT2_SPECULAR_RAY 0x00000020 // spocitaji se odlesky #define MAT2_MAP1 0x00000040 // koordinaty 1 aktivni #define MAT2_MAP2 0x00000080 // koordinaty 2 aktivni #define MAT2_CALC_MAP1 0x00000400 // pocitaji se koordinaty1 #define MAT2_CALC_MAP2 0x00000800 // pocitaji se koordinaty2 #define MAT2_DEF_TEXTANIM 0x00001000 // defaultne se spousti prvni animace textur #define MAT2_ENV_SPEC 0x00002000 // spekularni env mapping #define MAT2_ENV_SPEC_OBE 0x00004000 // spekularni oboustrany env mapping #define MAT2_MAP3 0x00008000 // koordinaty 3 aktivni #define MAT2_MAP4 0x00010000 // koordinaty 4 aktivni #define MAT2_CALC_MAP3 0x00020000 // pocitaji se koordinaty3 #define MAT2_CALC_MAP4 0x00040000 // pocitaji se koordinaty4 #define MAT2_T1_MATRIX 0x00080000 // pouzivat transformacni matici c.3 #define MAT2_T2_MATRIX 0x00100000 // pouzivat transformacni matici c.4 #define MAT2_T3_MATRIX 0x00200000 // pouzivat transformacni matici c.1 #define MAT2_T4_MATRIX 0x00400000 // pouzivat transformacni matici c.2 #define MAT2_MASKA 0x00800000 // pruhledny material #define MAT2_BUMP 0x01000000 // pruhledny material /* Run-time flagy */ #define KONT_POHYB 0x00000001 // Mesh se pohnul v poslednim tahu #define KONT_VIDITELNY 0x00000002 // Mesh je viditelny #define KONT_DRAW_SPEC 0x00000004 // Mesh/Poly pouziva na vykresleni docasne spekularni barvu #define KONT_MPMATRIX 0x00000008 // kontejner pouziva MP matrix #define KONT_DRAW_PRUHL 0x00000010 // Mesh/Poly se ma kreslit jako pruhledny material #define KONT_DRAW_CAMERA 0x00000020 // Mesh/Poly je pred kamerou a ma se kreslit jako pruhledny #define KONT_DRAW_LIGHT 0x00000040 // Mesh/Poly je privazan ke extra-svetlu #define KONT_DRAW_NOBALKA 0x00000080 // Mesh/Poly nema obalku (nema se na ni testovat) #define KONT_DRAW_VODA 0x00000100 // Mesh/Poly je voda (pouzivaji se 3.ti barevne slozky) #define KONT_VIDITELNY_ZRC 0x00000200 // Mesh je viditelny v zrcadle #define KONT_OBRUBA 0x00000400 // Mesh je obruba levelu #define KONT_PODLOZKA 0x00000800 // Mesh je podlozka levelu #define KONT_NO_SELF_SHADOW 0x00001000 // nevrha stiny na sebe #define KONT_PLG_OFFSET 0x00002000 // Mesh pouziva polygon-offset #define KONT_NORMAL_ANIM 0x00004000 // animace normalovych vektoru #define KONT_VIDITELNY_PRUHL 0x00008000 // poly/mesh je viditelny a pruhledny #define KONT_SVETLO 0x00010000 // kontejner ma pripojene svetlo #define KONT_VODA 0x00020000 // kontejner ma pripojenou vodu/vlnovy generator #define KONT_NORMAL_ANIM_POS 0x00040000 // animace normalovych vektoru //#define KONT_VIDITELNY_ZRC_FULL 0x00040000 // Mesh je viditelny v zrcadle #define KONT_UPLOAD 0x00080000 // Upload meshe do vertex-pole #define KONT_NO_FOG 0x00100000 // - nekresli se mlha #define KONT_NO_CALC 0x00200000 // - je to needitovaelny objekt #define KONT_POHYB_ZRUS 0x00400000 // zrusit pohybovej flag #define KONT_STATIC 0x00800000 // je staticky //#define KONT_LEVEL_CUBE 0x01000000 // je to kostka kolem levelu #define KONT_BRUTALNORMAL 0x02000000 // uplne kulaty objekt #define KONT_VIDITELNY_ZMENA 0x04000000 // zmenila se viditelnost meshe (z neviditelneho na viditelneho!) #define KONT_PRVEK 0x08000000 // prvek levelu #define KONT_VERTEX_LIGHT 0x10000000 // svetla ve vertexech #define KONT_NO_DRAW_SHADOW 0x20000000 // nevrha stiny na dalsi objekty #define KONT_KEYFRAME 0x40000000 // kontejner ma pripojene keyframy #define KONT_ZRCADLO 0x80000000 // kontejner/poly je zrcadlo #define KONT2_UPDATE_POS 0x00000001 #define KONT2_UPDATE_NORM 0x00000002 #define KONT2_UPDATE_DIFF 0x00000004 #define KONT2_UPDATE_SPEC 0x00000008 #define KONT2_UPDATE_TEXT1 0x00000010 #define KONT2_UPDATE_TEXT2 0x00000020 #define KONT2_UPDATE_TEXT3 0x00000040 #define KONT2_UPDATE_TEXT4 0x00000080 #define KONT2_UPDATE_NEW 0x00000100 #define KONT2_UPLOAD (KONT2_UPDATE_POS|KONT2_UPDATE_NORM| \ KONT2_UPDATE_DIFF | KONT2_UPDATE_SPEC | \ KONT2_UPDATE_TEXT1 | KONT2_UPDATE_TEXT2 | \ KONT2_UPDATE_TEXT3 | KONT2_UPDATE_TEXT4 | \ KONT2_UPDATE_NEW) #define KONT2_LOADED 0x00000100 // kontejner byl nahran z disku #define KONT2_JOINT_ANIM 0x00000200 // kontejner ma joint animace #define KONT2_NO_PHONG 0x00000400 // kontejner se renderuje bez phongu #define KONT2_BERUSKA 0x00000800 // kontejner je beruska #define KONT_STATICKY_PRVEK (KONT_PRVEK|KONT_STATIC) #define KONT_DYNAMICKY_PRVEK (KONT_PRVEK|KONT_VERTEX_LIGHT|KONT_NO_DRAW_SHADOW|KONT_NO_SELF_SHADOW) /* Frame animace */ #define FRAME_EVENT 0x1 // timto framem se nepokracuje (ceka se na udalost) #define FRAME_ALFA_FAKTOR 0x2 // tento frame ma nastavit alfa-stage #define FRAME_TEXTURA 0x4 // tento frame ma nastavit texturu #define FRAME_POSUN 0x8 // posun texturu oproti originalu typedef struct _ANIM_FRAME { char file[MAX_JMENO]; // soubor s animaci EDIT_TEXT *p_text; dword time; // cas dword alfa; // alfa faktor float u, v; // posun textury oproti originalu dword flag; // flagy framu } ANIM_FRAME; typedef struct _ANIM_MATERIAL { char jmeno[MAX_JMENO]; char pouzita; // pouzita animace char aktivni; // aktivni animace (animuje se) int framenum; // framova animace int frameakt; // aktualni frame ANIM_FRAME *p_frame; // pole framu dword last_time; // posledni cas animace (v jaky cas byl zobrazen // posledni frame) } ANIM_MATERIAL; // flagy importovane z 3D studia typedef struct _TDS_MAT_FLAGS { float u_scale; float v_scale; float vyc1; float u_offset; float v_offset; float vyc2; float rot_angle; } TDS_MAT_FLAGS; #define ANIM_TEXT_DEFAULT 0x1 typedef struct _ANIM_TEXT { int flag; // flagy animace (loop a pod) int *p_flag; // strkani vysleku animovani char stav; // 0 = stop, 1 = run dword endtime; // konecny cas (pocet framu) dword time; // aktualni cas dword time_start; dword time_stop; dword time_delka; dword start; // start dword stop; // stop BOD pos; // vysledny pozucni klic int pos_keys; // pozicni klice BOD *p_pos; // pozice KEY_POINT_BRS *p_pkeys; // Spline values for pos keys BOD pivot; // vysledny pivot klic int piv_keys; // pivot klice BOD *p_piv; // pivot KEY_POINT_BRS *p_vkeys; // Spline values for pivot keys BOD scs; // vysledny scale klic int scs_keys; // scale klice BOD *p_scale; // scaling keys KEY_POINT_BRS *p_skeys; // Spline values for scale keys float rot; // vysledny uhel int rot_keys; // Number of rotation keys float *p_rot; // Absolutni roracni traky KEY_POINT_BRS *p_rkeys; // Spline values for rotation keys int rez[10]; // rezervovano } ANIM_TEXT; #define SMATERIAL_POSLEDNI 10 typedef struct _EDIT_MATERIAL { // Jmeno materialu char jmeno[MAX_JMENO]; // Textury materialu char textfile[MAT_TEXTUR][MAX_JMENO]; EDIT_TEXT *p_text[MAT_TEXTUR]; int textflag[MAT_TEXTUR]; // flag textury GLMATRIX ttext[MAT_TEXTUR]; // matrice posunu co se dava jako settransformmatrix float texgen_koord_s[MAT_TEXTUR][4]; // texture-generovane veci float texgen_koord_t[MAT_TEXTUR][4]; // texture-generovane veci float texgen_koord_r[MAT_TEXTUR][4]; // texture-generovane veci float texgen_koord_q[MAT_TEXTUR][4]; // texture-generovane veci /* Michaci funkce */ int alfa_state; // alfa blok MATERIAL_TEXT_OLD text_state[MAT_TEXTUR]; // texture bloky float lesk; // lesklost MATERIAL dxmat; // barva objektu ANIM_MATERIAL anim; // frame animace (u animovanych materialu) int atextnum[MAT_TEXTUR]; int atextakt[MAT_TEXTUR]; ANIM_TEXT *p_atext[MAT_TEXTUR][MAX_TEXT_ANIM]; // animace textur int smaterial_pozice; // pozice s-materialu int textur; // celkovy pocet textur ktery material pouziva dword flag; // flagy materialu dword flag2; // flagy2 materialu int material_handle; // handle materialu TDS_MAT_FLAGS tds; // modifikace importovane z 3d studia float env_r, // env spekularni barva env_g, env_b; float env_add1; // aditivni konstanta 1 float env_add2; // aditivni konstanta 2 float env_scale; // scale env uhlu struct _EDIT_MATERIAL *p_sub; // pole sub-materialu (pouze pro ase-loader) } EDIT_MATERIAL; #define PART_AKT 0x1 // castice je aktivni #define PART_POHYB 0x2 // castice se pohybuje #define PART_SCALE 0x4 // castice se roztahuje/smrstuje #define PART_ANIM 0x8 // castice je animovana /* Tracky nacitane z 3ds souboru */ typedef struct _TRACK_INFO { char jmeno[MAX_JMENO]; int objekt; //objekt kteremu tento track patri //kazdy objekt ma 1 track int parent; //rodic tohoto objektu BOD pivot; //pivot-point word flags[2]; //flagy animace int framenum; int framestart; // Position keys dword pos_keys; // Number of position keys word pos_flag[7]; // Loop control flag for position keys KEY_POINT_BRS *p_pkeys; // Spline values for position keys BOD *p_pos; // Mesh position keys // Rotation keys dword rot_keys; // Number of rotation keys word rot_flag[7]; // Loop control flag for rotation keys KEY_POINT_BRS *p_rkeys; // Spline values for rotation keys QUAT *p_at; // Absolutni traky ROTKEY *p_rot; // Rotation keys // Scale keys dword scs_keys; // Number of scaling keys word scs_flag[7]; // Loop control flag for scaling keys KEY_POINT_BRS *p_skeys; // Spline values for scaling BOD *p_scale; // Mesh scaling keys struct _TRACK_INFO *p_next; //dalsi track } TRACK_INFO; typedef struct _KEYFRAMER_DATA { int frame_start; int frame_stop; TRACK_INFO *p_track; } KEYFRAMER_DATA; typedef struct _KAMERA_TRACK_INFO { char jmeno[MAX_JMENO]; int flag; int parent; int objekt; dword endtime; int stav; dword time; dword time_start; dword time_stop; dword time_delka; dword start; dword stop; // Position keys int pos_keys; // Number of position keys KEY_POINT_BRS *p_pkeys; // Spline values for position keys BOD *p_pos; // Kamera position keys // Target keys int trg_keys; // Number of target keys KEY_POINT_BRS *p_tkeys; // Spline values for target keys BOD *p_trg; // target keys // Roll keys int roll_keys; // Number of roll keys KEY_POINT_BRS *p_rlkeys; // Spline values for roll keys float *p_roll; // FOV keys int fov_keys; // Number of fov keys KEY_POINT_BRS *p_fkeys; // Spline values for fov keys float *p_fov; // Quat-keys int quat_keys; // Number of scaling keys KEY_POINT_BRS *p_qkeys; // Spline values for scaling QUAT *p_quat; // Mesh scaling keys } KAMERA_TRACK_INFO; /* Tracky udrzovane v pameti */ typedef struct _HIERARCHY_TRACK_INFO { // provazani se scenou struct _HIERARCHY_TRACK_INFO *p_otec; int childnum; // pocet detskych traku struct _HIERARCHY_TRACK_INFO **p_child; // detske tracky // Aktualni objekt void *p_obj; //-> kam to mam sypat GLMATRIX *p_m; //-> do teto matice to soupat BOD pivot; BOD pivot_sim; // Jmena rodicu char jmeno[MAX_JMENO]; char jmeno_otec[MAX_JMENO]; // loadovaci promene int parentnum; int objnum; dword endtime; // posledni cas animace (vetsinou delka) int pos_keys; // pozicni klice KEY_POINT_BRS *p_pkeys; // Spline values for position keys BOD *p_pos; // Mesh position keys int scs_keys; // scale klice KEY_POINT_BRS *p_skeys; // Spline values for scaling BOD *p_scale; // Mesh scaling keys int rot_keys; // Number of rotation keys KEY_POINT_BRS *p_rkeys; // Spline values for rotation keys QUAT *p_at; // Absolutni traky } HIERARCHY_TRACK_INFO; typedef struct _HIERARCHY_ROOT { float delka; // delka casu animace (fps) char stav; // 0 = stop, 1 = run int flag; // flagy animace (GL_LOOP,GL_REMOVE) dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int framenum; // framenum = 0 - volna animace int childnum; // pocet detskych traku char jmeno[MAX_JMENO]; // jmena animaci HIERARCHY_TRACK_INFO **p_child; } HIERARCHY_ROOT; /* typedef struct _MESH_OBALKY { BOD lmin; // lokalni obalky min (pouze vertexy) BOD lmax; // lokalni obalky max BOD gmin; // globalni obalky min (transformovane pozicni matici meshe) BOD gmax; // globalni obalky max } MESH_OBALKY; */ #define KONT_MAX_ANIM 40 #define KAM_MAX_ANIM 10 #define SIMPLE_AKTIVNI 0x8 /* simple track info -> na cely kontejner jeden track */ typedef struct _SIMPLE_TRACK_INFO { int Objekt_ID; // id objektu ke kteremu animace patri dword flag; int keynum; // pocet klicu BOD *p_pos; // Mesh position keys BOD *p_scale; // Mesh scaling keys QUAT *p_at; // Absolutni traky float *p_norm; // Normal-scale animace BOD pivot; // pivot point animace -> kopiruje se z objektu BOD pivot3ds; // pivot 3ds animace GLMATRIX *p_m; // kam to hazet GLMATRIX *p_all_matrix; // v pripade all-inclusive float *p_object_norm; // semka strkat normal-scale OBB_OLD *p_obb_local; OBB_OLD *p_obb_world; int childnum; // pocet svistich traku struct _SIMPLE_TRACK_INFO *p_child; // svisti traky struct _SIMPLE_TRACK_INFO *p_otec; // otcovy traky } SIMPLE_TRACK_INFO; typedef struct _HIERARCHY_SIM { float delka; // delka casu animace (fps) char stav; // 0 = stop, 1 = run int flag; // flagy animace (GL_LOOP,GL_REMOVE) dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int keynum; // pocet klicu char jmeno[MAX_JMENO]; // jmeno animace int childnum; // pocet detskych traku SIMPLE_TRACK_INFO *p_child; } HIERARCHY_SIM; // vyrobi list sousednosti plosek -> na filtraci typedef struct _FACE_SOUS { word f[3]; // pokud face == K_CHYBA -> je to to samy } FACE_SOUS; // Bezier PRS klice pro uzel typedef struct _JOINT_KEYS { int pos_keys; // pozicni klice KEY_POINT_BRS *p_pkeys; // Spline values for position keys BOD *p_pos; // Mesh position keys int rot_keys; // Number of rotation keys KEY_POINT_BRS *p_rkeys; // Spline values for rotation keys QUAT *p_rot; // Absolutni traky int scs_keys; // scale klice KEY_POINT_BRS *p_skeys; // Spline values for scaling BOD *p_scale; // Mesh scaling keys } JOINT_KEYS; // tuhost kloubu? // typ kloubu? (rotace/...) typedef struct _JOINT { int joint_ID; // ID a cislo jointu int vertexnum; // seznamy vertexu int *p_vertexlist; int flag; float tuhost; // tuhost kloubu (pro in-game animace) dword pos_keys; // absolutni pozice BOD *p_pos; BOD p; dword rot_keys; // absolutni rotace - tracky QUAT *p_rot; QUAT r; dword scs_keys; // absolutni scale BOD *p_scs; BOD s; BOD pivot; // pivot point kosti GLMATRIX m; JOINT_KEYS *p_keys; struct _JOINT *p_child; // linearni seznam child kosti struct _JOINT *p_next; // linearni seznam next kosti } JOINT; typedef struct _JOINT_ANIMACE { char jmeno[MAX_JMENO]; int framenum; int *p_flag; int flag; //GK_LOOP a spol. int konec; //flag konce int deb_kn; float deb_time; dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int stav; BOD *p_pos_in; BOD *p_pos_out; BOD *p_norm_in; BOD *p_norm_out; int *p_k2flag; // k2 flag kontejneru int *p_kkflag; // kflag kontejneru int *p_koflag; // kflag objektu JOINT *p_child; struct _JOINT_ANIMACE *p_next; // dalsi animace v seznamu objektu struct _JOINT_ANIMACE *p_game_next; // dalsi animace v seznamu animaci struct _JOINT_ANIMACE *p_game_prev; // predchozi animace v seznamu animaci struct _JOINT_ANIMACE *p_next_gen; // dalsi animace v seznamu pro generovani void *p_obj; // tmp pointer na objekt } JOINT_ANIMACE; #define O_INDEX_POCET 0 #define O_INDEX_TYP 1 #define O_INDEX_DATA 2 // Konstni animace objektu typedef struct _EDIT_OBJEKT { char jmeno[MAX_JMENO]; char jmeno_parent[MAX_JMENO]; int Objekt_ID; // ID objektu word vertexnum; OBJ_VERTEX *p_vertex; BOD *p_vertex_kosti; // kostni vertexy word facenum; word *p_face; dword *p_fsous; GLenum face_typ; // typ facu int optnum; // optimalizovane facy int *p_opt; word linenum; word *p_line; GLenum line_typ; // typ car int material; // pouzity material (z tabulky materialu) int material_sub; float float_scale; // aktualni float-scale float float_scale_last; // minuly float scale word x_rect; // x ctvercu objektu word y_rect; // y ctvercu objektu char kreslit; BOD pivot; // pivot-point objektu (relativni) char trans; // transformovane svetlo (je preveden na billboard a spocitane okoli) dword m1flag; // flagy objektu dword m2flag; // flagy objektu dword oflag; TRACK_INFO *p_track; // track info k animaci GLMATRIX m; // matrix k animacim OBB_OLD obb; void *p_tmp_top; // pomocny pointer na kontejner struct _EDIT_OBJEKT *p_tmp_next; // pomocny pointer na dalsi objekt JOINT_ANIMACE *p_joit_animace; // pointer na joint-animace struct _EDIT_OBJEKT *p_lod; // LOD objekty tohodlenctoho SIMPLE_TRACK_INFO *p_tmp_sim; } EDIT_OBJEKT; typedef struct _BUNKA_ZEME { int s; // preskocit bodu int dx, dy; // bodu word o; } BUNKA_ZEME; #define MAX_KONT_OBJEKTU 3000 #define MAX_KONT_TEXTUR 200 #define MAX_KONT_MATERIALU 200 typedef struct _EDIT_KONTEJNER { char jmeno[MAX_JMENO]; int kontejner_ID; // identifikacni cislo kontejneru -> jedinecne pri ukldani sceny EDIT_OBJEKT *p_obj[MAX_KONT_OBJEKTU]; GLMATRIX world; // hlavni modifikovaci matice (scale a pod -> nulova transfromace na stred) GLMATRIX mpmatrix; // pozicni matice - aktivni pouze pri ukladani/nahravani int max_objektu; char kreslit; int prvek; // pokud prvek -> je to logicky prvek k beruskam == K_CHYBA -> neni to prvek dword m1flag; // slepenec vsech materialu dword m2flag; // slepenec vsech materialu dword kflag; // slepenec vsech objektu dword k2flag; int facu; int bodu; int objektu; int mailbox; int kont; int low_id; // identifikator low/top-kontejneru OBB_OLD obb; MLZNA_KOSTKA *p_mlha; // pointer na mlznou kostku kontejneru HIERARCHY_SIM sim[KONT_MAX_ANIM]; // seznam animaci - sim-animace int akt_animace; // aktualne vybrana animace struct _STATIC_LIGHT *p_slight; // seznam statickych svetel struct _DYN_LIGHT *p_dlight; // seznam dynamickych svetel struct _EXTRA_DYN_LIGHT *p_edlight; // seznam extra svetel struct _EDIT_KONTEJNER *p_next; // dalsi kontejner v multi-mesh kontejnerech struct _EDIT_KONTEJNER *p_next_low; // dalsi kontejner v low hierarchii struct _EDIT_KONTEJNER *p_next_top; // top-kontejner } EDIT_KONTEJNER; // Seznam fleku v levelu typedef struct _FLEK { BOD p; // pozice fleku BOD nx, nz; // normalovy vektor fleku float u[4]; // mapovaci souradnice u float v[4]; // mapovaci souradnice v int material; // material fleku int uroven; float bias; int mesh; int flag; struct _FLEK *p_next; struct _FLEK *p_prew; } FLEK; #define LANI_FRONTA 6 typedef struct _GAME_MESH_ANIMACE { int update; // update animacniho stromu int akt[LANI_FRONTA]; // cislo aktivni animace, -1 pro zadnou int odkaz; // odkaz do tabulky int flag[LANI_FRONTA]; // flag animace SIMPLE_TRACK_INFO *p_sim[LANI_FRONTA]; // vrchni animace animacniho stromu dword time; // cas animace (0-1) dword time_stop; dword time_start; // start-time animace dword time_delka; int *p_flag[LANI_FRONTA]; // kofoluv flag dword start[LANI_FRONTA]; // frame start dword stop[LANI_FRONTA]; // frame konec } GAME_MESH_ANIMACE; #define GAME_MESH_RANI 0x1 //Game-mesh se animuje v sim_animaci typedef struct _EXTRA_FACE { int typ; word facenum; word *p_face; } EXTRA_FACE; typedef struct _GAME_MESH_DATA { void *p_mesh; // tatik-mesh dword m1flag; // flag materialu 1 dword m2flag; // flag materialu 2 dword kflag; // flag kontejneru dword k2flag; // druhy flag kontejneru int mesh_handle; // handle meshe int mesh_ID; // Svetla meshe void **p_light; // pole svetel meshu int slightnum; int lightmax; // velikost pole na svetla int lightakt; // aktualni velikost // Extra-dynamicke svetla meshe int top_edlight; // top_dynamicke svetlo EXTRA_DYN_LIGHT **p_edlight; int edlightnum; // aktualni pocet svetel int edlightmax; // maximalni pocet svetel // Loadovaci svetla meshe -> kopie z kontejneru struct _STATIC_LIGHT *p_lslight; // seznam statickych svetel struct _DYN_LIGHT *p_ldlight; // seznam dynamickych svetel struct _EXTRA_DYN_LIGHT *p_lelight; // seznam extra svetel } GAME_MESH_DATA; typedef struct _GAME_MESH_OLD { //celej kontejner char jmeno[MAX_JMENO]; dword vertexnum; // pocet vsech vertexu BOD *p_vertex_pos; // pozice bodu (po trojicich) BOD *p_vertex_pos_kosti; // pozice bodu (po trojicich) pro kostni transformaci BOD *p_vertex_norm; // normalove vektory BOD *p_vertex_norm_kosti; // normalove vektory pro kosti BODRGBA *p_vertex_diff_material; // materialove difusni barvy BODRGBA *p_vertex_diff; // vysledne difusni barvy BODRGBA *p_vertex_diff_voda; // vysledne difusni barvy vody BODRGB *p_vertex_spec_material; // materialove spekularni barvy BODRGB *p_vertex_spec; // vysledne spekularni barvy BODRGB *p_vertex_spec_voda; // vysledne spekularni barvy BODUV *p_vertex_uv1_material; // materialove text-koordinaty 1 BODUV *p_vertex_uv2_material; // materialove text-koordinaty 2 BODUV *p_vertex_uv3_material; // materialove text-koordinaty 3 BODUV *p_vertex_uv4_material; // materialove text-koordinaty 4 int objektu; // pocet objektu v meshi - pocet pointeru v extra face int *facenum; // pocty facu v extra-facich - polich int *facestart; // starty facu jednotlivych objektu int *p_face; int facevel; // velikost bloku plosek word *objektnum; // pocty vertextu v objektech word *objektstart; // starty vertextu objektu OBB_OLD *p_obb_local; // lokalni obalky objektu OBB_OLD *p_obb_world; // obalky transformovane do world-space OBB_OLD obb_local; // lokalni obalka kontejneru OBB_OLD obb_world; // world-space obalka kontejneru // EDIT_MATERIAL **p_mat; // pole pointeru na materialy na jednotlive objekty int *p_mat; // odkaz na meshe MLZNA_KOSTKA *p_mlha; // mlzna kostka meshe GLMATRIX *p_key; // klicove animacni matice pro kazdy objekt int *p_Objekt_ID; // ID objektu GLMATRIX m; // top-level matice GLMATRIX world; // world-transformace GAME_MESH_ANIMACE siminfo; // informace o aktualni animaci SIMPLE_TRACK_INFO *p_sim; // seznam vsech top-level animaci int simnum; // pocet simu dword *p_kflag; // kont-flagy pro urcite kontaky float *p_normal_scale; // scale normalovych vektoru float *p_normal_scale_last; // posledni scale normalovych vektoru float *p_normal_y; // puvodni y objektu // Aktualni (vybrana) animace meshe a jeji cas SIMPLE_TRACK_INFO *p_sim_aktivni; // aktivni animace dword sim_aktivni_time; // jeji aktualni cas dword sim_flag; // flag meshe int low_id; // low-id meshe struct _GAME_MESH_OLD *p_next; // pointer na dalsi mesh v poradi GAME_MESH_DATA *p_data; // stejne data pro vsechny meshe v multimeshu VERTEX_ARRAYS varray; // vertex-arrays // kazdy objekt ma svoji joint-animaci (pokud to je joint-anim kontejner) JOINT_ANIMACE **p_joint_anim; // seznam joint animaci BOD kofola_pivot; // kofolovy pivoty int mail; int nekreslit; } GAME_MESH_OLD; typedef struct _POZICE_BODU_2D { float x, y, z, w; // transformovane souradnice } POZICE_BODU_2D; typedef struct _TEXT_KOORD { float x, y, z; float nx, ny, nz; float tu1, tv1; // souradnice prvni textury float tu2, tv2; // souradnice druhe textury float tu3, tv3; // souradnice druhe textury float tu4, tv4; // souradnice druhe textury float tul, tvl; // souradnice light-mapy float dr, dg, db, da; // difusni barva barva r g b a float mdr, mdg, mdb, mda; // difusni barva barva r g b a float sr, sg, sb; // spekularni barva barva r g b float msr, msg, msb; // spekularni barva barva r g b } TEXT_KOORD; typedef struct _LIGHTMAP_FACE { int last_u; int upload; // face se ma uploadovat do videokarty bitmapa *p_bmp; // pointer na bitmapu textury bitmapa *p_zal; // pointer na zalozni bitmapu textury ROVINA n, rv, ru; // rovina plosky, rovina vektoru r, rovina vektoru u BOD s0, s1, s2, s3; // body na koncich ligthmapy float ddu, ddv; // delka vektoru u,v int u, v; // start body lightmapy int nu, nv; // pocet kroku } LIGHTMAP_FACE; // pouze na staticke objekty typedef struct _EDIT_MESH_POLY { //celej kontejner char jmeno[MAX_JMENO]; // jmeno poly int facenum; // co face to objekt TEXT_KOORD *p_koord; // list texture koordinatu - plosky po 3 LIGHTMAP_FACE *p_ind; // lightmapovaci indicie, je jich facenum/3 dword *p_fsous; // sousedni plosky dword m1flag; // flag materialu -> stejne jako u kontejneru dword m2flag; // flag mat 2 -> stejne jako u kontejneru dword kflag; // flag kontejneru dword k2flag; // flag kontejneru int material; // material poly int kont; // cislo kontejneru, ze ktereho bylo poly vyrobeno int poly; // poradove cislo poly v seznamu polyu MLZNA_KOSTKA *p_mlha; // mlzna kostka polyho int lightnum; // pocet lightmap int *p_lightnum; // pocty light-map EDIT_TEXT **p_light; // pole light-map char kreslit; int mail; // mailbox poly :) OBB_OLD obb; // Svetla poly - dynamicke void **p_dlight; // pole svetel meshu int lightmax; // velikost pole na svetla int lightakt; // aktualni vekikost // Svetla poly - extra-dynamicke int top_edlight; // top-svetlo void **p_edlight; // pole extra svetel meshu int edlightmax; // velikost pole na extra svetla int edlightakt; // aktualni velikost VERTEX_ARRAYS varray; // vertex-arrays } EDIT_MESH_POLY; // used as a template for poly loading typedef struct _EDIT_MESH_POLY_DISK { //celej kontejner char jmeno[MAX_JMENO]; // jmeno poly int facenum; // co face to objekt int tmp; int tmp1; int tmp2; dword m1flag; // flag materialu -> stejne jako u kontejneru dword m2flag; // flag mat 2 -> stejne jako u kontejneru dword kflag; // flag kontejneru dword k2flag; // flag kontejneru int material; // material poly int kont; // cislo kontejneru, ze ktereho bylo poly vyrobeno int poly; // poradove cislo poly v seznamu polyu int tmp3; int lightnum; // pocet lightmap int tmp4; int tmp5; char kreslit; int mail; // mailbox poly :) OBB_OLD obb; // Svetla poly - dynamicke int tmp6; int lightmax; // velikost pole na svetla int lightakt; // aktualni vekikost // Svetla poly - extra-dynamicke int top_edlight; // top-svetlo int tmp7; int edlightmax; // velikost pole na extra svetla int edlightakt; // aktualni velikost VERTEX_ARRAYS varray; // vertex-arrays } EDIT_MESH_POLY_DISK; typedef struct _PRVEK_DATABAZE { // prvek, ktery je v aktivni databazi prvku int kont; int guid; int kof_index; EDIT_KONTEJNER *p_kont; } PRVEK_DATABAZE; typedef struct _PRVEK_LEVELU { // prvek, ktery je umisteny v levelu int lev_index; // pozice prvku v levelu int prv_index; // index v seznamu prvku v levelu GLMATRIX m; // matrix kontejneru pokud je dynamicky PRVEK_DATABAZE *p_prv_databaze; // odkaz do databaze prvku int mesh; // cislo kontejneru pro kresleni prvku int Vazba1; // jedninecne vlastnosti prvku int Vazba2; int Rotace; int guid; // guid prvku } PRVEK_LEVELU; typedef struct _PRVEK_LEVELU_GAME { // prvek, ktery je umisteny v levelu int staticky; // je staticky ? float x, y, z; // fyzicky 3D stred objektu int rotace; // natoceni prvku int guid; // guid prvku GLMATRIX mg; // animacni matice (1 pri stani) GLMATRIX *p_mg_top; // top-animacni matice v anim strome GLMATRIX mp; // pozicni matice (umistuje prvek na pozici) BOD pivot; // pivot-point pro animace (kopiruje se z animaci) GAME_MESH_DATA *p_mesh_data; // mesh-data jsou stejne int mesh; int anim_mail; int flag; // flag prvku (low/top) prvek struct _PRVEK_LEVELU_GAME *p_next_low; // pointer na dalsi low/top prvek v poradi struct _PRVEK_LEVELU_GAME *p_prev_low; // pointer na predchozi low/top prvek v poradi } PRVEK_LEVELU_GAME; #define TEXT_DIRS 20 typedef struct _KONFIG_DIR { char save_dir[MAX_FILENAME]; char profile_dir[MAX_FILENAME]; char game_root_dir[MAX_FILENAME]; char prvky_dir[MAX_FILENAME]; char level_dir[MAX_FILENAME]; char out_dir[MAX_FILENAME]; char material_dir[MAX_FILENAME]; char data_dir[MAX_FILENAME]; char scene_dir[MAX_FILENAME]; char game_level_dir[MAX_FILENAME]; char game_data_dir[MAX_FILENAME]; char edit_level_dir[MAX_FILENAME]; char bitmap_dir[MAX_FILENAME]; char sound_dir[MAX_FILENAME]; char music_dir[MAX_FILENAME]; } KONFIG_DIR; typedef struct _TEXT_DIR { char texture_dir[TEXT_DIRS][MAX_FILENAME]; // adresare textur int texture_dir_class[TEXT_DIRS]; char scene_texture_dir[MAX_FILENAME]; } TEXT_DIR; #define SCENE_GAME_CUBE 0x1 // scena obsahuje game cube #define COLOR_SET 0 #define COLOR_ADD 1 #define COLOR_SUB 2 #define DEFAULT_ALFA_FAKTOR 0xffffffff typedef struct _TRIANGLE { OBJ_VERTEX a, b, c; } TRIANGLE; typedef struct _KAMERA { int cislo; // "use" - flag nebo K_CHYBA char jmeno[MAX_JMENO]; // jmeno kamery int flag; // 0 - nic, 1,2 -> kreslit osy /* Pocatecni hodnoty kamery */ BOD p, t; // umisteni kamery float fov; // field-of-view float roll; // nejakej jinej ? /* Objekty kamery */ EDIT_OBJEKT *p_objekt; // objekt kamery EDIT_OBJEKT *p_target; // cil kam kamera ukazuje EDIT_OBJEKT *p_pos; // pozice kamery /* Animace kamery */ KAMERA_TRACK_INFO tracky[KAM_MAX_ANIM]; //animace kamer int akt_animace; // aktualne vybrana animace kamery } KAMERA; #define SLOZ_FLARE 14 typedef struct _LENS_FLARE_SLOZ { float vzdal; // vzdalenost flare (0 = neaktivni) float r, g, b, a; // barva lensu float dx, dy; // rozmery dx,dy int material; float wx, wy, wz; int vid; EDIT_MATERIAL *p_mat; // material flaru } LENS_FLARE_SLOZ; typedef struct _LENS_FLARE { char akt; BOD p; // kde je ve 3d BOD *p_bod; // pointer na bod float r, g, b, a; // barva lensu float dx, dy; // rozmery dx,dy int material; EDIT_MATERIAL *p_mat; // material flaru int index; STATIC_LIGHT *p_svetlo; // staticke svetlo flaru float wx, wy, wz; // 2D souradnice int vid; int alfa; // alfa mod int rflag; // renderivaci flag -> jak kreslit osy int zflag; // z-test flag LENS_FLARE_SLOZ *p_sloz; // zbytek slozenych flaru struct _LENS_FLARE *p_next; // pointer na dalsi flare struct _LENS_FLARE *p_prev; // pointer na predchozi flare } LENS_FLARE; // flagy pro lens-flary #define FLR_NO_ZTEST 0x1 typedef struct _NASTAVENI_KAMER { float fov; float far_plane; float near_plane; float max_uhel; float min_uhel; float max_vzdal; float min_vzdal; BOD min; BOD max; int flag; } NASTAVENI_KAMER; typedef struct _ZEMNI_MLHA { int aktivni; float v_start; float v_stop; float h_start; float h_stop; dword barva; int handle; } ZEMNI_MLHA; typedef struct _LEVEL_KONFIG { dword barva_pozadi; // pouzit barvu pozadi int barva_pozadi_aktivni; // aktivni ZEMNI_MLHA zm; // nastaveni zemni mlhy } LEVEL_KONFIG; typedef struct _OBB_TREE_ITEM_OLD { OBB_OLD *p_obb; EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; int mesh; int viditelny; int zrc_viditelny; } OBB_TREE_ITEM_OLD; typedef struct _OBB_TREE_OLD { int mail; OBB_OLD obb; int itnum; // polozky stromu OBB_TREE_ITEM_OLD *p_item; struct _OBB_TREE_OLD *p_up; // otec stromu int nextnum; // pocet podobalek struct _OBB_TREE_OLD *p_next; // podobalky } OBB_TREE_OLD; /* U skladaneho potrebuju: */ inline void transformuj_bod_matici(float *p_x, float *p_y, float *p_z, GLMATRIX * m) { float x, y, z; x = *p_x; y = *p_y; z = *p_z; *p_x = m->_11 * x + m->_21 * y + m->_31 * z + m->_41; *p_y = m->_12 * x + m->_22 * y + m->_32 * z + m->_42; *p_z = m->_13 * x + m->_23 * y + m->_33 * z + m->_43; // wp = matSet._14*x + matSet._24*y + matSet._34*z + matSet._44; } inline BOD *transformuj_bod_bod_matici(BOD * p_p, GLMATRIX * m) { float x, y, z; x = p_p->x; y = p_p->y; z = p_p->z; p_p->x = m->_11 * x + m->_21 * y + m->_31 * z + m->_41; p_p->y = m->_12 * x + m->_22 * y + m->_32 * z + m->_42; p_p->z = m->_13 * x + m->_23 * y + m->_33 * z + m->_43; return (p_p); } inline void transformuj_wbod_matici(float *p_x, float *p_y, float *p_z, float *p_w, GLMATRIX * m) { float x, y, z, w; x = *p_x; y = *p_y; z = *p_z, w = *p_w;; *p_x = m->_11 * x + m->_21 * y + m->_31 * z + m->_41 * w; *p_y = m->_12 * x + m->_22 * y + m->_32 * z + m->_42 * w; *p_z = m->_13 * x + m->_23 * y + m->_33 * z + m->_43 * w; *p_w = m->_14 * x + m->_24 * y + m->_34 * z + m->_44 * w; } inline void transformuj_wbod_matici_wbod(WBOD * p_s, GLMATRIX * m, WBOD * p_c) { float x, y, z, w; x = p_s->x; y = p_s->y; z = p_s->z, w = p_s->w;; p_c->x = m->_11 * x + m->_21 * y + m->_31 * z + m->_41 * w; p_c->y = m->_12 * x + m->_22 * y + m->_32 * z + m->_42 * w; p_c->z = m->_13 * x + m->_23 * y + m->_33 * z + m->_43 * w; p_c->w = m->_14 * x + m->_24 * y + m->_34 * z + m->_44 * w; } inline BOD *transformuj_bod_matici_bod(BOD * p_bod, GLMATRIX * m, BOD * p_cil) { float x, y, z; x = p_bod->x; y = p_bod->y; z = p_bod->z; p_cil->x = m->_11 * x + m->_21 * y + m->_31 * z + m->_41; p_cil->y = m->_12 * x + m->_22 * y + m->_32 * z + m->_42; p_cil->z = m->_13 * x + m->_23 * y + m->_33 * z + m->_43; return (p_cil); } inline void transformuj_nbod_matici(BOD * p_bod, GLMATRIX * m) { float x, y, z; x = p_bod->x; y = p_bod->y; z = p_bod->z; p_bod->x = m->_11 * x + m->_21 * y + m->_31 * z; p_bod->y = m->_12 * x + m->_22 * y + m->_32 * z; p_bod->z = m->_13 * x + m->_23 * y + m->_33 * z; } inline void transformuj_nbod_matici_bod(BOD * p_bod, GLMATRIX * m, BOD * p_cil) { float x, y, z; x = p_bod->x; y = p_bod->y; z = p_bod->z; p_cil->x = m->_11 * x + m->_21 * y + m->_31 * z; p_cil->y = m->_12 * x + m->_22 * y + m->_32 * z; p_cil->z = m->_13 * x + m->_23 * y + m->_33 * z; } inline void transformuj_objekt_matici(EDIT_OBJEKT * p_obj, GLMATRIX * p_mat) { int v; for (v = 0; v < p_obj->vertexnum; v++) transformuj_bod_matici(&p_obj->p_vertex[v].x, &p_obj->p_vertex[v].y, &p_obj->p_vertex[v].z, p_mat); } inline void nastav_material_rgb(RGB_M * p_rgb, float r, float g, float b) { p_rgb->r = r; p_rgb->g = g; p_rgb->b = b; } // nastavi materialovou i vyslednou barvu inline void nastav_barvu_bodu_obj(EDIT_OBJEKT * p_obj, float r, float g, float b, float a) { int v; for (v = 0; v < p_obj->vertexnum; v++) { p_obj->p_vertex[v].mdr = p_obj->p_vertex[v].dr = r; p_obj->p_vertex[v].mdg = p_obj->p_vertex[v].dg = g; p_obj->p_vertex[v].mdb = p_obj->p_vertex[v].db = b; p_obj->p_vertex[v].mda = p_obj->p_vertex[v].da = a; } } inline void nastav_barvu_bodu_obj_dword(EDIT_OBJEKT * p_obj, dword barva) { int v; float b[4]; rgba_float(barva, b); for (v = 0; v < p_obj->vertexnum; v++) { p_obj->p_vertex[v].mdr = p_obj->p_vertex[v].dr = b[0]; p_obj->p_vertex[v].mdg = p_obj->p_vertex[v].dg = b[1]; p_obj->p_vertex[v].mdb = p_obj->p_vertex[v].db = b[2]; p_obj->p_vertex[v].mda = p_obj->p_vertex[v].da = b[3]; } } inline void add_barvu_bodu_obj(EDIT_OBJEKT * p_obj, float r, float g, float b, float a) { int v; for (v = 0; v < p_obj->vertexnum; v++) { add_color_fa(&p_obj->p_vertex[v].mdr, r, g, b, a); add_color_fa(&p_obj->p_vertex[v].dr, r, g, b, a); } } inline void sub_barvu_bodu_obj(EDIT_OBJEKT * p_obj, float r, float g, float b, float a) { int v; for (v = 0; v < p_obj->vertexnum; v++) { sub_color_fa(&p_obj->p_vertex[v].dr, r, g, b, a); sub_color_fa(&p_obj->p_vertex[v].mdr, r, g, b, a); } } inline void nastav_barvu_bodu_kont(EDIT_KONTEJNER * p_kont, float r, float g, float b, float a, char op) { int o, mo; mo = p_kont->max_objektu; for (o = 0; o < mo; o++) { if (p_kont->p_obj[o]) { switch (op) { case 0: //rep nastav_barvu_bodu_obj(p_kont->p_obj[o], r, g, b, a); break; case 1: //add add_barvu_bodu_obj(p_kont->p_obj[o], r, g, b, a); break; case 2: //sub sub_barvu_bodu_obj(p_kont->p_obj[o], r, g, b, a); break; } } } } inline void nastav_barvu_bodu_kont_dword(EDIT_KONTEJNER * p_kont, dword barva, char op) { int o, mo; float v[4]; rgba_float(barva, v); mo = p_kont->max_objektu; for (o = 0; o < mo; o++) { if (p_kont->p_obj[o]) { switch (op) { case 0: //rep nastav_barvu_bodu_obj(p_kont->p_obj[o], v[0], v[1], v[2], v[3]); break; case 1: //add add_barvu_bodu_obj(p_kont->p_obj[o], v[0], v[1], v[2], v[3]); break; case 2: //sub sub_barvu_bodu_obj(p_kont->p_obj[o], v[0], v[1], v[2], v[3]); break; } } } } inline void transformuj_mesh_matici(GAME_MESH_OLD * p_mesh, GLMATRIX * p_m) { int i, pocet = p_mesh->vertexnum; BOD *p_vert = p_mesh->p_vertex_pos; for (i = 0; i < pocet; i++) { transformuj_bod_matici(&p_vert[i].x, &p_vert[i].y, &p_vert[i].z, p_m); } } extern GLMATRIX __kont_world_matrix; inline GLMATRIX *kont_world_matrix(EDIT_KONTEJNER * p_kont) { if (p_kont->kflag & KONT_MPMATRIX) { return (mat_mult_dir(&p_kont->world, &p_kont->mpmatrix, &__kont_world_matrix)); } else { return (&p_kont->world); } } #define DDRGB(r, g, b) (0xff000000 | (((long)((b) * 255)) << 16) |(((long)((g) * 255)) << 8) | (long)((r) * 255)) #define DDRGBA(r, g, b, a) ((((long)((a) * 255)) << 24) | (((long)((b) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((r) * 255)) typedef int (*STAGE_FUNC) (EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int text, int rezerva); typedef void (*STAGE_FUNC_ELEM) (void); typedef void (*STAGE_FUNC_ALFA) (void); void kont_norm_vect(EDIT_KONTEJNER * p_kont_top); void transformuj_kontejner_matici(EDIT_KONTEJNER * p_kont, GLMATRIX * p_m); void transformuj_kontejner_keyframe(EDIT_KONTEJNER * p_kont); void transformuj_kontejner(EDIT_KONTEJNER * p_kont); void calc_norm_vec_inter_object(EDIT_OBJEKT * p_obj); //void mesh_norm_vect(GAME_MESH_OLD *p_mesh); void texturuj_zemi(EDIT_OBJEKT * p_obj, int rect_x, int rect_y, int c_text, int flag, int mat, float skok_u, float skok_v); EDIT_OBJEKT *vyrob_zemi(int rect_x, int rect_y, float skok); EDIT_OBJEKT *vyrob_zemi_start(int rect_x, int rect_y, float skok, float start_x, float start_y); void rozloz_zemi(EDIT_OBJEKT ** p_src, int ctvercu); EDIT_OBJEKT *mirror_objekt(EDIT_OBJEKT * p_src, int st, int mx, int my, int mz); void mirror_text(EDIT_OBJEKT * p_src, int t, int mu, int mv); void rotuj_text(EDIT_OBJEKT * p_obj, int t, int uhel); void dopln_cary(EDIT_OBJEKT * p_obj); void kresli_ctverec_2d(int x1, int y1, int x2, int y2, float r, float g, float b); void kresli_ctverec_2d_plnej(int x1, int y1, int x2, int y2, float r, float g, float b); void kresli_kurzor_mysi_kriz(int xres, int yres); EDIT_OBJEKT *vyrob_krychli(BOD * p_bod, float x, float y, float z, dword barva); EDIT_OBJEKT *vyrob_krychli_dratovou(BOD * p_bod, float x, float y, float z, dword barva); void krychli_dratovou_recalc(EDIT_OBJEKT * p_obj, BOD * p_bod, float x, float y, float z, dword barva); EDIT_OBJEKT *kameru_dratovou_calc(EDIT_OBJEKT * p_obj, BOD * p_p, BOD * p_t, float fov, float roll, dword barva); EDIT_OBJEKT *kameru_dratovou_vyrob(BOD * p_p, BOD * p_t, float fov, float roll); void kameru_dratovou_reanimuj(KAMERA * p_kam); void kameru_dratovou_recalc(EDIT_OBJEKT * p_obj, BOD * p_p, BOD * p_t, float fov, float roll); void invertuj_face_objektu(EDIT_OBJEKT * p_obj); void invertuj_face_kontejner(EDIT_KONTEJNER * p_kont); EDIT_KONTEJNER *vyrob_krychli_rozlozenou(BOD * p_bod, float x, float y, float z); void pridej_krychli(EDIT_OBJEKT ** p_src, BOD * p_bod, float x, float y, float z); EDIT_OBJEKT *vyrob_billboard(BOD * p_bod, float x, float y); void objekt_obalka(EDIT_OBJEKT * p_obj, GLMATRIX * p_m, BOD * p_min, BOD * p_max); void kontejner_obalka(EDIT_KONTEJNER * p_kont); int cti_velikost_objektu(EDIT_OBJEKT * p_obj); void cti_velikost_kontejneru(EDIT_KONTEJNER * p_kont, int *p_size, int *p_objektu); int intersect_ray_koule(BOD * p_stred, float radius, BOD * p_orig, BOD * p_dir); void obj_vyrob_list_sousednosti(EDIT_OBJEKT * p_obj); void obj_vyrob_list_sousednosti_full(EDIT_OBJEKT * p_obj); void calc_norm_vec(EDIT_OBJEKT * p_obj); void kresli_oktanovou_bunku(BOD * p_str, BOD * p_vel); void kresli_oktanovou_bunku_minmax(BOD * p_min, BOD * p_max, dword barva); void kresli_objekt_dratove_jednoduse(EDIT_OBJEKT * p_obj); void nastav_material_rgb_MAT(RGB_M * p_rgb); void nastav_material(float r, float g, float b); EDIT_OBJEKT *umisti_krychli_dratovou(EDIT_OBJEKT * p_obj, BOD * p_bod); void kresli_caru(BOD * p_s, BOD * p_k, dword barva); int vyrob_kameru_indir(KAMERA * p_kam, char *p_jmeno, BOD * p_p, BOD * p_t, float fov, float roll); void kresli_kosoctverec(GLMATRIX * p_project, GLMATRIX * p_camera, GLMATRIX * p_world, BOD * p_p, float r, float dr, float dg, float db); void transformuj_objekt_text_coord(EDIT_OBJEKT * p_obj, GLMATRIX * p_mat, int coord); void transformuj_kontejner_text_coord(EDIT_KONTEJNER * p_kont, GLMATRIX * p_mat, int coord); void mesh_env_maping_camera(GAME_MESH_OLD * p_mesh, GLMATRIX * p_cam); void poly_env_maping_camera(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL * p_mat, GLMATRIX * p_cam); void transformuj_mesh(GAME_MESH_OLD * p_mesh); void kresli_ctverec_2d_diff(int x1, int y1, int dx, int dy, float r, float g, float b); int stejny_vertex_point(BOD * v1, BOD * v2); int stejny_vertex_point_delta(BOD * v1, BOD * v2, float delta); void mesh_env_maping_spec(GAME_MESH_OLD * p_mesh, GLMATRIX * p_cam, EDIT_MATERIAL ** p_mt); void poly_env_maping_spec(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL * p_mat, GLMATRIX * p_cam); void kresli_kosoctverec_word(BOD * p_p, float r, dword barva); void poly_obalka(EDIT_MESH_POLY * p_poly, GLMATRIX * p_mat, BOD * p_min, BOD * p_max); int intersect_poly(EDIT_MESH_POLY * p_poly, BOD * p_orig, BOD * p_dir); void kontejner_obalka_aabb(EDIT_KONTEJNER * p_kont, BOD * p_min, BOD * p_max); int intersect_mesh(GAME_MESH_OLD * p_mesh, BOD * p_orig, BOD * p_dir); int intersect_mesh_objekt(GAME_MESH_OLD * p_mesh, int o, BOD * p_orig, BOD * p_dir); inline void oe_olist_reset(int *o) { *o = -1; } inline EDIT_OBJEKT *oe_olist_next(EDIT_KONTEJNER * p_kont, int *o) { EDIT_OBJEKT *p_obj; if (p_kont) { while ((*o) + 1 < MAX_KONT_OBJEKTU) { p_obj = p_kont->p_obj[++(*o)]; if (p_obj) return (p_obj); } } return (NULL); } inline float randf(void) { return ((float) rand() / (float) (RAND_MAX)); } /* Look-up tabulka */ #define MAX_LOOK_TABLE 256 void konfiguruj_look_up(int *p_looksqrt_linear, int *p_looksqrt_quadratic, float *p_looksqrt_linear_float, float *p_looksqrt_quadratic_float); // Minimalni intenzita svetla #define DELTA_MIN 0.00392156f inline void *kopiruj_pole(void *p_src, int velikost) { if (p_src) { void *p_mem = mmalloc((size_t)velikost); memcpy(p_mem, p_src, (size_t)velikost); return (p_mem); } else { return (NULL); } } #endif berusky2-0.12/src/komat/Berusky3d.cpp0000644000175000017500000010003313676411061014406 00000000000000/* Berusky - udelat konzoli (alt+tab) - prepinani na konzoli (konzole misto hry a zpet) */ #include #include #include #include #include #include "3d_all.h" #include "Object.h" #include "Setup.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Berusky3d_kamery.h" #include "Berusky3d_kofola2d.h" #define KAM_MIN_VZDAL 1.0f G_KONFIG ber, *p_ber = &ber; void ber_ini_mod(G_KONFIG * p_ber) { init_matrix(&p_ber->kamera.word); init_matrix(&p_ber->kamera.camera); p_ber->kamera.vzdal = MIN_VZDAL_KAMERY; p_ber->kamera.fi = (float) MIN_UHEL_KAMERY; p_ber->kamera.r = 0.0f; p_ber->kamera.roll = 0.0f; p_ber->kamera.fov = p_ber->kam.fov; p_ber->kamera.p.x = p_ber->x_start; p_ber->kamera.p.y = p_ber->y_start; p_ber->kamera.p.z = p_ber->z_start; calc_camera_bod(&p_ber->kamera.camera, &p_ber->kamera.invcam, &p_ber->kamera.p, p_ber->kamera.vzdal, p_ber->kamera.fi, p_ber->kamera.r); kam_set_normal_screen(p_ber); } void ber_nahod_mod(G_KONFIG * p_ber) { p_ber->p_word = &p_ber->kamera.word; p_ber->p_project = &p_ber->kamera.project; p_ber->p_camera = &p_ber->kamera.camera; p_ber->p_invcam = &p_ber->kamera.invcam; p_ber->p_vzdal = &p_ber->kamera.vzdal; p_ber->p_vzdal_kor = &p_ber->kamera.vzdal_kor; p_ber->p_fi = &p_ber->kamera.fi; p_ber->p_rfi = &p_ber->kamera.r; p_ber->p_target = &p_ber->kamera.t; p_ber->p_pos = &p_ber->kamera.p; p_ber->p_roll = &p_ber->kamera.roll; p_ber->p_mod = &p_ber->kamera.aktivni; p_ber->kamera.aktivni |= GAME_KAMERA_POLAR; p_ber->kamera.zmena = TRUE; set_matrix_world(p_ber->p_word); set_matrix_camera(p_ber->p_camera); set_matrix_project(p_ber->p_project); set_matrix_camera_project(p_ber->p_project); kam_set_normal_screen(p_ber); kprintf(TRUE, "kam.fov = %.2fs", RAD2DEG(p_ber->kam.fov)); kprintf(TRUE, "kam.near_plane = %.2fm", p_ber->kam.near_plane); kprintf(TRUE, "kam.far_plane = %.2fm", p_ber->kam.far_plane); kprintf(TRUE, "kam.min_degree = %.2fs", RAD2DEG(p_ber->kam.min_uhel)); kprintf(TRUE, "kam.max_degree = %.2fs", RAD2DEG(p_ber->kam.max_uhel)); kprintf(TRUE, "kam.min_dist = %.2fm", p_ber->kam.min_vzdal); kprintf(TRUE, "kam.max_dist = %.2fm", p_ber->kam.max_vzdal); } void ber_uloz_lookup(G_KONFIG * p_ber) { bitmapa *p_bmp1 = bmp_vyrob(256, 256); bitmapa *p_bmp2 = bmp_vyrob(256, 256); dword barva; float i1, i2; int x, y, i; for (y = 0; y < 256; y++) { for (x = 0; x < 256; x++) { i = y * MAX_LOOK_TABLE + x; i1 = (float) p_ber->p_looksqrt_linear[i] / (0xffffff); i2 = (float) p_ber->p_looksqrt_quadratic[i] / (0xffffff); barva = 0; add_mult_color(&barva, 0xffffffff, i1); bmp_putpixel(p_bmp1, x, y, barva); barva = 0; add_mult_color(&barva, 0xffffffff, i2); bmp_putpixel(p_bmp2, x, y, barva); } } bmp_uloz("e:\\linear.png", p_bmp1); bmp_uloz("e:\\kvad.png", p_bmp2); } void ber_rekonfiguruj_hra(G_KONFIG * p_ber) { char pom[200]; p_ber->conf_ovladani_rohy = GetPrivateProfileInt("game", "ovladani_rohy", 1, ini_file); p_ber->conf_ovladani_rohy_default = GetPrivateProfileInt("game", "ovladani_rohy_default", 0, ini_file); p_ber->conf_ovladani_rohy_smer = GetPrivateProfileInt("game", "ovladani_rohy_smer", 0, ini_file); GetPrivateProfileString("game", "ovladani_rohy_rychlost", "0.5", pom, 200, ini_file); p_ber->conf_ovladani_rohy_rychlost = (float) atof(pom); GetPrivateProfileString("game", "p_kamera_radius", "4.0", pom, 200, ini_file); p_ber->conf_pruhledna_kamera_radius = (float) atof(pom); } void ber_rekonfiguruj_3D(G_KONFIG * p_ber) { char pom[200]; hwconf.ditering = GetPrivateProfileInt("game", "ditering", 0, ini_file); p_ber->conf_animace_okoli = GetPrivateProfileInt("game", "animace_okoli", 1, ini_file); p_ber->conf_caustic = GetPrivateProfileInt("game", "scene_materialy", 1, ini_file); GetPrivateProfileString("textures", "text_ostrost", "0.0", pom, 200, ini_file); txconf.text_ostrost = (float) atof(pom); // 0/1 - on/off // 1,2,3 - hi/mid/low p_ber->conf_dyn_light = GetPrivateProfileInt("game", "light_dyn", 1, ini_file); if (p_ber->conf_dyn_light) p_ber->conf_dyn_rychlost = GetPrivateProfileInt("game", "light_dyn_speed", 1, ini_file); else p_ber->conf_dyn_rychlost = LIGHT_NIC; } void ber_rekonfiguruj_3D_aplikuj(G_KONFIG * p_ber) { if (hwconf.ditering) { glEnable(GL_DITHER); } else { glDisable(GL_DITHER); } dl_nastav(p_ber); } #define DEF_PROJECT_FOV DEG2RAD(20.0f) // taky float lok-up tabulka !!! void ber_konfiguruj_berusky(G_KONFIG * p_ber) { char pom[MAX_FILENAME]; int i; p_ber->conf_barva_pozadi = 0xff000000; p_ber->kam_omezeni = !GetPrivateProfileInt("debug", "debug_kamery", 0, ini_file); p_ber->kam.fov = DEF_PROJECT_FOV; p_ber->kam.far_plane = MAX_VZDAL_Z; p_ber->kam.near_plane = MIN_VZDAL_Z; p_ber->kam.max_uhel = MAX_UHEL_KAMERY; p_ber->kam.min_uhel = MIN_UHEL_KAMERY; p_ber->kam.max_vzdal = MAX_VZDAL_KAMERY; p_ber->kam.min_vzdal = MIN_VZDAL_KAMERY; p_ber->conf_zpruhlednovac = FALSE; set_matrix_init(); konfiguruj_look_up(p_ber->p_looksqrt_linear, p_ber->p_looksqrt_quadratic, p_ber->p_looksqrt_linear_float, p_ber->p_looksqrt_quadratic_float); for (i = 0; i < SIN_TABLE_SIZE; i++) p_ber->sinus_table[i] = sinf(DEG2RAD(i)); GetPrivateProfileString("install","save_dir","/", p_ber->dir.save_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.save_dir, MAX_FILENAME); GetPrivateProfileString("install","profile_dir","/", p_ber->dir.profile_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.profile_dir, MAX_FILENAME); // Load root of the data files GetPrivateProfileString("install","game_root","/", p_ber->dir.game_root_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.game_root_dir, MAX_FILENAME); GetPrivateProfileString("files","bitmap_dir","/", p_ber->dir.bitmap_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.bitmap_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.bitmap_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "prvky_dir", ".", p_ber->dir.prvky_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.prvky_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.prvky_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "level_dir", ".", p_ber->dir.level_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.level_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.level_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "out_dir", ".", p_ber->dir.out_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.out_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.out_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "material_dir", ".", p_ber->dir.material_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.material_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.material_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "data_dir", ".", p_ber->dir.data_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.data_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.data_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "game_level_dir", ".", p_ber->dir.game_level_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.game_level_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.game_level_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "game_data_dir", ".", p_ber->dir.game_data_dir, MAX_FILENAME, ini_file); working_file_translate(p_ber->dir.game_data_dir, MAX_FILENAME); root_dir_attach(p_ber->dir.game_data_dir, p_ber->dir.game_root_dir); GetPrivateProfileString("files", "texture_dir", ".", p_ber->tdir.texture_dir[0], MAX_FILENAME, ini_file); working_file_translate(p_ber->tdir.texture_dir[0], MAX_FILENAME); root_dir_attach(p_ber->tdir.texture_dir[0], p_ber->dir.game_root_dir); for (i = 0; i < TEXT_DIRS; i++) { char old[200]; int old_class; const struct { const char *const dir; const int dir_class; } defaults[TEXT_DIRS] = { { "textures/general", 1 }, { "textures/stul", 3 }, { "textures/balkon", 3 }, { "textures/kanal", 3 }, { "textures/voda", 3 }, { "textures/silnice", 3 }, { "textures/zahrada", 3 }, { "textures/bazina", 3 }, { "textures/les", 3 }, { "textures/tutorial", 3 }, { "textures/strom", 3 }, { "textures/detska", 3 }, { "textures/items", 2 } }; const char *default_dir = defaults[i].dir; const int default_class = defaults[i].dir_class; if (!default_dir) default_dir = ""; snprintf(pom, sizeof(pom), "texture_dir%d", i); snprintf(old, sizeof(old), "texture_file%d", i); get_dir_setting("files", pom, old, default_dir, p_ber->tdir.texture_dir[i], MAX_FILENAME, ini_file); working_file_translate(p_ber->tdir.texture_dir[i], MAX_FILENAME); root_dir_attach(p_ber->tdir.texture_dir[i], p_ber->dir.game_root_dir); if (p_ber->tdir.texture_dir[i][0] == '.' && !p_ber->tdir.texture_dir[i][1]) p_ber->tdir.texture_dir[i][0] = 0; snprintf(pom, sizeof(pom), "texture_dir%d_class", i); p_ber->tdir.texture_dir_class[i] = GetPrivateProfileInt("files", pom, default_class, ini_file); // Remove the old setting if it's the default. snprintf(old, sizeof(old), "texture_file%d_class", i); old_class = GetPrivateProfileInt("files", old, 0, ini_file); if (old_class == default_class) { kprintf(TRUE, "Removing obsolete setting with default value: %s=%d", old, old_class); WritePrivateProfileString("files", old, NULL, ini_file); } } // 'data_pak' is no longer used, and there is no corresponding // 'data_dir'. (Well, there is a 'data_dir', but that's for // something else). So just remove 'data_pak' from the INI file if // it exists. However, only remove it if it's equal to "data.pak", // because otherwise the user has changed it and might want to // remember that setting. GetPrivateProfileString("files", "data_pak", "", pom, sizeof(pom), ini_file); if (!strcmp(pom, "data.pak")) WritePrivateProfileString("files", "data_pak", NULL, ini_file); GetPrivateProfileString("soundengine","sound_dir","/",p_ber->dir.sound_dir,MAX_FILENAME,ini_file); working_file_translate(p_ber->dir.sound_dir,MAX_FILENAME); root_dir_attach(p_ber->dir.sound_dir, p_ber->dir.game_root_dir); adas_set_sound_dir(p_ber->dir.sound_dir); GetPrivateProfileString("soundengine","music_dir","/",p_ber->dir.music_dir,MAX_FILENAME,ini_file); working_file_translate(p_ber->dir.music_dir,MAX_FILENAME); root_dir_attach(p_ber->dir.music_dir, p_ber->dir.game_root_dir); p_ber->conf_barva_pozadi_pouzit_default = p_ber->conf_barva_pozadi_pouzit = GetPrivateProfileInt("game", "barva_pozadi", 0, ini_file); p_ber->conf_extra_light_vertex = GetPrivateProfileInt("game", "extra_light_vertex", 1, ini_file); ber_rekonfiguruj_hra(p_ber); ber_rekonfiguruj_3D(p_ber); #ifdef DEBUG_MOD p_ber->debug_fps = GetPrivateProfileInt("debug", "debug_fps", 0, ini_file); p_ber->debug_vypisy = GetPrivateProfileInt("debug", "debug_vypisy", 0, ini_file); p_ber->debug_light = GetPrivateProfileInt("debug", "debug_light", 0, ini_file); p_ber->debug_draty = GetPrivateProfileInt("debug", "debug_draty", 0, ini_file); #endif nahod_state_bloky(); /* Nastaveni debugu */ #ifdef DEBUG_MOD p_ber->debug_frame = TRUE; #endif kprintf(TRUE, "Configuration done"); } void kprintf(char log, const char *p_text, ...) { char text[2000]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); fprintf(stderr, "%s\n", text); if (log && p_ber->debug_file) { fputs(text, p_ber->debug_file); fputc('\n', p_ber->debug_file); fflush(p_ber->debug_file); } } void kprintfe(char log, const char *p_text, ...) { char text[2000]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); if (log && p_ber->debug_file) { fputs(text, p_ber->debug_file); fputc('\n', p_ber->debug_file); fflush(p_ber->debug_file); } exit(-1); } void kprintfl(char log, const char *p_text, ...) { char text[2000]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); fprintf(stderr,"%s\n", text); if (log && p_ber->debug_file) { fputs(text, p_ber->debug_file); fputc('\n', p_ber->debug_file); fflush(p_ber->debug_file); } } void kerror(char log, const char *p_text, ...) { char text[2000]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); fprintf(stderr, "FATAL ERROR: %s\n", text); if (log && p_ber->debug_file) { fputs(text, p_ber->debug_file); fputc('\n', p_ber->debug_file); fflush(p_ber->debug_file); } assert(0); exit(-1); } void kwarning(char log, const char *p_text, ...) { char text[2000]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); fprintf(stderr, "WARNING: %s\n", text); if (log && p_ber->debug_file) { fputs(text, p_ber->debug_file); fputc('\n', p_ber->debug_file); fflush(p_ber->debug_file); } } void ddw(const char *p_text, ...) { char text[2000]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); if (p_ber->debug_file) { fputs(text, p_ber->debug_file); fputc('\n', p_ber->debug_file); fflush(p_ber->debug_file); } } // Nahraje vlastnosti levelu a nestavy tyto vlastnosti void ber_init_level(G_KONFIG * p_ber) { float b[4]; glstav_reset(); if (p_ber->conf_barva_pozadi_pouzit) { rgb_float(p_ber->conf_barva_pozadi, b); glClearColor(b[0], b[1], b[2], 1.0f); } p_ber->dl_recalc = TRUE; p_ber->dl_new = TRUE; p_ber->dl_on = TRUE; p_ber->edl_recalc = TRUE; p_ber->edl_new = TRUE; /* Inicializace casu */ p_ber->TimeEndLastFrame = p_ber->TimeBase = timeGetTime() / DELICKA_CASU; p_ber->TimeLastFrame = 30; /* Prvotni init anim materialu */ ani_init(p_ber); /* Nahozeni animaci */ tani_init_scena(p_ber); /* Inicializace kamery */ ber_ini_mod(p_ber); ber_nahod_mod(p_ber); /* Nahozeni zemni mlhy */ if (p_ber->zm.aktivni) { p_ber->zm.handle = edl_svetlo_vyrob_zemni_mlha(p_ber->zm.barva, p_ber->zm.v_start, p_ber->zm.v_stop, p_ber->zm.h_start, p_ber->zm.h_stop); } /* Nactu scan-code pro P,R */ gl_Get_PR_ScanCode(&p_ber->conf_p_key, &p_ber->conf_r_key); /* Zpruhlednovani prvku pred kamerou */ if (setup.bugs_highlight) kom_zpruhlednovat_prvky(TRUE); /* Nahodi zvyraznovani prvku */ p_ber->conf_full_light = !setup.items_highlight; ber_prikaz_zvyraznovac(p_ber); /* Vypne kurzor */ vypni_kurzor(); /* Hodim kurzor do poloviny obrazovky */ //ber_nastav_kurzor(OXRES/2,OYRES/2); /* Nastavi svetla v levelu */ dl_nastav(p_ber); /* Reset mlhy */ mlha_reset(); /* Reload ini */ kom_reload_ini(); /* Nastavi flagose */ p_ber->ref_pos = TRUE; p_ber->ref_rot = TRUE; p_ber->ref_zmena = FALSE; p_ber->sflag1 = FALSE; } #ifdef DEBUG_MOD void ber_tiskni_statistiku(G_KONFIG * p_ber) { PARMETAC *p_par; GAME_MESH_OLD *p_mesh; GK_ANIM *p_gk; float dir[6]; BOD pos; int start = 2; int i; //int posun = 12; int posun = 20; int ppart, psystemu; int dlnum = 0; int edlnum = 0; float time; if (p_ber->debug_fps) { printfs(start, posun++, "f %.2f m %d o %d f %d", p_ber->fps, p_ber->debug.meshu, p_ber->debug.objektu, p_ber->debug.facu / 3); } kam_get_float_ext(dir, (float *) &pos); if (p_ber->debug_vypisy) { printfs(start, posun++, "bodu %d", p_ber->debug.bodu); printfs(start, posun++, "facu %d", p_ber->debug.facu / 3); printfs(start, posun++, "objektu %d", p_ber->debug.objektu); printfs(start, posun++, "poly rendered %d / total %d", p_ber->debug.poly, p_ber->polynum); printfs(start, posun++, "meshu rendered %d / total %d", p_ber->debug.meshu, p_ber->meshnum); printfs(start, posun++, "render list poly num %d / akt = %d, mesh num = %d / akt = %d", p_ber->poly_rendernum, p_ber->poly_renderakt, p_ber->mesh_rendernum, p_ber->mesh_renderakt); printfs(start, posun++, "ac %d tc %d", p_ber->debug.alfa_stage_change, p_ber->debug.text_stage_change); printfs(start, posun++, "pruhlednych %d", p_ber->prhlnum); printfs(start, posun++, "mouse [mi.t1 = %d mi.t2 = %d]", mi.t1, mi.t2); printfs(start, posun++, "r[%.2f] fi[%.2f] vzdal[%.2f] vzdal_kor[%.2f]", RAD2DEG(*p_ber->p_rfi), RAD2DEG(*p_ber->p_fi), *p_ber->p_vzdal, *p_ber->p_vzdal_kor); printfs(start, posun++, "t[%.2f,%.2f,%.2f]", p_ber->p_target->x, p_ber->p_target->y, p_ber->p_target->z); printfs(start, posun++, "p[%.2f,%.2f,%.2f]", p_ber->p_pos->x, p_ber->p_pos->y, p_ber->p_pos->z); printfs(start, posun++, "AK = %d PRCameraFlag = %d", p_ber->kamera.a_handle, PRCameraFlag); for (i = 0; i < p_ber->dl_lightnum; i++) { if (p_ber->p_dlight[i].akt) dlnum++; } for (i = 0; i < p_ber->edl_lightnum; i++) { if (p_ber->p_edlight[i].akt) edlnum++; } printfs(start, posun++, "LVertexu = %d sl = %d dl = %d edl = %d", p_ber->debug.light_vertexu, p_ber->slightnum, dlnum, edlnum); printfs(start, posun++, "LMeshu = %d", p_ber->debug.light_meshu); ppart = 0; psystemu = 0; p_par = p_ber->p_par; while (p_par) { ppart += p_par->pnum; psystemu++; p_par = p_par->p_next; } printfs(start, posun++, "systemu %d castic %d", psystemu, ppart); printfs(start, posun++, "hnizd %d viditelnych %d", p_ber->debug.hnizd, p_ber->debug.hnizd_vid); printfs(start, posun++, "Lani_vid %d", p_ber->debug.lani_vid); printfs(start, posun++, "Vertex Obj %d", p_ber->debug.vertex_obj); // p_light = &p_ber->p_edlight[0].tp; // printfs(start,posun++, "svetlo [%.3f %.3f %.3f] dosah %f",p_light->x,p_light->y,p_light->z,p_ber->p_edlight[0].dosah); for (i = 0; i < p_ber->gknum; i++) { p_gk = p_ber->p_gkzas + i; if (p_gk->flag & GK_AKTIVNI) { time = p_gk->time / (float) p_gk->time_delka; printfs(start, posun++, "G slot %d time %f", i, time); } } for (i = 0; i < p_ber->lokalnum; i++) { if (p_ber->p_lokal[i]) { p_mesh = p_ber->p_lokal[i]; time = p_mesh->sim_aktivni_time / (float) (p_mesh->p_sim_aktivni->keynum * SIM_KONSTI); printfs(start, posun++, "L slot %d time %f", i, time); } } printfs(start, posun++, "time = %d", timeGetTime()); } } #endif void cekej(int kolik) { int i, j, k, l; for (i = 0; i < kolik; i++) { for (j = 0; j < kolik; j++) { for (k = 0; k < kolik; k++) { for (l = 0; l < kolik; l++) { spracuj_spravy(1); } } } } } /* 1 - ok, dohral to 0 - abort */ /* p - posun sceny r - rotace sceny +,- - zoom kamery */ float ber_stredni_vzdalenost_ve_scene(G_KONFIG * p_ber) { BOD a, b, p; ROVINA r(0.0f, 1.0f, 0.0f, 0.0f); transf_2d_3d((float) SCREEN_XRES / 2, (float) SCREEN_YRES / 2, 0, &a.x, &a.y, &a.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART); transf_2d_3d((float) SCREEN_XRES / 2, (float) SCREEN_YRES / 2, 0.5f, &b.x, &b.y, &b.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART); if (!calc_prusek_bod(&r, &a, &b, &p)) return (10.0f); else return (vzdal_bodu_bod(&a, &p)); } /* inline ROVINA * calc_rovinu_bod_vektor(BOD *p, BOD *v, ROVINA *r) */ void ber_prikaz_posun_sceny(G_KONFIG * p_ber, int ref) { static BOD o1, v1; static int rx, ry; BOD v2; if (!PRCameraFlag) return; PRCameraFlagChange = TRUE; nuluj_mys(); nuluj_dif(); kam_stop(); kam_set_mod_polar(); if (ref) { rx = mi.x; ry = mi.y; } else { transf_2d_3d_z((float) rx, (float) ry, *p_ber->p_vzdal_kor, &v1.x, &v1.y, &v1.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); transf_2d_3d_z((float) mi.x, (float) mi.y, *p_ber->p_vzdal_kor, &v2.x, &v2.y, &v2.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); p_ber->p_target->x += v1.x - v2.x; p_ber->p_target->z += v1.z - v2.z; if (!p_ber->kam_omezeni) { p_ber->p_target->y += v1.y - v2.y; } if (p_ber->kam_omezeni) { kd_je_bod_v_kostce_orez(p_ber->p_target, &p_ber->level_min, &p_ber->level_max); } ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, FALSE); nuluj_dif(); rx = mi.x; ry = mi.y; } mi.dx = 1; // kvuli kofolovy - aby se ten kurzor nestracel p_ber->kamera.zmena = TRUE; } void ber_prikaz_rotace_sceny(G_KONFIG * p_ber, int ref) { static int rx, ry; if (!PRCameraFlag) return; PRCameraFlagChange = TRUE; nuluj_mys(); nuluj_dif(); kam_stop(); kam_set_mod_polar(); if (ref) { rx = mi.x; ry = mi.y; } else { *p_ber->p_fi += ((float) PI / 180) * (float) (mi.y - ry) * 0.5f; *p_ber->p_rfi -= ((float) PI / 180) * (float) (mi.x - rx) * 0.5f; if (p_ber->kam_omezeni) { if (*p_ber->p_fi < p_ber->kam.min_uhel) *p_ber->p_fi = p_ber->kam.min_uhel; else { if (*p_ber->p_fi > p_ber->kam.max_uhel) *p_ber->p_fi = p_ber->kam.max_uhel; } } ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, FALSE); rx = mi.x; ry = mi.y; } p_ber->kamera.zmena = TRUE; mi.dx = 1; // kvuli kofolovy - aby se ten kurzor nestracel } void ber_prikaz_scena_zoom(int koeficient) { kam_stop(); kam_set_mod_polar(); *p_ber->p_vzdal += koeficient * (*p_ber->p_vzdal) * 0.1f; if (*p_ber->p_vzdal < KAM_MIN_VZDAL) *p_ber->p_vzdal = KAM_MIN_VZDAL; if (p_ber->kam_omezeni && *p_ber->p_vzdal < p_ber->kam.min_vzdal) *p_ber->p_vzdal = p_ber->kam.min_vzdal; if (p_ber->kam_omezeni && *p_ber->p_vzdal > MAX_VZDAL_KAMERY) *p_ber->p_vzdal = MAX_VZDAL_KAMERY; ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, TRUE); p_ber->kamera.zmena = TRUE; PRCameraFlagChange = FALSE; } void ber_prikaz_zvyraznovac(G_KONFIG * p_ber) { p_ber->conf_full_light_last = p_ber->conf_full_light; p_ber->conf_full_light = !p_ber->conf_full_light; p_ber->dl_new = p_ber->dl_recalc = TRUE; dl_nastav(p_ber); } void ber_test_animaci(G_KONFIG * p_ber) { ExMeshHandle mh, next; ChapadloHandle *p_handle = NULL; int chapadel; static int flag; int i, j, objektu; /* ----------------------------------------------------------- Tuto cast musis delat nekde na zacatku - trva to dlouho (nacteni animaci objektu) */ /* Smycka - hleda a vraci postupne vsechny meshe ve scene ktere maji joint-animace */ next = 0; while ((mh = kom_najdi_mesh_joint(&next)) != K_CHYBA) { /* U nalezeneho meshe nacte pocet objektu ktere maji joint-animace */ objektu = chani_mesh_cti_objekty(mh); /* Projede objekty meshe (pocet objektu s animacema = objektu) a spusti jejich prvni animaci */ for (i = 0; i < objektu; i++) { /* Nacni animace i-teho objektu v poradi */ chani_mesh_cti_chapadelniky(mh, i, &p_handle, &chapadel); /* chapadel = pocet animaci objektu p_handle = pole handlu na tyto animace */ /* Vrati jmena animaci objektu */ for (j = 0; j < chapadel; j++) { char *p_jmeno = chani_cti_jmeno(p_handle[j]); (void)p_jmeno; //let's make gcc happy :) } /* ----------------------------------------------------------- Tuto cast muzes delat behem hry - je to rychle */ /* Vyberu si 1. animaci v objektu a tu zaradim do seznamu animaci (!!! pozor !!! pri zarazovani animace nekontroluju jestli ta animace tam uz je nebo ne, tak to musis volat jen 1x! nejlepe pred spustenim animace) */ j = 0; /* Zarazenou animaci spustim */ chani_go(p_handle[j], &flag, GK_LOOP, 0, 0); /* Uvolnim pole handlu (je to pole integeru, alokuje se pri volani chani_mesh_cti_chapadelniky pomoci malloc a ty to musis uvolnit kdyz to pole nepotrebujes To pole si klidne muzes ulozit do nejake sve struktury, ja ho k nicemu nepozuivam a je urceny jen pro tebe */ free(p_handle); } } /* Postup pri ruseni bezici animace: 1) Zastavim animaci chani_stop(p_handle[j]); 2) Vymazu ji z fronty animaci chani_zrus(p_handle[j]); */ } void ber_test_animaci2(G_KONFIG * p_ber) { } void ber_test_animaci3(G_KONFIG * p_ber) { } /* dword barva = 0xffffff; ExtraLightHandle elh = edl_svetlo_vyrob_zemni_mlha(barva, 0.0f, 3.0f, 0.0f, 60.0f); */ /* z_buffer_value = ( a + b / z ) N = number of bits of Z precision a = zFar / ( zFar - zNear ) b = zFar * zNear / ( zNear - zFar ) z = distance from the eye to the object ...and z_buffer_value is an integer. */ #define PEVNA_RYCH_POSUN 100.0f #define PEVNA_RYCH_ROTACE 100.0f #define PEVNA_RYCH_ZOOM 0.5f #define POHYBLIVA_RYCH_POSUN 600.0f #define POHYBLIVA_RYCH_ROTACE 400.0f #define POHYBLIVA_RYCH_ZOOM 1.0f // Aktivovat posun v 2D osach x,y void ber_ovladani_mysi_posun(G_KONFIG * p_ber, int x, int y) { float rych_posun = PEVNA_RYCH_POSUN + p_ber->conf_ovladani_rohy_rychlost * POHYBLIVA_RYCH_POSUN; float koef = p_ber->TimeLastFrame / 1000.0f; float mx1, my1, mx2, my2; GLMATRIX proj; BOD v1, v2; if (!PRCameraFlag) return; PRCameraFlagChange = TRUE; kam_stop(); kam_set_mod_polar(); if (x) { mx1 = (float) SCREEN_XSTART; mx2 = mx1 - x * rych_posun * koef; } else { mx1 = mx2 = 0; } if (y) { my1 = (float) (SCREEN_YSTART); my2 = my1 - y * rych_posun * koef; } else { my1 = my2 = 0; } calc_transf_3d_2d_matrix_smpl(p_ber->p_camera, p_ber->p_project, &proj); transf_2d_3d_z_matrix(mx1, my1, *p_ber->p_vzdal_kor, &v1.x, &v1.y, &v1.z, &proj, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); transf_2d_3d_z_matrix(mx2, my2, *p_ber->p_vzdal_kor, &v2.x, &v2.y, &v2.z, &proj, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); p_ber->p_target->x += v1.x - v2.x; p_ber->p_target->z += v1.z - v2.z; if (!p_ber->kam_omezeni) { p_ber->p_target->y += v1.y - v2.y; } if (p_ber->kam_omezeni) { kd_je_bod_v_kostce_orez(p_ber->p_target, &p_ber->level_min, &p_ber->level_max); } ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, FALSE); p_ber->kamera.zmena = TRUE; mi.dx = 1; } // Rotace x,y - 2D osy void ber_ovladani_mysi_rotace(G_KONFIG * p_ber, int x, int y) { float rych_rotace = PEVNA_RYCH_ROTACE + p_ber->conf_ovladani_rohy_rychlost * POHYBLIVA_RYCH_ROTACE; float koef = p_ber->TimeLastFrame / 1000.0f; static int flag = K_CHYBA; if (!PRCameraFlag || flag != K_CHYBA) return; PRCameraFlagChange = TRUE; kam_stop(); kam_set_mod_polar(); if (x) { //camera_Fast_Turn(0,(char)(x < 0), &flag, 0.0f); *p_ber->p_rfi -= ((float) PI / 180) * (float) (-x * rych_rotace * koef) * 0.5f; } if (y) { *p_ber->p_fi += ((float) PI / 180.0f) * (float) (-y * rych_rotace * koef) * 0.5f * 0.5f; if (*p_ber->p_fi >= DEG2RAD(88)) *p_ber->p_fi = DEG2RAD(88); } if (p_ber->kam_omezeni) { if (*p_ber->p_fi < p_ber->kam.min_uhel) *p_ber->p_fi = p_ber->kam.min_uhel; else { if (*p_ber->p_fi > p_ber->kam.max_uhel) *p_ber->p_fi = p_ber->kam.max_uhel; } } ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, FALSE); p_ber->kamera.zmena = TRUE; mi.dx = 1; // kvuli kofolovy - aby se ten kurzor nestracel } // Zoom y - +,- void ber_ovladani_mysi_zoom(G_KONFIG * p_ber, int y) { float rych_zoom = PEVNA_RYCH_ZOOM + p_ber->conf_ovladani_rohy_rychlost * POHYBLIVA_RYCH_ZOOM; float koef = p_ber->TimeLastFrame / 1000.0f; if (y > 0) { *p_ber->p_vzdal += rych_zoom * koef; if (p_ber->kam_omezeni && *p_ber->p_vzdal > MAX_VZDAL_KAMERY) *p_ber->p_vzdal = MAX_VZDAL_KAMERY; } else { *p_ber->p_vzdal -= rych_zoom * koef; if (p_ber->kam_omezeni && *p_ber->p_vzdal < p_ber->kam.min_vzdal) *p_ber->p_vzdal = p_ber->kam.min_vzdal; else if (*p_ber->p_vzdal < KAM_MIN_VZDAL) *p_ber->p_vzdal = KAM_MIN_VZDAL; } } // ovladani kdyz je kurzor na hranich obrazovky #define X_HRANICE 4 #define Y_HRANICE 4 int ber_ovladani_mysi(G_KONFIG * p_ber, int *p_zmena) { int posun, rotace, smer_pos, smer_rot; *p_zmena = FALSE; if (key[p_ber->conf_p_key] || key[p_ber->conf_r_key] || !(p_ber->conf_ovladani_rohy)) return (TRUE); if (p_ber->conf_ovladani_rohy_default) { // implicidne rotace posun = mi.ot2; rotace = !mi.ot2; } else { // implicidne posun posun = !mi.ot2; rotace = mi.ot2; } if (p_ber->conf_ovladani_rohy_smer) { // prehozeny smer ovladani smer_pos = -1; smer_rot = -1; } else { smer_pos = 1; smer_rot = 1; } if (mi.x <= SCREEN_XSTART + X_HRANICE) { // rotace/posun if (posun) { ber_ovladani_mysi_posun(p_ber, -smer_pos, FALSE); *p_zmena = TRUE; } else if (rotace) { ber_ovladani_mysi_rotace(p_ber, -smer_rot, FALSE); *p_zmena = TRUE; } } else if (mi.x >= SCREEN_XSTART + SCREEN_XRES - X_HRANICE) { // rotace/posun/zoom if (posun) { ber_ovladani_mysi_posun(p_ber, smer_pos, FALSE); *p_zmena = TRUE; } else if (rotace) { ber_ovladani_mysi_rotace(p_ber, smer_rot, FALSE); *p_zmena = TRUE; } } if (mi.y <= SCREEN_YSTART + Y_HRANICE) { // rotace/posun if (posun) { ber_ovladani_mysi_posun(p_ber, 0, -smer_pos); *p_zmena = TRUE; } else if (rotace) { ber_ovladani_mysi_rotace(p_ber, 0, -smer_rot); *p_zmena = TRUE; } } else if (mi.y >= SCREEN_YSTART + SCREEN_YRES - Y_HRANICE) { // rotace/posun/zoom if (posun) { ber_ovladani_mysi_posun(p_ber, 0, smer_pos); *p_zmena = TRUE; } else if (rotace) { ber_ovladani_mysi_rotace(p_ber, 0, smer_rot); *p_zmena = TRUE; } } return (TRUE); } void ber_klavesy_hra(G_KONFIG * p_ber) { if (!karmin_aktivni) return; if (PRCameraFlag) { p_ber->ref_zmena = FALSE; if (ber_ovladani_mysi(p_ber, &p_ber->ref_zmena)) { if (p_ber->ref_zmena) p_ber->sflag1 |= SFL_POSUN; } if (key[p_ber->conf_p_key]) { p_ber->sflag1 |= SFL_POSUN; ber_prikaz_posun_sceny(p_ber, p_ber->ref_pos); p_ber->ref_pos = FALSE; p_ber->ref_zmena = TRUE; } else { p_ber->ref_pos = TRUE; } if (key[p_ber->conf_r_key]) { p_ber->sflag1 |= SFL_ROTACE; ber_prikaz_rotace_sceny(p_ber, p_ber->ref_rot); p_ber->ref_rot = FALSE; p_ber->ref_zmena = TRUE; } else { p_ber->ref_rot = TRUE; } if (key[K_PLUS] || key[K_MINUS]) { ber_prikaz_scena_zoom(key[K_PLUS] ? -1 : 1); p_ber->ref_zmena = TRUE; p_ber->sflag1 |= SFL_ZOOM; key[K_PLUS] = key[K_MINUS] = FALSE; } if (p_ber->sflag1 & (SFL_POSUN | SFL_ROTACE | SFL_ZOOM) && !p_ber->ref_zmena) { p_ber->sflag1 = FALSE; PRCameraFlagChange = 2; } } #ifdef _DEBUG if (key[K_L]) { key[K_L] = FALSE; ber_test_animaci(p_ber); } if (key[K_K]) { key[K_K] = FALSE; ber_test_animaci2(p_ber); } if (key[K_J]) { key[K_J] = FALSE; ber_test_animaci3(p_ber); } #endif } berusky2-0.12/src/komat/Berusky3d_castice.h0000644000175000017500000003232713674426075015571 00000000000000/* Casticovy system pro Berusky II */ #ifndef __BERUSKY3D_CASTICE_H_ #define __BERUSKY3D_CASTICE_H_ /* Castice popisujici strepinu z krabice ma tvar obecneho 4-uhelnika a muze mit libovolne mapovani v jednolivych rozich castice */ typedef struct _PAR_STREPINA { BOD p; // akt umisteni castice ve 3D BOD dir; // smer letu castice float rychlost; // aktualni rychlost letu castice float vaha; // vaha castice, jak moc klesa k zemi float utlum; // utlum rychlosti letu castice float g; // gravitacni konstanta float u1, u2, u3, u4; // mapping ve vsech 4 rozich castice float v1, v2, v3, v4; float vel1; // 1 velikost castice float vel2; // 2 velikost castice float vel3; // 3 velikost castice float vel4; // 4 velikost castice float barva; // barva castice (0..1) int aktivni; // nastavuju ja -> je castice viditelna? float frame; // pokud je material animovany, tak aktivni frame float framedelta; //dword time_vznik; // cas vzniku castice struct _PAR_STREPINA *p_next; // navazani castice na dalsi struct _PAR_STREPINA *p_prev; // navazani castice na predchozi } PAR_STREPINA; /* Flekova castice - je definovana plochou, nepohybuje se, pouze scale */ typedef struct _PAR_FLEK { BOD p; // akt umisteni castice ve 3D BOD nx; // smer pohledu castice BOD ny; // smer pohledu castice BOD tmp[4]; // 4 tmp vertexy pouzite k renderingu float rychlost_x; // x rychlost scale castice float rychlost_y; // y rychlost scale castice float utlum_x; // x utlum scale float utlum_y; // y utlum scale float r, g, b, a; // barva castice float dr, dg, db, da; // zmena barvy castice (za sec) float ka; // konecna alfa (test na konec) int aktivni; // nastavuju ja -> je castice viditelna? float frame; // pokud je material animovany, tak aktivni frame float framedelta; //dword time_vznik; // cas vzniku castice struct _PAR_FLEK *p_next; // navazani castice na dalsi struct _PAR_FLEK *p_prev; // navazani castice na predchozi } PAR_FLEK; /* Kourova castice - ma scale faktor a meni svoji barvu, mapping je defaultni rozmery ve 2 smerech a je staticka (stoji na miste) Nepouzivaji se zadny testy na rendering */ typedef struct _PAR_KOUR_STOPA { BOD p; // umisteni castice ve 3D BOD nx, ny; // smerove-flekove vektory BOD dir; // smer letu // float dx,dy; // BOD tmp[4]; // tmp body pro rendering BOD rp; // renderovaci pozice float rychlost_x; // x rychlost scale castice a zaroven jeji rozmery float rychlost_y; // y rychlost scale castice float utlum_x; // x utlum scale float utlum_y; // y utlum scale float r, g, b, a; // barva castice float dr, dg, db, da; // zmena barvy castice float ka; float frame; // pokud je material animovany, tak aktivni frame float framedelta; float y_plane; // y-plane castice dword time_vznik; // cas vzniku castice char rotace; // rotace vypoustenych castic float x_max; // klipovaci roviny -> pouzite pro kresleni castic float x_min; float z_max; float z_min; struct _PAR_KOUR_STOPA *p_next; // navazani castice na dalsi struct _PAR_KOUR_STOPA *p_prev; // navazani castice na predchozi } PAR_KOUR_STOPA; /* Moje interni flagy na castice */ #define TPAR_STREP 0x0001 #define TPAR_KOUR_STOPA 0x0002 #define TPAR_FLEK 0x0004 #define TPAR_ANIMATE 0x0008 // animovat tento system typedef struct _PARMETAC_HNIZDO { void *p_first; // Linearni seznam aktivnich castic BOD *p_nx; // Normalovy vektor nx pro fleky BOD *p_ny; // Normalovy vektor ny pro fleky BOD *p_pivot; // pointer na bod, na kterem se castice uvolnuji BOD *p_dir; // pointer na smerovy vektor BOD *p_vitr; // pivot-pointer na vitr co se meni float rychlost_x; // x rychlost scale castice a zaroven jeji rozmery float rychlost_y; // y rychlost scale castice float utlum_x; // x utlum scale float utlum_y; // y utlum scale float r, g, b, a; // barva castice float dr, dg, db, da; // zmena barvy castice float ka; // mezni hodnota float frame; float framedelta; float y_plane; // hranicni y-plocha float x_max; // klipovaci roviny -> pouzite pro kresleni castic float x_min; float z_max; float z_min; BOD min, max; // min,max int pnum; // pocet aktivnich castic char rotace; // rotace vypoustenych castic dword time_last; // cas posledniho uvolneni dword time_interval; // interval uvolnovani novych castic int time_first; // cas uvolneni prvni castice struct _PARMETAC_HNIZDO *p_next; struct _PARMETAC_HNIZDO *p_prev; } PARMETAC_HNIZDO; /* Bomba - struktura kterou me kofola predava? */ typedef struct _PARMETAC { void *p_first; // seznam aktivnich/zasobnich castic PARMETAC_HNIZDO *p_hnizdo; // seznam aktivnich hnizd int *p_flag; int flag; int material; int start; int stop; float time; // cas animace - 0..1 BOD min; // kostka generatoru min BOD max; // kostka generatoru max int hnum; // pocet aktivnich hnizd int pnum; // pocet aktivnich castic BOD *p_pivot; float y_plane; GLMATRIX world; // transfromacni matice void *p_param; size_ptr param; size_ptr param2; END_FUNKCE p_endfce; // kofolova end funkce struct _PARMETAC *p_next; struct _PARMETAC *p_prev; } PARMETAC; // Flagy vkladane do promenne flag // castice se meni rozmerove #define TPAR_SCALE 0x00100 // castice se pouze pricita #define TPAR_SCALE_ADD 0x04000 // castice se meni barevne #define TPAR_DIFF 0x00200 // castice je aktualni alfa vetsi nez referencni,je castice aktivni #define TPAR_VETSI 0x00400 // parametr dir - pouzivar vektor posunu u castic #define TPAR_DIR 0x00800 // parametr vitr - pouzivar vektor vetru #define TPAR_VITR 0x01000 // kourova stopa se bere jako soubor 3D fleku #define TPAR_3D 0x02000 // kourova stopa se bere jako soubor half-life fleku #define TPAR_HALF_LIFE 0x08000 // pouziva frame-animace materialu #define TPAR_FRAME 0x10000 // nevypusti prvni castici v poradi #define TPAR_FIRST_LOST 0x20000 // Casticovy system se posouva s timto pivot-pointem #define TPAR_POS_PIVOT 0x40000 // Casticovy system se renderuje bez mlhy #define TPAR_NO_FOG 0x80000 // Bude se pouzivat 2D klipovani (x/z) #define TPAR_2DCLIP 0x100000 // Testuje se viditelnost castic kolizi s obalkama #define TPAR_HTEST 0x0200000 // Testuje horni y-plochu u hnizd (cas viditelna kdyz yc < y_plane) #define TPAR_YPLANE_TOP 0x0400000 // Testuje dolni y-plochy u hnizd (cas viditelna kdyz yc > y_plane) #define TPAR_YPLANE_LOW 0x0800000 // Casticovy system se sam odmaze po dobehnuti #define TPAR_AUTOREMOVE 0x1000000 /* Vyrobi generator castic vraci handle casticoveho systemu */ ParHandle par_vyrob(void); /* Nastavy vlastnosti casticoveho systemu material - material pouzity pro castice flag - TPAR flag pro castice p_pos - pozice casticoveho systemu v absolutnich souradnicich p_pivot - pivot poin casticoveho systemu (bod s kterym se posouva casticovy system) */ ParHandle par_set_param(ParHandle ph, int material, int flag, BOD * p_pos, BOD * p_pivot); /* Nastavi Y rovinu pro strepinove systemy */ ParHandle par_set_y_plane(ParHandle ph, float y_plane); /* Zrusi generator castic, podle zadaneho handle */ void par_zrus(ParHandle ph); /* Cte pocet aktivnich (zivych) castic casticoveho systemu */ int par_get(ParHandle ph); /* Spusti animaci casticoveho systemu, parametry jsou: *p_flag - flag, -1 = konec animace flag - animacni flag, zatim davat FALSE start - cas za ktery to ma vybuchnout (v milisec), 0 = okamzite stop - cas konce vybuchu, 0 = neomezeny konec */ ParHandle par_go(ParHandle ph, int *p_flag, int start, int stop); /* Pripoji tu dabelskou end funkci */ ParHandle par_pripoj_funkci(ParHandle ph, END_FUNKCE p_fce, size_ptr param, size_ptr param2, size_ptr p_param); /* Cte pointer na prvni castici v linearnim seznamu castic */ void *par_cti_prvni(ParHandle ph); /* Vlozi do casticoveho systemu castice typu strepina: - po celou dobu animace maji stejne rozmery - pohybuji se po zadane balisticke krivce - pusobi na ne gravitace */ void par_vloz_strepy(ParHandle ph, PAR_STREPINA * p_part, int pocet); /* Vlozi castice fleku - staticle fleky urcene pozici a vektorama */ void par_vloz_fleky(ParHandle ph, PAR_FLEK * p_part, int pocet); /*********************************************************************** Hnizdove casticove systemy ********************************************************************** */ /* Vlozi zasobu kourovych castic */ int par_vloz_kour_stopu(ParHandle ph, PAR_KOUR_STOPA * p_part, int pocet); /* Vyrobi generacni hnizdo */ HnizdoHandle par_vloz_hnizdo(ParHandle ph); /* Zruseni hnizda */ void par_zrus_hnizdo(ParHandle ph, HnizdoHandle hh); /* Nastavuje parametry hnizda */ HnizdoHandle par_vloz_hnizdo_komplet(HnizdoHandle hh, int time_interval, BOD * p_pivot, PAR_KOUR_STOPA * p_part); HnizdoHandle par_vloz_hnizdo_timer(HnizdoHandle hh, int time_interval, int time_first); HnizdoHandle par_vloz_hnizdo_pivot(HnizdoHandle hh, BOD * p_pivot); HnizdoHandle par_vloz_hnizdo_pivot_normal(HnizdoHandle hh, BOD * p_nx, BOD * p_ny); HnizdoHandle par_vloz_hnizdo_dir(HnizdoHandle hh, BOD * p_dir); HnizdoHandle par_vloz_hnizdo_vitr(HnizdoHandle hh, BOD * p_vitr); HnizdoHandle par_vloz_hnizdo_scale(HnizdoHandle hh, float rx, float ry, float utlum_x, float utlum_y); HnizdoHandle par_vloz_hnizdo_diff(HnizdoHandle hh, float r, float g, float b, float a, float dr, float dg, float db, float da, float ka); HnizdoHandle par_vloz_hnizdo_y_plane(HnizdoHandle hh, float y_plane); HnizdoHandle par_vloz_hnizdo_frame(HnizdoHandle hh, float frame, float framedelta); HnizdoHandle par_vloz_hnizdo_clip(HnizdoHandle hh, float min_x, float min_z, float max_x, float max_z); HnizdoHandle par_vloz_hnizdo_rotaci(HnizdoHandle hh, char rotace); /* Generuje castici z hnizda (okamzite, neceka na cas) */ HnizdoHandle par_vloz_hnizdo_pust_castici(HnizdoHandle hh); /* Prida okamzite zadany pocet castic do hnizda Vraci pointer na prvni pridavanou castici (lin seznam vsech dalsich pridavanych) */ PAR_KOUR_STOPA *par_vloz_hnizdo_pust_castice(ParHandle ph, HnizdoHandle hh, int pocet); /* Vrati pointer na hnizdo - muzes si ho nastavit sam primo */ PARMETAC_HNIZDO *par_cti_hnizdo(HnizdoHandle hh); /* Vrati pointer na prvni aktivni castici hnizda, NULL pokud neni zadna aktivni */ PAR_KOUR_STOPA *par_cti_hnizdo_castice(HnizdoHandle hh); /* Cte pocet hnizd casticoveho systemu */ int par_get_hnizda(ParHandle ph); /* Zrusi se casticovy system - end */ void par_zrus_end(PARMETAC * p_par); /* *************************************************************** Vodni dilo 2 *************************************************************** */ #define VOD_AKTIVNI 0x0001 #define VOD_BOD 0x0002 #define VOD_X_PLANE 0x0004 #define VOD_Y_PLANE 0x0008 #define VOD_Z_PLANE 0x0010 #define VOD_DIFF_MOD 0x0020 #define VOD_DIFF_ADD 0x0040 #define VOD_DIFF_SUB 0x0080 #define VOD_SPEC_MOD 0x0100 #define VOD_SPEC_ADD 0x0200 #define VOD_SPEC_SUB 0x0400 VodaHandle vod_vyrob(int meshu); VodaHandle vod_pridej_mesh(VodaHandle vh, MeshHandle mh); VodaHandle vod_uzavri_meshe(VodaHandle vh); VodnikHandle vod_vloz_vodnika(VodaHandle vh, BOD * p_pos, int flag, float amplituda, float perioda, float fi, float damplituda, float dperioda, float dfi); VodnikHandle vod_uprav_vodnika_par(VodnikHandle vh, float amplituda, float perioda, float fi, float damplituda, float dperioda, float dfi); VodnikHandle vod_cti_vodnika_par(VodnikHandle vh, float *p_amplituda, float *p_perioda, float *p_fi, float *p_damplituda, float *p_dperioda, float *p_dfi); VodnikHandle vod_uprav_vodnika_flag(VodnikHandle vh, int flag); VodnikHandle vod_cti_vodnika_flag(VodnikHandle vh, int *p_flag); VodnikHandle vod_vloz_vodnika_diff(VodnikHandle vh, float dr, float dg, float db, float da); VodnikHandle vod_vloz_vodnika_add_diff(VodnikHandle vh, float dr, float dg, float db, float da); VodnikHandle vod_vloz_vodnika_spec(VodnikHandle vh, float sr, float sg, float sb); VodnikHandle vod_vloz_vodnika_add_spec(VodnikHandle vh, float sr, float sg, float sb); #endif berusky2-0.12/src/komat/Quat.h0000644000175000017500000001166113674426075013133 00000000000000/* Quaterniony */ #ifndef __QUAT_H #define __QUAT_H #define DELTA 0.0001f #define ZERO_QUAT {0.0f,0.0f,0.0f,1.0f} inline float quat_delka(QUAT * p_v) { return ((float) sqrt(p_v->x * p_v->x + p_v->y * p_v->y + p_v->z * p_v->z + p_v->w * p_v->w)); } inline QUAT *quat_set_zero(QUAT * p_v) { p_v->x = 0; p_v->y = 0; p_v->z = 0; p_v->w = 1; return (p_v); } inline QUAT *angle_to_quat(QUAT * p_q, BOD * p_o, float uhel) { float vel = sqrtf(p_o->x * p_o->x + p_o->y * p_o->y + p_o->z * p_o->z); if (vel > 0.0001) { vel = 1.0f / vel; p_q->x = p_o->x * vel; p_q->y = p_o->y * vel; p_q->z = p_o->z * vel; } else { p_q->x = 0; p_q->y = 0; p_q->z = 0; } uhel *= 0.5f; p_q->w = (float) cos(uhel); vektor_mult_skalar((BOD *) p_q, sinf(uhel), (BOD *) p_q); quat_norm(p_q); return (p_q); } /* ( 1-2yy-2zz 2xy+2wz 2xz-2wy ) M = ( 2xy-2wz 1-2xx-2zz 2yz+2wx ) ( 2xz+2wy 2yz-2wx 1-2xx-2yy ) */ inline GLMATRIX *quat_to_matrix(GLMATRIX * p_mat, QUAT * p_q) { float xx2 = 2 * p_q->x * p_q->x; float yy2 = 2 * p_q->y * p_q->y; float zz2 = 2 * p_q->z * p_q->z; // vektor X p_mat->_11 = 1.0f - yy2 - zz2; p_mat->_21 = 2 * p_q->x * p_q->y - 2 * p_q->w * p_q->z; p_mat->_31 = 2 * p_q->x * p_q->z + 2 * p_q->w * p_q->y; // vektor Y p_mat->_12 = 2 * p_q->x * p_q->y + 2 * p_q->w * p_q->z; p_mat->_22 = 1.0f - xx2 - zz2; p_mat->_32 = 2 * p_q->y * p_q->z - 2 * p_q->w * p_q->x; // vektor Z p_mat->_13 = 2 * p_q->x * p_q->z - 2 * p_q->w * p_q->y; p_mat->_23 = 2 * p_q->y * p_q->z + 2 * p_q->w * p_q->x; p_mat->_33 = 1.0f - xx2 - yy2; return (p_mat); } /* y rotace // *p_r = acosf(1.0f-(2*p_q->x*p_q->x)-(2*p_q->y*p_q->y)); temp._11 = cosinus; temp._13 = sinus; temp._33 = cosinus; temp._31 = -sinus; */ inline QUAT *matrix_to_quat(GLMATRIX * p_m, QUAT * p_q) { // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes // article "Quaternion Calculus and Fast Animation". float diagonala = p_m->_11 + p_m->_22 + p_m->_33; float root; if (diagonala > 0.0f) { // |w| > 1/2, may as well choose w > 1/2 root = sqrtf(diagonala + 1.0f); // 2w p_q->w = 0.5f * root; root = 0.5f / root; // root = 1/(4w) p_q->x = (p_m->_23 - p_m->_32) * root; p_q->y = (p_m->_31 - p_m->_13) * root; p_q->z = (p_m->_12 - p_m->_21) * root; return (p_q); } else { // |w| <= 1/2 float t; int i; if (p_m->_22 > p_m->_11) { t = p_m->_22; i = 2; } else { t = p_m->_11; i = 1; } if (p_m->_33 > t) { i = 3; } // i je nejvetsi a pak j a k sou ty 2 zbyvajici // fRoot = sqrtf(kRot[i][i]-kRot[j][j]-kRot[k][k] + 1.0f); switch (i) { case 1: // x je nejvetsi -> 4*x^2 j = 2 k = 3 root = sqrtf(p_m->_11 - p_m->_22 - p_m->_33 + 1.0f); p_q->x = 0.5f * root; root = 0.5f / root; // 1/(4*x) p_q->w = (p_m->_23 - p_m->_32) * root; //kRot[k][j]-kRot[j][k]; p_q->y = (p_m->_12 + p_m->_21) * root; //kRot[j][i]+kRot[i][j]; p_q->z = (p_m->_13 + p_m->_31) * root; //kRot[k][i]+kRot[i][k]; break; case 2: // y je nejvetsi -> 4*y^2 j = 3 k = 1 root = sqrtf(p_m->_22 - p_m->_33 - p_m->_11 + 1.0f); p_q->y = 0.5f * root; root = 0.5f / root; // 1/(4*y) p_q->w = (p_m->_31 - p_m->_13) * root; //(kRot[k][j]-kRot[j][k]; p_q->z = (p_m->_23 + p_m->_32) * root; //(kRot[j][i]+kRot[i][j]; p_q->x = (p_m->_21 + p_m->_12) * root; //(kRot[k][i]+kRot[i][k]; break; case 3: // z je nejvetsi -> 4*z^2 i = 3 j = 1 k = 2 root = sqrtf(p_m->_33 - p_m->_11 - p_m->_22 + 1.0f); p_q->z = 0.5f * root; root = 0.5f / root; // 1/(4*z) p_q->w = (p_m->_12 - p_m->_21) * root; //(kRot[k][j]-kRot[j][k]; p_q->x = (p_m->_31 + p_m->_13) * root; //(kRot[j][i]+kRot[i][j]; p_q->y = (p_m->_32 + p_m->_23) * root; //(kRot[k][i]+kRot[i][k]; break; } return (p_q); } } /* Nasobeni quaternionu skalarem */ inline QUAT *quat_mult_skalar(QUAT * p_q1, float skalar, QUAT * p_qv) { p_qv->x = p_q1->x * skalar; p_qv->y = p_q1->y * skalar; p_qv->z = p_q1->z * skalar; p_qv->w = p_q1->w * skalar; return (p_qv); } /* Slepi 2 uhly do jednoho kvaternionu */ inline QUAT *kam_angle_to_quat(float r, float fi, QUAT * p_q) { QUAT q1, q2; BOD o1, o2; if (r > 0.0f) o1.y = -1.0f; else { r = -r; o1.y = 1.0f; } o1.z = 0.0f; o1.x = 0.0f; if (fi > 0.0f) o2.x = 1.0f; else { fi = -fi; o2.x = -1.0f; } o2.y = 0.0f; o2.z = 0.0f; quat_mult(angle_to_quat(&q1, &o1, r), angle_to_quat(&q2, &o2, fi), p_q); return (p_q); } inline QUAT *key_rotkey_to_quat(ROTKEY * p_rot, QUAT * p_q) { return (angle_to_quat(p_q, (BOD *) & p_rot->x, p_rot->angle)); } #endif berusky2-0.12/src/komat/Load.cpp0000644000175000017500000033435613674777104013446 00000000000000/* pomocne funkce */ #include #include #include "compat_mini.h" #include "Berusky_universal.h" #include "3d_all.h" void json_export_kont_single(EDIT_KONTEJNER *p_kont, EDIT_MATERIAL ** p_mat, int max_mat); int hlasit_kolize = 0; template < class T > void vyrob_pole(T ** p_dst, int num) { if (!(*p_dst = (T *) mmalloc(sizeof(*p_dst[0]) * num))) chyba("Pamet"); memset((void *) *p_dst, 0, sizeof(*p_dst[0]) * num); } template < class T > void vyrob_pole_abs(T ** p_dst, int num) { if (!(*p_dst = (T *) mmalloc(sizeof(byte) * num))) chyba("Pamet"); memset((void *) *p_dst, 0, sizeof(byte) * num); } /* Koncovky */ /* Zameni koncovku, koncovka je zadana vcetne tecky */ char *zamen_koncovku(char *p_file, const char *p_koncovka) { char *p_pom = p_file, *p_last = NULL; while ((p_pom = strchr(p_pom, '.'))) { p_last = p_pom++; } if (p_last) *p_last = 0; return ((p_koncovka) ? strcat(p_file, p_koncovka) : p_file); } /* Zameni koncovku, oddelovaci znak se zadava */ char *zamen_koncovku_znak(char *p_file, char znak, const char *p_koncovka) { char *p_pom = strchr(p_file, znak); if (p_pom) *p_pom = 0; return ((p_koncovka) ? strcat(p_file, p_koncovka) : p_file); } /* Vrati koncovku souboru */ char *cti_koncovku(char *p_file) { if (p_file) { return (strchr(p_file, '.')); } else { return (NULL); } } /* Vrati znak */ char *cti_za_znak(char *p_string, char znak) { char *p_pom = p_string; while (*p_pom && *p_pom == znak) p_pom++; return (p_pom); } /* Mlzna kostka */ MLZNA_KOSTKA *vyrob_mlhokostku(char *p_jmeno) { MLZNA_KOSTKA *p_mlha = (MLZNA_KOSTKA *) mmalloc(sizeof(p_mlha[0])); strcpy(p_mlha->jmeno, p_jmeno); p_mlha->poly = K_CHYBA; p_mlha->a = 1.0f; p_mlha->mod = GL_LINEAR; p_mlha->max.x = 10.0f; p_mlha->max.y = 10.0f; p_mlha->max.z = 10.0f; return (p_mlha); } MLZNA_KOSTKA *kopiruj_mlhokostku(MLZNA_KOSTKA * p_src, char *p_jmeno) { MLZNA_KOSTKA *p_mlha = (MLZNA_KOSTKA *) mmalloc(sizeof(p_mlha[0])); *p_mlha = *p_src; strcpy(p_mlha->jmeno, p_jmeno); p_mlha->p_kont = NULL; p_mlha->p_next = p_src->p_next; p_src->p_next = p_mlha; return (p_mlha); } void zrus_mlhokostku(MLZNA_KOSTKA ** p_first, MLZNA_KOSTKA * p_maz) { MLZNA_KOSTKA *p_tmp, *p_prev; if (!p_first) { p_maz->p_kont = NULL; } else { if ((*p_first) == p_maz) { (*p_first) = p_maz->p_next; } else { p_tmp = (*p_first)->p_next; p_prev = (*p_first); while (p_tmp) { if (p_tmp == p_maz) { p_prev->p_next = p_maz->p_next; break; } else { p_prev = p_tmp; p_tmp = p_tmp->p_next; } } } free(p_maz); } } MLZNA_KOSTKA *zrus_mlhokostku_all(MLZNA_KOSTKA * p_first) { MLZNA_KOSTKA *p_tmp; while (p_first) { p_tmp = p_first->p_next; free(p_first); p_first = p_tmp; } return (NULL); } /* ************************************************** Objekty - vyrobeni / zruseni */ EDIT_OBJEKT *vyrob_objekt(void) { EDIT_OBJEKT *p_obj; p_obj = (EDIT_OBJEKT *) mmalloc(sizeof(EDIT_OBJEKT)); p_obj->kreslit = 1; p_obj->face_typ = GL_TRIANGLES; p_obj->line_typ = GL_LINES; init_matrix(&p_obj->m); // init_matrix(&p_obj->local_matrix); return (p_obj); } // f = facenum * 3 !!! EDIT_OBJEKT *vyrob_objekt_komplet(int v, int f) { EDIT_OBJEKT *p_obj; p_obj = (EDIT_OBJEKT *) mmalloc(sizeof(EDIT_OBJEKT)); p_obj->p_vertex = (MUJ_BOD *) mmalloc(sizeof(MUJ_BOD) * v); if (f) { if ((p_obj->p_face = (FACE *) mmalloc(sizeof(FACE) * f)) == NULL) { chyba("pamet"); } } p_obj->vertexnum = v; p_obj->facenum = f; p_obj->kreslit = 1; p_obj->face_typ = GL_TRIANGLES; p_obj->line_typ = GL_LINES; init_matrix(&p_obj->m); return (p_obj); } void zrus_kosti_key(JOINT_KEYS ** p_key) { null_free((void **) &(*p_key)->p_pkeys); null_free((void **) &(*p_key)->p_pos); null_free((void **) &(*p_key)->p_rkeys); null_free((void **) &(*p_key)->p_rot); null_free((void **) &(*p_key)->p_skeys); null_free((void **) &(*p_key)->p_scale); null_free((void **) p_key); *p_key = NULL; } void zrus_kosti_prs_rec(JOINT * p_joint) { if (p_joint) { if (p_joint->p_child) zrus_kosti_prs_rec(p_joint->p_child); if (p_joint->p_next) zrus_kosti_prs_rec(p_joint->p_next); if (p_joint->p_keys) zrus_kosti_key(&(p_joint->p_keys)); p_joint->pos_keys = 0; p_joint->p.x = p_joint->p.y = p_joint->p.z = 0.0f; null_free((void **) &p_joint->p_pos); p_joint->rot_keys = 0; p_joint->r.x = p_joint->r.y = p_joint->r.z = 0.0f; p_joint->r.w = 1.0f; null_free((void **) &p_joint->p_rot); p_joint->scs_keys = 0; p_joint->s.x = p_joint->s.y = p_joint->s.z = 1.0f; null_free((void **) &p_joint->p_scs); } } void zrus_kosti_rec(JOINT ** p_joint) { if (*p_joint) { if ((*p_joint)->p_child) zrus_kosti_rec(&((*p_joint)->p_child)); if ((*p_joint)->p_next) zrus_kosti_rec(&((*p_joint)->p_next)); if ((*p_joint)->p_keys) zrus_kosti_key(&((*p_joint)->p_keys)); null_free((void **) &(*p_joint)->p_vertexlist); null_free((void **) &(*p_joint)->p_pos); null_free((void **) &(*p_joint)->p_rot); null_free((void **) &(*p_joint)->p_scs); null_free((void **) &(*p_joint)); p_joint = NULL; } } void zrus_kosti(EDIT_OBJEKT * p_obj) { JOINT_ANIMACE *p_tmp = p_obj->p_joit_animace, *p_next; while (p_tmp) { p_next = p_tmp->p_next; if (p_tmp->p_child) zrus_kosti_rec(&p_tmp->p_child); free(p_tmp); p_tmp = p_next; } } void zrus_objekt(EDIT_OBJEKT ** p_obj) { zrus_kosti(*p_obj); if ((*p_obj)->p_tmp_sim) { key_sim_zrus_vnitrek((*p_obj)->p_tmp_sim); null_free((void **) &(*p_obj)->p_tmp_sim); } null_free((void **) &(*p_obj)->p_face); null_free((void **) &(*p_obj)->p_opt); null_free((void **) &(*p_obj)->p_vertex); null_free((void **) &(*p_obj)->p_line); null_free((void **) p_obj); } int smaz_divoke_vertexy_objektu_dir(EDIT_OBJEKT * p_obj) { OBJ_VERTEX *p_vert = p_obj->p_vertex; byte *p_div; word *p_face = p_obj->p_face; int i, j, vn = p_obj->vertexnum, od, fn = p_obj->facenum; if (!vn || !fn) return (TRUE); if ((p_div = (byte *) mmalloc(sizeof(byte) * vn)) == NULL) { chyba("pamet"); } memset(p_div, 1, sizeof(byte) * vn); for (i = 0; i < fn; i += 3) { p_div[p_face[i]] = p_div[p_face[i + 1]] = p_div[p_face[i + 2]] = 0; } for (i = 0, od = 0; i < vn + od; i++) { if (p_div[i]) { smaz_vertex_bez_facu(p_vert, vn, (i - od)); for (j = 0; j < fn; j += 3) { if (p_face[j] > i - od) p_face[j]--; if (p_face[j + 1] > i - od) p_face[j + 1]--; if (p_face[j + 2] > i - od) p_face[j + 2]--; } od++; } } free(p_div); p_obj->vertexnum -= od; return (od); } EDIT_OBJEKT *kopiruj_objekt(EDIT_OBJEKT * p_src) { EDIT_OBJEKT *p_cil; if (!p_src) return (p_src); p_cil = (EDIT_OBJEKT *) kopiruj_pole(p_src, sizeof(p_src[0])); p_cil->p_vertex = (OBJ_VERTEX *) kopiruj_pole(p_src->p_vertex, sizeof(OBJ_VERTEX) * p_cil->vertexnum); p_cil->p_vertex_kosti = (BOD *) kopiruj_pole(p_src->p_vertex_kosti, sizeof(p_src->p_vertex_kosti[0]) * p_cil->vertexnum); p_cil->p_face = (FACE *) kopiruj_pole(p_src->p_face, sizeof(FACE) * p_cil->facenum); p_cil->p_opt = (int *) kopiruj_pole(p_src->p_opt, sizeof(p_src->p_opt[0]) * p_src->optnum); p_cil->p_line = NULL; p_cil->p_joit_animace = key_kosti_kopiruj_animace(p_src->p_joit_animace); return (p_cil); } /* kopiruje */ void kopiruj_objekt_geometrie(EDIT_OBJEKT * p_src, EDIT_OBJEKT * p_cil) { if (!p_src) return; free(p_cil->p_vertex); p_cil->vertexnum = p_src->vertexnum; p_cil->p_vertex = (OBJ_VERTEX *) mmalloc(sizeof(OBJ_VERTEX) * p_cil->vertexnum); // mtest(p_cil->p_vertex); memcpy(p_cil->p_vertex, p_src->p_vertex, sizeof(OBJ_VERTEX) * p_cil->vertexnum); free(p_cil->p_face); p_cil->facenum = p_src->facenum; p_cil->p_face = (FACE *) mmalloc(sizeof(FACE) * p_cil->facenum); // mtest(p_cil->p_face); memcpy(p_cil->p_face, p_src->p_face, sizeof(FACE) * p_cil->facenum); } EDIT_OBJEKT *kopiruj_objekt_indir_vyber(EDIT_OBJEKT * p_src, EDIT_OBJEKT * p_cil, int flag) { int i; if (!p_src || !p_cil) return (NULL); for (i = 0; i < p_cil->vertexnum; i++) { if (flag & COPY_GEOMETRY) { p_cil->p_vertex[i].x = p_src->p_vertex[i].x; p_cil->p_vertex[i].y = p_src->p_vertex[i].y; p_cil->p_vertex[i].z = p_src->p_vertex[i].z; } if (flag & COPY_DIFFUSE) { p_cil->p_vertex[i].dr = p_src->p_vertex[i].dr; p_cil->p_vertex[i].dg = p_src->p_vertex[i].dg; p_cil->p_vertex[i].db = p_src->p_vertex[i].db; p_cil->p_vertex[i].da = p_src->p_vertex[i].da; p_cil->p_vertex[i].mdr = p_src->p_vertex[i].mdr; p_cil->p_vertex[i].mdg = p_src->p_vertex[i].mdg; p_cil->p_vertex[i].mdb = p_src->p_vertex[i].mdb; p_cil->p_vertex[i].mda = p_src->p_vertex[i].mda; } if (flag & COPY_SPECULAR) { p_cil->p_vertex[i].sr = p_src->p_vertex[i].sr; p_cil->p_vertex[i].sg = p_src->p_vertex[i].sg; p_cil->p_vertex[i].sb = p_src->p_vertex[i].sb; p_cil->p_vertex[i].msr = p_src->p_vertex[i].msr; p_cil->p_vertex[i].msg = p_src->p_vertex[i].msg; p_cil->p_vertex[i].msb = p_src->p_vertex[i].msb; } if (flag & COPY_MAP1) { p_cil->p_vertex[i].tu1 = p_src->p_vertex[i].tu1; p_cil->p_vertex[i].tv1 = p_src->p_vertex[i].tv1; } if (flag & COPY_MAP2) { p_cil->p_vertex[i].tu2 = p_src->p_vertex[i].tu2; p_cil->p_vertex[i].tv2 = p_src->p_vertex[i].tv2; } } if (flag & COPY_MATERIAL) { p_cil->material = p_src->material; } return (p_cil); } EDIT_OBJEKT *slep_objekty(EDIT_OBJEKT * p_obj1, EDIT_OBJEKT * p_obj2) { EDIT_OBJEKT *p_obj = vyrob_objekt(); int i; int f1, f2; if (strlen(p_obj1->jmeno) + strlen(p_obj2->jmeno) + 1 >= MAX_JMENO) { strcpy(p_obj->jmeno, p_obj1->jmeno); } else { if (snprintf(p_obj->jmeno, sizeof(p_obj->jmeno), "%s_%s", p_obj1->jmeno, p_obj2->jmeno) >= (int) sizeof(p_obj->jmeno)) { zrus_objekt(&p_obj); return (NULL); } } assert(strlen(p_obj->jmeno) < MAX_JMENO); p_obj->vertexnum = p_obj1->vertexnum + p_obj2->vertexnum; if ((p_obj->p_vertex = (OBJ_VERTEX *) malloc(sizeof(OBJ_VERTEX) * p_obj->vertexnum)) == NULL) { zrus_objekt(&p_obj); return (NULL); } memcpy(p_obj->p_vertex, p_obj1->p_vertex, sizeof(OBJ_VERTEX) * p_obj1->vertexnum); memcpy(p_obj->p_vertex + p_obj1->vertexnum, p_obj2->p_vertex, sizeof(OBJ_VERTEX) * p_obj2->vertexnum); p_obj->facenum = p_obj1->facenum + p_obj2->facenum; if ((p_obj->p_face = (FACE *) mmalloc(sizeof(FACE) * p_obj->facenum)) == NULL) { zrus_objekt(&p_obj); return (NULL); } memcpy(p_obj->p_face, p_obj1->p_face, sizeof(FACE) * p_obj1->facenum); f1 = p_obj1->facenum; f2 = (p_obj2->facenum + f1); for (i = f1; i < f2; i++) p_obj->p_face[i] = p_obj1->vertexnum + p_obj2->p_face[i - f1]; p_obj->material = p_obj1->material; p_obj->m1flag = p_obj1->m1flag; p_obj->m2flag = p_obj1->m2flag; p_obj->oflag = p_obj1->oflag; return (p_obj); } /* ************************************************** Kontejner */ EDIT_KONTEJNER *vyrob_kontejner(void) { EDIT_KONTEJNER *p_kont; if ((p_kont = (EDIT_KONTEJNER *) mmalloc(sizeof(EDIT_KONTEJNER))) == NULL) chyba("pamet!"); memset((void *) p_kont, 0, sizeof(p_kont[0])); p_kont->max_objektu = MAX_KONT_OBJEKTU; p_kont->kreslit = 1; p_kont->prvek = K_CHYBA; p_kont->kflag |= KONT_STATIC; p_kont->kontejner_ID = K_CHYBA; // defaultni id kontejneru init_matrix(&p_kont->world); // globalni transformacni matice init_matrix(&p_kont->mpmatrix); // lokalni transformacni matice (mp matrix) return (p_kont); } void zrus_kontejner(EDIT_KONTEJNER ** pp_kont, MLZNA_KOSTKA ** p_first) { int i; EDIT_KONTEJNER *p_kont; p_kont = *pp_kont; for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { zrus_objekt(&p_kont->p_obj[i]); } } if (p_kont->p_mlha) zrus_mlhokostku(p_first, p_kont->p_mlha); for (i = 0; i < KONT_MAX_ANIM; i++) { key_sim_root_zrus(p_kont->sim + i); } free(p_kont); *pp_kont = NULL; } void zrus_kontejner_rec(EDIT_KONTEJNER ** pp_kont, MLZNA_KOSTKA ** p_first) { int i; EDIT_KONTEJNER *p_kont, *p_next; p_kont = *pp_kont; while (p_kont) { for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { zrus_objekt(&p_kont->p_obj[i]); } } if (p_kont->p_mlha) zrus_mlhokostku(p_first, p_kont->p_mlha); for (i = 0; i < KONT_MAX_ANIM; i++) { key_sim_root_zrus(p_kont->sim + i); } p_next = p_kont->p_next; free(p_kont); p_kont = p_next; } *pp_kont = NULL; } void vyprazdni_kontejner(EDIT_KONTEJNER * p_kont) { int i; if (!p_kont) return; for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) zrus_objekt(&p_kont->p_obj[i]); } updatuj_kontejner_statistika(p_kont, TRUE); } void updatuj_kontejner_flag(EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_mat) { int o, m; while (p_kont) { p_kont->m1flag = p_kont->m2flag = 0; for (o = 0; o < p_kont->max_objektu; o++) { if (p_kont->p_obj[o]) { m = p_kont->p_obj[o]->material; if (p_mat[m]) { p_kont->p_obj[o]->m1flag |= p_mat[m]->flag; p_kont->p_obj[o]->m2flag |= p_mat[m]->flag2; } p_kont->m1flag |= p_kont->p_obj[o]->m1flag; p_kont->m2flag |= p_kont->p_obj[o]->m2flag; p_kont->kflag |= p_kont->p_obj[o]->oflag; } } p_kont = p_kont->p_next; } } void updatuj_obalku_kontejner(EDIT_KONTEJNER * p_kont) { int i; if (!p_kont) return; for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { obb_calc_obj_fast(p_kont->p_obj[i]); } } kontejner_obalka(p_kont); } void updatuj_kontejner_statistika(EDIT_KONTEJNER * p_kont, int obalky) { int i, j, f, v; while (p_kont) { for (i = 0, j = 0, f = 0, v = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { f += p_kont->p_obj[i]->facenum; v += p_kont->p_obj[i]->vertexnum; p_kont->m1flag |= p_kont->p_obj[i]->m1flag; p_kont->m2flag |= p_kont->p_obj[i]->m2flag; p_kont->kflag |= p_kont->p_obj[i]->oflag; j++; } } p_kont->objektu = j; p_kont->facu = f; p_kont->bodu = v; vycisti_kontejner(p_kont); if (obalky) updatuj_obalku_kontejner(p_kont); p_kont = p_kont->p_next; } } void smaz_divoke_vertexy_kontejneru(EDIT_KONTEJNER * p_kont) { int i; if (p_kont) { for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i] && !p_kont->p_obj[i]->p_joit_animace) smaz_divoke_vertexy_objektu_dir(p_kont->p_obj[i]); } } } void vycisti_kontejner(EDIT_KONTEJNER * p_kont) { int i; if (!p_kont) return; smaz_divoke_vertexy_kontejneru(p_kont); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i] && (!p_kont->p_obj[i]->vertexnum || !p_kont->p_obj[i]->facenum)) zrus_objekt(&p_kont->p_obj[i]); } } // posune objekty v kontejneru k sobe a pojmenuje je jednotne void preindexuj_kontejner(EDIT_KONTEJNER * p_kont) { int i, j; for (i = 0, j = 0; i < p_kont->max_objektu; i++) { if (!p_kont->p_obj[i]) continue; if (j != i) { p_kont->p_obj[j] = p_kont->p_obj[i]; p_kont->p_obj[i] = NULL; } j++; } } int slep_kontejner(EDIT_KONTEJNER * p_kont) { EDIT_OBJEKT *p_obj; int i, j, ob = -1; // 1000 je MAX_EDIT_MATERIALU for (i = 0; i < 1000 /*MAX_EDIT_MATERIALU */ ; i++) { for (j = 0; j < p_kont->max_objektu; j++) { if (p_kont->p_obj[j] && p_kont->p_obj[j]->material == i) { ob = j; break; } } if (j == p_kont->max_objektu) continue; for (j = ob + 1; j < p_kont->max_objektu; j++) { if (p_kont->p_obj[j] && p_kont->p_obj[j]->material == i) { p_obj = slep_objekty(p_kont->p_obj[ob], p_kont->p_obj[j]); zrus_objekt(&p_kont->p_obj[ob]); zrus_objekt(&p_kont->p_obj[j]); p_kont->p_obj[ob] = p_obj; } } } updatuj_kontejner_statistika(p_kont, TRUE); preindexuj_kontejner(p_kont); return (TRUE); } /* Slepi 2 objekty, pokud jsou od sebe vzdaleny mene nez min_dist */ #define SLEP_FACE_LIMIT 500 int slep_kontejner_dist(EDIT_KONTEJNER * p_kont, float min_dist) { EDIT_OBJEKT *p_obj1, *p_obj2; int i1, i2; kont_world_matrix(p_kont); // vraci pocet unikatnich materialu lo_setrid_kontejner(p_kont); for (i1 = 0, i2 = 1; i2 < p_kont->max_objektu;) { p_obj1 = p_kont->p_obj[i1]; p_obj2 = p_kont->p_obj[i2]; if (!p_obj2 || p_obj2->p_joit_animace) { i2++; continue; } if (!p_obj1 || p_obj1->p_joit_animace || p_obj1->material != p_obj2->material) { i1++; i2++; continue; } if (p_obj1->facenum + p_obj2->facenum > SLEP_FACE_LIMIT) { i1++; i2++; continue; } if (vzdal_bodu_bod(&p_obj1->obb.obb_stred, &p_obj2->obb.obb_stred) < min_dist) { p_kont->p_obj[i1] = slep_objekty(p_obj1, p_obj2); p_kont->p_obj[i2] = NULL; obb_calc_obj_fast(p_kont->p_obj[i1]); zrus_objekt(&p_obj1); zrus_objekt(&p_obj2); i2++; } else { i1++; i2++; } } preindexuj_kontejner(p_kont); updatuj_kontejner_statistika(p_kont, TRUE); return (TRUE); } /* Kopie kontejneru */ EDIT_KONTEJNER *kopiruj_kontejner(EDIT_KONTEJNER * p_src, EDIT_MATERIAL ** p_smat, EDIT_MATERIAL ** p_dmat, int dmatnum, STATIC_LIGHT * p_slight, int slightnum, DYN_LIGHT * p_dlight, int dlightnum, EXTRA_DYN_LIGHT * p_elight, int elightnum, LENS_FLARE * p_flare, int maxflares) { EDIT_KONTEJNER *p_dest = NULL; EDIT_KONTEJNER *p_dest_top = NULL; int i, mat; while (p_src) { if (!p_dest) { p_dest_top = p_dest = vyrob_kontejner(); } else { p_dest = (p_dest->p_next = vyrob_kontejner()); } *p_dest = *p_src; if (p_src->p_mlha) { p_dest->p_mlha = kopiruj_mlhokostku(p_src->p_mlha, p_dest->jmeno); p_dest->p_mlha->p_kont = p_dest; } // Prekopiruju svetla lo_kopiruj_svetla_do_sceny(p_dest, p_slight, slightnum, p_dlight, dlightnum, p_elight, elightnum, p_flare, maxflares); for (i = 0; i < MAX_KONT_OBJEKTU; i++) { if (p_src->p_obj[i]) { p_dest->p_obj[i] = kopiruj_objekt(p_src->p_obj[i]); if (p_smat) { mat = lo_najdi_material(p_dmat, dmatnum, p_smat[p_src->p_obj[i]->material]->jmeno); if (mat == K_CHYBA) { mat = lo_najdi_prazdny_material(p_dmat, dmatnum); if (mat == K_CHYBA) continue; p_dmat[mat] = kopiruj_material(p_smat[p_src->p_obj[i]->material]); } p_dest->p_obj[i]->material = mat; } } } // kopie stromu animacniho stromu ... if (p_src->kflag & KONT_KEYFRAME) { for (i = 0; i < KONT_MAX_ANIM; i++) { if (p_src->sim[i].keynum) key_sim_root_to_sim_root_indir(p_dest, p_dest->sim + i, p_src->sim + i); } } p_src = p_src->p_next; } return (p_dest_top); } EDIT_KONTEJNER *kopiruj_kontejner_indir_vyber(EDIT_KONTEJNER * p_src, EDIT_KONTEJNER * p_dest, int flag) { int i; for (i = 0; i < MAX_KONT_OBJEKTU; i++) { if (p_src->p_obj[i] && p_dest->p_obj[i]) { kopiruj_objekt_indir_vyber(p_src->p_obj[i], p_dest->p_obj[i], flag); } } return (p_dest); } int lo_setrid_kontejner_compare(const void *p_o1, const void *p_o2) { EDIT_OBJEKT **p_obj1 = (EDIT_OBJEKT **) p_o1; EDIT_OBJEKT **p_obj2 = (EDIT_OBJEKT **) p_o2; int o1 = INT_MAX, o2 = INT_MAX; float d1, d2; if (*p_obj1) { o1 = ((EDIT_OBJEKT *) * p_obj1)->material; } if (*p_obj2) { o2 = ((EDIT_OBJEKT *) * p_obj2)->material; } if (!(*p_obj1) || !(*p_obj2)) { if (o1 < o2) return (-1); if (o1 == o2) return (0); else return (1); } if (o1 < o2) // o1 je mensi nez o2 return (-1); if (o1 == o2) { d1 = vektor_velikost(&(((EDIT_OBJEKT *) * p_obj1)->obb.obb_stred)); d2 = vektor_velikost(&(((EDIT_OBJEKT *) * p_obj2)->obb.obb_stred)); if (d1 < d2) return (-1); if (d1 > d2) return (1); else return (0); } else return (1); // o2 je vetsi nez o1 } /* setridi staticky kontejner podle pouzitych materialu da stejne materily k sobe */ int lo_setrid_kontejner(EDIT_KONTEJNER * p_kont) { int mat = 0, i, am = INT_MAX; if (p_kont->kflag & KONT_KEYFRAME) return (0); kont_world_matrix(p_kont); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) obb_calc_obj_fast(p_kont->p_obj[i]); } qsort((void *) p_kont->p_obj, (size_t) p_kont->max_objektu, (size_t) sizeof(EDIT_OBJEKT *), lo_setrid_kontejner_compare); for (i = 0; i < MAX_KONT_OBJEKTU; i++) { if (p_kont->p_obj[i] && p_kont->p_obj[i]->material != am) { am = p_kont->p_obj[i]->material; mat++; } } return (mat); } /* ************************************************************************** Setrideni kontejneru podle materialu */ int lo_setrid_kontejner_materialy_compare(const void *p_o1, const void *p_o2) { EDIT_OBJEKT **p_obj1 = (EDIT_OBJEKT **) p_o1; EDIT_OBJEKT **p_obj2 = (EDIT_OBJEKT **) p_o2; int o1 = INT_MAX, o2 = INT_MAX; if (*p_obj1) { o1 = ((EDIT_OBJEKT *) * p_obj1)->material; } if (*p_obj2) { o2 = ((EDIT_OBJEKT *) * p_obj2)->material; } if (!(*p_obj1) || !(*p_obj2)) { if (o1 < o2) return (-1); if (o1 == o2) return (0); else return (1); } return (o1 - o2); } /* setridi staticky kontejner podle pouzitych materialu da stejne materily k sobe */ void lo_setrid_kontejner_materialy(EDIT_KONTEJNER * p_kont) { if (!(p_kont->kflag & KONT_KEYFRAME)) { qsort((void *) p_kont->p_obj, (size_t) p_kont->max_objektu, (size_t) sizeof(EDIT_OBJEKT *), lo_setrid_kontejner_materialy_compare); } } /* ************************************************** Animace */ void zrus_tri_vnitrek(HIERARCHY_TRACK_INFO * p_tri) { null_free((void **) &p_tri->p_pkeys); null_free((void **) &p_tri->p_pos); null_free((void **) &p_tri->p_rkeys); null_free((void **) &p_tri->p_at); null_free((void **) &p_tri->p_scale); null_free((void **) &p_tri->p_skeys); } void zrus_tri(HIERARCHY_TRACK_INFO ** p_trii) { zrus_tri_vnitrek(*p_trii); free(*p_trii); *p_trii = NULL; } void key_root_zrus_rec(HIERARCHY_TRACK_INFO * p_tri) { int i; for (i = 0; i < p_tri->childnum; i++) { assert(p_tri->p_child[i]); key_root_zrus_rec(p_tri->p_child[i]); } zrus_tri(&p_tri); } // zrusi animacni strom void key_root_zrus(HIERARCHY_ROOT * p_root) { int i; if (p_root->framenum) { for (i = 0; i < p_root->childnum; i++) { assert(p_root->p_child[i]); key_root_zrus_rec(p_root->p_child[i]); } memset(p_root, 0, sizeof(*p_root)); } } /* ******************************************************* Materialy */ EDIT_MATERIAL *vyrob_material(void) { EDIT_MATERIAL *p_mat; int i; if ((p_mat = (EDIT_MATERIAL *) mmalloc(sizeof(EDIT_MATERIAL))) == NULL) { chyba("pamet"); } memset((void *) p_mat, 0, sizeof(EDIT_MATERIAL)); p_mat->dxmat.diffuse_r = 1.0f; p_mat->dxmat.diffuse_g = 1.0f; p_mat->dxmat.diffuse_b = 1.0f; p_mat->dxmat.diffuse_a = 1.0f; p_mat->dxmat.specular_r = 0.0f; p_mat->dxmat.specular_g = 0.0f; p_mat->dxmat.specular_b = 0.0f; p_mat->dxmat.faktor_r = 1.0f; p_mat->dxmat.faktor_g = 1.0f; p_mat->dxmat.faktor_b = 1.0f; p_mat->dxmat.faktor_a = 1.0f; p_mat->lesk = 1.0f; p_mat->flag2 |= (MAT2_DIFFUSE | MAT2_DIFFUSE_RAY | MAT2_MAP1); mat_default_stage_bloky(p_mat); for (i = 0; i < MAT_TEXTUR; i++) { init_matrix(p_mat->ttext + i); } p_mat->env_scale = 1.0f; return (p_mat); } void zrus_material(EDIT_MATERIAL ** p_mat) { int i, j; if ((*p_mat)->flag & MAT_ANIM_FRAME) lo_zrus_animaci(&(*p_mat)->anim); for (j = 0; j < MAT_TEXTUR; j++) { for (i = 0; i < MAX_TEXT_ANIM; i++) { if ((*p_mat)->p_atext[j][i]) key_zrus_material_animace((*p_mat)->p_atext[j] + i); } } if ((*p_mat)->p_sub) zrus_material(&((*p_mat)->p_sub)); null_free((void **) p_mat); *p_mat = NULL; } void lo_zrus_material_kont(EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_list, int num) { EDIT_OBJEKT *p_obj; int o; oe_olist_reset(&o); while ((p_obj = oe_olist_next(p_kont, &o))) { if (p_obj->material < num && p_list[p_obj->material]) zrus_material(p_list + p_obj->material); } } EDIT_MATERIAL *kopiruj_material_indir(EDIT_MATERIAL * p_src, EDIT_MATERIAL * p_dest) { int i, j; if (!p_src || !p_dest) return (NULL); memcpy(p_dest, p_src, sizeof(EDIT_MATERIAL)); // kopie animaci if (p_src->flag & MAT_ANIM_FRAME) { p_dest->anim.p_frame = (ANIM_FRAME *) mmalloc(sizeof(ANIM_FRAME) * p_dest->anim.framenum); memcpy(p_dest->anim.p_frame, p_src->anim.p_frame, sizeof(ANIM_FRAME) * p_dest->anim.framenum); } // kopie animaci 1 for (j = 0; j < MAT_TEXTUR; j++) { for (i = 0; i < MAX_TEXT_ANIM; i++) { if (p_src->p_atext[j][i]) p_dest->p_atext[j][i] = key_kopiruj_material_animace(p_src->p_atext[j][i]); } } p_dest->p_sub = NULL; return (p_dest); } EDIT_MATERIAL *kopiruj_material(EDIT_MATERIAL * p_src) { EDIT_MATERIAL *p_dest; if (!p_src) return (NULL); p_dest = (EDIT_MATERIAL *) mmalloc(sizeof(EDIT_MATERIAL)); return (kopiruj_material_indir(p_src, p_dest)); } /* **************************************************** Dalsi */ #define miror(promena)\ {\ for(i = 0; i < p_dest->vertexnum; i++) {\ stred += promena;\ }\ stred /= (float)p_dest->vertexnum;\ for(i = 0; i < p_dest->vertexnum; i++) {\ if(promena > stred)\ promena -= (promena - stred);\ else\ promena += (stred - promena);\ } \ }\ /* ******************************************************* Mesh */ GAME_MESH_OLD *kopiruj_mesh(GAME_MESH_OLD * p_src, GAME_MESH_DATA * p_data) { GAME_MESH_OLD *p_dest = vyrob_mesh(p_src->objektu, p_data); int i; if (!p_dest) chyba("Pamet!"); if (!p_data) kopiruj_mesh_data(p_src->p_data, p_dest, p_dest->p_data); p_dest->vertexnum = p_src->vertexnum; p_dest->objektu = p_src->objektu; p_dest->facevel = p_src->facevel; p_dest->p_vertex_pos = (BOD *) kopiruj_pole(p_src->p_vertex_pos, sizeof(p_src->p_vertex_pos[0]) * p_src->vertexnum); p_dest->p_vertex_norm = (BOD *) kopiruj_pole(p_src->p_vertex_norm, sizeof(p_dest->p_vertex_norm[0]) * p_src->vertexnum); p_dest->p_vertex_diff = (BODRGBA *) kopiruj_pole(p_src->p_vertex_diff, sizeof(p_dest->p_vertex_diff[0]) * p_src->vertexnum); p_dest->p_vertex_diff_material = (BODRGBA *) kopiruj_pole(p_src->p_vertex_diff_material, sizeof(p_dest->p_vertex_diff_material[0]) * p_src->vertexnum); p_dest->p_vertex_spec = (BODRGB *) kopiruj_pole(p_src->p_vertex_spec, sizeof(p_dest->p_vertex_spec[0]) * p_src->vertexnum); p_dest->p_vertex_spec_material = (BODRGB *) kopiruj_pole(p_src->p_vertex_spec_material, sizeof(p_dest->p_vertex_spec_material[0]) * p_src->vertexnum); p_dest->p_vertex_uv1_material = (BODUV *) kopiruj_pole(p_src->p_vertex_uv1_material, sizeof(p_dest->p_vertex_uv1_material[0]) * p_src->vertexnum); p_dest->p_vertex_uv2_material = (BODUV *) kopiruj_pole(p_src->p_vertex_uv2_material, sizeof(p_dest->p_vertex_uv2_material[0]) * p_src->vertexnum); memcpy(p_dest->objektnum, p_src->objektnum, sizeof(p_src->objektnum[0]) * p_src->objektu); memcpy(p_dest->objektstart, p_src->objektstart, sizeof(p_src->objektstart[0]) * p_src->objektu); memcpy(p_dest->facenum, p_src->facenum, sizeof(p_src->facenum[0]) * p_src->objektu); memcpy(p_dest->facestart, p_src->facestart, sizeof(p_src->facestart[0]) * p_src->objektu); memcpy(p_dest->p_mat, p_src->p_mat, sizeof(p_src->p_mat[0]) * p_src->objektu); p_dest->p_face = (int *) mmalloc(sizeof(p_dest->p_face[0]) * p_src->facevel); memcpy(p_dest->p_face, p_src->p_face, sizeof(p_dest->p_face[0]) * p_src->facevel); p_dest->simnum = p_src->simnum; if (p_dest->simnum) { p_dest->p_sim = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_dest->p_sim[0]) * p_dest->simnum); for (i = 0; i < p_dest->simnum; i++) { key_sim_to_sim_indir(p_dest->p_sim + i, p_src->p_sim + i); } } return (p_dest); } /* Kopie Mesh-Dat */ GAME_MESH_DATA *kopiruj_mesh_data(GAME_MESH_DATA * p_src, GAME_MESH_OLD * p_mesh_top, GAME_MESH_DATA * p_desc) { struct _STATIC_LIGHT *p_lss, *p_lsd; struct _DYN_LIGHT *p_lds, *p_ldd; struct _EXTRA_DYN_LIGHT *p_les, *p_led; if (!p_src || !p_desc) return (NULL); p_desc->p_mesh = p_mesh_top; p_desc->kflag = p_src->kflag; p_desc->m1flag = p_src->m1flag; p_desc->m2flag = p_src->m2flag; p_desc->mesh_handle = p_src->mesh_handle; p_desc->mesh_ID = p_src->mesh_ID; p_desc->slightnum = p_src->slightnum; p_desc->lightmax = p_src->lightmax; p_desc->lightakt = p_src->lightakt; if (p_src->lightmax && p_src->p_light) { p_desc->p_light = (void **) mmalloc(sizeof(void *) * p_src->lightmax); memcpy(p_desc->p_light, p_src->p_light, sizeof(void *) * p_src->lightmax); } p_desc->top_edlight = p_src->top_edlight; p_desc->edlightnum = p_src->edlightnum; p_desc->edlightmax = p_src->edlightmax; if (p_src->edlightmax && p_src->p_edlight) { p_desc->p_edlight = (EXTRA_DYN_LIGHT **) mmalloc(sizeof(p_desc->p_edlight[0]) * p_src->edlightnum); memcpy(p_desc->p_edlight, p_src->p_edlight, sizeof(p_desc->p_edlight[0]) * p_src->edlightnum); } // Kopie statickych svetel if (p_src->p_lslight) { p_desc->p_lslight = (STATIC_LIGHT *) mmalloc(sizeof(p_src->p_lslight[0])); memcpy(p_desc->p_lslight, p_src->p_lslight, sizeof(p_src->p_lslight[0])); p_lss = p_src->p_lslight->p_next; p_lsd = p_desc->p_lslight; while (p_lss) { p_lsd->p_next = (STATIC_LIGHT *) mmalloc(sizeof(p_lsd->p_next[0])); memcpy(p_lsd->p_next, p_lss, sizeof(p_lss[0])); p_lss = p_lss->p_next; p_lsd = p_lsd->p_next; } } // Kopie dynamickych svetel if (p_src->p_ldlight) { p_desc->p_ldlight = (DYN_LIGHT *) mmalloc(sizeof(p_src->p_ldlight[0])); memcpy(p_desc->p_ldlight, p_src->p_ldlight, sizeof(p_src->p_ldlight[0])); p_lds = p_src->p_ldlight->p_next; p_ldd = p_desc->p_ldlight; while (p_lds) { p_ldd->p_next = (DYN_LIGHT *) mmalloc(sizeof(p_ldd->p_next[0])); memcpy((void *) p_ldd->p_next, p_lss, sizeof(p_lds[0])); p_lds = p_lds->p_next; p_ldd = p_ldd->p_next; } } // Kopie extra-svetel if (p_src->p_lelight) { p_desc->p_lelight = (EXTRA_DYN_LIGHT *) mmalloc(sizeof(p_src->p_lelight[0])); memcpy(p_desc->p_lelight, p_src->p_lelight, sizeof(p_src->p_lelight[0])); p_les = p_src->p_lelight->p_next; p_led = p_desc->p_lelight; while (p_les) { p_led->p_next = (EXTRA_DYN_LIGHT *) mmalloc(sizeof(p_led->p_next[0])); memcpy(p_led->p_next, p_les, sizeof(p_les[0])); p_les = p_les->p_next; p_led = p_led->p_next; } } return (p_desc); } /* word *facenum; // pocty facu v extra-facich - polich word *facestart; // starty facu jednotlivych objektu EXTRA_FACE **p_face; int */ void rozsir_objekt_light(EDIT_OBJEKT * p_obj) { MUJ_BOD v, *p_v1, *p_v2; MUJ_BOD nov[5]; word face[3 * 4], f[6]; int i, j, p[6], n, num = 0; if (p_obj->vertexnum != 4 || p_obj->facenum != 6) return; for (i = 0; i < 6; i++) { for (j = i; j < 6; j++) { if (i == j) continue; if (p_obj->p_face[i] == p_obj->p_face[j]) { p[num] = p_obj->p_face[i]; num++; } } } if (num == 2 && vzdal_bodu(p_obj->p_vertex + p[0], p_obj->p_vertex + p[1]) > 2.0f) { p_v1 = p_obj->p_vertex + p[0]; p_v2 = p_obj->p_vertex + p[1]; v.x = p_v1->x * 0.5f + p_v2->x * 0.5f; v.y = p_v1->y * 0.5f + p_v2->y * 0.5f; v.z = p_v1->z * 0.5f + p_v2->z * 0.5f; v.nx = p_v1->nx * 0.5f + p_v2->nx * 0.5f; v.ny = p_v1->ny * 0.5f + p_v2->ny * 0.5f; v.nz = p_v1->nz * 0.5f + p_v2->nz * 0.5f; v.tu1 = p_v1->tu1 * 0.5f + p_v2->tu1 * 0.5f; v.tu2 = p_v1->tu2 * 0.5f + p_v2->tu2 * 0.5f; v.tv1 = p_v1->tv1 * 0.5f + p_v2->tv1 * 0.5f; v.tv2 = p_v1->tv2 * 0.5f + p_v2->tv2 * 0.5f; v.dr = p_v1->dr * 0.5f + p_v2->dr * 0.5f; v.dg = p_v1->dg * 0.5f + p_v2->dg * 0.5f; v.db = p_v1->db * 0.5f + p_v2->db * 0.5f; v.da = p_v1->da * 0.5f + p_v2->da * 0.5f; v.mdr = p_v1->mdr * 0.5f + p_v2->mdr * 0.5f; v.mdg = p_v1->mdg * 0.5f + p_v2->mdg * 0.5f; v.mdb = p_v1->mdb * 0.5f + p_v2->mdb * 0.5f; v.mda = p_v1->mda * 0.5f + p_v2->mda * 0.5f; v.sr = p_v1->sr * 0.5f + p_v2->sr * 0.5f; v.sg = p_v1->sg * 0.5f + p_v2->sg * 0.5f; v.sb = p_v1->sb * 0.5f + p_v2->sb * 0.5f; v.msr = p_v1->msr * 0.5f + p_v2->msr * 0.5f; v.msg = p_v1->msg * 0.5f + p_v2->msg * 0.5f; v.msb = p_v1->msb * 0.5f + p_v2->msb * 0.5f; for (i = 0; i < 6; i += 3) { n = 0; f[0] = p_obj->p_face[i]; if (p_obj->p_face[i] == p[0] || p_obj->p_face[i] == p[1]) { n++; } if (p_obj->p_face[i + 1] == p[0] || p_obj->p_face[i + 1] == p[1]) { if (n) { // druhy spolecny f[3] = f[2] = p_obj->p_face[i + 2]; f[4] = f[1] = 4; f[5] = p_obj->p_face[i + 1]; } else { // prvni spolecny f[1] = p_obj->p_face[i + 1]; f[4] = f[2] = 4; f[3] = f[0]; f[5] = p_obj->p_face[i + 2]; } } else { assert(n); f[3] = f[1] = p_obj->p_face[i + 1]; f[5] = f[2] = 4; f[4] = p_obj->p_face[i + 2]; } memcpy(face + (i * 2), f, sizeof(f)); } free(p_obj->p_face); p_obj->p_face = (word *) mmalloc(sizeof(f[0]) * 12); memcpy(p_obj->p_face, face, sizeof(f[0]) * 12); memcpy(nov, p_obj->p_vertex, sizeof(p_obj->p_vertex[0]) * 4); free(p_obj->p_vertex); p_obj->p_vertex = (OBJ_VERTEX *) mmalloc(sizeof(p_obj->p_vertex[0]) * 5); memcpy(p_obj->p_vertex, nov, sizeof(p_obj->p_vertex[0]) * 4); p_obj->p_vertex[4] = v; p_obj->vertexnum = 5; p_obj->facenum = 12; } } // Prida extra-vertex void kont_extra_light(EDIT_KONTEJNER * p_kont) { int i; for (i = 0; i < p_kont->objektu; i++) { if (p_kont->objektu) rozsir_objekt_light(p_kont->p_obj[i]); } updatuj_kontejner_statistika(p_kont, FALSE); } void mesh_calc_varray(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_varray = &p_mesh->varray; int vertexu = p_mesh->vertexnum; int m2flag = p_mesh->p_data->m2flag; int last, norm = glstav_pn_triangles || p_mesh-> p_data->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); if (gl_ext::extlist_vertex_array) { p_varray->ati_start_pos = 0; last = sizeof(p_mesh->p_vertex_pos[0]) * vertexu; if (norm) { p_varray->ati_start_norm = last; last = last + sizeof(p_mesh->p_vertex_norm[0]) * vertexu; } if (m2flag & MAT2_DIFFUSE) { p_varray->ati_start_diff = last; last = last + sizeof(p_mesh->p_vertex_diff[0]) * vertexu; } p_varray->ati_start_spec = last; last = last + sizeof(p_mesh->p_vertex_spec[0]) * vertexu; if (m2flag & MAT2_MAP1) { p_varray->ati_start_text[0] = last; last = last + sizeof(p_mesh->p_vertex_uv2_material[0]) * vertexu; } if (m2flag & MAT2_MAP2) { p_varray->ati_start_text[1] = last; last = last + sizeof(p_mesh->p_vertex_uv3_material[0]) * vertexu; } if (m2flag & MAT2_MAP3) { p_varray->ati_start_text[2] = last; last = last + sizeof(p_mesh->p_vertex_uv4_material[0]) * vertexu; } if (m2flag & MAT2_MAP4) { p_varray->ati_start_text[3] = last; last = last + sizeof(p_mesh->p_vertex_uv4_material[0]) * vertexu; } //p_varray->ati_velikost = last+sizeof(p_mesh->p_face[0])*p_mesh->facevel; p_varray->ati_velikost = last; } } void mesh_preved_jointy_rec(JOINT * p_joint, int prvni_vertex) { int i; for (i = 0; i < p_joint->vertexnum; i++) { p_joint->p_vertexlist[i] += prvni_vertex; } if (p_joint->p_child) mesh_preved_jointy_rec(p_joint->p_child, prvni_vertex); if (p_joint->p_next) mesh_preved_jointy_rec(p_joint->p_next, prvni_vertex); if (p_joint->p_keys) zrus_kosti_key(&p_joint->p_keys); } // prevede animace JOINT_ANIMACE *mesh_preved_jointy(EDIT_OBJEKT * p_obj, int prvni_vertex, int objnum, GAME_MESH_OLD * p_mesh) { JOINT_ANIMACE *p_ret = p_obj->p_joit_animace; JOINT_ANIMACE *p_tmp = p_ret; if (!p_ret) { p_mesh->p_data->k2flag &= ~KONT2_JOINT_ANIM; return (NULL); } key_kosti_interpoluj(p_ret); while (p_tmp) { if (p_tmp->p_child) { mesh_preved_jointy_rec(p_tmp->p_child, prvni_vertex); p_tmp->p_norm_in = p_mesh->p_vertex_norm_kosti; p_tmp->p_norm_out = p_mesh->p_vertex_norm; p_tmp->p_pos_in = p_mesh->p_vertex_pos_kosti; p_tmp->p_pos_out = p_mesh->p_vertex_pos; } p_tmp = p_tmp->p_next; } p_ret->p_k2flag = (int *) &p_mesh->p_data->k2flag; p_ret->p_kkflag = (int *) &p_mesh->p_data->kflag; p_ret->p_koflag = (int *) p_mesh->p_kflag + objnum; p_obj->p_joit_animace = NULL; return (p_ret); } /* #define O_INDEX_POCET 0 #define O_INDEX_TYP 1 #define O_INDEX_DATA 2 */ /* Slepi dohromady pole p_opt p_mesh->p_face = opt_slep(p_opt, p_optnum, p_mesh->facestart, p_mesh->objektu, &p_mesh->facevel); null_free((void **)&p_opt); null_free((void **)&p_optnum); */ /* p_opt - pole poli p_opt p_optnum - delky v jednotlivych pol i p_start - pole zacatku poli facu jednotlivych objektu objnum - pocet objektu p_vysnum - vysledna delka slepeneho pole - vraci slepene pole a jeho delku */ int *opt_slep(int **p_opt, int *p_optnum, int *p_start, int objnum, int *p_vysnum) { int start, i, vel, num; int *p_tmp; vel = 0; for (i = 0; i < objnum; i++) { vel += p_optnum[i]; } *p_vysnum = vel; p_tmp = (int *) mmalloc(sizeof(p_tmp[0]) * vel); start = 0; for (i = 0; i < objnum; i++) { num = p_optnum[i]; memcpy(p_tmp + start, p_opt[i], sizeof(p_tmp[0]) * num); free(p_opt[i]); p_start[i] = start; start += num; } return (p_tmp); } /* #define O_INDEX_POCET 0 #define O_INDEX_TYP 1 #define O_INDEX_DATA 2 */ /* Pripocte k facum add *p_opt - pointer na list optu optnum - delka pole *p_opt (vcetne vsech indexu) */ int opt_add(int *p_opt, int optnum, int add) { int i, j, num; int sekci; if (p_opt) { j = 0; sekci = 0; while (j < optnum) { num = p_opt[O_INDEX_POCET]; for (i = O_INDEX_DATA; i < num + O_INDEX_DATA; i++) { p_opt[i] += add; } j += num + O_INDEX_DATA; p_opt += num + O_INDEX_DATA; sekci++; } return (sekci); } else { return (0); } } void opt_dopln(EDIT_OBJEKT * p_obj) { int optnum; int *p_opt; int i; if (!p_obj->p_opt) { kprintf(TRUE, "Stary objekt - calc strip %s...", p_obj->jmeno); optnum = p_obj->facenum + 2; p_opt = (int *) mmalloc(sizeof(p_opt[0]) * optnum); p_opt[O_INDEX_POCET] = p_obj->facenum; p_opt[O_INDEX_TYP] = p_obj->face_typ; for (i = 0; i < p_obj->facenum; i++) p_opt[i + O_INDEX_DATA] = p_obj->p_face[i]; p_obj->p_opt = p_opt; p_obj->optnum = optnum; } } GAME_MESH_OLD *edit_to_mesh(GAME_MESH_DATA * p_mesh_data, EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_mat, int max_mat, int shadow_volume) { GAME_MESH_OLD *p_mesh = vyrob_mesh(p_kont->objektu, p_mesh_data); // VERTEX_ARRAYS *p_varray = &p_mesh->varray; GLMATRIX tmp; BOD *p_piv; int **p_opt; int *p_optnum; int i, j, p, k, vertexnum, bodu = p_kont->bodu; size_ptr vel; //int shut = 0; int pivot = 0; kprintf(TRUE, "Edit-to-mesh %s (f:%d v:%d)", p_kont->jmeno, p_kont->facu, p_kont->bodu); strcpy(p_mesh->jmeno, p_kont->jmeno); p_mesh->p_data->kflag |= (p_kont->kflag & KONT_STATIC ? p_kont-> kflag : p_kont->kflag | KONT_POHYB); p_mesh->p_data->m1flag |= p_kont->m1flag; p_mesh->p_data->m2flag |= p_kont->m2flag; p_mesh->objektu = p_kont->objektu; p_mesh->vertexnum = p_kont->bodu; p_mesh->world = p_kont->world; // world matrix meshe p_mesh->m = p_kont->mpmatrix; // mp (mesh-pozition) matrix meshe/kontejneru p_mesh->low_id = p_kont->low_id; p_mesh->p_data->mesh_ID = p_kont->kontejner_ID; p_mesh->obb_local = p_kont->obb; p_mesh->obb_world = p_kont->obb; p_mesh->p_kflag = (dword *) mmalloc(sizeof(p_mesh->p_kflag[0]) * p_kont->objektu); p_opt = (int **) mmalloc(sizeof(p_opt[0]) * p_kont->objektu); p_optnum = (int *) mmalloc(sizeof(p_optnum[0]) * p_kont->objektu); p_mesh->p_mlha = p_kont->p_mlha; if (p_mesh->p_mlha) { p_kont->p_mlha->p_kont = p_mesh; p_kont->p_mlha = NULL; } // Obalkovy system p_mesh->p_obb_local = (OBB_OLD *) mmalloc(sizeof(p_mesh->p_obb_local[0]) * p_mesh->objektu); p_mesh->p_obb_world = (OBB_OLD *) mmalloc(sizeof(p_mesh->p_obb_world[0]) * p_mesh->objektu); if (p_kont->kflag & KONT_KEYFRAME) { p_mesh->p_key = (GLMATRIX *) mmalloc(sizeof(p_mesh->p_key[0]) * p_mesh->objektu); for (i = 0; i < p_mesh->objektu; i++) { init_matrix(p_mesh->p_key + i); } } // joint-animace if (p_kont->k2flag & KONT2_JOINT_ANIM) { p_mesh->p_joint_anim = (JOINT_ANIMACE **) mmalloc(sizeof(p_mesh->p_joint_anim[0]) * p_mesh->objektu); } if (p_kont->kflag & KONT_NORMAL_ANIM) { vyrob_pole(&p_mesh->p_normal_scale, p_mesh->objektu); vyrob_pole(&p_mesh->p_normal_scale_last, p_mesh->objektu); } vyrob_pole(&p_mesh->p_Objekt_ID, p_mesh->objektu); vel = sizeof(p_mesh->p_vertex_pos[0]) + sizeof(p_mesh->p_vertex_norm[0]); if (p_kont->m2flag & MAT2_DIFFUSE) { vel += sizeof(p_mesh->p_vertex_diff[0]) + sizeof(p_mesh->p_vertex_diff_material[0]); } if (p_kont->m2flag & MAT2_SPECULAR) { vel += sizeof(p_mesh->p_vertex_spec[0]) + sizeof(p_mesh->p_vertex_spec_material[0]); } else if (p_kont->m2flag & MAT2_ENV_SPEC) { vel += sizeof(p_mesh->p_vertex_spec[0]); } if (p_kont->m2flag & MAT2_MAP1) { vel += sizeof(p_mesh->p_vertex_uv1_material[0]); } if (p_kont->m2flag & MAT2_MAP2) { vel += sizeof(p_mesh->p_vertex_uv2_material[0]); } if (p_kont->m2flag & MAT2_MAP3) { vel += sizeof(p_mesh->p_vertex_uv3_material[0]); } if (p_kont->m2flag & MAT2_MAP4) { vel += sizeof(p_mesh->p_vertex_uv4_material[0]); } vyrob_pole_abs(&p_mesh->p_vertex_pos, vel * bodu); p_mesh->p_vertex_norm = p_mesh->p_vertex_pos + bodu; vel = reinterpret_cast(p_mesh->p_vertex_norm + bodu); if (p_kont->m2flag & MAT2_DIFFUSE) { p_mesh->p_vertex_diff = (BARVA_RGBA *) vel; p_mesh->p_vertex_diff_material = p_mesh->p_vertex_diff + bodu; vel = reinterpret_cast(p_mesh->p_vertex_diff_material + bodu); } if (p_kont->m2flag & MAT2_SPECULAR) { p_mesh->p_vertex_spec = (BODRGB *) vel; p_mesh->p_vertex_spec_material = p_mesh->p_vertex_spec + bodu; vel = reinterpret_cast(p_mesh->p_vertex_spec_material + bodu); } else if (p_kont->m2flag & MAT2_ENV_SPEC) { p_mesh->p_vertex_spec = (BODRGB *) vel; vel = reinterpret_cast(p_mesh->p_vertex_spec + bodu); } if (p_kont->m2flag & MAT2_MAP1) { p_mesh->p_vertex_uv1_material = (BODUV *) vel; vel = reinterpret_cast(p_mesh->p_vertex_uv1_material + bodu); } if (p_kont->m2flag & MAT2_MAP2) { p_mesh->p_vertex_uv2_material = (BODUV *) vel; vel = reinterpret_cast(p_mesh->p_vertex_uv2_material + bodu); } if (p_kont->m2flag & MAT2_MAP3) { p_mesh->p_vertex_uv3_material = (BODUV *) vel; vel = reinterpret_cast(p_mesh->p_vertex_uv3_material + bodu); } if (p_kont->m2flag & MAT2_MAP4) { p_mesh->p_vertex_uv4_material = (BODUV *) vel; vel = reinterpret_cast(p_mesh->p_vertex_uv4_material + bodu); } if (p_kont->k2flag & KONT2_JOINT_ANIM) { p_mesh->p_vertex_pos_kosti = (BOD *) mmalloc(sizeof(p_mesh->p_vertex_pos_kosti[0]) * bodu); p_mesh->p_vertex_norm_kosti = (BOD *) mmalloc(sizeof(p_mesh->p_vertex_norm_kosti[0]) * bodu); } for (i = 0, p = 0, j = 0; i < MAX_KONT_OBJEKTU; i++) { if (!p_kont->p_obj[i]) continue; opt_dopln(p_kont->p_obj[i]); if (p_kont->kflag & KONT_KEYFRAME) { p_mesh->p_key[j] = p_kont->p_obj[i]->m; } p_piv = &p_kont->p_obj[i]->pivot; if (!pivot && (p_piv->x != 0.0f || p_piv->y != 0.0f || p_piv->z != 0.0f)) { p_mesh->kofola_pivot = *p_piv; pivot = TRUE; } p_mesh->p_obb_world[j] = p_mesh->p_obb_local[j] = p_kont->p_obj[i]->obb; p_mesh->p_Objekt_ID[j] = p_kont->p_obj[i]->Objekt_ID; vertexnum = p_kont->p_obj[i]->vertexnum; for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_pos[k + p].x = p_kont->p_obj[i]->p_vertex[k].x; p_mesh->p_vertex_pos[k + p].y = p_kont->p_obj[i]->p_vertex[k].y; p_mesh->p_vertex_pos[k + p].z = p_kont->p_obj[i]->p_vertex[k].z; p_mesh->p_vertex_norm[k + p].x = p_kont->p_obj[i]->p_vertex[k].nx; p_mesh->p_vertex_norm[k + p].y = p_kont->p_obj[i]->p_vertex[k].ny; p_mesh->p_vertex_norm[k + p].z = p_kont->p_obj[i]->p_vertex[k].nz; if (p_mesh->p_vertex_pos_kosti) p_mesh->p_vertex_pos_kosti[k + p] = p_mesh->p_vertex_pos[k + p]; if (p_mesh->p_vertex_norm_kosti) p_mesh->p_vertex_norm_kosti[k + p] = p_mesh->p_vertex_norm[k + p]; } if (p_kont->m2flag & MAT2_DIFFUSE) { for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_diff[k + p].r = p_kont->p_obj[i]->p_vertex[k].dr; p_mesh->p_vertex_diff[k + p].g = p_kont->p_obj[i]->p_vertex[k].dg; p_mesh->p_vertex_diff[k + p].b = p_kont->p_obj[i]->p_vertex[k].db; p_mesh->p_vertex_diff[k + p].a = p_kont->p_obj[i]->p_vertex[k].da; p_mesh->p_vertex_diff_material[k + p].r = p_kont->p_obj[i]->p_vertex[k].mdr; p_mesh->p_vertex_diff_material[k + p].g = p_kont->p_obj[i]->p_vertex[k].mdg; p_mesh->p_vertex_diff_material[k + p].b = p_kont->p_obj[i]->p_vertex[k].mdb; p_mesh->p_vertex_diff_material[k + p].a = p_kont->p_obj[i]->p_vertex[k].mda; } } if (p_kont->m2flag & MAT2_SPECULAR) { for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_spec[k + p].r = p_kont->p_obj[i]->p_vertex[k].sr; p_mesh->p_vertex_spec[k + p].g = p_kont->p_obj[i]->p_vertex[k].sg; p_mesh->p_vertex_spec[k + p].b = p_kont->p_obj[i]->p_vertex[k].sb; p_mesh->p_vertex_spec_material[k + p].r = p_kont->p_obj[i]->p_vertex[k].msr; p_mesh->p_vertex_spec_material[k + p].g = p_kont->p_obj[i]->p_vertex[k].msg; p_mesh->p_vertex_spec_material[k + p].b = p_kont->p_obj[i]->p_vertex[k].msb; } } if (p_kont->m2flag & MAT2_MAP1) { for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_uv1_material[k + p].u = p_kont->p_obj[i]->p_vertex[k].tu1; p_mesh->p_vertex_uv1_material[k + p].v = p_kont->p_obj[i]->p_vertex[k].tv1; } } if (p_kont->m2flag & MAT2_MAP2) { for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_uv2_material[k + p].u = p_kont->p_obj[i]->p_vertex[k].tu2; p_mesh->p_vertex_uv2_material[k + p].v = p_kont->p_obj[i]->p_vertex[k].tv2; } } if (p_kont->m2flag & MAT2_MAP3) { for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_uv3_material[k + p].u = p_kont->p_obj[i]->p_vertex[k].tu3; p_mesh->p_vertex_uv3_material[k + p].v = p_kont->p_obj[i]->p_vertex[k].tv3; } } if (p_kont->m2flag & MAT2_MAP4) { for (k = 0; k < vertexnum; k++) { p_mesh->p_vertex_uv4_material[k + p].u = p_kont->p_obj[i]->p_vertex[k].tu4; p_mesh->p_vertex_uv4_material[k + p].v = p_kont->p_obj[i]->p_vertex[k].tv4; } } p_opt[j] = p_kont->p_obj[i]->p_opt; p_optnum[j] = p_kont->p_obj[i]->optnum; p_kont->p_obj[i]->p_opt = NULL; p_kont->p_obj[i]->optnum = 0; p_mesh->facenum[j] = opt_add(p_opt[j], p_optnum[j], p); p_mesh->objektnum[j] = p_kont->p_obj[i]->vertexnum; p_mesh->objektstart[j] = p; p_mesh->p_mat[j] = p_kont->p_obj[i]->material; if (p_kont->k2flag & KONT2_JOINT_ANIM) { p_mesh->p_joint_anim[j] = mesh_preved_jointy(p_kont->p_obj[i], p, j, p_mesh); } p += p_kont->p_obj[i]->vertexnum; j++; } p_mesh->objektu = j; // pocet skutecne prevedenych objektu assert(j == p_kont->objektu); p_mesh->p_face = opt_slep(p_opt, p_optnum, p_mesh->facestart, p_mesh->objektu, &p_mesh->facevel); null_free((void **) &p_opt); null_free((void **) &p_optnum); //assert(!p_kont->p_slight); lo_premapuj_svetla_kont_mesh(p_kont, p_mesh); // kopie lokalnich animaci if (p_kont->kflag & KONT_KEYFRAME) { for (i = 0, p = K_CHYBA; i < KONT_MAX_ANIM; i++) { if (p_kont->sim[i].keynum) { p = i; } } if (p == K_CHYBA) { p_kont->kflag &= ~KONT_KEYFRAME; } else { p++; // p je posledni pouzity mesh p_mesh->p_sim = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_mesh->p_sim[0]) * p); p_mesh->simnum = p; // kopirovani animacnich stromu for (i = 0; i < p; i++) { if (p_kont->sim[i].keynum) { key_sim_root_to_sim_indir(p_kont->sim + i, p_mesh->p_sim + i); key_sim_dopln_matrix_mesh(p_mesh, p_mesh->p_sim + i); } } // ____OPRAVA____ p_mesh->p_sim_aktivni = p_mesh->p_sim; p_mesh->sim_aktivni_time = 0; mat_mult_dir(&p_mesh->world, &p_mesh->m, &tmp); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp); } } // Vertex-arrays inicializace mesh_calc_varray(p_mesh); mesh_pridej_vertex_array(p_mesh); if (!(p_mesh->p_data->kflag & KONT_KEYFRAME)) { mat_mult_dir(&p_mesh->world, &p_mesh->m, &tmp); obb_transformuj(&p_mesh->obb_local, &tmp, &p_mesh->obb_world); for (i = 0; i < p_mesh->objektu; i++) obb_transformuj(p_mesh->p_obb_local + i, &tmp, p_mesh->p_obb_world + i); } return (p_mesh); } GAME_MESH_OLD *vyrob_mesh(int objektu, GAME_MESH_DATA * p_data) { GAME_MESH_OLD *p_mesh; int i; if ((p_mesh = (GAME_MESH_OLD *) mmalloc(sizeof(p_mesh[0]))) == NULL) { chyba("pamet"); } memset((void *) p_mesh, 0, sizeof(p_mesh[0])); p_mesh->p_data = (p_data) ? p_data : vyrob_mesh_data(); p_mesh->objektu = objektu; p_mesh->p_data->top_edlight = K_CHYBA; p_mesh->objektnum = (word *) mmalloc(sizeof(p_mesh->objektnum[0]) * objektu); p_mesh->objektstart = (word *) mmalloc(sizeof(p_mesh->objektstart[0]) * objektu); p_mesh->facenum = (int *) mmalloc(sizeof(p_mesh->facenum[0]) * objektu); p_mesh->facestart = (int *) mmalloc(sizeof(p_mesh->facestart[0]) * objektu); p_mesh->p_mat = (int *) mmalloc(sizeof(p_mesh->p_mat[0]) * objektu); p_mesh->siminfo.odkaz = K_CHYBA; for (i = 0; i < LANI_FRONTA; i++) p_mesh->siminfo.akt[i] = K_CHYBA; return (p_mesh); } GAME_MESH_DATA *vyrob_mesh_data(void) { GAME_MESH_DATA *p_data; p_data = (GAME_MESH_DATA *) mmalloc(sizeof(p_data[0])); return (p_data); } void mesh_pridej_vodavertexy(GAME_MESH_OLD * p_mesh) { vyrob_pole(&p_mesh->p_vertex_diff_voda, p_mesh->vertexnum); vyrob_pole(&p_mesh->p_vertex_spec_voda, p_mesh->vertexnum); } void zrus_fleky(FLEK ** p_flek) { if (*p_flek) { zrus_fleky(&((*p_flek)->p_next)); free(*p_flek); *p_flek = NULL; } } void zrus_flare(LENS_FLARE ** p_flare) { if (*p_flare) { zrus_flare(&((*p_flare)->p_next)); null_free((void **) &(*p_flare)->p_sloz); free(*p_flare); *p_flare = NULL; } } void zrus_mesh_data(GAME_MESH_DATA ** p_tmp) { GAME_MESH_DATA *p_data = *p_tmp; null_free((void **) &p_data->p_light); null_free((void **) &p_data->p_edlight); null_free((void **) p_tmp); } void zrus_mesh(GAME_MESH_OLD ** p_mesh_top) { GAME_MESH_OLD *p_mesh = *p_mesh_top; GAME_MESH_OLD *p_tmp; int i; zrus_mesh_data(&p_mesh->p_data); while (p_mesh) { if (p_mesh->p_sim) { for (i = 0; i < p_mesh->simnum; i++) { key_sim_zrus(p_mesh->p_sim + i); } free(p_mesh->p_sim); } null_free((void **) &p_mesh->p_vertex_pos); null_free((void **) &p_mesh->objektnum); null_free((void **) &p_mesh->objektstart); null_free((void **) &p_mesh->facenum); null_free((void **) &p_mesh->facestart); null_free((void **) &p_mesh->p_face); null_free((void **) &p_mesh->p_mat); null_free((void **) &p_mesh->p_key); null_free((void **) &p_mesh->p_obb_local); null_free((void **) &p_mesh->p_obb_world); null_free((void **) &p_mesh->p_Objekt_ID); null_free((void **) &p_mesh->p_kflag); if (mesh_vertex_array_zrus) mesh_vertex_array_zrus(p_mesh); p_tmp = p_mesh; p_mesh = p_mesh->p_next; null_free((void **) &p_tmp); } *p_mesh_top = NULL; } /************************************************************************ Hledaci rutiny - co hledaji ruzne veci jako treba volne textury, plne textury a podobne ************************************************************************ */ // pocet textur - MAX_EDIT_TEXTUR int lo_najdi_texturu(EDIT_TEXT * p_text, int max, char *p_file, int flag) { int i; for (i = 0; i < max; i++) { if (flag == p_text[i].flag && !strcasecmp(p_file, p_text[i].jmeno)) return (i); } return (K_CHYBA); } int lo_najdi_volnou_texturu(EDIT_TEXT * p_text, int max) { int i; for (i = 0; i < max; i++) { if (!p_text[i].jmeno[0]) { return (i); } } return (K_CHYBA); } // Pocet materialu - MAX_EDIT_MATERIALU int lo_najdi_material(EDIT_MATERIAL ** p_mat, int max, char *p_text) { int i; for (i = 0; i < max; i++) { if (p_mat[i] && !strcasecmp(p_text, p_mat[i]->jmeno)) return (i); } return (K_CHYBA); } EDIT_MATERIAL *lo_najdi_material_text_point(EDIT_MATERIAL ** p_mat, int max, EDIT_TEXT * p_text) { int i; for (i = 0; i < max; i++) { if (p_mat[i] && p_mat[i]->p_text[0] == p_text) return (p_mat[i]); } return (NULL); } int lo_najdi_prazdny_material(EDIT_MATERIAL ** p_mat, int max) { int i; for (i = 0; i < max; i++) { if (!p_mat[i]) return (i); } return (K_CHYBA); } int lo_pocet_materialu(EDIT_MATERIAL ** p_mat, int max) { int i, vel = 0; for (i = 0; i < max; i++) { if (p_mat[i]) vel = i + 1; } return (vel); } int lo_najdi_kameru(KAMERA * p_kam, int max, char *p_jmeno) { int i; for (i = 0; i < max; i++) { if (p_kam[i].cislo != K_CHYBA && !strcasecmp(p_kam[i].jmeno, p_jmeno)) return (i); } return (K_CHYBA); } int lo_najdi_volnou_kameru(KAMERA * p_kam, int max) { int i; for (i = 0; i < max; i++) { if (p_kam[i].cislo == K_CHYBA) { return (i); } } return (K_CHYBA); } int lo_najdi_volny_kontejner(EDIT_KONTEJNER ** p_kont, int max) { int i; for (i = 0; i < max; i++) { if (!p_kont[i]) { return (i); } } return (K_CHYBA); } int lo_najdi_volny_kontejner_up(EDIT_KONTEJNER ** p_kont, int max, int up) { int i; for (i = up; i < max; i++) { if (!p_kont[i]) { return (i); } } return (K_CHYBA); } int lo_najdi_volny_kontejner_zpet(EDIT_KONTEJNER ** p_kont, int max) { int i; for (i = max - 1; i > -1; i--) { if (!p_kont[i]) { return (i); } } return (K_CHYBA); } int lo_najdi_kontejner(EDIT_KONTEJNER ** p_kont, int max, char *p_jmeno) { int i; for (i = 0; i < max; i++) { if (!p_kont[i]) continue; if (!strcasecmp(p_kont[i]->jmeno, p_jmeno)) return (i); } return (K_CHYBA); } int lo_najdi_volny_objekt_kont(EDIT_KONTEJNER * p_kont) { int i; if (!p_kont) return (K_CHYBA); for (i = 0; i < p_kont->max_objektu; i++) { if (!p_kont->p_obj[i]) { return (i); } } return (K_CHYBA); } int lo_najdi_objekt_kont(EDIT_KONTEJNER * p_kont, char *p_jmeno) { int i; if (!p_kont) return (K_CHYBA); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { if (!strcasecmp(p_kont->p_obj[i]->jmeno, p_jmeno)) return (i); } } return (K_CHYBA); } int lo_najdi_objekt_kont_ID(EDIT_KONTEJNER * p_kont, int ID) { int i; if (!p_kont) return (K_CHYBA); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i] && p_kont->p_obj[i]->Objekt_ID == ID) return (i); } return (K_CHYBA); } int lo_najdi_objekt_kont_plny(EDIT_KONTEJNER * p_kont) { int i; if (!p_kont) return (K_CHYBA); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) return (i); } return (K_CHYBA); } EDIT_OBJEKT *lo_najdi_objekt_kont_poiter(EDIT_KONTEJNER * p_kont, char *p_jmeno) { int i; if (!p_kont) return (NULL); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i] && !strcmp(p_kont->p_obj[i]->jmeno, p_jmeno)) return (p_kont->p_obj[i]); } return (NULL); } EDIT_OBJEKT *lo_najdi_objekt_kont_poiter_ID(EDIT_KONTEJNER * p_kont, int ID) { int i; if (!p_kont) return (NULL); for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i] && p_kont->p_obj[i]->Objekt_ID == ID) return (p_kont->p_obj[i]); } return (NULL); } int lo_najdi_volny_mesh(GAME_MESH_OLD ** p_mesh, int max) { int i = -1; while (p_mesh[++i] && i < max); return ((i == max) ? K_CHYBA : i); } int lo_najdi_volny_flare(LENS_FLARE * p_flare, int max) { int i = -1; while (p_flare[++i].akt && i < max); return ((i == max) ? K_CHYBA : i); } // Prevede pole flaru na oboustrany linearni seznam LENS_FLARE *lo_flare2linear(LENS_FLARE * p_flare_list, int max) { LENS_FLARE *p_flare, *p_flare_first = NULL; LENS_FLARE *p_prev = NULL; int i; for (i = 0; i < max; i++) { if (!p_flare_list[i].akt) continue; p_flare = (LENS_FLARE *) mmalloc(sizeof(p_flare[0])); *p_flare = p_flare_list[i]; p_flare->p_next = NULL; if (p_prev) { p_flare->p_prev = p_prev; p_prev->p_next = p_flare; } else { p_flare->p_prev = NULL; } if (!i) { p_flare_first = p_flare; } p_prev = p_flare; } return (p_flare_first); } int lo_posledni_svetlo(STATIC_LIGHT * p_light, int max) { int i = 0, mmx = 0; while (i < max) { if (p_light[i].akt) mmx = i + 1; i++; } return (mmx); } int lo_reload_textur_formaty(char *cDir, EDIT_TEXT * p_text, int max, int save) { int i; for (i = 0; i < max; i++) { if (!p_text[i].jmeno[0] || p_text[i].load) continue; kprintf(TRUE, "Texture %s...", p_text[i].jmeno); if (strcasestr(p_text[i].jmeno, ".png") || strcasestr(p_text[i].jmeno, ".btx")) txt_nahraj_texturu_z_func(cDir, p_text[i].jmeno, p_text + i, save, TRUE, NULL, bmp_nahraj); else if (strstr(p_text[i].jmeno, ".dds")) txt_nahraj_texturu_z_dds(cDir, p_text[i].jmeno, p_text + i, save); else if (strstr(p_text[i].jmeno, ".tga")) txt_nahraj_texturu_z_func(cDir, p_text[i].jmeno, p_text + i, save, TRUE, NULL, bmp_nahraj); else assert(0); } return (0); } int lo_reload_textur_dir(EDIT_TEXT * p_text, int max, char *p_dir, int save) { return (lo_reload_textur_formaty(p_dir, p_text, max, save)); } int lo_reload_textur(TEXT_DIR * p_dir, EDIT_TEXT * p_text, int num, int save) { int i; for (i = 0; i < TEXT_DIRS; i++) { if (p_dir->texture_dir[i][0]) { txt_trida(p_dir->texture_dir_class[i]); lo_reload_textur_dir(p_text, num, p_dir->texture_dir[i], save); } } lo_reload_textur_chyby(p_text, num); return (TRUE); } int lo_reload_textur_chyby(EDIT_TEXT * p_text, int num) { int i, ok, n; for (i = 0, n = 0, ok = 0; i < num; i++) { if (p_text[i].jmeno[0] && !p_text[i].load) { kprintf(TRUE, "Chyba loadu textury %s...", p_text[i].jmeno); n++; } else { ok++; } } kprintf(TRUE, "Nahrano %d textur", ok); kprintf(TRUE, "Chybne nahrano %d textur", n); return (TRUE); } int lo_reload_textur_vypis(EDIT_TEXT * p_text, int num) { int i; for (i = 0; i < num; i++) { if (p_text[i].jmeno[0]) { kprintf(TRUE, "%d textura %s %d...", i, p_text[i].jmeno, p_text[i].load); } } return (TRUE); } int lo_smaz_textury(EDIT_TEXT * p_text, int max) { int i; for (i = 0; i < max; i++) { if (p_text[i].load) { txt_zrus_texturu(p_text + i); } } return (0); } int lo_smaz_textury_bmp(EDIT_TEXT * p_text, int max) { int i; for (i = 0; i < max; i++) { if (p_text[i].load && p_text[i].p_bmp) { bmp_zrus(&p_text[i].p_bmp); } } return (0); } // Vraci velikost pixelu v texturach int lo_velikost_textur(EDIT_TEXT * p_text, int max) { int i, xres, yres, vel = 0; int r, g, b, a, l, in; for (i = 0; i < max; i++) { if (p_text[i].load) { glBindTexture(p_text[i].typ, p_text[i].text); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_WIDTH, &xres); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_HEIGHT, &yres); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_RED_SIZE, &r); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_GREEN_SIZE, &g); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_BLUE_SIZE, &b); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_ALPHA_SIZE, &a); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); glGetTexLevelParameteriv(p_text[i].typ, 0, GL_TEXTURE_INTENSITY_SIZE, &in); vel += xres * yres * (r + b + g + a + l + in); } } return (vel); } /* reloadne stage z textur do materialu */ void lo_reload_stage(EDIT_MATERIAL ** p_mat, int num) { int i, t, as; for (i = 0; i < num; i++) { if (p_mat[i]) { for (t = 0; t < MAT_TEXTUR; t++) { if (p_mat[i]->p_text[t]) { as = p_mat[i]->p_text[t]->alfa_stage; if (as != K_CHYBA) { p_mat[i]->alfa_state = as; //- alfa stage pouze od 1 textury if (as == STAGE_ALFA_MASKA) { p_mat[i]->flag &= ~(MAT_PRUHLEDNY | MAT_NO_ZMASK | MAT_NO_ZTEST | MAT_NO_CULL); } } as = p_mat[i]->p_text[t]->no_cull; if (as) { p_mat[i]->flag |= (MAT_NO_CULL); } } } } } } int lo_pocet_textur(EDIT_TEXT * p_text, int max) { int i, vel = 0; for (i = 0; i < max; i++) { if (p_text[i].load) { vel = i; } } return (vel); } int lo_velikost_meshu(GAME_MESH_OLD ** p_mesh, int num, int *p_facu, int *p_vertexu) { int i, vel = 0; for (i = 0; i < num; i++) { if (p_mesh[i]) { vel += p_mesh[i]->varray.ati_velikost; vel += p_mesh[i]->facevel * sizeof(p_mesh[0]->p_face[0]); *p_facu += p_mesh[i]->facevel; *p_vertexu += p_mesh[i]->vertexnum; } } return (vel); } int lo_velikost_poly(EDIT_MESH_POLY * p_poly, int num, int *p_facu, int *p_vertexu) { int i, vel = 0; for (i = 0; i < num; i++) { vel += p_poly[i].varray.ati_velikost; *p_facu += p_poly[i].facenum; *p_vertexu += p_poly[i].facenum; } return (vel); } /* *.mnt - soubory s materialama */ void lo_vymaz_materialy(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text) { int i; for (i = 0; i < max_mat; i++) { if (p_mat[i]) zrus_material(p_mat + i); } for (i = 0; i < max_text; i++) { if (p_text[i].load) { txt_zrus_texturu(p_text + i); } } } /****************************************************************************** Materialy ****************************************************************************** */ int lo_najdi_prazdnou_animaci(ANIM_MATERIAL * p_anim, int max) { int i; for (i = 0; i < max; i++) { if (!p_anim[i].pouzita) return (i); } return (K_CHYBA); } /* komplet = 0 - vsechno --||--- = 1 - frame --||--- = 2 - posun #define ANIM_LOAD_ALL 0 #define ANIM_LOAD_FRAME 1 #define ANIM_LOAD_POSUN 2 */ #define FFF_FILE 'F' // |F | #define FFF_TIME 'T' #define FFF_EVENT 'E' #define FFF_ALFA 'A' #define FFF_POSUN 'P' void lo_vyrob_animaci_list(EDIT_MATERIAL * p_mat, char *p_list, EDIT_TEXT * p_text, int max, char komplet, char *p_dir) { ANIM_MATERIAL *p_amat = &p_mat->anim; FILE *f; char line[200]; // max delka radku char *p_pom, *p_next; int linenum; int first_text = 1, i, t, akt, pos, alfa, a; if (chdir(p_dir)) { ddw("Cannot change directory to %s", p_dir); assert(0); return; } if ((f = fopen(p_list, "r")) == NULL) { ddw("Nemuzu otevrit soubor %s", p_list); assert(0); return; } lo_zrus_animaci(p_amat); // Prekopiruj list strcpy(p_amat->jmeno, p_list); if (fgets(line, 200, f) == NULL) { ddw("Cannot read %s", p_list); assert(0); return; } // nahraj informace o frame animaci if (komplet == ANIM_LOAD_ALL || komplet == ANIM_LOAD_FRAME) { sscanf(line, "FRAME %d %d %d", &akt, &p_amat->frameakt, &alfa); if (akt) { p_mat->flag = akt ? p_mat->flag | MAT_ANIM_FRAME : p_mat->flag & ~MAT_ANIM_FRAME; //p_mat->flag = alfa ? p_mat->flag|MAT_ALFA_FAKTOR : p_mat->flag&~MAT_ALFA_FAKTOR; } } if (fgets(line, 200, f) == NULL) { ddw("Cannot read %s", p_list); assert(0); return; } // nahraj informace o posunu if (komplet == ANIM_LOAD_ALL || komplet == ANIM_LOAD_POSUN) sscanf(line, "POSUN %d\n", &pos); // pokud je pozadavek na load frame animace if (komplet == ANIM_LOAD_ALL || komplet == ANIM_LOAD_FRAME) { linenum = 0; while (fgets(line, 200, f)) linenum++; // ddw("%d radek animace",linenum); strcpy(p_amat->jmeno, p_list); p_amat->framenum = linenum; p_amat->frameakt = 0; p_amat->p_frame = (ANIM_FRAME *) mmalloc(sizeof(ANIM_FRAME) * p_amat->framenum); fseek(f, 0, SEEK_SET); if (fgets(line, 200, f) == NULL || fgets(line, 200, f) == NULL) { ddw("Cannot read %s", p_list); assert(0); return; } for (i = 0; i < p_amat->framenum; i++) { // nacti jmeno souboru if (fgets(line, 200, f) == NULL) { ddw("Cannot read %s", p_list); assert(0); return; } if ((p_pom = strchr(line, '\n'))) *p_pom = 0; p_amat->p_frame[i].file[0] = 0; p_amat->p_frame[i].flag &= ~FRAME_TEXTURA; p_pom = line; while (p_pom && p_pom[0]) { if ((p_next = strchr(p_pom, '|'))) { *p_next++ = 0; } /* Format p_pom: A ' ' p_next -> dalsi zaznam */ // Load textury a = tolower((int) p_pom[0]); switch (a) { case 'f': // je to texture file // pridej do texture listu t = lo_najdi_texturu(p_text, max, p_pom + 2, FALSE); if (t == K_CHYBA) { t = lo_najdi_volnou_texturu(p_text, max); if (t == K_CHYBA) chyba("Neni volna textura !"); else { memset(p_text + t, 0, sizeof(p_text[t])); strcpy(p_text[t].jmeno, p_pom + 2); } } p_amat->p_frame[i].p_text = p_text + t; strcpy(p_amat->p_frame[i].file, p_pom + 2); p_amat->p_frame[i].flag |= FRAME_TEXTURA; if (first_text) { strcpy(p_mat->textfile[0], p_text[t].jmeno); p_mat->p_text[0] = p_text + t; p_mat->textflag[0] = 0; first_text = FALSE; } break; case 't': // time flag p_amat->p_frame[i].time = ftoi(atof(p_pom + 2) * 1000); break; case 'e': // event flag p_amat->p_frame[i].flag |= FRAME_EVENT; break; case 'a': sscanf(p_pom + 2, "%x", &p_amat->p_frame[i].alfa); p_amat->p_frame[i].flag |= FRAME_ALFA_FAKTOR; break; case 'p': sscanf(p_pom + 2, "%f %f", &p_amat->p_frame[i].u, &p_amat->p_frame[i].v); p_amat->p_frame[i].flag |= FRAME_POSUN; p_mat->flag |= MAT_POSUN2D; break; default: ddw("Neznamy flag ! (%s)", p_pom); break; } p_pom = p_next; } } } fclose(f); } /* #define FFF_FILE 'F' // |F | #define FFF_TIME 'T' #define FFF_EVENT 'E' #define FFF_ALFA 'A' #define FFF_POSUN 'P' #define FRAME_EVENT 0x1 // timto framem se nepokracuje (ceka se na udalost) #define FRAME_ALFA_FAKTOR 0x2 // tento frame ma nastavit alfa-stage #define FRAME_TEXTURA 0x4 // tento frame ma nastavit texturu #define FRAME_POSUN 0x8 // posun texturu oproti originalu */ void lo_uloz_animaci_list(EDIT_MATERIAL * p_mat, char *p_list, char *p_dir) { ANIM_MATERIAL *p_amat = &p_mat->anim; int i, akt; FILE *f; if ((f = fopen(p_list, "w")) == NULL) chybat(STC, "File %s", p_list); akt = p_mat->flag & MAT_ANIM_FRAME; fprintf(f, "FRAME %d %d %d\n", akt, p_amat->frameakt, 0); fprintf(f, "POSUN %d\n", 0); for (i = 0; i < p_amat->framenum; i++) { /* Soubor */ fputc(FFF_FILE, f); fputc(' ', f); fputs(p_amat->p_frame[i].file, f); fputc('|', f); /* Cas */ fprintf(f, "T %.3f|", (float) (p_amat->p_frame[i].time) * 0.001f); /* Event flag */ if (p_amat->p_frame[i].flag & FRAME_EVENT) { fputc(FFF_EVENT, f); fputc('|', f); } /* Alfa flag */ if (p_amat->p_frame[i].flag & FRAME_ALFA_FAKTOR) { fprintf(f, "%c %x|", FFF_ALFA, p_amat->p_frame[i].alfa); } /* Posunovaci flag */ if (p_amat->p_frame[i].flag & FRAME_POSUN) { fprintf(f, "%c %f %f |", FFF_POSUN, p_amat->p_frame[i].u, p_amat->p_frame[i].v); } fputc('\n', f); } fclose(f); } void lo_zrus_animaci(ANIM_MATERIAL * p_amat) { if (p_amat->p_frame) free(p_amat->p_frame); memset(p_amat, 0, sizeof(ANIM_MATERIAL)); } /* Poly-listy */ EDIT_MESH_POLY *vyrob_poly(void) { return ((EDIT_MESH_POLY *) mmalloc(sizeof(EDIT_MESH_POLY))); } void zrus_vnitrek_poly(EDIT_MESH_POLY * p_poly) { int i; if (poly_vertex_array_zrus) poly_vertex_array_zrus(p_poly); if (p_poly->p_ind) { for (i = 0; i < (p_poly->facenum / 3); i++) { bmp_zrus(&p_poly->p_ind[i].p_bmp); bmp_zrus(&p_poly->p_ind[i].p_zal); } null_free((void **) &p_poly->p_ind); } null_free((void **) &p_poly->p_koord); null_free((void **) &p_poly->p_light); null_free((void **) &p_poly->p_lightnum); null_free((void **) &p_poly->p_edlight); } void zrus_poly(EDIT_MESH_POLY ** p_poly) { zrus_vnitrek_poly(*p_poly); free((*p_poly)); *p_poly = NULL; } BOD *lo_edit_to_poly_najdi_vetex(BOD * p_pozice, int bodu, OBJ_VERTEX * p_bod, int *p_index) { int v; for (v = 0; v < bodu; v++) { if (p_pozice[v].x == p_bod->x && p_pozice[v].y == p_bod->y && p_pozice[v].z == p_bod->z) { *p_index = v; return (p_pozice); } } return (NULL); } /* Frci pouze na kontejnery 1:1 (1 kont s 1 objektem - poly ma jeden material) */ EDIT_MESH_POLY *edit_to_poly_indir(EDIT_KONTEJNER * p_kont, EDIT_MESH_POLY * p_poly, int kID) { OBJ_VERTEX *p_bod; EDIT_OBJEKT *p_obj; TEXT_KOORD *p_koord; int f; int spec = p_kont->m2flag & MAT2_SPECULAR; if (!p_poly) return (NULL); if (p_kont->objektu != 1) { ddw("Poly s %d objektama !", p_kont->objektu); assert(0); } p_obj = p_kont->p_obj[0]; assert(p_obj); memset((void *) p_poly, 0, sizeof(*p_poly)); strcpy(p_poly->jmeno, p_kont->jmeno); kont_norm_vect(p_kont); updatuj_kontejner_statistika(p_kont, FALSE); // pocty objektu a pod. // koordinaty pro vsecny facy kontejneru p_koord = (TEXT_KOORD *) mmalloc(sizeof(TEXT_KOORD) * p_obj->facenum); // vyrobim list sousednosti if (!p_obj->p_fsous) obj_vyrob_list_sousednosti(p_obj); p_poly->p_fsous = (dword *) kopiruj_pole(p_obj->p_fsous, sizeof(p_obj->p_fsous[0]) * p_obj->facenum); p_poly->material = p_obj->material; // prekopiruj plosky for (f = 0; f < p_obj->facenum; f++) { p_bod = p_obj->p_vertex + p_obj->p_face[f]; p_koord[f].x = p_bod->x; p_koord[f].y = p_bod->y; p_koord[f].z = p_bod->z; p_koord[f].tu1 = p_bod->tu1; p_koord[f].tv1 = p_bod->tv1; p_koord[f].tu2 = p_bod->tu2; p_koord[f].tv2 = p_bod->tv2; p_koord[f].tu3 = p_bod->tu3; p_koord[f].tv3 = p_bod->tv3; p_koord[f].tu4 = p_bod->tu4; p_koord[f].tv4 = p_bod->tv4; p_koord[f].nx = p_bod->nx; p_koord[f].ny = p_bod->ny; p_koord[f].nz = p_bod->nz; p_koord[f].dr = p_bod->dr; p_koord[f].dg = p_bod->dg; p_koord[f].db = p_bod->db; p_koord[f].da = p_bod->da; p_koord[f].mdr = p_bod->mdr; p_koord[f].mdg = p_bod->mdg; p_koord[f].mdb = p_bod->mdb; p_koord[f].mda = p_bod->mda; if (spec) { p_koord[f].sr = p_bod->sr; p_koord[f].sg = p_bod->sg; p_koord[f].sb = p_bod->sb; p_koord[f].msr = p_bod->msr; p_koord[f].msg = p_bod->msg; p_koord[f].msb = p_bod->msb; } else { p_koord[f].msr = p_koord[f].sr = 0.0f; p_koord[f].msg = p_koord[f].sg = 0.0f; p_koord[f].msb = p_koord[f].sb = 0.0f; } } p_poly->p_koord = p_koord; p_poly->facenum = p_kont->facu; p_poly->kflag = p_kont->kflag; p_poly->k2flag = p_kont->k2flag; p_poly->m1flag = p_kont->m1flag; p_poly->m2flag = p_kont->m2flag; p_poly->p_mlha = p_kont->p_mlha; if (p_kont->p_mlha) { p_kont->p_mlha->poly = kID; p_kont->p_mlha->p_kont = NULL; p_kont->p_mlha = NULL; } p_poly->kreslit = TRUE; obb_calc_poly(p_poly); return (p_poly); } void lo_poly_flaguj_materialy(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat) { int mat; p_poly->m1flag |= p_mat[p_poly->material]->flag; p_poly->m2flag |= p_mat[p_poly->material]->flag2; mat = p_poly->material; if (alfa_stage_edit_blok[p_mat[mat]->alfa_state].alfa_pruhledny) { p_poly->m1flag |= MAT_PRUHLEDNY; } else { p_poly->m1flag &= ~MAT_PRUHLEDNY; } if (p_mat[mat]->alfa_state == STAGE_ALFA_MASKA) { p_poly->m2flag |= MAT2_MASKA; } else { p_poly->m2flag &= ~MAT2_MASKA; } } void lo_poly_oznac_zrcadlo(EDIT_MESH_POLY * p_poly) { p_poly->kflag |= KONT_ZRCADLO; } void edit_mesh_poly_from_disk(EDIT_MESH_POLY_DISK *src, EDIT_MESH_POLY *desc) { memcpy(desc->jmeno, src->jmeno, sizeof(desc->jmeno)); desc->facenum = src->facenum; desc->m1flag = src->m1flag; desc->m2flag = src->m2flag; desc->kflag = src->kflag; desc->k2flag = src->k2flag; desc->material = src->material; desc->kont = src->kont; desc->poly = src->poly; desc->lightnum = src->lightnum; desc->kreslit = src->kreslit; desc->mail = src->mail; desc->obb = src->obb; desc->lightmax = src->lightmax; desc->lightakt = src->lightakt; desc->top_edlight = src->top_edlight; desc->edlightmax = src->edlightmax; desc->edlightakt = src->edlightakt; desc->varray = src->varray; } FFILE lo_poly_file_vyrob(char *p_file, int filenum, int velikost) { FFILE f; if (!(f = ffopen(p_file, "wb"))) { assert(0); kerror(1,"Unable to open polyfile for writting (%s)",p_file); } ffwrite(&filenum, sizeof(int), 1, f); ffwrite(&velikost, sizeof(int), 1, f); return (f); } FFILE lo_poly_file_otevri(char *p_file, int *p_filenum, int velikost) { FFILE f; int vel; if (!(f = ffopen(p_file, "rb"))) { pperror(1, "Unable to open file %s", p_file); } ffread(p_filenum, sizeof(int), 1, f); ffread(&vel, sizeof(int), 1, f); if (vel != velikost) { pperror(1, "Wrong poly version (%s)! Save it again.", p_file); ffclose(f); return (NULL); } return (f); } void lo_poly_file_zavri(FFILE f) { ffclose(f); } void lo_poly_uloz(FFILE f, EDIT_MESH_POLY * p_poly, EDIT_TEXT * p_light) { int i; ffwrite(p_poly, sizeof(p_poly[0]), 1, f); ffwrite(p_poly->p_koord, sizeof(p_poly->p_koord[0]), p_poly->facenum, f); for (i = 0; i < p_poly->lightnum; i++) { p_poly->p_light[i] = (EDIT_TEXT *) (p_poly->p_light[i] - p_light); } // TODO - 64bit ffwrite(p_poly->p_light, sizeof(p_poly->p_light[0]), p_poly->lightnum, f); ffwrite(p_poly->p_lightnum, sizeof(p_poly->p_lightnum[0]), p_poly->lightnum, f); for (i = 0; i < p_poly->lightnum; i++) { p_poly->p_light[i] = p_light + reinterpret_cast(p_poly->p_light[i]); } } void lo_poly_nahraj_indir(FFILE f, EDIT_MESH_POLY * p_poly, EDIT_TEXT * p_light) { EDIT_MESH_POLY_DISK poly_disk; int i; ffread(&poly_disk, sizeof(poly_disk), 1, f); edit_mesh_poly_from_disk(&poly_disk, p_poly); p_poly->mail = 0; p_poly->p_koord = (TEXT_KOORD *) mmalloc(sizeof(p_poly->p_koord[0])*p_poly->facenum); ffread(p_poly->p_koord, sizeof(p_poly->p_koord[0]), p_poly->facenum, f); p_poly->p_light = (EDIT_TEXT **) mmalloc(sizeof(p_poly->p_light[0])*p_poly->lightnum); p_poly->p_lightnum = (int *) mmalloc(sizeof(p_poly->p_lightnum[0])*p_poly->lightnum); int *p_tmp = (int *)mmalloc(sizeof(int)*p_poly->lightnum); ffread(p_tmp, sizeof(int), p_poly->lightnum, f); ffread(p_poly->p_lightnum, sizeof(p_poly->p_lightnum[0]), p_poly->lightnum, f); for (i = 0; i < p_poly->lightnum; i++) { p_poly->p_light[i] = p_light + p_tmp[i]; } ffree(p_tmp); } void load_poly_check(void) { assert(sizeof(EDIT_MESH_POLY_DISK) == 372); assert(sizeof(TEXT_KOORD) == 120); assert(sizeof(EDIT_TEXT_DISK) == 124); } EDIT_MESH_POLY *lo_nahraj_poly_list(char *p_file, int *p_polynum, EDIT_TEXT * p_light, EDIT_MATERIAL ** p_mat, int matnum) { EDIT_MESH_POLY *p_poly; char material[50]; int i, filenum, mat, mn; FFILE f; load_poly_check(); if (!(f = lo_poly_file_otevri(p_file, &filenum, sizeof(EDIT_MESH_POLY_DISK)))) { *p_polynum = 0; return (NULL); } if (!filenum) { *p_polynum = 0; return (NULL); } if (!(p_poly = (EDIT_MESH_POLY *) mmalloc(sizeof(p_poly[0]) * filenum))) { assert(0); chyba("Pamet!"); } for (i = 0; i < filenum; i++) { kprintf(TRUE,"Loading poly %d...",i); ffread(material, sizeof(char), 50, f); lo_poly_nahraj_indir(f, p_poly + i, p_light); if (p_poly[i].m1flag & MAT_ANIM_FRAME) { int ret; // animovany material u poly-listu skopiruju mat = lo_najdi_material(p_mat, matnum, material); assert(mat != K_CHYBA); p_poly[i].material = mn = lo_najdi_prazdny_material(p_mat, matnum); assert(mn != K_CHYBA); p_mat[mn] = kopiruj_material(p_mat[mat]); ret = snprintf(p_mat[mn]->jmeno, sizeof(p_mat[mn]->jmeno), "%s_ak%d", p_mat[mat]->jmeno, mn); assert(ret < (int) sizeof(p_mat[mn]->jmeno)); } else { p_poly[i].material = lo_najdi_material(p_mat, matnum, material); } assert(p_poly[i].material != K_CHYBA); } lo_poly_file_zavri(f); *p_polynum = filenum; for (i = 0; i < filenum; i++) p_poly[i].kflag |= KONT_UPLOAD; return (p_poly); } void lo_uloz_poly_list(char *p_file, EDIT_MESH_POLY * p_poly, int polynum, EDIT_TEXT * p_light, EDIT_MATERIAL ** p_mat, int matnum) { char material[50]; FFILE f; int i; f = lo_poly_file_vyrob(p_file, polynum, sizeof(p_poly[0])); for (i = 0; i < polynum; i++) { assert(p_poly[i].material < matnum && p_mat[p_poly[i].material]); strcpy(material, p_mat[p_poly[i].material]->jmeno); ffwrite(material, sizeof(char), 50, f); lo_poly_uloz(f, p_poly + i, p_light); } lo_poly_file_zavri(f); } void lo_poly_calc_lightmap_face(EDIT_MESH_POLY * p_poly) { LIGHTMAP_FACE *p_lf; int facu = p_poly->facenum / 3; int ind; int l, i, last = 0; int s, u, v, t; BOD prus; float bmp_u, bmp_v; BOD vu, vv; // smerove vektory x,y p_poly->p_ind = (LIGHTMAP_FACE *) mmalloc(sizeof(p_poly->p_ind[0]) * facu); for (l = 0; l < p_poly->lightnum; l++) { for (i = 0; i < p_poly->p_lightnum[l]; i += 3) { ind = (last + i) / 3; p_lf = p_poly->p_ind + ind; s = last + i; u = last + i + 1; v = last + i + 2; // Setrideni podle u if (p_poly->p_koord[s].tul > p_poly->p_koord[u].tul) { t = s; s = u; u = t; if (p_poly->p_koord[s].tul > p_poly->p_koord[v].tul) { t = s; s = v; v = t; } } else { if (p_poly->p_koord[v].tul > p_poly->p_koord[u].tul) { t = u; u = v; v = t; } } // Setrideni podle v if (p_poly->p_koord[s].tvl > p_poly->p_koord[u].tvl) { t = s; s = u; u = t; if (p_poly->p_koord[s].tvl > p_poly->p_koord[v].tvl) { t = s; s = v; v = t; } } else { if (p_poly->p_koord[v].tvl < p_poly->p_koord[u].tvl) { t = u; u = v; v = t; } } p_lf->last_u = 0; // Ted to je OK, s-u-v p_lf->s0.x = p_poly->p_koord[s].x; p_lf->s0.y = p_poly->p_koord[s].y; p_lf->s0.z = p_poly->p_koord[s].z; vektor_sub((BOD *) (p_poly->p_koord + u), (BOD *) (p_poly->p_koord + s), &vu); prusecik((BOD *) (p_poly->p_koord + s), (BOD *) (p_poly->p_koord + u), (BOD *) (p_poly->p_koord + v), &prus); vektor_sub((BOD *) (p_poly->p_koord + v), &prus, &vv); calc_rovinu_bod((BOD *) (p_poly->p_koord + s), (BOD *) (p_poly->p_koord + s + 2), (BOD *) (p_poly->p_koord + s + 1), &p_poly->p_ind[ind].n); norm_rovinu(&p_poly->p_ind[ind].n); calc_rovinu_bod_vektor((BOD *) (p_poly->p_koord + s), &vu, &p_poly->p_ind[ind].rv); norm_rovinu(&p_poly->p_ind[ind].rv); calc_rovinu_bod_vektor((BOD *) (p_poly->p_koord + s), &vv, &p_poly->p_ind[ind].ru); norm_rovinu(&p_poly->p_ind[ind].ru); p_poly->p_ind[ind].ddu = vektor_velikost(&vu); p_poly->p_ind[ind].ddv = vektor_velikost(&vv); vektor_add(&p_lf->s0, &vv, &p_lf->s1); vektor_add(&p_lf->s0, &vu, &p_lf->s2); vektor_add(&p_lf->s2, &vv, &p_lf->s3); if (p_poly->p_light[l]->p_bmp) { bmp_u = (float) p_poly->p_light[l]->p_bmp->x; bmp_v = (float) p_poly->p_light[l]->p_bmp->y; p_poly->p_ind[ind].u = ftoi((float) floor(p_poly->p_koord[s].tul * bmp_u)); p_poly->p_ind[ind].v = ftoi((float) floor(p_poly->p_koord[s].tvl * bmp_v)); p_poly->p_ind[ind].nu = ftoi((float) ceil(p_poly->p_koord[u].tul * bmp_u)); p_poly->p_ind[ind].nv = ftoi((float) ceil(p_poly->p_koord[v].tvl * bmp_v)); p_poly->p_ind[ind].nu -= p_poly->p_ind[ind].u; p_poly->p_ind[ind].nv -= p_poly->p_ind[ind].v; p_poly->p_ind[ind].p_bmp = bmp_vyrob(p_poly->p_ind[ind].nu + 2, p_poly->p_ind[ind].nv + 2); p_poly->p_ind[ind].p_zal = bmp_vyrob(p_poly->p_ind[ind].nu + 2, p_poly->p_ind[ind].nv + 2); // MSS_SET_BLOCK_LABEL(p_poly->p_ind[ind].p_bmp, "lo_poly_calc_lightmap_face1"); // MSS_SET_BLOCK_LABEL(p_poly->p_ind[ind].p_zal, "lo_poly_calc_lightmap_face2"); bmp_vyber_rec(p_poly->p_light[l]->p_bmp, p_poly->p_ind[ind].p_bmp, p_poly->p_ind[ind].u - 1, p_poly->p_ind[ind].v - 1); bmp_kopiruj(p_poly->p_ind[ind].p_bmp, p_poly->p_ind[ind].p_zal); } else { kprintf(1, "lo_poly_calc_lightmap_face -> p_bmp = NULL!"); } } last += p_poly->p_lightnum[l]; } } /* ********************************************************************** Load/save kont/materialy */ /* Uklada utomaticky do *.b2m */ FFILE lo_uloz_kontejner(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER * p_kont_top, char *p_jmeno, int file, FFILE f) { EDIT_KONTEJNER *p_kont; if (!f || !file) { if ((f = ffopen(p_jmeno, "wb")) == NULL) { return (NULL); } } lo_uloz_kontejner_chunk(f, p_mat, max_mat, p_kont_top, FALSE); p_kont = p_kont_top->p_next; while (p_kont) { lo_uloz_kontejner_chunk(f, p_mat, max_mat, p_kont, TRUE); p_kont = p_kont->p_next; } if (!file) { ffclose(f); return (NULL); } else { return (f); } } /* Nacti b2m (OGL) a out meshe */ EDIT_KONTEJNER *lo_nahraj_kontejner(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_jmeno, int mat) { if (!strcmp(cti_koncovku(p_jmeno), KONCOVKA_MESH_OLD)) { return (lo_nahraj_kontejner_out(p_mat, max_mat, p_text, max_text, p_jmeno, mat)); } else { return (lo_nahraj_kontejner_chunk(p_mat, max_mat, p_text, max_text, p_jmeno, mat, FALSE)); } } /* Nahraje b2t nebo mnt materialy */ int lo_nahraj_materialy(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file) { if (!strcmp(cti_koncovku(p_file), KONCOVKA_MATERIAL_OLD)) { return (lo_nahraj_materialy_out_jmeno(p_mat, max_mat, p_text, max_text, p_file, TRUE)); } else { return (lo_nahraj_materialy_chunk(p_mat, max_mat, p_text, max_text, p_file, TRUE)); } } /* Ulozi vsechny materialy vcetne animaci - pouze jako chunk */ int lo_uloz_materialy(EDIT_MATERIAL ** p_mat, int max_mat, char *p_file, char *p_dir) { char file[500]; FFILE f; int i; strcpy(file, p_file); zamen_koncovku(file, KONCOVKA_MATERIAL); if (chdir(p_dir) || (f = ffopen(file, "wb")) == NULL) return (FALSE); for (i = 0; i < max_mat; i++) { if (p_mat[i]) lo_uloz_material_chunk(f, p_mat[i]); } ffclose(f); return (TRUE); } int lo_uloz_material(EDIT_MATERIAL * p_mat, char *p_file, char *p_dir) { char file[500]; FFILE f; strcpy(file, p_file); zamen_koncovku(file, KONCOVKA_MATERIAL); if (chdir (p_dir) || (f = ffopen(file, "wb")) == NULL) return (FALSE); lo_uloz_material_chunk(f, p_mat); ffclose(f); return (TRUE); } /* ulozi pouzite materily vcetne animaci */ int lo_uloz_materialy_pouzite(EDIT_MATERIAL ** p_mat, int max_mat, char *p_file, char *p_dir) { char file[200]; FFILE f; int i; strcpy(file, p_file); zamen_koncovku(file, KONCOVKA_MATERIAL); if (chdir(p_dir) || (f = ffopen(file, "wb")) == NULL) return (FALSE); for (i = 0; i < max_mat; i++) { if (p_mat[i] && p_mat[i]->flag & (MAT_POUZITY | MAT_SYSTEM)) { lo_uloz_material_chunk(f, p_mat[i]); } } ffclose(f); return (i); } /* Mesi sekce */ GAME_MESH_OLD *lo_nahraj_mesh(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file, int mat, int extra_light, int json_export) { EDIT_KONTEJNER *p_kont_top, *p_kont; GAME_MESH_OLD *p_mesh_top = NULL, *p_mesh = NULL; p_kont = p_kont_top = lo_nahraj_kontejner(p_mat, max_mat, p_text, max_text, p_file, mat); if(json_export) { json_export_kont_single(p_kont, p_mat, max_mat); } if (p_kont && p_kont->bodu && p_kont->objektu) { while (p_kont) { if (extra_light) kont_extra_light(p_kont); lo_setrid_kontejner_materialy(p_kont); if (p_mesh) { p_mesh = (p_mesh->p_next = edit_to_mesh(p_mesh_top->p_data, p_kont, p_mat, max_mat, FALSE)); } else { p_mesh_top = p_mesh = edit_to_mesh(NULL, p_kont, p_mat, max_mat, FALSE); p_mesh->p_data->p_mesh = p_mesh; } p_kont = p_kont->p_next; } } else { p_mesh_top = NULL; } zrus_kontejner_rec(&p_kont_top, NULL); return (p_mesh_top); } /* Kontejner to mesh */ GAME_MESH_OLD *lo_kontejner_to_mesh(EDIT_KONTEJNER ** p_kont_top, EDIT_MATERIAL ** p_mat, int max_mat, int extra_light) { EDIT_KONTEJNER *p_kont; GAME_MESH_OLD *p_mesh_top = NULL, *p_mesh = NULL; p_kont = *p_kont_top; if (p_kont->bodu && p_kont->objektu) { while (p_kont) { if (extra_light) kont_extra_light(p_kont); lo_setrid_kontejner_materialy(p_kont); updatuj_kontejner_statistika(p_kont, FALSE); if (p_mesh) { p_mesh = (p_mesh->p_next = edit_to_mesh(p_mesh_top->p_data, p_kont, p_mat, max_mat, FALSE)); } else { p_mesh_top = p_mesh = edit_to_mesh(NULL, p_kont, p_mat, max_mat, FALSE); p_mesh->p_data->p_mesh = p_mesh; } p_kont = p_kont->p_next; } } else { p_mesh_top = NULL; } zrus_kontejner_rec(p_kont_top, NULL); return (p_mesh_top); } // Prevede kontejner tak, aby jeho objekty meli jedinecne jmena void lo_kontejner_jedinecne_jmena(EDIT_KONTEJNER * p_kont, int ds3) { char pom[200]; int i, j, max = 0; if (ds3) { for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { sprintf(p_kont->p_obj[i]->jmeno, "Obj_%d", i); } } } else { for (i = 0; i < p_kont->max_objektu; i++) { if (p_kont->p_obj[i]) { max = i + 1; } } for (i = 0; i < max; i++) { if (!p_kont->p_obj[i]) continue; for (j = i + 1; j < max; j++) { if (!p_kont->p_obj[j]) continue; if (!strcmp(p_kont->p_obj[i]->jmeno, p_kont->p_obj[j]->jmeno)) { strcat(p_kont->p_obj[i]->jmeno, "#"); strcat(p_kont->p_obj[i]->jmeno, itoa(i, pom, 10)); assert(strlen(p_kont->p_obj[i]->jmeno) < MAX_JMENO); break; // koncim a modlim se } } } } } void lo_kontlist_jedinecne_jmena(EDIT_KONTEJNER ** p_kont, int listnum) { char pom[200]; int i, j, max = 0; // Zjistim posledni objekt for (i = 0; i < listnum; i++) { if (p_kont[i]) max = i + 1; } for (i = 0; i < max; i++) { if (!p_kont[i]) continue; for (j = i + 1; j < max; j++) { if (!p_kont[j]) continue; if (!strcmp(p_kont[i]->jmeno, p_kont[j]->jmeno)) { strcat(p_kont[i]->jmeno, "#"); strcat(p_kont[i]->jmeno, itoa(i, pom, 10)); assert(strlen(p_kont[i]->jmeno) < MAX_JMENO); break; // koncim a modlim se } } } } int lo_najdi_volne_stat_svetlo(STATIC_LIGHT * p_light, int max) { int i; for (i = 0; i < max; i++) { if (!p_light[i].akt) return (i); } return (K_CHYBA); } int lo_najdi_plne_stat_svetlo(STATIC_LIGHT * p_light, int max) { int i; for (i = 0; i < max; i++) { if (p_light[i].akt) return (i); } return (K_CHYBA); } int lo_najdi_volne_dsvetlo(DYN_LIGHT * p_dlight, int max) { int i; for (i = 0; i < max; i++) { if (!p_dlight[i].akt) return (i); } return (K_CHYBA); } int lo_najdi_plne_dsvetlo(DYN_LIGHT * p_dlight, int max) { int i; for (i = 0; i < max; i++) { if (p_dlight[i].akt) return (i); } return (K_CHYBA); } DYN_LIGHT *lo_najdi_volne_dsvetlo_point(DYN_LIGHT * p_dlight, int max) { int i; for (i = 0; i < max; i++) { if (!p_dlight[i].akt) return (p_dlight + i); } return (NULL); } int lo_najdi_prepocitej_dsvetlo(DYN_LIGHT * p_dlight, int max) { int i, dl_lightnum = -1; for (i = 0; i < MAX_FLARE_SVETEL; i++) { if (p_dlight[i].akt && i > dl_lightnum) { dl_lightnum = i; } } return (dl_lightnum + 1); } /* Extra-svetla */ int lo_najdi_prepocitej_extra_svetlo(EXTRA_DYN_LIGHT * p_dlight, int max) { int i, dl_lightnum = -1; for (i = 0; i < MAX_FLARE_SVETEL; i++) { if (p_dlight[i].akt && i > dl_lightnum) { dl_lightnum = i; } } return (dl_lightnum + 1); } int lo_najdi_volne_extra_svetlo(EXTRA_DYN_LIGHT * p_dlight, int max) { int i; for (i = 0; i < max; i++) { if (!p_dlight[i].akt) return (i); } return (K_CHYBA); } int lo_najdi_plne_extra_svetlo(EXTRA_DYN_LIGHT * p_dlight, int max) { int i; for (i = 0; i < max; i++) { if (p_dlight[i].akt) return (i); } return (K_CHYBA); } EXTRA_DYN_LIGHT *lo_najdi_volne_extra_svetlo_point(EXTRA_DYN_LIGHT * p_dlight, int max) { int i; for (i = 0; i < max; i++) { if (!p_dlight[i].akt) return (p_dlight + i); } return (NULL); } void lo_preved_flare_do_sceny(STATIC_LIGHT * p_light, LENS_FLARE * p_flarelist, int flaremax) { LENS_FLARE *p_flare; while (p_light) { if (p_light->p_flare) { p_flare = lo_kopiruj_flare(p_flarelist, flaremax, (LENS_FLARE *) p_light->p_flare); free(p_light->p_flare); p_light->p_flare = p_flare; p_flare->p_svetlo = p_light; } p_light = p_light->p_next; } } void lo_preved_svetla_do_sceny(EDIT_KONTEJNER * p_kont, STATIC_LIGHT * p_light, int lightnum, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum) { STATIC_LIGHT *p_slight, *p_next; DYN_LIGHT *p_dlight, *p_dnext; EXTRA_DYN_LIGHT *p_elight, *p_enext; int l, p; while (p_kont) { /* Prevedu staticky svetla */ if (p_light) { p_slight = p_kont->p_slight; if (p_slight) { l = lo_najdi_volne_stat_svetlo(p_light, lightnum); if (l != K_CHYBA) { p_light[l] = *p_slight; if (p_light[l].p_flare) ((LENS_FLARE *) (p_light[l].p_flare))->p_svetlo = p_light + l; p_light[l].index = l; p_light[l].p_mesh_data = p_kont; p_light[l].p_prev = NULL; p_light[l].p_next = NULL; p_kont->p_slight = p_light + l; p = l; p_next = p_slight->p_next; free(p_slight); p_slight = p_next; while (p_slight) { l = lo_najdi_volne_stat_svetlo(p_light, lightnum); if (l != K_CHYBA) { p_light[l] = *p_slight; if (p_light[l].p_flare) ((LENS_FLARE *) (p_light[l].p_flare))->p_svetlo = p_light + l; p_light[l].index = l; p_light[l].p_mesh_data = p_kont; p_light[l].p_next = NULL; p_light[l].p_prev = p_light + p; p_light[p].p_next = p_light + l; p = l; p_next = p_slight->p_next; free(p_slight); p_slight = p_next; } else { ddw("Madrfakr!!!! - Dosly nam svetla!"); } } } } } /* Prevedu dynamicky svetla */ if (p_dlist) { p_dlight = p_kont->p_dlight; if (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_kont; p_dlist[l].p_prev = NULL; p_dlist[l].p_next = NULL; p_kont->p_dlight = p_dlist + l; p = l; p_dnext = p_dlight->p_next; free(p_dlight); p_dlight = p_dnext; while (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_kont; p_dlist[l].p_next = NULL; p_dlist[l].p_prev = p_dlist + p; p_dlist[p].p_next = p_dlist + l; p = l; p_dnext = p_dlight->p_next; free(p_dlight); p_dlight = p_dnext; } else { ddw("Madrfakr!!!! - Dosly nam dyn. svetla!"); } } } } } /* Prevedu extra-dynamicky svetla */ if (p_elist) { p_elight = p_kont->p_edlight; if (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_kont; p_elist[l].p_prev = NULL; p_elist[l].p_next = NULL; p_kont->p_edlight = p_elist + l; p = l; p_enext = p_elight->p_next; free(p_elight); p_elight = p_enext; while (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_kont; p_elist[l].p_next = NULL; p_elist[l].p_prev = p_elist + p; p_elist[p].p_next = p_elist + l; p = l; p_enext = p_elight->p_next; free(p_elight); p_elight = p_enext; } else { ddw("Madrfakr!!!! - Dosly nam extra svetla!"); } } } } } p_kont = p_kont->p_next; } } // skopiruje svetla do sceny a navaze se na nove svetla void lo_kopiruj_svetla_do_sceny(EDIT_KONTEJNER * p_kont, STATIC_LIGHT * p_light, int lightnum, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum, LENS_FLARE * p_flares, int maxflares) { STATIC_LIGHT *p_slight; DYN_LIGHT *p_dlight; EXTRA_DYN_LIGHT *p_elight; int l, p; // Prevedu staticky svetla if (p_light) { p_slight = p_kont->p_slight; if (p_slight) { l = lo_najdi_volne_stat_svetlo(p_light, lightnum); if (l != K_CHYBA) { p_light[l] = *p_slight; if (p_light[l].p_flare) { p_light[l].p_flare = lo_kopiruj_flare(p_flares, maxflares, (LENS_FLARE *) p_light[l].p_flare); ((LENS_FLARE *) (p_light[l].p_flare))->p_svetlo = p_light + l; } p_light[l].index = l; p_light[l].p_mesh_data = p_kont; p_light[l].p_prev = NULL; p_light[l].p_next = NULL; p_kont->p_slight = p_light + l; p = l; p_slight = p_slight->p_next; while (p_slight) { l = lo_najdi_volne_stat_svetlo(p_light, lightnum); if (l != K_CHYBA) { p_light[l] = *p_slight; if (p_light[l].p_flare) { p_light[l].p_flare = lo_kopiruj_flare(p_flares, maxflares, (LENS_FLARE *) p_light[l].p_flare); ((LENS_FLARE *) (p_light[l].p_flare))->p_svetlo = p_light + l; } p_light[l].index = l; p_light[l].p_mesh_data = p_kont; p_light[l].p_next = NULL; p_light[l].p_prev = p_light + p; p_light[p].p_next = p_light + l; p = l; p_slight = p_slight->p_next; } else { ddw("Madrfakr!!!! - Dosly nam svetla!"); } } } } } // Prevedu dynamicky svetla if (p_dlist) { p_dlight = p_kont->p_dlight; if (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_kont; p_dlist[l].p_prev = NULL; p_dlist[l].p_next = NULL; p_kont->p_dlight = p_dlist + l; p = l; p_dlight = p_dlight->p_next; while (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_kont; p_dlist[l].p_next = NULL; p_dlist[l].p_prev = p_dlist + p; p_dlist[p].p_next = p_dlist + l; p = l; p_dlight = p_dlight->p_next; } else { ddw("Madrfakr!!!! - Dosly nam dyn. svetla!"); } } } } } // Prevedu extra svetla if (p_elist) { p_elight = p_kont->p_edlight; if (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_kont; p_elist[l].p_prev = NULL; p_elist[l].p_next = NULL; p_kont->p_edlight = p_elist + l; p = l; p_elight = p_elight->p_next; while (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_kont; p_elist[l].p_next = NULL; p_elist[l].p_prev = p_elist + p; p_elist[p].p_next = p_elist + l; p = l; p_elight = p_elight->p_next; } else { ddw("Madrfakr!!!! - Dosly nam extra svetla!"); } } } } } } // skopiruje svetla do sceny a navaze se na nove svetla void lo_kopiruj_svetla_do_sceny_mesh(GAME_MESH_DATA * p_data, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum) { DYN_LIGHT *p_dlight = NULL; EXTRA_DYN_LIGHT *p_elight; int l, p; /* Prevedu dynamicky svetla */ if (p_dlist) { p_dlight = p_data->p_ldlight; if (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_data; p_dlist[l].p_prev = NULL; p_dlist[l].p_next = NULL; p_data->p_ldlight = p_dlist + l; p = l; p_dlight = p_dlight->p_next; while (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_data; p_dlist[l].p_next = NULL; p_dlist[l].p_prev = p_dlist + p; p_dlist[p].p_next = p_dlist + l; p = l; p_dlight = p_dlight->p_next; } else { ddw("Madrfakr!!!! - Dosly nam dyn. svetla!"); } } } } } /* Prevedu extra svetla */ if (p_elist) { p_elight = p_data->p_lelight; if (p_dlight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_data; p_elist[l].p_prev = NULL; p_elist[l].p_next = NULL; p_data->p_lelight = p_elist + l; p = l; p_elight = p_elight->p_next; while (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_data; p_elist[l].p_next = NULL; p_elist[l].p_prev = p_elist + p; p_elist[p].p_next = p_elist + l; p = l; p_elight = p_elight->p_next; } else { ddw("Madrfakr!!!! - Dosly nam dyn. svetla!"); } } } } } } void lo_preved_svetla_do_sceny_mesh(GAME_MESH_DATA * p_data, DYN_LIGHT * p_dlist, int dlistnum, EXTRA_DYN_LIGHT * p_elist, int elistnum) { DYN_LIGHT *p_dlight, *p_dnext; EXTRA_DYN_LIGHT *p_elight, *p_enext; int l, p; /* Prevedu dynamicky svetla */ if (p_dlist) { p_dlight = p_data->p_ldlight; if (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_data; p_dlist[l].p_prev = NULL; p_dlist[l].p_next = NULL; p_data->p_ldlight = p_dlist + l; p = l; p_dnext = p_dlight->p_next; free(p_dlight); p_dlight = p_dnext; while (p_dlight) { l = lo_najdi_volne_dsvetlo(p_dlist, dlistnum); if (l != K_CHYBA) { p_dlist[l] = *p_dlight; p_dlist[l].index = l; p_dlist[l].p_mesh_data = p_data; p_dlist[l].p_next = NULL; p_dlist[l].p_prev = p_dlist + p; p_dlist[p].p_next = p_dlist + l; p = l; p_dnext = p_dlight->p_next; free(p_dlight); p_dlight = p_dnext; } else { ddw("Madrfakr!!!! - Dosly nam dyn. svetla!"); } } } } } /* Prevedu dynamicky svetla */ if (p_elist) { p_elight = p_data->p_lelight; if (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_data; p_elist[l].p_prev = NULL; p_elist[l].p_next = NULL; p_data->p_lelight = p_elist + l; p = l; p_enext = p_elight->p_next; free(p_elight); p_elight = p_enext; while (p_elight) { l = lo_najdi_volne_extra_svetlo(p_elist, elistnum); if (l != K_CHYBA) { p_elist[l] = *p_elight; p_elist[l].index = l; p_elist[l].p_mesh_data = p_data; p_elist[l].p_next = NULL; p_elist[l].p_prev = p_elist + p; p_elist[p].p_next = p_elist + l; p = l; p_enext = p_elight->p_next; free(p_elight); p_elight = p_enext; } else { ddw("Madrfakr!!!! - Dosly nam dyn. svetla!"); } } } } } } void lo_vymaz_svetla_ze_sceny(EDIT_KONTEJNER * p_kont) { STATIC_LIGHT *p_slight = p_kont->p_slight, *p_snext; DYN_LIGHT *p_dlight = p_kont->p_dlight, *p_dnext; EXTRA_DYN_LIGHT *p_elight = p_kont->p_edlight, *p_enext; while (p_slight) { p_snext = p_slight->p_next; memset((void *) p_slight, 0, sizeof(p_slight[0])); p_slight = p_snext; } while (p_dlight) { p_dnext = p_dlight->p_next; memset((void *) p_dlight, 0, sizeof(p_dlight[0])); p_dlight = p_dnext; } while (p_elight) { p_enext = p_elight->p_next; memset((void *) p_elight, 0, sizeof(p_elight[0])); p_elight = p_enext; } } void lo_vymaz_svetla(EDIT_KONTEJNER * p_kont) { STATIC_LIGHT *p_slight = p_kont->p_slight, *p_snext; DYN_LIGHT *p_dlight = p_kont->p_dlight, *p_dnext; EXTRA_DYN_LIGHT *p_elight = p_kont->p_edlight, *p_enext; while (p_slight) { p_snext = p_slight->p_next; free(p_slight); p_slight = p_snext; } while (p_dlight) { p_dnext = p_dlight->p_next; free(p_dlight); p_dlight = p_dnext; } while (p_elight) { p_enext = p_elight->p_next; free(p_elight); p_elight = p_enext; } } void lo_vymaz_svetla_ze_sceny_mesh(GAME_MESH_DATA * p_data) { DYN_LIGHT *p_dlight = p_data->p_ldlight, *p_dnext; EXTRA_DYN_LIGHT *p_elight = p_data->p_lelight, *p_enext; while (p_dlight) { p_dnext = p_dlight->p_next; memset((void *) p_dlight, 0, sizeof(p_dlight[0])); p_dlight = p_dnext; } while (p_elight) { p_enext = p_elight->p_next; memset((void *) p_elight, 0, sizeof(p_elight[0])); p_elight = p_enext; } } void lo_vymaz_svetla_mesh(GAME_MESH_DATA * p_data) { DYN_LIGHT *p_dlight = p_data->p_ldlight, *p_dnext; EXTRA_DYN_LIGHT *p_elight = p_data->p_lelight, *p_enext; while (p_dlight) { p_dnext = p_dlight->p_next; free(p_dlight); p_dlight = p_dnext; } while (p_elight) { p_enext = p_elight->p_next; free(p_elight); p_elight = p_enext; } } void lo_premapuj_svetla_kont_mesh(EDIT_KONTEJNER * p_src, GAME_MESH_OLD * p_dest) { STATIC_LIGHT *p_slight = p_src->p_slight; DYN_LIGHT *p_dlight = p_src->p_dlight; EXTRA_DYN_LIGHT *p_elight = p_src->p_edlight; if (!p_src || !p_dest) return; while (p_slight) { p_slight->p_mesh_data = p_dest->p_data; p_slight = p_slight->p_next; } p_dest->p_data->p_lslight = p_src->p_slight; p_src->p_slight = NULL; while (p_dlight) { p_dlight->p_mesh_data = p_dest->p_data; p_dlight = p_dlight->p_next; } p_dest->p_data->p_ldlight = p_src->p_dlight; p_src->p_dlight = NULL; while (p_elight) { p_elight->p_mesh_data = p_dest->p_data; p_elight = p_elight->p_next; } p_dest->p_data->p_lelight = p_src->p_edlight; p_src->p_edlight = NULL; } void lo_premapuj_svetla_mesh(GAME_MESH_OLD * p_src, GAME_MESH_OLD * p_dest) { STATIC_LIGHT *p_slight = p_src->p_data->p_lslight; DYN_LIGHT *p_dlight = p_src->p_data->p_ldlight; EXTRA_DYN_LIGHT *p_elight = p_src->p_data->p_lelight; if (!p_src || !p_dest) return; while (p_slight) { p_slight->p_mesh_data = p_dest->p_data; p_slight = p_slight->p_next; } p_dest->p_data->p_lslight = p_src->p_data->p_lslight; p_src->p_data->p_lslight = NULL; while (p_dlight) { p_dlight->p_mesh_data = p_dest->p_data; p_dlight = p_dlight->p_next; } p_dest->p_data->p_ldlight = p_src->p_data->p_ldlight; p_src->p_data->p_ldlight = NULL; while (p_elight) { p_elight->p_mesh_data = p_dest->p_data; p_elight = p_elight->p_next; } p_dest->p_data->p_lelight = p_src->p_data->p_lelight; p_src->p_data->p_lelight = NULL; } void lo_transformuj_svetla_do_wordspace(EDIT_KONTEJNER * p_src) { STATIC_LIGHT *p_slight = p_src->p_slight; DYN_LIGHT *p_dlight = p_src->p_dlight; EXTRA_DYN_LIGHT *p_elight = p_src->p_edlight; GLMATRIX *p_top = kont_world_matrix(p_src); if (!p_src) return; while (p_slight) { transformuj_bod_bod_matici(&p_slight->p, p_top); p_slight = p_slight->p_next; } while (p_dlight) { transformuj_bod_bod_matici(&p_dlight->np, p_top); p_dlight->tp = p_dlight->np; p_dlight = p_dlight->p_next; } while (p_elight) { transformuj_bod_bod_matici(&p_elight->np, p_top); p_elight->tp = p_elight->np; p_elight = p_elight->p_next; } } void lo_premapuj_svetla_do_wordspace(EDIT_KONTEJNER * p_src) { if (!p_src) return; STATIC_LIGHT *p_slight = p_src->p_slight; DYN_LIGHT *p_dlight = p_src->p_dlight; EXTRA_DYN_LIGHT *p_elight = p_src->p_edlight; kont_world_matrix(p_src); lo_transformuj_svetla_do_wordspace(p_src); while (p_slight) { if (p_slight->p_flare) { ((LENS_FLARE *) (p_slight->p_flare))->p = p_slight->p; ((LENS_FLARE *) (p_slight->p_flare))->p_svetlo = NULL; } p_slight->p_mesh_data = NULL; p_slight->flag2 &= ~SL2_MESH; p_slight = p_slight->p_next; } p_src->p_slight = NULL; while (p_dlight) { p_dlight->p_mesh_data = NULL; p_dlight->flag &= ~SDL_MESH; p_dlight = p_dlight->p_next; } p_src->p_dlight = NULL; while (p_elight) { p_elight->p_mesh_data = NULL; p_elight->flag &= ~SDL_MESH; p_elight = p_elight->p_next; } p_src->p_edlight = NULL; } LENS_FLARE *lo_kopiruj_flare(LENS_FLARE * p_flarelist, int max, LENS_FLARE * p_flare) { int f = lo_najdi_volny_flare(p_flarelist, max); p_flarelist[f] = *p_flare; if (p_flare->p_sloz) { p_flarelist[f].p_sloz = (LENS_FLARE_SLOZ *) mmalloc(sizeof(p_flarelist[f].p_sloz[0]) * SLOZ_FLARE); memcpy(p_flarelist[f].p_sloz, p_flare->p_sloz, sizeof(p_flarelist[f].p_sloz[0]) * SLOZ_FLARE); } p_flarelist[f].index = f; return (p_flarelist + f); } void mesh_pridej_vertex_array(GAME_MESH_OLD * p_mesh) { int flag, m2flag = p_mesh->p_data->m2flag; if (gl_ext::extlist_vertex_array) { mesh_vertex_array_init(p_mesh); flag = KONT2_UPDATE_POS | KONT2_UPDATE_NORM; if (m2flag & MAT2_DIFFUSE) flag |= KONT2_UPDATE_DIFF; if (m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC)) flag |= KONT2_UPDATE_SPEC; if (m2flag & MAT2_MAP1) flag |= KONT2_UPDATE_TEXT1; if (m2flag & MAT2_MAP2) flag |= KONT2_UPDATE_TEXT2; if (m2flag & MAT2_MAP3) flag |= KONT2_UPDATE_TEXT3; if (m2flag & MAT2_MAP4) flag |= KONT2_UPDATE_TEXT4; p_mesh->p_data->k2flag |= flag | KONT2_UPDATE_NEW; mesh_vertex_array_upload(p_mesh); } } void poly_pridej_vertex_array(EDIT_MESH_POLY * p_poly) { memset(&p_poly->varray, 0, sizeof(p_poly->varray)); poly_vertex_array_init(p_poly); poly_vertex_array_upload(p_poly); } berusky2-0.12/src/komat/Texture_import.h0000644000175000017500000000014013674426075015241 00000000000000/* Import textur */ //int txt_dds_to_bmp(APAK_HANDLE * pHandle, char *p_file, void **p_return); berusky2-0.12/src/komat/Berusky3d_kofola_interface.cpp0000644000175000017500000010735713674426075020012 00000000000000/* Kofolovo rozhrani - C */ #include #include #include #include "3d_all.h" #include "Object.h" #include "Setup.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_light.h" #include "Berusky3d_animace.h" #include "Berusky3d_kamery.h" #include "Berusky3d_castice2.h" #include "Berusky3d_kofola_interface.h" extern G_KONFIG ber, *p_ber; float kom_load_progres; // aktualni tick // For restoring mirror effects. int zrc_akt; int *p_poly_indices; struct poly_save_data { dword kflag, m1flag; int alfa_state; } *p_poly_data; unsigned int n_poly_indices, n_poly_data; /* Load levelu */ void kom_init_level(LEVEL_HEADER * p_head) // level header { ber_zrus_level(p_ber); ber_vyrob_level(p_ber, p_head->x, p_head->y, p_head->z); p_ber->x_start = finite(p_head->x_start) ? p_head->x_start : 0.0f; p_ber->y_start = finite(p_head->y_start) ? p_head->y_start : 0.0f; p_ber->z_start = finite(p_head->z_start) ? p_head->z_start : 0.0f; p_ber->level_min.x = p_ber->x_start; p_ber->level_min.y = p_ber->y_start; p_ber->level_min.z = p_ber->z_start; p_ber->level_max.x = p_ber->x_start + p_head->x * X_PRVEK; p_ber->level_max.y = p_ber->y_start + p_head->y * Y_PRVEK; p_ber->level_max.z = p_ber->z_start + p_head->z * Z_PRVEK; p_ber->hitnum = p_head->x * p_head->y * p_head->z; p_ber->p_hit_list = (int *) mmalloc(sizeof(p_ber->p_hit_list[0]) * p_ber->hitnum); p_ber->frame = 0; } /* Vraci handle meshe - vola kofola */ MeshHandle kom_pridej_prvek_levelu(BUNKA_LEVELU_DISK * p_bunka, int x, int y, int z) { MeshHandle handle = K_CHYBA; int mesh; ber_prvek_disk_do_bunky(p_ber, p_bunka, &handle, TRUE, x, y, z); mesh = p_ber->p_prv_lev[handle]->mesh; if (!p_ber->p_prv_lev[handle]->staticky && (mesh == K_CHYBA || !p_ber->p_mesh[mesh])) { kprintf(TRUE, "---- Error loading mesh number %d", mesh); } return (handle); } /* Loadne prvek levelu z disku */ MeshHandle kom_pridej_prvek_levelu_disk(char *p_file, BUNKA_LEVELU_DISK * p_bunka, int x, int y, int z) { MeshHandle handle = K_CHYBA; int mesh; int l; l = lo_najdi_volny_mesh(p_ber->p_mesh, MAX_BERUSKY_KONTEJNERU); if (l == K_CHYBA) return (K_CHYBA); if (!ber_nahraj_mesh(p_ber, p_file, p_ber->p_mesh + l)) return (K_CHYBA); if (l >= p_ber->meshnum) p_ber->meshnum = l + 1; p_bunka->mesh = l; ber_prvek_disk_do_bunky(p_ber, p_bunka, &handle, TRUE, x, y, z); mesh = p_ber->p_prv_lev[handle]->mesh; if (!p_ber->p_prv_lev[handle]->staticky && (mesh == K_CHYBA || !p_ber->p_mesh[mesh])) { kprintf(TRUE, "---- Error loading mesh number %d", mesh); } else { ber_dynamic_mesh_list_vloz_mesh(p_ber, mesh); } return (handle); } /* Pridani meshe do levelu */ MeshHandle kom_pridej_mesh_do_levelu(char *p_jmeno) { int handle = K_CHYBA, kont; kont = kom_najdi_mesh(p_jmeno); if (kont == K_CHYBA || !p_ber->p_mesh[kont]) return (K_CHYBA); else { ber_mesh_do_bunky(p_ber, kont, &handle); return (handle); } } /* Nastavi pivot point meshe (0,0,0) je default */ int kom_mesh_set_pivot(MeshHandle prvek_handle, float x, float y, float z) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; if (p_prv) { GLMATRIX m; memcpy(&m, &p_ber->p_mesh[p_prv->mesh]->m, sizeof(m)); m._41 = m._42 = m._43 = 0.0f; transformuj_bod_matici(&x, &y, &z, &m); p_prv->pivot.x = x; p_prv->pivot.y = y; p_prv->pivot.z = z; return (prvek_handle); } else { return (K_CHYBA); } } /* Cte pivot meshe */ int kom_mesh_get_pivot(MeshHandle prvek_handle, BOD * p_pivot) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; if (p_prv) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_prv->mesh]; *p_pivot = p_mesh->kofola_pivot; return (TRUE); } else { return (FALSE); } } /* Nastavi pivot point pomoci bodu */ int kom_mesh_set_pivot_bod(MeshHandle prvek_handle, BOD * p_bod) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; if (p_prv) { BOD p = *p_bod; GLMATRIX m; memcpy(&m, &p_ber->p_mesh[p_prv->mesh]->m, sizeof(m)); m._41 = m._42 = m._43 = 0.0f; transformuj_bod_matici(&p.x, &p.y, &p.z, &m); p_prv->pivot = p; return (prvek_handle); } else { return (K_CHYBA); } } /* resetuje matici rotace meshe + prepocita mesh na urcenou pozici (ten na teto pozici musi byt, jinak bude spatne umisteny) */ int kom_mesh_reset_pr(MeshHandle prvek_handle, int x, int y, int z, int rotace) { if (p_ber->p_prv_lev[prvek_handle]) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_prv->mesh]; GLMATRIX m1, m2, m3; if(invert_matrix(ber_position_matrix(p_ber, &m1, x, y, z, rotace), &m2)) { mat_mult(&p_mesh->m, &m2, &m3); transformuj_mesh_matici(p_mesh, &m3); memcpy(&p_mesh->m, &m1, sizeof(GLMATRIX)); memcpy(&p_prv->mp, &m1, sizeof(GLMATRIX)); ber_position_level(p_prv, &m1, rotace); } return (prvek_handle); } else { return (K_CHYBA); } } /* Nastavi flag meshe ze se nema testovat kolize s timto meshem */ int kom_mesh_set_no_test(MeshHandle prvek_handle) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; GAME_MESH_OLD *p_mesh; if (p_prv && p_prv->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_prv->mesh]; p_mesh->p_data->kflag |= KONT_DRAW_NOBALKA; return (prvek_handle); } else { return (K_CHYBA); } } /* Nacte mesh - cislo pro ukladani */ int kom_mesh_get_save_num(MeshHandle prvek_handle) { if (p_ber->p_prv_lev[prvek_handle]) { return (p_ber->p_prv_lev[prvek_handle]->mesh); } else { return (K_CHYBA); } } /* Nacte mesh - fyzickou pozici */ int kom_mesh_get_float(MeshHandle prvek_handle, float *p_x, float *p_y, float *p_z, int *p_rotace) { if (p_ber->p_prv_lev[prvek_handle]) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; *p_x = p_prv->x; *p_y = p_prv->y; *p_z = p_prv->z; *p_rotace = p_prv->rotace; return (prvek_handle); } else { return (K_CHYBA); } } /* Nacte mesh - logickou pozici */ int kom_mesh_get_int(MeshHandle prvek_handle, int *p_x, int *p_y, int *p_z, int *p_rotace) { if (p_ber->p_prv_lev[prvek_handle]) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; *p_x = ftoi((p_prv->x - p_ber->x_start - X_PRVEK / 2) / X_PRVEK); *p_y = ftoi((p_prv->y * 2.0f - p_ber->y_start - Y_PRVEK / 2) / Y_PRVEK); *p_z = ftoi((p_prv->z - p_ber->z_start - Z_PRVEK / 2) / Z_PRVEK); *p_rotace = p_prv->rotace; return (prvek_handle); } else { return (K_CHYBA); } } /* Prida prvek do databaze */ DataHandle kom_pridej_prvek_do_databaze(SECONDDATADESC * p_sec) { int handle; if (p_ber->mdatanum >= MAX_BERUSKY_DATABAZE) return (K_CHYBA); else handle = p_ber->mdatanum++; ber_nahraj_mesh(p_ber, p_sec->File_Name[0], p_ber->p_mdata + handle); return (handle); } MeshHandle kom_vloz_prvek_z_databaze(DataHandle data_handle, int x, int y, int z, int rotace, int guid) { GAME_MESH_DATA *p_data; BUNKA_LEVELU_DISK disk; MeshHandle handle = K_CHYBA; int m; m = disk.mesh = lo_najdi_volny_mesh(p_ber->p_mesh, MAX_BERUSKY_KONTEJNERU); if (m == K_CHYBA) return (K_CHYBA); if (m >= p_ber->meshnum) p_ber->meshnum = m + 1; assert(p_ber->p_mdata[data_handle]); // source ok? p_ber->p_mesh[m] = kopiruj_mesh(p_ber->p_mdata[data_handle], NULL); assert(p_ber->p_mesh[m]); // dest ok? ber_dynamic_mesh_list_vloz_mesh(p_ber, m); p_data = p_ber->p_mesh[m]->p_data; lo_kopiruj_svetla_do_sceny_mesh(p_data, p_ber->p_dlight, MAX_FLARE_SVETEL, p_ber->p_edlight, MAX_FLARE_SVETEL); if (p_data->p_ldlight) p_ber->dl_lightnum = lo_najdi_prepocitej_dsvetlo(p_ber->p_dlight, MAX_FLARE_SVETEL); if (p_data->p_lelight) p_ber->edl_lightnum = lo_najdi_prepocitej_extra_svetlo(p_ber->p_edlight, MAX_FLARE_SVETEL); disk.guid = guid; disk.Rotace = rotace; disk.Vazba1 = disk.Vazba2 = 0; ber_prvek_disk_do_bunky(p_ber, &disk, &handle, FALSE, x, y, z); ber_umisti_prvek(handle, x, y, z, rotace); return (handle); } void kom_zrus_level(int restart) { int i; kprintf(TRUE, "Kom_zrus_level - start..."); /* Zrusi casticovy systemy */ { PARMETAC *p_par = p_ber->p_par; PARMETAC *p_next; while (p_par) { p_next = p_par->p_next; par_zrus_end(p_par); p_par = p_next; } } p_ber->p_par = NULL; kprintf(TRUE, "Kom_zrus_level - level..."); /* Zrus level */ for (i = 0; i < MAX_PRVKU_LEVEL; i++) { if (p_ber->p_prv_lev[i]) { free(p_ber->p_prv_lev[i]); p_ber->p_prv_lev[i] = NULL; } } p_ber->prvnum = 0; memset(p_ber->p_prv_lev, 0, sizeof(p_ber->p_prv_lev[0]) * MAX_PRVKU_LEVEL); kprintf(TRUE, "Kom_zrus_level - poly..."); /* Zrus poly */ if (p_ber->p_poly) { for (i = 0; i < p_ber->polynum; i++) { zrus_vnitrek_poly(p_ber->p_poly + i); } free(p_ber->p_poly); p_ber->p_poly = NULL; } if (zrc_akt) { zrc_akt = FALSE; free(p_poly_indices); free(p_poly_data); } kprintf(TRUE, "Kom_zrus_level - mesh..."); /* Zrus meshe */ for (i = 0; i < p_ber->meshnum; i++) { if (p_ber->p_mesh[i]) zrus_mesh(p_ber->p_mesh + i); } kprintf(TRUE, "Kom_zrus_level - databaze..."); /* Zrus meshe v databazi */ for (i = 0; i < MAX_BERUSKY_DATABAZE; i++) { if (p_ber->p_mdata[i]) { lo_vymaz_svetla_mesh(p_ber->p_mdata[i]->p_data); zrus_mesh(p_ber->p_mdata + i); } } kprintf(TRUE, "Kom_zrus_level - materialy..."); /* Zrus materiay + smaterial */ for (i = 0; i < MAX_CELKEM_MATERIALU; i++) { if (p_ber->p_mat[i]) zrus_material(p_ber->p_mat + i); } p_ber->p_smat = NULL; if (!restart) { kprintf(TRUE, "Kom_zrus_level - textury..."); /* Zrus textury */ lo_smaz_textury(p_ber->p_text, MAX_CELKEM_TEXTUR); memset(p_ber->p_text, 0, sizeof(p_ber->p_text[0]) * MAX_CELKEM_TEXTUR); } kprintf(TRUE, "Kom_zrus_level - lightmapy..."); /* Zrus lightmapy */ for (i = 0; i < MAX_RAY_TEXTUR; i++) { if (p_ber->p_lightmap[i].load) { txt_zrus_lightmapu(p_ber->p_lightmap + i); } } memset(p_ber->p_lightmap, 0, sizeof(p_ber->p_lightmap[0]) * MAX_CELKEM_TEXTUR); kprintf(TRUE, "Kom_zrus_level - mlho-kostky..."); /* Zrus mlho-kostky */ p_ber->p_mlha = zrus_mlhokostku_all(p_ber->p_mlha); p_ber->p_mlha = p_ber->p_mlha_akt = NULL; kprintf(TRUE, "Kom_zrus_level - fleky..."); /* Zrus fleky */ zrus_fleky(&p_ber->p_fleky); zrus_fleky(&p_ber->p_fleky_mesh); kprintf(TRUE, "Kom_zrus_level - flare..."); /* Zrus flare */ zrus_flare(&p_ber->p_flare); kprintf(TRUE, "Kom_zrus_level - voda..."); /* Zrusi vodu */ vod_zrus(&p_ber->p_voda); kprintf(TRUE, "Kom_zrus_level - animace textur..."); /* Zrusi vsechny koordinatovy animace textur */ tani_zrus(&p_ber->p_textanim); kprintf(TRUE, "Kom_zrus_level - animace kamer..."); /* Animace kamer */ for (i = 0; i < KAM_MAX_ANIM; i++) { key_kamera_zrus_indir(p_ber->kamery + i); } memset(p_ber->kamery, 0, sizeof(p_ber->kamery[0]) * KAM_MAX_ANIM); p_ber->kamnum = 0; kprintf(TRUE, "Kom_zrus_level - stat svetla..."); /* Zrusi staticky svetla int slightnum; STATIC_LIGHT p_slight[MAX_FLARE_SVETEL]; */ p_ber->slightnum = 0; memset((void *) p_ber->p_slight, 0, sizeof(p_ber->p_slight[0]) * MAX_FLARE_SVETEL); kprintf(TRUE, "Kom_zrus_level - dyn svetla..."); /* Zrusi dynamicky svetla */ for (i = 0; i < MAX_FLARE_SVETEL; i++) { if (p_ber->p_dlight[i].akt) { sdla_animaci_zrus_online(&p_ber->p_dlight[i].an); } } memset((void *) p_ber->p_dlight, 0, sizeof(p_ber->p_dlight[0]) * MAX_FLARE_SVETEL); kprintf(TRUE, "Kom_zrus_level - extra-dyn svetla..."); /* Extra-dynamicky svetla */ for (i = 0; i < MAX_FLARE_SVETEL; i++) { if (p_ber->p_edlight[i].akt) { sdla_animaci_zrus_online(&p_ber->p_edlight[i].an); } } memset((void *) p_ber->p_edlight, 0, sizeof(p_ber->p_edlight[0]) * MAX_FLARE_SVETEL); kprintf(TRUE, "Kom_zrus_level - sim-animaci..."); /* Zruseni zbyvajicich sim/track animaci */ for (i = 0; i < MAX_SIM_ANIMACI; i++) { if (p_ber->p_sim[i].keynum) { key_sim_zrus_vnitrek(p_ber->p_sim + i); } if (p_ber->p_track[i].endtime) { zrus_tri_vnitrek(p_ber->p_track + i); } } memset((void *) p_ber->p_sim, 0, sizeof(p_ber->p_sim[0]) * MAX_SIM_ANIMACI); memset((void *) p_ber->p_track, 0, sizeof(p_ber->p_track[0]) * MAX_SIM_ANIMACI); kprintf(TRUE, "Kom_zrus_level - hit-list..."); /* Zruseni hit-listu */ free(p_ber->p_hit_list); p_ber->p_hit_list = NULL; p_ber->hitnum = FALSE; kprintf(TRUE, "Kom_zrus_level - zrcadla..."); /* Smaz zrcadla pokud jsou */ { ZDRCADLO_DESC_POLY *p_poly = p_ber->zrc.p_poly, *p_tmp; while (p_poly) { p_tmp = p_poly->p_next; free(p_poly); p_poly = p_tmp; } p_ber->zrc_akt = FALSE; memset((void *) &p_ber->zrc, 0, sizeof(p_ber->zrc)); } kprintf(TRUE, "Kom_zrus_level - obb a renderlist..."); /* Smaze obalky + poly render list */ obbtree_zrus(&p_ber->obbtree); memset((void *) &p_ber->obbtree, 0, sizeof(p_ber->obbtree)); ber_poly_render_list_zrus(p_ber); memset(p_ber->p_dyn_meshlist, 0, sizeof(p_ber->p_dyn_meshlist[0]) * MAX_BERUSKY_KONTEJNERU); memset(p_ber->p_mesh_renderlist, 0, sizeof(p_ber->p_mesh_renderlist[0]) * MAX_BERUSKY_KONTEJNERU); kprintf(TRUE, "Kom_zrus_level - fronta animaci..."); /* Smazu frontu animaci */ memset(p_ber->p_lokal, 0, sizeof(p_ber->p_lokal[0]) * MAX_RUN_ANIMACI); p_ber->lokalnum = 0; kprintf(TRUE, "Kom_zrus_level - anim materialu..."); /* Animace materialu */ memset(&p_ber->p_man, 0, sizeof(p_ber->p_man[0]) * MAX_MAT_ANIMACI); // materialove animace p_ber->mannum = 0; kprintf(TRUE, "Kom_zrus_level - gkanimace..."); /* Animace vseho */ p_ber->p_gkanim = NULL; p_ber->gknum = 0; memset((void *) p_ber->p_gkzas, 0, sizeof(p_ber->p_gkzas[0]) * MAX_RUN_ANIMACI); kprintf(TRUE, "Kom_zrus_level - animace chapadel..."); /* Animace chapadel */ chani_zrus_all(p_ber); kprintf(TRUE, "Kom_zrus_level - kofolovy cary..."); /* Kofolovy cary - ven */ p_ber->p_cary = NULL; p_ber->mail = 0; /* Vymaznu vse co tady mam */ p_ber->x_num = p_ber->y_num = p_ber->z_num = 0; p_ber->dyn_meshlistnum = 0; p_ber->mesh_renderakt = 0; p_ber->mesh_rendernum = 0; p_ber->meshnum = 0; p_ber->polynum = 0; p_ber->anim_mail = 0; p_ber->simnum = 0; p_ber->dl_recalc = p_ber->dl_new = p_ber->dl_lightnum = p_ber->dl_on = 0; kprintf(TRUE, "Kom_zrus_level - all done..."); } /* Vypne zrcadlo pokud je zrcadlo vypnute - vypni zrcadlo */ int ber_test_zrcadla(void) { ZDRCADLO_DESC_POLY *p_poly = p_ber->zrc.p_poly; int mat; unsigned int i, j; // If `zrc_akt' is TRUE, we've already disabled mirror effects. if (zrc_akt && !setup.mirror_effects) return (TRUE); // Ma se vypnout zrcadlo if (p_ber->zrc_akt && !setup.mirror_effects) { zrc_akt = TRUE; p_ber->zrc_akt = FALSE; // Prepare for saving the old data to restore mirror effects // later. n_poly_indices = n_poly_data = 0; while (p_poly) { n_poly_indices++; if (p_poly->poly != K_CHYBA && p_ber->polynum > p_poly->poly) n_poly_data++; p_poly = p_poly->p_next; } p_poly = p_ber->zrc.p_poly; p_poly_indices = (int *) mmalloc(sizeof(*p_poly_indices) * n_poly_indices); p_poly_data = (struct poly_save_data *) mmalloc(sizeof(*p_poly_data) * n_poly_data); for (i = j = 0; p_poly; i++) { // Save the index for later restoring of mirror effects. assert(i < n_poly_indices); p_poly_indices[i] = p_poly->poly; if (p_poly->poly != K_CHYBA && p_ber->polynum > p_poly->poly) { // Save the flags. assert(j < n_poly_data); p_poly_data[j].kflag = p_ber->p_poly[p_poly->poly].kflag & KONT_ZRCADLO; p_poly_data[j].m1flag = p_ber->p_poly[p_poly->poly].m1flag & MAT_PRUHLEDNY; p_ber->p_poly[p_poly->poly].kflag &= ~KONT_ZRCADLO; p_ber->p_poly[p_poly->poly].m1flag &= ~MAT_PRUHLEDNY; mat = p_ber->p_poly[p_poly->poly].material; // Save `alfa_state'. p_poly_data[j].alfa_state = p_ber->p_mat[mat]->alfa_state; p_ber->p_mat[mat]->alfa_state = FALSE; j++; } p_poly->poly = K_CHYBA; p_poly = p_poly->p_next; } assert(i == n_poly_indices); assert(j == n_poly_data); return (TRUE); } else if (zrc_akt) { // Restore mirror effects. p_ber->zrc_akt = TRUE; for (i = j = 0; i < n_poly_indices; i++) { assert(p_poly); p_poly->poly = p_poly_indices[i]; if (p_poly->poly != K_CHYBA && p_ber->polynum > p_poly->poly) { assert(j < n_poly_data); p_ber->p_poly[p_poly->poly].kflag |= p_poly_data[j].kflag; p_ber->p_poly[p_poly->poly].m1flag |= p_poly_data[j].m1flag; mat = p_ber->p_poly[p_poly->poly].material; p_ber->p_mat[mat]->alfa_state = p_poly_data[j].alfa_state; j++; } p_poly = p_poly->p_next; } assert(i == n_poly_indices); assert(j == n_poly_data); // Clean up. zrc_akt = FALSE; free(p_poly_indices); free(p_poly_data); // Make sure all reflections are updated. p_ber->kamera.zmena = TRUE; } return (FALSE); } void kom_load_sys_material(int i) { char file[200]; char pom[200]; sprintf(pom, "system_material_%d", i); GetPrivateProfileString("files", pom, "", file, 200, ini_file); if (file[0]) { kprintf(1, "Load system materials '%s' from %s....", pom, file); if (!ber_nahraj_materialy(p_ber, file, p_ber->dir.material_dir)) kprintf(1, "---- Fail load file %s....", file); } } void kom_posun_slider(void) { if (p_ber->conf_load_tik < p_ber->conf_load_tiku && p_ber->p_tik_fce) { p_ber->p_tik_fce(); p_ber->conf_load_tik += p_ber->conf_load_krok; } } int ber_vyber_berusky(BUNKA_LEVELU_DISK * p_disk, int num, BUNKA_LEVELU_DISK * p_berusky) { int i, berusek = 0; for (i = 0; i < num; i++, p_disk++) { if (ber_je_objekt_beruska(p_disk->guid)) { *p_berusky++ = *p_disk; berusek++; } } if (berusek > 5) { kprintfe(TRUE, "Too many bugs in the level!!! Bugs number %d", berusek); } return (berusek); } // chdir - TRUE - nastavit adresar void kom_load_level(char *p_file, int zmen_dir, int restart, BUNKA_LEVELU_DISK * p_bunka, int bunek) { BUNKA_LEVELU_DISK berusky[5]; int berusek; GAME_MESH_OLD **p_slist; int snum; char dir[200]; char file[200]; int vel1, vel2, vel3, vel4, ret, i, facu, vertexu; int *p_ind; dword time; berusek = ber_vyber_berusky(p_bunka, bunek, berusky); kprintf(1, "Loading level '%s'", p_file); kom_posun_slider(); // Load systemovych materialu if (getcwd(dir, 200) == NULL) konec(TRUE); for (i = 0; i < 10; i++) kom_load_sys_material(i); if (zmen_dir) { if (chdir(p_ber->dir.game_level_dir)) konec(TRUE); strcpy(dir, p_file); zamen_koncovku(dir, ""); } if (chdir(dir) || getcwd(dir, 200) == NULL) konec(TRUE); strcpy(file, p_file); kom_posun_slider(); kprintf(1, "Level directory '%s'", dir); // leveldir+jmenobez koncovky // jmeno kprintf(1, "Load materials...."); if (!ber_nahraj_materialy(p_ber, file, dir)) { kprintf(TRUE, "Error loading level materials %s from directory %s, stop loading..", file, dir); konec(TRUE); } kom_posun_slider(); time = timeGetTime(); kprintf(1, "Load scene - dynamic items...."); ret = ber_nahraj_scenu(p_ber, file, dir, restart, berusky, berusek); // scena (dynamicke veci) kprintf(TRUE, "Scene load ret %d", ret); if (!ret) { kprintf(TRUE, "Error loading scene %s from directory %s, stop loading...", file, dir); konec(TRUE); } else { ber_dynamic_mesh_list_vyrob(p_ber); } kprintf(TRUE, "Loaded in %dms", timeGetTime() - time); kom_posun_slider(); kprintf(1, "Load scene - static items...."); ber_nahraj_poly(p_ber, file, dir); // poly (staticke veci) kom_posun_slider(); zrc_akt = FALSE; if (ber_test_zrcadla()) kprintf(TRUE, "Mirror off"); else kprintf(TRUE, "Mirror on"); time = timeGetTime(); kprintf(1, "Load scene - static items - OBB Tree..."); p_slist = ber_mesh_vyber_staticke(p_ber, &snum, &p_ind); obbtree_vyrob(&p_ber->obbtree, p_ber->p_poly, p_ber->polynum, p_slist, snum, p_ind, p_ber->p_mat); null_free((void **) &p_slist); null_free((void **) &p_ind); kprintf(TRUE, "time %d", timeGetTime() - time); kom_posun_slider(); kprintf(1, "Load scene - lightmaps...."); ber_nahraj_lightmap(p_ber, file, dir); time = timeGetTime(); if (!restart) { int bump = hwconf.bump_mapping && p_ber->conf_dyn_light && p_ber->conf_dyn_rychlost == LIGHT_ALL; lo_reload_textur(&p_ber->tdir, p_ber->p_text, MAX_CELKEM_TEXTUR, bump); kom_posun_slider(); if (bump) { ber_uprava_materialu_bump_mapping(p_ber); lo_reload_textur(&p_ber->tdir, p_ber->p_text, MAX_CELKEM_TEXTUR, FALSE); lo_smaz_textury_bmp(p_ber->p_text, MAX_CELKEM_TEXTUR); } } else { lo_reload_textur(&p_ber->tdir, p_ber->p_text, MAX_CELKEM_TEXTUR, FALSE); } lo_reload_stage(p_ber->p_mat, MAX_CELKEM_MATERIALU); kprintf(TRUE, "time %d", timeGetTime() - time); kom_posun_slider(); kprintf(1, "Static lights %d", p_ber->slightnum); vel1 = (lo_velikost_textur(p_ber->p_text, MAX_CELKEM_TEXTUR)) / 8000; vel2 = (lo_velikost_textur(p_ber->p_lightmap, MAX_RAY_TEXTUR)) / 8000; facu = 0; vertexu = 0; vel3 = lo_velikost_meshu(p_ber->p_mesh, p_ber->meshnum, &facu, &vertexu) / 1000; vel4 = lo_velikost_poly(p_ber->p_poly, p_ber->polynum, &facu, &vertexu) / 1000; kprintf(1, "Size of mesh vert. %d KB", vel3); kprintf(1, "Size of poly vert. %d KB", vel4); kprintf(1, "Size of textures %d KB", vel1); kprintf(1, "Size of lightmaps %d KB", vel2); kprintf(1, "Size of all %d KB", vel1 + vel2); kprintf(1, "Vertex-num %d", vertexu); kprintf(1, "Face-num %d", facu); ber_velikost_sceny(p_ber); kom_posun_slider(); } void kom_post_init_level(void) { ber_init_level(p_ber); } /* Zruseni meshe */ void kom_zrus_prvek(MeshHandle prvek_handle) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[prvek_handle]; if (p_prv) { int mh = p_prv->mesh; if (mh != K_CHYBA) { GAME_MESH_DATA *p_data = p_ber->p_mesh[mh]->p_data; lo_vymaz_svetla_ze_sceny_mesh(p_data); if (p_data->p_ldlight) p_ber->dl_lightnum = lo_najdi_prepocitej_dsvetlo(p_ber->p_dlight, MAX_FLARE_SVETEL); if (p_data->p_lelight) p_ber->edl_lightnum = lo_najdi_prepocitej_extra_svetlo(p_ber->p_edlight, MAX_FLARE_SVETEL); zrus_mesh(p_ber->p_mesh + mh); } free(p_ber->p_prv_lev[prvek_handle]); p_ber->p_prv_lev[prvek_handle] = NULL; } } float kom_get_framerate(void) { return (p_ber->fps); } void kom_klavesy_hra(void) { ber_klavesy_hra(&ber); } BOD *kom_get_fyz_souradnice(int x, int y, int z, BOD * p_bod) { p_bod->x = (float) (p_ber->x_start + x * X_PRVEK + X_PRVEK / 2); p_bod->y = (float) (p_ber->y_start + (y >> 1) * Y_PRVEK); p_bod->z = (float) (p_ber->z_start + z * Z_PRVEK + Z_PRVEK / 2); return (p_bod); } /* Hledaci funkce */ MatHandle kom_najdi_material(char *p_jmeno) { int i; for (i = 0; i < MAX_CELKEM_MATERIALU; i++) { if (p_ber->p_mat[i] && !strcmp(p_ber->p_mat[i]->jmeno, p_jmeno)) return (i); } return (K_CHYBA); } EDIT_MATERIAL *kom_preloz_material(MatHandle mh) { return (p_ber->p_mat[mh]); } MeshHandle kom_najdi_mesh_prvek(char *p_jmeno) { PRVEK_LEVELU_GAME *p_prv; int i; for (i = 0; i < p_ber->prvnum; i++) { if ((p_prv = p_ber->p_prv_lev[i]) && p_prv->mesh != K_CHYBA && !strcmp(p_ber->p_mesh[p_prv->mesh]->jmeno, p_jmeno)) return ((MeshHandle) i); } return (K_CHYBA); } ExMeshHandle kom_najdi_mesh(char *p_jmeno) { int i; for (i = 0; i < p_ber->meshnum; i++) { if (p_ber->p_mesh[i] && !strcmp(p_ber->p_mesh[i]->jmeno, p_jmeno)) return (i); } return (K_CHYBA); } ExMeshHandle kom_najdi_mesh_joint(ExMeshHandle * p_next) { int i; if (*p_next < 0) return (-1); for (i = *p_next; i < p_ber->meshnum; i++) { if (p_ber->p_mesh[i] && p_ber->p_mesh[i]->p_joint_anim) { *p_next = i + 1; return (i); } } *p_next = K_CHYBA; return (K_CHYBA); } /*************************************************** Fleky - flekovac ************************************************** */ #define FLEK_BIAS 2.0f #define FLEK_BIAS_NAS 1.0f void kom_flek_zmen(FlekHandle fh, BOD * p_p, BOD * p_nx, BOD * p_nz, float dx, float dz, int rotace, int uroven, MatHandle material) { FLEK *p_flek = (FLEK *) fh; p_flek->material = material; p_flek->p = *p_p; // Eliminate y-axis fighting p_flek->p.y += 0.02; p_flek->nx.x = p_nx->x * dx; p_flek->nx.y = p_nx->y * dx; p_flek->nx.z = p_nx->z * dx; p_flek->nz.x = p_nz->x * dz; p_flek->nz.y = p_nz->y * dz; p_flek->nz.z = p_nz->z * dz; p_flek->uroven = uroven; p_flek->bias = -(FLEK_BIAS + (float) uroven * FLEK_BIAS_NAS); p_flek->flag = FALSE; if (!rotace) { p_flek->u[0] = 0.0f; p_flek->v[0] = 0.0f; p_flek->u[1] = 1.0f; p_flek->v[1] = 0.0f; p_flek->u[2] = 1.0f; p_flek->v[2] = 1.0f; p_flek->u[3] = 0.0f; p_flek->v[3] = 1.0f; } else if (rotace == 1) { p_flek->u[1] = 0.0f; p_flek->v[1] = 0.0f; p_flek->u[2] = 1.0f; p_flek->v[2] = 0.0f; p_flek->u[3] = 1.0f; p_flek->v[3] = 1.0f; p_flek->u[0] = 0.0f; p_flek->v[0] = 1.0f; } else if (rotace == 2) { p_flek->u[2] = 0.0f; p_flek->v[2] = 0.0f; p_flek->u[3] = 1.0f; p_flek->v[3] = 0.0f; p_flek->u[0] = 1.0f; p_flek->v[0] = 1.0f; p_flek->u[1] = 0.0f; p_flek->v[1] = 1.0f; } else { p_flek->u[3] = 0.0f; p_flek->v[3] = 0.0f; p_flek->u[0] = 1.0f; p_flek->v[0] = 0.0f; p_flek->u[1] = 1.0f; p_flek->v[1] = 1.0f; p_flek->u[2] = 0.0f; p_flek->v[2] = 1.0f; } } void kom_vloz_flek(FLEK ** p_first, FLEK * p_flek) { FLEK *p_tmp = *p_first; FLEK *p_prev = NULL; while (p_tmp) { if (p_tmp->uroven < p_flek->uroven) { p_prev = p_tmp; p_tmp = p_tmp->p_next; } else break; } if (!p_tmp && p_prev) { // insert-last p_flek->p_next = NULL; p_flek->p_prew = p_prev; p_prev->p_next = p_flek; } else if (!p_prev) { // insert-first p_flek->p_next = p_tmp; p_flek->p_prew = NULL; if (p_tmp) p_tmp->p_prew = p_flek; *p_first = p_flek; } else { // insert mezi-kozy - predejdu to o 1 p_flek->p_next = p_prev->p_next; p_flek->p_prew = p_prev; p_prev->p_next = p_flek; if (p_flek->p_next) p_flek->p_next->p_prew = p_flek; } } FlekHandle kom_flek_pridej(MeshHandle mh, BOD * p_p, BOD * p_nx, BOD * p_nz, float dx, float dz, int rotace, int uroven, MatHandle material) { PRVEK_LEVELU_GAME *p_prv; FLEK *p_flek; /* Flek se pripojuje ke scene */ if (mh == K_CHYBA) { p_flek = (FLEK *) mmalloc(sizeof(FLEK)); kom_flek_zmen((FlekHandle) p_flek, p_p, p_nx, p_nz, dx, dz, rotace, uroven, material); p_flek->mesh = K_CHYBA; kom_vloz_flek(&p_ber->p_fleky, p_flek); } /* Flek se pripojuje ke meshi */ else { p_prv = p_ber->p_prv_lev[mh]; if (!p_prv || p_prv->mesh == K_CHYBA) return (K_CHYBA); //GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_prv->mesh]; p_flek = (FLEK *) mmalloc(sizeof(FLEK)); kom_flek_zmen((FlekHandle) p_flek, p_p, p_nx, p_nz, dx, dz, rotace, uroven, material); p_flek->mesh = p_prv->mesh; /* Pripojeni fleku ke scene */ kom_vloz_flek(&p_ber->p_fleky_mesh, p_flek); } return ((FlekHandle) p_flek); } int kom_flek_getflag(FlekHandle fh, int flag) { FLEK *p_flek = (FLEK *) fh; return (p_flek->flag); } int kom_flek_setflag(FlekHandle fh, int flag) { FLEK *p_flek = (FLEK *) fh; return (p_flek->flag = flag); } void kom_flek_zrus(FlekHandle fh) { FLEK *p_flek = (FLEK *) fh; if (p_flek->mesh == K_CHYBA) { /* Ruseni fleku sceny */ if (p_flek->p_next) p_flek->p_next->p_prew = p_flek->p_prew; if (p_flek->p_prew) p_flek->p_prew->p_next = p_flek->p_next; else p_ber->p_fleky = p_flek->p_next; } else { /* Ruseni fleku meshu */ if (p_flek->p_next) p_flek->p_next->p_prew = p_flek->p_prew; if (p_flek->p_prew) p_flek->p_prew->p_next = p_flek->p_next; else p_ber->p_fleky_mesh = p_flek->p_next; } free(p_flek); } /* Nacte pocet materialu v kontejneru */ int kom_mesh_get_matnum(MeshHandle mh) { PRVEK_LEVELU_GAME *p_prv; GAME_MESH_OLD *p_mesh; int i, amat = -1, mat = 0; if ((p_prv = p_ber->p_prv_lev[mh]) && p_prv->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_prv->mesh]; for (i = mat = 0; i < p_mesh->objektu; i++) { if (p_mesh->p_mat[i] != amat) { amat = p_mesh->p_mat[i]; mat++; } } } return (mat); } // Nacte samotne materialy int kom_mesh_get_mat(MeshHandle mh, MatHandle * p_mat) { PRVEK_LEVELU_GAME *p_prv; GAME_MESH_OLD *p_mesh; int i, amat = -1, mat = 0; if ((p_prv = p_ber->p_prv_lev[mh]) && p_prv->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_prv->mesh]; for (i = mat = 0; i < p_mesh->objektu; i++) { if (p_mesh->p_mat[i] != amat) { amat = p_mesh->p_mat[i]; p_mat[mat++] = amat; } } } return (mat); } // Nacte jmeno materialu z materialu char *kom_get_mat_jmeno(MatHandle mh, char *p_buffer, int max_znaku) { if (p_ber->p_mat[mh] && (strlen(p_ber->p_mat[mh]->jmeno) < (dword) max_znaku)) { return (strcpy(p_buffer, p_ber->p_mat[mh]->jmeno)); } else return (NULL); } int kom_je_prvek_staticky(int guid) { return (ber_je_objekt_staticky(guid)); } /* ******************************************************* Nastaveni mlznych kostek */ MLZNA_KOSTKA *kom_mlhokostka_najdi(char *p_jmeno) { MLZNA_KOSTKA *p_top = p_ber->p_mlha; while (p_top) { if (!strcmp(p_top->jmeno, p_jmeno)) return (p_top); } return (NULL); } /* Nastaveni zpruhlednovani prvku */ void kom_zpruhlednovat_prvky(int stav) { p_ber->kamera.zmena = TRUE; p_ber->conf_pruhledna_kamera = stav; if (!stav) ber_zpruhledni_prvky_reset(p_ber); } /* Zmena zpruhlednovani prvku */ void kom_zpruhlednovat_prvky_zmena_berusky(void) { p_ber->kamera.zmena = TRUE; } /* Nastavi linelist */ void kom_set_linelist(KOFOLOVA_CARA * p_list, int pocet) { p_ber->car_a_kouzel = pocet; p_ber->p_cary = p_list; } /* Cte level environment levelu */ LEVEL_ENVIRONMENT *kom_get_level_environment(void) { return (&p_ber->env); } /* Cte level pozici */ void kom_get_level_size(BOD * p_min, BOD * p_max) { *p_min = p_ber->level_min; *p_max = p_ber->level_max; } /* Vrati mesh vybrany kurzorem mysi */ MeshHandle kom_get_mesh_mys(int itrida) { GLMATRIX *p_mat = get_matrix_camera_project(), m; GAME_MESH_OLD *p_mesh; PRVEK_LEVELU_GAME *p_prv; int i, prvnum; float min_t = FLT_MAX; float t; int min_mesh = K_CHYBA; BOD a, b, p, *p_min, *p_max, min, max; glu_invert_matrix(p_mat, &m); transf_2d_3d_matrix((float) mi.x, (float) mi.y, 0.0f, &a.x, &a.y, &a.z, &m, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART); transf_2d_3d_matrix((float) mi.x, (float) mi.y, 0.2f, &b.x, &b.y, &b.z, &m, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART); prvnum = p_ber->prvnum; for (i = 0; i < prvnum; i++) { p_prv = p_ber->p_prv_lev[i]; if (p_prv && p_prv->guid && p_prv->guid / 1000 != itrida) { if (p_prv->mesh != K_CHYBA) { p_mesh = p_ber->p_mesh[p_prv->mesh]; p_min = &p_mesh->obb_world.aabb_min; p_max = &p_mesh->obb_world.aabb_max; } else { kd_bunka_expanze3(p_prv->x, p_prv->y, p_prv->z, X_PRVEK2, Y_PRVEK2, Z_PRVEK2, &min, &max); p_min = &min; p_max = &max; } if (kd_intersect_kostku_bod(&a, &b, p_min, p_max, &p, &t)) { t = vzdal_bodu_bod(&a, &p); if (t < min_t) { min_t = t; min_mesh = i; } } } } return (min_mesh); } int kom_get_mesh_mys_all(void) { GLMATRIX *p_mat = get_matrix_camera_project(), m; GAME_MESH_OLD *p_mesh; int i, meshnum; float min_t = FLT_MAX; float t; int min_mesh = K_CHYBA; BOD a, b, p, *p_min, *p_max; glu_invert_matrix(p_mat, &m); transf_2d_3d_matrix((float) mi.x, (float) mi.y, 0.0f, &a.x, &a.y, &a.z, &m, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART); transf_2d_3d_matrix((float) mi.x, (float) mi.y, 0.2f, &b.x, &b.y, &b.z, &m, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART); meshnum = p_ber->meshnum; for (i = 0; i < meshnum; i++) { p_mesh = p_ber->p_mesh[i]; if (p_mesh) { p_min = &p_mesh->obb_world.aabb_min; p_max = &p_mesh->obb_world.aabb_max; if (kd_intersect_kostku_bod(&a, &b, p_min, p_max, &p, &t)) { t = vzdal_bodu_bod(&a, &p); if (t < min_t) { min_t = t; min_mesh = i; } } } } return (min_mesh); } /* Nastavi aktivni mesh u multimesh charakteru */ MeshHandle kom_mesh_set_mesh(MeshHandle mh, int ID, size_ptr rotace) { PRVEK_LEVELU_GAME *p_lev = p_ber->p_prv_lev[mh]; int mesh = p_lev->mesh; GAME_MESH_OLD *p_prev = NULL, *p_mesh = p_ber->p_mesh[mesh], *p_last = p_mesh; assert(mesh != K_CHYBA); while (p_mesh) { if (p_mesh->low_id == ID) { if (p_prev) { p_prev->p_next = p_mesh->p_next; p_mesh->p_next = p_last; p_mesh->sim_flag = FALSE; p_mesh->p_data->p_mesh = p_mesh; p_ber->p_mesh[mesh] = p_mesh; p_lev->mesh = mesh; } p_lev->rotace = rotace; ber_umisti_prvek_abs(p_lev, p_lev->x, p_lev->y - Y_PRVEK2, p_lev->z, p_lev->rotace); return (mh); } p_prev = p_mesh; p_mesh = p_mesh->p_next; } return (K_CHYBA); } /* Parametry funkce: mip_mapping = 0/1 (on/off) mip_filtr = 0/1 (linear/trilinear) std_filtr = 0/1 (near/liner) wrap_x/y = 0/1 (clamp/wrap) hi_res = 0/1 */ void kom_set_default_text_config(int mip_mapping, int mip_filtr, int std_filtr, int wrap_x, int wrap_y, int hi_res) { txconf.text_mip_mapping = mip_mapping; txconf.text_mip_filtr = txconf.text_mip_filtr; txconf.text_filtr = txconf.text_filtr; txconf.text_wrap_x = wrap_x; txconf.text_wrap_y = wrap_y; } void kom_reload_ini(void) { ber_rekonfiguruj_hra(p_ber); ber_rekonfiguruj_3D(p_ber); ber_rekonfiguruj_3D_aplikuj(p_ber); } void kom_zpruhlednovac_on(void) { if (!p_ber->conf_zpruhlednovac) { p_ber->conf_zpruhlednovac = TRUE; p_ber->kamera.zmena = TRUE; } } void kom_zpruhlednovac_off(void) { if (p_ber->conf_zpruhlednovac) { p_ber->conf_zpruhlednovac = FALSE; ber_kamera_zpruhledni_objekty_reset(p_ber); } } // Zvyraznovani prvku on/off void kom_zvyraznovac(void) { ber_prikaz_zvyraznovac(p_ber); } #define KOM_LOAD_KROKU 9 void kom_load_param_set(int tiku) { p_ber->conf_load_tiku = tiku; p_ber->conf_load_tik = 0; p_ber->conf_load_krok = tiku / KOM_LOAD_KROKU; } void kom_load_param_fce(void (*p_load_fce) (void)) { p_ber->p_tik_fce = p_load_fce; } MeshHandle kom_pridej_kurzor_do_levelu(void) { return (kom_pridej_mesh_do_levelu(JMENO_KURZOR)); } MeshHandle kom_prvek_viditelnost(MeshHandle mh, int vid) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[mh]; if (p_prv) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_prv->mesh]; assert(p_mesh); p_mesh->nekreslit = !vid; return (TRUE); } else { return (FALSE); } } int kom_get_mesh_id(MeshHandle prvek_handle) { PRVEK_LEVELU_GAME *p_lev = p_ber->p_prv_lev[prvek_handle]; GAME_MESH_DATA *p_mesh_data = p_lev->p_mesh_data; return(p_mesh_data ? p_mesh_data->mesh_ID : -1); } berusky2-0.12/src/komat/Berusky3d_ini.cpp0000644000175000017500000003105113674426075015261 00000000000000/* Berusci smazba */ #define WM_MOUSEWHEEL 0x020A #include #include #include #include #include #include #include "config.h" #include "3d_all.h" #include "Object.h" #include "game_main.h" #include "game_logic.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_kamery.h" #include "Berusky3d_kofola2d.h" #include "json_export.h" #ifdef DEBUG_OKNO dword start_debug; #endif #define WINDOW_TITLE "Berusky 2" extern int bScreenshot; char ini_file[MAX_FILENAME] = ""; bool create_user_data = TRUE; bool export_level = FALSE; char export_level_file[MAX_FILENAME] = ""; void flip(void) { AGE_MAIN *p_age = p_ber->p_age; GRAPH3D *p_grf = p_age->graph_get(); // Save a screenshot if requested. Do it here, because we need to // save a screenshot if and only if we are about to update the // screen. if (bScreenshot) { gl_Screen_Shot(0); bScreenshot = 0; } p_grf->flip(); static TIMER tm(hwconf.game_fps); tm.frame_end(TRUE); tm.frame_start(); } void screen_resize_callback(tpos width, tpos height) { printf("Screen resize %dx%d\n", width, height); SCREEN_XRES = width; SCREEN_YRES = height; // Set scale factor scale_factor_set(); // Projection & View matrix kam_set_last(p_ber); } inline int filtr_klaves(int scancode) { return (gl_Allow_Key(scancode) ? scancode : 0); } int nahraj_konfig(void) { /* TODO - sync with Setup */ nahraj_device_config(ini_file, "game"); nahraj_universal_device_config(ini_file, "game"); nahraj_texture_config(ini_file, &txconf); return (TRUE); } void kom_ret_default_text_config(void) { txconf.text_mip_mapping = GetPrivateProfileInt(TXT_SEKCE, "text_mip_mapping", 1, ini_file); txconf.text_mip_filtr = GetPrivateProfileInt(TXT_SEKCE, "text_mip_filtr", 1, ini_file); txconf.text_wrap_x = 1; txconf.text_wrap_y = 1; } void kom_graf_konec(int menu) { kprintf(TRUE, "kom_graf_konec..."); /* Shodim GL */ konec(FALSE); } void konec(int konec) { /* Zapne kurzor */ zapni_kurzor(); if (konec) { exit(0); } } bool main_callback(AGE_MAIN * p_age) { // Draw frame p_age->graph_draw(); return (TRUE); } void quat_test(void) { QUAT q; VECT o(1, 0, 0); float r, fi = DEG2RAD(30); angle_to_quat(&q, &o, fi); quat_to_angle(&q, &o, &fi); r = DEG2RAD(0); fi = DEG2RAD(30); kam_angle_to_quat(r, fi, &q); quat_to_euler(&q, &r, &fi); assert(r == 0 && RAD2DEG(fi) == 30); } void print_banner(void) { printf("%s v.%s (C) Anakreon 2011, http://www.anakreon.cz/\n", WINDOW_TITLE, VERSION); printf("This is free software; see the source for copying conditions.\n"); printf("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); } void print_help(void) { printf("Using: berusky2 [OPTIONS][LEVEL_NAME]\n"); printf("\nOptions:\n"); printf(" -h --help Print help\n"); printf(" -i --ini-file file_name.ini Set game ini file (It overides the default one in ~user/.berusky2/berusky3d.ini)\n"); printf(" -l --no-local-copy Don't create local config at ~user/.berusky2\n"); printf(" -e --export file_name Export loaded level to JSON\n"); printf("\nLevel name:\n"); printf(" level_name.lv6 Run this level (from game dir) instead of default menu\n"); printf("\n"); exit(0); } void process_params(G_KONFIG * p_ber, int argc, char **argv) { int i; for (i = 1; i < argc; i++) { if (!strcasecmp(argv[i], "-h") || !strcasecmp(argv[i], "--help")) { print_help(); } else if (!strcasecmp(argv[i], "-i") || !strcasecmp(argv[i], "--ini-file")) { i++; if (i < argc) { strcpy(ini_file, argv[i]); } } else if (!strcasecmp(argv[i], "-l") || !strcasecmp(argv[i], "--no-local-copy")) { create_user_data = FALSE; } else if (!strcasecmp(argv[i], "-e") || !strcasecmp(argv[i], "--export")) { export_level = TRUE; i++; if (i < argc) { strcpy(export_level_file, argv[i]); } } else { // it's a level name? strcpy(p_ber->level_name, argv[i]); pprintf("Custom level set - %s", p_ber->level_name); } } } /* Config file initialization 1) Check used refined ini file (-i param) 2) try the one from ~./berusky2 3) check local config dir */ char ini_file_dirs[][MAX_FILENAME] = { "", // ~./berusky2 "", // current working dir INI_FILE_GLOBAL_DIR }; void ini_file_init(void) { if (ini_file[0]) { if (!efile(ini_file)) { pperror(1, "Unable to open ini file '%s'!", ini_file); } else { char tmp_ini[MAX_FILENAME]; if (!realpath(ini_file, tmp_ini)) { pperror(1, "Unable to resolve ini file path! (%s)", ini_file); } strcpy(ini_file, tmp_ini); pprintf("Using custom ini file: %s", ini_file); } } else { for (unsigned int i = 0; i < sizeof(ini_file_dirs) / sizeof(ini_file_dirs[0]); i++) { // ~./berusky2 if (i == 0) { return_path(INI_USER_DIRECTORY, "", ini_file_dirs[i], MAX_FILENAME); } // current working directory init if (i == 1) { if (getcwd(ini_file_dirs[i], MAX_FILENAME) == NULL) pperror(1, "Cannot get current directory"); } strcat(ini_file_dirs[i], "/" INI_FILE_NAME); pprintfnl("Trying to open ini file at %s...", ini_file_dirs[i]); if (efile(ini_file_dirs[i])) { pprintf("OK"); strcpy(ini_file, ini_file_dirs[i]); return; } else { pprintf("FAILED"); } } pperror(1, "Unable to open any ini file!"); } } void debug_file_init(void) { char tmp[200]; GetPrivateProfileString("install", "log_file", "", tmp, 200, ini_file); if(tmp[0]) { p_ber->debug_file = fopen(tmp, "a"); } } /* It tries to create the user directory (~./berusky2) * and copy berusky3d.ini file there * */ void user_directory_create(void) { // Check ~./berusky2 dir_create(INI_USER_DIRECTORY); dir_create(INI_SAVES_DIRECTORY); dir_create(INI_PROFILE_DIRECTORY); // Check ~./berusky2/berusky3d.ini pprintfnl("Checking %s/%s...", INI_USER_DIRECTORY, INI_FILE_NAME); if (!file_exists(INI_USER_DIRECTORY, INI_FILE_NAME)) { pprintfnl("missing, try to copy it from %s...", INI_FILE_GLOBAL); bool ret = file_copy(INI_FILE_GLOBAL, NULL, INI_FILE_NAME, INI_USER_DIRECTORY, FALSE); if (ret) { pprintf("OK"); } else { print_errno(TRUE); pprintf("FAILED"); } } else { pprintf("OK"); } } void game_exit(void) { AGE_MAIN *p_age = p_ber->p_age; if(p_age) delete p_age; } int main(int argc, char **argv) { //feenableexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW); //feenableexcept(FE_DIVBYZERO|FE_INVALID); //quat_test(); //alut_test(TRUE); atexit(game_exit); print_banner(); process_params(p_ber, argc, argv); if (create_user_data) { user_directory_create(); } ini_file_init(); working_dir_init(); debug_file_init(); nahraj_konfig(); AGE_MAIN *p_age = p_ber->p_age = new AGE_MAIN(main_callback); p_age->graph_set(SCREEN_XRES, SCREEN_YRES, hwconf.bpp, hwconf.fullscreen); if (!p_age->graph_screen_create()) return(FALSE); GRAPH3D *p_grf = p_age->graph_get(); p_grf->get(&SCREEN_XRES, &SCREEN_YRES, &hwconf.bpp); window_set_title(WINDOW_TITLE); if (!grf_start(ini_file)) pperror(1, "Init"); ber_nahod_render_funkce(); ber_konfiguruj_berusky(&ber); timeGetTimeInit(); SCENE *p_scene = p_age->scene_new(); p_age->scene_active_set(p_scene); p_grf->config_draw_grid(FALSE); p_grf->config_draw_mouse_cursor(FALSE); p_grf->config_draw_boxes(FALSE); p_grf->config_draw_console(FALSE); p_grf->config_draw_fps(FALSE); p_grf->config_draw_normals(FALSE); p_grf->config_opengl_lighting(FALSE); p_grf->config_draw_all_objects(TRUE); p_grf->config_draw_pivots(TRUE); p_grf->config_draw_selection(TRUE); p_grf->resize_callback_set(screen_resize_callback); glstav_reset(); if(export_level) { json_export_start(export_level_file); } winmain_Game_Run(p_ber->level_name); if(export_level) { json_export_end(); } return (TRUE); } inline void nacti_polohu_mysi(int nx, int ny) { mi.dx = nx - mi.x; mi.dy = ny - mi.y; mi.x = nx; mi.y = ny; } inline void nacti_tlacitka_mysi(int num, bool state) { //kprintf(TRUE, "nacti_tlacitka_mysi(): num = %d, state = %d", num, state); switch (num) { case 1: //kprintf(TRUE, "nacti_tlacitka_mysi(): mi.t1 = %d", state); mi.ot1 = mi.dt1 = mi.t1 = state; break; case 3: //kprintf(TRUE, "nacti_tlacitka_mysi(): mi.t2 = %d", state); mi.ot2 = mi.dt2 = mi.t2 = state; break; case 4: case 5: { if (state) { if (!PRCameraFlag) break; PRCameraFlagChange = FALSE; if (num == 4) { //kprintf(TRUE, "nacti_tlacitka_mysi(): key[K_PLUS] = %d", TRUE); key[K_PLUS] = TRUE; } else { //kprintf(TRUE, "nacti_tlacitka_mysi(): key[K_MINUS] = %d", TRUE); key[K_MINUS] = TRUE; } } } break; default: break; } } /* case WM_CHAR: key_pressed = (TCHAR) wParam; break; case WM_SETCURSOR: if(!mouse_move) mouse_move = FALSE; break; } */ int spracuj_spravy(int param) { SDL_Event event; /* Event structure */ while (SDL_PollEvent(&event)) { int keycode = event.key.keysym.sym; SDLMod mod = event.key.keysym.mod; // `keycode' might be uninitialized if the event isn't a keypress // event. if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) { // Compensate for keyboard layouts where '+' is shifted '=' // (e.g. QWERTY). if (keycode == K_EQUALS) keycode = K_PLUS; } switch (event.type) { case SDL_KEYDOWN: { //printf("SDL_KEYDOWN(%d)\n",keycode); key[keycode] = TRUE; key[0] = TRUE; key[K_SHIFT] = mod & KMOD_SHIFT; key[K_CTRL] = mod & KMOD_CTRL; key[K_ALT] = mod & KMOD_ALT; // store unicode character for GUI interface key_pressed = event.key.keysym.unicode; } break; case SDL_KEYUP: { key[keycode] = FALSE; key[0] = FALSE; key[K_SHIFT] = mod & KMOD_SHIFT; key[K_CTRL] = mod & KMOD_CTRL; key[K_ALT] = mod & KMOD_ALT; } break; case SDL_MOUSEMOTION: { nacti_polohu_mysi(event.motion.x, event.motion.y); int i; for (i = 0; i < MOUSE_BUTTONS; i++) { bool state = event.motion.state & SDL_BUTTON(i); if (state) { nacti_tlacitka_mysi(i, 1); } } } break; case SDL_MOUSEBUTTONDOWN: nacti_polohu_mysi(event.motion.x, event.motion.y); nacti_tlacitka_mysi(event.button.button, 1); break; case SDL_MOUSEBUTTONUP: nacti_polohu_mysi(event.motion.x, event.motion.y); nacti_tlacitka_mysi(event.button.button, 0); break; case SDL_ACTIVEEVENT: if (event.active.state&SDL_APPINPUTFOCUS) { kprintf(TRUE,"SDL_APPINPUTFOCUS, gain = %d",event.active.gain); } if (event.active.state&SDL_APPMOUSEFOCUS) { kprintf(TRUE,"SDL_APPMOUSEFOCUS, gain = %d",event.active.gain); if (event.active.gain) { p_ber->system_kurzor = FALSE; } else { p_ber->system_kurzor = TRUE; } } if (event.active.state&SDL_APPACTIVE) { kprintf(TRUE,"SDL_APPACTIVE, gain = %d",event.active.gain); if (event.active.gain) { karmin_aktivni = TRUE; } else { karmin_aktivni = FALSE; } } break; case SDL_VIDEORESIZE: { AGE_MAIN *p_age = p_ber->p_age; if(p_age) { GRAPH3D *p_grf = p_age->graph_get(); p_grf->screen_resize(event.resize.w, event.resize.h); } break; } case SDL_QUIT: gl_Kofola_End(bInMenu); break; default: printf("I don't know what this event is!\n"); } } return (TRUE); } berusky2-0.12/src/komat/Berusky3d_kofola2d.cpp0000644000175000017500000007302213674426075016207 00000000000000/* -------------------------------------------------- Rozhrani k 2D grafice -------------------------------------------------- - vypnuti renderingu hry */ #include #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Berusky3d_kamery.h" #include "Berusky3d_kofola2d.h" #define MAX_TEXT_BUFFER_X 2048 #define MAX_TEXT_BUFFER_Y 2048 /* Alfa = 0 - viditelne = 1 - ne-viditelne */ #define COLOR_MASKA (0x00ffffff) #define PRUHL_BARVA (0xff000000|slist.pruhledna_barva) #define bmp_nepruhl(barva) (barva&0x00ffffff) #define nepruhl(barva) (barva&0x00ffffff) #define VELIKOST_PIXELU (sizeof(dword)) static DDX2_SURFACE_DEVICE *p_dev; static DDX2_SURFACE_DEVICE *p_dev_list; static DDX2_SURFACE_DEVICE *p_dev_cursor; static DDX2_SURFACE_LIST slist; static int ddx2InitDone = FALSE; #define vysledna_barva(barva) ((nepruhl(barva) == slist.pruhledna_barva) ? PRUHL_BARVA : nepruhl(barva)) inline bitmapa *get_bmp(SurfaceHandle handle) { if (handle == DDX2_BACK_BUFFER) { return (p_dev->p_back_buffer); } else { assert(handle < slist.surf_max); return (slist.p_slist[handle].p_bmp); } } // Kofolovo extern RECT_LINE rline; //------------------------------------------------------------------------------------------------ // Name: ddx2Init() // Desc: Vyrobi rezervoar na surfacy //------------------------------------------------------------------------------------------------ int ddx2Init(int max_surfacu, dword pruhledna_barva) { if (!ddx2InitDone) { slist.p_slist = (DDX2_SURFACE *)mmalloc(sizeof(slist.p_slist[0]) * max_surfacu); slist.surf_max = max_surfacu; slist.pruhledna_barva = pruhledna_barva; slist.surf_num = 0; ddx2InitDone = TRUE; } return (TRUE); } //------------------------------------------------------------------------------------------------ // Name: ddx2Release() // Desc: Zrusi rezervovar na surfacy //------------------------------------------------------------------------------------------------ void ddx2Release(void) { if (ddx2InitDone) { int i; for (i = 0; i < slist.surf_max; i++) { ddx2ReleaseBitmap(i); } null_free((void **) &slist.p_slist); ddx2InitDone = FALSE; } } //----------------------------------------------------------------------------- // Name: ddx2DeviceCreate() // Desc: Vyrobi renderovaci device a vlozi ho to seznamu devicu // filtr - TRUE - linear, FALSE - near // bpp - 16/32 //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceCreate(int linear_filtr, int bpp, bool cursor_device) { DDX2_SURFACE_DEVICE *p_tmp = (DDX2_SURFACE_DEVICE *) mmalloc(sizeof(p_tmp[0])); p_tmp->p_back_buffer = NULL; p_tmp->hw.filtr = linear_filtr; p_tmp->hw.format = (bpp == 16) ? GL_RGB5_A1 : GL_RGBA8; if(!cursor_device) { p_tmp->p_next = p_dev_list; p_dev_list = p_tmp; } else { assert(!p_dev_cursor); p_dev_cursor = p_tmp; } return ((DeviceHandle) p_tmp); } //----------------------------------------------------------------------------- // Name: ddx2DeviceSetCursor() // Desc: Nastavi renderovaci device jako aktivni //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetActive(DeviceHandle handle) { p_dev = (DDX2_SURFACE_DEVICE *) handle; return (handle); } //----------------------------------------------------------------------------- // Name: ddx2DeviceSetCursor() // Desc: Set this device as a cursor device //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetCursor(DeviceHandle handle) { p_dev_cursor = (DDX2_SURFACE_DEVICE *) handle; return (handle); } //----------------------------------------------------------------------------- // Interni funkce //----------------------------------------------------------------------------- void ddx2DeviceRemoveRec(DDX2_SURFACE_DEVICE ** p_rm) { DDX2_SURFACE_DEVICE *p_dev = *p_rm; if (p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; if (p_hw->text) txt_zrus_2D_texturu(&p_hw->text); bmp_zrus(&p_dev->p_back_buffer); free(p_dev); p_rm = NULL; } } //----------------------------------------------------------------------------- // Name: ddx2DeviceRemove() // Desc: Zrusi zarizeni, pokud je aktivni nastavi aktivni prvni v seznamu //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceRemove(DeviceHandle handle) { DDX2_SURFACE_DEVICE *p_rm = (DDX2_SURFACE_DEVICE *) handle; DDX2_SURFACE_DEVICE *p_tmp = p_dev_list; int reset = (p_rm == p_dev); if (p_dev_list == p_rm) { p_dev_list = p_rm->p_next; ddx2DeviceRemoveRec(&p_rm); if (reset) { p_dev = p_dev_list; } return (TRUE); } else { while (p_tmp) { if (p_tmp->p_next == p_rm) { p_tmp->p_next = p_tmp->p_next->p_next; ddx2DeviceRemoveRec(&p_rm); if (reset) { p_dev = p_dev_list; } return (TRUE); } p_tmp = p_tmp->p_next; } // It's a cursor device? if(p_dev_cursor == p_rm) { ddx2DeviceRemoveRec(&p_rm); p_dev_cursor = NULL; return (TRUE); } return (FALSE); } } //----------------------------------------------------------------------------- // Name: ddx2DeviceResBackBuffer(int back_dx, int back_dy) // Desc: Nastavi rozmer back-bufferu //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetBackBufferSize(int back_dx, int back_dy) { if (p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; p_hw->back_dx = back_dx; p_hw->back_dy = back_dy; if (p_dev->p_back_buffer) bmp_zrus(&p_dev->p_back_buffer); p_dev->p_back_buffer = bmp_vyrob(p_hw->back_dx, p_hw->back_dy); if (p_dev->p_back_buffer) ddx2CleareSurface(DDX2_BACK_BUFFER); return ((DeviceHandle) p_dev); } else return (FALSE); } //----------------------------------------------------------------------------- // Name: ddx2DeviceSetBackBufferRect(int text_x, int text_y, int text_dx, int text_dy) // Desc: Nastavi pozici a rozmery textury v back-bufferu //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetBackBufferRect(int text_x, int text_y, int text_dx, int text_dy) { if (p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; int ttdx, ttdy; if (text_dx > MAX_TEXT_BUFFER_X && text_dy > MAX_TEXT_BUFFER_Y) return (FALSE); p_hw->text_x = text_x; p_hw->text_y = text_y; p_hw->text_dx = text_dx; p_hw->text_dy = text_dy; if (p_hw->text) txt_zrus_2D_texturu(&p_hw->text); for (ttdx = 2; ttdx < MAX_TEXT_BUFFER_X && ttdx < p_hw->text_dx; ttdx <<= 1); for (ttdy = 2; ttdy < MAX_TEXT_BUFFER_X && ttdy < p_hw->text_dx; ttdy <<= 1); p_hw->text_real_dx = ttdx; p_hw->text_real_dy = ttdy; p_hw->text = txt_vyrob_2D_texturu(ttdx, ttdy, p_hw->filtr, p_hw->format); return ((DeviceHandle) p_dev); } else return (FALSE); } #define pomer(p,min,max) (((float)p-(float)min)/((float)max-(float)min)) //----------------------------------------------------------------------------- // Name: ddx2DeviceSetTextRenderRec(int vx, int vy, int v_dx, int v_dy) // Desc: Nastavi oblast textury, ktera se bude prenaset na obrazovku //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetTextRenderRec(int vx, int vy, int v_dx, int v_dy) { if (p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; BODUV *p_v = p_hw->map; int tdx, tdy; tdx = p_hw->text_real_dx; tdy = p_hw->text_real_dy; if (vx < 0 || vy < 0 || v_dx > tdx || v_dy > tdy) return (FALSE); p_v->u = pomer(vx, 0, tdx); p_v->v = pomer(vy, 0, tdy); p_v++; p_v->u = pomer(vx + v_dx, 0, tdx); p_v->v = pomer(vy, 0, tdy); p_v++; p_v->u = pomer(vx + v_dx, 0, tdx); p_v->v = pomer(vy + v_dy, 0, tdy); p_v++; p_v->u = pomer(vx, 0, tdx); p_v->v = pomer(vy + v_dy, 0, tdy); p_v++; return ((DeviceHandle) p_dev); } else return (FALSE); } //----------------------------------------------------------------------------- // Name: ddx2DeviceSetScreenRec(int scr_x, int scr_y, int scr_dx, int scr_dy) // Desc: Nastavi pozici textury na obrazovce (umisteni + rozmer) //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetScreenRec(int scr_x, int scr_y, int scr_dx, int scr_dy) { if (p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; p_hw->scr_x = scr_x; p_hw->scr_y = scr_y; if(scr_dx) p_hw->scr_dx = scr_dx; if(scr_dy) p_hw->scr_dy = scr_dy; return ((DeviceHandle) p_dev); } else return (FALSE); } //----------------------------------------------------------------------------- // Name: ddx2DeviceSetScreenRecCallback(DDX2_DEVICE_SCREEN_CALLBACK p_callback) // Desc: Sets a callback for screen resize //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetScreenRecCallback(DDX2_DEVICE_SCREEN_CALLBACK p_callback) { if(p_dev) { p_dev->p_resize_callback = p_callback; return((DeviceHandle)p_dev); } else return(FALSE); } //----------------------------------------------------------------------------- // Name: ddx2DeviceSetRender(int draw) // Desc: Povoli/zakaze kresleni device //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceSetRender(int draw) { if (p_dev) { p_dev->draw = draw; return ((DeviceHandle) p_dev); } else { return ((DeviceHandle) FALSE); } } //----------------------------------------------------------------------------- // Name: ddx2DeviceDeaktivuj() // Desc: Odmapuje aktivni zarizeni zobrazovky (smaze texturu a pod.) //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceDeaktivuj(void) { if (p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; bmp_zrus(&p_dev->p_back_buffer); txt_zrus_2D_texturu(&p_hw->text); return ((DeviceHandle) p_dev); } else { return ((DeviceHandle) FALSE); } } //----------------------------------------------------------------------------- // Name: ddx2DeviceGetInfo() // Desc: Cte informace o device - vraci pocet surfacu v aktivnim device, // velikost obsazene pameti //----------------------------------------------------------------------------- DeviceHandle ddx2DeviceGetInfo(int *p_surfacu, int *p_mem) { int i, s, num; if (p_dev) { for (i = 0, s = 0, num = 0; i < slist.surf_max; i++) { if (slist.p_slist[i].p_bmp) { s += bmp_velikost(slist.p_slist[i].p_bmp); num++; } } *p_surfacu = num; *p_mem = s; return ((DeviceHandle) p_dev); } else { return (FALSE); } } //----------------------------------------------------------------------------- // Name: ddx2SetRect() // Desc: Nastavi seznam recu na kresleni, NULL = nic nekreslit //----------------------------------------------------------------------------- void ddx2SetRect(RECT * p_rlist, int rnum) { p_dev->p_rlist = p_rlist; p_dev->rnum = rnum; } // ---------------------------------------------------------------------------- // Interni funkce // ---------------------------------------------------------------------------- void ddx2RenderujDevice(G_KONFIG * p_ber, DDX2_SURFACE_DEVICE * p_dev) { DDX2_SURFACE_DEVICE_3D *p_hw = &p_dev->hw; RECT *p_rlist = p_dev->p_rlist; int i, rx, ry, rkx, rky; int tx, ty, tkx, tky, vdx, vdy; dword *p_text_start; BODUV *p_v = p_hw->map; glBindTexture(GL_TEXTURE_2D, p_hw->text); glPixelStorei(GL_UNPACK_ROW_LENGTH, p_dev->p_back_buffer->x); if (p_rlist && p_dev->rnum) { tx = p_hw->text_x; ty = p_hw->text_y; tkx = tx + p_hw->text_dx; tky = ty + p_hw->text_dy; p_text_start = p_dev->p_back_buffer->data; for (i = 0; i < p_dev->rnum; i++, p_rlist++) { rx = p_rlist->left; ry = p_rlist->top; rkx = rx + p_rlist->right; rky = ry + p_rlist->bottom; if (rx < tx) rx = tx; if (ry < ty) ry = ty; if (rx > tkx) rx = tkx; if (ry > tky) ry = tky; if (rkx < tx) rkx = tx; if (rky < ty) rky = ty; if (rkx > tkx) rkx = tkx; if (rky > tky) rky = tky; vdx = rkx - rx; vdy = rky - ry; if (vdx && vdy) { glTexSubImage2D(GL_TEXTURE_2D, // target 0, // level (MIP map?) rx - tx, ry - ty, // xoffset / yoffset vdx, vdy, // width / height GL_RGBA, // format GL_UNSIGNED_BYTE, // data type p_text_start + rx + ry * p_hw->back_dx); // pixel data } } } glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glBegin(GL_QUADS); glTexCoord2fv((float *) (p_v + 3)); glVertex2i(p_hw->scr_x, p_hw->scr_y+p_hw->scr_dy); glTexCoord2fv((float *) (p_v + 2)); glVertex2i(p_hw->scr_x+p_hw->scr_dx, p_hw->scr_y+p_hw->scr_dy); glTexCoord2fv((float *) (p_v + 1)); glVertex2i(p_hw->scr_x+p_hw->scr_dx, p_hw->scr_y); glTexCoord2fv((float *) (p_v)); glVertex2i(p_hw->scr_x, p_hw->scr_y); glEnd(); } //------------------------------------------------------------------------------------------------ // Renderuj Kurzor //------------------------------------------------------------------------------------------------ void ddx2DrawCursor(SurfaceHandle iSurface, int x, int y, int dx, int dy, dword pruhledna) { DDX2_SURFACE_DEVICE *p_dev_back = p_dev; p_dev = p_dev_cursor; if(iSurface != NO_SURFACE) { ddx2CleareSurface(DDX2_BACK_BUFFER); ddx2TransparentBltFull(DDX2_BACK_BUFFER, 0, 0, iSurface, pruhledna); } ddx2DeviceSetScreenRec(x,y); static RECT drawRect = {0,0,dx,dy}; ddx2SetRect(&drawRect, 1); p_dev = p_dev_back; } void ddx2DrawCursorSetDraw(int draw) { if(p_dev_cursor) p_dev_cursor->draw = draw; } //------------------------------------------------------------------------------------------------ // zacatek 3d kresleni //------------------------------------------------------------------------------------------------ void ddx2StartRender2D(void) { set_matrix_2d(SCREEN_XRES, SCREEN_YRES); glColor4f(1, 1, 1, 1); glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_LEQUAL, 0); specular_off(); specular_color(0, 0, 0); } //------------------------------------------------------------------------------------------------ // konec 3d kresleni //------------------------------------------------------------------------------------------------ void ddx2StopRender2D(void) { glDisable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.5f); glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); ret_matrix_2d(); } // ---------------------------------------------------------------------------- // Name: ddx2RenderDevices() // Desc: Render all devices // Vola se pokud se menu ma kreslit jako soucast hry (volat po renderingu // menu s listim) - vykresli pouze menu a nic jineho // ---------------------------------------------------------------------------- void ddx2RenderDevices(G_KONFIG * p_ber) { DDX2_SURFACE_DEVICE *p_tmp = p_dev_list; if (p_tmp) { ddx2StartRender2D(); while (p_tmp) { if(p_dev->p_resize_callback) { p_dev->p_resize_callback(); } if (p_tmp->draw) ddx2RenderujDevice(p_ber, p_tmp); p_tmp = p_tmp->p_next; } if(p_dev_cursor && p_dev_cursor->draw) { ddx2RenderujDevice(p_ber, p_dev_cursor); } ddx2StopRender2D(); } } // ---------------------------------------------------------------------------- // Name: ddx2RenderujVse() // Desc: Vykresli menu // Kresli menu vcetne vymazani obrazovky // ---------------------------------------------------------------------------- void ddx2RenderujVse(G_KONFIG * p_ber) { glClear(GL_DEPTH_BUFFER_BIT); if (p_ber->conf_barva_pozadi_pouzit) glClear(GL_COLOR_BUFFER_BIT); /* Vypnuti scale-faktoru texturoveho filtru */ text_sharp(0.0f); /* Update fps */ ber_updatuj_fps(p_ber); /* Kofolovo nastaveni */ text_set_num(0); text_on(GL_TEXTURE_2D); text_set_blok(0, BLOK_MODULACE); /* 2D rendering */ ddx2RenderDevices(p_ber); } //------------------------------------------------------------------------------------------------ // finds first free index //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2FindFreeSurface(void) { int i; if (!slist.p_slist[slist.surf_num].p_bmp) { return (slist.surf_num++); } for (i = 0; i < slist.surf_max; i++) { if (!slist.p_slist[i].p_bmp) return (i); } // We don't have a free surface kerror(TRUE, "Unable to find free surface! ddx2FindFreeSurface()"); return (K_CHYBA); } //------------------------------------------------------------------------------------------------ // release bitmap //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2ReleaseBitmap(SurfaceHandle iSurface) { assert(iSurface < slist.surf_max); if (slist.p_slist[iSurface].p_bmp) { bmp_zrus(&slist.p_slist[iSurface].p_bmp); } return (iSurface); } //------------------------------------------------------------------------------------------------ // load bitmap from a directory na pozici //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmapPos(SurfaceHandle handle, char *pFileName, char *pDirName) { if (handle != K_CHYBA) { assert(handle < slist.surf_max); ddx2ReleaseBitmap(handle); if ((slist.p_slist[handle].p_bmp = bmp_nahraj(pDirName, (char *)pFileName))) { // for compatibility with old broken bmp loading bmp_prehod(slist.p_slist[handle].p_bmp); return (handle); } } kerror(TRUE, "FILE %s LINE %d Chyba loadu bmp %s...", __FILE__, __LINE__, pFileName); return (K_CHYBA); } //------------------------------------------------------------------------------------------------ // load bitmap from DISK na pozici //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmapPosDisk(SurfaceHandle handle, char *pFileName) { if (handle != K_CHYBA) { assert(handle < slist.surf_max); ddx2ReleaseBitmap(handle); if ((slist.p_slist[handle].p_bmp = bmp_nahraj(pFileName))) { // for compatibility with old broken bmp loading bmp_prehod(slist.p_slist[handle].p_bmp); return (handle); } } kerror(TRUE, "FILE %s LINE %d Chyba loadu bmp %s...", __FILE__, __LINE__, pFileName); return (K_CHYBA); } //------------------------------------------------------------------------------------------------ // load bitmap from a directory //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmap(char *pFileName, char *pDirName) { return (ddx2LoadBitmapPos(ddx2FindFreeSurface(), pFileName, pDirName)); } //------------------------------------------------------------------------------------------------ // load bitmap from DISK //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2LoadBitmapDisk(char *pFileName) { return (ddx2LoadBitmapPosDisk(ddx2FindFreeSurface(), pFileName)); } //------------------------------------------------------------------------------------------------ // load list of bitmaps from a directory //------------------------------------------------------------------------------------------------ BOOL ddx2LoadList(char *pFileName, char *pBmpDir, char *p_bmp_dir) { int c; char text[MAX_FILENAME]; FILE *file = 0; DWORD Eplased; DWORD Start, Stop; construct_path(text, MAX_FILENAME, 3, p_bmp_dir, pBmpDir, pFileName); kprintf(1, "Kofola: - Load bitmap pro herni menu"); file = fopen(text, "rb"); if (!file) { kprintf(1, "File not found : %s", text); konec(TRUE); } c = 0; Start = timeGetTime(); while (fgets(text, 256, file)) { newline_cut(text); ddx2LoadBitmapPos(c, text, pBmpDir); c++; } fclose(file); Stop = timeGetTime(); Eplased = Stop - Start; kprintf(1,(char *) "--------------Total load time %.1f s -----------------", Eplased / 1000.0f); return (TRUE); } //------------------------------------------------------------------------------------------------ // Create Surface //------------------------------------------------------------------------------------------------ SurfaceHandle ddx2CreateSurface(int x, int y, int idx) { assert(idx < slist.surf_max); if (idx > -1 && idx < slist.surf_max) { ddx2ReleaseBitmap(idx); slist.p_slist[idx].p_bmp = bmp_vyrob(x, y); if (!(slist.p_slist[idx].p_bmp)) { kprintf(TRUE, "FILE %s LINE %d vyrob bmp..." __FILE__, __LINE__); konec(TRUE); } if (slist.p_slist[idx].p_bmp) ddx2CleareSurface(idx); return (slist.p_slist[idx].p_bmp ? idx : K_CHYBA); } else { kerror(TRUE, "Unable to create surface - ddx2CreateSurface(%d, %d, %d)", x, y, idx) ; return (K_CHYBA); } } //------------------------------------------------------------------------------------------------ // nakresli obrazek // com[1] je index v poli surafacu a // com[2],[3] je x,y kam se to ma kreslit //------------------------------------------------------------------------------------------------ void ddx2DrawSurfaceColorKey(int iSurface, int *com, int layer, COLORREF color) { bitmapa *p_src = get_bmp(com[1]); ddx2TransparentBlt(iSurface, com[2], com[3], p_src->x, p_src->y, com[1], 0, 0, color); } void ddx2DrawDisplayColorKey(int *com, int layer, COLORREF color) { bitmapa *p_src = get_bmp(com[1]); ddx2TransparentBlt(DDX2_BACK_BUFFER, com[2], com[3], p_src->x, p_src->y, com[1], 0, 0, color); } // ---------------------------------------------------------- // Kresli do surface // ---------------------------------------------------------- void ddx2DrawSurface(int iSurface, int *com, int layer) { RECT r; bitmapa *p_src = get_bmp(com[1]); ddx2BitBlt(iSurface, com[2], com[3], p_src->x, p_src->y, com[1], 0, 0); r.left = com[2]; r.top = com[3]; r.right = p_src->x; r.bottom = p_src->y; ddx2AddRectItem(&rline, r, layer); } // ---------------------------------------------------------- // Kresli na displey // ---------------------------------------------------------- void ddx2DrawDisplay(int *com, int layer) { bitmapa *p_src = get_bmp(com[1]); ddx2BitBlt(DDX2_BACK_BUFFER, com[2], com[3], p_src->x, p_src->y, com[1], 0, 0); } // color to make transparent BOOL ddx2TransparentBlt(SurfaceHandle dst, int dx, int dy, int dsirka, int dvyska, SurfaceHandle src, int sx, int sy, dword pruhledna) { bitmapa *p_src = get_bmp(src); bitmapa *p_dst = get_bmp(dst); // Clip the coordinates if(dx < 0) { dsirka += dx; dx = 0; } if(dy < 0) { dvyska += dy; dy = 0; } assert(sx >= 0 && sy >= 0); if(dx + dsirka > p_dst->x) { dsirka = p_dst->x - dx; if(dsirka <= 0) return(FALSE); } if(dy + dvyska > p_dst->y) { dvyska = p_dst->y - dy; if(dvyska <= 0) return(FALSE); } assert(sx + dsirka <= p_src->x && sy + dvyska <= p_src->y); int ssirka = dsirka; int svyska = dvyska; int sirka_src = p_src->x; int sirka_dst = p_dst->x; int rozdil_src = sirka_src - ssirka; int rozdil_dst = sirka_dst - ssirka; int src_x = sy * sirka_src + sx; int dst_x = dy * sirka_dst + dx; dword *p_src_data = p_src->data + src_x; dword *p_dst_data = p_dst->data + dst_x; dword barva; int x, y; if (dst == DDX2_BACK_BUFFER) { RECT r; r.left = dx; r.top = dy; r.right = dsirka; r.bottom = dvyska; ddx2AddRectItem(&rline, r, 0); } assert(dx < p_dst->x && dy < p_dst->y); assert(sx < p_src->x && sy < p_src->y); assert(dx + dsirka <= p_dst->x && dy + dvyska <= p_dst->y); assert(sx + ssirka <= p_src->x && sy + svyska <= p_src->y); pruhledna = bmp_nepruhl(pruhledna); for (y = 0; y < svyska; y++) { for (x = 0; x < ssirka; x++) { barva = bmp_nepruhl(*p_src_data); if (barva != pruhledna) { *p_dst_data = barva; } p_dst_data++; p_src_data++; } p_dst_data += rozdil_dst; p_src_data += rozdil_src; } return (TRUE); } BOOL ddx2TransparentBltFull(SurfaceHandle dst, int dx, int dy, SurfaceHandle src, dword barva) { bitmapa *p_src = get_bmp(src); return (ddx2TransparentBlt(dst, dx, dy, p_src->x, p_src->y, src, 0, 0, barva)); } BOOL ddx2TransparentBltDisplay(int dx, int dy, int dsirka, int dvyska, int dcSrcSurface, int sx, int sy, int ssirka, int svyska, UINT crTransparent) { return (ddx2TransparentBlt(DDX2_BACK_BUFFER, dx, dy, dsirka, dvyska, dcSrcSurface, sx, sy, crTransparent)); } BOOL ddx2BitBlt(SurfaceHandle dst, int dx, int dy, int sirka, int vyska, SurfaceHandle src, int sx, int sy) { bitmapa *p_src = get_bmp(src); bitmapa *p_dst = get_bmp(dst); int sirka_src = p_src->x; int sirka_dst = p_dst->x; int src_x = sy * sirka_src + sx; int dst_x = dy * sirka_dst + dx; dword *p_src_data = p_src->data + src_x; dword *p_dst_data = p_dst->data + dst_x; int y; if (dst == DDX2_BACK_BUFFER) { RECT r; r.left = dx; r.top = dy; r.right = sirka; r.bottom = vyska; ddx2AddRectItem(&rline, r, 0); } assert(dx <= p_dst->x && dy <= p_dst->y); assert(sx <= p_src->x && sy <= p_src->y); assert(dx + sirka <= p_dst->x && dy + vyska <= p_dst->y); assert(sx + sirka <= p_src->x && sy + vyska <= p_src->y); for (y = 0; y < vyska; y++) { memmove(p_dst_data, p_src_data, sizeof(p_dst_data[0]) * sirka); p_dst_data += sirka_dst; p_src_data += sirka_src; } return (TRUE); } BOOL ddx2BitBltStretch(SurfaceHandle dst, int dx, int dy, int dst_width, int dst_height, SurfaceHandle src, int sx, int sy, int src_width, int src_height) { bitmapa *p_src = get_bmp(src); bitmapa *p_dst = get_bmp(dst); int src_bitmap_width = p_src->x; int dst_bitmap_width = p_dst->x; dword *p_src_data = p_src->data; dword *p_dst_data = p_dst->data; int x,y; if (dst == DDX2_BACK_BUFFER) { RECT r; r.left = dx; r.top = dy; r.right = dst_width; r.bottom = dst_height; ddx2AddRectItem(&rline, r, 0); } assert(dx < p_dst->x && dy < p_dst->y); assert(sx < p_src->x && sy < p_src->y); assert(dx + dst_width <= p_dst->x && dy + dst_height <= p_dst->y); assert(sx + src_width <= p_src->x && sy + src_height <= p_src->y); float scale_factor_width = src_width / (float)dst_width; float scale_factor_height = src_height / (float)dst_height; for (y = 0; y < dst_height; y++) { for (x = 0; x < dst_width; x++) { int dst_index = (dy + y)*dst_bitmap_width + dx + x; int src_index = (sy + floor(y*scale_factor_height))*src_bitmap_width + sx + floor(x*scale_factor_width); p_dst_data[dst_index] = p_src_data[src_index]; } } return (TRUE); } BOOL ddx2BitBltFull(SurfaceHandle dst, int dx, int dy, SurfaceHandle src) { bitmapa *p_src = get_bmp(src); return (ddx2BitBlt(dst, dx, dy, p_src->x, p_src->y, src, 0, 0)); } BOOL ddx2BitBltDisplay(int dx, int dy, int sirka, int vyska, int dcSrcSurface, int sx, int sy) { return (ddx2BitBlt(DDX2_BACK_BUFFER, dx, dy, sirka, vyska, dcSrcSurface, sx, sy)); } int ddx2GetWidth(SurfaceHandle src) { if (src == DDX2_BACK_BUFFER) { return (p_dev->hw.back_dx); } else { return (slist.p_slist[src].p_bmp->x); } } int ddx2GetHeight(SurfaceHandle src) { if (src == DDX2_BACK_BUFFER) { return (p_dev->hw.back_dy); } else { return (slist.p_slist[src].p_bmp->y); } } void ddx2CleareSurfaceColor(SurfaceHandle iSurface, COLORREF color) { bmp_smaz(get_bmp(iSurface), vysledna_barva(color)); } void ddx2FillRect(SurfaceHandle iSurface, RECT * rect, COLORREF color) { dword barva = vysledna_barva(color); bitmapa *p_src = get_bmp(iSurface); int sirka = rect->right - rect->left; int vyska = rect->bottom - rect->top; int sirka_src = p_src->x - sirka; dword *p_src_data = p_src->data + rect->top * (p_src->x) + rect->left; int x, y; assert(sirka <= p_src->x && vyska <= p_src->y); for (y = 0; y < vyska; y++) { for (x = 0; x < sirka; x++) *p_src_data++ = barva; p_src_data += sirka_src; } } void ddx2CleareSurface(SurfaceHandle iSurface) { ddx2CleareSurfaceColor(iSurface, slist.pruhledna_barva); } void ddx2AddRectItem(RECT_LINE * p_rl, RECT rect, int iLayer) { if (p_rl->rlast < DRAW_RECT_NUM) { p_rl->rect[p_rl->rlast].rect = rect; p_rl->rect[p_rl->rlast].iLayer = iLayer; p_rl->rect[p_rl->rlast].bUsed = 1; p_rl->rlast++; } } void ddx2ScreenResDefaultCallback(void) { ddx2DeviceSetScreenRec(0, 0, SCREEN_XRES, SCREEN_YRES); } //------------------------------------------------------------------------------------------------ // Povoli/zakaze rendering hry //------------------------------------------------------------------------------------------------ void ddx2GameRender(int render) { p_ber->conf_menu_render = !render; } berusky2-0.12/src/komat/obbo.h0000644000175000017500000001446013674426075013142 00000000000000/* OBB a jeho stromy */ #ifndef __OBB_OLD_H__ #define __OBB_OLD_H__ void obb_body(OBB_OLD * p_obbs); int obb_intersect_obb(OBB_OLD * p_obb1, OBB_OLD * p_obb2); int obb_intersect_line(OBB_OLD * p_obb, BOD * p_orig, BOD * p_dir); int obb_intersect_line_dist(OBB_OLD * p_obb, BOD * p_orig, BOD * p_dir); void obb_obalka(GLMATRIX * p_mat, OBB_OLD * p_obb, BOD * p_min, BOD * p_max); void obb_slep(OBB_OLD * p_vys, OBB_OLD * p_list, int num); void obb_slep_aabb(OBB_OLD * p_vys, OBB_OLD * p_list, int num); float obb_calc_obalka_obj(EDIT_OBJEKT * p_obj, BOD * p_vx, BOD * p_vy, BOD * p_vz, BOD * p_dist, BOD * p_stred); void obb_calc_obj(EDIT_OBJEKT * p_obj); void obb_calc_obj_fast(EDIT_OBJEKT * p_obj); void obb_calc_kont(EDIT_KONTEJNER * p_kont_top, int precizne); float obb_calc_poly_obalka(EDIT_MESH_POLY * p_poly, BOD * p_vx, BOD * p_vy, BOD * p_vz, BOD * p_dist, BOD * p_stred); void obb_calc_poly(EDIT_MESH_POLY * p_poly); void obb_calc_item(OBB_OLD * p_vys, OBB_TREE_ITEM_OLD * p_item, int itemnum); void obbtree_vyrob(OBB_TREE_OLD * p_prvni, EDIT_MESH_POLY * p_poly, int polynum, GAME_MESH_OLD ** p_mesh, int meshnum, int *p_ind, EDIT_MATERIAL ** p_matlist); void obbtree_vyrob_rec(OBB_TREE_OLD * p_prvni, float max_vzdal); void obbtree_zrus(OBB_TREE_OLD * p_ob); void obbtree_kresli(OBB_TREE_OLD * p_prvni, dword barva); int obb_visibility(OBB_OLD * p_obb, GLMATRIX * p_m); inline float obb_vzdal_bod(OBB_OLD * p_obb, BOD * p_bod); void obb_kresli_obalku(OBB_OLD * p_obb, dword barva, GLMATRIX * p_mat); void obb_prvek(OBB_OLD * p_obb); inline float obb_vzdal_rovina_x(OBB_OLD * p_obb, float x) { float min = p_obb->aabb_min.x, max = p_obb->aabb_max.x; float vzdal1, vzdal2; if (min <= x && x <= max) return (0.0f); else { vzdal1 = fabsf(min - x); vzdal2 = fabsf(max - x); return (vzdal1 > vzdal2 ? vzdal1 : vzdal2); } } inline float obb_vzdal_rovina_y(OBB_OLD * p_obb, float y) { float min = p_obb->aabb_min.y, max = p_obb->aabb_max.y; float vzdal1, vzdal2; if (min <= y && y <= max) return (0.0f); else { vzdal1 = fabsf(min - y); vzdal2 = fabsf(max - y); return (vzdal1 > vzdal2 ? vzdal1 : vzdal2); } } inline float obb_vzdal_rovina_z(OBB_OLD * p_obb, float z) { float min = p_obb->aabb_min.z, max = p_obb->aabb_max.z; float vzdal1, vzdal2; if (min <= z && z <= max) return (0.0f); else { vzdal1 = fabsf(min - z); vzdal2 = fabsf(max - z); return (vzdal1 > vzdal2 ? vzdal1 : vzdal2); } } inline float obb_vzdal_bod(OBB_OLD * p_obb, BOD * p_bod) { BOD v, v1, v2; vektor_sub(p_bod, &p_obb->obb_stred, &v1); v.x = vektor_dot_product(p_obb->obb, &v1); v.y = vektor_dot_product(p_obb->obb + 1, &v1); v.z = vektor_dot_product(p_obb->obb + 2, &v1); v2 = v1; vektor_norm_mult_vektor(&v2, &p_obb->obb_len); if (fabsf(v1.x) <= fabsf(v2.x) && fabsf(v1.y) <= fabsf(v2.y) && fabsf(v1.z) <= fabsf(v2.z)) { return (0.0f); } else { return (vektor_velikost(vektor_sub(&v1, &v2, &v1))); } } inline float obb_vzdal_bod_aabb(OBB_OLD * p_obb, BOD * p_bod) { BOD v1, v2; vektor_sub(p_bod, &p_obb->obb_stred, &v1); v2 = v1; vektor_norm_mult_vektor(&v2, &p_obb->obb_len); if (fabsf(v1.x) <= fabsf(v2.x) && fabsf(v1.y) <= fabsf(v2.y) && fabsf(v1.z) <= fabsf(v2.z)) { return (0.0f); } else { return (vektor_velikost(vektor_sub(&v1, &v2, &v1))); } } inline int obb_je_bod_v_kostce(OBB_OLD * p_obb, BOD * p_bod) { BOD v, v1; BOD *p_len; vektor_sub(p_bod, &p_obb->obb_stred, &v1); v.x = vektor_dot_product(p_obb->obb, &v1); v.y = vektor_dot_product(p_obb->obb + 1, &v1); v.z = vektor_dot_product(p_obb->obb + 2, &v1); p_len = &p_obb->obb_len; if (fabsf(v.x) <= fabsf(p_len->x) && fabsf(v.y) <= fabsf(p_len->y) && fabsf(v.z) <= fabsf(p_len->z)) return (TRUE); else return (FALSE); } inline int obb_je_bod_v_kostce_aabb(OBB_OLD * p_obb, BOD * p_bod) { BOD *p_min = &p_obb->aabb_min; BOD *p_max = &p_obb->aabb_max; return (p_min->x <= p_bod->x && p_bod->x <= p_max->x && p_min->y <= p_bod->y && p_bod->y <= p_max->y && p_min->z <= p_bod->z && p_bod->z <= p_max->z); } inline void obb_aabb_obj(EDIT_OBJEKT * p_obj, OBB_OLD * p_obb) { objekt_obalka(p_obj, NULL, &p_obb->aabb_min, &p_obb->aabb_max); } inline void obb_aabb_poly(EDIT_MESH_POLY * p_poly, OBB_OLD * p_obb) { poly_obalka(p_poly, NULL, &p_obb->aabb_min, &p_obb->aabb_max); } inline void obb_aabb_kont(EDIT_KONTEJNER * p_kont, OBB_OLD * p_obb) { kontejner_obalka_aabb(p_kont, &p_obb->aabb_min, &p_obb->aabb_max); } inline void obb_aabb(OBB_OLD * p_obb) { obb_obalka(NULL, p_obb, &p_obb->aabb_min, &p_obb->aabb_max); } inline void obb_transformuj(OBB_OLD * p_src, GLMATRIX * p_mat, OBB_OLD * p_dest) { GLMATRIX m; BOD a1; float lx, ly, lz; transformuj_bod_matici_bod(&p_src->obb_stred, p_mat, &p_dest->obb_stred); lx = p_src->obb_len.x; ly = p_src->obb_len.y; lz = p_src->obb_len.z; m = *p_mat; m._41 = m._42 = m._43 = 0.0f; if (lx != 0.0f) { vektor_mult_skalar(p_src->obb, lx, &a1); p_dest->obb_len.x = vektor_norm(transformuj_bod_matici_bod(&a1, &m, p_dest->obb)); } else { transformuj_bod_matici_bod(p_src->obb, &m, p_dest->obb); p_dest->obb_len.x = 0.0f; } if (ly != 0.0f) { vektor_mult_skalar(p_src->obb + 1, ly, &a1); p_dest->obb_len.y = vektor_norm(transformuj_bod_matici_bod(&a1, &m, p_dest->obb + 1)); } else { transformuj_bod_matici_bod(p_src->obb + 1, &m, p_dest->obb + 1); p_dest->obb_len.y = 0.0f; } if (lz != 0.0f) { vektor_mult_skalar(p_src->obb + 2, lz, &a1); p_dest->obb_len.z = vektor_norm(transformuj_bod_matici_bod(&a1, &m, p_dest->obb + 2)); } else { transformuj_bod_matici_bod(p_src->obb + 2, &m, p_dest->obb + 2); p_dest->obb_len.z = 0.0f; } obb_body(p_dest); obb_aabb(p_dest); } inline void obb_transformuj_aabb(OBB_OLD * p_src, GLMATRIX * p_mat, OBB_OLD * p_dest) { BOD *p_s1 = p_src->obb_hran, *p_s2 = p_dest->obb_hran; int i; for (i = 0; i < 8; i++) transformuj_bod_matici_bod(p_s1 + i, p_mat, p_s2 + i); obb_aabb(p_dest); } inline void obb_kresli_obalku_obj(EDIT_OBJEKT * p_obj, GLMATRIX * p_mat, dword barva) { obb_kresli_obalku(&p_obj->obb, barva, p_mat); } inline void obb_kresli_obalku_kont(EDIT_KONTEJNER * p_kont, GLMATRIX * p_mat, dword barva) { obb_kresli_obalku(&p_kont->obb, barva, p_mat); } #endif berusky2-0.12/src/komat/3dproject.cpp0000644000175000017500000001357313674426075014455 00000000000000/* Projekcni funkce - rene ja a rudolf, chodivame na golf spec podekovani - */ #include "3d_all.h" int transf_3d_2d_word(float p_x, float p_y, float p_z, int *p_tx, int *p_ty, float *p_tz, GLMATRIX * p_cam, GLMATRIX * p_proj, int x_c, int y_c, int xs, int ys, float z_near, float z_far) { float x, y, z, w, w2; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_cam->_11 * p_x + p_cam->_21 * p_y + p_cam->_31 * p_z + p_cam->_41; y = p_cam->_12 * p_x + p_cam->_22 * p_y + p_cam->_32 * p_z + p_cam->_42; z = p_cam->_13 * p_x + p_cam->_23 * p_y + p_cam->_33 * p_z + p_cam->_43; w = p_cam->_14 * p_x + p_cam->_24 * p_y + p_cam->_34 * p_z + p_cam->_44; p_x = x; p_y = y; p_z = z; w2 = w; x = p_proj->_11 * p_x + p_proj->_21 * p_y + p_proj->_31 * p_z + p_proj->_41 * w2; y = p_proj->_12 * p_x + p_proj->_22 * p_y + p_proj->_32 * p_z + p_proj->_42 * w2; z = p_proj->_13 * p_x + p_proj->_23 * p_y + p_proj->_33 * p_z + p_proj->_43 * w2; w = p_proj->_14 * p_x + p_proj->_24 * p_y + p_proj->_34 * p_z + p_proj->_44 * w2; if (w == 0.0f) return (FALSE); if (-w <= z && z <= w && -w <= x && x <= w && -w < y && y <= w) { *p_tx = ftoi(x_c * (x / w + 1)) + xs; *p_ty = ftoi(y_c * (1 - y / w)) + ys; *p_tz = z_near + ((z / w + 1) * 0.5f) * (z_far - z_near); return (TRUE); } else { return (FALSE); } } int transf_3d_2d(float p_x, float p_y, float p_z, int *p_tx, int *p_ty, float *p_tz, GLMATRIX * p_word, GLMATRIX * p_cam, GLMATRIX * p_proj, int x_c, int y_c, int xs, int ys, float z_near, float z_far) { float x, y, z, w, w2; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_word->_11 * p_x + p_word->_21 * p_y + p_word->_31 * p_z + p_word->_41; y = p_word->_12 * p_x + p_word->_22 * p_y + p_word->_32 * p_z + p_word->_42; z = p_word->_13 * p_x + p_word->_23 * p_y + p_word->_33 * p_z + p_word->_43; w = p_word->_14 * p_x + p_word->_24 * p_y + p_word->_34 * p_z + p_word->_44; p_x = p_cam->_11 * x + p_cam->_21 * y + p_cam->_31 * z + p_cam->_41 * w; p_y = p_cam->_12 * x + p_cam->_22 * y + p_cam->_32 * z + p_cam->_42 * w; p_z = p_cam->_13 * x + p_cam->_23 * y + p_cam->_33 * z + p_cam->_43 * w; w2 = p_cam->_14 * x + p_cam->_24 * y + p_cam->_34 * z + p_cam->_44 * w; x = p_proj->_11 * p_x + p_proj->_21 * p_y + p_proj->_31 * p_z + p_proj->_41 * w2; y = p_proj->_12 * p_x + p_proj->_22 * p_y + p_proj->_32 * p_z + p_proj->_42 * w2; z = p_proj->_13 * p_x + p_proj->_23 * p_y + p_proj->_33 * p_z + p_proj->_43 * w2; w = p_proj->_14 * p_x + p_proj->_24 * p_y + p_proj->_34 * p_z + p_proj->_44 * w2; if (w == 0.0f) return (FALSE); if (-w <= z && z <= w && -w <= x && x <= w && -w < y && y <= w) { *p_tx = ftoi(x_c * (x / w + 1)) + xs; *p_ty = ftoi(y_c * (1 - y / w)) + ys; *p_tz = z_near + ((z / w + 1) * 0.5f) * (z_far - z_near); return (TRUE); } else { return (FALSE); } } void transf_2d_3d(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys) { GLMATRIX m, mi; float x, y, z; float x3, y3, z3, w3; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_x / x_c - 1; y = 1 - p_y / y_c; z = 2 * p_z - 1; glu_invert_matrix(mat_mult(p_cam, p_proj, &mi), &m); x3 = m._11 * x + m._21 * y + m._31 * z + m._41; y3 = m._12 * x + m._22 * y + m._32 * z + m._42; z3 = m._13 * x + m._23 * y + m._33 * z + m._43; w3 = m._14 * x + m._24 * y + m._34 * z + m._44; *p_tx = x3 / w3; *p_ty = y3 / w3; *p_tz = z3 / w3; } /* Problem -> 2D ->3D */ void transf_2d_3d_z(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far) { GLMATRIX m, mi; float x, y, z, a, b, c; float x3, y3, z3, w3; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_x / x_c - 1; y = 1 - p_y / y_c; c = z_far - z_near; a = (z_near + z_far) / c; b = -(z_near * z_far) / c; z = a + b / p_z; glu_invert_matrix(mat_mult(p_cam, p_proj, &mi), &m); x3 = m._11 * x + m._21 * y + m._31 * z + m._41; y3 = m._12 * x + m._22 * y + m._32 * z + m._42; z3 = m._13 * x + m._23 * y + m._33 * z + m._43; w3 = m._14 * x + m._24 * y + m._34 * z + m._44; *p_tx = x3 / w3; *p_ty = y3 / w3; *p_tz = z3 / w3; } void transf_2d_3d_world(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_world, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys) { GLMATRIX m, mi; float x, y, z, w; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_x / x_c - 1; y = 1 - p_y / y_c; z = 2 * p_z - 1; mat_mult(p_world, p_cam, &m); mat_mult(&m, p_proj, &mi); glu_invert_matrix(&mi, &m); w = m._14 * x + m._24 * y + m._34 * z + m._44; *p_tx = (m._11 * x + m._21 * y + m._31 * z + m._41) / w; *p_ty = (m._12 * x + m._22 * y + m._32 * z + m._42) / w; *p_tz = (m._13 * x + m._23 * y + m._33 * z + m._43) / w; } void transf_2d_3d_z_world(float p_x, float p_y, float p_z, float *p_tx, float *p_ty, float *p_tz, GLMATRIX * p_world, GLMATRIX * p_cam, GLMATRIX * p_proj, dword x_c, dword y_c, dword xs, dword ys, float z_near, float z_far) { GLMATRIX m, mi; float x, y, z; float a, b, c; float x3, y3, z3, w3; x_c >>= 1; y_c >>= 1; p_x -= xs; p_y -= ys; x = p_x / x_c - 1; y = 1 - p_y / y_c; c = z_far - z_near; a = (z_near + z_far) / c; b = -(z_near * z_far) / c; z = a + b / p_z; mat_mult(p_world, p_cam, &m); mat_mult(&m, p_proj, &mi); glu_invert_matrix(&mi, &m); x3 = m._11 * x + m._21 * y + m._31 * z + m._41; y3 = m._12 * x + m._22 * y + m._32 * z + m._42; z3 = m._13 * x + m._23 * y + m._33 * z + m._43; w3 = m._14 * x + m._24 * y + m._34 * z + m._44; *p_tx = x3 / w3; *p_ty = y3 / w3; *p_tz = z3 / w3; } berusky2-0.12/src/komat/json_export.h0000644000175000017500000000375313674426075014576 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __JSON_EXPORT_H__ #define __JSON_EXPORT_H__ void json_export_start(char *p_file); void json_export_end(void); void json_export_kont(EDIT_KONTEJNER *p_kont, EDIT_MATERIAL ** p_mat, int max_mat); void json_export_kont_single(EDIT_KONTEJNER *p_kont, EDIT_MATERIAL ** p_mat, int max_mat); void json_export_materialy(EDIT_MATERIAL ** p_mat, int max_mat); void json_export_light(STATIC_LIGHT * p_light, int lightnum); void json_export_poly(EDIT_MESH_POLY *p_poly, int polynum, EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT *p_light_list); void json_export_level(LEVELINFO * p_Level); void json_export_lightmap(int num, bitmapa *p_bmp); #endif // __JSON_EXPORT_H__ berusky2-0.12/src/komat/mmalloc.h0000644000175000017500000000406013674426075013640 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __MMALLOC_H #define __MMALLOC_H #include #include #include #ifdef __cplusplus extern "C" { #endif void tiskni_chybu(int line, char *p_file, char *p_text, ...); #define STC __LINE__,__FILE__,NULL #define chyba(text) tiskni_chybu(__LINE__,__FILE__,text) #define chybat tiskni_chybu #define chyba_be(text) tiskni_chybu_bez_exit(__LINE__,__FILE__,text) inline void *mmalloc(size_t velikost) { void *p_mem = malloc(velikost); if(p_mem) { memset(p_mem, 0, velikost); return(p_mem); } else { tiskni_chybu(__LINE__, __FILE__, "Unable to allocate %d bytes", velikost); return(NULL); } } #ifdef __cplusplus } #endif #endif berusky2-0.12/src/komat/Berusky3d_load.h0000644000175000017500000000350413674426075015070 00000000000000/* Berusky */ #ifndef __BERUSKY_3D_LOAD #define __BERUSKY_3D_LOAD typedef struct _GAMESLOT { char jmeno[30]; int vzor; GLMATRIX word; char rezerved[10]; } GAMESLOT; int ber_load_level(G_KONFIG * p_ber, char *p_file); int ber_pridej_prvek_databaze(G_KONFIG * p_ber, SECONDDATADESC * p_scd, int guid); void ber_zrus_level(G_KONFIG * p_ber); PRVEK_LEVELU_GAME **vyrob_level(int x, int y, int z); void ber_vyrob_level(G_KONFIG * p_ber, int x, int y, int z); int ber_prvek_disk_do_bunky(G_KONFIG * p_ber, BUNKA_LEVELU_DISK * p_disk, MeshHandle *p_handle, int ID, int x, int y, int z); int ber_je_objekt_voda(int guid); int ber_nahraj_materialy(G_KONFIG * p_ber, char *p_jmeno, char *p_dir); int ber_nahraj_scenu(G_KONFIG * p_ber, char *p_jmeno, char *p_dir, int reload, BUNKA_LEVELU_DISK * p_berusky, int bernum); void ber_nahraj_poly(G_KONFIG * p_ber, char *p_jmeno, char *p_dir); int ber_nahraj_materialy_frame_animace(G_KONFIG * p_ber, char *p_jmeno, char *p_dir); void ber_nahraj_lightmap(G_KONFIG * p_ber, char *p_jmeno, char *p_dir); bool ber_nahraj_mesh(G_KONFIG * p_ber, char *p_jmeno, GAME_MESH_OLD ** p_mesh, int json_export = FALSE); void ber_velikost_sceny(G_KONFIG * p_ber); void ber_umisti_prvek(MeshHandle handle, int x, int y, int z, int rotace); void ber_umisti_prvek_abs(PRVEK_LEVELU_GAME * p_lev, float x, float y, float z, int rotace); int ber_mesh_do_bunky(G_KONFIG * p_ber, int mesh, int *p_handle); GAME_MESH_OLD **ber_mesh_vyber_staticke(G_KONFIG * p_ber, int *p_snum, int **p_indexy); int ber_uprava_materialu_bump_mapping(G_KONFIG * p_ber); inline int ber_je_mesh_beruska_fast(GAME_MESH_OLD * p_mesh) { return (p_mesh->p_data->k2flag & KONT2_BERUSKA); } inline int ber_je_mesh_prvek_fast(GAME_MESH_OLD * p_mesh) { return ((p_mesh->p_data->kflag) & KONT_PRVEK); } #define JMENO_KURZOR "sv2.b2m" #endif berusky2-0.12/src/komat/Berusky3d_light.h0000644000175000017500000002023613674426075015261 00000000000000/* Svetla.h */ #ifndef __BERUSKY_3D_LIGHT #define __BERUSKY_3D_LIGHT /*********************************************************************** Dynamicka svetla - scena ********************************************************************** */ /* Prace se scenou */ void dl_scena_set_diff(float r, float g, float b, float a); void dl_scena_add_diff(float r, float g, float b, float a); void dl_scena_modulate_spec(float r, float g, float b, float a); void dl_scena_set_spec(float r, float g, float b, float a); void dl_scena_add_spec(float r, float g, float b, float a); void dl_scena_set_ambient(float r, float g, float b, float a); /* Prace s meshama */ int dl_mesh_modulate_diff(MeshHandle mh, float r, float g, float b, float a); int dl_mesh_set_diff(MeshHandle mh, float r, float g, float b, float a); int dl_mesh_add_diff(MeshHandle mh, float r, float g, float b, float a); int dl_mesh_modulate_spec(MeshHandle mh, float r, float g, float b, float a); int dl_mesh_set_spec(MeshHandle mh, float r, float g, float b, float a); int dl_mesh_add_spec(MeshHandle mh, float r, float g, float b, float a); /* ******************************************************** Dyn. svetla - jednoducha ******************************************************** */ #define SDL_ADD_SUB 0x00000080 // svetlo pracuje v komplementarnim add/sub modu #define SDL_MESH 0x00000100 // svetlo patri k urcitemu meshi #define SDL_SUB 0x00000200 // svetla se nepricitaji ale moduluji #define SDL_UTLUM_LINEAR 0x00000400 // linearni utlum - defaultni #define SDL_UTLUM_KVADRATIC 0x00000800 // kvadraticky utlum /* Moje flagy */ #define SDL_REMOVE 0x10000000 // svetlo se ma smazat #define SDL_ANIMACE 0x20000000 // svetlo se prave animuje #define SDL_ZMENA_LOKAL 0x40000000 // lokalni zmena svetla #define SDL_ZMENA_GLOBAL 0x80000000 // globalni zmena svetla #define SDL_KOFOLA 0x08000000 // kofolovo svetlo /* Nacteni seznamu existujich dynamickych svetel */ typedef struct _LIGHT_INFO { int light_handle; // handle na svetlo (dynamicke/extra dynamicke) char jmeno[MAX_JMENO]; // jeho jmeno int kof_cislo; // kofolovo cislo svetla } LIGHT_INFO; // cte obycejna svetla int sdl_get_num(void); int sdl_get_list(LIGHT_INFO * p_li, int max); // cte extra svetla int edl_get_num(void); int edl_get_list(LIGHT_INFO * p_li, int max); /* Vyrobi/zrusi svetlo */ LightHandle sdl_svetlo_vyrob(dword flag); LightHandle sdl_svetlo_pojmenuj(LightHandle handle, char *p_jmeno); int sdl_svetlo_zrus(LightHandle handle); /* Jednorazove nastaveni */ LightHandle sdl_svetlo_set_pos(LightHandle lh, BOD * p_bod); LightHandle sdl_svetlo_set_pos_ext(LightHandle lh, float x, float y, float z); LightHandle sdl_svetlo_set_diff(LightHandle lh, float dr, float dg, float db, float min, float max, float dosah); LightHandle sdl_svetlo_set_diff_sub(LightHandle lh, float sr, float sg, float sb); /* Jednoducha animace - od katualniho nastaveni po nove s autoremove */ RunHandle sdl_svetlo_anim(LightHandle handle, BOD * p_bod, float dr, float dg, float db, float da, float dosah, float min, float max, int flag, int *p_flag, int framenum); /* Animace svetel */ LightHandle sdl_anim_vyrob(LightHandle lh, int framenum, int pos_keys, int diff_keys, int dosah_keys); LightHandle sdl_anim_zrus(LightHandle lh); LightHandle sdl_anim_vloz_klic_posun(LightHandle lh, int klic, float x, float y, float z, int frame); LightHandle sdl_anim_vloz_klic_posun_bod(LightHandle lh, int klic, BOD * p_p, int frame); LightHandle sdl_anim_vloz_klic_diff(LightHandle lh, int klic, float r, float g, float b, float a, int frame); LightHandle sdl_anim_vloz_klic_vzdal(LightHandle lh, int klic, float dosah, float min, float max, int frame); /* Run/Stop animaci Akceptovane flagy do promenne flag: GK_LOOP - animace se bude opakovat GK_REMOVE - animace se po dobehnuti smaze i se svetlem */ LightHandle sdl_anim_start(LightHandle lh, int *p_flag, int flag, int start, int stop); int sdl_anim_stop(LightHandle rh); void sdla_animaci_zrus_online(DYN_LIGHT_ANIM * p_an); /* ******************************************************** Dyn. svetla - extra svetla, v akci na: - diffusni svetla - spekularni svetla - textury u1 - env/flat mapping - textury u2 */ // Nahraje svetlo ze sim animace ExtraLightHandle edl_svetlo_nahraj(char *p_file); // Vyrobi/Zrusi svetlo // Prida/Odebere meshe svetla ExtraLightHandle edl_svetlo_vyrob(dword flag, int meshnum); ExtraLightHandle edl_svetlo_vyrob_zemni_mlha(dword barva, float v_start, float v_stop, float h_start, float h_stop); int edl_svetlo_zrus(ExtraLightHandle handle); ExtraLightHandle edl_svetlo_pridej_mesh(ExtraLightHandle lh, MeshHandle mh); ExtraLightHandle edl_svetlo_uzavri_meshe(ExtraLightHandle lh); ExtraLightHandle edl_svetlo_zrus_meshe(ExtraLightHandle lh); // Jednorazove nastaveni ExtraLightHandle edl_svetlo_set_pos(ExtraLightHandle lh, BOD * p_bod, BOD * p_dir); ExtraLightHandle edl_svetlo_set_pos_ext(ExtraLightHandle lh, float px, float py, float pz, float dx, float dy, float dz); ExtraLightHandle edl_svetlo_set_par(ExtraLightHandle lh, float utlum, float dosah, float theta, float gourand); ExtraLightHandle edl_svetlo_set_diff(ExtraLightHandle lh, float da); ExtraLightHandle edl_svetlo_set_spec(ExtraLightHandle lh, float sr, float sg, float sb); // Slozite animace svetel ExtraLightHandle edl_anim_vyrob(ExtraLightHandle lh, int framenum, int pos_keys, int dir_keys, int diff_keys, int spec_keys, int dosah_keys); ExtraLightHandle edl_anim_zrus(ExtraLightHandle lh); ExtraLightHandle edl_anim_vloz_klic_posun(ExtraLightHandle lh, int klic, float x, float y, float z, int frame); ExtraLightHandle edl_anim_vloz_klic_posun_bod(ExtraLightHandle lh, int klic, BOD * p_p, int frame); ExtraLightHandle edl_anim_vloz_klic_dir(ExtraLightHandle lh, int klic, float x, float y, float z, int frame); ExtraLightHandle edl_anim_vloz_klic_dir_bod(ExtraLightHandle lh, int klic, BOD * p_dir, int frame); ExtraLightHandle edl_anim_vloz_klic_diff(ExtraLightHandle lh, int klic, float a, int frame); ExtraLightHandle edl_anim_vloz_klic_spec(ExtraLightHandle lh, int klic, float r, float g, float b, int frame); ExtraLightHandle edl_anim_vloz_klic_vzdal(ExtraLightHandle lh, int klic, float dosah, float k2, float k3, int frame); // Prehravani slozitych animaci svetel ExtraLightHandle edl_anim_start(ExtraLightHandle lh, int *p_flag, int flag, int start, int stop); int edl_anim_stop(ExtraLightHandle rh); /*********************** Servisni rutiny ********************** */ int dl_mesh_pridej_svetla(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh); int edl_mesh_pridej_svetla(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh); int dl_mesh_pripocitej_svetla(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh, int dyn_light, int extra_light, int full_light, int all); void edla_updatuj(G_KONFIG * p_ber); void sdla_updatuj(G_KONFIG * p_ber); void dl_renderuj_svetla(G_KONFIG * p_ber); void dl_updatuj(G_KONFIG * p_ber); /* ***************************************************************************** Flare ***************************************************************************** */ /* Klasicka vyroba/zruseni */ FlareHandle kom_flare_vyrob(int flag); void kom_flare_zrus(FlareHandle fh); /* Nastaveni vlastnosti flare, alfa muze byt GL_ONE,GL_ONE_MINUS_SRC_ALPHA */ FlareHandle kom_flare_set_param(FlareHandle fh, float r, float g, float b, float a, float dx, float dy, int material, int alfa); /* Nastaveni pointeru na vazaci bod */ FlareHandle kom_flare_set_pivot(FlareHandle fh, BOD * p_pivot); /* Nastaveni pevne pozice */ FlareHandle kom_flare_set_pos(FlareHandle fh, BOD * p_pos); /* Nacte pointer flaru pro primou praci s nim */ LENS_FLARE *kom_flare_get_pointer(FlareHandle fh); /* Nastaveni kvality svetel */ void dl_nastav_kvalitu(G_KONFIG * p_ber); void dl_nastav(G_KONFIG * p_ber); /* Reset mlhy */ void mlha_reset(void); /* Rychlosti svetel */ #define LIGHT_ALL 1 // vsechno #define LIGHT_PRVKY 2 // pouze prvky #define LIGHT_VERTEXY 3 // poze vertexove prvky #define LIGHT_NIC 4 // pouze beruska #endif berusky2-0.12/src/komat/Berusky3d_kofola_interface.h0000644000175000017500000007110013674426075017441 00000000000000/* Kofolovo rozhrani - H verze 0.8.0 Poradne si prostuduj ty komentare tady, vsechno sem ti napsal jak se ovlada. */ /* Header files */ #ifndef __BERUSKY3D_KOFOLA_INTERFACE_H__ #define __BERUSKY3D_KOFOLA_INTERFACE_H__ #include #include #include #include "Ddx.h" #include "Di.h" #include "Matrix.h" #include "Object.h" #include "Mat3d.h" #include "Kdtree.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_animace.h" extern G_KONFIG ber, *p_ber; /* Load indicie pro slider - 0-100% */ extern float kom_load_progres; /********************************************************************** Load a zruseni levelu - to je taky urcite jasny ********************************************************************** */ void kom_init_level(LEVEL_HEADER * p_head); // konfiguruje nahravany level, volat pred "void kom_load_level(char *p_file)" void kom_load_level(char *p_file, int zmen_dir, int restart, BUNKA_LEVELU_DISK * p_bunka, int bunek); void kom_post_init_level(void); // konfiguruje level, volat po "void kom_load_level(char *p_file)" void kom_zrus_level(int restart); // rusi level, pokud je to restart tak zrus spec zpusobem int ber_test_zrcadla(void); // Nacte fyzickou souradnici policka levelu BOD *kom_get_fyz_souradnice(int x, int y, int z, BOD * p_bod); /********************************************************************** Hledaci funkce ********************************************************************** */ // Hleda material podle jeho jmena, K_CHYBA pri neuspechu MatHandle kom_najdi_material(char *p_jmeno); // Vrati pointer na material - strkat do flaru EDIT_MATERIAL *kom_preloz_material(MatHandle mh); // Hleda meshe prvku MeshHandle kom_najdi_mesh_prvek(char *p_jmeno); /********************************************************************** Herni prvky a predmety ********************************************************************** */ /* load/ruseni */ MeshHandle kom_pridej_prvek_levelu(BUNKA_LEVELU_DISK * p_bunka, int x, int y, int z); MeshHandle kom_pridej_prvek_levelu_disk(char *p_file, BUNKA_LEVELU_DISK * p_bunka, int x, int y, int z); /* Vlozis jmeno kontejneru co chces najit a on ti z nejvyrobi prvek levelu. vraci K_CHYBA pokud nenasel kontejner toho jmena */ MeshHandle kom_pridej_mesh_do_levelu(char *p_jmeno); void kom_zrus_prvek(MeshHandle prvek_handle); ExMeshHandle kom_najdi_mesh(char *p_jmeno); /* Nastavi pivot point pro prvek, prepise nastaveni pivotu u sim animace pokud to nepojede, dej vedet... */ int kom_mesh_set_pivot_bod(MeshHandle prvek_handle, BOD * p_bod); int kom_mesh_set_pivot(MeshHandle prvek_handle, float x, float y, float z); int kom_mesh_get_pivot(MeshHandle prvek_handle, BOD * p_pivot); /* Nastaveni aktivniho meshe u multi-mesh meshu */ MeshHandle kom_mesh_set_mesh(MeshHandle mh, int ID, size_ptr rotace); /* Cte okamzite fyzicke!!! umisteni prvku ve scene + jeho rotaci Tato pozice zavisi take na umisteni levelu a velikosti hernich policek Tuto pozici pouzivam pro urcovani viditelnosti prvku a odpovida stredu policka kde je prvek umisten. Tato pozice se meni v realnem case pri behu animaci */ int kom_mesh_get_float(MeshHandle prvek_handle, float *p_x, float *p_y, float *p_z, int *p_rotace); /* Cte logicke umisteni prvku v levelu + jeho rotaci Vsechny prvky vraci v 0 vrstve, takze y je 0,2,4,6,... */ int kom_mesh_get_int(MeshHandle prvek_handle, int *p_x, int *p_y, int *p_z, int *p_rotace); /* Resetuje umisteni prvku ve scene Rika animacim, na ktere logicke souradnici je prvek umisten a ze jej ma na tuto pozici resetovat. Prvek bude mit stred (0,0,0) na zadanych logickych souradnicich jako by byl vlozen znova do levelu. Typicky tuto funkci zavolej, pokud se prvek nejak otoci a ty ho chces resetovat na defaultni smer rotace */ int kom_mesh_reset_pr(MeshHandle prvek_handle, int x, int y, int z, int rotace); /* Nastavi no-test flag (u vody) */ int kom_mesh_set_no_test(MeshHandle prvek_handle); /* Vrati savovaci cislo meshe (cislo ktere se strka do ukladacich struktur) */ int kom_mesh_get_save_num(MeshHandle prvek_handle); /* Sladi logicke umisteni prvku s jeho fyzickym umistenim */ inline int kom_mesh_reset(MeshHandle prvek_handle) { int x, y, z, rotace; kom_mesh_get_int(prvek_handle, &x, &y, &z, &rotace); kom_mesh_reset_pr(prvek_handle, x, y, z, rotace); return (TRUE); } /* Premisteni prvku - Presune prvek na zadanou pozici */ #define kom_umisti_prvek(prvek_handle,x,y,z,rotace) ber_umisti_prvek(prvek_handle,x,y,z,rotace) int kom_get_mesh_id(MeshHandle prvek_handle); /* Databaze -> vznikani prvku z databaze za behu Vlozi prvek do databaze, ze ktere muze byt behem hry zkopirovan do levelu */ DataHandle kom_pridej_prvek_do_databaze(SECONDDATADESC * p_sec); /* Kopiruje a umisti prvek z databaze do levelu. Kazdy prvek muzes kopirovat kolikrat chces. */ MeshHandle kom_vloz_prvek_z_databaze(DataHandle data_handle, int x, int y, int z, int rotace, int guid); /*********************************************************************** Kresleni levelu *********************************************************************** */ void kom_klavesy_hra(void); void ber_renderuj_scenu(void); #define kom_kresli_level() ber_renderuj_scenu() /*********************************************************************** Animace materialu *********************************************************************** */ /* Nacte handle materilove animace konkretniho meshe a jeho podobjektu */ MatHandle kom_amat_mesh_get(MeshHandle mesh, int objekt); /* Cte pocet materialovych animaci */ int kom_amat_mesh_get_num(void); typedef struct _MATERIAL_BUNKA { MatHandle handle_materialove_animace; MeshHandle handle_meshe; int cislo_objektu; } MATERIAL_BUNKA; /* Vrati vsechny materialove animace ve scene, uklada do bunek o dvojicich mesh_handle,objekt p_bunky musi byt predem naalokovany */ int kom_amat_mesh_get_all(MATERIAL_BUNKA * p_bunky); /* Nastavi frame materialove animace */ int kom_amat_set_frame(MatHandle handle, int frame); /* Vyvola udalost v materialove animaci */ int kom_amat_event(MatHandle handle); /* Cte stav animace 0 = stoji 1 = bezi */ int kom_amat_get(MatHandle handle); /* Vrati cislo kontejneru k meshi */ int kom_amat_get_kontejner(MeshHandle mh); /* Vrati pocet materialu konkretniho meshe */ int kom_mesh_get_matnum(MeshHandle mh); /* Naplni pole handlu materialu */ int kom_mesh_get_mat(MeshHandle mh, MatHandle * p_mat); /* Vrati jmeno konkretniho materialu */ char *kom_get_mat_jmeno(MatHandle mh, char *p_buffer, int max_znaku); /********************************************************************** Makra pro prevod framu na cas a zpet **********************************************************************/ // prevod frame->cas(sec) #define FRAME2SEC(frame) ((frame)/FRAMU_PER_SEC) // prevod cas(sec)->frame #define SEC2FRAME(sec) ((sec)*FRAMU_PER_SEC) /*********************************************************************** Vyroba animaci hernich prvku *********************************************************************** */ AnimHandle sim_nahraj_animaci(char *p_dir, char *p_jmeno, int linearne); AnimHandle sim_vyrob_animaci(int pos_key, int rot_key, int scale_key); AnimHandle sim_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle sim_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD * p_p, int frame); AnimHandle sim_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle sim_vloz_klic_rotace(AnimHandle handle, int klic, BOD * p_osa, float uhel, int frame); AnimHandle sim_vloz_klic_rotace_quat(AnimHandle handle, int klic, QUAT * p_q, int frame); AnimHandle sim_vloz_klic_rotace_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle sim_vloz_klic_scale(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle sim_vloz_klic_scale_bod(AnimHandle handle, int klic, BOD * p_scs, int frame); AnimHandle sim_vloz_klic_scale_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle sim_vloz_pivot(AnimHandle handle, float x, float y, float z); AnimHandle sim_vloz_pivot_bod(AnimHandle handle, BOD * p_bod); AnimHandle sim_interpoluj_animaci(AnimHandle handle, int framenum, int loop); AnimHandle sim_zrus_animaci(AnimHandle handle); /*********************************************************************** Run Animace *********************************************************************** */ #define MESH_PRVEK 0x1 // interni #define MESH_LOCAL_MATRIX 0x2 // interni #define MESH_MULT_MATRIX 0x4 // interni #define MESH_USE_MATRIX 0x8 // interni #define MESH_PIVOT 0x20 // interni #define MESH_TRANSFORMUJ_PIVOT 0x10 // interni #define MESH_KAMERA 0x40 // je to kamera RunHandle rani_aktivuj(AnimHandle shandle, int *p_flag, int flag, int start, int stop); /* Stejne jako rani_aktivuj, jenom se nespusti. Musis ji ructe spustit funkci RunHandle rani_go(RunHandle ah, int flag, int start, int stop), kde flag,start,stop jsou flagy co jinak strkas do te rani_aktivuj() a ah je handle run animace kterou ti vrati to rani_aktivuj */ RunHandle rani_aktivuj_cekej(AnimHandle shandle, int *p_flag); /* Pripoji na run animaci funkci p_fce, funkce je ve tvaru: void moje_funkce(int param, void *p_param) pokud p_fce = NULL tak nastavenou funkci zase smazes privazat ji muzes kdykoliv v prubehu animace, ale samozrejme ze to musis stihnout do konce animace, jinak se ti nezavola ty promeny param, p_param ti do te funkce strcim. */ RunHandle rani_pripoj_funkci(RunHandle a_handle, END_FUNKCE p_fce, size_ptr param, size_ptr param2, size_ptr param3); /* Pripoji na run animaci dalsi run animaci s handlem next_ah, po skonceni animace ah se zavola automaticky funkce rani_go takto: rani_go(next_ah, flag, start, stop); cimz se automaticky spusti animace next_ah. pokud next_ah = NULL tak se fronta vymaze. Je jedno jestli animace ah bezi nebo stoji. */ RunHandle rani_next_animace(RunHandle ah, RunHandle next_ah, int flag, int start, int stop); /* Jedina zmena - promena transformuj_pivot = 1 znamena ze pivot se ma transformovat do souradnic meshe. zere to trochu pri privazovani cas, takze to nepouzivej pokud ten mesh je resetovanej */ MatrixHandle rani_privaz_mesh(RunHandle a_handle, MeshHandle m_handle, int transformuj_pivot); MatrixHandle rani_privaz_kameru(RunHandle a_handle); MatrixHandle rani_privaz_svetlo(RunHandle a_handle, LightHandle l_handle); RunHandle rani_rozvaz(RunHandle a_handle, MatrixHandle m_handle); // Znovu spousti uz dobehnutou nebo jeste nespustenou run animaci RunHandle rani_go(RunHandle ah, int flag, int start, int stop); // Zrusi run animaci int rani_zrus(RunHandle ahandle); /*********************************************************************** Vazani meshu dohromady -> top mesh je pod low meshem *********************************************************************** */ int kom_svaz_meshe(MeshHandle m_top, MeshHandle m_low); int kom_rozvaz_mesh(MeshHandle m_low); /*********************************************************************** Lokalni animace meshu (lokani key-frame animace) *********************************************************************** */ MeshHandle lani_set(MeshHandle mh, int poradi, int c_anim, int *p_flag, int flag, int start, int stop); MeshHandle lani_smaz_frontu(MeshHandle mh); MeshHandle lani_next(MeshHandle mh); int lani_get(MeshHandle mh); /******************************************************************************* Rezimy kamer: 1. Polarni rezim: Kamera je zadana pomozi 3 parametru bod - Stredovy bod kolem ktereho se kamera otaci r - uhel otoceni kamery kolem osy Y (pravo/levo) fi - uhel otoceni kamery kolem osy X (nahoru/dolu) vzdal - vzdalenost od bodu 2. 3DS Rezim Kamera je zadana pomoci 2 bodu a 1 nebo 2 uhlu Position - Bod kde lezi kamera Target - Bod kam se kamera diva Roll - Rotace kamery kolem osy kterou se diva (otaci se jakoby kolem stredu obrazovky) Fov - Field-Of-View (perspektiva/zoom kamery - je defaultne nastavene, vetsinou neni potreba) Rezimy (polar/3ds) se prepinaji automaticky podle toho kterou funkci pouzijes. Ovladani kamer: * Nacteni orientace kamery (vsechny rezimy) void kam_get_float(float *p_body); Smer pohledu kamery - (p_body[0],p_body[1],p_body[2]) Smer nahoru kamery - (p_body[3],p_body[4],p_body[5]) * Nastaveni / Cteni orientace kamery 1. Nastaveni souradnic kamery int kam_pol_set(BOD *p_p, float r, float fi, float vzdal); int kam_3ds_set(BOD *p_pos, BOD *p_target, float roll); 2. Pricteni k aktualnimu nastaveni kamery Pokud chces pricist vzdalenost nebo otocit kameru o 90 stupnu tak toto jsou idelani funkce. Ty hodnoty se prictou k aktualnimu nastaveni int kam_pol_add(BOD *p_p, float r, float fi, float vzdal); int kam_3ds_add(BOD *p_pos, BOD *p_target, float roll); 3. Nacteni aktualniho stavu kamery Vraci nastaveni kamery v 3ds nebo polarnich souradnicich int kam_pol_get(BOD *p_p, float *p_r, float *p_fi, float *p_vzdal); int kam_3ds_get(BOD *p_pos, BOD *p_target, float *p_roll); * Jednoduche animace kamer Tohle jsou rychle a jednoduche animace, kdy zadas kam se ma kamera presunout, strcis ji promenou do ktere zapisuje stav animace (jestli uz kamera dobehla nebo ne) a vsechno bezi mimo tebe. Po dobehnuti se animace sama smaze, takze se nemusis o nic uz starat. Jako vychozi pozice animace se pouzije aktualni nastaveni kamery, jako cil se pouzije to co zadas. To RunHandle vubec nemusis nijak kontrolovat. 1. Nastavovaci funkce Tyhle funkce pracuji aktulani_pozice -> zadana_pozice. Parametry: *p_flag - promena (globalni! ne lokalni zasobnikova), kam kamera haze stav animace, 0..100 procenta ubehle animace (50 = 1/2 animace) -1 = konec animace, animace skoncila flag - flag animace, tady 0 framenum - pocet framu animace, 20 framu = 1 sec. tension - tenze animace, je od -1.0f do 1.0f, 0 = default znamena to jak rychle bude animace zacinat/koncit. vetsinou pouzivam 1.0f coz vypada celkem pekne. Zbyle 4(3) parametry jsou cilove nastaveni kamery. RunHandle kam_pol_anim(BOD *p_p, float r, float fi, float vzdal, int *p_flag, int flag, int framenum, float tension); RunHandle kam_3ds_anim(BOD *p_p, BOD *p_t, float roll, int *p_flag, int flag, int framenum, float tension); 2. Pricitaci funkce Tyhle funkce jsou uplne stejne jako predchozi, ale zadane hodnoty se prictou k aktualnimu nastaveni kamery. (takze pokud chces otocit animovane kameru o 90 stupnu, priblizit/vzdalit a pod. tak timto) RunHandle kam_pol_anim_add(BOD *p_p, float r, float fi, float vzdal, int *p_flag, int flag, int framenum, float tension); RunHandle kam_3ds_anim_add(BOD *p_p, BOD *p_t, float roll, int *p_flag, int flag, int framenum, float tension); * Uplne animace kamer Funguji uplne stejne jako ty na mesh. Vyrobis si animaci, vlozis klice ktere nemusis interpolovat a rovnou to spustis. Animaci kamer muze byt vice ale beze muze jen jedna. 1. Vyrobeni animace Vraci klasicke hadle na animaci AnimHandle kam_pol_vyrob_animaci(int framenum, int pos_keys, int rot_keys, int vzdal_keys); (rot keys jsou klice rotace r a fi, tyto 2 uhly se zadavaji dohromady) AnimHandle kam_3ds_vyrob_animaci(int framenum, int pos_keys, int target_keys, int roll_keys, int fov_keys); 2. Nahrani animace Kdyz si animaci udelas v editoru, muzes si ju imto nahrat: AnimHandle kam_3ds_nahraj_animaci(char *p_jmeno); 3. Vlozeni klicu polarnich klicu AnimHandle kam_pol_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle kam_pol_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD *p_p, int frame); AnimHandle kam_pol_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_pol_vloz_klic_rotace(AnimHandle handle, int klic, float r, float fi, int frame); AnimHandle kam_pol_vloz_klic_rotace_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_pol_vloz_klic_vzdal(AnimHandle handle, int klic, float vzdal, int frame, float tension, float continuity, float bias); AnimHandle kam_pol_vloz_klic_all(AnimHandle handle, int klic, BOD *p_p, float r, float fi, float vzdal, int frame, float tension); 3ds klicu AnimHandle kam_3ds_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle kam_3ds_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD *p_p, int frame); AnimHandle kam_3ds_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_target(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle kam_3ds_vloz_klic_target_bod(AnimHandle handle, int klic, BOD *p_target, int frame); AnimHandle kam_3ds_vloz_klic_target_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_roll(AnimHandle handle, int klic, float roll, int frame, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_fov(AnimHandle handle, int klic, float fov, int frame, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_all(AnimHandle handle, int klic, BOD *p_p, BOD *p_t, float roll, int frame, float tension); Promene ve funkcich sou parametry jsou od -1.0f do 1.0f pro kazdy klic a znamenaji: tension - Jak silne bude animace v tomto bode zrychlovat/zpomalovat continuity - Spojitost v tomto bode (tj. velikost zrychlen) bias - Jak silne bude animace v tomto bode pokracovat ve svem puvodnim smeru 0 = defaultni nastaveni pro vsechny (kdyz je nezadas tak jsou nulove) vic info je ve poc. grafice (ta hneda knizka) na strane 361/Pocitacova animace 4. Zruseni animace (3ds i polarni) AnimHandle kam_zrus_animaci(AnimHandle handle); 5. Prehrani animace RunHandle kam_start(AnimHandle a_handle, int *p_flag, int flag, int start, int stop); Spusti animaci s handle a_handle. Parametry jsou a_handle - AnimHandle animace *p_flag - promena (globalni! ne lokalni zasobnikova), kam kamera haze stav animace, 0..100 procenta ubehle animace (50 = 1/2 animace) -1 = konec animace, animace skoncila flag - flag animace, muze byt GK_LOOP|GK_REMOVE kde: GK_LOOP - animace se bude opakovat GK_REMOVE - animace se po skonceni automaticky smaze start - frame od ktereho se ma animovat stop - frame do ktereho ma animace bezet (0 = az do konce) 6. Stop animace void kam_stop(void); Pokud animace bezi, muzes ji zastavit touto funkci. Pokud animace skonci (*p_flag = -1) tak uz nebezi a tuto funkci nevolej, uz se volala :) Pokud do startu das flag GK_REMOVE, v teto funkci se animace taky smaze. Nepredava se handle, protoze nezet muze jen 1 animace kamery ******************************************************************************* */ // Interni flagy #define GAME_KAMERA_POLAR 0x1 // kamera je v polarnim modu #define GAME_KAMERA_3DS 0x2 // kamera je v 3ds modu #define GAME_KAMERA_ANIMACE 0x4 // kamera se prave animuje #define GAME_KAMERA_KOREKCE 0x8 // kamera se koriguje /* Konstanty predavane do promene flag */ #ifndef GK_LOOP #define GK_LOOP 0x100 // Run-animace se prehrava furt dokola #endif #ifndef GK_REMOVE #define GK_REMOVE 0x200 // Animace se po dobehnuti automaticky smaze #endif // Nacte vektory kamery void kam_get_float(float *p_body); // Nacte vektory kamery + pozici void kam_get_float_ext(float *p_dir, float *p_pos); // nastaveni, pricteni a nacteni kamery v polarnich souradnicich int kam_pol_set(BOD * p_p, float r, float fi, float vzdal, int korekce); int kam_pol_add(BOD * p_p, float r, float fi, float vzdal, int korekce); int kam_pol_get(BOD * p_p, float *p_r, float *p_fi, float *p_vzdal); // nastaveni, pricteni a nacteni kamery v 3ds souradnicich int kam_3ds_set(BOD * p_pos, BOD * p_target, float roll); int kam_3ds_add(BOD * p_pos, BOD * p_target, float roll); int kam_3ds_get(BOD * p_pos, BOD * p_target, float *p_roll); // Jednoduche animace kamer (odkud-kam) - samorusici se // flag musi byt staticka/globalni promena (ne zasobnikova!!) RunHandle kam_pol_anim(BOD * p_p, float r, float fi, float vzdal, int *p_flag, int flag, int framenum, float tension); RunHandle kam_pol_anim_add(BOD * p_p, float r, float fi, float vzdal, int *p_flag, int flag, int framenum, float tension); RunHandle kam_3ds_anim(BOD * p_p, BOD * p_t, float roll, int *p_flag, int flag, int framenum, float tension); RunHandle kam_3ds_anim_add(BOD * p_p, BOD * p_t, float roll, int *p_flag, int flag, int framenum, float tension); // Slozite animace kamer AnimHandle kam_pol_vyrob_animaci(int framenum, int pos_keys, int rot_keys, int vzdal_keys, int korekce); AnimHandle kam_pol_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle kam_pol_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD * p_p, int frame); AnimHandle kam_pol_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_pol_vloz_klic_rotace(AnimHandle handle, int klic, float r, float fi, int frame); AnimHandle kam_pol_vloz_klic_rotace_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_pol_vloz_klic_vzdal(AnimHandle handle, int klic, float vzdal, int frame, float tension, float continuity, float bias); AnimHandle kam_pol_vloz_klic_all(AnimHandle handle, int klic, BOD * p_p, float r, float fi, float vzdal, int frame, float tension); AnimHandle kam_zrus_animaci(AnimHandle handle); AnimHandle kam_3ds_vyrob_animaci(int framenum, int pos_keys, int target_keys, int roll_keys, int fov_keys); AnimHandle kam_3ds_nahraj_animaci(char *p_dir, char *p_jmeno); AnimHandle kam_3ds_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle kam_3ds_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD * p_p, int frame); AnimHandle kam_3ds_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_target(AnimHandle handle, int klic, float x, float y, float z, int frame); AnimHandle kam_3ds_vloz_klic_target_bod(AnimHandle handle, int klic, BOD * p_target, int frame); AnimHandle kam_3ds_vloz_klic_target_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_roll(AnimHandle handle, int klic, float roll, int frame, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_fov(AnimHandle handle, int klic, float fov, int frame, float tension, float continuity, float bias); AnimHandle kam_3ds_vloz_klic_all(AnimHandle handle, int klic, BOD * p_p, BOD * p_t, float roll, int frame, float tension); // Prehravani slozitych animaci kamer RunHandle kam_start(AnimHandle a_handle, int *p_flag, int flag, int start, int stop); void kam_stop(void); // Cteni klicu kamery int kam_3ds_cti_klic(AnimHandle handle, float time, BOD * p_p, BOD * p_t, float *p_roll); int kam_pol_cti_klic(AnimHandle handle, float time, BOD * p_t, float *p_r, float *p_fi, float *p_vzdal); // Servisni funkce void kam_set_mod_param(int mod); // nastavi mod kamery (3ds/polarni) void kam_set_mod_3ds(void); // nastavi 3ds mod kamerty void kam_set_mod_polar(void); // nastavi polarni mod kamery int kam_get_mod(void); // zjisti aktualni mod kamery /*********************************************************************** Nastaveni mlznych kostek *********************************************************************** */ /* Nacte pointer na mlhokostku, ktera se muze libovolne upravovat: typedef struct _MLZNA_KOSTKA { char jmeno[MAX_JMENO];// jmeno mlzne kostky BOD min,max; // rozmery kostky int flag; // flagy mlhy int mod; // mod mlhy (linear/exp/exp2) int priorita; // priorita mlzne kostky float start; // zacatek mlhy float stop; // konec mlhy (za tim je maximalni) float intenzita; // intenzita mlhy (pro exp a pod) float r,g,b,a; // barva struct _MLZNA_KOSTKA *p_next; } MLZNA_KOSTKA; */ MLZNA_KOSTKA *kom_mlhokostka_najdi(char *p_jmeno); /*********************************************************************** Fleky *********************************************************************** */ /* Prida flek do sceny, vrati jeho handle Pokud je MeshHandle == K_CHYBA - je to globani flek jinak je flek privazanej ke konkretnimu meshu uroven je vrstva fleku (0,1,2,..pocet) (kdyz je vice fleku na 1 miste, tak nejspodnejsi ma uroven "0" a nejvyssi uroven "pocet") */ FlekHandle kom_flek_pridej(MeshHandle mh, BOD * p_p, BOD * p_nx, BOD * p_nz, float dx, float dz, int rotace, int uroven, MatHandle material); void kom_flek_zmen(FlekHandle fh, BOD * p_p, BOD * p_nx, BOD * p_nz, float dx, float dz, int rotace, int uroven, MatHandle material); void kom_flek_zrus(FlekHandle fh); int kom_flek_getflag(FlekHandle fh, int flag); int kom_flek_setflag(FlekHandle fh, int flag); #define FLEK_NEKRESLIT 0x1 /*********************************************************************** Chapadelnici *********************************************************************** */ // Cteni animaci sceny ExMeshHandle kom_najdi_mesh_joint(ExMeshHandle * p_next); ExMeshHandle mesh_to_ex_mesh(MeshHandle mh); int chani_mesh_cti_objekty(ExMeshHandle mh); int chani_mesh_cti_chapadelniky(ExMeshHandle mh, int objekt, ChapadloHandle ** p_chap, int *p_chapadel); char *chani_cti_jmeno(ChapadloHandle chh); // Vlozi/Vyhodi animace chapadelnika do aniamcniho seznamu ChapadloHandle chani_zarad(ChapadloHandle chh); ChapadloHandle chani_zrus(ChapadloHandle chh); // Start/Stop animace ChapadloHandle chani_go(ChapadloHandle chh, int *p_flag, int flag, int start, int stop); ChapadloHandle chani_stop(ChapadloHandle chh); /*********************************************************************** Dynamicke svetla - jednoduche *********************************************************************** */ /*********************************************************************** Dynamicke svetla - slozite *********************************************************************** */ /* Kresleni car v levelu */ /* typedef struct _KOFOLOVA_CARA { BOD p1,p2; BODRGB b1,b2; } KOFOLOVA_CARA; */ void kom_set_linelist(KOFOLOVA_CARA * p_list, int pocet); /* Nastaveni zpruhlednovani prvku */ void kom_zpruhlednovat_prvky(int stav); void kom_zpruhlednovat_prvky_zmena_berusky(void); /* Cte stacicitu prvku */ int kom_je_prvek_staticky(int guid); /* FPS */ float kom_get_framerate(void); /* Debug-soubor */ void kprintf(char log, const char *p_text, ...); void kprintfe(char log, const char *p_text, ...); /* Nacte level environment levelu */ LEVEL_ENVIRONMENT *kom_get_level_environment(void); /* Nacte mesh, na ktery ukazuje mys */ MeshHandle kom_get_mesh_mys(int itrida); /* Texture-config */ /* Parametry funkce: mip_mapping = 0/1 (on/off) mip_filtr = 0/1 (linear/trilinear) std_filtr = 0/1 (near/liner) wrap_x/y = 0/1 (clamp/wrap) hi_res = 0/1 */ void kom_set_default_text_config(int mip_mapping, int mip_filtr, int std_filtr, int wrap_x, int wrap_y, int hi_res); /* Load zpet defaultnich hodnot */ void kom_ret_default_text_config(void); /* Nahraje konfiguraci z INI (po zmene hodnot) */ void kom_reload_ini(void); /* Cte velikost levelu */ void kom_get_level_size(BOD * p_min, BOD * p_max); /* Zapne/vypne zpruhlednovac */ void kom_zpruhlednovac_on(void); void kom_zpruhlednovac_off(void); /* Zvyraznovani prvku on/off */ void kom_zvyraznovac(void); /* Load-slidery */ void kom_load_param_set(int tiku); void kom_load_param_fce(void (*p_load_fce) (void)); /* Pridani kurzoru do hry */ MeshHandle kom_pridej_kurzor_do_levelu(void); /* Nastavi viditelnost prvku */ MeshHandle kom_prvek_viditelnost(MeshHandle mh, int vid); /* Zere mesh */ int kom_get_mesh_mys_all(void); /* Dela okno */ //HWND otevri_okno(HINSTANCE handle_aplikace, int full_screen, int dx, int dy, HW_KONFIG *p_conf); #endif berusky2-0.12/src/komat/Load_out.h0000644000175000017500000000054013674426075013761 00000000000000/* Load/save out souboru */ #ifndef __LOAD_OUT_H_ #define __LOAD_OUT_H_ EDIT_KONTEJNER *lo_nahraj_kontejner_out(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_jmeno, int mat); int lo_nahraj_materialy_out_jmeno(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file, int save); #endif berusky2-0.12/src/komat/Ddx.cpp0000644000175000017500000003627613674426075013304 00000000000000/* Interface pro GL */ #include #include "3d_all.h" HW_KONFIG hwconf; TXT_KONFIG txconf; #define FORMATU 24 int cti_texture_format(int format, char *p_string) { int i; int formaty_cisla[FORMATU] = { GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5, GL_RGB8, GL_RGBA8, GL_RGBA8, GL_LUMINANCE8, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE8_ALPHA8, GL_ALPHA8, GL_RGB8, GL_COMPRESSED_RGB_ARB, GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_LUMINANCE_ARB, GL_COMPRESSED_LUMINANCE_ALPHA_ARB, GL_COMPRESSED_LUMINANCE_ALPHA_ARB, GL_COMPRESSED_ALPHA_ARB, GL_RGB5 }; char formaty_stringy[FORMATU][50] = { "GL_RGB5", "GL_RGB5_A1", "GL_RGBA4", "GL_LUMINANCE8", "GL_LUMINANCE6_ALPHA2", "GL_LUMINANCE4_ALPHA4", "GL_ALPHA8", "GL_RGB5", "GL_RGB8", "GL_RGBA8", "GL_RGBA8", "GL_LUMINANCE8", "GL_LUMINANCE8_ALPHA8", "GL_LUMINANCE8_ALPHA8", "GL_ALPHA8", "GL_RGB8", "GL_COMPRESSED_RGB_ARB", "GL_COMPRESSED_RGBA_ARB", "GL_COMPRESSED_RGBA_ARB", "GL_COMPRESSED_LUMINANCE_ARB", "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", "GL_COMPRESSED_ALPHA_ARB", "GL_RGB5" }; for (i = 0; i < FORMATU; i++) { if (formaty_cisla[i] == format) { strcpy(p_string, formaty_stringy[i]); return (TRUE); } } return (FALSE); } int preloz_texture_format(int *p_format, char *p_string) { int i; char format_string[FORMAT_POCET][50] = { "FORMAT_RGB", "FORMAT_RGBA1", "FORMAT_RGBA4", "FORMAT_LUM", "FORMAT_LUM_ALFA1", "FORMAT_LUM_ALFA4", "FORMAT_ALFA", "FORMAT_LIGHTMAPY" }; for (i = 0; i < FORMAT_POCET; i++) { if (!strcasecmp(format_string[i], p_string)) { *p_format = i; return (TRUE); } } *p_format = 0; return (FALSE); } /* Nahravaci retezec textur: 1. Load do raw 2. Orezani na velikost graf karty 3. Vyrobeni mip-mappingu 4. Prevedeni do textur */ void nastav_konfig(HW_KONFIG * p_hwconf, TXT_KONFIG * p_txt) { int max; /* Konfigurace - dithering */ if (p_hwconf->ditering) { glEnable(GL_DITHER); } else { glDisable(GL_DITHER); } kprintf(1, "Text Dithering: %s", p_hwconf->ditering ? "ON" : "OFF"); /* Povoleni Z-bufferu */ glEnable(GL_DEPTH_TEST); /* Alfa-test */ glstav_alfa_test = TRUE; alfa_test_off(); glAlphaFunc(GL_GREATER, 0.5f); /* Nastaveni kvality */ p_txt->text_perspective = TRUE; kprintf(1, "OpenGL Render quality: %s", p_txt->text_kvalita ? "Nicest" : "Fastest"); glHint(GL_POLYGON_SMOOTH_HINT, (p_txt->text_kvalita) ? GL_NICEST : GL_FASTEST); kprintf(1, "Fog type: %s", p_hwconf->typ_mlhy ? "Pixel-Fog" : "Vertex-Fog"); glHint(GL_FOG_HINT, (p_hwconf->typ_mlhy) ? GL_NICEST : GL_FASTEST); /* Maximalni rozmery textur */ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max); kprintf(1, "Text maximal size %d pixels", max); if (max < p_txt->text_max_x) { p_txt->text_max_x = max; } if (max < p_txt->text_max_y) { p_txt->text_max_y = max; } if (p_txt->text_komprese) { if (gl_ext::extlist_text_compresion) { // Komprese je podporovana a povolena p_txt->text_bpp = TEXT_DTX; } } if (p_txt->text_bpp != TEXT_DTX) { if (p_txt->text_bpp_plocha) { kprintf(1, "Text automatic texture depth"); p_txt->text_bpp = p_hwconf->bpp; } kprintf(1, "Text depth %d bpp", p_txt->text_bpp); } else { kprintf(1, "Text DTX compress on", p_txt->text_bpp); } /* Konfigurace formatu textur */ if (p_txt->text_bpp == TEXT_16BPP) { p_txt->format1d[FORMAT_RGB] = p_txt->format2d[FORMAT_RGB] = GL_RGB5; p_txt->format1d[FORMAT_RGBA1] = p_txt->format2d[FORMAT_RGBA1] = GL_RGB5_A1; p_txt->format1d[FORMAT_RGBA4] = p_txt->format2d[FORMAT_RGBA4] = GL_RGBA4; p_txt->format1d[FORMAT_LUM] = p_txt->format2d[FORMAT_LUM] = GL_LUMINANCE8; p_txt->format1d[FORMAT_LUM_ALFA1] = p_txt->format2d[FORMAT_LUM_ALFA1] = GL_LUMINANCE6_ALPHA2; p_txt->format1d[FORMAT_LUM_ALFA4] = p_txt->format2d[FORMAT_LUM_ALFA4] = GL_LUMINANCE4_ALPHA4; p_txt->format1d[FORMAT_ALFA] = p_txt->format2d[FORMAT_ALFA] = GL_ALPHA8; p_txt->format1d[FORMAT_LIGHTMAPY] = p_txt->format2d[FORMAT_LIGHTMAPY] = GL_RGB5; } else if (p_txt->text_bpp == TEXT_32BPP) { p_txt->format1d[FORMAT_RGB] = p_txt->format2d[FORMAT_RGB] = GL_RGB8; p_txt->format1d[FORMAT_RGBA1] = p_txt->format2d[FORMAT_RGBA1] = GL_RGBA8; p_txt->format1d[FORMAT_RGBA4] = p_txt->format2d[FORMAT_RGBA4] = GL_RGBA8; p_txt->format1d[FORMAT_LUM] = p_txt->format2d[FORMAT_LUM] = GL_LUMINANCE8; p_txt->format1d[FORMAT_LUM_ALFA1] = p_txt->format2d[FORMAT_LUM_ALFA1] = GL_LUMINANCE8_ALPHA8; p_txt->format1d[FORMAT_LUM_ALFA4] = p_txt->format2d[FORMAT_LUM_ALFA4] = GL_LUMINANCE8_ALPHA8; p_txt->format1d[FORMAT_ALFA] = p_txt->format2d[FORMAT_ALFA] = GL_ALPHA8; p_txt->format1d[FORMAT_LIGHTMAPY] = p_txt->format2d[FORMAT_LIGHTMAPY] = GL_RGB5; } else if (p_txt->text_bpp == TEXT_DTX) { p_txt->format1d[FORMAT_RGB] = GL_RGB5; p_txt->format1d[FORMAT_RGBA1] = GL_RGB5_A1; p_txt->format1d[FORMAT_RGBA4] = GL_RGBA4; p_txt->format1d[FORMAT_LUM] = GL_LUMINANCE8; p_txt->format1d[FORMAT_LUM_ALFA1] = GL_LUMINANCE6_ALPHA2; p_txt->format1d[FORMAT_LUM_ALFA4] = GL_LUMINANCE4_ALPHA4; p_txt->format1d[FORMAT_ALFA] = GL_ALPHA8; p_txt->format1d[FORMAT_LIGHTMAPY] = GL_RGB5; p_txt->format2d[FORMAT_RGB] = GL_COMPRESSED_RGB_ARB; p_txt->format2d[FORMAT_RGBA1] = GL_COMPRESSED_RGBA_ARB; p_txt->format2d[FORMAT_RGBA4] = GL_COMPRESSED_RGBA_ARB; p_txt->format2d[FORMAT_LUM] = GL_COMPRESSED_LUMINANCE_ARB; p_txt->format2d[FORMAT_LUM_ALFA1] = GL_COMPRESSED_LUMINANCE_ALPHA_ARB; p_txt->format2d[FORMAT_LUM_ALFA4] = GL_COMPRESSED_LUMINANCE_ALPHA_ARB; p_txt->format2d[FORMAT_ALFA] = GL_COMPRESSED_ALPHA_ARB; p_txt->format2d[FORMAT_LIGHTMAPY] = GL_RGB5; } if (p_txt->text_bpp != TEXT_32BPP && p_txt->text_bpp != TEXT_16BPP && p_txt->text_bpp != TEXT_DTX) { kprintf(1, "Bad texture depth %d, switch to 16bpp", p_txt->text_bpp); p_txt->text_bpp = TEXT_16BPP; } text_off(GL_TEXTURE_1D); text_off(GL_TEXTURE_2D); } /* load hw konfigu */ int nahraj_device_config(char *p_file, char *p_sekce) { hwconf.fullscreen = GetPrivateProfileInt(p_sekce, "fullscreen", 0, p_file); // 0 in p_conf->xres, p_conf->yres and p_conf->bpp means use current // screen resolution and color depth // set screen resolution for windowed mode only if(!hwconf.fullscreen) { hwconf.screen_width = GetPrivateProfileInt(p_sekce, "xres", 1024, p_file); hwconf.screen_height = GetPrivateProfileInt(p_sekce, "yres", 768, p_file); } else { hwconf.screen_width = hwconf.screen_height = 0; } hwconf.bpp = GetPrivateProfileInt(p_sekce, "bpp", 0, p_file); hwconf.game_fps = GetPrivateProfileInt(p_sekce, "game_fps", 60, p_file); hwconf.ditering = GetPrivateProfileInt(p_sekce, "ditering", 0, p_file); hwconf.typ_mlhy = TRUE; // Use pixel fog hwconf.bump_mapping = FALSE; // Disable bump-mapping - is not used anyway hwconf.bump_mapping_typ = AUTO_BUMP_DOT3; return (TRUE); } int nahraj_universal_device_config(char *p_file, char *p_sekce) { hwconf.pn_triangles = GetPrivateProfileInt(p_sekce, "pn_triangles", 0, p_file); hwconf.pn_triangles_detail = GetPrivateProfileInt(p_sekce, "pn_triangles_tesell", 0, p_file); return (TRUE); } /* load konfigu textur */ int nahraj_texture_config(char *p_file, TXT_KONFIG * p_txt) { char pom[200]; int i; p_txt->text_kvalita = GetPrivateProfileInt(TXT_SEKCE, "text_kvalita", 0, p_file); p_txt->text_komprese = GetPrivateProfileInt(TXT_SEKCE, "text_komprese", 0, p_file); p_txt->text_bpp = GetPrivateProfileInt(TXT_SEKCE, "text_bpp", 16, p_file); p_txt->text_mip_mapping = GetPrivateProfileInt(TXT_SEKCE, "text_mip_mapping", 1, p_file); p_txt->text_mip_filtr = GetPrivateProfileInt(TXT_SEKCE, "text_mip_filtr", 1, p_file); p_txt->text_perspective = GetPrivateProfileInt(TXT_SEKCE, "text_perspective", 1, p_file); p_txt->text_max_x = GetPrivateProfileInt(TXT_SEKCE, "text_max_x", 256, p_file); p_txt->text_max_y = GetPrivateProfileInt(TXT_SEKCE, "text_max_y", 256, p_file); p_txt->text_bpp_plocha = GetPrivateProfileInt(TXT_SEKCE, "text_bpp_plocha", 0, p_file); p_txt->text_anis = GetPrivateProfileInt(TXT_SEKCE, "text_ans", 0, p_file); p_txt->text_anis_level = (float) GetPrivateProfileInt(TXT_SEKCE, "text_ans_stupen", 1, p_file); p_txt->text_wrap_x = 1; p_txt->text_wrap_y = 1; GetPrivateProfileString(TXT_SEKCE, "text_ostrost", "0.0", pom, 200, p_file); p_txt->text_ostrost = (float) atof(pom); for (i = 0; i < TEXT_TRID; i++) { sprintf(pom, "text_detail%d", i); p_txt->text_detail[i] = GetPrivateProfileInt(TXT_SEKCE, pom, 0, p_file); sprintf(pom, "text_bump%d", i); p_txt->text_bump[i] = GetPrivateProfileInt(TXT_SEKCE, pom, 0, p_file); } return (1); } void anisotropic_filtr_init(TXT_KONFIG * p_txt) { float max_anis, as, akt_anis; int i, imax; if (p_txt->text_anis && gl_ext::extlist_text_filter_anisotropic) { glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anis); akt_anis = p_txt->text_anis_level; if (akt_anis > 5) akt_anis = 5; imax = (int) akt_anis - 1; for (as = 2, i = 0; i < imax; i++, as *= 2); if (as > max_anis) as = max_anis; p_txt->text_anis_level = as / max_anis; kprintf(TRUE, "Text Max Anisotropy %.1f, akt %.1f", max_anis, p_txt->text_anis_level); } else { p_txt->text_anis = FALSE; } } int grf_start(char *p_file) { nahraj_texture_config(p_file, &txconf); /* Nahozeni stavu OpenGL */ nastav_konfig(&hwconf, &txconf); anisotropic_filtr_init(&txconf); BuildFont(); return (TRUE); } int grf_stop(void) { KillFont(); return (1); } #define KONZOLE_POZADI 0xffffffff #define KONZOLE_TEXT 0x0 #define KONZOLE_COLOR 1 void ddw_surf(int x, int y, const char *fmt, ...) { char text[1000]; va_list ap; // Pointer To List Of Arguments if (fmt == NULL) // If There's No Text return; // Do Nothing glColor3f(KONZOLE_COLOR, KONZOLE_COLOR, KONZOLE_COLOR); glRasterPos2i(x * SIRKA_FONTU, y * VYSKA_FONTU); va_start(ap, fmt); // Parses The String For Variables vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers va_end(ap); // Results Are Stored In Text glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits glListBase(hwconf.font_baze - 32); // Sets The Base Character to 32 glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text glPopAttrib(); // Pops The Display List Bits } void ddw_surf_xy(int x, int y, const char *fmt, ...) { char text[1000]; va_list ap; // Pointer To List Of Arguments if (fmt == NULL) // If There's No Text return; // Do Nothing glColor3f(KONZOLE_COLOR, KONZOLE_COLOR, KONZOLE_COLOR); glRasterPos2i(x, y); va_start(ap, fmt); // Parses The String For Variables vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers va_end(ap); // Results Are Stored In Text glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits glListBase(hwconf.font_baze - 32); // Sets The Base Character to 32 glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text glPopAttrib(); // Pops The Display List Bits } int ddwqueto(char *p_text, ...) { char text[500]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); // return(MessageBox(hwnd,text,"DdwQueto:",MB_ICONASTERISK|MB_YESNO|MB_SYSTEMMODAL) == IDYES); return (1); } int ddwquetot(char *p_title, char *p_text, ...) { char text[500]; va_list argumenty; va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); // return(MessageBox(hwnd,text,p_title,MB_ICONASTERISK|MB_YESNO|MB_SYSTEMMODAL) == IDYES); return (1); } void gl_texture_scan(void) { dword i, num, max = 0; num = 0; max--; for (i = 0; i < max; i++) if (glIsTexture(i)) num++; kprintf(TRUE, "Textur %d...", num); } /* tiskni chybu */ void tiskni_chybu(int line, char *p_file, char *p_text, ...) { char text[2000]; char text1[2000]; va_list argumenty; sprintf(text1, "Chyba na line %d file %s\n", line, p_file); va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); strcat(text1, text); fprintf(stderr,"%s\n", text1); assert(0); exit(-1); } void tiskni_chybu_bez_exit(int line, char *p_file, char *p_text, ...) { char text[2000]; char text1[2000]; va_list argumenty; sprintf(text1, "Chyba na line %d file %s\n", line, p_file); va_start(argumenty, p_text); vsprintf(text, p_text, argumenty); va_end(argumenty); strcat(text1, text); fprintf(stderr,"%s\n", text1); } void mfree(void **p_mem) { if (*p_mem) { free((*p_mem)); *p_mem = NULL; } } void rozeber_chybu(void) { } /* Taken from NeHe tutorials: */ /* * This code was created by Jeff Molofee '99 * (ported to Linux/SDL by Ti Leggett '01) * * If you've found this code useful, please let me know. * * Visit Jeff at http://nehe.gamedev.net/ * * or for port-specific comments, questions, bugreports etc. * email to leggett@eecs.tulane.edu */ void BuildFont(void) // Build Our Bitmap Font { Display *dpy; /* Our current X display */ XFontStruct *fontInfo; /* Our font info */ /* Sotrage for 96 characters */ hwconf.font_baze = glGenLists(96); /* Get our current display long enough to get the fonts */ dpy = XOpenDisplay(NULL); /* Get the font information */ fontInfo = XLoadQueryFont(dpy, "-adobe-helvetica-medium-r-normal--18-*-*-*-p-*-iso8859-1"); /* If the above font didn't exist try one that should */ if (fontInfo == NULL) { fontInfo = XLoadQueryFont(dpy, "fixed"); /* If that font doesn't exist, something is wrong */ if (fontInfo == NULL) { fprintf(stderr, "no X font available?\n"); return; } } /* generate the list */ glXUseXFont(fontInfo->fid, 32, 96, hwconf.font_baze); /* Recover some memory */ XFreeFont(dpy, fontInfo); /* close the display now that we're done with it */ XCloseDisplay(dpy); } void KillFont(void) // Delete The Font { glDeleteLists(hwconf.font_baze, 96); // Delete All 96 Characters } void glChyba(void) { dword chyba = glGetError(); switch (chyba) { case 0: break; case GL_INVALID_ENUM: kprintf(1, "GL_INVALID_ENUM"); assert(0); break; case GL_INVALID_VALUE: kprintf(1, "GL_INVALID_VALUE"); assert(0); break; case GL_INVALID_OPERATION: kprintf(1, "GL_INVALID_OPERATION"); assert(0); break; case GL_STACK_OVERFLOW: kprintf(1, "GL_STACK_OVERFLOW"); assert(0); break; case GL_STACK_UNDERFLOW: kprintf(1, "GL_STACK_UNDERFLOW"); assert(0); break; case GL_OUT_OF_MEMORY: kprintf(1, "GL_OUT_OF_MEMORY"); assert(0); break; default: assert(0); break; } } berusky2-0.12/src/komat/Berusky3d_animace.cpp0000644000175000017500000012520613674426075016105 00000000000000/* berusky3d_animace.c Animacni modul k beruskam II posuny objektu kyframe animace objektu animacni hierachie */ #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" extern G_KONFIG ber, *p_ber; /*-------------------------------------------------------- Animovane materialy -------------------------------------------------------- */ /* Prida animaci do animacniho listu z meshu */ int amat_pridej_mesh(G_KONFIG * p_ber, int mesh) { EDIT_MATERIAL **p_imat = p_ber->p_mat; EDIT_MATERIAL *p_mat; GAME_MESH_OLD *p_mesh = p_ber->p_mesh[mesh]; int i, aa; assert(p_mesh); if (p_mesh->p_data->m1flag & MAT_ANIM_FRAME) { for (i = 0; i < p_mesh->objektu; i++) { p_mat = p_imat[p_mesh->p_mat[i]]; if (p_mat->flag & MAT_ANIM_FRAME) { //p_mesh->p_mat[i] -> tento material if (p_ber->mannum >= MAX_MAT_ANIMACI) { ddw("Nedostatek volnych slotu animaci !"); assert(0); } else { aa = p_ber->mannum++; p_ber->p_man[aa].mesh = mesh; p_ber->p_man[aa].objekt = i; p_ber->p_man[aa].p_anim = p_mat; // odkazuj material } } } } return (p_ber->mannum); } /* Prihodi na animovani material */ int amat_pridej_material(G_KONFIG * p_ber, EDIT_MATERIAL * p_mat) { int aa; assert(p_mat); if (p_mat->flag & MAT_ANIM_FRAME) { if (p_ber->mannum >= MAX_MAT_ANIMACI) { ddw("Nedostatek volnych slotu animaci !"); assert(0); } else { aa = p_ber->mannum++; p_ber->p_man[aa].mesh = K_CHYBA; p_ber->p_man[aa].objekt = K_CHYBA; p_ber->p_man[aa].p_anim = p_mat; } } return (p_ber->mannum); } /* Vrati aktivni frame u animovaheho materialu K_CHYBA pokud material neni animovany */ int amat_get_frame(EDIT_MATERIAL * p_mat) { if (p_mat->anim.p_frame) return (p_mat->anim.frameakt); else { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } } /* Nastavi frame u animovaneho materialu */ int amat_set_frame_text(EDIT_MATERIAL * p_mat, int frame) { ANIM_MATERIAL *p_anim = &p_mat->anim; if (p_anim->p_frame) { ANIM_FRAME *p_frame = p_anim->p_frame + frame; dword flag = p_frame->flag; if (flag & FRAME_TEXTURA) { text_set_num(0); text_set(p_frame->p_text->text, p_frame->p_text->typ); } return (TRUE); } else { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } } /* Prida animaci do animacniho listu z poly */ int amat_pridej_poly(G_KONFIG * p_ber, int poly) { EDIT_MESH_POLY *p_poly = p_ber->p_poly + poly; int aa; assert(p_poly); //p_mesh->p_mat[i] -> tento material if (p_poly->m1flag & MAT_ANIM_FRAME) { if (p_ber->mannum >= MAX_MAT_ANIMACI) { ddw("Nedostatek volnych slotu animaci !"); assert(0); } else { aa = p_ber->mannum++; p_ber->p_man[aa].mesh = poly; p_ber->p_man[aa].objekt = K_CHYBA; p_ber->p_man[aa].p_anim = p_ber->p_mat[p_poly->material]; // odkazuj material } } return (p_ber->mannum); } /* Updatuje frame animace -> vraci cas dalsi aktualizace */ inline int amat_frame_updatuj(EDIT_MATERIAL * p_mat, int *p_event) { ANIM_MATERIAL *p_anim = &p_mat->anim; int next = (p_anim->frameakt + 1 >= p_anim->framenum) ? p_anim->frameakt = 0 : ++p_anim->frameakt; ANIM_FRAME *p_frame = p_anim->p_frame + next; dword flag; assert(p_frame); flag = p_frame->flag; if (flag & FRAME_TEXTURA) p_mat->p_text[0] = p_frame->p_text; if (flag & FRAME_POSUN) { p_mat->ttext[0]._41 = p_frame->u; p_mat->ttext[0]._42 = p_frame->v; } *p_event = (flag & FRAME_EVENT); return (p_anim->p_frame[next].time); } void amat_updatuj(G_KONFIG * p_ber) { MAL_BUNKA *p_man; int i; for (i = 0; i < p_ber->mannum; i++) { p_man = p_ber->p_man + i; if (p_man->p_anim->anim.p_frame) { if (p_man->next_time < p_ber->TimeEndLastFrame && !p_man->event) { // updatuj tento frame animace p_man->next_time = p_ber->TimeEndLastFrame + amat_frame_updatuj(p_man->p_anim, &p_man->event); } } } } /* Casove nahozeni animaci */ void ani_init(G_KONFIG * p_ber) { int i; for (i = 0; i < p_ber->mannum; i++) { p_ber->p_man[i].next_time = p_ber->TimeBase; } } /* Dotaz na existenci animovaneho materialu */ int kom_amat_mesh_get(int mesh, int objekt) { int i; if (!(p_ber->p_mesh[mesh]) || objekt >= p_ber->p_mesh[mesh]->objektu) { return (K_CHYBA); } for (i = 0; i < p_ber->mannum; i++) { if (p_ber->p_man[i].mesh == mesh && p_ber->p_man[i].objekt == objekt) return (i); } return (K_CHYBA); } /* Skoci animaci na tento frame a hodi casovac 0 */ int kom_amat_set_frame(int handle, int frame) { MAL_BUNKA *p_man = p_ber->p_man + handle; assert(handle < p_ber->mannum); p_man->p_anim->anim.frameakt = frame; p_man->next_time = p_ber->TimeEndLastFrame + amat_frame_updatuj(p_man->p_anim, &p_man->event); return (TRUE); } /* Zrusi event flag animace */ int kom_amat_event(MatHandle handle) { MAL_BUNKA *p_man = p_ber->p_man + handle; assert(handle < p_ber->mannum); p_ber->p_man[handle].event = 0; p_man->next_time = p_ber->TimeEndLastFrame + amat_frame_updatuj(p_man->p_anim, &p_man->event); return (TRUE); } /* Cte flagy animace - bezici/jina 0 = stoji 1 = bezi */ int kom_amat_get(int handle) { assert(handle < p_ber->mannum); return (!p_ber->p_man[handle].event); } int kom_amat_mesh_get_num(void) { return (p_ber->mannum); } int kom_amat_mesh_get_all(MATERIAL_BUNKA * p_bunky) { int i; for (i = 0; i < p_ber->mannum; i++) { p_bunky[i].handle_materialove_animace = i; p_bunky[i].handle_meshe = p_ber->p_man[i].mesh; p_bunky[i].cislo_objektu = p_ber->p_man[i].objekt; } return (p_ber->mannum); } int kom_amat_get_kontejner(MeshHandle mh) { if (p_ber->p_prv_lev[mh]) { return (p_ber->p_prv_lev[mh]->mesh); } else { return (K_CHYBA); } } /*--------------------------------------------------------------------- Globalni animace --------------------------------------------------------------------- */ /* Vraci handle nebo K_CHYBA kdyz nic/chyba loadu */ AnimHandle sim_nahraj_animaci(char *p_dir, char *p_jmeno, int linearne) { AnimHandle sim; int i; for (i = 0; i < p_ber->simnum; i++) { if (!p_ber->p_sim[i].flag) { sim = i; goto naslo_se_to1; } } if (p_ber->simnum == MAX_SIM_ANIMACI) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } else sim = p_ber->simnum++; naslo_se_to1:; if (!key_sim_nahraj(p_dir, p_ber->p_sim + sim, p_jmeno, p_ber->dir.data_dir, linearne)) return (K_CHYBA); p_ber->p_sim[sim].flag |= SIMPLE_AKTIVNI; return (sim); } /* vyrobi animaci padu (delku framu prekona za delku) */ /* vyrobi slot v teto animaci */ AnimHandle sim_vyrob_animaci(int pos_key, int rot_key, int scale_key) { AnimHandle sim; int i; for (i = 0; i < p_ber->simnum; i++) { if (!p_ber->p_sim[i].flag) { sim = i; goto naslo_se_to2; } } if (p_ber->simnum >= MAX_SIM_ANIMACI) { kprintfe(TRUE, "sim_vyrob_animaci = -1, FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } else sim = p_ber->simnum++; naslo_se_to2:; p_ber->p_sim[sim].flag |= SIMPLE_AKTIVNI; key_tri_vyrob_indir(p_ber->p_track + sim, pos_key, rot_key, scale_key); return (sim); } AnimHandle sim_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].pos_keys) { kprintfe(TRUE, "sim_vloz_klic_posun = -1, FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_pos[klic].x = x; p_ber->p_track[handle].p_pos[klic].y = y; p_ber->p_track[handle].p_pos[klic].z = z; p_ber->p_track[handle].p_pkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle sim_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD * p_p, int frame) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].pos_keys) { kprintfe(TRUE, "sim_vloz_klic_posun_bod = -1, FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_pos[klic] = *p_p; p_ber->p_track[handle].p_pkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle sim_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].pos_keys) { kprintfe(TRUE, "sim_vyrob_animaci = -1, FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_pkeys[klic].bias = bias; p_ber->p_track[handle].p_pkeys[klic].continuity = continuity; p_ber->p_track[handle].p_pkeys[klic].tension = tension; return (handle); } // uhel je ve stupnich AnimHandle sim_vloz_klic_rotace(AnimHandle handle, int klic, BOD * p_osa, float uhel, int frame) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].rot_keys) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } /* Korekce zaporneho uhlu */ if (uhel < 0.0f) { uhel = -uhel; p_osa->x = -p_osa->x; p_osa->y = -p_osa->y; p_osa->z = -p_osa->z; } quat_norm(angle_to_quat(p_ber->p_track[handle].p_at + klic, p_osa, (uhel * PI) / 180.0f)); p_ber->p_track[handle].p_rkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle sim_vloz_klic_rotace_quat(AnimHandle handle, int klic, QUAT * p_q, int frame) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].rot_keys) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } /* Korekce zaporneho uhlu */ p_ber->p_track[handle].p_at[klic] = *p_q; quat_norm(p_ber->p_track[handle].p_at + klic); p_ber->p_track[handle].p_rkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle sim_vloz_klic_rotace_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].rot_keys) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_rkeys[klic].bias = bias; p_ber->p_track[handle].p_rkeys[klic].continuity = continuity; p_ber->p_track[handle].p_rkeys[klic].tension = tension; return (handle); } AnimHandle sim_vloz_klic_scale(AnimHandle handle, int klic, float x, float y, float z, int frame) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].scs_keys) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_skeys[klic].time = frame * SIM_KONSTI; p_ber->p_track[handle].p_scale[klic].x = x; p_ber->p_track[handle].p_scale[klic].y = y; p_ber->p_track[handle].p_scale[klic].z = z; return (handle); } AnimHandle sim_vloz_klic_scale_bod(AnimHandle handle, int klic, BOD * p_scs, int frame) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].scs_keys) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_scale[klic] = *p_scs; p_ber->p_track[handle].p_skeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle sim_vloz_klic_scale_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { if (handle >= p_ber->simnum || klic >= p_ber->p_track[handle].scs_keys) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].p_skeys[klic].bias = bias; p_ber->p_track[handle].p_skeys[klic].continuity = continuity; p_ber->p_track[handle].p_skeys[klic].tension = tension; return (handle); } AnimHandle sim_vloz_pivot(AnimHandle handle, float x, float y, float z) { if (handle >= p_ber->simnum) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].pivot.x = x; p_ber->p_track[handle].pivot.y = y; p_ber->p_track[handle].pivot.z = z; return (handle); } AnimHandle sim_vloz_pivot_bod(AnimHandle handle, BOD * p_bod) { if (handle >= p_ber->simnum) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].pivot = *p_bod; return (handle); } /* Rozinterpoluje key-frame animaci */ AnimHandle sim_interpoluj_animaci(AnimHandle handle, int framenum, int loop) { if (handle >= p_ber->simnum) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_ber->p_track[handle].endtime = calc_endtime(framenum); key_tri_to_sim_indir(p_ber->p_track + handle, p_ber->p_sim + handle, loop, FALSE); p_ber->p_sim[handle].flag |= SIMPLE_AKTIVNI; return (handle); } /* Zrusi animaci */ AnimHandle sim_zrus_animaci(AnimHandle handle) { if (handle >= p_ber->simnum || !p_ber->p_sim[handle].flag) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } else { p_ber->p_sim[handle].flag = 0; zrus_tri_vnitrek(p_ber->p_track + handle); key_sim_zrus_vnitrek(p_ber->p_sim + handle); if (handle + 1 == p_ber->simnum) p_ber->simnum--; } return (handle); } /************************************************************************** Run-animace ************************************************************************** Aktivace animace */ RunHandle rani_aktivuj(AnimHandle shandle, int *p_flag, int flag, int start, int stop) { GK_ANIM *p_gk; int ah; int i; for (i = 0; i < p_ber->gknum; i++) { if (!p_ber->p_gkzas[i].flag) { ah = i; goto naslo_se_to; } } if (p_ber->gknum == MAX_RUN_ANIMACI) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } else { ah = p_ber->gknum++; } naslo_se_to:; p_gk = p_ber->p_gkzas + ah; p_gk->p_flag = p_flag; p_gk->p_sim = p_ber->p_sim + shandle; p_gk->flag |= GK_POUZITA; p_gk->matic = 0; p_gk->next_ah = (size_ptr)NULL; p_gk->p_endfce = NULL; // Zarazeni do render-listu p_gk->p_next = p_ber->p_gkanim; p_gk->p_prev = NULL; if (p_gk->p_next) p_gk->p_next->p_prev = p_gk; p_ber->p_gkanim = p_gk; return (rani_go((RunHandle) p_gk, flag, start, stop)); } RunHandle rani_aktivuj_cekej(AnimHandle shandle, int *p_flag) { GK_ANIM *p_gk; int ah; int i; for (i = 0; i < p_ber->gknum; i++) { if (!p_ber->p_gkzas[i].flag) { ah = i; goto naslo_se_to; } } if (p_ber->gknum == MAX_RUN_ANIMACI) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } else { ah = p_ber->gknum++; } naslo_se_to:; p_gk = p_ber->p_gkzas + ah; p_gk->p_flag = p_flag; p_gk->p_sim = p_ber->p_sim + shandle; p_gk->flag |= GK_POUZITA; p_gk->matic = 0; p_gk->next_ah = (size_ptr)NULL; p_gk->p_endfce = NULL; // Zarazeni do render-listu p_gk->p_next = p_ber->p_gkanim; p_gk->p_prev = NULL; if (p_gk->p_next) p_gk->p_next->p_prev = p_gk; p_ber->p_gkanim = p_gk; return ((RunHandle) p_gk); } RunHandle rani_pripoj_funkci(RunHandle a_handle, END_FUNKCE p_fce, size_ptr param, size_ptr param2, size_ptr param3) { GK_ANIM *p_gk = (GK_ANIM *) a_handle; p_gk->p_endfce = p_fce; p_gk->p_param = reinterpret_cast(param3); p_gk->param = param; p_gk->param2 = param2; return (a_handle); } RunHandle rani_next_animace(RunHandle ah, RunHandle next_ah, int flag, int start, int stop) { GK_ANIM *p_gk = (GK_ANIM *) ah; p_gk->next_ah = next_ah; p_gk->next_flag = flag; p_gk->next_start = start; p_gk->next_stop = stop; return (ah); } /* Pripoji k animaci (druh) MeshHandle */ MatrixHandle rani_privaz_mesh(RunHandle a_handle, MeshHandle m_handle, int transformuj_pivot) { GAME_MESH_OLD *p_mesh; GK_ANIM *p_gk = (GK_ANIM *) a_handle; GKA_MATICE *p_mat; MatrixHandle matice; if (!p_ber->p_prv_lev[m_handle]) { ddw("Chybne privazani mesh-handle %d", m_handle); kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } if (p_gk->matic >= MAX_ANIM_MATIC) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } matice = p_gk->matic++; p_mat = p_gk->p_mat + matice; p_mat->p_mat = &p_ber->p_prv_lev[m_handle]->mg; p_mat->p_notify = NULL; p_mat->flagy = MESH_USE_MATRIX | MESH_PRVEK; p_mat->fce_param = m_handle; p_mat->funkce_start = NULL; p_mat->funkce_frame = rani_updatuj_prvek_matice; p_mat->funkce_end = rani_umisti_prvek_animace; // Nastavi pivot point pro rotaci --- sim animace -> mesh if (p_gk->p_sim->p_at) { p_mat->flagy |= (transformuj_pivot) ? MESH_TRANSFORMUJ_PIVOT | MESH_PIVOT : MESH_PIVOT; } //__OPRAVA__ // vsechny meshe naflaguj p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[m_handle]->mesh]; p_mesh->sim_flag |= GAME_MESH_RANI; return (matice); } int rani_je_mesh(RunHandle a_handle, MeshHandle m_handle) { GK_ANIM *p_gk = (GK_ANIM *) a_handle; GKA_MATICE *p_mat; int m; assert(m_handle >= 0 && m_handle < MAX_PRVKU_LEVEL); if (!p_ber->p_prv_lev[m_handle]) return (FALSE); p_mat = p_gk->p_mat; for (m = 0; m < p_gk->matic; m++, p_mat++) { if (p_mat->fce_param == (size_ptr) m_handle) return (TRUE); } return (FALSE); } /* Pripoji k animaci (druh) */ RunHandle rani_rozvaz(RunHandle a_handle, MatrixHandle m_handle) { GK_ANIM *p_gk = (GK_ANIM *) a_handle; if (m_handle < MAX_ANIM_MATIC) { p_gk->p_mat[m_handle].p_mat = NULL; p_gk->p_mat[m_handle].p_notify = NULL; return (TRUE); } else { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } } /* Znovu - Spusteni animace */ RunHandle rani_go(RunHandle ah, int flag, int start, int stop) { GAME_MESH_OLD *p_mesh; GK_ANIM *p_gk = (GK_ANIM *) ah; dword mflag; int m_handle; int i; calc_time(p_gk->p_sim->keynum, p_ber->TimeEndLastFrame, start, stop, &p_gk->start, &p_gk->stop, &p_gk->time_start, &p_gk->time_stop, &p_gk->time_delka); p_gk->flag |= (GK_AKTIVNI | flag); p_gk->konec = FALSE; for (i = 0; i < p_gk->matic; i++) { m_handle = p_gk->p_mat[i].fce_param; if (p_gk->p_mat[i].funkce_start) p_gk->p_mat[i].funkce_start(ah); if (p_gk->p_mat[i].flagy & MESH_PRVEK) p_ber->p_prv_lev[m_handle]->anim_mail = K_CHYBA; mflag = p_gk->p_mat[i].flagy; if (mflag & MESH_PIVOT) { if (mflag & MESH_TRANSFORMUJ_PIVOT) { GLMATRIX m; p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[m_handle]->mesh]; memcpy(&m, &p_mesh->m, sizeof(m)); m._41 = m._42 = m._43 = 0.0f; transformuj_bod_matici_bod(&p_gk->p_sim->pivot, &m, &p_ber->p_prv_lev[m_handle]->pivot); } else { p_ber->p_prv_lev[m_handle]->pivot = p_gk->p_sim->pivot; } } } return (ah); } // stopne animaci int rani_zrus(RunHandle ahandle) { GK_ANIM *p_gk = (GK_ANIM *) ahandle; // zrusi posledni p_gk->flag = 0; // Rozvaze ji ze seznamu aktivnich animaci if (!p_gk->p_prev) { p_ber->p_gkanim = p_gk->p_next; if (p_ber->p_gkanim) p_ber->p_gkanim->p_prev = NULL; } else { p_gk->p_prev->p_next = p_gk->p_next; if (p_gk->p_next) p_gk->p_next->p_prev = p_gk->p_prev; } return (TRUE); } /* --------------------------------- Interni rutiny pro run-animace --------------------------------- */ void rani_updatuj_prvek_matice_vnitrek(PRVEK_LEVELU_GAME * p_prv) { PRVEK_LEVELU_GAME *p_top; BOD *p_pivot, p; // pouzij pivot point meshe GLMATRIX tmp1; GAME_MESH_OLD *p_mesh; if (p_prv->anim_mail == p_ber->anim_mail) return; else p_prv->anim_mail = p_ber->anim_mail; p_pivot = &p_prv->pivot; p_mesh = p_ber->p_mesh[p_prv->mesh]; if (p_prv->flag & PRV_TOP && p_prv->p_next_low) { // Provaz matici mg vsechny pod-objekty a updatuj je // Pivotuj matici MG mat_copy(&tmp1, &p_prv->mg); vektor_add((BOD *) (&p_prv->mp._41), p_pivot, &p); pivotuj_matrix(&tmp1, &p); /* Ukonci animovani - konec + pronasobeni p_mg_top */ if (p_prv->flag & PRV_ANIM_END) { p_top = p_prv->p_next_low; while (p_top) { p_top->p_mg_top = NULL; mat_mult(&p_top->mp, &tmp1, &p_top->mp); rani_updatuj_prvek_matice_vnitrek(p_top); p_top = p_top->p_next_low; } } /* Nastav top_mg a vynasob to */ else { p_top = p_prv->p_next_low; while (p_top) { p_top->p_mg_top = &tmp1; rani_updatuj_prvek_matice_vnitrek(p_top); p_top = p_top->p_next_low; } } } else if (p_prv->flag & PRV_LOW && p_prv->p_mg_top) { mat_mult(p_prv->p_mg_top, &p_prv->mg, &tmp1); vektor_add((BOD *) (&p_prv->mp._41), p_pivot, &p); // nakopiruj si pivot + pozice transformuj_bod_bod_matici(&p, p_prv->p_mg_top); pivotuj_matrix(&tmp1, &p); // pivotuj animovanou matici } else { mat_copy(&tmp1, &p_prv->mg); vektor_add((BOD *) (&p_prv->mp._41), p_pivot, &p); pivotuj_matrix(&tmp1, &p); } // vysledna transformacni matice polohy = p_mesh->m mat_mult_dir(&p_prv->mp, &tmp1, &p_mesh->m); // p_prv->p_mesh->m - vysledna matice if (p_mesh->p_data->kflag & KONT_KEYFRAME) { mat_mult_dir(&p_mesh->world, &p_mesh->m, &tmp1); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp1); } else { key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } p_prv->x = p_mesh->m._41; p_prv->y = p_mesh->m._42 + Y_PRVEK2; p_prv->z = p_mesh->m._43; p_mesh->p_data->kflag |= KONT_POHYB; if (p_prv->flag & PRV_ANIM_END) { p_prv->flag &= ~PRV_ANIM_END; p_prv->mp = p_mesh->m; init_matrix(&p_prv->mg); p_mesh->sim_flag = FALSE; } } void rani_updatuj_prvek_matice_vnitrek_end_top(PRVEK_LEVELU_GAME * p_prv) { BOD *p_pivot, p; // pouzij pivot point meshe GLMATRIX tmp1; GAME_MESH_OLD *p_mesh; if (p_prv->p_mg_top) { p_pivot = &p_prv->pivot; p_mesh = p_ber->p_mesh[p_prv->mesh]; // Pivotuj matici MG mat_copy(&tmp1, &p_prv->mg); vektor_add((BOD *) (&p_prv->mp._41), p_pivot, &p); pivotuj_matrix(&tmp1, &p); mat_mult(&p_prv->mp, p_prv->p_mg_top, &p_prv->mp); mat_mult_dir(&p_prv->mp, &tmp1, &p_mesh->m); // p_prv->p_mesh->m - vysledna matice if (p_mesh->p_data->kflag & KONT_KEYFRAME) { mat_mult_dir(&p_mesh->world, &p_mesh->m, &tmp1); key_mesh_reanimuj(p_mesh, p_mesh->sim_aktivni_time, &tmp1); } else { key_mesh_transformuj_obalky(p_mesh, &p_mesh->m); } p_prv->x = p_mesh->m._41; p_prv->y = p_mesh->m._42 + Y_PRVEK2; p_prv->z = p_mesh->m._43; p_mesh->p_data->kflag |= KONT_POHYB; } } /* Frame-funkce posunu meshu */ void rani_updatuj_prvek_matice(size_ptr mesh_handle) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[mesh_handle]; int flag = p_prv->flag; p_prv->flag &= ~PRV_ANIM_END; if (flag & PRV_TOP) { // pridej to do top-listu p_ber->p_prv_lev_top[p_ber->prvnum_top++] = p_prv; assert(p_ber->prvnum_top < MAX_PRVKU_LEVEL_TOP); } else if (flag & PRV_LOW) { // pridej to do low-listu p_ber->p_prv_lev_low[p_ber->prvnum_low++] = p_prv; assert(p_ber->prvnum_low < MAX_PRVKU_LEVEL_LOW); } else { rani_updatuj_prvek_matice_vnitrek(p_prv); } } /* End-funkce posunu prvku */ void rani_umisti_prvek_animace(size_ptr mesh_handle) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[mesh_handle]; int flag = p_prv->flag; p_prv->flag |= PRV_ANIM_END; if (flag & PRV_TOP) { // pridej to do top-listu p_ber->p_prv_lev_top[p_ber->prvnum_top++] = p_prv; assert(p_ber->prvnum_top < MAX_PRVKU_LEVEL_TOP); } else if (flag & PRV_LOW) { // pridej to do low-listu p_ber->p_prv_lev_low[p_ber->prvnum_low++] = p_prv; assert(p_ber->prvnum_low < MAX_PRVKU_LEVEL_LOW); } else { rani_updatuj_prvek_matice_vnitrek(p_prv); } } /* Updatuje vsechny top objekty a s nimi i low objekty ktere se zmenily */ void rani_updatuj_top_objekty(void) { int i; for (i = 0; i < p_ber->prvnum_top; i++) rani_updatuj_prvek_matice_vnitrek(p_ber->p_prv_lev_top[i]); for (i = 0; i < p_ber->prvnum_low; i++) rani_updatuj_prvek_matice_vnitrek(p_ber->p_prv_lev_low[i]); } /* Postup update: 1. Nastaveni mailu 2. update animaci v lin seznamu 3. update top-low objektu 4. zavolani end funkci vsech animaci */ inline void rani_updatuj_1(GK_ANIM * p_gk) { GKA_MATICE *p_mat; dword next_time = p_ber->TimeEndLastFrame; int m; //mesh; GLMATRIX tmp; /* Animace se updatuji kazdy frame */ if (p_gk->flag & GK_AKTIVNI) { /* Test na konec animace */ if ((p_gk->konec = (next_time > p_gk->time_stop))) { if (p_gk->flag & GK_LOOP) { calc_time_loop(next_time, p_gk->start, &p_gk->time_start, &p_gk->time_stop, &p_gk->time_delka, &p_gk->time); // zruseni flagu konec p_gk->konec = 0; if (p_gk->p_flag) *(p_gk->p_flag) = 0; } else { if (p_gk->next_ah) { p_gk->next_start += next_time - p_gk->time_stop; p_gk->time = p_gk->time_delka; if (p_gk->p_flag) *(p_gk->p_flag) = ANIM_FLAG_KONEC; } else { p_gk->time = p_gk->time_delka; if (p_gk->p_flag) *(p_gk->p_flag) = ANIM_FLAG_KONEC; } } } else { p_gk->time = calc_time_akt(next_time, p_gk->time_start); if (p_gk->p_flag) *(p_gk->p_flag) = ftoi((p_gk->time / (float) p_gk->time_delka) * 100.0f); } /* Vypocitej animaci */ key_sim_to_matrix_param(p_gk->p_sim, p_gk->time, &tmp, &p_gk->p, &p_gk->q, &p_gk->s); for (m = 0; m < p_gk->matic; m++) { p_mat = p_gk->p_mat + m; /* Spocitani animacni matice */ if (p_mat->p_mat && p_mat->flagy & MESH_USE_MATRIX) { if (p_mat->flagy & MESH_MULT_MATRIX) { if (p_mat->flagy & MESH_LOCAL_MATRIX) mat_mult(&tmp, p_mat->p_mat, p_mat->p_mat); else mat_mult(p_mat->p_mat, &tmp, p_mat->p_mat); } else { *(p_mat->p_mat) = tmp; } } /* Zapise flag notify, pokud je pozadovan */ if (p_mat->p_notify) *(p_mat->p_notify) = TRUE; if (p_gk->konec) { /* volani end_funkce pokud je definovana */ if (p_mat->funkce_end) p_mat->funkce_end(p_mat->fce_param); } else { /* Volani frame-funkce pokud je definovana */ if (p_mat->funkce_frame) p_mat->funkce_frame(p_mat->fce_param); } } } } /* Zavolani end-funkci podle mistra kofolace... */ inline void rani_updatuj_2(GK_ANIM * p_gk) { if (p_gk->flag & GK_AKTIVNI && p_gk->konec) { p_gk->flag &= ~GK_AKTIVNI; if (p_gk->p_endfce) p_gk->p_endfce(p_gk->param, p_gk->param2, reinterpret_cast(p_gk->p_param)); if (p_gk->next_ah) { rani_go(p_gk->next_ah, p_gk->next_flag, p_gk->next_start, p_gk->next_stop); rani_updatuj_1((GK_ANIM *) p_gk->next_ah); } if (p_gk->flag & GK_REMOVE) { rani_zrus((RunHandle) p_gk); } } } /* Samotny animacni motor */ void rani_updatuj(G_KONFIG * p_ber) { GK_ANIM *p_gk; /* Vynulovani poctu low-prvku a top-prvku na mape + animacni mail */ p_ber->prvnum_top = 0; p_ber->prvnum_low = 0; p_ber->anim_mail++; /* Update animaci */ p_gk = p_ber->p_gkanim; while (p_gk) { if (p_gk->flag & GK_AKTIVNI) { rani_updatuj_1(p_gk); } p_gk = p_gk->p_next; } /* Updatuji se top-low objekty */ rani_updatuj_top_objekty(); /* Volani end-funkci */ p_gk = p_ber->p_gkanim; while (p_gk) { if (p_gk->flag & GK_AKTIVNI && p_gk->konec) { rani_updatuj_2(p_gk); } p_gk = p_gk->p_next; } } /* ------------------------------------- Animace meshe ------------------------------------- */ /* Rozbehne animaci meshe */ void lani_go(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh) { GAME_MESH_ANIMACE *p_sinfo = &p_mesh->siminfo; SIMPLE_TRACK_INFO *p_sim = p_sinfo->p_sim[0]; int i; calc_time_bez_stop(p_sim->keynum, p_ber->TimeEndLastFrame, p_sinfo->start[0], p_sinfo->stop[0], &p_sinfo->time_start, &p_sinfo->time_stop, &p_sinfo->time_delka); p_sinfo->flag[0] |= GK_AKTIVNI; if (p_sinfo->odkaz == K_CHYBA) { for (i = 0; i < p_ber->lokalnum; i++) { if (!p_ber->p_lokal[i]) { goto nasel; } } i = p_ber->lokalnum++; nasel:; p_ber->p_lokal[i] = p_mesh; p_sinfo->odkaz = i; } } /* Strepe animace - prvni na nultou, pokud je aktivni */ inline void lani_setrep(GAME_MESH_ANIMACE * p_anim) { int i, j; for (i = 0, j = 1; j < LANI_FRONTA; j++, i++) { if (p_anim->akt[j] != K_CHYBA) { p_anim->akt[i] = p_anim->akt[j]; p_anim->flag[i] = p_anim->flag[j]; p_anim->p_flag[i] = p_anim->p_flag[j]; p_anim->p_sim[i] = p_anim->p_sim[j]; p_anim->start[i] = p_anim->start[j]; p_anim->stop[i] = p_anim->stop[j]; p_anim->akt[j] = K_CHYBA; } else { break; } } } /* Nastavi aktivni lokalni animaci nebo K_CHYBA pro stop animace */ MeshHandle lani_set(MeshHandle mh, int poradi, int c_anim, int *p_flag, int flag, int start, int stop) { PRVEK_LEVELU_GAME *p_prv = p_ber->p_prv_lev[mh]; // Level item has been removed? if(!p_prv) return (K_CHYBA); GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_prv->mesh]; // Do we have a valid mesh? if (!p_mesh || poradi >= LANI_FRONTA) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } // If the animation is out of the range - choose the first one (no animation?) if (p_mesh->simnum <= c_anim) c_anim = 0; if ((p_mesh->siminfo.akt[poradi] = c_anim) != K_CHYBA) { p_mesh->siminfo.flag[poradi] = flag; p_mesh->siminfo.p_flag[poradi] = p_flag; p_mesh->siminfo.p_sim[poradi] = p_mesh->p_sim + c_anim; p_mesh->siminfo.start[poradi] = start * SIM_KONSTI; p_mesh->siminfo.stop[poradi] = stop * SIM_KONSTI; if (!poradi) lani_go(p_ber, p_mesh); return (mh); } else { if (!poradi && p_mesh->siminfo.odkaz != K_CHYBA) { p_ber->p_lokal[p_mesh->siminfo.odkaz] = NULL; p_mesh->siminfo.odkaz = K_CHYBA; } } return (mh); } /* Prejde okamzite na dalsi animaci v poradi jinak skonci */ MeshHandle lani_next(MeshHandle mh) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (!p_mesh) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } lani_setrep(&p_mesh->siminfo); if (p_mesh->siminfo.akt[0] != K_CHYBA) { lani_go(p_ber, p_mesh); } return (mh); } /* Vraci pocet bezicich animaci meshe 0 - zadna (mesh se neanimuje) 1 - jedna bezici animace 2 - jedna bezici animace + jedna v zasobe */ int lani_get(MeshHandle mh) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (!p_mesh) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } if (p_mesh->siminfo.akt[0] == K_CHYBA) return (0); else { return ((p_mesh->siminfo.akt[1] == K_CHYBA) ? 1 : 2); } } /* Smaze frontu animaci a vsechny je zastavi */ MeshHandle lani_smaz_frontu(MeshHandle mh) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; int i; if (!p_mesh) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } for (i = 0; i < LANI_FRONTA; i++) p_mesh->siminfo.akt[i] = K_CHYBA; if (p_mesh->siminfo.odkaz != K_CHYBA) { p_ber->p_lokal[p_mesh->siminfo.odkaz] = NULL; p_mesh->siminfo.odkaz = K_CHYBA; } return (mh); } /* Udelat seznam key-frame hierarchickych animaci a ty animovat pred objektama */ void lani_updatuj(G_KONFIG * p_ber) { GAME_MESH_ANIMACE *p_sinfo; GAME_MESH_OLD *p_mesh; GLMATRIX tmp1; dword next_time = p_ber->TimeEndLastFrame; int i, konec; int animovat; // animace podle lokalu for (i = 0; i < p_ber->lokalnum; i++) { if ((p_mesh = p_ber->p_lokal[i])) { animovat = p_ber->conf_animace_okoli || (p_mesh->p_data->kflag) & KONT_PRVEK; p_sinfo = &p_mesh->siminfo; if (p_sinfo->akt[0] == K_CHYBA) { lani_setrep(p_sinfo); if (p_sinfo->akt[0] != K_CHYBA) { lani_go(p_ber, p_mesh); } else { p_ber->p_lokal[i] = NULL; p_sinfo->odkaz = K_CHYBA; } } else { if ((konec = (next_time > p_sinfo->time_stop))) { // chyby mi tady osetreni loop flagu if (p_sinfo->flag[0] & GK_LOOP) { calc_time_loop(next_time, p_sinfo->start[0], &p_sinfo->time_start, &p_sinfo->time_stop, &p_sinfo->time_delka, &p_sinfo->time); if (p_sinfo->p_flag[0]) *(p_sinfo->p_flag[0]) = 0; } else { p_sinfo->time = p_sinfo->time_delka; if (p_sinfo->p_flag[0]) *(p_sinfo->p_flag[0]) = ANIM_FLAG_KONEC; p_sinfo->akt[0] = K_CHYBA; } } else { p_sinfo->time = calc_time_akt(next_time, p_sinfo->time_start); if (p_sinfo->p_flag[0]) *(p_sinfo->p_flag[0]) = ftoi((p_sinfo->time / (float) p_sinfo->time_delka) * 100.0f); } p_mesh->p_sim_aktivni = p_sinfo->p_sim[0]; p_mesh->sim_aktivni_time = p_sinfo->time; if (animovat) { if ((p_mesh->p_data->kflag & (KONT_VIDITELNY | KONT_VIDITELNY_ZRC)) && !(p_mesh->sim_flag & GAME_MESH_RANI)) { mat_mult(&p_mesh->world, &p_mesh->m, &tmp1); key_sim_animuj_strom(p_sinfo->p_sim[0], p_sinfo->time, &tmp1); key_mesh_recalc_normal_anim(p_mesh); p_mesh->p_data->kflag |= KONT_POHYB; #ifdef DEBUG_MOD p_ber->debug.lani_vid = TRUE; #endif } else { #ifdef DEBUG_MOD p_ber->debug.lani_vid = FALSE; #endif } } } } } } /******************************************************** Zavislosti mezi meshama ******************************************************** */ /* Vazani meshu na sebe */ int kom_svaz_meshe(MeshHandle m_top, MeshHandle m_low) { PRVEK_LEVELU_GAME *p_top = p_ber->p_prv_lev[m_top]; PRVEK_LEVELU_GAME *p_low = p_ber->p_prv_lev[m_low]; assert(p_top && p_low); if (p_top->flag & PRV_LOW || p_low->flag != 0) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_top->flag |= PRV_TOP; p_low->flag |= PRV_LOW; // insert first p_low->p_next_low = p_top->p_next_low; p_low->p_prev_low = p_top; p_top->p_next_low = p_low; p_top->p_prev_low = NULL; return (TRUE); } /* Rozvazani zavislosti 2 meshu */ int kom_rozvaz_mesh(MeshHandle m_low) { PRVEK_LEVELU_GAME *p_low = p_ber->p_prv_lev[m_low]; assert(p_low); // Test - low objekt neni low objekt if (!(p_low->flag & PRV_LOW)) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } // Provazani prvku smerem dopredu p_low->p_prev_low->p_next_low = p_low->p_next_low; // Provazani zpet if (p_low->p_next_low) { p_low->p_next_low->p_prev_low = p_low->p_prev_low; } else { if (p_low->p_prev_low->flag & PRV_TOP) p_low->p_prev_low->flag &= ~PRV_TOP; } // Odstraneni low-flagu p_low->flag &= ~PRV_LOW; // Odstraneni vazeb p_low->p_next_low = NULL; p_low->p_prev_low = NULL; // reanimuj jako konecny prvek rani_updatuj_prvek_matice_vnitrek_end_top(p_low); return (TRUE); } TextHandle tani_go(MatHandle mh, int textura, int animace, int *p_flag, int flag, int start, int stop) { GK_TEXTANIM *p_tani; ANIM_TEXT *p_track; if (p_ber->p_mat[mh]) { p_track = p_ber->p_mat[mh]->p_atext[textura][animace]; if (!p_track) { kprintfe(TRUE, "K_CHYBA - FILE %s LINE %d", __FILE__, __LINE__); return (K_CHYBA); } p_tani = (GK_TEXTANIM *) mmalloc(sizeof(p_tani[0])); p_tani->material = mh; p_tani->p_track = p_track; p_tani->p_mat = p_ber->p_mat[mh]->ttext + textura; p_tani->p_flag = p_flag; p_tani->flag = p_track->flag | flag; calc_time_end(p_tani->p_track->endtime, p_ber->TimeEndLastFrame, start, stop, &p_tani->start, &p_tani->stop, &p_tani->time_start, &p_tani->time_stop, &p_tani->time_delka); p_tani->p_next = p_ber->p_textanim; p_tani->p_prev = NULL; if (p_tani->p_next) { p_tani->p_next->p_prev = p_tani; } p_ber->p_textanim = p_tani; return ((RunHandle) p_tani); } //kprintfe(TRUE,"K_CHYBA - FILE %s LINE %d",__FILE__,__LINE__); return (K_CHYBA); } /* Animace texture materialu */ void tani_init_scena(G_KONFIG * p_ber) { EDIT_MATERIAL *p_mat; int i, j, k; for (i = 0; i < MAX_CELKEM_MATERIALU; i++) { p_mat = p_ber->p_mat[i]; if (p_mat) { for (k = 0; k < MAT_TEXTUR; k++) { for (j = 0; j < p_mat->atextnum[k]; j++) { if (p_mat->p_atext[k][j] && p_mat->p_atext[k][j]->flag & ANIM_TEXT_DEFAULT) { tani_go(i, k, j, NULL, FALSE, 0, 0); break; } } } } } } /* Texture animace */ void tani_updatuj(G_KONFIG * p_ber) { dword next_time = p_ber->TimeEndLastFrame; GK_TEXTANIM *p_tani = p_ber->p_textanim; while (p_tani) { if (next_time > p_tani->time_stop) { if (p_tani->flag & GK_LOOP) { calc_time_loop(next_time, p_tani->start, &p_tani->time_start, &p_tani->time_stop, &p_tani->time_delka, &p_tani->time); // zruseni flagu konec if (p_tani->p_flag) *(p_tani->p_flag) = 0; } else { p_tani->time = p_tani->time_delka; if (p_tani->p_flag) *(p_tani->p_flag) = ANIM_FLAG_KONEC; } } else { p_tani->time = calc_time_akt(next_time, p_tani->time_start); if (p_tani->p_flag) *(p_tani->p_flag) = ftoi((p_tani->time / (float) p_tani->time_delka) * 100.0f); } //p_tani->time -> aktualni cas animace key_sim_to_text_matrix(p_tani->p_track, p_tani->time, p_tani->p_mat); p_tani = p_tani->p_next; } } void tani_zrus(GK_TEXTANIM ** p_tmp) { GK_TEXTANIM *p_tani = *p_tmp; GK_TEXTANIM *p_next; while (p_tani) { p_next = p_tani->p_next; null_free((void **) &p_tani); p_tani = p_next; } if (p_tmp) { *p_tmp = NULL; } } /* Joint-animace - chapadelnici -> vraci pocet objektu s animacema a pocet animaci celkem */ ExMeshHandle mesh_to_ex_mesh(MeshHandle mh) { return (p_ber->p_prv_lev[mh]->mesh); } /* Vrati pocet objektu ktere maji mesh-animace */ int chani_mesh_cti_objekty(ExMeshHandle mh) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[mh]; int i, anim = 0; if (p_mesh->p_joint_anim) { for (i = 0; i < p_mesh->objektu; i++) { if (p_mesh->p_joint_anim[i]) anim++; } return (anim); } else return (0); } /* Cte objekt v poradi s animacema */ int chani_mesh_cti_chapadelniky(ExMeshHandle mh, int objekt, ChapadloHandle ** p_chap, int *p_chapadel) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[mh]; ChapadloHandle *p_handle; JOINT_ANIMACE *p_anim; int i, chapadel, anim = 0; if (p_mesh->p_joint_anim) { for (i = 0; i < p_mesh->objektu; i++) { if (p_mesh->p_joint_anim[i]) { if (objekt == anim) { chapadel = 0; p_anim = p_mesh->p_joint_anim[i]; while (p_anim) { chapadel++; p_anim = p_anim->p_next; } *p_chapadel = chapadel; if (chapadel) { *p_chap = p_handle = (ChapadloHandle *) mmalloc(sizeof(p_handle[0]) * chapadel); p_anim = p_mesh->p_joint_anim[i]; chapadel = 0; while (p_anim) { p_handle[chapadel++] = (ChapadloHandle) p_anim; p_anim = p_anim->p_next; } } return (chapadel); } anim++; } } return (anim); } else return (0); } char *chani_cti_jmeno(ChapadloHandle chh) { JOINT_ANIMACE *p_ani = (JOINT_ANIMACE *) chh; return (p_ani->jmeno); } // zaradim to do seznamu animaci na chapadlo ChapadloHandle chani_zarad(ChapadloHandle chh) { JOINT_ANIMACE *p_ani = (JOINT_ANIMACE *) chh; p_ani->p_game_next = p_ber->p_chap; p_ber->p_chap = p_ani; p_ani->p_game_prev = NULL; if (p_ani->p_game_next) { p_ani->p_game_next->p_game_prev = p_ani; } return (chh); } /* Spusti animaci chapadelniha - vrati handle na bezici animaci */ ChapadloHandle chani_go(ChapadloHandle chh, int *p_flag, int flag, int start, int stop) { JOINT_ANIMACE *p_ani = (JOINT_ANIMACE *) chh; calc_time(p_ani->framenum, p_ber->TimeEndLastFrame, start, stop, &p_ani->start, &p_ani->stop, &p_ani->time_start, &p_ani->time_stop, &p_ani->time_delka); p_ani->flag |= (GK_AKTIVNI | flag); p_ani->konec = FALSE; return (chh); } /* Stopne animaci chapadelnika */ ChapadloHandle chani_stop(ChapadloHandle chh) { JOINT_ANIMACE *p_ani = (JOINT_ANIMACE *) chh; p_ani->flag = 0; return (chh); } /* Zrusi animaci */ ChapadloHandle chani_zrus(ChapadloHandle chh) { JOINT_ANIMACE *p_ani = (JOINT_ANIMACE *) chh; if (!p_ani->p_game_prev) { p_ber->p_chap = p_ani->p_game_next; if (p_ber->p_chap) { p_ber->p_chap->p_game_prev = NULL; } } else { p_ani->p_game_prev = p_ani->p_game_next; if (p_ani->p_game_next) p_ani->p_game_next->p_game_prev = p_ani->p_game_prev; } return (chh); } void chani_zrus_all(G_KONFIG * p_ber) { p_ber->p_chap = NULL; return; } void chani_updatuj(G_KONFIG * p_ber) { JOINT_ANIMACE *p_ani = p_ber->p_chap; dword next_time = p_ber->TimeEndLastFrame; #ifdef DEBUG_MOD p_ber->debug.vertex_obj = 0; #endif while (p_ani) { if (next_time > p_ani->time_stop) { if (p_ani->flag & GK_LOOP) { calc_time_loop(next_time, p_ani->start, &p_ani->time_start, &p_ani->time_stop, &p_ani->time_delka, &p_ani->time); // zruseni flagu konec if (p_ani->p_flag) *(p_ani->p_flag) = 0; } else { p_ani->time = p_ani->time_delka; if (p_ani->p_flag) *(p_ani->p_flag) = ANIM_FLAG_KONEC; } } else { p_ani->time = calc_time_akt(next_time, p_ani->time_start); if (p_ani->p_flag) *(p_ani->p_flag) = ftoi((p_ani->time / (float) p_ani->time_delka) * 100.0f); } if (p_ber->conf_animace_okoli) { if ((*p_ani->p_kkflag) & (KONT_VIDITELNY | KONT_VIDITELNY_ZRC) && (*p_ani->p_koflag) & (KONT_VIDITELNY | KONT_VIDITELNY_ZRC)) { key_kosti_stream_animuj(p_ani); (*p_ani->p_kkflag) |= KONT_POHYB; #ifdef DEBUG_MOD p_ber->debug.vertex_obj++; #endif } } p_ani = p_ani->p_game_next; } } berusky2-0.12/src/komat/3dinterface.cpp0000644000175000017500000014033013674426075014737 00000000000000/* 3D interface - interface pro OpenGL */ #include "3d_all.h" int glstav_blending; // blending on-off int glstav_cull; // cull mod int glstav_cull_mod; // jaka strana se orezava int glstav_lighting; // gl svetla int glstav_specular; // spekularni svetla int glstav_diffuse; // diffusni svetla int glstav_mlha; int glstav_mlha_causal; int glstav_array_diffuse; int glstav_array_specular; int glstav_array_normal; int glstav_genenv_s[6]; // 1 int glstav_genenv_t[6]; // 2 int glstav_genenv_r[6]; // 3 int glstav_genenv_q[6]; // 4 int glstav_multitext_units; int glstav_alfa_blok; int glstav_text_blok[6]; int glstav_num_bumb_units; int *glstav_p_bumb_units; int glstav_cliping; int glstav_pn_triangles; int glstav_deph_test; int glstav_alfa_test; int glstav_zmask; int glstav_bump_mapping; int glstav_zmena_kamery; int glstav_text_akt; // aktivni texury int glstav_text_akt_client; // aktivni klientska texura int glstav_textury_2d[6]; // textury int glstav_textury_1d[6]; // textury GLuint glstav_last_text_2d[6]; // posledni textura GLuint glstav_last_text_1d[6]; // posledni textura int glstav_text_array[6]; // texturovaci pole int glstav_text_array_akt; // aktualni texturovaci pole int glstav_text_map_indicie[6]; // mapovaci indicie pro textury (cislo mapy) int glstav_text_poly_indicie; // mapovaci indicie pro poly (cislo mapy) unsigned int glstav_posun_flagy2[6] = { MAT2_T1_MATRIX, MAT2_T2_MATRIX, MAT2_T3_MATRIX, MAT2_T4_MATRIX, 0, 0 }; unsigned int glstav_texgen_on[6] = { MAT2_CALC_MAP1, MAT2_CALC_MAP2, MAT2_CALC_MAP3, MAT2_CALC_MAP4, 0, 0 }; unsigned int glstav_texgen_eye_lin_flagy[6] = { MAT_T1_EYE_LIN, MAT_T2_EYE_LIN, MAT_T3_EYE_LIN, MAT_T4_EYE_LIN, 0, 0 }; unsigned int glstav_texgen_sphere_flagy[6] = { MAT_T1_SPHERE, MAT_T2_SPHERE, MAT_T3_SPHERE, MAT_T4_SPHERE, 0, 0 }; GLMATRIX glstav_texgen[6]; int glstav_view_x; int glstav_view_y; int glstav_view_dx; int glstav_view_dy; int glstav_matrix_2d_mod; STAGE_FUNC_ALFA p_alfa_stage_func[STAGE_ALFA_FUNKCI]; STAGE_FUNC p_text_stage_func[STAGE_TEXT_FUNKCI]; STAGE_FUNC_ELEM p_text_stage_func_elem[STAGE_TEXT_FUNKCI]; EDIT_STATE_ALFA_BLOK alfa_stage_edit_blok[STAGE_ALFA_FUNKCI + STATE_BLOK_PRUHL + 1]; EDIT_STATE_TEXT_BLOK text_stage_edit_blok[STAGE_TEXT_FUNKCI]; #define TYP_TEXTURY_NUM 3 #define TYP_TEXT_COLOR 0 #define TYP_TEXT_DOT3 1 #define TYP_TEXT_DUDV 2 char typ_textury[TYP_TEXTURY_NUM][MAX_JMENO] = { "Color Map", "DOT3 Bump-Map", "DUDV Map" }; GLMATRIX __mat_kamera; GLMATRIX __mat_world; GLMATRIX __mat_vysl; GLMATRIX __mat_camera_project; // transformuje 3D do 2D GLMATRIX __mat_init; GLMATRIX __mat_top_matrix[MAX_WORD_MATRIX_STACK]; // druha word-matrix -> top-matrix int __mat_top_matrix_akt; GLMATRIX __mat_tmp; int __mat_text[4]; void glstav_reset(void) { int i; glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &glstav_multitext_units); glstav_bump_mapping = TRUE; glstav_cull = FALSE; glstav_cull_mod = K_CHYBA; cull_on(); cull_back(); glstav_lighting = TRUE; light_on_off(FALSE); glstav_specular = TRUE; specular_off(); glstav_diffuse = FALSE; glstav_mlha = TRUE; glstav_mlha_causal = FALSE; disable_fog(); glstav_blending = TRUE; blend_off(); glstav_deph_test = FALSE; deph_test_set(TRUE); glstav_alfa_test = TRUE; alfa_test_off(); glAlphaFunc(GL_GREATER, 0.5f); glstav_zmask = FALSE; zmask_set(TRUE); glstav_array_diffuse = FALSE; glstav_array_specular = FALSE; glstav_array_normal = FALSE; for (i = 0; i < 6; i++) { glstav_genenv_s[i] = FALSE; glstav_genenv_t[i] = FALSE; glstav_genenv_r[i] = FALSE; glstav_genenv_q[i] = FALSE; glstav_text_blok[i] = K_CHYBA; glstav_textury_1d[i] = FALSE; glstav_textury_2d[i] = FALSE; glstav_last_text_1d[i] = FALSE; glstav_last_text_2d[i] = FALSE; glstav_text_array[i] = FALSE; glstav_text_map_indicie[i] = FALSE; } glstav_alfa_blok = K_CHYBA; glstav_text_array_akt = K_CHYBA; glstav_text_poly_indicie = K_CHYBA; glstav_text_akt = K_CHYBA; glstav_text_akt_client = FALSE; glstav_pn_triangles = FALSE; } /* Elementarni nastavovaci funkce */ void el_text_modulace(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } void el_text_modulace_comb(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } void el_text_modulace_2x_comb(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f); } void el_text_add(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); } void el_text_add_comb(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } void el_text_decal(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); } void el_text_blend(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND); } void el_text_replace(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); } void el_text_dot3_bump(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } /* Stage-blok-sekce */ int sbl_text_modulace(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_txt) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_MODULACE); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_modulace_2x(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_txt) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_MODULACE); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_add(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_mat->textfile[t][0] && p_mat->p_text[t]) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_ADD); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_decal(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_mat->textfile[t][0] && p_mat->p_text[t]) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_DECAL); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_blend(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_mat->textfile[t][0] && p_mat->p_text[t]) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_BLEND); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_replace(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_mat->textfile[t][0] && p_mat->p_text[t]) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_REPLACE); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_dot3_bump(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret; int koord; /* Test efektu - je to podporovane videokartou? */ glstav_multitext_units -= rezerva; if (gl_ext::extlist_text_env_dot3 && last_text + p_stage->textur <= glstav_multitext_units) { t = p_text->textury[DOT3_BUMP]; // Text 0 - DOT3 p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_DOT3_BUMP); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; } if (last_text < glstav_multitext_units) { t = p_text->textury[DOT3_TEXT]; // Text 1 - Color-mapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, p_text->text_funkce[DOT3_TEXT]); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; ret = last_text; } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_dot3_bump_env(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret; int koord; /* Test efektu - je to podporovane videokartou? */ glstav_multitext_units -= rezerva; if (gl_ext::extlist_text_env_dot3 && last_text + p_stage->textur <= glstav_multitext_units) { t = p_text->textury[DOT3_ENV]; // Text 2 - Lightmapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, p_text->text_funkce[DOT3_ENV]); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; t = p_text->textury[DOT3_BUMP]; // Text 0 - DOT3 Color-Mapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_DOT3_BUMP); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; } if (last_text < glstav_multitext_units) { t = p_text->textury[DOT3_TEXT]; // Text 1 - Color-mapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, p_text->text_funkce[DOT3_TEXT]); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; ret = last_text; } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); } int sbl_text_bump_env(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { return (K_CHYBA); } /* Alfa-stage bloky */ void sbl_alfa_default(void) { blend_off(); alfa_test_off(); } void sbl_alfa_flek(void) { blend_on(); alfa_test_off(); glBlendFunc(GL_ZERO, GL_SRC_COLOR); } void sbl_alfa_kour(void) { blend_on(); alfa_test_off(); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR); } void sbl_alfa_pruhledny(void) { blend_on(); alfa_test_on(); glAlphaFunc(GL_GREATER, 0.004f); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } void sbl_alfa_test(void) { blend_off(); alfa_test_on(); glAlphaFunc(GL_GREATER, 0.5f); } void nahod_state_bloky(void) { /* Text-bloky */ p_text_stage_func[0] = sbl_text_modulace; p_text_stage_func[1] = sbl_text_add; p_text_stage_func[2] = sbl_text_decal; p_text_stage_func[3] = sbl_text_blend; p_text_stage_func[4] = sbl_text_replace; p_text_stage_func[5] = sbl_text_dot3_bump; p_text_stage_func[6] = sbl_text_dot3_bump_env; p_text_stage_func[7] = sbl_text_bump_env; p_text_stage_func[8] = sbl_text_modulace_2x; /* Elementarni text_bloky funkce */ p_text_stage_func_elem[0] = el_text_modulace; p_text_stage_func_elem[1] = el_text_add; p_text_stage_func_elem[2] = el_text_decal; p_text_stage_func_elem[3] = el_text_blend; p_text_stage_func_elem[4] = el_text_replace; p_text_stage_func_elem[5] = el_text_dot3_bump; p_text_stage_func_elem[6] = el_text_modulace_2x_comb; /* Alfa-bloky */ p_alfa_stage_func[0] = sbl_alfa_default; p_alfa_stage_func[1] = sbl_alfa_flek; p_alfa_stage_func[2] = sbl_alfa_kour; p_alfa_stage_func[3] = sbl_alfa_pruhledny; p_alfa_stage_func[4] = sbl_alfa_test; /* Text-bloky */ strcpy(text_stage_edit_blok[0].jmeno, "Modulace"); text_stage_edit_blok[0].funkce = 0; text_stage_edit_blok[0].edit_funkce = -1; text_stage_edit_blok[0].textur = 1; text_stage_edit_blok[0].delka = 1; text_stage_edit_blok[0].textury_typ[0] = TYP_TEXT_COLOR; text_stage_edit_blok[0].text_funkce[0] = BLOK_MODULACE; strcpy(text_stage_edit_blok[1].jmeno, "Add"); text_stage_edit_blok[1].funkce = 1; text_stage_edit_blok[1].edit_funkce = -1; text_stage_edit_blok[1].textur = 1; text_stage_edit_blok[1].delka = 1; text_stage_edit_blok[1].textury_typ[0] = TYP_TEXT_COLOR; text_stage_edit_blok[1].text_funkce[0] = BLOK_ADD; strcpy(text_stage_edit_blok[2].jmeno, "Decal"); text_stage_edit_blok[2].funkce = 2; text_stage_edit_blok[2].edit_funkce = -1; text_stage_edit_blok[2].textur = 1; text_stage_edit_blok[2].delka = 1; text_stage_edit_blok[2].textury_typ[0] = TYP_TEXT_COLOR; text_stage_edit_blok[2].text_funkce[0] = BLOK_DECAL; strcpy(text_stage_edit_blok[3].jmeno, "Blend"); text_stage_edit_blok[3].funkce = 3; text_stage_edit_blok[3].edit_funkce = -1; text_stage_edit_blok[3].textur = 1; text_stage_edit_blok[3].delka = 1; text_stage_edit_blok[3].textury_typ[0] = TYP_TEXT_COLOR; text_stage_edit_blok[3].text_funkce[0] = BLOK_BLEND; strcpy(text_stage_edit_blok[4].jmeno, "Replace"); text_stage_edit_blok[4].funkce = 4; text_stage_edit_blok[4].edit_funkce = -1; text_stage_edit_blok[4].textur = 1; text_stage_edit_blok[4].delka = 1; text_stage_edit_blok[4].textury_typ[0] = TYP_TEXT_COLOR; text_stage_edit_blok[4].text_funkce[0] = BLOK_REPLACE; strcpy(text_stage_edit_blok[5].jmeno, "DOT3Color"); text_stage_edit_blok[5].funkce = 5; text_stage_edit_blok[5].edit_funkce = 0; text_stage_edit_blok[5].textur = 2; text_stage_edit_blok[5].delka = 2; text_stage_edit_blok[5].textury_typ[0] = TYP_TEXT_DOT3; // dot-3 bump-mapa text_stage_edit_blok[5].textury_typ[1] = TYP_TEXT_COLOR; // color-mapa text_stage_edit_blok[5].text_funkce[0] = BLOK_DOT3_BUMP; text_stage_edit_blok[5].text_funkce[1] = BLOK_MODULACE; strcpy(text_stage_edit_blok[6].jmeno, "DOT3ENV"); text_stage_edit_blok[6].funkce = 6; text_stage_edit_blok[6].edit_funkce = 1; text_stage_edit_blok[6].textur = 3; text_stage_edit_blok[6].delka = 3; text_stage_edit_blok[6].textury_typ[0] = TYP_TEXT_DOT3; // bump-mapa text_stage_edit_blok[6].textury_typ[1] = TYP_TEXT_COLOR; // color-map textura text_stage_edit_blok[6].textury_typ[2] = TYP_TEXT_COLOR; // light-mapa text_stage_edit_blok[6].text_funkce[0] = BLOK_DOT3_BUMP; text_stage_edit_blok[6].text_funkce[1] = BLOK_MODULACE; text_stage_edit_blok[6].text_funkce[2] = BLOK_MODULACE; strcpy(text_stage_edit_blok[7].jmeno, "EnvBump"); text_stage_edit_blok[7].funkce = 7; text_stage_edit_blok[7].edit_funkce = 2; text_stage_edit_blok[7].textur = 3; text_stage_edit_blok[7].delka = 3; text_stage_edit_blok[7].textury_typ[0] = TYP_TEXT_DUDV; // normalova mapa text_stage_edit_blok[7].textury_typ[1] = TYP_TEXT_COLOR; // color-map textura text_stage_edit_blok[7].textury_typ[2] = TYP_TEXT_COLOR; // spodni mapa text_stage_edit_blok[7].text_funkce[0] = BLOK_BUMP_ENV; text_stage_edit_blok[7].text_funkce[1] = BLOK_MODULACE; text_stage_edit_blok[7].text_funkce[2] = BLOK_MODULACE; strcpy(text_stage_edit_blok[8].jmeno, "Modulace 2X"); text_stage_edit_blok[8].funkce = 0; text_stage_edit_blok[8].edit_funkce = -1; text_stage_edit_blok[8].textur = 1; text_stage_edit_blok[8].delka = 1; text_stage_edit_blok[8].textury_typ[0] = TYP_TEXT_COLOR; text_stage_edit_blok[8].text_funkce[0] = BLOK_MODULACE2X; /* Alfa-bloky */ strcpy(alfa_stage_edit_blok[0].jmeno, "Default"); alfa_stage_edit_blok[0].alfa_pruhledny = FALSE; alfa_stage_edit_blok[0].funkce = 0; strcpy(alfa_stage_edit_blok[1].jmeno, "Flek"); alfa_stage_edit_blok[1].alfa_pruhledny = TRUE; alfa_stage_edit_blok[1].funkce = 1; strcpy(alfa_stage_edit_blok[2].jmeno, "Kour"); alfa_stage_edit_blok[2].alfa_pruhledny = TRUE; alfa_stage_edit_blok[2].funkce = 2; strcpy(alfa_stage_edit_blok[3].jmeno, "Pruhledny"); alfa_stage_edit_blok[3].alfa_pruhledny = TRUE; alfa_stage_edit_blok[3].funkce = 3; strcpy(alfa_stage_edit_blok[4].jmeno, "Maska"); alfa_stage_edit_blok[4].alfa_pruhledny = FALSE; alfa_stage_edit_blok[4].funkce = 4; strcpy(alfa_stage_edit_blok[STATE_BLOK_PRUHL].jmeno, "Pruhledny-system"); alfa_stage_edit_blok[STATE_BLOK_PRUHL].alfa_pruhledny = FALSE; alfa_stage_edit_blok[STATE_BLOK_PRUHL].funkce = 3; } /* ATI vertex array - set vertex array */ void mesh_vertex_array_init_ati(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_varray = &p_mesh->varray; p_varray->ati_handle = glNewObjectBufferATI(p_varray->ati_velikost, NULL, GL_DYNAMIC_ATI); } void mesh_vertex_array_zrus_ati(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_varray = &p_mesh->varray; if (glIsObjectBufferATI(p_varray->ati_handle)) { glFreeObjectBufferATI(p_varray->ati_handle); p_varray->ati_handle = 0; } } void mesh_vertex_array_set_ati(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; int handle = p_mesh->varray.ati_handle; int m2flag = p_mesh->p_data->m2flag; int norm = glstav_pn_triangles || m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); glArrayObjectATI(GL_VERTEX_ARRAY, 3, GL_FLOAT, 0, handle, p_va->ati_start_pos); array_normal_off(); array_diffuse_off(); array_specular_off(); if (norm) { array_normal_on(); glArrayObjectATI(GL_NORMAL_ARRAY, 3, GL_FLOAT, 0, handle, p_va->ati_start_norm); } else { array_normal_off(); } if (m2flag & MAT2_DIFFUSE) { array_diffuse_on(); glArrayObjectATI(GL_COLOR_ARRAY, 4, GL_FLOAT, 0, handle, p_va->ati_start_diff); } else { array_diffuse_off(); } if (m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC) || p_mesh->p_data->kflag & KONT_DRAW_SPEC) { array_specular_on(); glArrayObjectATI(GL_SECONDARY_COLOR_ARRAY_EXT, 3, GL_FLOAT, 0, handle, p_va->ati_start_spec); } else { array_specular_off(); } } void mesh_vertex_array_set_koord_ati(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; int handle = p_mesh->varray.ati_handle; int *p_int, ind; p_int = glstav_text_map_indicie; ind = *p_int++; ind = K_CHYBA; array_text_set_num(0); if (ind != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, 0, handle, p_va->ati_start_text[ind]); } else { array_text_off(); } ind = *p_int++; ind = K_CHYBA; if (array_text_set_num(1)) { if (ind != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, 0, handle, p_va->ati_start_text[ind]); } else { array_text_off(); } } ind = *p_int++; ind = K_CHYBA; if (array_text_set_num(2)) { if (ind != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, 0, handle, p_va->ati_start_text[ind]); } else { array_text_off(); } } ind = *p_int++; ind = K_CHYBA; if (array_text_set_num(3)) { if (ind != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, 0, handle, p_va->ati_start_text[ind]); } else { array_text_off(); } } } void mesh_vertex_array_upload_ati(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; int handle = p_mesh->varray.ati_handle; int vertexu = p_mesh->vertexnum, k2flag = p_mesh->p_data->k2flag, m2flag = p_mesh->p_data->m2flag, kflag = p_mesh->p_data->kflag; int norm = glstav_pn_triangles || p_mesh-> p_data->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); if (k2flag & KONT2_UPDATE_POS) glUpdateObjectBufferATI(handle, p_va->ati_start_pos, sizeof(p_mesh->p_vertex_pos[0]) * vertexu, p_mesh->p_vertex_pos, GL_PRESERVE_ATI); if (norm && k2flag & KONT2_UPDATE_NORM) glUpdateObjectBufferATI(handle, p_va->ati_start_norm, sizeof(p_mesh->p_vertex_norm[0]) * vertexu, p_mesh->p_vertex_norm, GL_PRESERVE_ATI); if (k2flag & KONT2_UPDATE_DIFF && m2flag & MAT2_DIFFUSE) { if (kflag & KONT_DRAW_VODA) { glUpdateObjectBufferATI(handle, p_va->ati_start_diff, sizeof(p_mesh->p_vertex_diff_voda[0]) * vertexu, p_mesh->p_vertex_diff_voda, GL_PRESERVE_ATI); } else { glUpdateObjectBufferATI(handle, p_va->ati_start_diff, sizeof(p_mesh->p_vertex_diff[0]) * vertexu, p_mesh->p_vertex_diff, GL_PRESERVE_ATI); } } if (k2flag & KONT2_UPDATE_SPEC) { if (kflag & KONT_DRAW_VODA) { glUpdateObjectBufferATI(handle, p_va->ati_start_spec, sizeof(p_mesh->p_vertex_spec_voda[0]) * vertexu, p_mesh->p_vertex_spec_voda, GL_PRESERVE_ATI); } else { glUpdateObjectBufferATI(handle, p_va->ati_start_spec, sizeof(p_mesh->p_vertex_spec[0]) * vertexu, p_mesh->p_vertex_spec, GL_PRESERVE_ATI); } } if (k2flag & KONT2_UPDATE_TEXT1) glUpdateObjectBufferATI(handle, p_va->ati_start_text[0], sizeof(p_mesh->p_vertex_uv1_material[0]) * vertexu, p_mesh->p_vertex_uv1_material, GL_PRESERVE_ATI); if (k2flag & KONT2_UPDATE_TEXT2) glUpdateObjectBufferATI(handle, p_va->ati_start_text[1], sizeof(p_mesh->p_vertex_uv2_material[0]) * vertexu, p_mesh->p_vertex_uv2_material, GL_PRESERVE_ATI); if (k2flag & KONT2_UPDATE_TEXT3) glUpdateObjectBufferATI(handle, p_va->ati_start_text[2], sizeof(p_mesh->p_vertex_uv3_material[0]) * vertexu, p_mesh->p_vertex_uv3_material, GL_PRESERVE_ATI); if (k2flag & KONT2_UPDATE_TEXT4) glUpdateObjectBufferATI(handle, p_va->ati_start_text[3], sizeof(p_mesh->p_vertex_uv4_material[0]) * vertexu, p_mesh->p_vertex_uv4_material, GL_PRESERVE_ATI); p_mesh->p_data->k2flag &= ~(KONT2_UPLOAD); } /* Poly-listy */ void poly_vertex_array_init_ati(EDIT_MESH_POLY * p_poly) { VERTEX_ARRAYS *p_varray = &p_poly->varray; p_varray->ati_handle = glNewObjectBufferATI(sizeof(p_poly->p_koord[0]) * p_poly->facenum, p_poly->p_koord, GL_DYNAMIC_ATI); } void poly_vertex_array_zrus_ati(EDIT_MESH_POLY * p_poly) { VERTEX_ARRAYS *p_varray = &p_poly->varray; if (glIsObjectBufferATI(p_varray->ati_handle)) { glFreeObjectBufferATI(p_varray->ati_handle); p_varray->ati_handle = 0; } } void poly_vertex_array_upload_ati(EDIT_MESH_POLY * p_poly) { glUpdateObjectBufferATI(p_poly->varray.ati_handle, 0, sizeof(p_poly->p_koord[0]) * p_poly->facenum, p_poly->p_koord, GL_DISCARD_ATI); } /* Navaze aktualni renderovaci pole na poly */ void poly_vertex_array_set_ati(EDIT_MESH_POLY * p_poly) { int handle = p_poly->varray.ati_handle; int spec = p_poly->m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC) || p_poly->kflag & KONT_DRAW_SPEC; int norm = glstav_pn_triangles || p_poly->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); int *p_int, ind; glArrayObjectATI(GL_VERTEX_ARRAY, 3, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, 0); array_diffuse_on(); glArrayObjectATI(GL_COLOR_ARRAY, 4, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, 16 * sizeof(float)); if (norm) { array_normal_on(); glArrayObjectATI(GL_NORMAL_ARRAY, 3, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, 3 * sizeof(float)); } else { array_normal_off(); } if (spec) { array_specular_on(); glArrayObjectATI(GL_SECONDARY_COLOR_ARRAY_EXT, 3, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, 24 * sizeof(float)); } else { array_specular_off(); } p_int = glstav_text_map_indicie; if (glstav_text_poly_indicie > 0) { array_text_set_num(0); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, (6 + ((ind) << 1)) * sizeof(float)); } else { array_text_off(); } } p_int++; if (glstav_text_poly_indicie > 1) { array_text_set_num(1); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, (6 + ((ind) << 1)) * sizeof(float)); } else { array_text_off(); } } p_int++; if (glstav_text_poly_indicie > 2) { array_text_set_num(2); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, (6 + ((ind) << 1)) * sizeof(float)); } else { array_text_off(); } } p_int++; if (glstav_text_poly_indicie > 3) { array_text_set_num(3); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, (6 + ((ind) << 1)) * sizeof(float)); } else { array_text_off(); } } array_text_set_num(glstav_text_poly_indicie); array_text_on(); glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, sizeof(p_poly->p_koord[0]), handle, 14 * sizeof(float)); } // vertex-araay nastavim ale nepovilim pro to co neni pozadovany? // 1 rutina pro rendering vsech poli void vertex_array_start_render_ati(void) { glEnableClientState(GL_VERTEX_ARRAY); if (gl_ext::extlist_ati_element_array) glEnableClientState(GL_ELEMENT_ARRAY_ATI); array_text_set_num(0); array_text_on(); array_text_set_num(1); array_text_off(); array_text_set_num(2); array_text_off(); array_text_set_num(3); array_text_off(); } void vertex_array_stop_render_ati(void) { glDisableClientState(GL_VERTEX_ARRAY); if (gl_ext::extlist_ati_element_array) glDisableClientState(GL_ELEMENT_ARRAY_ATI); array_diffuse_off(); array_specular_off(); array_normal_off(); array_text_set_num(0); array_text_off(); array_text_set_num(1); array_text_off(); array_text_set_num(2); array_text_off(); array_text_set_num(3); array_text_off(); } /* ARB vertex array - inicializuje pole */ void mesh_vertex_array_init_arb(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; glGenBuffersARB(1, (GLuint *) & p_va->ati_handle); glGenBuffersARB(1, (GLuint *) & p_va->arb_handle_indicie); } // Zrusi pole void mesh_vertex_array_zrus_arb(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_varray = &p_mesh->varray; if (glIsBufferARB(p_varray->ati_handle)) { glDeleteBuffersARB(1, (GLuint *) & p_varray->ati_handle); p_varray->ati_handle = 0; } if (glIsBufferARB(p_varray->arb_handle_indicie)) { glDeleteBuffersARB(1, (GLuint *) & p_varray->arb_handle_indicie); p_varray->arb_handle_indicie = 0; } } // Nastavi mesh pro rendering - vertexy void mesh_vertex_array_set_arb(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; int m2flag = p_mesh->p_data->m2flag; int norm = glstav_pn_triangles || m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, p_va->arb_handle_indicie); glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle); glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_pos)); if (norm) { array_normal_on(); glNormalPointer(GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_norm)); } else { array_normal_off(); } if (m2flag & MAT2_DIFFUSE) { array_diffuse_on(); glColorPointer(4, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_diff)); } else { array_diffuse_off(); } if (m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC) || p_mesh->p_data->kflag & KONT_DRAW_SPEC) { array_specular_on(); glSecondaryColorPointerEXT(3, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_spec)); } else { array_specular_off(); } } // Nastavi mesh pro rendering - koordinaty void mesh_vertex_array_set_koord_arb(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; int *p_int, ind; p_int = glstav_text_map_indicie; ind = *p_int++; array_text_set_num(0); if (ind != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_text[ind])); } else { array_text_off(); } ind = *p_int++; if (array_text_set_num(1)) { if (ind != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_text[ind])); } else { array_text_off(); } } ind = *p_int++; if (array_text_set_num(2)) { if (ind != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_text[ind])); } else { array_text_off(); } } ind = *p_int++; if (array_text_set_num(3)) { if (ind != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_text[ind])); } else { array_text_off(); } } } // Uploadnuje mesh do videoram po zmene void mesh_vertex_array_upload_arb(GAME_MESH_OLD * p_mesh) { VERTEX_ARRAYS *p_va = &p_mesh->varray; int vertexu = p_mesh->vertexnum, k2flag = p_mesh->p_data->k2flag, m2flag = p_mesh->p_data->m2flag, kflag = p_mesh->p_data->kflag; int norm = glstav_pn_triangles || p_mesh-> p_data->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); if (k2flag & KONT2_UPDATE_NEW) { glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, p_va->arb_handle_indicie); glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(p_mesh->p_face[0]) * p_mesh->facevel, p_mesh->p_face, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle); glBufferDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_velikost, p_mesh->p_vertex_pos, GL_DYNAMIC_DRAW_ARB); } glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle); if (k2flag & KONT2_UPDATE_POS) glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_pos, sizeof(p_mesh->p_vertex_pos[0]) * vertexu, p_mesh->p_vertex_pos); if (norm && k2flag & KONT2_UPDATE_NORM) glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_norm, sizeof(p_mesh->p_vertex_norm[0]) * vertexu, p_mesh->p_vertex_norm); if (k2flag & KONT2_UPDATE_DIFF && m2flag & MAT2_DIFFUSE) { if (kflag & KONT_DRAW_VODA) { glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_diff, sizeof(p_mesh->p_vertex_diff_voda[0]) * vertexu, p_mesh->p_vertex_diff_voda); } else { glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_diff, sizeof(p_mesh->p_vertex_diff[0]) * vertexu, p_mesh->p_vertex_diff); } } if (k2flag & KONT2_UPDATE_SPEC) { if (kflag & KONT_DRAW_VODA) { glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_spec, sizeof(p_mesh->p_vertex_spec_voda[0]) * vertexu, p_mesh->p_vertex_spec_voda); } else { glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_spec, sizeof(p_mesh->p_vertex_spec[0]) * vertexu, p_mesh->p_vertex_spec); } } if (k2flag & KONT2_UPDATE_TEXT1) glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_text[0], sizeof(p_mesh->p_vertex_uv1_material[0]) * vertexu, p_mesh->p_vertex_uv1_material); if (k2flag & KONT2_UPDATE_TEXT2) glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_text[1], sizeof(p_mesh->p_vertex_uv2_material[0]) * vertexu, p_mesh->p_vertex_uv2_material); if (k2flag & KONT2_UPDATE_TEXT3) glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_text[2], sizeof(p_mesh->p_vertex_uv3_material[0]) * vertexu, p_mesh->p_vertex_uv3_material); if (k2flag & KONT2_UPDATE_TEXT4) glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, p_va->ati_start_text[3], sizeof(p_mesh->p_vertex_uv4_material[0]) * vertexu, p_mesh->p_vertex_uv4_material); p_mesh->p_data->k2flag &= ~(KONT2_UPLOAD); } /* Poly-listy - inicializace */ void poly_vertex_array_init_arb(EDIT_MESH_POLY * p_poly) { VERTEX_ARRAYS *p_va = &p_poly->varray; glGenBuffersARB(1, (GLuint *) & p_va->ati_handle); } // Zruseni void poly_vertex_array_zrus_arb(EDIT_MESH_POLY * p_poly) { VERTEX_ARRAYS *p_va = &p_poly->varray; if (glIsBufferARB(p_va->ati_handle)) { glDeleteBuffersARB(1, (GLuint *) & p_va->ati_handle); p_va->ati_handle = 0; } } // uploaduje poly do videoram void poly_vertex_array_upload_arb(EDIT_MESH_POLY * p_poly) { VERTEX_ARRAYS *p_va = &p_poly->varray; glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle); glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(p_poly->p_koord[0]) * p_poly->facenum, p_poly->p_koord, GL_DYNAMIC_DRAW_ARB); } // Nastavi poly na rendering void poly_vertex_array_set_arb(EDIT_MESH_POLY * p_poly) { VERTEX_ARRAYS *p_va = &p_poly->varray; int spec = p_poly->m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC) || p_poly->kflag & KONT_DRAW_SPEC; int norm = glstav_pn_triangles || p_poly->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); int *p_int, ind; glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle); glVertexPointer(3, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET(0)); array_diffuse_on(); glColorPointer(4, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET(16 * sizeof(float))); if (norm) { array_normal_on(); glNormalPointer(GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET(3 * sizeof(float))); } else { array_normal_off(); } if (spec) { array_specular_on(); glSecondaryColorPointerEXT(3, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET(24 * sizeof(float))); } else { array_specular_off(); } p_int = glstav_text_map_indicie; if (glstav_text_poly_indicie > 0) { array_text_set_num(0); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float))); } else { array_text_off(); } } p_int++; if (glstav_text_poly_indicie > 1) { array_text_set_num(1); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float))); } else { array_text_off(); } } p_int++; if (glstav_text_poly_indicie > 2) { array_text_set_num(2); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float))); } else { array_text_off(); } } p_int++; if (glstav_text_poly_indicie > 3) { array_text_set_num(3); if ((ind = *p_int) != K_CHYBA) { array_text_on(); glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float))); } else { array_text_off(); } } array_text_set_num(glstav_text_poly_indicie); array_text_on(); glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET(14 * sizeof(float))); } // start renderu void vertex_array_start_render_arb(void) { glEnableClientState(GL_VERTEX_ARRAY); array_text_set_num(0); array_text_on(); array_text_set_num(1); array_text_off(); array_text_set_num(2); array_text_off(); array_text_set_num(3); array_text_off(); } // stop renderu void vertex_array_stop_render_arb(void) { glDisableClientState(GL_VERTEX_ARRAY); array_diffuse_off(); array_specular_off(); array_normal_off(); array_text_set_num(0); array_text_off(); array_text_set_num(1); array_text_off(); array_text_set_num(2); array_text_off(); array_text_set_num(3); array_text_off(); } /* Univerzalni pointer-based */ void (*mesh_vertex_array_init) (GAME_MESH_OLD * p_mesh); void (*mesh_vertex_array_zrus) (GAME_MESH_OLD * p_mesh); void (*mesh_vertex_array_upload) (GAME_MESH_OLD * p_mesh); void (*mesh_vertex_array_set) (GAME_MESH_OLD * p_mesh); void (*mesh_vertex_array_set_koord) (GAME_MESH_OLD * p_mesh); void (*vertex_array_start_render) (void); void (*vertex_array_stop_render) (void); void (*poly_vertex_array_init) (EDIT_MESH_POLY * p_poly); void (*poly_vertex_array_zrus) (EDIT_MESH_POLY * p_poly); void (*poly_vertex_array_upload) (EDIT_MESH_POLY * p_poly); void (*poly_vertex_array_set) (EDIT_MESH_POLY * p_poly); void vertex_array_start_render_nic(void) { }; void vertex_array_stop_render_nic(void) { }; /* Inicializuje vretexove pole podle podporovanych extenzi */ void vertex_array_ini(void) { if (gl_ext::extlist_arb_vertex_buffer) { gl_ext::extlist_vertex_array = TRUE; gl_ext::extlist_indicie_array = TRUE; poly_vertex_array_init = poly_vertex_array_init_arb; poly_vertex_array_zrus = poly_vertex_array_zrus_arb; poly_vertex_array_upload = poly_vertex_array_upload_arb; poly_vertex_array_set = poly_vertex_array_set_arb; mesh_vertex_array_init = mesh_vertex_array_init_arb; mesh_vertex_array_zrus = mesh_vertex_array_zrus_arb; mesh_vertex_array_upload = mesh_vertex_array_upload_arb; mesh_vertex_array_set = mesh_vertex_array_set_arb; mesh_vertex_array_set_koord = mesh_vertex_array_set_koord_arb; vertex_array_start_render = vertex_array_start_render_arb; vertex_array_stop_render = vertex_array_stop_render_arb; } else if (gl_ext::extlist_ati_vertex_array_object) { gl_ext::extlist_vertex_array = gl_ext::extlist_ati_vertex_array_object; gl_ext::extlist_indicie_array = gl_ext::extlist_ati_element_array; poly_vertex_array_init = poly_vertex_array_init_ati; poly_vertex_array_zrus = poly_vertex_array_zrus_ati; poly_vertex_array_upload = poly_vertex_array_upload_ati; poly_vertex_array_set = poly_vertex_array_set_ati; mesh_vertex_array_init = mesh_vertex_array_init_ati; mesh_vertex_array_zrus = mesh_vertex_array_zrus_ati; mesh_vertex_array_upload = mesh_vertex_array_upload_ati; mesh_vertex_array_set = mesh_vertex_array_set_ati; mesh_vertex_array_set_koord = mesh_vertex_array_set_koord_ati; vertex_array_start_render = vertex_array_start_render_ati; vertex_array_stop_render = vertex_array_stop_render_ati; } else { vertex_array_start_render = vertex_array_start_render_nic; vertex_array_stop_render = vertex_array_stop_render_nic; assert(0); } } berusky2-0.12/src/komat/Berusky3d_light.cpp0000644000175000017500000031112413674766375015625 00000000000000/* berusky3d_light.c Svetelny modul k beruskam II */ #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" extern G_KONFIG ber, *p_ber; inline void sdl_maxlook_korekce(DYN_LIGHT * p_light, float min, float max, float dosah) { p_light->min = min; // utlum je od 0 do 1 if (dosah >= max) { p_light->max = max; p_light->dosah = max; p_light->look_max = 255; } else { p_light->max = max; p_light->dosah = dosah; p_light->look_max = (dosah * 255.0f) / max; } } /* Test mod->render statickych a dynamickych svetel */ void dl_renderuj_svetla(G_KONFIG * p_ber) { int i; set_matrix_world_init(); for (i = 0; i < p_ber->slightnum; i++) { kresli_kosoctverec(p_ber->p_project, p_ber->p_camera, get_matrix_init(), &p_ber->p_slight[i].p, 0.5f, 1.0f, 1.0f, 1.0f); } for (i = 0; i < p_ber->dl_lightnum; i++) { if (p_ber->p_dlight[i].akt) kresli_kosoctverec(p_ber->p_project, p_ber->p_camera, get_matrix_init(), &p_ber->p_dlight[i].tp, 0.5f, 1.0f, 0.0f, 0.0f); } for (i = 0; i < p_ber->edl_lightnum; i++) { if (p_ber->p_edlight[i].akt) { kresli_kosoctverec(p_ber->p_project, p_ber->p_camera, get_matrix_init(), &p_ber->p_edlight[i].tp, 0.5f, 1.0f, 0.0f, 0.0f); } } glColor3f(1.0f, 1.0f, 1.0f); } /* *********************************************** Dynamicka scena *********************************************** */ static inline void dl_poly_diff_color_set(EDIT_MESH_POLY * p_poly, float r, float g, float b, float a) { TEXT_KOORD *p_koord = p_poly->p_koord; int i; for (i = 0; i < p_poly->facenum; i++) { p_koord->da = a; p_koord->dr = r; p_koord->dg = g; p_koord->db = b; p_koord++; } } static inline void dl_poly_diff_color_add(EDIT_MESH_POLY * p_poly, float r, float g, float b, float a) { TEXT_KOORD *p_koord = p_poly->p_koord; int i; for (i = 0; i < p_poly->facenum; i++) { p_koord->da += a; p_koord->dr += r; p_koord->dg += g; p_koord->db += b; p_koord++; } } static inline void dl_poly_diff_color_mult(EDIT_MESH_POLY * p_poly, float r, float g, float b, float a) { TEXT_KOORD *p_koord = p_poly->p_koord; int i; for (i = 0; i < p_poly->facenum; i++) { p_koord->da *= a; p_koord->dr *= r; p_koord->dg *= g; p_koord->db *= b; p_koord++; } } static inline void dl_mesh_diff_color_set(GAME_MESH_OLD * p_mesh, float r, float g, float b, float a) { BODRGBA *p_vertex; int i, vnum; p_vertex = p_mesh->p_vertex_diff; vnum = p_mesh->vertexnum; for (i = 0; i < vnum; i++) { p_vertex->a = a; p_vertex->r = r; p_vertex->g = g; p_vertex->b = b; p_vertex++; } } static inline void dl_mesh_diff_color_add(GAME_MESH_OLD * p_mesh, float r, float g, float b, float a) { BODRGBA *p_vertex; int i, vnum; p_vertex = p_mesh->p_vertex_diff; vnum = p_mesh->vertexnum; for (i = 0; i < vnum; i++) { p_vertex->a += a; p_vertex->r += r; p_vertex->g += g; p_vertex->b += b; p_vertex++; } } inline void ld_mesh_diff_color_mul(GAME_MESH_OLD * p_mesh, float r, float g, float b, float a) { BODRGBA *p_vertex; int i, vnum; p_vertex = p_mesh->p_vertex_diff; vnum = p_mesh->vertexnum; for (i = 0; i < vnum; i++) { p_vertex->a *= a; p_vertex->r *= r; p_vertex->g *= g; p_vertex->b *= b; p_vertex++; } } /* Spekularni */ static inline void dl_poly_spec_color_set(EDIT_MESH_POLY * p_poly, float r, float g, float b, float a) { TEXT_KOORD *p_koord = p_poly->p_koord; int i; for (i = 0; i < p_poly->facenum; i++) { p_koord->sr = r; p_koord->sg = g; p_koord->sb = b; p_koord++; } } static inline void dl_poly_spec_color_add(EDIT_MESH_POLY * p_poly, float r, float g, float b, float a) { TEXT_KOORD *p_koord = p_poly->p_koord; int i; for (i = 0; i < p_poly->facenum; i++) { p_koord->sr += r; p_koord->sg += g; p_koord->sb += b; p_koord++; } } static inline void dl_poly_spec_color_mult(EDIT_MESH_POLY * p_poly, float r, float g, float b, float a) { TEXT_KOORD *p_koord = p_poly->p_koord; int i; for (i = 0; i < p_poly->facenum; i++) { p_koord->sr *= r; p_koord->sg *= g; p_koord->sb *= b; p_koord++; } } static inline void dl_mesh_spec_color_set(GAME_MESH_OLD * p_mesh, float r, float g, float b, float a) { BODRGB *p_vertex; int i, vnum; p_vertex = p_mesh->p_vertex_spec; vnum = p_mesh->vertexnum; for (i = 0; i < vnum; i++) { p_vertex->r = r; p_vertex->g = g; p_vertex->b = b; p_vertex++; } } static inline void dl_mesh_spec_color_add(GAME_MESH_OLD * p_mesh, float r, float g, float b, float a) { BODRGB *p_vertex; int i, vnum; p_vertex = p_mesh->p_vertex_spec; vnum = p_mesh->vertexnum; for (i = 0; i < vnum; i++) { p_vertex->r += r; p_vertex->g += g; p_vertex->b += b; p_vertex++; } } static inline void dl_mesh_spec_color_mul(GAME_MESH_OLD * p_mesh, float r, float g, float b, float a) { BODRGB *p_vertex; int i, vnum; p_vertex = p_mesh->p_vertex_spec; vnum = p_mesh->vertexnum; for (i = 0; i < vnum; i++) { p_vertex->r *= r; p_vertex->g *= g; p_vertex->b *= b; p_vertex++; } } /* Aplikuje se na vsechny meshe a poly */ void dl_scena_set_ambient(float r, float g, float b, float a) { p_ber->dl_ambient[0] = r; p_ber->dl_ambient[1] = g; p_ber->dl_ambient[2] = b; p_ber->dl_ambient[3] = a; } /* Prace s meshama */ int dl_mesh_modulate_diff(MeshHandle mh, float r, float g, float b, float a) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[mh]; if (p_mesh) { ld_mesh_diff_color_mul(p_mesh, r, g, b, a); return (TRUE); } return (FALSE); } int dl_mesh_set_diff(MeshHandle mh, float r, float g, float b, float a) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (p_mesh) { dl_mesh_diff_color_set(p_mesh, r, g, b, a); return (TRUE); } return (FALSE); } int dl_mesh_add_diff(MeshHandle mh, float r, float g, float b, float a) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (p_mesh) { dl_mesh_diff_color_add(p_mesh, r, g, b, a); return (TRUE); } return (FALSE); } int dl_mesh_modulate_spec(MeshHandle mh, float r, float g, float b, float a) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (p_mesh && p_mesh->p_data->m2flag & MAT2_SPECULAR) { dl_mesh_spec_color_mul(p_mesh, r, g, b, a); return (TRUE); } return (FALSE); } int dl_mesh_set_spec(MeshHandle mh, float r, float g, float b, float a) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (p_mesh && p_mesh->p_data->m2flag & MAT2_SPECULAR) { dl_mesh_spec_color_set(p_mesh, r, g, b, a); return (TRUE); } return (FALSE); } int dl_mesh_add_spec(MeshHandle mh, float r, float g, float b, float a) { GAME_MESH_OLD *p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (p_mesh && p_mesh->p_data->m2flag & MAT2_SPECULAR) { dl_mesh_spec_color_add(p_mesh, r, g, b, a); return (TRUE); } return (FALSE); } /* ******************************************************************* Dynamicke svetla ******************************************************************* */ inline void sdla_animaci_zrus(DYN_LIGHT_ANIM * p_an) { p_an->endtime = 0; if (p_an->diff_keys) { null_free((void **) &p_an->p_dfkeys); null_free((void **) &p_an->p_diff); p_an->diff_keys = 0; } if (p_an->alfa_keys) { null_free((void **) &p_an->p_akeys); null_free((void **) &p_an->p_alfa); p_an->alfa_keys = 0; } if (p_an->pos_keys) { null_free((void **) &p_an->p_pkeys); null_free((void **) &p_an->p_pos); p_an->pos_keys = 0; } if (p_an->trg_keys) { null_free((void **) &p_an->p_tkeys); null_free((void **) &p_an->p_trg); p_an->trg_keys = 0; } if (p_an->dos_keys) { null_free((void **) &p_an->p_dskeys); null_free((void **) &p_an->p_dosah); p_an->dos_keys = 0; } } void sdla_animaci_zrus_online(DYN_LIGHT_ANIM * p_an) { sdla_animaci_zrus(p_an); } inline void sdla_animaci_vyrob(DYN_LIGHT_ANIM * p_an, int framenum, int pos_keys, int dir_keys, int diff_keys, int spec_keys, int dos_keys, int alfa_keys) { p_an->endtime = calc_endtime(framenum); p_an->pos_keys = pos_keys; if (pos_keys) { p_an->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_pkeys[0]) * pos_keys); p_an->p_pos = (BOD *) mmalloc(sizeof(p_an->p_pos[0]) * pos_keys); } p_an->trg_keys = dir_keys; if (dir_keys) { p_an->p_tkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_tkeys[0]) * dir_keys); p_an->p_trg = (BOD *) mmalloc(sizeof(p_an->p_trg[0]) * dir_keys); } p_an->dos_keys = dos_keys; if (dos_keys) { p_an->p_dskeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_dskeys[0]) * dos_keys); p_an->p_dosah = (BOD *) mmalloc(sizeof(p_an->p_dosah[0]) * dos_keys); } p_an->diff_keys = diff_keys; if (diff_keys) { p_an->p_dfkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_dfkeys[0]) * diff_keys); p_an->p_diff = (BARVA_RGBA *) mmalloc(sizeof(p_an->p_diff[0]) * diff_keys); } p_an->alfa_keys = alfa_keys; if (alfa_keys) { p_an->p_akeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_akeys[0]) * alfa_keys); p_an->p_alfa = (float *) mmalloc(sizeof(p_an->p_alfa[0]) * alfa_keys); } p_an->spec_keys = spec_keys; if (spec_keys) { p_an->p_spkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_spkeys[0]) * spec_keys); p_an->p_spec = (BARVA_RGBA *) mmalloc(sizeof(p_an->p_spec[0]) * spec_keys); } } /* keyframova animace svetel */ inline void sdl_light_to_light(DYN_LIGHT * p_light, DYN_LIGHT_ANIM * p_track, int time) { int loop = p_light->an_flag & GK_LOOP; BOD d; if (p_track->pos_keys) { key_track_interpolace_bod(&p_light->np, p_track->p_pos, p_track->p_pkeys, time, p_track->endtime, p_track->pos_keys, loop); p_light->tp = p_light->np; } if (p_track->dos_keys) { key_track_interpolace_bod_linear(&d, p_track->p_dosah, p_track->p_dskeys, time, p_track->endtime, p_track->dos_keys, loop); sdl_maxlook_korekce(p_light, d.y, d.z, d.x); // interpolace je dosah/min/max } if (p_track->diff_keys) { key_track_interpolace_wbod_linear((WBOD *) & p_light->dr, (WBOD *) p_track->p_diff, p_track->p_dfkeys, time, p_track->endtime, p_track->diff_keys, loop); } } LightHandle sdl_svetlo_vyrob(dword flag) { DYN_LIGHT *p_light; int l; for (l = 0; l < p_ber->dl_lightnum; l++) { if (!p_ber->p_dlight[l].akt) { p_light = p_ber->p_dlight + l; goto nasel; } } p_light = p_ber->p_dlight + l; p_ber->dl_lightnum++; nasel: p_light->akt = TRUE; p_light->flag = flag | SDL_ZMENA_GLOBAL | SDL_KOFOLA; p_ber->dl_new = TRUE; sprintf(p_light->jmeno, "Run-time svetlo %d", l); return (l); } LightHandle sdl_svetlo_pojmenuj(LightHandle handle, char *p_jmeno) { if (!p_ber->p_dlight[handle].akt) return (FALSE); else strcpy(p_ber->p_dlight[handle].jmeno, p_jmeno); return (handle); } int sdl_svetlo_zrus(LightHandle handle) { if (!p_ber->p_dlight[handle].akt) { return (K_CHYBA); } else { // Zruseni svetla p_ber->p_dlight[handle].akt = FALSE; if (p_ber->dl_lightnum == handle + 1) p_ber->dl_lightnum--; p_ber->dl_new = TRUE; // Zruseni pripadne animace if (p_ber->p_dlight[handle].an.endtime) sdla_animaci_zrus(&p_ber->p_dlight[handle].an); return (TRUE); } } // Vrati pocet dynamickych svetel int sdl_get_num(void) { int i, num = 0; for (i = 0; i < p_ber->dl_lightnum; i++) if (p_ber->p_dlight[i].akt) num++; return (num); } // Pointer na pole dynamickych svetel int sdl_get_list(LIGHT_INFO * p_li, int max) { int i, num = 0; for (i = 0; i < p_ber->dl_lightnum; i++) { if (p_ber->p_dlight[i].akt && num < max) { strcpy(p_li[num].jmeno, p_ber->p_dlight[i].jmeno); p_li[num].light_handle = i; p_li[num].light_handle = p_ber->p_dlight[i].ktrida; num++; } } return (num); } // Vrati pocet dynamickych svetel int edl_get_num(void) { int i, num = 0; for (i = 0; i < p_ber->edl_lightnum; i++) if (p_ber->p_edlight[i].akt) num++; return (num); } // Pointer na pole dynamickych svetel int edl_get_list(LIGHT_INFO * p_li, int max) { int i, num = 0; for (i = 0; i < p_ber->edl_lightnum; i++) { if (p_ber->p_edlight[i].akt && num < max) { strcpy(p_li[num].jmeno, p_ber->p_edlight[i].jmeno); p_li[num].light_handle = i; p_li[num].light_handle = p_ber->p_edlight[i].ktrida; num++; } } return (num); } /* *********************************************** vyroba / ruseni svetel *********************************************** */ LightHandle sdl_svetlo_set_pos(LightHandle lh, BOD * p_bod) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; if (lh < p_ber->dl_lightnum && p_light->akt) { p_light->tp = p_light->np = *p_bod; p_light->flag |= SDL_ZMENA_GLOBAL; p_ber->dl_recalc = TRUE; return (lh); } else return (K_CHYBA); } LightHandle sdl_svetlo_set_pos_ext(LightHandle lh, float x, float y, float z) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; if (lh < p_ber->dl_lightnum && p_light->akt) { p_light->np.x = x; p_light->np.y = y; p_light->np.z = z; p_light->tp = p_light->np; p_light->flag |= SDL_ZMENA_GLOBAL; p_ber->dl_recalc = TRUE; return (lh); } else return (K_CHYBA); } /* min -> zacatek utlumu svetla max -> tady uz je to svetlo uplne neviditelne */ LightHandle sdl_svetlo_set_diff(LightHandle lh, float dr, float dg, float db, float min, float max, float dosah) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; if (lh < p_ber->dl_lightnum && p_light->akt) { p_light->dr = dr; // zakladni barva svetla p_light->dg = dg; p_light->db = db; sdl_maxlook_korekce(p_light, min, max, dosah); p_light->flag |= SDL_ZMENA_LOKAL; p_ber->dl_recalc = TRUE; return (lh); } else return (K_CHYBA); } LightHandle sdl_svetlo_set_diff_sub(LightHandle lh, float sr, float sg, float sb) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; if (lh < p_ber->dl_lightnum && p_light->akt) { p_light->sr = sr; // zakladni barva svetla p_light->sg = sg; p_light->sb = sb; p_light->flag |= SDL_ZMENA_LOKAL; p_ber->dl_recalc = TRUE; return (lh); } else return (K_CHYBA); } RunHandle sdl_svetlo_anim(LightHandle handle, BOD * p_bod, float dr, float dg, float db, float da, float dosah, float min, float max, int flag, int *p_flag, int framenum) { return (TRUE); } LightHandle sdl_anim_vyrob(LightHandle lh, int framenum, int pos_keys, int diff_keys, int dosah_keys) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; DYN_LIGHT_ANIM *p_an; if (lh < p_ber->dl_lightnum && p_light->akt) { p_an = &p_light->an; if (p_an->endtime) sdla_animaci_zrus(p_an); sdla_animaci_vyrob(p_an, framenum, pos_keys, 0, diff_keys, 0, dosah_keys, 0); return (lh); } else return (K_CHYBA); } LightHandle sdl_anim_zrus(LightHandle lh) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; if (lh < p_ber->dl_lightnum && p_light->akt && p_light->an.endtime) { sdla_animaci_zrus(&p_light->an); return (lh); } else return (K_CHYBA); } LightHandle sdl_anim_vloz_klic_posun(LightHandle lh, int klic, float x, float y, float z, int frame) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->dl_lightnum && p_light->akt && p_an->endtime && klic < p_an->pos_keys) { p_an->p_pos[klic].x = x; p_an->p_pos[klic].y = y; p_an->p_pos[klic].z = z; p_an->p_pkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } LightHandle sdl_anim_vloz_klic_posun_bod(LightHandle lh, int klic, BOD * p_p, int frame) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->dl_lightnum && p_light->akt && p_an->endtime && klic < p_an->pos_keys) { p_an->p_pos[klic] = *p_p; p_an->p_pkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } LightHandle sdl_anim_vloz_klic_diff(LightHandle lh, int klic, float r, float g, float b, float a, int frame) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->dl_lightnum && p_light->akt && p_an->endtime && klic < p_an->diff_keys) { p_an->p_diff[klic].r = r; p_an->p_diff[klic].g = g; p_an->p_diff[klic].b = b; p_an->p_diff[klic].a = a; p_an->p_dfkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } LightHandle sdl_anim_vloz_klic_vzdal(LightHandle lh, int klic, float dosah, float min, float max, int frame) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->dl_lightnum && p_light->akt && p_an->endtime && klic < p_an->dos_keys) { p_an->p_dosah[klic].x = dosah; p_an->p_dosah[klic].y = min; p_an->p_dosah[klic].z = max; p_an->p_dskeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } /* ************************************** Run-time animace ************************************** */ LightHandle sdl_anim_start(LightHandle lh, int *p_flag, int flag, int start, int stop) { DYN_LIGHT *p_light = p_ber->p_dlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->dl_lightnum && p_light->akt && p_an->endtime) { calc_time_end(p_an->endtime, p_ber->TimeEndLastFrame, start, stop, &p_light->start, &p_light->stop, &p_light->time_start, &p_light->time_stop, &p_light->time_delka); p_light->p_flag = p_flag; p_light->an_flag = flag; p_light->flag |= SDL_ANIMACE; return (lh); } else return (K_CHYBA); } int sdl_anim_stop(LightHandle rh) { DYN_LIGHT *p_light = p_ber->p_dlight + rh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (rh < p_ber->dl_lightnum && p_light->akt && p_an->endtime && p_light->flag & SDL_ANIMACE) { p_light->flag &= ~SDL_ANIMACE; return (rh); } else return (K_CHYBA); } /* keyframova animace svetel */ void sdla_updatuj(G_KONFIG * p_ber) { dword next_time = p_ber->TimeEndLastFrame; DYN_LIGHT *p_light; DYN_LIGHT_ANIM *p_an; int i; int konec; /* Animace se updatuji kazdy frame */ for (i = 0; i < p_ber->dl_lightnum; i++) { p_light = p_ber->p_dlight + i; p_an = &p_light->an; if (p_light->flag & SDL_REMOVE) { sdl_svetlo_zrus(i); continue; } if (p_light->flag & SDL_ANIMACE) { /* Test na konec animace */ if ((konec = (next_time > p_light->time_stop))) { if (p_light->an_flag & GK_LOOP) { calc_time_loop(next_time, p_light->start, &p_light->time_start, &p_light->time_stop, &p_light->time_delka, &p_light->time); konec = 0; if (p_light->p_flag) *(p_light->p_flag) = 0; } else { p_light->time = p_light->time_delka; p_light->flag &= ~SDL_ANIMACE; if (p_light->p_flag) *(p_light->p_flag) = ANIM_FLAG_KONEC; if (p_light->an_flag & GK_REMOVE) p_light->flag |= SDL_REMOVE; } } else { p_light->time = calc_time_akt(next_time, p_light->time_start); if (p_light->p_flag) *(p_light->p_flag) = ftoi((p_light->time / (float) p_light->time_delka) * 100.0f); } /* Vypocitej animaci svetla */ sdl_light_to_light(p_light, p_an, p_light->time); p_light->flag |= SDL_ZMENA_GLOBAL; p_ber->dl_recalc = TRUE; } } } // 1. Update svetel podle meshu // 2. Update svetel privazane k meshum -> update specialnima rutinama !!! // 3. Update svetel privazane k scene -> update specialnima rutinama !!! int dl_mesh_pridej_svetla(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh) { GAME_MESH_DATA *p_data = p_mesh->p_data; STATIC_LIGHT *p_slight = p_ber->p_slight; DYN_LIGHT *p_dlight = p_ber->p_dlight; void *p_light_dyn[MAX_FLARE_SVETEL * 2]; void *p_light_stat[MAX_FLARE_SVETEL * 2]; int lightakt = 0; int slightnum = 0; int dlightnum = 0; int i; int kflag = p_data->kflag; if (kflag & (KONT_POHYB | KONT_VIDITELNY_ZMENA) || p_ber->dl_recalc || p_ber->dl_new) { // Zapocitam staticke svetla pri pohybu nebo je prekopiruju if (p_data->kflag & KONT_POHYB) { for (lightakt = 0, i = 0; i < p_ber->slightnum; i++) { p_slight = p_ber->p_slight + i; if (p_slight->flag2 & SL2_DYNAMIC && p_slight->dosah > obb_vzdal_bod(&p_mesh->obb_world, &p_slight->p)) p_light_stat[lightakt++] = p_slight; } slightnum = lightakt; } else { slightnum = p_data->slightnum; } // Zaradim dynamicke svetla for (lightakt = 0, i = 0; i < p_ber->dl_lightnum; i++) { p_dlight = p_ber->p_dlight + i; if (p_dlight->akt && p_dlight->dosah > obb_vzdal_bod(&p_mesh->obb_world, &p_dlight->tp)) { p_light_dyn[lightakt++] = p_dlight; } } dlightnum = lightakt; i = dlightnum + slightnum; if (!i) { null_free((void **) &p_data->p_light); p_data->lightakt = p_data->lightmax = p_data->slightnum = 0; } else { if (i >= p_data->lightmax) { if (!(p_mesh->p_data->kflag & KONT_POHYB)) memcpy(p_light_stat, p_data->p_light, slightnum * sizeof(p_data->p_light[0])); null_free((void **) &p_data->p_light); i += (i >> 1) + 10; p_data->p_light = (void **) mmalloc(sizeof(p_data->p_light[0]) * i); p_data->lightmax = i; memcpy(p_data->p_light, p_light_stat, slightnum * sizeof(p_data->p_light[0])); memcpy(p_data->p_light + slightnum, p_light_dyn, dlightnum * sizeof(p_data->p_light[0])); } else { if (p_data->kflag & KONT_POHYB) memcpy(p_data->p_light, p_light_stat, slightnum * sizeof(p_data->p_light[0])); memcpy(p_data->p_light + slightnum, p_light_dyn, dlightnum * sizeof(p_data->p_light[0])); } p_data->lightakt = slightnum + dlightnum; p_data->slightnum = slightnum; } return (TRUE); } else { return (FALSE); } } /* Zjisti jestli se nektery dynamicky svetlo meshe zmenilo a musi se teda prepocitat */ inline int dl_mesh_svetlo_update(GAME_MESH_DATA * p_data) { DYN_LIGHT **p_dlight = (DYN_LIGHT **) p_data->p_light; dword flags = 0; int i; for (i = p_data->slightnum; i < p_data->lightakt; i++) { flags |= p_dlight[i]->flag; } return (flags & (SDL_ZMENA_GLOBAL | SDL_ZMENA_LOKAL)); } /* Pokud je svetlo privazany -> automaticky ho updatuju */ int dl_mesh_pripocitej_svetla(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh, int dyn_light, int extra_light, int full_light, int all) { EDIT_MATERIAL **p_mat = p_ber->p_mat; GAME_MESH_DATA *p_data = p_mesh->p_data; STATIC_LIGHT *p_slight; DYN_LIGHT *p_dlight; EXTRA_DYN_LIGHT *p_light; GLMATRIX *p_m = NULL; BOD *p_vertex_pos = NULL; BOD *p_vertex_norm = NULL; BODRGBA *p_vertex_diff = NULL; BODRGBA *p_vertex_diff_mat = NULL; BODRGB *p_vertex_spec = NULL; BODRGB *p_vertex_spec_mat = NULL; BOD p(0), n(0), dir(0), cam(0); int i, v, vnum, dflag, m2flag, j; int diffuse, specular, specular_light; int diffuse_ray, specular_ray; int kflag = p_data->kflag; int *p_kflag; int keyframe; int norm, o, objektu; int staticky, bump; int beruska = ber_je_mesh_beruska_fast(p_mesh); float vzdal = INT_MAX, vzdal2, I, lesk = 1.0f; float Ar, Ag, Ab; float *p_looksqrt_linear_float = p_ber->p_looksqrt_linear_float; float *p_looksqrt_quad_float = p_ber->p_looksqrt_quadratic_float; m2flag = p_data->m2flag; diffuse = m2flag & MAT2_DIFFUSE && p_mesh->p_vertex_diff; specular = m2flag & MAT2_SPECULAR; if (!diffuse && !specular) return (FALSE); if (!diffuse || (dyn_light && !(kflag & KONT_POHYB) && !p_ber->dl_new && !dl_mesh_svetlo_update(p_data))) { dyn_light = FALSE; } extra_light = extra_light ? p_data->edlightnum : 0; specular_light = extra_light && kflag & KONT_DRAW_SPEC; keyframe = kflag & KONT_KEYFRAME; staticky = kflag & KONT_STATIC; vnum = p_mesh->vertexnum; if (diffuse) { diffuse_ray = m2flag & MAT2_DIFFUSE_RAY; specular_ray = m2flag & MAT2_SPECULAR_RAY; Ar = p_ber->dl_ambient[0]; Ag = p_ber->dl_ambient[1]; Ab = p_ber->dl_ambient[2]; } else { diffuse_ray = specular_ray = FALSE; } if (extra_light) { cam.x = p_ber->p_invcam->_41; cam.y = p_ber->p_invcam->_42; cam.z = p_ber->p_invcam->_43; } if (!keyframe) p_m = &p_mesh->m; #ifdef DEBUG_MOD p_ber->debug.light_meshu++; #endif objektu = p_mesh->objektu; p_kflag = (int *) p_mesh->p_kflag; for (o = 0; o < objektu; o++) { if (all || p_kflag[o] & (KONT_VIDITELNY | KONT_VIDITELNY_ZRC)) { v = p_mesh->objektstart[o]; vnum = v + p_mesh->objektnum[o]; bump = p_mat[p_mesh->p_mat[o]]->flag2 & MAT2_BUMP; if (keyframe) p_m = p_mesh->p_key + o; p_vertex_pos = p_mesh->p_vertex_pos + v; p_vertex_diff = p_mesh->p_vertex_diff + v; p_vertex_diff_mat = p_mesh->p_vertex_diff_material + v; if (diffuse_ray) p_vertex_norm = p_mesh->p_vertex_norm + v; if (specular || specular_light) { p_vertex_spec = p_mesh->p_vertex_spec + v; p_vertex_spec_mat = p_mesh->p_vertex_spec_material + v; } for (; v < vnum; v++, p_vertex_pos++, p_vertex_norm++) { if (full_light) { if (p_vertex_diff) { if (beruska) { p_vertex_diff->r = p_vertex_diff_mat->r; p_vertex_diff->g = p_vertex_diff_mat->g; p_vertex_diff->b = p_vertex_diff_mat->b; } else { p_vertex_diff->r = 1.0f; p_vertex_diff->g = 1.0f; p_vertex_diff->b = 1.0f; } } if (p_vertex_spec) { p_vertex_spec->r = 0.0f; p_vertex_spec->g = 0.0f; p_vertex_spec->b = 0.0f; } } else { norm = keyframe; transformuj_bod_matici_bod(p_vertex_pos, p_m, &p); if (diffuse) { if (!staticky && diffuse_ray) { transformuj_nbod_matici_bod(p_vertex_norm, p_m, &n); p_vertex_diff->r = p_vertex_diff_mat->r * Ar; p_vertex_diff->g = p_vertex_diff_mat->g * Ag; p_vertex_diff->b = p_vertex_diff_mat->b * Ab; } else { p_vertex_diff->r = p_vertex_diff_mat->r; p_vertex_diff->g = p_vertex_diff_mat->g; p_vertex_diff->b = p_vertex_diff_mat->b; } } if (specular) { if (specular_ray) { // defaultni spekularni svetlo bude modifikovano vektor_set((BOD *) p_vertex_spec, 0.0f); } else { // defaultni spekularni se kopiruje *p_vertex_spec = *p_vertex_spec_mat; } } else if (specular_light) { // defaultni spekularni neexistuje vektor_set((BOD *) p_vertex_spec, 0.0f); } // Update statickych svetel podle materialu if (diffuse && !staticky) { for (i = 0; i < p_data->slightnum; i++) { p_slight = (STATIC_LIGHT *) p_data->p_light[i]; vzdal = vzdal_bodu_bod(&p_slight->p, &p); if (vzdal < p_slight->dosah) { if (p_slight->uhel) { vektor_sub(&p, &p_slight->p, &dir); vektor_norm(&dir); if (norm) { vektor_norm(&n); norm = FALSE; } I = vektor_dot_product(&n, &dir); if (I <= 0.0f) continue; } else { I = 1.0f; } if (p_slight->utlum) { I *= 1.0f / (p_slight->k1 + p_slight->k2 * vzdal + p_slight->k3 * vzdal * vzdal); } if (diffuse_ray) { p_vertex_diff->r += p_vertex_diff_mat->r * p_slight->r * I; p_vertex_diff->g += p_vertex_diff_mat->g * p_slight->g * I; p_vertex_diff->b += p_vertex_diff_mat->b * p_slight->b * I; } if (specular_ray) { I *= lesk; p_vertex_spec->r += p_vertex_spec_mat->r * p_slight->r * I; p_vertex_spec->g += p_vertex_spec_mat->g * p_slight->g * I; p_vertex_spec->b += p_vertex_spec_mat->b * p_slight->b * I; } #ifdef DEBUG_MOD p_ber->debug.light_vertexu++; #endif } } // Normalizace barev if (diffuse_ray) { vektor_norm_up((BOD *) p_vertex_diff); } if (specular_ray) { vektor_norm_up((BOD *) p_vertex_spec); } } // Update jednoduchych dynamickych svetel if (dyn_light) { for (i = p_data->slightnum; i < p_data->lightakt; i++) { p_dlight = (DYN_LIGHT *) p_data->p_light[i]; dflag = p_dlight->flag; vzdal = vzdal_bodu_bod(&p_dlight->tp, &p); if (vzdal > p_dlight->dosah) continue; if (vzdal <= p_dlight->min) { if (dflag & SDL_ADD_SUB) { p_vertex_diff->r -= p_dlight->sr; p_vertex_diff->g -= p_dlight->sg; p_vertex_diff->b -= p_dlight->sb; vektor_norm_down((BOD *) p_vertex_diff); p_vertex_diff->r += p_dlight->dr; p_vertex_diff->g += p_dlight->dg; p_vertex_diff->b += p_dlight->db; } else if (dflag & SDL_SUB) { p_vertex_diff->r -= p_dlight->dr; p_vertex_diff->g -= p_dlight->dg; p_vertex_diff->b -= p_dlight->db; } else { p_vertex_diff->r += p_dlight->dr; p_vertex_diff->g += p_dlight->dg; p_vertex_diff->b += p_dlight->db; } } else { j = ftoi(((vzdal - p_dlight->min) / (p_dlight->max - p_dlight->min)) * 255.0f); I = (dflag & SDL_UTLUM_LINEAR) ? p_looksqrt_linear_float[j] : p_looksqrt_quad_float[j]; if (I < DELTA_MIN) continue; if (dflag & SDL_ADD_SUB) { p_vertex_diff->r -= p_dlight->sr * I; p_vertex_diff->g -= p_dlight->sg * I; p_vertex_diff->b -= p_dlight->sb * I; vektor_norm_down((BOD *) p_vertex_diff); p_vertex_diff->r += p_dlight->dr * I; p_vertex_diff->g += p_dlight->dg * I; p_vertex_diff->b += p_dlight->db * I; } else if (dflag & SDL_SUB) { p_vertex_diff->r -= p_dlight->dr * I; p_vertex_diff->g -= p_dlight->dg * I; p_vertex_diff->b -= p_dlight->db * I; } else { p_vertex_diff->r += p_dlight->dr * I; p_vertex_diff->g += p_dlight->dg * I; p_vertex_diff->b += p_dlight->db * I; } } } } // Update extra-svetel - pokud jsou if (extra_light) { for (i = 0; i < extra_light; i++) { p_light = p_data->p_edlight[i]; dflag = p_light->flag; if (dflag & EDL_ZEMNI_MLHA) { vzdal = fabsf(p_light->tp.y - p.y); if (vzdal <= p_light->v_start) { p_vertex_spec->r = p_light->sr; p_vertex_spec->g = p_light->sg; p_vertex_spec->b = p_light->sb; } else if (vzdal < p_light->v_stop) { vzdal2 = vzdal_bodu_bod(&cam, &p); if (vzdal2 < p_light->h_start) { I = 1.0f - (vzdal - p_light->v_start) / (p_light->v_stop - p_light->v_start); p_vertex_spec->r = p_light->sr * I; p_vertex_spec->g = p_light->sg * I; p_vertex_spec->b = p_light->sb * I; } else if (vzdal2 > p_light->h_stop) { p_vertex_spec->r = p_light->sr; p_vertex_spec->g = p_light->sg; p_vertex_spec->b = p_light->sb; } else { vzdal = 1.0f - (vzdal - p_light->v_start) / (p_light->v_stop - p_light->v_start); vzdal2 = (vzdal2 - p_light->h_start) / (p_light->h_stop - p_light->h_start); I = MAX(vzdal, vzdal2); p_vertex_spec->r = p_light->sr * I; p_vertex_spec->g = p_light->sg * I; p_vertex_spec->b = p_light->sb * I; } } } else { if (dflag & EDL_DOSAH) { if (dflag & EDL_BODOVE) { vzdal = vzdal_bodu_bod(&p_light->tp, &p); } else if (dflag & (EDL_PLOSNE_X | EDL_PLOSNE_Y | EDL_PLOSNE_Z)) { if (dflag & EDL_PLOSNE_X) { vzdal = fabsf(p_light->tp.x - p.x); } else if (dflag & EDL_PLOSNE_Y) { vzdal = fabsf(p_light->tp.y - p.y); } else { vzdal = fabsf(p_light->tp.z - p.z); } } if (vzdal >= p_light->dosah) continue; if (dflag & EDL_UTLUM_LIN) { vzdal = 1.0f - (vzdal) / (p_light->dosah * p_light->utlum); if (vzdal < DELTA_MIN) continue; } else if (dflag & EDL_UTLUM_KVAD) { vzdal = 1.0f - (vzdal * vzdal) / (p_light->dosah * p_light->utlum); if (vzdal < DELTA_MIN) continue; } else { vzdal = 1.0f; } } else { vzdal = 1.0f; } if (dflag & EDL_GOURAND) { vektor_sub(&p, &p_light->tp, &dir); vektor_norm(&dir); if (norm) { vektor_norm(&n); norm = FALSE; } I = vektor_dot_product(&n, &dir) * vzdal * p_light->gourand; if (I < DELTA_MIN) continue; } else { I = vzdal; } // Nastav alfa slozku if (dflag & (EDL_ALFA_MOD | EDL_ALFA_SET | EDL_ALFA_ADD | EDL_ALFA_SUB)) { if (dflag & EDL_ALFA_SET) { p_vertex_diff->a = 1.0f - p_light->da * I; } else if (dflag & EDL_ALFA_ADD) { p_vertex_diff->a = p_vertex_diff_mat->a + (1.0f - p_light->da * I); } else if (dflag & EDL_ALFA_MOD) { p_vertex_diff->a = p_vertex_diff_mat->a * (1.0f - p_light->da * I); } else { p_vertex_diff->a = p_vertex_diff_mat->a - (1.0f - p_light->da * I); } } // Nastav spekularni slozku if (dflag & (EDL_SPEC_MOD | EDL_SPEC_SET | EDL_SPEC_ADD | EDL_SPEC_SUB)) { if (dflag & EDL_SPEC_ADD) { p_vertex_spec->r += p_light->sr * I; p_vertex_spec->g += p_light->sg * I; p_vertex_spec->b += p_light->sb * I; } else if (dflag & EDL_SPEC_MOD) { p_vertex_spec->r *= p_light->sr * I; p_vertex_spec->g *= p_light->sg * I; p_vertex_spec->b *= p_light->sb * I; } else if (dflag & EDL_SPEC_SUB) { p_vertex_spec->r -= p_light->sr * I; p_vertex_spec->g -= p_light->sg * I; p_vertex_spec->b -= p_light->sb * I; } else { p_vertex_spec->r = p_light->sr * I; p_vertex_spec->g = p_light->sg * I; p_vertex_spec->b = p_light->sb * I; } } } } } } if (bump && diffuse) { vektor_norm_bump((BOD *) p_vertex_diff); } // Posun na dalsi vertex p_vertex_diff++; p_vertex_diff_mat++; if (specular || specular_light) { p_vertex_spec++; p_vertex_spec_mat++; } } } } p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; if (specular || specular_light) p_mesh->p_data->k2flag |= KONT2_UPDATE_SPEC; return (TRUE); } void dl_reset_svetel(G_KONFIG * p_ber) { DYN_LIGHT *p_light; EXTRA_DYN_LIGHT *p_edlight; int i; for (i = 0; i < p_ber->dl_lightnum; i++) { p_light = p_ber->p_dlight + i; if (p_light->akt) { p_light->flag &= ~(SDL_ZMENA_GLOBAL | SDL_ZMENA_LOKAL); } } for (i = 0; i < p_ber->edl_lightnum; i++) { p_edlight = p_ber->p_edlight + i; if (p_edlight->akt) { p_edlight->flag &= ~(EDL_ZMENA_GLOBAL | EDL_ZMENA_LOKAL); } } } inline void dl_updatuj_mesh(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh, int full_light, int all) { int v1, v2; v1 = dl_mesh_pridej_svetla(p_ber, p_mesh); v2 = edl_mesh_pridej_svetla(p_ber, p_mesh); if (v1 || v2) { dl_mesh_pripocitej_svetla(p_ber, p_mesh, v1, v2, full_light, all); p_mesh->p_data->kflag |= KONT_POHYB_ZRUS; } } inline void dl_updatuj_seznam_meshu(G_KONFIG * p_ber, int all) { GAME_MESH_OLD *p_mesh; int flag = (p_ber->conf_dyn_light_prvky || p_ber->conf_dyn_light_beruska) ? KONT_PRVEK : FALSE; int full = p_ber->conf_full_light; int m; if (all) { for (m = 0; m < p_ber->meshnum; m++) { p_mesh = p_ber->p_mesh[m]; if (p_mesh) { dl_updatuj_mesh(p_ber, p_mesh, full ? ber_je_mesh_prvek_fast(p_mesh) : FALSE, all); } } } else { ber_mesh_render_list_reset(p_ber); while ((p_mesh = ber_mesh_render_list_next_flag(p_ber, flag, FALSE))) { if (!p_ber->conf_dyn_light_beruska || (p_ber->conf_dyn_light_beruska && ber_je_mesh_beruska_fast(p_mesh))) { dl_updatuj_mesh(p_ber, p_mesh, full ? ber_je_mesh_prvek_fast(p_mesh) : FALSE, FALSE); } } } } // Vzdalenost od ctvercove obalky int dl_poly_pridej_svetla(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly) { DYN_LIGHT *p_dlight = p_ber->p_dlight; void *p_light_dyn[MAX_FLARE_SVETEL * 2]; int lightakt = 0; int i; if (!p_ber->dl_recalc && !p_ber->dl_new) return (FALSE); for (lightakt = 0, i = 0; i < p_ber->dl_lightnum; i++) { p_dlight = p_ber->p_dlight + i; if (p_dlight->akt && p_dlight->dosah > obb_vzdal_bod(&p_poly->obb, &p_dlight->tp)) { p_light_dyn[lightakt++] = p_dlight; } } p_poly->lightakt = i = lightakt; if (!i) { null_free((void **) &p_poly->p_dlight); p_poly->lightmax = 0; } else { if (i >= p_poly->lightmax) { null_free((void **) &p_poly->p_dlight); i += (i >> 1) + 10; p_poly->p_dlight = (void **) mmalloc(sizeof(p_poly->p_dlight[0]) * i); p_poly->lightmax = i; } memcpy(p_poly->p_dlight, p_light_dyn, i * sizeof(p_poly->p_dlight[0])); } return (TRUE); } // Vzdalenost od ctvercove obalky int edl_poly_pridej_svetla(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly) { EXTRA_DYN_LIGHT *p_light; EXTRA_DYN_LIGHT *p_light_dyn[MAX_FLARE_SVETEL * 2]; float vzdal; int kflag = p_poly->kflag; dword flags = 0; int flag; int lightnum; int i; if (!p_ber->edl_recalc && !p_ber->edl_new) return (FALSE); // Zaradim dynamicke svetla lightnum = 0; for (i = 0; i < p_ber->edl_lightnum; i++) { p_light = p_ber->p_edlight + i; if (p_light->akt) { flag = p_light->flag; if (!(flag & EDL_SCENA)) { if (flag & EDL_MESH_LIGHT) { if (kflag & KONT_DRAW_LIGHT && p_poly->top_edlight == i) { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } else if (flag & EDL_DOSAH) { if (flag & EDL_BODOVE) { if (p_light->dosah > obb_vzdal_bod(&p_poly->obb, &p_light->tp)) { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } else if (flag & (EDL_PLOSNE_X | EDL_PLOSNE_Y | EDL_PLOSNE_Z)) { if (flag & EDL_PLOSNE_X) { vzdal = obb_vzdal_rovina_x(&p_poly->obb, p_light->tp.x); } else if (flag & EDL_PLOSNE_Y) { vzdal = obb_vzdal_rovina_y(&p_poly->obb, p_light->tp.y); } else { vzdal = obb_vzdal_rovina_z(&p_poly->obb, p_light->tp.z); } if (p_light->dosah > vzdal) { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } } } else { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } } if (!lightnum) { null_free((void **) &p_poly->p_edlight); p_poly->edlightakt = p_poly->edlightmax = 0; if (!(kflag & KONT_DRAW_LIGHT)) { p_poly->kflag &= ~(KONT_DRAW_SPEC); p_poly->kflag &= ~(KONT_DRAW_PRUHL); } } else { // Nastav ostrou spekularni barvu if (flags & (EDL_SPEC_MOD | EDL_SPEC_SET | EDL_SPEC_ADD | EDL_SPEC_SUB)) { p_poly->kflag |= KONT_DRAW_SPEC; } if (flags & EDL_PRUHL_LIGHT) { p_poly->kflag |= KONT_DRAW_PRUHL; } if (lightnum >= p_poly->edlightmax) { null_free((void **) &p_poly->p_edlight); i += (lightnum >> 1) + 10; p_poly->p_edlight = (void **) mmalloc(sizeof(p_poly->p_edlight[0]) * i); p_poly->edlightmax = i; memcpy(p_poly->p_edlight, p_light_dyn, sizeof(p_poly->p_edlight[0]) * lightnum); } else { memcpy(p_poly->p_edlight, p_light_dyn, sizeof(p_poly->p_edlight[0]) * lightnum); } p_poly->edlightakt = lightnum; } return (TRUE); } inline int dl_poly_svetlo_update(EDIT_MESH_POLY * p_poly) { DYN_LIGHT **p_dlight = (DYN_LIGHT **) p_poly->p_dlight; dword flags = 0; int i; for (i = 0; i < p_poly->lightakt; i++) { flags |= p_dlight[i]->flag; } return (flags & (SDL_ZMENA_GLOBAL | SDL_ZMENA_LOKAL)); } inline int edl_poly_svetlo_update(EDIT_MESH_POLY * p_poly, int *p_flag) { EXTRA_DYN_LIGHT **p_edlight = (EXTRA_DYN_LIGHT **) p_poly->p_edlight; dword flags = 0; int i; for (i = 0; i < p_poly->edlightakt; i++) { flags |= p_edlight[i]->flag; } *p_flag = flags; return (flags & (EDL_ZMENA_GLOBAL | EDL_ZMENA_LOKAL)); } /* Updatuju dynamicky svetla a extra-svetla */ int edl_poly_pripocitej_svetla(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly) { EXTRA_DYN_LIGHT *p_light = NULL; BODRGBA *p_vertex_diff = NULL; BODRGBA *p_vertex_diff_mat = NULL; BODRGB *p_vertex_spec = NULL; BODRGB *p_vertex_spec_mat = NULL; BOD *p, *n, dir(0), cam(0); int i, v, vnum, dflag; int specular, specular_light; int extra_light; int lflag, diffuse, update; float vzdal = FLT_MAX, vzdal2, I; update = edl_poly_svetlo_update(p_poly, &lflag); if (!p_ber->edl_new && !update) { return (FALSE); } diffuse = lflag & (EDL_ALFA_MOD | EDL_ALFA_SET | EDL_ALFA_ADD | EDL_ALFA_SUB); specular = lflag & (EDL_SPEC_MOD | EDL_SPEC_SET | EDL_SPEC_ADD | EDL_SPEC_SUB); specular_light = p_poly->kflag & KONT_DRAW_SPEC; if (lflag & EDL_ZEMNI_MLHA) { cam.x = p_ber->p_invcam->_41; cam.y = p_ber->p_invcam->_42; cam.z = p_ber->p_invcam->_43; } #ifdef DEBUG_MOD p_ber->debug.light_meshu++; #endif extra_light = p_poly->edlightakt; vnum = p_poly->facenum; for (v = 0; v < vnum; v++) { p = (BOD *) & p_poly->p_koord[v].x; n = (BOD *) & p_poly->p_koord[v].nx; if (diffuse) { // je aktivni diff-operace p_vertex_diff = (BODRGBA *) & p_poly->p_koord[v].dr; p_vertex_diff_mat = (BODRGBA *) & p_poly->p_koord[v].mdr; } if (specular) { // je aktivni spec-operace -> loaduju defaultni specy p_vertex_spec = (BODRGB *) & p_poly->p_koord[v].sr; p_vertex_spec_mat = (BODRGB *) & p_poly->p_koord[v].msr; *p_vertex_spec = *p_vertex_spec_mat; } else if (specular_light) { // defaultni spekularni neexistuje p_vertex_spec = (BODRGB *) & p_poly->p_koord[v].sr; p_vertex_spec->r = 0.0f; p_vertex_spec->g = 0.0f; p_vertex_spec->b = 0.0f; } /* Update extra-svetel */ for (i = 0; i < extra_light; i++) { p_light = (EXTRA_DYN_LIGHT *) p_poly->p_edlight[i]; dflag = p_light->flag; if (dflag & EDL_ZEMNI_MLHA) { vzdal = fabsf(p_light->tp.y - p->y); if (vzdal <= p_light->v_start) { p_vertex_spec->r = p_light->sr; p_vertex_spec->g = p_light->sg; p_vertex_spec->b = p_light->sb; } else if (vzdal <= p_light->v_stop) { vzdal2 = vzdal_bodu_bod(&cam, p); if (vzdal2 < p_light->h_start) { I = 1.0f - (vzdal - p_light->v_start) / (p_light->v_stop - p_light->v_start); p_vertex_spec->r = p_light->sr * I; p_vertex_spec->g = p_light->sg * I; p_vertex_spec->b = p_light->sb * I; } else if (vzdal2 > p_light->h_stop) { p_vertex_spec->r = p_light->sr; p_vertex_spec->g = p_light->sg; p_vertex_spec->b = p_light->sb; } else { vzdal = 1.0f - (vzdal - p_light->v_start) / (p_light->v_stop - p_light->v_start); vzdal2 = (vzdal2 - p_light->h_start) / (p_light->h_stop - p_light->h_start); I = MAX(vzdal, vzdal2); p_vertex_spec->r = p_light->sr * I; p_vertex_spec->g = p_light->sg * I; p_vertex_spec->b = p_light->sb * I; } } } else { if (dflag & EDL_DOSAH) { if (dflag & EDL_BODOVE) { vzdal = vzdal_bodu_bod(&p_light->tp, p); } else if (dflag & (EDL_PLOSNE_X | EDL_PLOSNE_Y | EDL_PLOSNE_Z)) { if (dflag & EDL_PLOSNE_X) { vzdal = fabsf(p_light->tp.x - p->x); } else if (dflag & EDL_PLOSNE_Y) { vzdal = fabsf(p_light->tp.y - p->y); } else { vzdal = fabsf(p_light->tp.z - p->z); } } if (vzdal >= p_light->dosah) continue; if (dflag & EDL_UTLUM_LIN) { vzdal = 1.0f - (vzdal) / (p_light->dosah * p_light->utlum); if (vzdal < DELTA_MIN) continue; } else if (dflag & EDL_UTLUM_KVAD) { vzdal = 1.0f - (vzdal * vzdal) / (p_light->dosah * p_light->utlum); if (vzdal < DELTA_MIN) continue; } else { vzdal = 1.0f; } } else { vzdal = 1.0f; } if (dflag & EDL_GOURAND) { vektor_sub(p, &p_light->tp, &dir); vektor_norm(&dir); I = vektor_dot_product(n, &dir) * vzdal * p_light->gourand; if (I < DELTA_MIN) continue; } else { I = vzdal; } // Nastav alfa slozku if (dflag & (EDL_ALFA_MOD | EDL_ALFA_SET | EDL_ALFA_ADD | EDL_ALFA_SUB)) { if (dflag & EDL_ALFA_SET) { p_vertex_diff->a = 1.0f - p_light->da * I; } else if (dflag & EDL_ALFA_ADD) { p_vertex_diff->a = p_vertex_diff_mat->a + 1.0f - p_light->da * I; } else if (dflag & EDL_ALFA_MOD) { p_vertex_diff->a = p_vertex_diff_mat->a * (1.0f - p_light->da * I); } else { p_vertex_diff->a = p_vertex_diff_mat->a - (1.0f - p_light->da * I); } } // Nastav spekularni slozku if (dflag & (EDL_SPEC_MOD | EDL_SPEC_SET | EDL_SPEC_ADD | EDL_SPEC_SUB)) { if (dflag & EDL_SPEC_ADD) { p_vertex_spec->r += p_light->sr * I; p_vertex_spec->g += p_light->sg * I; p_vertex_spec->b += p_light->sb * I; } else if (dflag & EDL_SPEC_MOD) { p_vertex_spec->r *= p_light->sr * I; p_vertex_spec->g *= p_light->sg * I; p_vertex_spec->b *= p_light->sb * I; } else if (dflag & EDL_SPEC_SUB) { p_vertex_spec->r -= p_light->sr * I; p_vertex_spec->g -= p_light->sg * I; p_vertex_spec->b -= p_light->sb * I; } else { p_vertex_spec->r = p_light->sr * I; p_vertex_spec->g = p_light->sg * I; p_vertex_spec->b = p_light->sb * I; } } } } } p_poly->kflag |= KONT_UPLOAD; return (TRUE); } /* - nahodim lightmapu a provedu update vsech regionu - U dynamickeho svetla udelam nakvantovani celeho jeho dosahu po n krocich pro vsechny barvy po kroku vzdal nadruhou max 255 kombinaci) */ /* #define MAX_LOOKF 255.0f #define MAX_LOOK 255 */ #define MIN_LOOKF 0.0f #define MIN_LOOK 0 // full_light - plne osvetleni inline int sdl_poly_pripocitej_svetla_face(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly, LIGHTMAP_FACE * p_lf, int full_light) { int lnum = p_poly->lightakt; // dword *p_data; float suf1, suf2, svf1, svf2; float vzdal, dosah2d /*, look_max, max_vzdal*/; BOD s; DYN_LIGHT *p_dlight; int l, sv, su, u = 0; // dword r, g, b; // dword sr, sg, sb; // int nup, nul; // pocet pravych/levych pixelu // int sup, sul; // pocet pravych/levych pixelu // int nvp, nvl; // pocet pravych/levych pixelu // int svp, svl; // pocet pravych/levych pixelu // int kup, skup; // fixed pricitaci krok prave/leve strany // int kul, skul; // fixed start prave/leve strany // int kvp, skvp; // fixed pricitaci krok prave/leve strany // int kvl, skvl; // fixed start prave/leve strany // int fvzdal; // fixed-point 8:24 korekcni hodnota v look-up tabulce // int min_u, max_u; // int min_v, max_v; // int zal, nusu, nvsv; // int *p_looksqrt; int nu, nv; if (!full_light) { for (l = 0, u = 0; l < lnum; l++) { p_dlight = (DYN_LIGHT *) p_poly->p_dlight[l]; vzdal = vzdal_bodu_a_roviny(&p_dlight->tp, &p_lf->n); if ((p_dlight->aup = (vzdal < p_dlight->dosah))) { p_dlight->avzdal = vzdal; u++; } } if (!u && !p_lf->last_u && !p_ber->conf_full_light_last) { p_lf->upload = FALSE; return (FALSE); } } // kopie ze zalohy do vysledku bmp_kopiruj(p_lf->p_zal, p_lf->p_bmp); if (full_light) { bmp_smaz(p_lf->p_bmp, 0xffffff); u = 0; } p_lf->last_u = u; if (!u) { p_lf->upload = TRUE; return (TRUE); } // p_data = p_lf->p_bmp->data; // udelam to pro kazde svetlo extra zvlaste for (l = 0; l < lnum; l++) { p_dlight = (DYN_LIGHT *) p_poly->p_dlight[l]; if (!p_dlight->aup) continue; // p_looksqrt = p_dlight->flag & SDL_UTLUM_KVADRATIC ? // p_ber->p_looksqrt_quadratic : p_ber->p_looksqrt_linear; // 3D bod na rovine s.x = p_dlight->tp.x - p_lf->n.x * p_dlight->avzdal; s.y = p_dlight->tp.y - p_lf->n.y * p_dlight->avzdal; s.z = p_dlight->tp.z - p_lf->n.z * p_dlight->avzdal; // 2D bod ve svetle nu = p_lf->nu + 2; nv = p_lf->nv + 2; su = ftoi(vzdal_bodu_a_roviny_nabs(&s, &p_lf->rv) * ((float) nu / p_lf->ddu)); sv = ftoi(vzdal_bodu_a_roviny_nabs(&s, &p_lf->ru) * ((float) nv / p_lf->ddv)); suf1 = vzdal_bodu_a_primky(&s, &p_lf->s0, &p_lf->s1); svf1 = vzdal_bodu_a_primky(&s, &p_lf->s0, &p_lf->s2); suf2 = vzdal_bodu_a_primky(&s, &p_lf->s2, &p_lf->s3); svf2 = vzdal_bodu_a_primky(&s, &p_lf->s1, &p_lf->s3); // r = (byte) ftoi(255.0f * p_dlight->dr); // g = (byte) ftoi(255.0f * p_dlight->dg); // b = (byte) ftoi(255.0f * p_dlight->db); // if (p_dlight->flag & SDL_ADD_SUB) { // sr = (byte) ftoi(255.0f * p_dlight->sr); // sg = (byte) ftoi(255.0f * p_dlight->sg); // sb = (byte) ftoi(255.0f * p_dlight->sb); // } // look_max = p_dlight->look_max; // if (p_dlight->avzdal >= p_dlight->min) { // fvzdal = // 0x01000000 - ftoi((float) 0x01000000 * ((p_dlight->avzdal - // p_dlight->min) / p_dlight->max)); // } // else { // fvzdal = 0x01000000; // } dosah2d = sqrtf(p_dlight->dosah * p_dlight->dosah - p_dlight->avzdal * p_dlight->avzdal); // nusu = nu - su; // nvsv = nv - sv; // Strana U lightmapy if (su <= 0) { if (suf1 > dosah2d) continue; // min_u = ftoi(look_max * suf1 / dosah2d); // if (suf2 > dosah2d) { // max_u = ftoi(look_max); // nup = ftoi(((dosah2d - suf1) / (suf2 - suf1)) * nu); // } // else { // nup = nu; // max_u = ftoi(look_max * suf2 / dosah2d); // } // nul = sul = sup = 0; // if (nup > 0) { // kup = ((max_u - min_u) << 16) / nup; // skup = (min_u << 16) - kup; // } } else if (su >= nu - 1) { if (suf2 > dosah2d) continue; // min_u = ftoi(look_max * suf2 / dosah2d); // if (suf1 > dosah2d) { // max_u = ftoi(look_max); // nul = ftoi(((dosah2d - suf2) / (suf1 - suf2)) * nu); // } // else { // nul = nu; // max_u = ftoi(look_max * suf1 / dosah2d); // } // nup = sup = 0; // sul = nu - 1; // if (nul > 0) { // kul = ((max_u - min_u) << 16) / nul; // skul = (min_u << 16) - kul; // } } // else { // min_u = MIN_LOOK; // max_vzdal = (suf2 > suf1) ? suf2 : suf1; // max_u = // (max_vzdal > // dosah2d) ? ftoi(look_max) : ftoi(look_max * max_vzdal / dosah2d); // // Spocitam pravou stranu -> sf2 // nup = (suf2 > dosah2d) ? ftoi((dosah2d / suf2) * nusu) : nusu; // // Leva strana -> su // nul = (suf1 > dosah2d) ? ftoi((dosah2d / suf1) * su) : su; // /* // if(--nul < 0) // nul = 0; // */ // sup = su; // Start prave strany // sul = su - 1; // Start leve strany // if (nup > 0 && nul > 0) // kup = kul = (nul > nup) ? (max_u << 16) / nul : (max_u << 16) / nup; // else if (nul > nup && nul > 0) // kup = kul = (max_u << 16) / nul; // else if (nup > 0) // kup = kul = (max_u << 16) / nup; // skul = skup = -kup; // } /* Strana V lightmapy */ if (sv <= 0) { if (svf1 > dosah2d) continue; // min_v = ftoi(look_max * svf1 / dosah2d); // if (svf2 > dosah2d) { // max_v = ftoi(look_max); // nvp = ftoi(((dosah2d - svf1) / (svf2 - svf1)) * nv); // } // else { // nvp = nv; // max_v = ftoi(look_max * svf2 / dosah2d); // } // nvl = svl = svp = 0; // if (nvp > 0) { // kvp = ((max_v - min_v) << 16) / nvp; // skvp = (min_v << 16) - kvp; // } } else if (sv >= nv - 1) { if (svf2 > dosah2d) continue; // min_v = ftoi(look_max * svf2 / dosah2d); // if (svf1 > dosah2d) { // max_v = ftoi(look_max); // nvl = ftoi(((dosah2d - svf2) / (svf1 - svf2)) * nv); // } // else { // nvl = nv; // max_v = ftoi(look_max * svf1 / dosah2d); // } // nvp = svp = 0; // svl = nv - 1; // if (nvl > 0) { // kvl = ((max_v - min_v) << 16) / nvl; // skvl = (min_v << 16) - kvl; // } } // else { // min_v = MIN_LOOK; // max_vzdal = (svf2 > svf1) ? svf2 : svf1; // max_v = // (max_vzdal > // dosah2d) ? ftoi(look_max) : ftoi(look_max * max_vzdal / dosah2d); // // Spocitam pravou stranu -> sf2 // nvp = (svf2 > dosah2d) ? ftoi((dosah2d / svf2) * nvsv) : nvsv; // // Leva strana -> su // nvl = (svf1 > dosah2d) ? ftoi((dosah2d / svf1) * sv) : sv; // /* // if(--nvl < 0) // nvl = 0; // */ // svp = sv; // Start prave strany // svl = sv - 1; // Start leve strany // if (nvp > 0 && nvl > 0) // kvp = kvl = (nvl > nvp) ? (max_v << 16) / nvl : (max_v << 16) / nvp; // else if (nvl > nvp && nvl > 0) // kvp = kvl = (max_v << 16) / nvl; // else if (nvp > 0) // kvp = kvl = (max_v << 16) / nvp; // skvl = skvp = -kvp; // } // pokud je index po priteni mensi nez 0 -> vezmu maximum !!! // pokud je vetsi nez 255 -> kaslu na to // Prvne spocitam prave sloupce v lightmape // potom leve sloupce /* if(p_dlight->flag&SDL_ADD_SUB) { __asm { pushfd pushad // Pocet pocitanych radku mov ecx, nvp // pocet radku smerem nahoru test ecx, ecx jz __prava_strana_ms ____dalsi_radek_prava_strana_ms: mov edi, p_data mov eax, svp mov edx, nu add eax, ecx dec eax mul edx shl eax, 2 add edi, eax // edi -> mam cilovy radek v lightmape mov eax, ecx mov edx, kvp mul edx add eax, skvp shr eax, 16 // vypoctu radku tabulky shl eax, 10 // krat sirka tabulky * 4 mov ebx, p_looksqrt add ebx, eax mov zal, ebx // cilovy radk v look-up push ecx call __spocitej_radek_ms pop ecx dec ecx jnz ____dalsi_radek_prava_strana_ms // udelam levou stranu __prava_strana_ms: mov ecx, nvl // pocet radku smerem nahoru test ecx, ecx jz __konec_vseho_ms ____dalsi_radek_leva_strana_ms: // prvne udelam levou stranu a potom pravou mov edi, p_data mov eax, svl mov edx, nu sub eax, ecx inc eax mul edx shl eax, 2 add edi, eax // edi -> mam cilovy radek v lightmape mov eax, ecx mov edx, kvl mul edx add eax, skvl shr eax, 16 shl eax, 10 mov ebx, p_looksqrt add ebx, eax mov zal, ebx push ecx call __spocitej_radek_ms pop ecx dec ecx jnz ____dalsi_radek_leva_strana_ms jmp __konec_vseho_ms */ /* ************************************************** Vypocty scan_line */ /* // edi -> zacatek radku cilove ligthmapy // zal -> zacatek radku look-up tabulky __spocitej_radek_ms: // spocitam jeden radek push edi cmp nup,0 jz __radek_dozadu_ms // pravy radek neexistuje -> preskoc ho mov eax,sup shl eax,2 add edi,eax // prictu sup -> zacatek v tabulce mov ecx,nup // VV // cx -> pocet opakovani - pocet radku ligthmapy mov edx,kup // krok v look-up tabulce (fixed) mov ebx,skup // start bod v look-up tabulce (fixed) sloupec_dopredu_ms: // prava strana add ebx,edx // ebx -> aktualni fixed point bod // edx -> fixed point krok // cx -> pocet kroku // edi -> kam zapisuju mov eax,ebx // eax je tmp registr shr eax,16 shl eax,2 mov esi,zal add esi,eax push edx mov eax,[esi] // nactu intenzitu rgb barev mul fvzdal // vynasobim fixed-point koeficientem a-vzdal shl edx,8 shr eax,24 or edx,eax mov esi,edx // schovam si fixed-point hodnotu mov eax,r // add-mod mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_r1_msa mov dl,0xff __neni_prenos_r1_msa: push edx mov eax,sr // sub-mod mul esi pop edx shr eax,24 sub dl,al ja __neni_prenos_r1_ms mov dl,0x0 __neni_prenos_r1_ms: mov [edi],dl inc edi mov eax,g mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_g1_msa mov dl,0xff __neni_prenos_g1_msa: push edx mov eax,sg mul esi pop edx shr eax,24 sub dl,al ja __neni_prenos_g1_ms mov dl,0x0 __neni_prenos_g1_ms: mov [edi],dl inc edi mov eax,b mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_b1_msa mov dl,0xff __neni_prenos_b1_msa: push edx mov eax,sb mul esi pop edx shr eax,24 sub dl,al ja __neni_prenos_b1_ms mov dl,0x0 __neni_prenos_b1_ms: mov [edi],dl inc edi inc edi pop edx dec cx jnz short sloupec_dopredu_ms // Frcime nazpatek -> opacne __radek_dozadu_ms: pop edi // vyber puvodni zacatek cmp nul,0 jz __radek_konec_ms // levy radek neexistuje -> preskoc ho mov eax,sul shl eax,2 add edi,eax mov ecx,nul //VV// cx -> pocet opakovani - pocet radku ligthmapy mov edx,kul // krok v look-up tabulce (fixed) mov ebx,skul // start bod v look-up tabulce (fixed) sloupec_dozadu_ms: // prava strana add ebx,edx // ebx -> aktualni fixed point bod // edx -> fixed point krok // cx -> pocet kroku // edi -> kam zapisuju mov eax,ebx // eax je tmp registr shr eax,16 shl eax,2 mov esi,zal add esi,eax push edx mov eax,[esi] // nactu intenzitu rgb barev mul fvzdal shl edx,8 shr eax,24 or edx,eax mov esi,edx // schovam si fixed-point hodnotu mov eax,r mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_r2_msa mov dl,0xff __neni_prenos_r2_msa: push edx mov eax,sr mul esi pop edx shr eax,24 sub dl,al ja __neni_prenos_r2_ms mov dl,0x0 __neni_prenos_r2_ms: mov [edi],dl inc edi mov eax,g mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_g2_msa mov dl,0xff __neni_prenos_g2_msa: push edx mov eax,sg mul esi pop edx shr eax,24 sub dl,al ja __neni_prenos_g2_ms mov dl,0x0 __neni_prenos_g2_ms: mov [edi],dl inc edi mov eax,s mul esi shr eax,24 mov dl,[edi] sub dl,al jnc __neni_prenos_b2_msa mov dl,0xff __neni_prenos_b2_msa: push edx mov eax,sb mul esi pop edx shr eax,24 sub dl,al ja __neni_prenos_b2_ms mov dl,0x0 __neni_prenos_b2_ms: mov [edi],dl inc edi sub edi,7 pop edx dec cx jnz short sloupec_dozadu_ms __radek_konec_ms: ret // vrat se zpet __konec_vseho_ms: popad popfd } } else if(p_dlight->flag&SDL_SUB) { __asm { pushfd pushad // Pocet pocitanych radku mov ecx, nvp // pocet radku smerem nahoru test ecx, ecx jz __prava_strana_m ____dalsi_radek_prava_strana_m: mov edi, p_data mov eax, svp mov edx, nu add eax, ecx dec eax mul edx shl eax, 2 add edi, eax // edi -> mam cilovy radek v lightmape mov eax, ecx mov edx, kvp mul edx add eax, skvp shr eax, 16 // vypoctu radku tabulky shl eax, 10 // krat sirka tabulky * 4 mov ebx, p_looksqrt add ebx, eax mov zal, ebx // cilovy radk v look-up push ecx call __spocitej_radek_m pop ecx dec ecx jnz ____dalsi_radek_prava_strana_m // udelam levou stranu __prava_strana_m: mov ecx, nvl // pocet radku smerem nahoru test ecx, ecx jz __konec_vseho_m ____dalsi_radek_leva_strana_m: // prvne udelam levou stranu a potom pravou mov edi, p_data mov eax, svl mov edx, nu sub eax, ecx inc eax mul edx shl eax, 2 add edi, eax // edi -> mam cilovy radek v lightmape mov eax, ecx mov edx, kvl mul edx add eax, skvl shr eax, 16 shl eax, 10 mov ebx, p_looksqrt add ebx, eax mov zal, ebx push ecx call __spocitej_radek_m pop ecx dec ecx jnz ____dalsi_radek_leva_strana_m jmp __konec_vseho_m */ /* ************************************************** Vypocty scan_line */ /* // edi -> zacatek radku cilove ligthmapy // zal -> zacatek radku look-up tabulky __spocitej_radek_m: // spocitam jeden radek push edi cmp nup,0 jz __radek_dozadu_m // pravy radek neexistuje -> preskoc ho mov eax,sup shl eax,2 add edi,eax // prictu sup -> zacatek v tabulce mov ecx,nup // VV // cx -> pocet opakovani - pocet radku ligthmapy mov edx,kup // krok v look-up tabulce (fixed) mov ebx,skup // start bod v look-up tabulce (fixed) sloupec_dopredu_m: // prava strana add ebx,edx // ebx -> aktualni fixed point bod // edx -> fixed point krok // cx -> pocet kroku // edi -> kam zapisuju mov eax,ebx // eax je tmp registr shr eax,16 shl eax,2 mov esi,zal add esi,eax push edx mov eax,[esi] // nactu intenzitu rgb barev mul fvzdal // vynasobim fixed-point koeficientem a-vzdal shl edx,8 shr eax,24 or edx,eax mov esi,edx // schovam si fixed-point hodnotu mov eax,r mul esi shr eax,24 mov dl,[edi] sub dl,al ja __neni_prenos_r1_m mov dl,0x0 __neni_prenos_r1_m: mov [edi],dl inc edi mov eax,g mul esi shr eax,24 mov dl,[edi] sub dl,al ja __neni_prenos_g1_m mov dl,0x0 __neni_prenos_g1_m: mov [edi],dl inc edi mov eax,b mul esi shr eax,24 mov dl,[edi] sub dl,al ja __neni_prenos_b1_m mov dl,0x0 __neni_prenos_b1_m: mov [edi],dl inc edi inc edi pop edx dec cx jnz short sloupec_dopredu_m // Frcime nazpatek -> opacne __radek_dozadu_m: pop edi // vyber puvodni zacatek cmp nul,0 jz __radek_konec_m // levy radek neexistuje -> preskoc ho mov eax,sul shl eax,2 add edi,eax mov ecx,nul //VV// cx -> pocet opakovani - pocet radku ligthmapy mov edx,kul // krok v look-up tabulce (fixed) mov ebx,skul // start bod v look-up tabulce (fixed) sloupec_dozadu_m: // prava strana add ebx,edx // ebx -> aktualni fixed point bod // edx -> fixed point krok // cx -> pocet kroku // edi -> kam zapisuju mov eax,ebx // eax je tmp registr shr eax,16 shl eax,2 mov esi,zal add esi,eax push edx mov eax,[esi] // nactu intenzitu rgb barev mul fvzdal shl edx,8 shr eax,24 or edx,eax mov esi,edx // schovam si fixed-point hodnotu mov eax,r mul esi shr eax,24 mov dl,[edi] sub dl,al ja __neni_prenos_r2_m mov dl,0x0 __neni_prenos_r2_m: mov [edi],dl inc edi mov eax,g mul esi shr eax,24 mov dl,[edi] sub dl,al ja __neni_prenos_g2_m mov dl,0x0 __neni_prenos_g2_m: mov [edi],dl inc edi mov eax,b mul esi shr eax,24 mov dl,[edi] sub dl,al ja __neni_prenos_b2_m mov dl,0x0 __neni_prenos_b2_m: mov [edi],dl inc edi sub edi,7 pop edx dec cx jnz short sloupec_dozadu_m __radek_konec_m: ret // vrat se zpet __konec_vseho_m: popad popfd } } else { __asm { pushfd pushad // Pocet pocitanych radku mov ecx, nvp // pocet radku smerem nahoru test ecx, ecx jz __prava_strana ____dalsi_radek_prava_strana: mov edi, p_data mov eax, svp mov edx, nu add eax, ecx dec eax mul edx shl eax, 2 add edi, eax // edi -> mam cilovy radek v lightmape mov eax, ecx mov edx, kvp mul edx add eax, skvp shr eax, 16 // vypoctu radku tabulky shl eax, 10 // krat sirka tabulky * 4 mov ebx, p_looksqrt add ebx, eax mov zal, ebx // cilovy radk v look-up push ecx call __spocitej_radek pop ecx dec ecx jnz ____dalsi_radek_prava_strana // udelam levou stranu __prava_strana: mov ecx, nvl // pocet radku smerem nahoru test ecx, ecx jz __konec_vseho ____dalsi_radek_leva_strana: // prvne udelam levou stranu a potom pravou mov edi, p_data mov eax, svl mov edx, nu sub eax, ecx inc eax mul edx shl eax, 2 add edi, eax // edi -> mam cilovy radek v lightmape mov eax, ecx mov edx, kvl mul edx add eax, skvl shr eax, 16 shl eax, 10 mov ebx, p_looksqrt add ebx, eax mov zal, ebx push ecx call __spocitej_radek pop ecx dec ecx jnz ____dalsi_radek_leva_strana jmp __konec_vseho */ /* ************************************************** Vypocty scan_line */ /* // edi -> zacatek radku cilove ligthmapy // zal -> zacatek radku look-up tabulky __spocitej_radek: // spocitam jeden radek push edi cmp nup,0 jz __radek_dozadu // pravy radek neexistuje -> preskoc ho mov eax,sup shl eax,2 add edi,eax // prictu sup -> zacatek v tabulce mov ecx,nup // VV // cx -> pocet opakovani - pocet radku ligthmapy mov edx,kup // krok v look-up tabulce (fixed) mov ebx,skup // start bod v look-up tabulce (fixed) sloupec_dopredu: // prava strana add ebx,edx // ebx -> aktualni fixed point bod // edx -> fixed point krok // cx -> pocet kroku // edi -> kam zapisuju mov eax,ebx // eax je tmp registr shr eax,16 shl eax,2 mov esi,zal add esi,eax push edx mov eax,[esi] // nactu intenzitu rgb barev mul fvzdal // vynasobim fixed-point koeficientem a-vzdal shl edx,8 shr eax,24 or edx,eax mov esi,edx // schovam si fixed-point hodnotu mov eax,r mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_r1 mov dl,0xff __neni_prenos_r1: mov [edi],dl inc edi mov eax,g mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_g1 mov dl,0xff __neni_prenos_g1: mov [edi],dl inc edi mov eax,b mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_b1 mov dl,0xff __neni_prenos_b1: mov [edi],dl inc edi inc edi pop edx dec cx jnz short sloupec_dopredu // Frcime nazpatek -> opacne __radek_dozadu: pop edi // vyber puvodni zacatek cmp nul,0 jz __radek_konec // levy radek neexistuje -> preskoc ho mov eax,sul shl eax,2 add edi,eax mov ecx,nul //VV// cx -> pocet opakovani - pocet radku ligthmapy mov edx,kul // krok v look-up tabulce (fixed) mov ebx,skul // start bod v look-up tabulce (fixed) sloupec_dozadu: // prava strana add ebx,edx // ebx -> aktualni fixed point bod // edx -> fixed point krok // cx -> pocet kroku // edi -> kam zapisuju mov eax,ebx // eax je tmp registr shr eax,16 shl eax,2 mov esi,zal add esi,eax push edx mov eax,[esi] // nactu intenzitu rgb barev mul fvzdal shl edx,8 shr eax,24 or edx,eax mov esi,edx // schovam si fixed-point hodnotu mov eax,r mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_r2 mov dl,0xff __neni_prenos_r2: mov [edi],dl inc edi mov eax,g mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_g2 mov dl,0xff __neni_prenos_g2: mov [edi],dl inc edi mov eax,b mul esi shr eax,24 mov dl,[edi] add dl,al jnc __neni_prenos_b2 mov dl,0xff __neni_prenos_b2: mov [edi],dl inc edi sub edi,7 pop edx dec cx jnz short sloupec_dozadu __radek_konec: ret // vrat se zpet __konec_vseho: popad popfd } } */ } p_lf->upload = TRUE; return (TRUE); } // Pripocita vsechna svetla v seznamu a provede update lightmapy int sdl_poly_pripocitej_svetla(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly, int full_light) { int f, ret; if (!p_ber->dl_recalc && !p_ber->dl_new) return (FALSE); if (!p_ber->dl_new && !dl_poly_svetlo_update(p_poly)) return (FALSE); // pripocitej k tomuto poly ke kazde face vsechny lightmapy for (f = 0, ret = 0; f < p_poly->facenum / 3; f++) { ret += sdl_poly_pripocitej_svetla_face(p_ber, p_poly, p_poly->p_ind + f, full_light); } return (ret); } // uploaduje lightmapu do akceleratoru int sdl_poly_updatuj_lightmap(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly) { LIGHTMAP_FACE *p_lf = p_poly->p_ind; int l, i, ln, up, last; int uploaded = 0; last = 0; for (l = 0; l < p_poly->lightnum; l++) { ln = last + p_poly->p_lightnum[l] / 3; up = 0; for (i = last; i < ln; i++) up += p_lf[i].upload; if (up) { glBindTexture(p_poly->p_light[l]->typ, p_poly->p_light[l]->text); for (i = last; i < ln; i++) { if (p_lf[i].upload) { glTexSubImage2D(p_poly->p_light[l]->typ, 0, p_lf[i].u - 1, p_lf[i].v - 1, p_lf[i].nu + 2, p_lf[i].nv + 2, GL_RGBA, GL_UNSIGNED_BYTE, p_lf[i].p_bmp->data); uploaded += p_lf[i].p_bmp->x * p_lf[i].p_bmp->y * 4; } } } last += p_poly->p_lightnum[l] / 3; } return (uploaded); } /* * This function is not used, and it chdir's to /home/komat, so I've * removed it. */ // void sdl_save_lightmap(EDIT_MESH_POLY * p_poly, int p) // { // char pom[200]; // int l; // chdir("/home/komat"); // for (l = 0; l < p_poly->lightnum; l++) { // sprintf(pom, "poly%dlight%d.png", p, l); // bmp_uloz(pom, p_poly->p_light[l]->p_bmp); // } // for (l = 0; l < p_poly->facenum / 3; l++) { // sprintf(pom, "poly%dfacelight%d.png", p, l); // bmp_uloz(pom, p_poly->p_ind[l].p_bmp); // } // } inline void sdl_updatuj_poly(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly, int full_light) { if (dl_poly_pridej_svetla(p_ber, p_poly)) { if (sdl_poly_pripocitej_svetla(p_ber, p_poly, full_light)) { sdl_poly_updatuj_lightmap(p_ber, p_poly); } } if (edl_poly_pridej_svetla(p_ber, p_poly)) edl_poly_pripocitej_svetla(p_ber, p_poly); } inline void sdl_updatuj_seznam_poly(G_KONFIG * p_ber, int all) { int flag = (p_ber->conf_dyn_light_prvky) ? KONT_PRVEK : FALSE; int full = p_ber->conf_full_light; EDIT_MESH_POLY *p_poly; int p; if (all) { for (p = 0; p < p_ber->polynum; p++) { p_poly = p_ber->p_poly + p; sdl_updatuj_poly(p_ber, p_poly, full ? p_poly->kflag & KONT_PRVEK : FALSE); } } else { ber_poly_render_list_reset(p_ber); while ((p_poly = ber_poly_render_list_next_flag(p_ber, flag, FALSE))) { sdl_updatuj_poly(p_ber, p_poly, full ? p_poly->kflag & KONT_PRVEK : FALSE); } } } void dl_transformuj_svetla(G_KONFIG * p_ber) { GAME_MESH_DATA *p_data; GAME_MESH_OLD *p_mesh; DYN_LIGHT *p_light; EXTRA_DYN_LIGHT *p_edlight; int kamera_zmena = p_ber->kamera.zmena || p_ber->kamera.zmena_last; int i; for (i = 0; i < p_ber->dl_lightnum; i++) { p_light = p_ber->p_dlight + i; if (p_light->akt && p_light->flag & SDL_MESH) { p_data = (GAME_MESH_DATA *)p_light->p_mesh_data; if (p_data->kflag & KONT_POHYB) { p_mesh = (GAME_MESH_OLD *)p_data->p_mesh; transformuj_bod_matici_bod(&p_light->np, &p_mesh->m, &p_light->tp); } } } for (i = 0; i < p_ber->edl_lightnum; i++) { p_edlight = p_ber->p_edlight + i; if (p_edlight->akt) { if (p_edlight->flag & EDL_MESH) { p_data = (GAME_MESH_DATA *)p_edlight->p_mesh_data; if (p_data->kflag & KONT_POHYB) { p_mesh = (GAME_MESH_OLD *)p_data->p_mesh; transformuj_bod_matici_bod(&p_edlight->np, &p_mesh->m, &p_edlight->tp); } } else if (p_edlight->flag & EDL_CAMERA_POINT && kamera_zmena) { p_edlight->tp.x = p_ber->p_invcam->_41; p_edlight->tp.y = p_ber->p_invcam->_42; p_edlight->tp.z = p_ber->p_invcam->_43; p_ber->edl_recalc = TRUE; p_edlight->flag |= EDL_ZMENA_GLOBAL; } if (p_edlight->flag & (EDL_CAMERA_POINT | EDL_ZMENA_CAMERA) && kamera_zmena) { p_ber->edl_recalc = TRUE; p_edlight->flag |= EDL_ZMENA_GLOBAL; } } } } void dl_updatuj(G_KONFIG * p_ber) { int all = p_ber->conf_dyn_light_update_all; if (p_ber->dl_on || all) { if (all) p_ber->conf_dyn_light_update_all = FALSE; dl_transformuj_svetla(p_ber); if (p_ber->conf_dyn_light_mesh || p_ber->conf_dyn_light_beruska) dl_updatuj_seznam_meshu(p_ber, all); if (p_ber->conf_dyn_light_poly) { sdl_updatuj_seznam_poly(p_ber, all); p_ber->conf_full_light_last = FALSE; } dl_reset_svetel(p_ber); p_ber->dl_recalc = FALSE; p_ber->dl_new = FALSE; p_ber->edl_recalc = FALSE; p_ber->edl_new = FALSE; } } /* Udelat update-list -> ktere meshe a svetla se maji prepocitat - mesh -> pri posunu meshe (dyn+staticke) - svetlo -> vse v okoli */ /* Svetlo privazat k: - targetu kamery - kamere - meshi kameru privazat k: - meshi - svetlu */ ExtraLightHandle edl_svetlo_vyrob(dword flag, int meshnum) { EXTRA_DYN_LIGHT *p_light; int l; if (flag & EDL_MESH_LIGHT && flag & EDL_SCENA) { return (K_CHYBA); } for (l = 0; l < p_ber->edl_lightnum; l++) { if (!p_ber->p_edlight[l].akt) { p_light = p_ber->p_edlight + l; goto nasel; } } if (l == MAX_FLARE_SVETEL) return (K_CHYBA); p_light = p_ber->p_edlight + l; p_ber->edl_lightnum++; nasel: p_light->akt = TRUE; p_light->flag = flag | EDL_ZMENA_GLOBAL; if (flag | EDL_MESH_LIGHT && meshnum) { p_light->p_lmesh = (int *)mmalloc(sizeof(p_light->p_lmesh[0]) * meshnum); p_light->lmeshnum = meshnum; p_light->lmeshakt = 0; } p_ber->kamera.zmena = TRUE; p_ber->edl_new = TRUE; return (l); } ExtraLightHandle edl_svetlo_zrus_meshe(ExtraLightHandle lh) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; GAME_MESH_DATA *p_data; GAME_MESH_OLD *p_mesh; int i; if (!p_light->akt) return (FALSE); else { p_ber->edl_new = TRUE; // Zruseni meshu if (p_light->flag | EDL_MESH_LIGHT && p_light->lmeshnum) { for (i = 0; i < p_light->lmeshakt; i++) { p_mesh = p_ber->p_mesh[p_light->p_lmesh[i]]; if (p_mesh) { p_data = p_mesh->p_data; p_data->kflag &= ~KONT_DRAW_LIGHT; p_data->kflag |= KONT_POHYB; p_data->top_edlight = K_CHYBA; } } null_free((void **)&p_light->p_lmesh); p_light->lmeshnum = p_light->lmeshakt = 0; } return (TRUE); } } int edl_svetlo_zrus(ExtraLightHandle lh) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (!p_light->akt) return (FALSE); else { edl_svetlo_zrus_meshe(lh); // Zruseni svetla p_light->akt = FALSE; if (p_ber->edl_lightnum == lh + 1) p_ber->edl_lightnum--; p_ber->edl_new = TRUE; // Zruseni animace if (p_light->an.endtime) sdla_animaci_zrus(&p_light->an); // Zajisti prepocitani svetel p_ber->dl_new = TRUE; return (TRUE); } } ExtraLightHandle edl_svetlo_pridej_mesh(ExtraLightHandle lh, MeshHandle mh) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; GAME_MESH_DATA *p_data; int m; if (lh < p_ber->edl_lightnum && p_light->akt && p_light->flag | EDL_MESH_LIGHT && p_light->lmeshnum && p_light->lmeshakt < p_light->lmeshnum) { assert(p_ber->p_prv_lev[mh]); p_data = p_ber->p_prv_lev[mh]->p_mesh_data; m = p_ber->p_prv_lev[mh]->mesh; if (p_data->kflag & KONT_DRAW_LIGHT) { return (K_CHYBA); } else { p_light->p_lmesh[p_light->lmeshakt++] = m; p_data->top_edlight = lh; return (lh); } } else { return (K_CHYBA); } } ExtraLightHandle edl_svetlo_set_pos(ExtraLightHandle lh, BOD * p_bod, BOD * p_dir) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (lh < p_ber->edl_lightnum && p_light->akt) { p_light->tp = p_light->np = *p_bod; p_light->dir = *p_dir; p_light->flag |= EDL_ZMENA_GLOBAL; p_ber->edl_recalc = TRUE; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_svetlo_set_pos_ext(ExtraLightHandle lh, float px, float py, float pz, float dx, float dy, float dz) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (lh < p_ber->edl_lightnum && p_light->akt) { p_light->np.x = px; p_light->np.y = py; p_light->np.z = pz; p_light->dir.x = dx; p_light->dir.y = dy; p_light->dir.z = dz; p_light->tp = p_light->np; p_light->flag |= EDL_ZMENA_GLOBAL; p_ber->edl_recalc = TRUE; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_svetlo_set_par(ExtraLightHandle lh, float utlum, float dosah, float theta, float gourand) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (lh < p_ber->edl_lightnum && p_light->akt) { p_light->dosah = dosah; p_light->utlum = utlum; p_light->theta = theta; p_light->gourand = gourand; p_light->flag |= EDL_ZMENA_GLOBAL; p_ber->edl_recalc = TRUE; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_svetlo_set_diff(ExtraLightHandle lh, float da) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (lh < p_ber->edl_lightnum && p_light->akt) { p_light->da = da; p_light->flag |= EDL_ZMENA_LOKAL; p_ber->edl_recalc = TRUE; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_svetlo_set_spec(ExtraLightHandle lh, float sr, float sg, float sb) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (lh < p_ber->edl_lightnum && p_light->akt) { p_light->sr = sr; p_light->sg = sg; p_light->sb = sb; p_light->flag |= EDL_ZMENA_LOKAL; p_ber->edl_recalc = TRUE; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_svetlo_vyrob_zemni_mlha(dword barva, float v_start, float v_stop, float h_start, float h_stop) { EXTRA_DYN_LIGHT *p_light; int l; for (l = 0; l < p_ber->edl_lightnum; l++) { if (!p_ber->p_edlight[l].akt) { p_light = p_ber->p_edlight + l; goto nasel; } } if (l == MAX_FLARE_SVETEL) return (K_CHYBA); p_light = p_ber->p_edlight + l; p_ber->edl_lightnum++; nasel: p_light->akt = TRUE; p_light->flag = EDL_ZEMNI_MLHA | EDL_SPEC_ADD | EDL_SCENA | EDL_ZMENA_GLOBAL | EDL_ZMENA_LOKAL | EDL_ZMENA_CAMERA; rgb_float(barva, &p_light->sr); p_light->v_start = v_start; p_light->v_stop = v_stop; p_light->h_start = h_start; p_light->h_stop = h_stop; p_ber->kamera.zmena = TRUE; p_ber->edl_new = TRUE; return (l); } /* Privaze svetlo k meshum */ ExtraLightHandle edl_svetlo_uzavri_meshe(ExtraLightHandle lh) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; GAME_MESH_OLD *p_mesh; GAME_MESH_DATA *p_data; int i, flags; if (lh < p_ber->edl_lightnum && p_light->akt && p_light->flag | EDL_MESH_LIGHT) { flags = p_light->flag; for (i = 0; i < p_light->lmeshakt; i++) { p_mesh = p_ber->p_mesh[p_light->p_lmesh[i]]; p_data = p_mesh->p_data; assert(p_mesh); if (flags & (EDL_SPEC_MOD | EDL_SPEC_SET | EDL_SPEC_ADD | EDL_SPEC_SUB)) { p_data->kflag |= KONT_DRAW_SPEC; if (!(p_data->m2flag & MAT2_SPECULAR)) { p_mesh->p_vertex_spec = (BODRGB *) mmalloc(sizeof(p_mesh->p_vertex_spec[0]) * p_mesh->vertexnum); } } if (flags & EDL_PRUHL_LIGHT) { p_data->kflag |= KONT_DRAW_PRUHL; } p_data->kflag |= KONT_DRAW_LIGHT; } return (lh); } else { return (K_CHYBA); } } /* Animace extra-svetel */ ExtraLightHandle edl_anim_vyrob(ExtraLightHandle lh, int framenum, int pos_keys, int trg_keys, int alfa_keys, int spec_keys, int dosah_keys) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an; if (lh < p_ber->edl_lightnum && p_light->akt) { p_an = &p_light->an; if (p_an->endtime) sdla_animaci_zrus(p_an); sdla_animaci_vyrob(p_an, framenum, pos_keys, trg_keys, 0, spec_keys, dosah_keys, alfa_keys); return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_anim_zrus(ExtraLightHandle lh) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; if (lh < p_ber->edl_lightnum && p_light->akt && p_light->an.endtime) { sdla_animaci_zrus(&p_light->an); return (lh); } else return (K_CHYBA); } /* In-Klice extra-dyn-light */ ExtraLightHandle edl_anim_vloz_klic_posun(ExtraLightHandle lh, int klic, float x, float y, float z, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->pos_keys) { p_an->p_pos[klic].x = x; p_an->p_pos[klic].y = y; p_an->p_pos[klic].z = z; p_an->p_pkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_anim_vloz_klic_posun_bod(ExtraLightHandle lh, int klic, BOD * p_p, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->pos_keys) { p_an->p_pos[klic] = *p_p; p_an->p_pkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_anim_vloz_klic_target(ExtraLightHandle lh, int klic, float x, float y, float z, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->trg_keys) { p_an->p_trg[klic].x = x; p_an->p_trg[klic].y = y; p_an->p_trg[klic].z = z; p_an->p_tkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_anim_vloz_klic_target_bod(ExtraLightHandle lh, int klic, BOD * p_p, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->trg_keys) { p_an->p_trg[klic] = *p_p; p_an->p_tkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_anim_vloz_klic_diff(ExtraLightHandle lh, int klic, float a, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->alfa_keys) { p_an->p_alfa[klic] = a; p_an->p_akeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } ExtraLightHandle edl_anim_vloz_klic_spec(ExtraLightHandle lh, int klic, float r, float g, float b, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->spec_keys) { p_an->p_spec[klic].r = r; p_an->p_spec[klic].g = g; p_an->p_spec[klic].b = b; p_an->p_spkeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } LightHandle edl_anim_vloz_klic_vzdal(LightHandle lh, int klic, float dosah, float theta, float utlum, int frame) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && klic < p_an->dos_keys) { p_an->p_dosah[klic].x = dosah; p_an->p_dosah[klic].y = theta; p_an->p_dosah[klic].z = utlum; p_an->p_dskeys[klic].time = frame * SIM_KONSTI; return (lh); } else return (K_CHYBA); } /* *************************************************** Run-time animace extra-dynamickych svetel *************************************************** */ ExtraLightHandle edl_anim_start(ExtraLightHandle lh, int *p_flag, int flag, int start, int stop) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + lh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (lh < p_ber->edl_lightnum && p_light->akt && p_an->endtime) { calc_time_end(p_an->endtime, p_ber->TimeEndLastFrame, start, stop, &p_light->start, &p_light->stop, &p_light->time_start, &p_light->time_stop, &p_light->time_delka); p_light->p_flag = p_flag; p_light->an_flag = flag; p_light->flag |= EDL_ANIMACE; return (lh); } else return (K_CHYBA); } int edl_anim_stop(ExtraLightHandle rh) { EXTRA_DYN_LIGHT *p_light = p_ber->p_edlight + rh; DYN_LIGHT_ANIM *p_an = &p_light->an; if (rh < p_ber->edl_lightnum && p_light->akt && p_an->endtime && p_light->flag & EDL_ANIMACE) { p_light->flag &= ~EDL_ANIMACE; return (rh); } else return (K_CHYBA); } /* **************************************************************** Extra-svetla - keyframova animace svetel **************************************************************** */ inline void edl_light_to_light(EXTRA_DYN_LIGHT * p_light, DYN_LIGHT_ANIM * p_track, int time) { int loop = p_light->an_flag & GK_LOOP; if (p_track->pos_keys) { key_track_interpolace_bod(&p_light->np, p_track->p_pos, p_track->p_pkeys, time, p_track->endtime, p_track->pos_keys, loop); p_light->tp = p_light->np; } if (p_track->trg_keys) { key_track_interpolace_bod(&p_light->dir, p_track->p_trg, p_track->p_tkeys, time, p_track->endtime, p_track->trg_keys, loop); } if (p_track->dos_keys) { key_track_interpolace_bod_linear((BOD *) & p_light->dosah, p_track->p_dosah, p_track->p_dskeys, time, p_track->endtime, p_track->dos_keys, loop); } if (p_track->alfa_keys) { key_track_interpolace_float_linear(&p_light->da, p_track->p_alfa, p_track->p_akeys, time, p_track->endtime, p_track->alfa_keys, loop); } if (p_track->spec_keys) { key_track_interpolace_bod_linear((BOD *) & p_light->sr, (BOD *) p_track->p_spec, p_track->p_spkeys, time, p_track->endtime, p_track->spec_keys, loop); } } void edla_updatuj(G_KONFIG * p_ber) { dword next_time = p_ber->TimeEndLastFrame; EXTRA_DYN_LIGHT *p_light; DYN_LIGHT_ANIM *p_an; int i; int konec; /* Animace se updatuji kazdy frame */ for (i = 0; i < p_ber->edl_lightnum; i++) { p_light = p_ber->p_edlight + i; p_an = &p_light->an; if (p_light->flag & EDL_ANIMACE) { /* Test na konec animace */ if ((konec = (next_time > p_light->time_stop))) { if (p_light->an_flag & GK_LOOP) { calc_time_loop(next_time, p_light->start, &p_light->time_start, &p_light->time_stop, &p_light->time_delka, &p_light->time); if (p_light->p_flag) *(p_light->p_flag) = 0; konec = 0; } else { p_light->time = p_light->time_delka; p_light->flag &= ~EDL_ANIMACE; if (p_light->p_flag) *(p_light->p_flag) = ANIM_FLAG_KONEC; } } else { p_light->time = calc_time_akt(next_time, p_light->time_start); if (p_light->p_flag) *(p_light->p_flag) = ftoi((p_light->time / (float) p_light->time_delka) * 100.0f); } /* Vypocitej animaci svetla */ edl_light_to_light(p_light, p_an, p_light->time); p_light->flag |= EDL_ZMENA_GLOBAL; p_ber->edl_recalc = TRUE; } } } /* Run-time rutiny pro extra-dynamicke svetla */ /* Prepocitam seznamy svetel -> pouze pri update */ int edl_mesh_pridej_svetla(G_KONFIG * p_ber, GAME_MESH_OLD * p_mesh) { GAME_MESH_DATA *p_data = p_mesh->p_data; EXTRA_DYN_LIGHT *p_light; EXTRA_DYN_LIGHT *p_light_dyn[MAX_FLARE_SVETEL * 2]; dword flags = 0; float vzdal; int flag; int lightnum = 0; int i; int kflag = p_data->kflag; if (kflag & (KONT_POHYB | KONT_VIDITELNY_ZMENA) || p_ber->edl_recalc || p_ber->edl_new) { // Zaradim dynamicke svetla lightnum = 0; for (i = 0; i < p_ber->edl_lightnum; i++) { p_light = p_ber->p_edlight + i; if (p_light->akt) { flag = p_light->flag; if (!(flag & EDL_SCENA)) { if (flag & EDL_MESH_LIGHT) { if (kflag & KONT_DRAW_LIGHT && p_data->top_edlight == i) { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } else if (flag & EDL_DOSAH) { if (flag & EDL_BODOVE) { if (p_light->dosah > obb_vzdal_bod(&p_mesh->obb_world, &p_light->tp)) { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } else if (flag & (EDL_PLOSNE_X | EDL_PLOSNE_Y | EDL_PLOSNE_Z)) { if (flag & EDL_PLOSNE_X) { vzdal = obb_vzdal_rovina_x(&p_mesh->obb_world, p_light->tp.x); } else if (flag & EDL_PLOSNE_Y) { vzdal = obb_vzdal_rovina_y(&p_mesh->obb_world, p_light->tp.y); } else { vzdal = obb_vzdal_rovina_z(&p_mesh->obb_world, p_light->tp.z); } if (p_light->dosah > vzdal) { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } } } else { p_light_dyn[lightnum++] = p_light; flags |= p_light->flag; } } } if (!lightnum) { null_free((void **) &p_data->p_edlight); p_data->edlightnum = p_data->edlightmax = 0; if (!(kflag & KONT_DRAW_LIGHT)) { p_data->kflag &= ~(KONT_DRAW_SPEC); p_data->kflag &= ~(KONT_DRAW_PRUHL); if (!(p_data->m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC)) && p_mesh->p_vertex_spec) { free(p_mesh->p_vertex_spec); p_mesh->p_vertex_spec = NULL; } } } else { // Nastav ostrou spekularni barvu if (flags & (EDL_SPEC_MOD | EDL_SPEC_SET | EDL_SPEC_ADD | EDL_SPEC_SUB)) { p_data->kflag |= KONT_DRAW_SPEC; if (!p_mesh->p_vertex_spec) { p_mesh->p_vertex_spec = (BODRGB *) mmalloc(sizeof(p_mesh->p_vertex_spec[0]) * p_mesh->vertexnum); } } if (flags & EDL_PRUHL_LIGHT) { p_data->kflag |= KONT_DRAW_PRUHL; } if (lightnum >= p_data->edlightmax) { null_free((void **) &p_data->p_edlight); i += (lightnum >> 1) + 10; p_data->p_edlight = (EXTRA_DYN_LIGHT **)mmalloc(sizeof(p_data->p_edlight[0]) * i); p_data->edlightmax = i; memcpy(p_data->p_edlight, p_light_dyn, sizeof(p_data->p_edlight[0]) * lightnum); } else { memcpy(p_data->p_edlight, p_light_dyn, sizeof(p_data->p_edlight[0]) * lightnum); } p_data->edlightnum = lightnum; } return (TRUE); } else { return (FALSE); } } /*********************************************************************** Dynamicke flare ********************************************************************** */ FlareHandle kom_flare_set_param(FlareHandle fh, float r, float g, float b, float a, float dx, float dy, int material, int alfa) { LENS_FLARE *p_flare = (LENS_FLARE *) fh; p_flare->akt = TRUE; p_flare->r = r; p_flare->g = g; p_flare->b = b; p_flare->a = a; p_flare->dx = dx; p_flare->dy = dy; p_flare->material = material; p_flare->alfa = alfa; p_flare->p_mat = p_ber->p_mat[material]; return (fh); } LENS_FLARE *kom_flare_get_pointer(FlareHandle fh) { return ((LENS_FLARE *) fh); } FlareHandle kom_flare_set_pivot(FlareHandle fh, BOD * p_pivot) { LENS_FLARE *p_flare = (LENS_FLARE *) fh; p_flare->p_bod = p_pivot; return (fh); } FlareHandle kom_flare_set_pos(FlareHandle fh, BOD * p_pos) { LENS_FLARE *p_flare = (LENS_FLARE *) fh; p_flare->p = *p_pos; return (fh); } FlareHandle kom_flare_vyrob(int flag) { LENS_FLARE *p_flare; p_flare = (LENS_FLARE *)mmalloc(sizeof(p_flare[0])); p_flare->p_next = p_ber->p_flare; p_flare->p_prev = NULL; if (p_ber->p_flare) { p_ber->p_flare->p_prev = p_flare; } p_ber->p_flare = p_flare; p_flare->zflag = flag; p_flare->p_svetlo = NULL; return ((FlareHandle) p_flare); } void kom_flare_zrus(FlareHandle fh) { LENS_FLARE *p_flare = (LENS_FLARE *) fh; if (p_flare->p_next) p_flare->p_next->p_prev = p_flare->p_prev; if (p_flare->p_prev) p_flare->p_prev->p_next = p_flare->p_next; else p_ber->p_flare = p_flare->p_next; free(p_flare); } void dl_nastav_kvalitu(G_KONFIG * p_ber) { if (p_ber->conf_dyn_rychlost == LIGHT_ALL) { p_ber->conf_dyn_light_prvky = FALSE; p_ber->conf_dyn_light_beruska = FALSE; p_ber->conf_dyn_light_mesh = TRUE; p_ber->conf_dyn_light_poly = TRUE; } else if (p_ber->conf_dyn_rychlost == LIGHT_PRVKY) { p_ber->conf_dyn_light_prvky = TRUE; // pouze prvky p_ber->conf_dyn_light_beruska = FALSE; p_ber->conf_dyn_light_mesh = TRUE; p_ber->conf_dyn_light_poly = TRUE; } else if (p_ber->conf_dyn_rychlost == LIGHT_VERTEXY) { p_ber->conf_dyn_light_prvky = TRUE; // pouze vertexove prvky p_ber->conf_dyn_light_beruska = FALSE; p_ber->conf_dyn_light_mesh = TRUE; p_ber->conf_dyn_light_poly = FALSE; } else if (p_ber->conf_dyn_rychlost == LIGHT_NIC) { p_ber->conf_dyn_light_beruska = TRUE; // pouze beruska p_ber->conf_dyn_light_prvky = FALSE; p_ber->conf_dyn_light_mesh = FALSE; p_ber->conf_dyn_light_poly = FALSE; } } /* Nastavi detaily pro dynamicke svetla */ void dl_nastav(G_KONFIG * p_ber) { int rych = p_ber->conf_dyn_rychlost; // on-off svetel p_ber->conf_dyn_rychlost = LIGHT_ALL; p_ber->conf_dyn_light_update_all = TRUE; dl_nastav_kvalitu(p_ber); dl_updatuj(p_ber); p_ber->conf_dyn_rychlost = rych; dl_nastav_kvalitu(p_ber); } void mlha_reset(void) { p_ber->p_mlha_akt = NULL; } berusky2-0.12/src/komat/Matrix.h0000644000175000017500000004246313674454657013500 00000000000000/* h k modulu s maticema */ #ifndef __MATRIX_H #define __MATRIX_H // vynuluje matici inline GLMATRIX *zero_matrix(GLMATRIX * m) { memset((void *) m, 0, sizeof(*m)); return (m); } // Standartni kody na praci s maticemi // Nastavi matici na jednotkovou inline GLMATRIX *init_matrix(GLMATRIX * m) { m->_11 = m->_22 = m->_33 = m->_44 = 1; m->_12 = m->_13 = m->_14 = m->_41 = 0; m->_21 = m->_23 = m->_24 = m->_42 = 0; m->_31 = m->_32 = m->_34 = m->_43 = 0; return (m); } // Nasobeni matic 'a' a 'b' do matice 'r' // Alespon doufam po me konverzi :-) inline GLMATRIX *mat_mult(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) { GLMATRIX tmp; tmp._11 = a->_11 * b->_11 + a->_12 * b->_21 + a->_13 * b->_31 + a->_14 * b->_41; tmp._21 = a->_21 * b->_11 + a->_22 * b->_21 + a->_23 * b->_31 + a->_24 * b->_41; tmp._31 = a->_31 * b->_11 + a->_32 * b->_21 + a->_33 * b->_31 + a->_34 * b->_41; tmp._41 = a->_41 * b->_11 + a->_42 * b->_21 + a->_43 * b->_31 + a->_44 * b->_41; tmp._12 = a->_11 * b->_12 + a->_12 * b->_22 + a->_13 * b->_32 + a->_14 * b->_42; tmp._22 = a->_21 * b->_12 + a->_22 * b->_22 + a->_23 * b->_32 + a->_24 * b->_42; tmp._32 = a->_31 * b->_12 + a->_32 * b->_22 + a->_33 * b->_32 + a->_34 * b->_42; tmp._42 = a->_41 * b->_12 + a->_42 * b->_22 + a->_43 * b->_32 + a->_44 * b->_42; tmp._13 = a->_11 * b->_13 + a->_12 * b->_23 + a->_13 * b->_33 + a->_14 * b->_43; tmp._23 = a->_21 * b->_13 + a->_22 * b->_23 + a->_23 * b->_33 + a->_24 * b->_43; tmp._33 = a->_31 * b->_13 + a->_32 * b->_23 + a->_33 * b->_33 + a->_34 * b->_43; tmp._43 = a->_41 * b->_13 + a->_42 * b->_23 + a->_43 * b->_33 + a->_44 * b->_43; tmp._14 = a->_11 * b->_14 + a->_12 * b->_24 + a->_13 * b->_34 + a->_14 * b->_44; tmp._24 = a->_21 * b->_14 + a->_22 * b->_24 + a->_23 * b->_34 + a->_24 * b->_44; tmp._34 = a->_31 * b->_14 + a->_32 * b->_24 + a->_33 * b->_34 + a->_34 * b->_44; tmp._44 = a->_41 * b->_14 + a->_42 * b->_24 + a->_43 * b->_34 + a->_44 * b->_44; memcpy(r, &tmp, sizeof(GLMATRIX)); return (r); } inline GLMATRIX *mat_add(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) { r->_11 = a->_11 + b->_11; r->_12 = a->_12 + b->_12; r->_13 = a->_13 + b->_13; r->_14 = a->_14 + b->_14; r->_21 = a->_21 + b->_21; r->_22 = a->_22 + b->_22; r->_23 = a->_23 + b->_23; r->_24 = a->_24 + b->_24; r->_31 = a->_31 + b->_31; r->_32 = a->_32 + b->_32; r->_33 = a->_33 + b->_33; r->_34 = a->_34 + b->_34; r->_41 = a->_41 + b->_41; r->_42 = a->_42 + b->_42; r->_43 = a->_43 + b->_43; r->_44 = a->_44 + b->_44; return (r); } inline GLMATRIX *mat_mult_skalar(GLMATRIX * r, float scale) { r->_11 *= scale; r->_12 *= scale; r->_13 *= scale; r->_14 *= scale; r->_21 *= scale; r->_22 *= scale; r->_23 *= scale; r->_24 *= scale; r->_31 *= scale; r->_32 *= scale; r->_33 *= scale; r->_34 *= scale; r->_41 *= scale; r->_42 *= scale; r->_43 *= scale; r->_44 *= scale; return (r); } inline int mat_porovnej(GLMATRIX * r, GLMATRIX * a) { if (r->_11 != a->_11) return (FALSE); if (r->_12 != a->_12) return (FALSE); if (r->_13 != a->_13) return (FALSE); if (r->_14 != a->_14) return (FALSE); if (r->_21 != a->_21) return (FALSE); if (r->_22 != a->_22) return (FALSE); if (r->_23 != a->_23) return (FALSE); if (r->_24 != a->_24) return (FALSE); if (r->_31 != a->_31) return (FALSE); if (r->_32 != a->_32) return (FALSE); if (r->_33 != a->_33) return (FALSE); if (r->_34 != a->_34) return (FALSE); if (r->_41 != a->_41) return (FALSE); if (r->_42 != a->_42) return (FALSE); if (r->_43 != a->_43) return (FALSE); if (r->_44 != a->_44) return (FALSE); return (TRUE); } inline GLMATRIX *mat_copy(GLMATRIX * d, GLMATRIX * s) { return ((GLMATRIX *) memcpy(d, s, sizeof(*d))); } inline GLMATRIX *mat_mult_dir(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) { r->_11 = a->_11 * b->_11 + a->_12 * b->_21 + a->_13 * b->_31 + a->_14 * b->_41; r->_21 = a->_21 * b->_11 + a->_22 * b->_21 + a->_23 * b->_31 + a->_24 * b->_41; r->_31 = a->_31 * b->_11 + a->_32 * b->_21 + a->_33 * b->_31 + a->_34 * b->_41; r->_41 = a->_41 * b->_11 + a->_42 * b->_21 + a->_43 * b->_31 + a->_44 * b->_41; r->_12 = a->_11 * b->_12 + a->_12 * b->_22 + a->_13 * b->_32 + a->_14 * b->_42; r->_22 = a->_21 * b->_12 + a->_22 * b->_22 + a->_23 * b->_32 + a->_24 * b->_42; r->_32 = a->_31 * b->_12 + a->_32 * b->_22 + a->_33 * b->_32 + a->_34 * b->_42; r->_42 = a->_41 * b->_12 + a->_42 * b->_22 + a->_43 * b->_32 + a->_44 * b->_42; r->_13 = a->_11 * b->_13 + a->_12 * b->_23 + a->_13 * b->_33 + a->_14 * b->_43; r->_23 = a->_21 * b->_13 + a->_22 * b->_23 + a->_23 * b->_33 + a->_24 * b->_43; r->_33 = a->_31 * b->_13 + a->_32 * b->_23 + a->_33 * b->_33 + a->_34 * b->_43; r->_43 = a->_41 * b->_13 + a->_42 * b->_23 + a->_43 * b->_33 + a->_44 * b->_43; r->_14 = a->_11 * b->_14 + a->_12 * b->_24 + a->_13 * b->_34 + a->_14 * b->_44; r->_24 = a->_21 * b->_14 + a->_22 * b->_24 + a->_23 * b->_34 + a->_24 * b->_44; r->_34 = a->_31 * b->_14 + a->_32 * b->_24 + a->_33 * b->_34 + a->_34 * b->_44; r->_44 = a->_41 * b->_14 + a->_42 * b->_24 + a->_43 * b->_34 + a->_44 * b->_44; return (r); } // Rotace kolem osy x o uhel angle inline GLMATRIX *rotate_matrix_x(GLMATRIX * m, float angle) { GLMATRIX r; float ssin = (float) sin(angle); float ccos = (float) cos(angle); // a = rotate matrix // b = m r._11 = m->_11; r._21 = ccos * m->_21 + ssin * m->_31; r._31 = -ssin * m->_21 + ccos * m->_31; r._41 = m->_41; r._12 = m->_12; r._22 = ccos * m->_22 + ssin * m->_32; r._32 = -ssin * m->_22 + ccos * m->_32; r._42 = m->_42; r._13 = m->_13; r._23 = ccos * m->_23 + ssin * m->_33; r._33 = -ssin * m->_23 + ccos * m->_33; r._43 = m->_43; r._14 = m->_14; r._24 = ccos * m->_24 + ssin * m->_34; r._34 = -ssin * m->_24 + ccos * m->_34; r._44 = m->_44; *m = r; return (m); } // Rotace kolem osy y o uhel angle inline GLMATRIX *rotate_matrix_y(GLMATRIX * m, float angle) { GLMATRIX r; float ssin = (float) sin(angle); float ccos = (float) cos(angle); // a = temp // b = m r._11 = ccos * m->_11 + ssin * m->_31; r._21 = m->_21; r._31 = -ssin * m->_11 + ccos * m->_31; r._41 = m->_41; r._12 = ccos * m->_12 + ssin * m->_32; r._22 = m->_22; r._32 = -ssin * m->_12 + ccos * m->_32; r._42 = m->_42; r._13 = ccos * m->_13 + ssin * m->_33; r._23 = m->_23; r._33 = -ssin * m->_13 + ccos * m->_33; r._43 = m->_43; r._14 = ccos * m->_14 + ssin * m->_34; r._24 = m->_24; r._34 = -ssin * m->_14 + ccos * m->_34; r._44 = m->_44; *m = r; return (m); } // Rotace kolem osy z o uhel angle inline GLMATRIX *rotate_matrix_z(GLMATRIX * m, float angle) { GLMATRIX r; float ssin = (float) sin(angle); float ccos = (float) cos(angle); r._11 = ccos * m->_11 + ssin * m->_21; r._21 = -ssin * m->_11 + ccos * m->_21; r._31 = m->_31; r._41 = m->_41; r._12 = ccos * m->_12 + ssin * m->_22; r._22 = -ssin * m->_12 + ccos * m->_22; r._32 = m->_32; r._42 = m->_42; r._13 = ccos * m->_13 + ssin * m->_23; r._23 = -ssin * m->_13 + ccos * m->_23; r._33 = m->_33; r._43 = m->_43; r._14 = ccos * m->_14 + ssin * m->_24; r._24 = -ssin * m->_14 + ccos * m->_24; r._34 = m->_34; r._44 = m->_44; *m = r; return (m); } inline GLMATRIX *rotation_matrix_z(GLMATRIX * p_m, float angle) { float sinus = (float) sin(angle); float cosinus = (float) cos(angle); init_matrix(p_m); p_m->_11 = cosinus; p_m->_12 = sinus; p_m->_22 = cosinus; p_m->_21 = -sinus; return (p_m); } // Posunuti matice m o dx,dy,dz inline GLMATRIX *translate_matrix(GLMATRIX * m, float px, float py, float pz) { m->_41 += px * m->_11 + py * m->_21 + pz * m->_31; m->_42 += px * m->_12 + py * m->_22 + pz * m->_32; m->_43 += px * m->_13 + py * m->_23 + pz * m->_33; m->_44 += px * m->_14 + py * m->_24 + pz * m->_34; return (m); } inline GLMATRIX *translate_matrix2(GLMATRIX * m, BOD * p_pos) { float px = p_pos->x; float py = p_pos->y; float pz = p_pos->z; m->_41 += px * m->_11 + py * m->_21 + pz * m->_31; m->_42 += px * m->_12 + py * m->_22 + pz * m->_32; m->_43 += px * m->_13 + py * m->_23 + pz * m->_33; m->_44 += px * m->_14 + py * m->_24 + pz * m->_34; return (m); } inline GLMATRIX *translate_matrix_set(GLMATRIX * m, BOD * p_pos) { m->_41 = p_pos->x; m->_42 = p_pos->y; m->_43 = p_pos->z; return (m); } // scale matice m o dx,dy,dz inline GLMATRIX *scale_matrix(GLMATRIX * m, float x, float y, float z) { m->_11 *= x; m->_21 *= x; m->_31 *= x; m->_12 *= y; m->_22 *= y; m->_32 *= y; m->_13 *= z; m->_23 *= z; m->_33 *= z; return (m); } // vypocet inverzni matice k src // Spocita inverzni matici k *src a ulozi ji do *inv inline GLMATRIX *invert_matrix(GLMATRIX * src, GLMATRIX * inv) { float det; inv->_11 = src->_22 * src->_33 - src->_23 * src->_32; inv->_12 = -src->_12 * src->_33 + src->_13 * src->_32; inv->_13 = src->_12 * src->_23 - src->_13 * src->_22; det = inv->_11 * src->_11 + inv->_12 * src->_21 + inv->_13 * src->_31; if (det == 0.0f) { // we're not very happy with the source matrix ;-) init_matrix(inv); return inv; } inv->_21 = -src->_21 * src->_33 + src->_23 * src->_31; inv->_22 = src->_11 * src->_33 - src->_13 * src->_31; inv->_23 = -src->_11 * src->_23 + src->_13 * src->_21; inv->_31 = src->_21 * src->_32 - src->_22 * src->_31; inv->_32 = -src->_11 * src->_32 + src->_12 * src->_31; inv->_33 = src->_11 * src->_22 - src->_12 * src->_21; inv->_11 /= det; inv->_12 /= det; inv->_13 /= det; inv->_21 /= det; inv->_22 /= det; inv->_23 /= det; inv->_31 /= det; inv->_32 /= det; inv->_33 /= det; inv->_41 = -src->_41 * inv->_11 - src->_42 * inv->_21 - src->_43 * inv->_31; inv->_42 = -src->_41 * inv->_12 - src->_42 * inv->_22 - src->_43 * inv->_32; inv->_43 = -src->_41 * inv->_13 - src->_42 * inv->_23 - src->_43 * inv->_33; inv->_14 = 0; inv->_24 = 0; inv->_34 = 0; inv->_44 = 1; return (inv); } inline int matrix_det(GLMATRIX * p_mat) { float m1 = p_mat->_22 * p_mat->_33 - p_mat->_23 * p_mat->_32; float m2 = -p_mat->_12 * p_mat->_33 + p_mat->_13 * p_mat->_32; float m3 = p_mat->_12 * p_mat->_23 - p_mat->_13 * p_mat->_22; return ((m1 * p_mat->_11 + m2 * p_mat->_21 + m3 * p_mat->_31) != 0.0); } inline GLMATRIX *invert_matrix_copy(GLMATRIX * src, GLMATRIX * inv) { GLMATRIX m; float det; m._11 = src->_22 * src->_33 - src->_23 * src->_32; m._12 = -src->_12 * src->_33 + src->_13 * src->_32; m._13 = src->_12 * src->_23 - src->_13 * src->_22; det = m._11 * src->_11 + m._12 * src->_21 + m._13 * src->_31; if (det == 0.0f) { // we're not very happy with the source matrix ;-) init_matrix(inv); return inv; } m._21 = -src->_21 * src->_33 + src->_23 * src->_31; m._22 = src->_11 * src->_33 - src->_13 * src->_31; m._23 = -src->_11 * src->_23 + src->_13 * src->_21; m._31 = src->_21 * src->_32 - src->_22 * src->_31; m._32 = -src->_11 * src->_32 + src->_12 * src->_31; m._33 = src->_11 * src->_22 - src->_12 * src->_21; m._11 /= det; m._12 /= det; m._13 /= det; m._21 /= det; m._22 /= det; m._23 /= det; m._31 /= det; m._32 /= det; m._33 /= det; m._41 = -src->_41 * m._11 - src->_42 * m._21 - src->_43 * m._31; m._42 = -src->_41 * m._12 - src->_42 * m._22 - src->_43 * m._32; m._43 = -src->_41 * m._13 - src->_42 * m._23 - src->_43 * m._33; m._14 = 0; m._24 = 0; m._34 = 0; m._44 = 1; *inv = m; return (inv); } inline GLMATRIX *mat_rot(GLMATRIX * p_mat, BOD * p_vx, BOD * p_vy, BOD * p_vz) { p_mat->_11 = p_vx->x; p_mat->_21 = p_vx->y; p_mat->_31 = p_vx->z; p_mat->_12 = p_vy->x; p_mat->_22 = p_vy->y; p_mat->_32 = p_vy->z; p_mat->_13 = p_vz->x; p_mat->_23 = p_vz->y; p_mat->_33 = p_vz->z; p_mat->_14 = p_mat->_24 = p_mat->_34 = 0.0f; p_mat->_41 = p_mat->_42 = p_mat->_43 = 0.0f; p_mat->_44 = 1.0f; return (p_mat); } inline GLMATRIX *mat_rot_2(GLMATRIX * p_mat, BOD * p_vx, BOD * p_vy, BOD * p_vz, BOD * p_pos) { p_mat->_11 = p_vx->x; p_mat->_21 = p_vx->y; p_mat->_31 = p_vx->z; p_mat->_12 = p_vy->x; p_mat->_22 = p_vy->y; p_mat->_32 = p_vy->z; p_mat->_13 = p_vz->x; p_mat->_23 = p_vz->y; p_mat->_33 = p_vz->z; p_mat->_14 = p_mat->_24 = p_mat->_34 = 0.0f; p_mat->_41 = p_pos->x; p_mat->_42 = p_pos->y; p_mat->_43 = p_pos->z; p_mat->_44 = 1.0f; return (p_mat); } inline GLMATRIX *mat_rot_inv(GLMATRIX * p_mat, BOD * p_vx, BOD * p_vy, BOD * p_vz) { return (invert_matrix_copy(mat_rot(p_mat, p_vx, p_vy, p_vz), p_mat)); } inline GLMATRIX *mat_rot_2_inv(GLMATRIX * p_mat, BOD * p_vx, BOD * p_vy, BOD * p_vz, BOD * p_pos) { return (invert_matrix_copy(mat_rot_2(p_mat, p_vx, p_vy, p_vz, p_pos), p_mat)); } inline GLMATRIX *buildFrustumMatrix(GLMATRIX * m, float l, float r, float b, float t, float n, float f) { m->_11 = (2.0f * n) / (r - l); m->_12 = 0.0f; m->_13 = 0.0f; m->_14 = 0.0f; m->_21 = 0.0f; m->_22 = (2.0f * n) / (t - b); m->_23 = 0.0f; m->_24 = 0.0f; m->_31 = (r + l) / (r - l); m->_32 = (t + b) / (t - b); m->_33 = (f + n) / (f - n); m->_34 = 1.0f; m->_41 = 0.0f; m->_42 = 0.0f; m->_43 = -(2.0f * f * n) / (f - n); m->_44 = 0.0f; return (m); } #ifndef PI #define PI 3.14159265358979323846f #endif /* */ #ifndef RAD2DEG #define RAD2DEG(fi) (((fi)/PI)*180.0f) #endif /* */ #define MAX_VZDAL_Z 50.0f #define MIN_VZDAL_Z 1.0f inline GLMATRIX *projection_matrix(GLMATRIX * p_mat, float fovy, float aspect, float zNear, float zFar) { float xmin, xmax, ymin, ymax; ymax = zNear * (float) tan(fovy); ymin = -ymax; xmin = ymin * aspect; xmax = ymax * aspect; return (buildFrustumMatrix(p_mat, xmin, xmax, ymin, ymax, zNear, zFar)); } //inline GLMATRIX * mat_mult(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) inline GLMATRIX *float_to_matrix(GLMATRIX * p_mat, float uhel, BOD * p_pivot) { GLMATRIX m2; float cosa = (float) cos(uhel); float sina = (float) sin(uhel); float px, py; if (!p_pivot) { p_mat->_11 = cosa; p_mat->_22 = cosa; p_mat->_21 = sina; p_mat->_12 = -sina; } else { px = -p_pivot->x; py = -p_pivot->y; /* posun matice a*b -> tmp a = pos matrix b = rot matrix */ m2._11 = cosa; m2._21 = sina; m2._41 = px * cosa + py * sina + p_mat->_41; m2._12 = -sina; m2._22 = cosa; m2._42 = px * (-sina) + py * cosa + p_mat->_42; /* a = rot b = pos - 1 */ p_mat->_11 = m2._11; p_mat->_21 = m2._21; p_mat->_41 = m2._41 + p_mat->_44 * (-px); p_mat->_12 = m2._12; p_mat->_22 = m2._22; p_mat->_42 = m2._42 + p_mat->_44 * (-py); } return (p_mat); } inline GLMATRIX *pivotuj_matrix(GLMATRIX * p_mat, BOD * p_pivot) { float px = -p_pivot->x, py = -p_pivot->y, pz = -p_pivot->z; float m14, m24, m34, m41, m42, m43, m44; if (px == 0.0f && py == 0.0f && pz == 0.0f) return (p_mat); // a = translate // b = p_mat m41 = px * p_mat->_11 + py * p_mat->_21 + pz * p_mat->_31 + p_mat->_41; m42 = px * p_mat->_12 + py * p_mat->_22 + pz * p_mat->_32 + p_mat->_42; m43 = px * p_mat->_13 + py * p_mat->_23 + pz * p_mat->_33 + p_mat->_43; m44 = px * p_mat->_14 + py * p_mat->_24 + pz * p_mat->_34 + p_mat->_44; m14 = p_mat->_14; m24 = p_mat->_24; m34 = p_mat->_34; // posun zpet // a = mat // b = translate - px = -px; py = -py; pz = -pz; p_mat->_11 += m14 * (px); p_mat->_21 += m24 * (px); p_mat->_31 += m34 * (px); p_mat->_41 = m41 + m44 * (px); p_mat->_12 += m14 * (py); p_mat->_22 += m24 * (py); p_mat->_32 += m34 * (py); p_mat->_42 = m42 + m44 * (py); p_mat->_13 += m14 * (pz); p_mat->_23 += m24 * (pz); p_mat->_33 += m34 * (pz); p_mat->_43 = m43 + m44 * (pz); p_mat->_44 = m44; return (p_mat); } inline GLMATRIX *pivotuj_matrix_tam(BOD * p_pivot, GLMATRIX * p_mat) { float px = -p_pivot->x, py = -p_pivot->y, pz = -p_pivot->z; if (px == 0.0f && py == 0.0f && pz == 0.0f) return (p_mat); else { // a = translate // b = p_mat p_mat->_41 += px * p_mat->_11 + py * p_mat->_21 + pz * p_mat->_31; p_mat->_42 += px * p_mat->_12 + py * p_mat->_22 + pz * p_mat->_32; p_mat->_43 += px * p_mat->_13 + py * p_mat->_23 + pz * p_mat->_33; p_mat->_44 += px * p_mat->_14 + py * p_mat->_24 + pz * p_mat->_34; return (p_mat); } } GLfloat *glu_invert_matrix(GLfloat * m, GLfloat * out); inline GLMATRIX *rovina_to_matrix(ROVINA * p_r, GLMATRIX * p_mat, float scale) { p_mat->_11 = p_r->x * p_r->x * scale; p_mat->_21 = p_r->x * p_r->y * scale; p_mat->_31 = p_r->x * p_r->z * scale; p_mat->_41 = p_r->x * p_r->e * scale; p_mat->_12 = p_r->y * p_r->x * scale; p_mat->_22 = p_r->y * p_r->y * scale; p_mat->_32 = p_r->y * p_r->z * scale; p_mat->_42 = p_r->y * p_r->e * scale; p_mat->_13 = p_r->z * p_r->x * scale; p_mat->_23 = p_r->z * p_r->y * scale; p_mat->_33 = p_r->z * p_r->z * scale; p_mat->_43 = p_r->z * p_r->e * scale; p_mat->_14 = p_r->e * p_r->x * scale; p_mat->_24 = p_r->e * p_r->y * scale; p_mat->_34 = p_r->e * p_r->z * scale; p_mat->_44 = p_r->e * p_r->e * scale; return (p_mat); } inline void matrix_to_rovina(GLMATRIX * p_mat, ROVINA * p_r) { p_r->x = (float) sqrt(p_mat->_11); p_r->y = (float) sqrt(p_mat->_22); p_r->z = (float) sqrt(p_mat->_33); p_r->e = (float) sqrt(p_mat->_44); } GLMATRIX *matrix_all(GLMATRIX * m, BOD * p_pos, QUAT * p_rot, BOD * p_scs); #endif berusky2-0.12/src/komat/Berusky3d_animace.h0000644000175000017500000000157613674426075015555 00000000000000/* Animace.h */ #ifndef __BERUSKY_3D_ANIMACE #define __BERUSKY_3D_ANIMACE /* Init vsech animaci */ void ani_init(G_KONFIG * p_ber); int amat_pridej_mesh(G_KONFIG * p_ber, int mesh); int amat_pridej_poly(G_KONFIG * p_ber, int poly); int amat_pridej_material(G_KONFIG * p_ber, EDIT_MATERIAL * p_mat); void amat_updatuj(G_KONFIG * p_ber); int amat_get_frame(EDIT_MATERIAL * p_mat); int amat_set_frame_text(EDIT_MATERIAL * p_mat, int frame); void lani_updatuj(G_KONFIG * p_ber); void rani_updatuj_prvek_matice(size_ptr mesh_handle); void rani_umisti_prvek_animace(size_ptr mesh_handle); void rani_updatuj(G_KONFIG * p_ber); void tani_init_scena(G_KONFIG * p_ber); void tani_updatuj(G_KONFIG * p_ber); void tani_zrus(GK_TEXTANIM ** p_tani); void chani_updatuj(G_KONFIG * p_ber); void chani_zrus_all(G_KONFIG * p_ber); int rani_je_mesh(RunHandle a_handle, MeshHandle m_handle); #endif berusky2-0.12/src/komat/3d_all.h0000644000175000017500000000066113674426075013355 00000000000000/* Vsechny include pro 3D */ #ifndef __3D_ALL__ #define __3D_ALL__ #include #include #include #include #include #include #include #include #include "age.h" #include "mmalloc.h" #include "zlib.h" #include "zlib_io.h" #include "level_environment.h" #include "adas.h" #include "audio_plug-in.h" #include "compat.h" #include "kfile.h" #endif berusky2-0.12/src/komat/Load_chunks.cpp0000644000175000017500000045325713674774077015031 00000000000000/* Chunky */ #include #include #include #include "3d_all.h" #define CHUNK_MATERIAL 10 // nacitat material (jmeno materialu) #define CHUNK_COLOR 11 // barvy materialu #define CHUNK_MATANIM 12 // animace materialu #define CHUNK_STAG_TAG 13 // stage tagy (cislo stagu + jejich cisla) #define CHUNK_COLOR_EXT 20 // barvy materialu rozsirene #define CHUNK_LESK 21 // sila odlesku #define CHUNK_FLAGS 22 // flagy materialu #define CHUNK_ENVSPEC 26 // spec-env udaje #define CHUNK_ALFA_STAGE 27 // alfa nastavenni materialu (pruhledny,pouzity,src,dest) #define CHUNK_TEXT_STAGE_1 28 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_2 29 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_3 30 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_4 31 // multi tag, pred texturou #define CHUNK_TEXT_1 16 // textura, k multi tagu #define CHUNK_TEXT_2 18 // textura, k multi tagu #define CHUNK_TEXT_3 32 // textura, k multi tagu #define CHUNK_TEXT_4 33 // textura, k multi tagu #define CHUNK_MATANIM_T1 34 // animace textur 1 #define CHUNK_MATANIM_T2 35 // animace textur 2 #define CHUNK_MATANIM_T3 36 // animace textur 3 #define CHUNK_MATANIM_T4 37 // animace textur 4 // tady se musi nechat rezerva kvuli ukadani dalsich textur #define CHUNK_MATMATRIX_EXT 50 // animacni matice textury 1 #define CHUNK_TEXT_STAGE_AD_1 51 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_AD_2 52 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_AD_3 53 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_AD_4 54 // multi tag, pred texturou #define CHUNK_TEXT_FLAG_1 55 // textura, k multi tagu #define CHUNK_TEXT_FLAG_2 56 // textura, k multi tagu #define CHUNK_TEXT_FLAG_3 57 // textura, k multi tagu #define CHUNK_TEXT_FLAG_4 58 // textura, k multi tagu #define CHUNK_MATANIM_EXT 60 // animace materialu #define CHUNK_MATANIM_FRAME 61 // frame materialu #define CHUNK_MAT_SMAT_POS 62 // pozice s-materialu #define CHUNK_MAT_TEXGEN 63 // pozice s-materialu #define CHUNK_MATANIM_EFRAME 64 // frame materialu #define CHUNK_KONT_JMENO 100 // zacatek kontejneru - jeho jmeno #define CHUNK_KONT_FLAG 101 // flag kontejneru #define CHUNK_KONT_WMATRIX 102 // matice kontejneru #define CHUNK_KONT_FLAG_EXT 103 // flag kontejneru #define CHUNK_KONT_MPMATRIX 104 // m-p matice kontejneru #define CHUNK_KONT_LOW_JMENO 105 // zacatek low kontejneru #define CHUNK_KONT_LOW_ID 106 // identifikator low-kontejneru #define CHUNK_KONT_ID 107 // identifikator kontejneru #define CHUNK_KONT_FLAG_EXT_2 108 // ext-flagy // #define CHUNK_KONT_OBB 109 - stara #define CHUNK_KONT_OBB 110 // OBB kontejneru #define CHUNK_OBJ_JMENO 1001 // jmeno objektu #define CHUNK_OBJ_MATERIAL 1002 // material objektu #define CHUNK_OBJ_VERTEXY 1003 // pole vertexu #define CHUNK_OBJ_MAPY_1 1004 // pole mapu #define CHUNK_OBJ_MAPY_2 1005 // pole mapu #define CHUNK_OBJ_FACY 1006 // pole facu #define CHUNK_OBJ_BARVY 1007 // pole barev #define CHUNK_OBJ_BARVY_EXT 1008 // pole rozsirenych barev #define CHUNK_OBJ_MATRIX 1009 // local-matrix kontejneru (pro keyframe-kontejnery) #define CHUNK_OBJ_ID 1010 // ID objektu #define CHUNK_OBJ_MATRIX_KEY 1011 // keyframe matice #define CHUNK_OBJ_MAPY_3 1012 // pole mapu 3 #define CHUNK_OBJ_MAPY_4 1013 // pole mapu 4 #define CHUNK_OBJ_PIVOT 1014 // pivot-point objektu //#define CHUNK_OBJ_OBB 1015 stara obb obalka #define CHUNK_OBJ_OBB 1016 // obb obalka #define CHUNK_OBJ_FACY_OPT 1017 // pole facu #define CHUNK_OBJ_NORMAL 1018 // pole normalu #define CHUNK_OBJ_JA 1500 #define CHUNK_OBJ_JA_JMENO 1501 #define CHUNK_OBJ_JA_FRAMU 1502 #define CHUNK_OBJ_JNT_ID 1600 #define CHUNK_OBJ_JNT_PIVOT 1601 #define CHUNK_OBJ_JNT_VERT 1602 #define CHUNK_OBJ_JNT_FLAG 1603 #define CHUNK_OBJ_JNT_POS 1604 #define CHUNK_OBJ_JNT_ROT 1605 #define CHUNK_OBJ_JNT_SCS 1606 #define CHUNK_OBJ_JNT_KEYPOS 1607 #define CHUNK_OBJ_JNT_KEYROT 1608 #define CHUNK_OBJ_JNT_KEYSCS 1609 //v 1.0 // vsechny se davaji do aktivniho kontejneru //#define CHUNK_KEYFRAME_ROOT 2000 // hlavicka key-framove animace //#define CHUNK_KEYFRAME_ROT2 2005 // hlavicka key-framove animace //#define CHUNK_KEYFRAME_NODE 2001 // vetev animace - pro jeden objekt //#define CHUNK_KEYFRAME_POS 2002 // chunk s pozicema //#define CHUNK_KEYFRAME_ROT 2003 // chunk s rotacema //#define CHUNK_KEYFRAME_SCS 2004 // chunk s scalama //v. 2 #define CHUNK_KEYFRAME_ROT2 2006 // hlavicka key-framove animace #define CHUNK_KEYFRAME_NODE 2007 // vetev animace - pro jeden objekt #define CHUNK_KEYFRAME_POS 2008 // chunk s pozicema #define CHUNK_KEYFRAME_ROT 2009 // chunk s rotacema #define CHUNK_KEYFRAME_SCS 2010 // chunk s scalama //v. 3 - sim animace #define CHUNK_SIM_ROOT 2020 // hlavicka key-framove animace #define CHUNK_SIM_NODE 2021 // vetev animace - pro jeden objekt #define CHUNK_SIM_NODE_EXT 2022 // vetev animace - pro jeden objekt //#define CHUNK_SIM_NODE_MAT 2023 // all-matice #define CHUNK_SIM_NODE_EXT2 2024 // vetev animace - pro jeden objekt // v. 2 #define CHUNK_STATIC_LIGHT 5003 // chunk se statickym svetlem sceny #define CHUNK_STATIC_LIGHT_MESH 5004 // chunk se statickym svetlem (patri k naposledy nactenemu meshi) #define CHUNK_DYNAMIC_LIGHT 5100 // chunk se dynamickycm svetlem #define CHUNK_DYNAMIC_LIGHT_MESH 5101 // chunk se dynamickycm svetlem (patri k naposledy nactenemu meshi) #define CHUNK_EXTRA_LIGHT 5200 // chunk se extra dynamickycm svetlem #define CHUNK_EXTRA_LIGHT_MESH 5201 // chunk se extra dynamickycm svetlem (patri k naposledy nactenemu meshi) #define CHUNK_ZRCADLO 6000 // chunk se statickym svetlem #define CHUNK_ZRCADLO_2 6001 // chunk se statickym svetlem #define CHUNK_ZRCADLO_3 6002 // chunk se statickym svetlem #define CHUNK_ZRCADLO_3_POLOZKA 6003 // chunk se statickym svetlem #define CHUNK_FLARE 7000 // chunk se flare #define CHUNK_FLARE_SLOZENY 7001 // chunk se slozkama ke flare #define CHUNK_FLARE_MESH 7002 // chunk se flare_pripojeny k mesi #define CHUNK_FLARE_LIGHT 7003 // chunk se flare ke svetlu #define CHUNK_FLARE_EXT 7010 // chunk se flare #define CHUNK_FLARE_MESH_EXT 7011 // chunk se flare_pripojeny k mesi #define CHUNK_FLARE_LIGHT_EXT 7012 // chunk se flare ke svetlu #define CHUNK_AMBIENT 8000 // chunk s ambientnim svetlem #define CHUNK_LEVEL_KONFIG 8001 // chunk s kofiguraci levelu #define CHUNK_LEVEL_KONFIG_EXT 8002 // chunk s kofiguraci levelu #define CHUNK_MLHOKOSTKA 8010 // chunk se starou mlznou kostkou #define CHUNK_MLHOKOSTKA_2 8011 // chunk s mlznou kostkou #define CHUNK_ENVIRONMENT 8020 // chunk s environmentem #define CHUNK_KAMSET 8021 // chunk s environmentem #define CHUNK_KAMSET_2 8022 // chunk s environmentem #define ROOT_NODE_JMENO "$$$ROOT_NODE$$$" typedef struct _OUT_CHUNK { int typ; int velikost; // od zacatku tohoto chunku } OUT_CHUNK; /* ********************************************************************** Ulozeni environmentu */ int lo_chunk_save_environment(FFILE f, LEVEL_ENVIRONMENT * p_env) { OUT_CHUNK ch; ch.typ = CHUNK_ENVIRONMENT; ch.velikost = sizeof(ch) + sizeof(p_env[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_env, sizeof(p_env[0]), 1, f); return (TRUE); } /* ********************************************************************** Ulozeni omezeni a nastaveni kamer */ int lo_chunk_save_kamset(FFILE f, NASTAVENI_KAMER * p_kam) { OUT_CHUNK ch; ch.typ = CHUNK_KAMSET; ch.velikost = sizeof(ch) + sizeof(p_kam->far_plane) + sizeof(p_kam->fov) + sizeof(p_kam->max_uhel) + sizeof(p_kam->min_uhel) + sizeof(p_kam->min_vzdal) + sizeof(p_kam->max_vzdal); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kam->far_plane, sizeof(p_kam->far_plane), 1, f); ffwrite(&p_kam->fov, sizeof(p_kam->fov), 1, f); ffwrite(&p_kam->max_uhel, sizeof(p_kam->max_uhel), 1, f); ffwrite(&p_kam->min_uhel, sizeof(p_kam->min_uhel), 1, f); ffwrite(&p_kam->min_vzdal, sizeof(p_kam->min_vzdal), 1, f); ffwrite(&p_kam->max_vzdal, sizeof(p_kam->max_vzdal), 1, f); return (TRUE); } int lo_chunk_save_kamset_2(FFILE f, NASTAVENI_KAMER * p_kam) { OUT_CHUNK ch; ch.typ = CHUNK_KAMSET_2; ch.velikost = sizeof(ch) + sizeof(p_kam->max) + sizeof(p_kam->min); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kam->max, sizeof(p_kam->max), 1, f); ffwrite(&p_kam->min, sizeof(p_kam->min), 1, f); return (TRUE); } /* ********************************************************************** Ulozeni dynamickeho svetla */ int lo_chunk_save_dyn_light_anim(FFILE f, DYN_LIGHT_ANIM * p_an, int extra) { ffwrite(&p_an->pos_keys, sizeof(p_an->pos_keys), 1, f); ffwrite(p_an->p_pkeys, sizeof(p_an->p_pkeys[0]), p_an->pos_keys, f); ffwrite(p_an->p_pos, sizeof(p_an->p_pos[0]), p_an->pos_keys, f); ffwrite(&p_an->trg_keys, sizeof(p_an->trg_keys), 1, f); ffwrite(p_an->p_tkeys, sizeof(p_an->p_tkeys[0]), p_an->trg_keys, f); ffwrite(p_an->p_trg, sizeof(p_an->p_trg[0]), p_an->trg_keys, f); ffwrite(&p_an->dos_keys, sizeof(p_an->dos_keys), 1, f); ffwrite(p_an->p_dskeys, sizeof(p_an->p_dskeys[0]), p_an->dos_keys, f); ffwrite(p_an->p_dosah, sizeof(p_an->p_dosah[0]), p_an->dos_keys, f); if (!extra) { ffwrite(&p_an->diff_keys, sizeof(p_an->diff_keys), 1, f); ffwrite(p_an->p_dfkeys, sizeof(p_an->p_dfkeys[0]), p_an->diff_keys, f); ffwrite(p_an->p_diff, sizeof(p_an->p_diff[0]), p_an->diff_keys, f); } else { int i; p_an->p_diff = (BARVA_RGBA *) mmalloc(sizeof(p_an->p_diff[0]) * p_an->alfa_keys); for (i = 0; i < p_an->alfa_keys; i++) { p_an->p_diff[i].r = p_an->p_diff[i].g = p_an->p_diff[i].b = p_an->p_diff[i].a = p_an->p_alfa[i]; } ffwrite(&p_an->alfa_keys, sizeof(p_an->alfa_keys), 1, f); ffwrite(p_an->p_akeys, sizeof(p_an->p_akeys[0]), p_an->alfa_keys, f); ffwrite(p_an->p_diff, sizeof(p_an->p_diff[0]), p_an->alfa_keys, f); null_free((void **) &p_an->p_diff); } ffwrite(&p_an->spec_keys, sizeof(p_an->spec_keys), 1, f); ffwrite(p_an->p_spkeys, sizeof(p_an->p_spkeys[0]), p_an->spec_keys, f); ffwrite(p_an->p_spec, sizeof(p_an->p_spec[0]), p_an->spec_keys, f); return (TRUE); } int lo_chunk_get_dyn_light_size(FFILE f, DYN_LIGHT_ANIM * p_an) { return (sizeof(p_an->pos_keys) + sizeof(p_an->p_pkeys[0]) * p_an->pos_keys + sizeof(p_an->p_pos[0]) * p_an->pos_keys + sizeof(p_an->trg_keys) + sizeof(p_an->p_tkeys[0]) * p_an->trg_keys + sizeof(p_an->p_trg[0]) * p_an->trg_keys + sizeof(p_an->dos_keys) + sizeof(p_an->p_dskeys[0]) * p_an->dos_keys + sizeof(p_an->p_dosah[0]) * p_an->dos_keys + sizeof(p_an->diff_keys) + sizeof(p_an->p_dfkeys[0]) * p_an->diff_keys + sizeof(p_an->p_diff[0]) * p_an->diff_keys + sizeof(p_an->spec_keys) + sizeof(p_an->p_spkeys[0]) * p_an->spec_keys + sizeof(p_an->p_spec[0]) * p_an->spec_keys); } int lo_chunk_save_dyn_light(FFILE f, DYN_LIGHT * p_light) { OUT_CHUNK ch; ch.typ = CHUNK_DYNAMIC_LIGHT; ch.velikost = sizeof(ch) + sizeof(p_light->akt) + sizeof(byte) + sizeof(p_light->np) + sizeof(p_light->dir) + sizeof(p_light->look_max) + sizeof(p_light->dosah) + sizeof(p_light->min) + sizeof(p_light->max) + sizeof(p_light->theta) + sizeof(p_light->dr) + sizeof(p_light->dg) + sizeof(p_light->db) + sizeof(p_light->an_flag) + sizeof(p_light->flag); if (p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_light->akt, sizeof(p_light->akt), 1, f); ffwrite(p_light->jmeno, sizeof(byte), strlen(p_light->jmeno) + 1, f); ffwrite(&p_light->np, sizeof(p_light->np), 1, f); ffwrite(&p_light->dir, sizeof(p_light->dir), 1, f); ffwrite(&p_light->look_max, sizeof(p_light->look_max), 1, f); ffwrite(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffwrite(&p_light->min, sizeof(p_light->min), 1, f); ffwrite(&p_light->max, sizeof(p_light->max), 1, f); ffwrite(&p_light->theta, sizeof(p_light->theta), 1, f); ffwrite(&p_light->dr, sizeof(p_light->dr), 1, f); ffwrite(&p_light->dg, sizeof(p_light->dg), 1, f); ffwrite(&p_light->db, sizeof(p_light->db), 1, f); ffwrite(&p_light->sr, sizeof(p_light->sr), 1, f); ffwrite(&p_light->sg, sizeof(p_light->sg), 1, f); ffwrite(&p_light->sb, sizeof(p_light->sb), 1, f); ffwrite(&p_light->flag, sizeof(p_light->flag), 1, f); ffwrite(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffwrite(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffwrite(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); if (p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an, FALSE); } return (TRUE); } // ulozi linearni seznam svetel int lo_chunk_save_dyn_light_mesh(FFILE f, DYN_LIGHT * p_light) { OUT_CHUNK ch; while (p_light) { ch.typ = CHUNK_DYNAMIC_LIGHT_MESH; ch.velikost = sizeof(ch) + sizeof(p_light->akt) + sizeof(byte) + sizeof(p_light->np) + sizeof(p_light->dir) + sizeof(p_light->look_max) + sizeof(p_light->dosah) + sizeof(p_light->min) + sizeof(p_light->max) + sizeof(p_light->theta) + sizeof(p_light->dr) + sizeof(p_light->dg) + sizeof(p_light->db) + sizeof(p_light->an_flag) + sizeof(p_light->flag); if (p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_light->akt, sizeof(p_light->akt), 1, f); ffwrite(p_light->jmeno, sizeof(byte), strlen(p_light->jmeno) + 1, f); ffwrite(&p_light->np, sizeof(p_light->np), 1, f); ffwrite(&p_light->dir, sizeof(p_light->dir), 1, f); ffwrite(&p_light->look_max, sizeof(p_light->look_max), 1, f); ffwrite(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffwrite(&p_light->min, sizeof(p_light->min), 1, f); ffwrite(&p_light->max, sizeof(p_light->max), 1, f); ffwrite(&p_light->theta, sizeof(p_light->theta), 1, f); ffwrite(&p_light->dr, sizeof(p_light->dr), 1, f); ffwrite(&p_light->dg, sizeof(p_light->dg), 1, f); ffwrite(&p_light->db, sizeof(p_light->db), 1, f); ffwrite(&p_light->sr, sizeof(p_light->sr), 1, f); ffwrite(&p_light->sg, sizeof(p_light->sg), 1, f); ffwrite(&p_light->sb, sizeof(p_light->sb), 1, f); ffwrite(&p_light->flag, sizeof(p_light->flag), 1, f); ffwrite(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffwrite(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffwrite(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); if (p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an, FALSE); } p_light = p_light->p_next; } return (TRUE); } /************************************************************ Ulozeni extra-svetel *********************************************************** */ int lo_chunk_save_extra_light(FFILE f, EXTRA_DYN_LIGHT * p_light) { OUT_CHUNK ch; ch.typ = CHUNK_EXTRA_LIGHT; ch.velikost = sizeof(ch) + sizeof(p_light->akt) + sizeof(byte) + sizeof(p_light->flag) + sizeof(p_light->mflag) + sizeof(p_light->ktrida) + sizeof(p_light->np) + sizeof(p_light->dir) + sizeof(p_light->dosah) + sizeof(p_light->theta) + sizeof(p_light->utlum) + sizeof(p_light->gourand) + 4 * sizeof(p_light->da) + sizeof(p_light->sr) + sizeof(p_light->sg) + sizeof(p_light->sb) + sizeof(p_light->an_flag) + sizeof(p_light->an.endtime); if (p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_light->akt, sizeof(p_light->akt), 1, f); ffwrite(p_light->jmeno, sizeof(byte), strlen(p_light->jmeno) + 1, f); ffwrite(&p_light->flag, sizeof(p_light->flag), 1, f); ffwrite(&p_light->mflag, sizeof(p_light->mflag), 1, f); ffwrite(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffwrite(&p_light->np, sizeof(p_light->np), 1, f); ffwrite(&p_light->dir, sizeof(p_light->dir), 1, f); ffwrite(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffwrite(&p_light->theta, sizeof(p_light->theta), 1, f); ffwrite(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffwrite(&p_light->gourand, sizeof(p_light->gourand), 1, f); ffwrite(&p_light->da, sizeof(p_light->da), 4, f); // alfa se ulozi jako duplikovana ffwrite(&p_light->sr, sizeof(p_light->sr), 1, f); ffwrite(&p_light->sg, sizeof(p_light->sg), 1, f); ffwrite(&p_light->sb, sizeof(p_light->sb), 1, f); ffwrite(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffwrite(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); if (p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an, TRUE); } return (TRUE); } int lo_chunk_save_extra_light_mesh(FFILE f, EXTRA_DYN_LIGHT * p_light) { OUT_CHUNK ch; while (p_light) { ch.typ = CHUNK_EXTRA_LIGHT_MESH; ch.velikost = sizeof(ch) + sizeof(p_light->akt) + sizeof(byte) + sizeof(p_light->flag) + sizeof(p_light->mflag) + sizeof(p_light->ktrida) + sizeof(p_light->np) + sizeof(p_light->dir) + sizeof(p_light->dosah) + sizeof(p_light->theta) + sizeof(p_light->utlum) + sizeof(p_light->gourand) + 4 * sizeof(p_light->da) + sizeof(p_light->sr) + sizeof(p_light->sg) + sizeof(p_light->sb) + sizeof(p_light->an_flag) + sizeof(p_light->an.endtime); if (p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_light->akt, sizeof(p_light->akt), 1, f); ffwrite(p_light->jmeno, sizeof(byte), strlen(p_light->jmeno) + 1, f); ffwrite(&p_light->flag, sizeof(p_light->flag), 1, f); ffwrite(&p_light->mflag, sizeof(p_light->mflag), 1, f); ffwrite(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffwrite(&p_light->np, sizeof(p_light->np), 1, f); ffwrite(&p_light->dir, sizeof(p_light->dir), 1, f); ffwrite(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffwrite(&p_light->theta, sizeof(p_light->theta), 1, f); ffwrite(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffwrite(&p_light->gourand, sizeof(p_light->gourand), 1, f); ffwrite(&p_light->da, sizeof(p_light->da), 4, f); ffwrite(&p_light->sr, sizeof(p_light->sr), 1, f); ffwrite(&p_light->sg, sizeof(p_light->sg), 1, f); ffwrite(&p_light->sb, sizeof(p_light->sb), 1, f); ffwrite(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffwrite(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); if (p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an, TRUE); } p_light = p_light->p_next; } return (TRUE); } /* ********************************************************************** Ulozeni mlho-kostek */ void lo_chunk_save_mlhokostku(FFILE f, MLZNA_KOSTKA * p_top, int kont) { OUT_CHUNK ch; int kid; while (p_top) { if (!kont && p_top->p_kont) { p_top = p_top->p_next; // uloz vsechny mlho-kostky bez kontejnerovych continue; } ch.typ = CHUNK_MLHOKOSTKA_2; ch.velikost = sizeof(ch) + sizeof(byte) + sizeof(BOD) + sizeof(BOD) + sizeof(p_top->flag) + sizeof(p_top->mod) + sizeof(p_top->priorita) + sizeof(p_top->start) + sizeof(p_top->stop) + sizeof(p_top->intenzita) + sizeof(float) * 4 + sizeof(int) + sizeof(int); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_top->jmeno, sizeof(byte), strlen(p_top->jmeno) + 1, f); ffwrite(&p_top->min, sizeof(BOD), 1, f); ffwrite(&p_top->max, sizeof(BOD), 1, f); ffwrite(&p_top->flag, sizeof(p_top->flag), 1, f); ffwrite(&p_top->mod, sizeof(p_top->mod), 1, f); ffwrite(&p_top->priorita, sizeof(p_top->priorita), 1, f); ffwrite(&p_top->start, sizeof(p_top->start), 1, f); ffwrite(&p_top->stop, sizeof(p_top->stop), 1, f); ffwrite(&p_top->intenzita, sizeof(p_top->intenzita), 1, f); ffwrite(&p_top->r, sizeof(float) * 4, 1, f); kid = p_top->p_kont ? 1 : K_CHYBA; ffwrite(&kid, sizeof(kid), 1, f); ffwrite(&p_top->poly, sizeof(p_top->poly), 1, f); if (kont) // pokud je kont - uloz 1 kostku kontejneru return; p_top = p_top->p_next; } } /* ********************************************************************** Ulozeni flare */ void lo_chunk_save_flare(FFILE f, LENS_FLARE * p_flare, EDIT_MATERIAL ** p_mat, int light) { OUT_CHUNK ch; char pom[200]; int nic = K_CHYBA; if (!p_flare) return; strcpy(pom, p_mat[p_flare->material]->jmeno); ch.typ = light ? CHUNK_FLARE_LIGHT_EXT : CHUNK_FLARE_EXT; ch.velikost = sizeof(ch) + sizeof(BOD) + sizeof(float) * 4 + sizeof(float) * 2 + sizeof(int) + sizeof(int) + sizeof(int) + strlen(pom) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_flare->p, sizeof(BOD), 1, f); // umisteni ffwrite(&p_flare->r, sizeof(float), 4, f); // barva ffwrite(&p_flare->dx, sizeof(float), 2, f); // rozmery ffwrite(&nic, sizeof(int), 1, f); // navazani ffwrite(&p_flare->alfa, sizeof(int), 1, f); ffwrite(&p_flare->zflag, sizeof(int), 1, f); ffwrite(pom, sizeof(char), strlen(pom) + 1, f); } void lo_chunk_save_flare_mesh(FFILE f, LENS_FLARE * p_flare, EDIT_MATERIAL ** p_mat) { OUT_CHUNK ch; char pom[200]; int nic = K_CHYBA; if (!p_flare) return; strcpy(pom, p_mat[p_flare->material]->jmeno); ch.typ = CHUNK_FLARE_MESH_EXT; ch.velikost = sizeof(ch) + sizeof(BOD) + sizeof(float) * 4 + sizeof(float) * 2 + sizeof(int) + sizeof(int) + sizeof(int) + strlen(pom) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_flare->p, sizeof(BOD), 1, f); // umisteni ffwrite(&p_flare->r, sizeof(float), 4, f); // barva ffwrite(&p_flare->dx, sizeof(float), 2, f); // rozmery //ffwrite(&p_flare->svetlo,sizeof(int),1,f); // navazani ffwrite(&nic, sizeof(int), 1, f); // navazani ffwrite(&p_flare->alfa, sizeof(int), 1, f); ffwrite(&p_flare->zflag, sizeof(int), 1, f); ffwrite(pom, sizeof(char), strlen(pom) + 1, f); } void lo_chunk_save_flare_slozeny(FFILE f, LENS_FLARE * p_flare, EDIT_MATERIAL ** p_mat) { OUT_CHUNK ch; char pom[SLOZ_FLARE][200]; int s, d = 0; if (!p_flare || !p_flare->p_sloz) return; for (s = 0; s < SLOZ_FLARE; s++) { if (p_flare->p_sloz[s].vzdal > 0.0f) strcpy(pom[s], p_mat[p_flare->p_sloz[s].material]->jmeno); else pom[s][0] = 0; d += strlen(pom[s]) + 1; } ch.typ = CHUNK_FLARE_SLOZENY; ch.velikost = sizeof(ch) + sizeof(float) * SLOZ_FLARE + sizeof(float) * 4 * SLOZ_FLARE + sizeof(float) * 2 * SLOZ_FLARE + d; ffwrite(&ch, sizeof(ch), 1, f); for (s = 0; s < SLOZ_FLARE; s++) { ffwrite(&p_flare->p_sloz[s].vzdal, sizeof(float), 1, f); ffwrite(&p_flare->p_sloz[s].r, sizeof(float), 4, f); ffwrite(&p_flare->p_sloz[s].dx, sizeof(float), 2, f); ffwrite(pom[s], sizeof(char), strlen(pom[s]) + 1, f); } } /* ********************************************************************** Ulozeni ambientu */ void lo_chunk_save_ambient(FFILE f, dword ambient) { OUT_CHUNK ch; ch.typ = CHUNK_AMBIENT; ch.velikost = sizeof(ch) + sizeof(ambient); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&ambient, sizeof(ambient), 1, f); } /* ********************************************************************** Ulozeni ambientu */ void lo_chunk_save_lc_ext(FFILE f, LEVEL_KONFIG * p_lc) { OUT_CHUNK ch; ch.typ = CHUNK_LEVEL_KONFIG_EXT; ch.velikost = sizeof(ch) + sizeof(p_lc->barva_pozadi) + sizeof(p_lc->barva_pozadi_aktivni) + sizeof(p_lc->zm.aktivni) + sizeof(p_lc->zm.v_start) + sizeof(p_lc->zm.v_stop) + sizeof(p_lc->zm.h_start) + sizeof(p_lc->zm.h_stop) + sizeof(p_lc->zm.barva); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_lc->barva_pozadi, sizeof(p_lc->barva_pozadi), 1, f); ffwrite(&p_lc->barva_pozadi_aktivni, sizeof(p_lc->barva_pozadi_aktivni), 1, f); ffwrite(&p_lc->zm.aktivni, sizeof(p_lc->zm.aktivni), 1, f); ffwrite(&p_lc->zm.v_start, sizeof(p_lc->zm.v_start), 1, f); ffwrite(&p_lc->zm.v_stop, sizeof(p_lc->zm.v_stop), 1, f); ffwrite(&p_lc->zm.h_start, sizeof(p_lc->zm.h_start), 1, f); ffwrite(&p_lc->zm.h_stop, sizeof(p_lc->zm.h_stop), 1, f); ffwrite(&p_lc->zm.barva, sizeof(p_lc->zm.barva), 1, f); } /* ********************************************************************** Ulozeni zrcadla */ void lo_chunk_preved_zrcadlo(EDIT_KONTEJNER ** p_kont, int kontnum, ZDRCADLO_DESC * p_desc) { ZDRCADLO_DESC_POLY *p_tmp = p_desc->p_poly; while (p_tmp) { int k = p_tmp->zrcadlo_k; if (k != K_CHYBA && k < kontnum && p_kont[k]) { p_tmp->id_kont = p_kont[k]->kontejner_ID; } else { p_tmp->id_kont = K_CHYBA; } p_tmp = p_tmp->p_next; } } /* typedef struct _ZDRCADLO_DESC_POLY { int zrcadlo_k; // kontejner zrcadla int zrcadlo_o; // objekt zrcadla int id_kont; // id kontejneru int poly; // poly ktereho se to tyka struct _ZDRCADLO_DESC_POLY *p_next; } ZDRCADLO_DESC_POLY; */ void lo_chunk_save_zrcadlo_sub(FFILE f, ZDRCADLO_DESC_POLY * p_desc) { OUT_CHUNK ch; ch.typ = CHUNK_ZRCADLO_3_POLOZKA; ch.velikost = sizeof(ch) + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(int); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_desc->zrcadlo_k, sizeof(p_desc->zrcadlo_k), 1, f); ffwrite(&p_desc->zrcadlo_o, sizeof(p_desc->zrcadlo_o), 1, f); ffwrite(&p_desc->id_kont, sizeof(p_desc->id_kont), 1, f); ffwrite(&p_desc->poly, sizeof(p_desc->poly), 1, f); int tmp; ffwrite(&tmp, sizeof(int), 1, f); } /* typedef struct _ZDRCADLO_DESC { // Zustava - popisuje rovine zrcadlo GLMATRIX ref; // reflexni matice BOD p[4]; // 4 body roviny zrcadla ROVINAD r[5]; // 4 plochy klipovaci pyramidy ZDRCADLO_DESC_POLY * p_poly; } ZDRCADLO_DESC; */ void lo_chunk_save_zrcadlo(FFILE f, ZDRCADLO_DESC * p_desc) { ZDRCADLO_DESC_POLY *p_poly; OUT_CHUNK ch; ch.typ = CHUNK_ZRCADLO_3; ch.velikost = sizeof(ch) + sizeof(GLMATRIX) + sizeof(BOD) * 4 + sizeof(ROVINAD) * 5 + sizeof(int); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_desc->ref, sizeof(GLMATRIX), 1, f); ffwrite(p_desc->p, sizeof(BOD) * 4, 1, f); ffwrite(p_desc->r, sizeof(ROVINAD) * 5, 1, f); int tmp; ffwrite(&tmp, sizeof(tmp), 1, f); p_poly = p_desc->p_poly; while (p_poly) { lo_chunk_save_zrcadlo_sub(f, p_poly); p_poly = p_poly->p_next; } } /* ********************************************************************** Ulozeni svetel */ int lo_chunk_save_static_light(FFILE f, STATIC_LIGHT * p_light, EDIT_MATERIAL ** p_mat) { LENS_FLARE *p_flare; OUT_CHUNK ch; int j; ch.typ = CHUNK_STATIC_LIGHT; ch.velikost = sizeof(ch) + sizeof(p_light->akt) + strlen(p_light->jmeno) + 1 + sizeof(p_light->index) + sizeof(p_light->p) + sizeof(float) * 3 + sizeof(float) * 4 + sizeof(p_light->uhel) + sizeof(p_light->utlum) + sizeof(p_light->flag) + sizeof(p_light->flag2); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_light->akt, sizeof(p_light->akt), 1, f); ffwrite(p_light->jmeno, sizeof(char), strlen(p_light->jmeno) + 1, f); ffwrite(&p_light->index, sizeof(p_light->index), 1, f); ffwrite(&p_light->p, sizeof(p_light->p), 1, f); ffwrite(&p_light->r, sizeof(float), 1, f); ffwrite(&p_light->g, sizeof(float), 1, f); ffwrite(&p_light->b, sizeof(float), 1, f); ffwrite(&p_light->k1, sizeof(float), 4, f); ffwrite(&p_light->uhel, sizeof(p_light->uhel), 1, f); ffwrite(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffwrite(&p_light->flag, sizeof(p_light->flag), 1, f); ffwrite(&p_light->flag2, sizeof(p_light->flag2), 1, f); p_flare = (LENS_FLARE *) p_light->p_flare; if (p_flare && p_flare->akt) { lo_uloz_material_chunk(f, p_flare->p_mat); lo_chunk_save_flare(f, p_flare, p_mat, TRUE); if (p_flare->p_sloz) { for (j = 0; j < SLOZ_FLARE; j++) { if (p_flare->p_sloz[j].vzdal > 0.0f) lo_uloz_material_chunk(f, p_flare->p_sloz[j].p_mat); } lo_chunk_save_flare_slozeny(f, p_flare, p_mat); } } return (TRUE); } int lo_chunk_save_static_light_mesh(FFILE f, STATIC_LIGHT * p_light, EDIT_MATERIAL ** p_mat) { LENS_FLARE *p_flare; OUT_CHUNK ch; int j; while (p_light) { /* Ulozeni statickeho svetla */ ch.typ = CHUNK_STATIC_LIGHT_MESH; ch.velikost = sizeof(ch) + sizeof(p_light->akt) + strlen(p_light->jmeno) + 1 + sizeof(p_light->index) + sizeof(p_light->p) + sizeof(float) * 3 + sizeof(float) * 4 + sizeof(p_light->uhel) + sizeof(p_light->utlum) + sizeof(p_light->flag) + sizeof(p_light->flag2); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_light->akt, sizeof(p_light->akt), 1, f); ffwrite(p_light->jmeno, sizeof(char), strlen(p_light->jmeno) + 1, f); ffwrite(&p_light->index, sizeof(p_light->index), 1, f); ffwrite(&p_light->p, sizeof(p_light->p), 1, f); ffwrite(&p_light->r, sizeof(float), 1, f); ffwrite(&p_light->g, sizeof(float), 1, f); ffwrite(&p_light->b, sizeof(float), 1, f); ffwrite(&p_light->k1, sizeof(float), 4, f); ffwrite(&p_light->uhel, sizeof(p_light->uhel), 1, f); ffwrite(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffwrite(&p_light->flag, sizeof(p_light->flag), 1, f); ffwrite(&p_light->flag2, sizeof(p_light->flag2), 1, f); /* Ulozeni flaru ke statickemu svetlu */ p_flare = (LENS_FLARE *) p_light->p_flare; if (p_flare && p_flare->akt) { lo_uloz_material_chunk(f, p_flare->p_mat); lo_chunk_save_flare_mesh(f, p_flare, p_mat); if (p_flare->p_sloz) { for (j = 0; j < SLOZ_FLARE; j++) { if (p_flare->p_sloz[j].vzdal > 0.0f) lo_uloz_material_chunk(f, p_flare->p_sloz[j].p_mat); } lo_chunk_save_flare_slozeny(f, p_flare, p_mat); } } /* Dalsi svetlo */ p_light = p_light->p_next; } return (TRUE); } /************************************************************************ Ukladani materialu */ int lo_chunk_save_mat(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_MATERIAL; ch.velikost = sizeof(ch) + strlen(p_mat->jmeno) + 1; ffwrite(&ch, sizeof(ch), 1, f); strlwr(p_mat->jmeno); ffwrite(p_mat->jmeno, sizeof(char), strlen(p_mat->jmeno) + 1, f); return (TRUE); } int lo_chunk_save_mat_flags(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_FLAGS; ch.velikost = sizeof(ch) + sizeof(p_mat->flag) + sizeof(p_mat->flag2); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_mat->flag, sizeof(p_mat->flag), 1, f); ffwrite(&p_mat->flag2, sizeof(p_mat->flag2), 1, f); return (TRUE); } int lo_chunk_save_mat_smat_pos(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; if (p_mat->flag & MAT_SCENE) { ch.typ = CHUNK_MAT_SMAT_POS; ch.velikost = sizeof(ch) + sizeof(p_mat->smaterial_pozice); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_mat->smaterial_pozice, sizeof(p_mat->smaterial_pozice), 1, f); } return (TRUE); } int lo_chunk_save_mat_color(FFILE f, EDIT_MATERIAL * p_mat) { MATERIAL *p_dxmat; char string[16]; OUT_CHUNK ch; ch.typ = CHUNK_COLOR_EXT; ch.velikost = sizeof(ch) + 16; p_dxmat = &p_mat->dxmat; string[0] = (byte) (p_dxmat->ambient_r * MAX_BYTE); string[1] = (byte) (p_dxmat->ambient_g * MAX_BYTE); string[2] = (byte) (p_dxmat->ambient_b * MAX_BYTE); string[3] = (byte) (1.0f * MAX_BYTE); string[4] = (byte) (p_dxmat->diffuse_r * MAX_BYTE); string[5] = (byte) (p_dxmat->diffuse_g * MAX_BYTE); string[6] = (byte) (p_dxmat->diffuse_b * MAX_BYTE); string[7] = (byte) (p_dxmat->diffuse_a * MAX_BYTE); string[8] = (byte) (p_dxmat->specular_r * MAX_BYTE); string[9] = (byte) (p_dxmat->specular_g * MAX_BYTE); string[10] = (byte) (p_dxmat->specular_b * MAX_BYTE); string[11] = (byte) (1.0f * MAX_BYTE); string[12] = (byte) (p_dxmat->faktor_r * MAX_BYTE); string[13] = (byte) (p_dxmat->faktor_g * MAX_BYTE); string[14] = (byte) (p_dxmat->faktor_b * MAX_BYTE); string[15] = (byte) (p_dxmat->faktor_a * MAX_BYTE); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(string, sizeof(char), 16, f); return (TRUE); } int lo_chunk_save_mat_matanim_frame(FFILE f, ANIM_FRAME * p_fram, int frame) { EDIT_TEXT *p_text; OUT_CHUNK ch; int flag; if (p_fram) { p_text = p_fram->p_text; ch.typ = CHUNK_MATANIM_EFRAME; ch.velikost = sizeof(ch) + strlen(p_text->jmeno) + 1 + sizeof(p_text->flag) + sizeof(p_fram->time) + sizeof(p_fram->alfa) + sizeof(p_fram->u) + sizeof(p_fram->v) + sizeof(p_fram->flag) + sizeof(frame); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&frame, sizeof(frame), 1, f); ffwrite(&p_fram->time, sizeof(p_fram->time), 1, f); ffwrite(&p_fram->alfa, sizeof(p_fram->alfa), 1, f); ffwrite(&p_fram->u, sizeof(p_fram->u), 1, f); ffwrite(&p_fram->v, sizeof(p_fram->v), 1, f); ffwrite(&p_fram->flag, sizeof(p_fram->flag), 1, f); //Prdy z vody - ulozim rovnou texturu p_text = p_fram->p_text; flag = p_text->flag; ffwrite(&p_text->jmeno, sizeof(char), strlen(p_text->jmeno) + 1, f); ffwrite(&flag, sizeof(flag), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_mat_matanim(FFILE f, EDIT_MATERIAL * p_mat) { ANIM_MATERIAL *p_anim = &p_mat->anim; OUT_CHUNK ch; int i; if (p_mat->flag & MAT_ANIM_FRAME) { ch.typ = CHUNK_MATANIM_EXT; ch.velikost = sizeof(ch) + strlen(p_mat->anim.jmeno) + 1 + sizeof(p_anim->framenum); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_anim->jmeno, sizeof(char), strlen(p_anim->jmeno) + 1, f); ffwrite(&p_anim->framenum, sizeof(p_anim->framenum), 1, f); for (i = 0; i < p_anim->framenum; i++) { lo_chunk_save_mat_matanim_frame(f, p_anim->p_frame + i, i); } return (TRUE); } else return (FALSE); } int lo_chunk_save_mat_matanim_text_dal(FFILE f, ANIM_TEXT * p_track, int typ) { OUT_CHUNK ch; int velikost = 0; if (p_track->pos_keys && p_track->p_pos) { velikost += sizeof(p_track->p_pos[0]) * p_track->pos_keys + sizeof(p_track->p_pkeys[0]) * p_track->pos_keys; } if (p_track->piv_keys && p_track->p_piv) { velikost += sizeof(p_track->p_piv[0]) * p_track->piv_keys + sizeof(p_track->p_vkeys[0]) * p_track->piv_keys; } if (p_track->rot_keys && p_track->p_rot) { velikost += sizeof(p_track->p_rot[0]) * p_track->rot_keys + sizeof(p_track->p_rkeys[0]) * p_track->rot_keys; } if (p_track->scs_keys && p_track->p_scale) { velikost += sizeof(p_track->p_scale[0]) * p_track->scs_keys + sizeof(p_track->p_skeys[0]) * p_track->scs_keys; } ch.typ = typ; ch.velikost = sizeof(ch) + sizeof(p_track[0]) + velikost; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_track, sizeof(p_track[0]), 1, f); if (p_track->pos_keys && p_track->p_pos) { ffwrite(p_track->p_pos, sizeof(p_track->p_pos[0]), p_track->pos_keys, f); ffwrite(p_track->p_pkeys, sizeof(p_track->p_pkeys[0]), p_track->pos_keys, f); } if (p_track->piv_keys && p_track->p_piv) { ffwrite(p_track->p_piv, sizeof(p_track->p_piv[0]), p_track->piv_keys, f); ffwrite(p_track->p_vkeys, sizeof(p_track->p_vkeys[0]), p_track->piv_keys, f); } if (p_track->rot_keys && p_track->p_rot) { ffwrite(p_track->p_rot, sizeof(p_track->p_rot[0]), p_track->rot_keys, f); ffwrite(p_track->p_rkeys, sizeof(p_track->p_rkeys[0]), p_track->rot_keys, f); } if (p_track->scs_keys && p_track->p_scale) { ffwrite(p_track->p_scale, sizeof(p_track->p_scale[0]), p_track->scs_keys, f); ffwrite(p_track->p_skeys, sizeof(p_track->p_skeys[0]), p_track->scs_keys, f); } return (TRUE); } /* Ulozi animace textur */ int lo_chunk_save_mat_matanim_text(FFILE f, EDIT_MATERIAL * p_mat) { int i, j; for (j = 0; j < MAT_TEXTUR; j++) { if (p_mat->flag & glstav_posun_flagy2[j]) { for (i = 0; i < MAX_TEXT_ANIM; i++) { if (p_mat->p_atext[j][i]) { lo_chunk_save_mat_matanim_text_dal(f, p_mat->p_atext[j][i], CHUNK_MATANIM_T1 + j); } } } } return (TRUE); } int lo_chunk_save_mat_textmatrix(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_MATMATRIX_EXT; ch.velikost = sizeof(ch) + 4 * sizeof(p_mat->ttext[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_mat->ttext, sizeof(p_mat->ttext[0]), 1, f); ffwrite(p_mat->ttext + 1, sizeof(p_mat->ttext[0]), 1, f); ffwrite(p_mat->ttext + 2, sizeof(p_mat->ttext[0]), 1, f); ffwrite(p_mat->ttext + 3, sizeof(p_mat->ttext[0]), 1, f); return (TRUE); } int lo_chunk_save_mat_texgen_param(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_MAT_TEXGEN; ch.velikost = sizeof(ch) + 4 * sizeof(p_mat->texgen_koord_t); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_mat->texgen_koord_t, sizeof(p_mat->texgen_koord_t), 1, f); ffwrite(p_mat->texgen_koord_s, sizeof(p_mat->texgen_koord_s), 1, f); ffwrite(p_mat->texgen_koord_r, sizeof(p_mat->texgen_koord_r), 1, f); ffwrite(p_mat->texgen_koord_q, sizeof(p_mat->texgen_koord_q), 1, f); return (TRUE); } int lo_chunk_save_mat_blend(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_ALFA_STAGE; ch.velikost = sizeof(ch) + sizeof(p_mat->alfa_state); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_mat->alfa_state, sizeof(p_mat->alfa_state), 1, f); return (TRUE); } int lo_chunk_save_mat_env_spec(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_ENVSPEC; ch.velikost = sizeof(ch) + sizeof(p_mat->env_add1) + sizeof(p_mat->env_add2) + sizeof(p_mat->env_scale) + sizeof(p_mat->env_r) + sizeof(p_mat->env_g) + sizeof(p_mat->env_b); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_mat->env_add1, sizeof(p_mat->env_add1), 1, f); ffwrite(&p_mat->env_add2, sizeof(p_mat->env_add2), 1, f); ffwrite(&p_mat->env_scale, sizeof(p_mat->env_scale), 1, f); ffwrite(&p_mat->env_r, sizeof(p_mat->env_r), 1, f); ffwrite(&p_mat->env_g, sizeof(p_mat->env_g), 1, f); ffwrite(&p_mat->env_b, sizeof(p_mat->env_b), 1, f); return (TRUE); } int lo_chunk_save_mat_text_blend_ext(FFILE f, EDIT_MATERIAL * p_mat, int num) { OUT_CHUNK ch; ch.typ = CHUNK_TEXT_STAGE_AD_1 + num; ch.velikost = sizeof(ch) + sizeof(int) * 1 + sizeof(int) * 4 + sizeof(int) * 4 + sizeof(int) * 4 + sizeof(p_mat->text_state[num].text_ati_bump_matrix[0]) * 4; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_mat->text_state[num].text_stage, sizeof(int), 1, f); ffwrite(&p_mat->text_state[num].textury, sizeof(int), 4, f); ffwrite(&p_mat->text_state[num].text_koord, sizeof(int), 4, f); ffwrite(&p_mat->text_state[num].text_funkce, sizeof(int), 4, f); ffwrite(&p_mat->text_state[num].text_ati_bump_matrix, sizeof(p_mat->text_state[num].text_ati_bump_matrix[0]), 4, f); return (TRUE); } int lo_chunk_save_mat_text(FFILE f, EDIT_MATERIAL * p_mat, int num, int typ) { OUT_CHUNK ch; if (p_mat->textfile[num][0]) { ch.typ = typ; ch.velikost = sizeof(ch) + strlen(p_mat->textfile[num]) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_mat->textfile[num], sizeof(char), strlen(p_mat->textfile[num]) + 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_mat_text_flag(FFILE f, EDIT_MATERIAL * p_mat, int num, int typ) { OUT_CHUNK ch; if (p_mat) { ch.typ = typ; ch.velikost = sizeof(ch) + sizeof(p_mat->textflag[num]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_mat->textflag + num, sizeof(p_mat->textflag[num]), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_mat_lesk(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; ch.typ = CHUNK_LESK; ch.velikost = sizeof(ch) + sizeof(float); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_mat->lesk, sizeof(float), 1, f); return (TRUE); } /* Ulozi material do souboru */ int lo_uloz_material_chunk(FFILE f, EDIT_MATERIAL * p_mat) { // hlavni info lo_chunk_save_mat(f, p_mat); lo_chunk_save_mat_flags(f, p_mat); lo_chunk_save_mat_color(f, p_mat); lo_chunk_save_mat_matanim(f, p_mat); lo_chunk_save_mat_matanim_text(f, p_mat); lo_chunk_save_mat_textmatrix(f, p_mat); lo_chunk_save_mat_texgen_param(f, p_mat); lo_chunk_save_mat_blend(f, p_mat); lo_chunk_save_mat_env_spec(f, p_mat); lo_chunk_save_mat_smat_pos(f, p_mat); // prvni textura lo_chunk_save_mat_text_blend_ext(f, p_mat, 0); lo_chunk_save_mat_text_flag(f, p_mat, 0, CHUNK_TEXT_FLAG_1); lo_chunk_save_mat_text(f, p_mat, 0, CHUNK_TEXT_1); // druha textura lo_chunk_save_mat_text_blend_ext(f, p_mat, 1); lo_chunk_save_mat_text_flag(f, p_mat, 1, CHUNK_TEXT_FLAG_2); lo_chunk_save_mat_text(f, p_mat, 1, CHUNK_TEXT_2); // treti textura lo_chunk_save_mat_text_blend_ext(f, p_mat, 2); lo_chunk_save_mat_text_flag(f, p_mat, 2, CHUNK_TEXT_FLAG_3); lo_chunk_save_mat_text(f, p_mat, 2, CHUNK_TEXT_3); // ctvrta textura lo_chunk_save_mat_text_blend_ext(f, p_mat, 3); lo_chunk_save_mat_text_flag(f, p_mat, 3, CHUNK_TEXT_FLAG_4); lo_chunk_save_mat_text(f, p_mat, 3, CHUNK_TEXT_4); return (TRUE); } /* ********************************************************************* Ukladani animaci */ int lo_chunk_save_keyframe_root(FFILE f, HIERARCHY_ROOT * p_root) { OUT_CHUNK ch; if (p_root) { ch.typ = CHUNK_KEYFRAME_ROT2; ch.velikost = sizeof(ch) + sizeof(HIERARCHY_ROOT); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_root, sizeof(*p_root), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_keyframe_node(FFILE f, HIERARCHY_TRACK_INFO * p_node) { char jmeno[200]; char otec[200]; OUT_CHUNK ch; if (p_node) { strcpy(jmeno, ((EDIT_OBJEKT *) (p_node->p_obj))->jmeno); strcpy(otec, p_node->p_otec ? ((EDIT_OBJEKT *) (p_node->p_otec-> p_obj))->jmeno : ROOT_NODE_JMENO); ch.typ = CHUNK_KEYFRAME_NODE; ch.velikost = sizeof(ch) + sizeof(HIERARCHY_TRACK_INFO) + strlen(jmeno) + 1 + strlen(otec) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(jmeno, sizeof(char), strlen(jmeno) + 1, f); ffwrite(otec, sizeof(char), strlen(otec) + 1, f); ffwrite(p_node, sizeof(*p_node), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_keyframe_node_pos(FFILE f, HIERARCHY_TRACK_INFO * p_node) { OUT_CHUNK ch; if (p_node) { ch.typ = CHUNK_KEYFRAME_POS; ch.velikost = sizeof(ch) + sizeof(p_node->p_pos[0]) * p_node->pos_keys + sizeof(p_node->p_pkeys[0]) * p_node->pos_keys; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_node->p_pos, sizeof(p_node->p_pos[0]), p_node->pos_keys, f); ffwrite(p_node->p_pkeys, sizeof(p_node->p_pkeys[0]), p_node->pos_keys, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_keyframe_node_rot(FFILE f, HIERARCHY_TRACK_INFO * p_node) { OUT_CHUNK ch; if (p_node) { ch.typ = CHUNK_KEYFRAME_ROT; ch.velikost = sizeof(ch) + sizeof(p_node->p_at[0]) * p_node->rot_keys + sizeof(p_node->p_rkeys[0]) * p_node->rot_keys; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_node->p_at, sizeof(p_node->p_at[0]), p_node->rot_keys, f); ffwrite(p_node->p_rkeys, sizeof(p_node->p_rkeys[0]), p_node->rot_keys, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_keyframe_node_scale(FFILE f, HIERARCHY_TRACK_INFO * p_node) { OUT_CHUNK ch; if (p_node) { ch.typ = CHUNK_KEYFRAME_SCS; ch.velikost = sizeof(ch) + sizeof(p_node->p_scale[0]) * p_node->scs_keys + sizeof(p_node->p_skeys[0]) * p_node->scs_keys; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_node->p_scale, sizeof(p_node->p_scale[0]), p_node->scs_keys, f); ffwrite(p_node->p_skeys, sizeof(p_node->p_skeys[0]), p_node->scs_keys, f); return (TRUE); } else return (FALSE); } /* Ulozi root vcetne vsech decek */ int lo_chunk_save_keyframe_child(FFILE f, HIERARCHY_TRACK_INFO * p_node) { int i; lo_chunk_save_keyframe_node(f, p_node); lo_chunk_save_keyframe_node_pos(f, p_node); lo_chunk_save_keyframe_node_rot(f, p_node); lo_chunk_save_keyframe_node_scale(f, p_node); for (i = 0; i < p_node->childnum; i++) lo_chunk_save_keyframe_child(f, p_node->p_child[i]); return (TRUE); } int lo_chunk_save_keyframe(FFILE f, HIERARCHY_ROOT * p_root) { int i; lo_chunk_save_keyframe_root(f, p_root); for (i = 0; i < p_root->childnum; i++) { lo_chunk_save_keyframe_child(f, p_root->p_child[i]); } return (TRUE); } /************************************************************************ Ulozeni sim-animaci #define CHUNK_SIM_ROOT 2020 // hlavicka key-framove animace #define CHUNK_SIM_NODE 2021 // vetev animace - pro jeden objekt */ /* typedef struct _HIERARCHY_SIM { float delka; // delka casu animace (fps) byte stav; // 0 = stop, 1 = run int flag; // flagy animace (GL_LOOP,GL_REMOVE) dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int keynum; // pocet klicu char jmeno[MAX_JMENO]; // jmeno animace int childnum; // pocet detskych traku SIMPLE_TRACK_INFO *p_child; } HIERARCHY_SIM; */ int lo_chunk_save_sim_root(FFILE f, HIERARCHY_SIM * p_sim) { OUT_CHUNK ch; if (p_sim) { ch.typ = CHUNK_SIM_ROOT; ch.velikost = sizeof(ch) + sizeof(p_sim->flag) + sizeof(p_sim->keynum) + sizeof(p_sim->jmeno[0]) * MAX_JMENO + sizeof(p_sim->childnum); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_sim->flag, sizeof(p_sim->flag), 1, f); ffwrite(&p_sim->keynum, sizeof(p_sim->keynum), 1, f); ffwrite(&p_sim->jmeno, sizeof(p_sim->jmeno[0]), MAX_JMENO, f); ffwrite(&p_sim->childnum, sizeof(p_sim->childnum), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_sim_node_ext_all_matrix(FFILE f, SIMPLE_TRACK_INFO * p_sim) { if (p_sim && p_sim->p_all_matrix) { ffwrite(p_sim->p_all_matrix, sizeof(p_sim->p_all_matrix[0]), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_save_sim_node_ext(FFILE f, SIMPLE_TRACK_INFO * p_sim) { OUT_CHUNK ch; int klicu, i; if (p_sim) { ch.typ = p_sim->p_all_matrix ? CHUNK_SIM_NODE_EXT2 : CHUNK_SIM_NODE_EXT; ch.velikost = sizeof(ch) + sizeof(p_sim->Objekt_ID) + sizeof(p_sim->flag) + sizeof(p_sim->keynum) + sizeof(p_sim->pivot) + sizeof(p_sim->pivot3ds) + sizeof(p_sim->childnum) + sizeof(klicu) * 3 + (p_sim->p_pos ? sizeof(p_sim->p_pos[0]) * p_sim->keynum : 0) + (p_sim->p_scale ? sizeof(p_sim->p_scale[0]) * p_sim->keynum : 0) + (p_sim->p_at ? sizeof(p_sim->p_at[0]) * p_sim->keynum : 0) + (p_sim->p_norm ? sizeof(p_sim->p_norm[0]) * p_sim->keynum : 0) + (p_sim->p_all_matrix ? sizeof(p_sim->p_all_matrix[0]) : 0); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_sim->Objekt_ID, sizeof(p_sim->Objekt_ID), 1, f); ffwrite(&p_sim->flag, sizeof(p_sim->flag), 1, f); ffwrite(&p_sim->keynum, sizeof(p_sim->keynum), 1, f); ffwrite(&p_sim->pivot, sizeof(p_sim->pivot), 1, f); ffwrite(&p_sim->pivot3ds, sizeof(p_sim->pivot3ds), 1, f); ffwrite(&p_sim->childnum, sizeof(p_sim->childnum), 1, f); klicu = p_sim->p_pos ? p_sim->keynum : 0; ffwrite(&klicu, sizeof(klicu), 1, f); if (klicu) ffwrite(p_sim->p_pos, sizeof(p_sim->p_pos[0]), p_sim->keynum, f); klicu = p_sim->p_scale ? p_sim->keynum : 0; ffwrite(&klicu, sizeof(klicu), 1, f); if (klicu) ffwrite(p_sim->p_scale, sizeof(p_sim->p_scale[0]), p_sim->keynum, f); klicu = p_sim->p_at ? p_sim->keynum : 0; ffwrite(&klicu, sizeof(klicu), 1, f); if (klicu) ffwrite(p_sim->p_at, sizeof(p_sim->p_at[0]), p_sim->keynum, f); klicu = p_sim->p_norm ? p_sim->keynum : 0; ffwrite(&klicu, sizeof(klicu), 1, f); if (klicu) ffwrite(p_sim->p_norm, sizeof(p_sim->p_norm[0]), p_sim->keynum, f); if (p_sim->p_all_matrix) lo_chunk_save_sim_node_ext_all_matrix(f, p_sim); for (i = 0; i < p_sim->childnum; i++) lo_chunk_save_sim_node_ext(f, p_sim->p_child + i); return (TRUE); } else return (FALSE); } /* Ulozi koren sim animace */ int lo_chunk_save_sim(FFILE f, HIERARCHY_SIM * p_sim) { int i; lo_chunk_save_sim_root(f, p_sim); for (i = 0; i < p_sim->childnum; i++) { lo_chunk_save_sim_node_ext(f, p_sim->p_child + i); } return (TRUE); } /************************************************************************ Ukladani meshu do souboru */ int lo_chunk_save_kont_jmeno(FFILE f, EDIT_KONTEJNER * p_kont, int pozice) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_JMENO; ch.velikost = sizeof(ch) + sizeof(p_kont->prvek) + strlen(p_kont->jmeno) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&pozice, sizeof(int), 1, f); ffwrite(p_kont->jmeno, sizeof(char), strlen(p_kont->jmeno) + 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_low_jmeno(FFILE f, EDIT_KONTEJNER * p_kont) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_LOW_JMENO; ch.velikost = sizeof(ch) + strlen(p_kont->jmeno) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_kont->jmeno, sizeof(char), strlen(p_kont->jmeno) + 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_low_id(FFILE f, EDIT_KONTEJNER * p_kont) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_LOW_ID; ch.velikost = sizeof(ch) + sizeof(p_kont->low_id); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kont->low_id, sizeof(p_kont->low_id), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_id(FFILE f, int id) { OUT_CHUNK ch; ch.typ = CHUNK_KONT_ID; ch.velikost = sizeof(ch) + sizeof(id); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&id, sizeof(id), 1, f); return (TRUE); } int lo_chunk_save_kont_flag(FFILE f, EDIT_KONTEJNER * p_kont) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_FLAG; ch.velikost = sizeof(ch) + sizeof(p_kont->kflag); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kont->kflag, sizeof(p_kont->kflag), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_flag_ext(FFILE f, EDIT_KONTEJNER * p_kont) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_FLAG_EXT; ch.velikost = sizeof(ch) + sizeof(p_kont->m1flag) + sizeof(p_kont->m2flag); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kont->m1flag, sizeof(p_kont->m1flag), 1, f); ffwrite(&p_kont->m2flag, sizeof(p_kont->m2flag), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_flag_ext_2(FFILE f, EDIT_KONTEJNER * p_kont) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_FLAG_EXT_2; ch.velikost = sizeof(ch) + sizeof(p_kont->k2flag); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kont->k2flag, sizeof(p_kont->k2flag), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_obb(FFILE f, EDIT_KONTEJNER * p_kont) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_OBB; ch.velikost = sizeof(ch) + sizeof(p_kont->obb); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_kont->obb, sizeof(p_kont->obb), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_wmatrix(FFILE f, EDIT_KONTEJNER * p_kont, GLMATRIX * p_matrix) { OUT_CHUNK ch; if (p_kont) { ch.typ = CHUNK_KONT_WMATRIX; ch.velikost = sizeof(ch) + sizeof(*p_matrix); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_matrix, sizeof(*p_matrix), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_kont_mpmatrix(FFILE f, EDIT_KONTEJNER * p_kont, GLMATRIX * p_matrix) { OUT_CHUNK ch; if (p_kont && p_kont->kflag & KONT_MPMATRIX) { ch.typ = CHUNK_KONT_MPMATRIX; ch.velikost = sizeof(ch) + sizeof(*p_matrix); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_matrix, sizeof(*p_matrix), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_jmeno(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; if (p_obj) { ch.typ = CHUNK_OBJ_JMENO; ch.velikost = sizeof(ch) + strlen(p_obj->jmeno) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_obj->jmeno, sizeof(char), strlen(p_obj->jmeno) + 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_ID(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; if (p_obj) { ch.typ = CHUNK_OBJ_ID; ch.velikost = sizeof(ch) + sizeof(p_obj->Objekt_ID); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_obj->Objekt_ID, sizeof(p_obj->Objekt_ID), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_pivot(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; if (p_obj) { ch.typ = CHUNK_OBJ_PIVOT; ch.velikost = sizeof(ch) + sizeof(p_obj->pivot); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_obj->pivot, sizeof(p_obj->pivot), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_obb(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; if (p_obj) { ch.typ = CHUNK_OBJ_OBB; ch.velikost = sizeof(ch) + sizeof(p_obj->obb); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_obj->obb, sizeof(p_obj->obb), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_material(FFILE f, EDIT_MATERIAL * p_mat) { OUT_CHUNK ch; if (p_mat) { ch.typ = CHUNK_OBJ_MATERIAL; ch.velikost = sizeof(ch) + strlen(p_mat->jmeno) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_mat->jmeno, sizeof(char), strlen(p_mat->jmeno) + 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_matrix(FFILE f, GLMATRIX * p_mat) { OUT_CHUNK ch; if (p_mat) { ch.typ = CHUNK_OBJ_MATRIX_KEY; ch.velikost = sizeof(ch) + sizeof(p_mat[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_mat, sizeof(p_mat[0]), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_vertex(FFILE f, EDIT_OBJEKT * p_obj, GLMATRIX * p_transf) { OUT_CHUNK ch; dword pocet, i; float v[3]; if (p_obj) { ch.typ = CHUNK_OBJ_VERTEXY; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 3 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; ffwrite(&pocet, sizeof(pocet), 1, f); for (i = 0; i < pocet; i++) { v[0] = p_obj->p_vertex[i].x; v[1] = p_obj->p_vertex[i].y; v[2] = p_obj->p_vertex[i].z; if (p_transf) transformuj_bod_matici(v, v + 1, v + 2, p_transf); if (!ffwrite(&v, sizeof(v), 1, f)) chyba("Zapis!"); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_face(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; int pocet; if (p_obj) { ch.typ = CHUNK_OBJ_FACY; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(word) * p_obj->facenum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->facenum; if (!ffwrite(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); if (!ffwrite(p_obj->p_face, sizeof(p_obj->p_face[0]), pocet, f)) chyba("Zapis"); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_face_ext(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; if (p_obj->p_opt) { ch.typ = CHUNK_OBJ_FACY_OPT; ch.velikost = sizeof(ch) + sizeof(p_obj->optnum) + sizeof(p_obj->p_opt[0]) * p_obj->optnum; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_obj->optnum, sizeof(p_obj->optnum), 1, f); ffwrite(p_obj->p_opt, sizeof(p_obj->p_opt[0]), p_obj->optnum, f); return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_mapy_1(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; float m[2]; dword pocet, i; if (p_obj) { ch.typ = CHUNK_OBJ_MAPY_1; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 2 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; if (!ffwrite(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); for (i = 0; i < pocet; i++) { m[0] = p_obj->p_vertex[i].tu1; m[1] = p_obj->p_vertex[i].tv1; ffwrite(&m, sizeof(m), 1, f); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_mapy_2(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; float m[2]; dword pocet, i; if (p_obj) { ch.typ = CHUNK_OBJ_MAPY_2; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 2 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; if (!ffwrite(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); for (i = 0; i < pocet; i++) { m[0] = p_obj->p_vertex[i].tu2; m[1] = p_obj->p_vertex[i].tv2; ffwrite(&m, sizeof(m), 1, f); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_mapy_3(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; float m[2]; dword pocet, i; if (p_obj) { ch.typ = CHUNK_OBJ_MAPY_3; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 2 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; if (!ffwrite(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); for (i = 0; i < pocet; i++) { m[0] = p_obj->p_vertex[i].tu3; m[1] = p_obj->p_vertex[i].tv3; ffwrite(&m, sizeof(m), 1, f); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_mapy_4(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; float m[2]; dword pocet, i; if (p_obj) { ch.typ = CHUNK_OBJ_MAPY_4; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 2 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; if (!ffwrite(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); for (i = 0; i < pocet; i++) { m[0] = p_obj->p_vertex[i].tu4; m[1] = p_obj->p_vertex[i].tv4; ffwrite(&m, sizeof(m), 1, f); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_barvy(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; dword pocet, i; float v[4] = { 0, 0, 0, 0 }; if (p_obj) { ch.typ = CHUNK_OBJ_BARVY; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 4 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; ffwrite(&pocet, sizeof(pocet), 1, f); for (i = 0; i < pocet; i++) { v[0] = p_obj->p_vertex[i].dr; v[1] = p_obj->p_vertex[i].dg; v[2] = p_obj->p_vertex[i].db; v[3] = 1.0f; if (!ffwrite(&v, sizeof(float), 4, f)) chyba("Zapis!"); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_normal(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; dword pocet, i; float v[3] = { 0, 0, 0 }; if (p_obj) { ch.typ = CHUNK_OBJ_NORMAL; ch.velikost = sizeof(ch) + sizeof(pocet) + sizeof(float) * 3 * p_obj->vertexnum; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; ffwrite(&pocet, sizeof(pocet), 1, f); for (i = 0; i < pocet; i++) { v[0] = p_obj->p_vertex[i].nx; v[1] = p_obj->p_vertex[i].ny; v[2] = p_obj->p_vertex[i].nz; if (!ffwrite(&v, sizeof(float), 3, f)) chyba("Zapis!"); } return (TRUE); } else return (FALSE); } /* Ulozi rozsirene barvy */ int lo_chunk_save_obj_barvy_ext(FFILE f, EDIT_OBJEKT * p_obj) { OUT_CHUNK ch; dword pocet, i; float v[4] = { 0, 0, 0, 0 }; if (p_obj) { ch.typ = CHUNK_OBJ_BARVY_EXT; ch.velikost = sizeof(ch) + sizeof(dword) + sizeof(float) * 4 * p_obj->vertexnum * 4; ffwrite(&ch, sizeof(ch), 1, f); pocet = p_obj->vertexnum; ffwrite(&pocet, sizeof(pocet), 1, f); for (i = 0; i < pocet; i++) { // Uloz vsechny difusni barvy v[0] = p_obj->p_vertex[i].dr; v[1] = p_obj->p_vertex[i].dg; v[2] = p_obj->p_vertex[i].db; v[3] = p_obj->p_vertex[i].da; if (!ffwrite(&v, sizeof(float), 4, f)) chyba("Zapis!"); v[0] = p_obj->p_vertex[i].mdr; v[1] = p_obj->p_vertex[i].mdg; v[2] = p_obj->p_vertex[i].mdb; v[3] = p_obj->p_vertex[i].mda; if (!ffwrite(&v, sizeof(float), 4, f)) chyba("Zapis!"); // Uloz vsechny spekularni barvy v[0] = p_obj->p_vertex[i].sr; v[1] = p_obj->p_vertex[i].sg; v[2] = p_obj->p_vertex[i].sb; v[3] = 1.0f; //p_obj->p_vertex[i].sa; if (!ffwrite(&v, sizeof(float), 4, f)) chyba("Zapis!"); v[0] = p_obj->p_vertex[i].msr; v[1] = p_obj->p_vertex[i].msg; v[2] = p_obj->p_vertex[i].msb; v[3] = 1.0f; //p_obj->p_vertex[i].msa; if (!ffwrite(&v, sizeof(float), 4, f)) chyba("Zapis!"); } return (TRUE); } else return (FALSE); } int lo_chunk_save_obj_joint_spline(FFILE f, JOINT_KEYS * p_keys) { OUT_CHUNK ch; if (!p_keys) return (FALSE); if (p_keys->p_pos) { ch.typ = CHUNK_OBJ_JNT_KEYPOS; ch.velikost = sizeof(ch) + sizeof(p_keys->pos_keys) + p_keys->pos_keys * sizeof(p_keys->p_pos[0]) + p_keys->pos_keys * sizeof(p_keys->p_pkeys[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_keys->pos_keys, sizeof(p_keys->pos_keys), 1, f); ffwrite(p_keys->p_pos, sizeof(p_keys->p_pos[0]), p_keys->pos_keys, f); ffwrite(p_keys->p_pkeys, sizeof(p_keys->p_pkeys[0]), p_keys->pos_keys, f); } if (p_keys->p_rot) { ch.typ = CHUNK_OBJ_JNT_KEYROT; ch.velikost = sizeof(ch) + sizeof(p_keys->rot_keys) + p_keys->rot_keys * sizeof(p_keys->p_rot[0]) + p_keys->rot_keys * sizeof(p_keys->p_rkeys[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_keys->rot_keys, sizeof(p_keys->rot_keys), 1, f); ffwrite(p_keys->p_rot, sizeof(p_keys->p_rot[0]), p_keys->rot_keys, f); ffwrite(p_keys->p_rkeys, sizeof(p_keys->p_rkeys[0]), p_keys->rot_keys, f); } if (p_keys->p_scale) { ch.typ = CHUNK_OBJ_JNT_KEYSCS; ch.velikost = sizeof(ch) + sizeof(p_keys->scs_keys) + p_keys->scs_keys * sizeof(p_keys->p_scale[0]) + p_keys->scs_keys * sizeof(p_keys->p_skeys[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_keys->scs_keys, sizeof(p_keys->scs_keys), 1, f); ffwrite(p_keys->p_scale, sizeof(p_keys->p_scale[0]), p_keys->scs_keys, f); ffwrite(p_keys->p_skeys, sizeof(p_keys->p_skeys[0]), p_keys->scs_keys, f); } return (TRUE); } #define ROOT_ID 0 int lo_chunk_save_obj_joint(FFILE f, JOINT * p_joint, int id_prev) { OUT_CHUNK ch; if (!p_joint) return (FALSE); ch.typ = CHUNK_OBJ_JNT_ID; ch.velikost = sizeof(ch) + 2 * sizeof(p_joint->joint_ID); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->joint_ID, sizeof(p_joint->joint_ID), 1, f); ffwrite(&id_prev, sizeof(id_prev), 1, f); ch.typ = CHUNK_OBJ_JNT_PIVOT; ch.velikost = sizeof(ch) + sizeof(p_joint->pivot); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->pivot, sizeof(p_joint->pivot), 1, f); if (p_joint->p_vertexlist) { ch.typ = CHUNK_OBJ_JNT_VERT; ch.velikost = sizeof(ch) + sizeof(p_joint->vertexnum) + p_joint->vertexnum * sizeof(p_joint->p_vertexlist[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->vertexnum, sizeof(p_joint->vertexnum), 1, f); ffwrite(p_joint->p_vertexlist, sizeof(p_joint->p_vertexlist[0]), p_joint->vertexnum, f); } ch.typ = CHUNK_OBJ_JNT_FLAG; ch.velikost = sizeof(ch) + sizeof(p_joint->flag); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->flag, sizeof(p_joint->flag), 1, f); if (p_joint->p_pos) { ch.typ = CHUNK_OBJ_JNT_POS; ch.velikost = sizeof(ch) + sizeof(p_joint->pos_keys) + p_joint->pos_keys * sizeof(p_joint->p_pos[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->pos_keys, sizeof(p_joint->pos_keys), 1, f); ffwrite(p_joint->p_pos, sizeof(p_joint->p_pos[0]), p_joint->pos_keys, f); } if (p_joint->p_rot) { ch.typ = CHUNK_OBJ_JNT_ROT; ch.velikost = sizeof(ch) + sizeof(p_joint->rot_keys) + p_joint->rot_keys * sizeof(p_joint->p_rot[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->rot_keys, sizeof(p_joint->rot_keys), 1, f); ffwrite(p_joint->p_rot, sizeof(p_joint->p_rot[0]), p_joint->rot_keys, f); } if (p_joint->p_scs) { ch.typ = CHUNK_OBJ_JNT_SCS; ch.velikost = sizeof(ch) + sizeof(p_joint->scs_keys) + p_joint->scs_keys * sizeof(p_joint->p_scs[0]); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_joint->scs_keys, sizeof(p_joint->scs_keys), 1, f); ffwrite(p_joint->p_scs, sizeof(p_joint->p_scs[0]), p_joint->scs_keys, f); } if (p_joint->p_keys) lo_chunk_save_obj_joint_spline(f, p_joint->p_keys); lo_chunk_save_obj_joint(f, p_joint->p_next, p_joint->joint_ID); lo_chunk_save_obj_joint(f, p_joint->p_child, p_joint->joint_ID); return (TRUE); } int lo_chunk_save_obj_joint_animaci(FFILE f, JOINT_ANIMACE * p_jani) { OUT_CHUNK ch; ch.typ = CHUNK_OBJ_JA; ch.velikost = sizeof(ch) + strlen(p_jani->jmeno) + 1; ffwrite(&ch, sizeof(ch), 1, f); ffwrite(p_jani->jmeno, sizeof(char), strlen(p_jani->jmeno) + 1, f); ch.typ = CHUNK_OBJ_JA_FRAMU; ch.velikost = sizeof(ch) + sizeof(p_jani->framenum); ffwrite(&ch, sizeof(ch), 1, f); ffwrite(&p_jani->framenum, sizeof(p_jani->framenum), 1, f); lo_chunk_save_obj_joint(f, p_jani->p_child, ROOT_ID); return (TRUE); } void lo_kost_ocisluj_rec(JOINT * p_joint, int *p_cislo) { if (p_joint->p_child) lo_kost_ocisluj_rec(p_joint->p_child, p_cislo); if (p_joint->p_next) lo_kost_ocisluj_rec(p_joint->p_next, p_cislo); p_joint->joint_ID = (*p_cislo)++; } int lo_chunk_save_obj_joint_animace(FFILE f, EDIT_OBJEKT * p_obj) { JOINT_ANIMACE *p_akt = p_obj->p_joit_animace; int ID; while (p_akt) { ID = 1; lo_kost_ocisluj_rec(p_akt->p_child, &ID); lo_chunk_save_obj_joint_animaci(f, p_akt); p_akt = p_akt->p_next; } return (TRUE); } int lo_chunk_save_kont_mesh(FFILE f, EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_mat, int max_mat, GLMATRIX * p_world) { int i, j; if (p_kont) { for (i = 0, j = 0; i < p_kont->max_objektu; i++) { if (!p_kont->p_obj[i]) continue; j++; /* Zapis jmeno objektu */ lo_chunk_save_obj_jmeno(f, p_kont->p_obj[i]); lo_chunk_save_obj_ID(f, p_kont->p_obj[i]); lo_chunk_save_obj_pivot(f, p_kont->p_obj[i]); lo_chunk_save_obj_obb(f, p_kont->p_obj[i]); /* Uloz jmeno materialu */ assert(p_kont->p_obj[i]->material < max_mat); lo_chunk_save_obj_material(f, p_mat[p_kont->p_obj[i]->material]); /* Uloz jeho vertexy */ lo_chunk_save_obj_vertex(f, p_kont->p_obj[i], p_world); /* Uloz jeho normaly */ lo_chunk_save_obj_normal(f, p_kont->p_obj[i]); /* Uloz facelist */ lo_chunk_save_obj_face(f, p_kont->p_obj[i]); /* Uloz jeho normaly */ lo_chunk_save_obj_face_ext(f, p_kont->p_obj[i]); /* Uloz maplisty */ lo_chunk_save_obj_mapy_1(f, p_kont->p_obj[i]); lo_chunk_save_obj_mapy_2(f, p_kont->p_obj[i]); lo_chunk_save_obj_mapy_3(f, p_kont->p_obj[i]); lo_chunk_save_obj_mapy_4(f, p_kont->p_obj[i]); /* Uloz rozsirene barvy objektu */ lo_chunk_save_obj_barvy_ext(f, p_kont->p_obj[i]); /* Lokalni matice */ if (p_kont->kflag & KONT_KEYFRAME) lo_chunk_save_obj_matrix(f, &p_kont->p_obj[i]->m); /* Single - mesh animace */ if (p_kont->p_obj[i]->p_joit_animace) { lo_chunk_save_obj_joint_animace(f, p_kont->p_obj[i]); } } return (j); } else return (FALSE); } int lo_chunk_save_kontejner(FFILE f, EDIT_KONTEJNER * p_kont, EDIT_MATERIAL ** p_mat, int max_mat, int low, int kont, int kont_id, int transf_stat) { int i; /* Oflagovani podle materialu */ updatuj_kontejner_flag(p_kont, p_mat); /* Optimalizace jmen objektu */ lo_kontejner_jedinecne_jmena(p_kont, FALSE); p_kont->kontejner_ID = kont_id; if (low) { lo_chunk_save_kont_low_jmeno(f, p_kont); } else { lo_chunk_save_kont_jmeno(f, p_kont, kont); } lo_chunk_save_kont_low_id(f, p_kont); lo_chunk_save_kont_id(f, p_kont->kontejner_ID); lo_chunk_save_kont_flag(f, p_kont); lo_chunk_save_kont_flag_ext(f, p_kont); lo_chunk_save_kont_flag_ext_2(f, p_kont); lo_chunk_save_kont_obb(f, p_kont); /* Podle transformacniho flagu transf_stat */ transf_stat = (p_kont->kflag & KONT_STATIC && transf_stat); if (!transf_stat) { lo_chunk_save_kont_wmatrix(f, p_kont, &p_kont->world); lo_chunk_save_kont_mpmatrix(f, p_kont, &p_kont->mpmatrix); } else { GLMATRIX m; init_matrix(&m); lo_chunk_save_kont_wmatrix(f, p_kont, &m); lo_chunk_save_kont_mpmatrix(f, p_kont, &m); } i = lo_chunk_save_kont_mesh(f, p_kont, p_mat, max_mat, transf_stat ? kont_world_matrix(p_kont) : NULL); /* Uloz key-framy */ if (p_kont->kflag & KONT_KEYFRAME) { for (i = 0; i < KONT_MAX_ANIM; i++) { if (p_kont->sim[i].keynum) { key_sim_root_vloz_pivoty_do_animace(p_kont, p_kont->sim + i); lo_chunk_save_sim(f, p_kont->sim + i); } } } /* Uloz svetla tohoto kontejneru */ lo_chunk_save_static_light_mesh(f, p_kont->p_slight, p_mat); lo_chunk_save_dyn_light_mesh(f, p_kont->p_dlight); lo_chunk_save_extra_light_mesh(f, p_kont->p_edlight); /* Uloz mlho-kostky */ lo_chunk_save_mlhokostku(f, p_kont->p_mlha, TRUE); return (i); } int lo_uloz_materialy_chunk_kont(FFILE f, EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER * p_kont, int kontrola) { int i, j; /* Uloz pouzite materialy */ for (i = 0; i < max_mat; i++) { if (p_mat[i]) { for (j = 0; j < p_kont->max_objektu; j++) { if (p_kont->p_obj[j] && p_kont->p_obj[j]->material == i) { if (!kontrola || !(p_mat[i]->flag & (MAT_POUZITY | MAT_SYSTEM))) lo_uloz_material_chunk(f, p_mat[i]); break; } } } } return (TRUE); } int lo_uloz_materialy_chunk_pouzite(FFILE f, EDIT_MATERIAL ** p_mat, int max_mat) { int i; /* Uloz pouzite materialy */ for (i = 0; i < max_mat; i++) { if (p_mat[i] && p_mat[i]->flag & (MAT_POUZITY | MAT_SYSTEM)) { lo_uloz_material_chunk(f, p_mat[i]); } } return (TRUE); } /* Ulozi kontejner */ int lo_uloz_kontejner_chunk(FFILE f, EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER * p_kont, int low) { /* Uloz materialy */ lo_uloz_materialy_chunk_kont(f, p_mat, max_mat, p_kont, FALSE); /* Uloz kontejner */ lo_chunk_save_kontejner(f, p_kont, p_mat, max_mat, low, K_CHYBA, K_CHYBA, FALSE); /* Uloz mlho-kostky */ lo_chunk_save_mlhokostku(f, p_kont->p_mlha, TRUE); return (TRUE); } /* Ulozi vsechny veci do .prj */ int lo_uloz_projekt(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER ** p_kontlist, int kontnum, char *p_jmeno, STATIC_LIGHT * p_light, int lightnum, ZDRCADLO_DESC * p_zrcadlo, LENS_FLARE * p_flarr, int flaremax, dword ambient, MLZNA_KOSTKA * p_mlha, DYN_LIGHT * p_ddlight, int ddlightnum, EXTRA_DYN_LIGHT * p_eelight, int eelightnum, LEVEL_ENVIRONMENT * p_env, NASTAVENI_KAMER * p_kam, LEVEL_KONFIG * p_lc, int level, int transf_static) { EDIT_KONTEJNER *p_kont; FFILE f; int i, j, kID; /* Preved scenu na jedinecna jmena */ //lo_kontlist_jedinecne_jmena(p_kontlist,kontnum); if ((f = ffopen(p_jmeno, "wb")) == NULL) { return (FALSE); } /* Ulozim ambientni svetlo sceny */ lo_chunk_save_ambient(f, ambient); /* Ulozeni konfigurace levelu - pokud je */ if (p_lc) { lo_chunk_save_lc_ext(f, p_lc); } /* Ulozeni pouzitych materialu */ lo_uloz_materialy_chunk_pouzite(f, p_mat, max_mat); /* Uloz kontejnery */ kID = K_CHYBA; for (j = 0; j < kontnum; j++) { if ((p_kont = p_kontlist[j])) { if (level) kID++; lo_uloz_materialy_chunk_kont(f, p_mat, max_mat, p_kont, TRUE); lo_chunk_save_kontejner(f, p_kont, p_mat, max_mat, FALSE, K_CHYBA, kID, transf_static); p_kont = p_kont->p_next; while (p_kont) { lo_uloz_materialy_chunk_kont(f, p_mat, max_mat, p_kont, TRUE); lo_chunk_save_kontejner(f, p_kont, p_mat, max_mat, TRUE, K_CHYBA, kID, transf_static); p_kont = p_kont->p_next; } } } /* Staticka svetla sceny */ if (p_light) { for (i = 0; i < lightnum; i++) { if (p_light[i].akt && !(p_light[i].flag2 & SL2_MESH)) lo_chunk_save_static_light(f, p_light + i, p_mat); } } /* Uloz dynamicka svetla sceny */ if (p_ddlight) { for (i = 0; i < ddlightnum; i++) if (p_ddlight[i].akt && !(p_ddlight[i].flag & SDL_MESH)) lo_chunk_save_dyn_light(f, p_ddlight + i); } /* Extra a efektova svetla sceny */ if (p_eelight) { for (i = 0; i < eelightnum; i++) if (p_eelight[i].akt && !(p_eelight[i].flag & EDL_MESH)) lo_chunk_save_extra_light(f, p_eelight + i); } /* Zrcadlo */ if (p_zrcadlo) { lo_chunk_preved_zrcadlo(p_kontlist, kontnum, p_zrcadlo); lo_chunk_save_zrcadlo(f, p_zrcadlo); } /* Flare efekty + jejich materialy (pouze ze sceny) */ for (i = 0; i < flaremax; i++) { if (p_flarr[i].akt && !p_flarr[i].p_svetlo) { lo_uloz_material_chunk(f, p_flarr[i].p_mat); lo_chunk_save_flare(f, p_flarr + i, p_mat, FALSE); if (p_flarr[i].p_sloz) { for (j = 0; j < SLOZ_FLARE; j++) { if (p_flarr[i].p_sloz[j].vzdal > 0.0f) lo_uloz_material_chunk(f, p_flarr[i].p_sloz[j].p_mat); } lo_chunk_save_flare_slozeny(f, p_flarr + i, p_mat); } } } /* Mlho-kostku */ lo_chunk_save_mlhokostku(f, p_mlha, FALSE); /* Ulozeni environmentu */ if (p_env) { lo_chunk_save_environment(f, p_env); } /* Ulozeni nastaveni kamer */ if (p_kam) { lo_chunk_save_kamset(f, p_kam); lo_chunk_save_kamset_2(f, p_kam); } ffclose(f); return (j); } /************************************************************************ Loading objektu/materialu pres chunk Globalni promenne pro loading */ /* Nabinduje se na p_cnf->p_mat */ static int matlistnum; // pocet nactenych materialu static EDIT_MATERIAL **p_matlist; // aktualni material static ANIM_MATERIAL *p_fanim; // aktualni frame animace static int textlistnum; // list textur static EDIT_TEXT *p_textlist; // list textur static EDIT_KONTEJNER **p_kontlist; // seznam kontejneru static int kontlistnum; // max pocet kontejneru static int kont_load; static EDIT_KONTEJNER *p_kont_old; // stary kontejner static EDIT_KONTEJNER *p_kont; // aktualni kontejner static EDIT_MATERIAL *p_mat; // aktualni material static EDIT_OBJEKT *p_obj; // aktualni objekt static HIERARCHY_SIM *p_sim; // aktivni loadovaci root static STATIC_LIGHT *p_lightlist; static STATIC_LIGHT *p_lightakt; // aktualni staticke svetlo static int lightlistnum; static STATIC_LIGHT *p_light_mesh; static ZDRCADLO_DESC *p_zrcadlolist; static int *p_zrcadloload; static LENS_FLARE *p_flarelist; // seznam flaru static LENS_FLARE *p_flare; // posledni nahrany flare static int flarelistnum; static MLZNA_KOSTKA *p_top_mlha; static dword *p_ambient; static DYN_LIGHT *p_dlist; // seznam dynamickych svetel static int dlistnum; static EXTRA_DYN_LIGHT *p_elist; // seznam extra svetel static int elistnum; static LEVEL_ENVIRONMENT *p_lenv; static NASTAVENI_KAMER *p_kamset; static LEVEL_KONFIG *p_lc; static JOINT *p_joint; static JOINT_ANIMACE *p_joint_animace; /* ********************************************************************** Loading environmentu */ int lo_chunk_load_environment(FFILE f, OUT_CHUNK * p_ch) { if (p_ch->typ == CHUNK_ENVIRONMENT) { if (p_lenv) { ffread(p_lenv, sizeof(p_lenv[0]), 1, f); } else { LEVEL_ENVIRONMENT env; ffread(&env, sizeof(env), 1, f); } return (TRUE); } else return (FALSE); } /* ********************************************************************** Loading kamsetu */ int lo_chunk_load_kamset(FFILE f, OUT_CHUNK * p_ch) { if (p_kamset && p_ch->typ == CHUNK_KAMSET) { ffread(&p_kamset->far_plane, sizeof(p_kamset->far_plane), 1, f); ffread(&p_kamset->fov, sizeof(p_kamset->fov), 1, f); ffread(&p_kamset->max_uhel, sizeof(p_kamset->max_uhel), 1, f); ffread(&p_kamset->min_uhel, sizeof(p_kamset->min_uhel), 1, f); ffread(&p_kamset->min_vzdal, sizeof(p_kamset->min_vzdal), 1, f); ffread(&p_kamset->max_vzdal, sizeof(p_kamset->max_vzdal), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kamset_2(FFILE f, OUT_CHUNK * p_ch) { if (p_kamset && p_ch->typ == CHUNK_KAMSET_2) { ffread(&p_kamset->max, sizeof(p_kamset->max), 1, f); ffread(&p_kamset->min, sizeof(p_kamset->min), 1, f); return (TRUE); } else return (FALSE); } /* ********************************************************************** Loading dynamickeho svetla */ int lo_chunk_load_dyn_light_anim(FFILE f, DYN_LIGHT_ANIM * p_an, int extra) { ffread(&p_an->pos_keys, sizeof(p_an->pos_keys), 1, f); if (p_an->pos_keys) { p_an->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_pkeys[0]) * p_an->pos_keys); ffread(p_an->p_pkeys, sizeof(p_an->p_pkeys[0]), p_an->pos_keys, f); p_an->p_pos = (BOD *) mmalloc(sizeof(p_an->p_pos[0]) * p_an->pos_keys); ffread(p_an->p_pos, sizeof(p_an->p_pos[0]), p_an->pos_keys, f); } else { p_an->p_pkeys = NULL; p_an->p_pos = NULL; } ffread(&p_an->trg_keys, sizeof(p_an->trg_keys), 1, f); if (p_an->trg_keys) { p_an->p_tkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_tkeys[0]) * p_an->trg_keys); ffread(p_an->p_tkeys, sizeof(p_an->p_tkeys[0]), p_an->trg_keys, f); p_an->p_trg = (BOD *) mmalloc(sizeof(p_an->p_trg[0]) * p_an->trg_keys); ffread(p_an->p_trg, sizeof(p_an->p_trg[0]), p_an->trg_keys, f); } else { p_an->p_tkeys = NULL; p_an->p_trg = NULL; } ffread(&p_an->dos_keys, sizeof(p_an->dos_keys), 1, f); if (p_an->dos_keys) { p_an->p_dskeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_dskeys[0]) * p_an->dos_keys); ffread(p_an->p_dskeys, sizeof(p_an->p_dskeys[0]), p_an->dos_keys, f); p_an->p_dosah = (BOD *) mmalloc(sizeof(p_an->p_dosah[0]) * p_an->dos_keys); ffread(p_an->p_dosah, sizeof(p_an->p_dosah[0]), p_an->dos_keys, f); } else { p_an->p_dskeys = NULL; p_an->p_dosah = NULL; } if (extra) { ffread(&p_an->alfa_keys, sizeof(p_an->alfa_keys), 1, f); p_an->diff_keys = 0; p_an->p_dfkeys = NULL; p_an->p_diff = NULL; if (p_an->alfa_keys) { int i; p_an->p_akeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_akeys[0]) * p_an->alfa_keys); ffread(p_an->p_akeys, sizeof(p_an->p_akeys[0]), p_an->alfa_keys, f); p_an->p_diff = (BARVA_RGBA *) mmalloc(sizeof(p_an->p_diff[0]) * p_an->alfa_keys); ffread(p_an->p_diff, sizeof(p_an->p_diff[0]), p_an->alfa_keys, f); p_an->p_alfa = (float *) mmalloc(sizeof(p_an->p_alfa[0]) * p_an->alfa_keys); for (i = 0; i < p_an->alfa_keys; i++) { p_an->p_alfa[i] = p_an->p_diff[i].a; } null_free((void **) &p_an->p_diff); } else { p_an->p_akeys = NULL; p_an->p_alfa = NULL; } } else { ffread(&p_an->diff_keys, sizeof(p_an->diff_keys), 1, f); p_an->alfa_keys = 0; p_an->p_akeys = NULL; p_an->p_alfa = NULL; if (p_an->diff_keys) { p_an->p_dfkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_dfkeys[0]) * p_an->diff_keys); ffread(p_an->p_dfkeys, sizeof(p_an->p_dfkeys[0]), p_an->diff_keys, f); p_an->p_diff = (BARVA_RGBA *) mmalloc(sizeof(p_an->p_diff[0]) * p_an->diff_keys); ffread(p_an->p_diff, sizeof(p_an->p_diff[0]), p_an->diff_keys, f); } else { p_an->p_dfkeys = NULL; p_an->p_diff = NULL; } } ffread(&p_an->spec_keys, sizeof(p_an->spec_keys), 1, f); if (p_an->spec_keys) { p_an->p_spkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_an->p_spkeys[0]) * p_an->spec_keys); ffread(p_an->p_spkeys, sizeof(p_an->p_spkeys[0]), p_an->spec_keys, f); p_an->p_spec = (BARVA_RGBA *) mmalloc(sizeof(p_an->p_spec[0]) * p_an->spec_keys); ffread(p_an->p_spec, sizeof(p_an->p_spec[0]), p_an->spec_keys, f); } else { p_an->p_spkeys = NULL; p_an->p_spec = NULL; } return (TRUE); } int lo_chunk_load_dyn_light(FFILE f, OUT_CHUNK * p_ch) { DYN_LIGHT *p_light; if (p_ch->typ == CHUNK_DYNAMIC_LIGHT && p_dlist) { p_light = lo_najdi_volne_dsvetlo_point(p_dlist, dlistnum); if (p_light) { ffread(&p_light->akt, sizeof(p_light->akt), 1, f); str_read(p_light->jmeno, f); ffread(&p_light->np, sizeof(p_light->np), 1, f); ffread(&p_light->dir, sizeof(p_light->dir), 1, f); ffread(&p_light->look_max, sizeof(p_light->look_max), 1, f); ffread(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffread(&p_light->min, sizeof(p_light->min), 1, f); ffread(&p_light->max, sizeof(p_light->max), 1, f); ffread(&p_light->theta, sizeof(p_light->theta), 1, f); ffread(&p_light->dr, sizeof(p_light->dr), 1, f); ffread(&p_light->dg, sizeof(p_light->dg), 1, f); ffread(&p_light->db, sizeof(p_light->db), 1, f); ffread(&p_light->sr, sizeof(p_light->sr), 1, f); ffread(&p_light->sg, sizeof(p_light->sg), 1, f); ffread(&p_light->sb, sizeof(p_light->sb), 1, f); ffread(&p_light->flag, sizeof(p_light->flag), 1, f); ffread(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffread(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffread(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); p_light->tp = p_light->np; if (p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an, FALSE); } return (TRUE); } else return (FALSE); } else return (FALSE); } int lo_chunk_load_dyn_light_mesh(FFILE f, OUT_CHUNK * p_ch) { DYN_LIGHT *p_light; if (p_kont && p_ch->typ == CHUNK_DYNAMIC_LIGHT_MESH) { p_light = (DYN_LIGHT *) mmalloc(sizeof(p_light[0])); ffread(&p_light->akt, sizeof(p_light->akt), 1, f); str_read(p_light->jmeno, f); ffread(&p_light->np, sizeof(p_light->np), 1, f); ffread(&p_light->dir, sizeof(p_light->dir), 1, f); ffread(&p_light->look_max, sizeof(p_light->look_max), 1, f); ffread(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffread(&p_light->min, sizeof(p_light->min), 1, f); ffread(&p_light->max, sizeof(p_light->max), 1, f); ffread(&p_light->theta, sizeof(p_light->theta), 1, f); ffread(&p_light->dr, sizeof(p_light->dr), 1, f); ffread(&p_light->dg, sizeof(p_light->dg), 1, f); ffread(&p_light->db, sizeof(p_light->db), 1, f); ffread(&p_light->sr, sizeof(p_light->sr), 1, f); ffread(&p_light->sg, sizeof(p_light->sg), 1, f); ffread(&p_light->sb, sizeof(p_light->sb), 1, f); ffread(&p_light->flag, sizeof(p_light->flag), 1, f); ffread(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffread(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffread(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); p_light->tp = p_light->np; if (p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an, FALSE); } p_light->p_mesh_data = p_kont; p_light->p_next = p_kont->p_dlight; p_light->p_prev = NULL; p_kont->p_dlight = p_light; if (p_light->p_next) { p_light->p_next->p_prev = p_light; } return (TRUE); } else return (FALSE); } /* ************************************************************** Nahraje Extra svetla ************************************************************** */ int lo_chunk_load_extra_light(FFILE f, OUT_CHUNK * p_ch) { EXTRA_DYN_LIGHT *p_light; if (p_ch->typ == CHUNK_EXTRA_LIGHT && p_elist) { p_light = lo_najdi_volne_extra_svetlo_point(p_elist, elistnum); if (p_light) { ffread(&p_light->akt, sizeof(p_light->akt), 1, f); str_read(p_light->jmeno, f); ffread(&p_light->flag, sizeof(p_light->flag), 1, f); ffread(&p_light->mflag, sizeof(p_light->mflag), 1, f); ffread(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffread(&p_light->np, sizeof(p_light->np), 1, f); ffread(&p_light->dir, sizeof(p_light->dir), 1, f); ffread(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffread(&p_light->theta, sizeof(p_light->theta), 1, f); ffread(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffread(&p_light->gourand, sizeof(p_light->gourand), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->sr, sizeof(p_light->sr), 1, f); ffread(&p_light->sg, sizeof(p_light->sg), 1, f); ffread(&p_light->sb, sizeof(p_light->sb), 1, f); ffread(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffread(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); p_light->tp = p_light->np; if (p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an, TRUE); } return (TRUE); } else return (FALSE); } else return (FALSE); } int lo_chunk_load_extra_light_mesh(FFILE f, OUT_CHUNK * p_ch) { EXTRA_DYN_LIGHT *p_light; if (p_kont && p_ch->typ == CHUNK_EXTRA_LIGHT_MESH) { p_light = (EXTRA_DYN_LIGHT *) mmalloc(sizeof(p_light[0])); ffread(&p_light->akt, sizeof(p_light->akt), 1, f); str_read(p_light->jmeno, f); ffread(&p_light->flag, sizeof(p_light->flag), 1, f); ffread(&p_light->mflag, sizeof(p_light->mflag), 1, f); ffread(&p_light->ktrida, sizeof(p_light->ktrida), 1, f); ffread(&p_light->np, sizeof(p_light->np), 1, f); ffread(&p_light->dir, sizeof(p_light->dir), 1, f); ffread(&p_light->dosah, sizeof(p_light->dosah), 1, f); ffread(&p_light->theta, sizeof(p_light->theta), 1, f); ffread(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffread(&p_light->gourand, sizeof(p_light->gourand), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->da, sizeof(p_light->da), 1, f); ffread(&p_light->sr, sizeof(p_light->sr), 1, f); ffread(&p_light->sg, sizeof(p_light->sg), 1, f); ffread(&p_light->sb, sizeof(p_light->sb), 1, f); ffread(&p_light->an_flag, sizeof(p_light->an_flag), 1, f); ffread(&p_light->an.endtime, sizeof(p_light->an.endtime), 1, f); p_light->tp = p_light->np; if (p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an, TRUE); } p_light->p_mesh_data = p_kont; p_light->p_next = p_kont->p_edlight; p_light->p_prev = NULL; p_kont->p_edlight = p_light; if (p_light->p_next) { p_light->p_next->p_prev = p_light; } return (TRUE); } else return (FALSE); } /* *********************************************************************** Loading mlho-kostek */ int lo_chunk_load_mlho_kostek(FFILE f, OUT_CHUNK * p_ch) { MLZNA_KOSTKA *p_top; if (p_ch->typ == CHUNK_MLHOKOSTKA) { p_top = vyrob_mlhokostku(""); str_read(p_top->jmeno, f); ffread(&p_top->min, sizeof(BOD), 1, f); ffread(&p_top->max, sizeof(BOD), 1, f); ffread(&p_top->flag, sizeof(p_top->flag), 1, f); ffread(&p_top->mod, sizeof(p_top->mod), 1, f); ffread(&p_top->priorita, sizeof(p_top->priorita), 1, f); ffread(&p_top->start, sizeof(p_top->start), 1, f); ffread(&p_top->stop, sizeof(p_top->stop), 1, f); ffread(&p_top->intenzita, sizeof(p_top->intenzita), 1, f); ffread(&p_top->r, sizeof(float) * 4, 1, f); p_top->p_next = p_top_mlha; p_top_mlha = p_top; return (TRUE); } else return (FALSE); } int lo_chunk_load_mlho_kostek_2(FFILE f, OUT_CHUNK * p_ch) { MLZNA_KOSTKA *p_top; int kid; if (p_ch->typ == CHUNK_MLHOKOSTKA_2) { p_top = vyrob_mlhokostku(""); str_read(p_top->jmeno, f); ffread(&p_top->min, sizeof(BOD), 1, f); ffread(&p_top->max, sizeof(BOD), 1, f); ffread(&p_top->flag, sizeof(p_top->flag), 1, f); ffread(&p_top->mod, sizeof(p_top->mod), 1, f); ffread(&p_top->priorita, sizeof(p_top->priorita), 1, f); ffread(&p_top->start, sizeof(p_top->start), 1, f); ffread(&p_top->stop, sizeof(p_top->stop), 1, f); ffread(&p_top->intenzita, sizeof(p_top->intenzita), 1, f); ffread(&p_top->r, sizeof(float) * 4, 1, f); ffread(&kid, sizeof(int), 1, f); if (kid != K_CHYBA) { p_kont->p_mlha = p_top; p_top->p_kont = p_kont; } ffread(&p_top->poly, sizeof(p_top->poly), 1, f); p_top->p_next = p_top_mlha; p_top_mlha = p_top; return (TRUE); } else return (FALSE); } /* *********************************************************************** Loading flaru */ int lo_chunk_load_flare(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int i, nic; if (p_flarelist && p_ch->typ == CHUNK_FLARE) { // najiti flare if ((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1, "Neni volny flare !"); p_flare = NULL; assert(0); return (FALSE); } p_flare = p_flarelist + i; memset((void *) p_flare, 0, sizeof(p_flare[0])); ffread(&p_flare->p, sizeof(BOD), 1, f); ffread(&p_flare->r, sizeof(float), 4, f); ffread(&p_flare->dx, sizeof(float), 2, f); ffread(&nic, sizeof(int), 1, f); ffread(&p_flare->alfa, sizeof(int), 1, f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; // load materialu str_read(pom, f); if ((p_flare->material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return (TRUE); } else return (FALSE); } int lo_chunk_load_flare_ext(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int i, nic; if (p_flarelist && p_ch->typ == CHUNK_FLARE_EXT) { // najiti flare if ((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1, "Neni volny flare !"); p_flare = NULL; assert(0); return (FALSE); } p_flare = p_flarelist + i; memset((void *) p_flare, 0, sizeof(p_flare[0])); ffread(&p_flare->p, sizeof(BOD), 1, f); ffread(&p_flare->r, sizeof(float), 4, f); ffread(&p_flare->dx, sizeof(float), 2, f); ffread(&nic, sizeof(int), 1, f); ffread(&p_flare->alfa, sizeof(int), 1, f); ffread(&p_flare->zflag, sizeof(int), 1, f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; // load materialu str_read(pom, f); if ((p_flare->material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return (TRUE); } else return (FALSE); } int lo_chunk_load_flare_light(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int i, nic; if (p_flarelist && p_lightakt && p_ch->typ == CHUNK_FLARE_LIGHT) { if ((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1, "Neni volny flare !"); p_flare = NULL; assert(0); return (FALSE); } p_flare = p_flarelist + i; ffread(&p_flare->p, sizeof(BOD), 1, f); ffread(&p_flare->r, sizeof(float), 4, f); ffread(&p_flare->dx, sizeof(float), 2, f); ffread(&nic, sizeof(int), 1, f); ffread(&p_flare->alfa, sizeof(int), 1, f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; p_flare->p_svetlo = p_lightakt; p_lightakt->p_flare = p_flare; // load materialu str_read(pom, f); if ((p_flare->material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return (TRUE); } else return (FALSE); } int lo_chunk_load_flare_light_ext(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int i, nic; if (p_flarelist && p_lightakt && p_ch->typ == CHUNK_FLARE_LIGHT_EXT) { if ((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1, "Neni volny flare !"); p_flare = NULL; assert(0); return (FALSE); } p_flare = p_flarelist + i; ffread(&p_flare->p, sizeof(BOD), 1, f); ffread(&p_flare->r, sizeof(float), 4, f); ffread(&p_flare->dx, sizeof(float), 2, f); ffread(&nic, sizeof(int), 1, f); ffread(&p_flare->alfa, sizeof(int), 1, f); ffread(&p_flare->zflag, sizeof(int), 1, f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; p_flare->p_svetlo = p_lightakt; p_lightakt->p_flare = p_flare; // load materialu str_read(pom, f); if ((p_flare->material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return (TRUE); } else return (FALSE); } int lo_chunk_load_flare_mesh(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int nic; if (p_light_mesh && p_ch->typ == CHUNK_FLARE_MESH) { // vyroba flare p_flare = (LENS_FLARE *) mmalloc(sizeof(p_flare[0])); ffread(&p_flare->p, sizeof(BOD), 1, f); ffread(&p_flare->r, sizeof(float), 4, f); ffread(&p_flare->dx, sizeof(float), 2, f); ffread(&nic, sizeof(int), 1, f); ffread(&p_flare->alfa, sizeof(int), 1, f); p_flare->akt = TRUE; p_flare->p_svetlo = p_light_mesh; p_flare->p_next = (LENS_FLARE *) p_light_mesh->p_flare; p_light_mesh->p_flare = p_flare; // load materialu str_read(pom, f); if ((p_flare->material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return (TRUE); } else return (FALSE); } int lo_chunk_load_flare_mesh_ext(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int nic; if (p_light_mesh && p_ch->typ == CHUNK_FLARE_MESH_EXT) { // vyroba flare p_flare = (LENS_FLARE *) mmalloc(sizeof(p_flare[0])); ffread(&p_flare->p, sizeof(BOD), 1, f); ffread(&p_flare->r, sizeof(float), 4, f); ffread(&p_flare->dx, sizeof(float), 2, f); ffread(&nic, sizeof(int), 1, f); ffread(&p_flare->alfa, sizeof(int), 1, f); ffread(&p_flare->zflag, sizeof(int), 1, f); p_flare->akt = TRUE; p_flare->p_svetlo = p_light_mesh; p_flare->p_next = (LENS_FLARE *) p_light_mesh->p_flare; p_light_mesh->p_flare = p_flare; // load materialu str_read(pom, f); if ((p_flare->material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return (TRUE); } else return (FALSE); } // Ulozeni slozeneho flare int lo_chunk_load_flare_slozeny(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int s; if (p_flare && p_ch->typ == CHUNK_FLARE_SLOZENY) { p_flare->p_sloz = (LENS_FLARE_SLOZ *) mmalloc(sizeof(p_flare->p_sloz[0]) * SLOZ_FLARE); for (s = 0; s < SLOZ_FLARE; s++) { ffread(&p_flare->p_sloz[s].vzdal, sizeof(float), 1, f); ffread(&p_flare->p_sloz[s].r, sizeof(float), 4, f); ffread(&p_flare->p_sloz[s].dx, sizeof(float), 2, f); str_read(pom, f); if (p_flare->p_sloz[s].vzdal > 0.0f) { if ((p_flare->p_sloz[s].material = lo_najdi_material(p_matlist, matlistnum, pom)) == K_CHYBA) { kprintf(1, "Cannot find material %s", pom); assert(0); } p_flare->p_sloz[s].p_mat = (p_flare->p_sloz[s].material < matlistnum) ? p_matlist[p_flare->p_sloz[s].material] : NULL; } else { p_flare->p_sloz[s].p_mat = NULL; p_flare->p_sloz[s].material = 0; } } return (TRUE); } else return (FALSE); } /* *********************************************************************** Loading ambientu */ int lo_chunk_load_ambient(FFILE f, OUT_CHUNK * p_ch) { if (p_ambient && p_ch->typ == CHUNK_AMBIENT) { ffread(p_ambient, sizeof(*p_ambient), 1, f); return (TRUE); } else return (FALSE); } /* *********************************************************************** Loading ambientu */ int lo_chunk_load_levelconfig(FFILE f, OUT_CHUNK * p_ch) { if (p_ch->typ == CHUNK_LEVEL_KONFIG_EXT) { ffread(&p_lc->barva_pozadi, sizeof(p_lc->barva_pozadi), 1, f); ffread(&p_lc->barva_pozadi_aktivni, sizeof(p_lc->barva_pozadi_aktivni), 1, f); ffread(&p_lc->zm.aktivni, sizeof(p_lc->zm.aktivni), 1, f); ffread(&p_lc->zm.v_start, sizeof(p_lc->zm.v_start), 1, f); ffread(&p_lc->zm.v_stop, sizeof(p_lc->zm.v_stop), 1, f); ffread(&p_lc->zm.h_start, sizeof(p_lc->zm.h_start), 1, f); ffread(&p_lc->zm.h_stop, sizeof(p_lc->zm.h_stop), 1, f); ffread(&p_lc->zm.barva, sizeof(p_lc->zm.barva), 1, f); return (TRUE); } else return (FALSE); } /* *********************************************************************** Loading zrcadla */ /* int lo_chunk_load_zrcadlo(FFILE f, OUT_CHUNK *p_ch) { if(p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO) { *p_zrcadloload = TRUE; ffread(&p_zrcadlolist->zrcadlo_k,sizeof(p_zrcadlolist->zrcadlo_k),1,f); ffread(&p_zrcadlolist->zrcadlo_o,sizeof(p_zrcadlolist->zrcadlo_o),1,f); ffread(&p_zrcadlolist->poly,sizeof(p_zrcadlolist->poly),1,f); ffread(&p_zrcadlolist->ref,sizeof(p_zrcadlolist->ref),1,f); ffread(p_zrcadlolist->p,sizeof(p_zrcadlolist->p[0]),4,f); ffread(p_zrcadlolist->r,sizeof(p_zrcadlolist->r[0]),5,f); return(TRUE); } else return(FALSE); } int lo_chunk_load_zrcadlo_2(FFILE f, OUT_CHUNK *p_ch) { if(p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO_2) { *p_zrcadloload = TRUE; ffread(p_zrcadlolist,sizeof(ZDRCADLO_DESC),1,f); return(TRUE); } else return(FALSE); } */ /* typedef struct _ZDRCADLO_DESC_POLY { int zrcadlo_k; // kontejner zrcadla int zrcadlo_o; // objekt zrcadla int id_kont; // id kontejneru int poly; // poly ktereho se to tyka struct _ZDRCADLO_DESC_POLY *p_next; } ZDRCADLO_DESC_POLY; */ int lo_chunk_load_zrcadlo_3_sub(FFILE f, OUT_CHUNK * p_ch) { ZDRCADLO_DESC_POLY *p_poly; if (p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO_3_POLOZKA) { p_poly = (ZDRCADLO_DESC_POLY *) mmalloc(sizeof(p_poly[0])); ffread(&p_poly->zrcadlo_k, sizeof(p_poly->zrcadlo_k), 1, f); ffread(&p_poly->zrcadlo_o, sizeof(p_poly->zrcadlo_o), 1, f); ffread(&p_poly->id_kont, sizeof(p_poly->id_kont), 1, f); ffread(&p_poly->poly, sizeof(p_poly->poly), 1, f); ffseek(f, 4, SEEK_CUR); p_poly->p_next = p_zrcadlolist->p_poly; p_zrcadlolist->p_poly = p_poly; return (TRUE); } else return (FALSE); } int lo_chunk_load_zrcadlo_3(FFILE f, OUT_CHUNK * p_ch) { if (p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO_3) { *p_zrcadloload = TRUE; ffread(&p_zrcadlolist->ref, sizeof(p_zrcadlolist->ref), 1, f); ffread(&p_zrcadlolist->p, sizeof(p_zrcadlolist->p), 1, f); ffread(&p_zrcadlolist->r, sizeof(p_zrcadlolist->r), 1, f); p_zrcadlolist->p_poly = NULL; // skip p_zrcadlolist->p_poly and 4 bytes space ffseek(f, 8, SEEK_CUR); return (TRUE); } else return (FALSE); } /* *********************************************************************** Loading statickych svetel */ int lo_chunk_load_static_light(FFILE f, OUT_CHUNK * p_ch) { STATIC_LIGHT light; if (p_lightlist && p_ch->typ == CHUNK_STATIC_LIGHT) { memset((void *) &light, 0, sizeof(light)); ffread(&light.akt, sizeof(light.akt), 1, f); str_read(light.jmeno, f); ffread(&light.index, sizeof(light.index), 1, f); ffread(&light.p, sizeof(light.p), 1, f); ffread(&light.r, sizeof(float), 1, f); ffread(&light.g, sizeof(float), 1, f); ffread(&light.b, sizeof(float), 1, f); ffread(&light.k1, sizeof(float), 4, f); ffread(&light.uhel, sizeof(light.uhel), 1, f); ffread(&light.utlum, sizeof(light.utlum), 1, f); ffread(&light.flag, sizeof(light.flag), 1, f); ffread(&light.flag2, sizeof(light.flag2), 1, f); if (p_lightlist[light.index].akt) { light.index = lo_najdi_volne_stat_svetlo(p_lightlist, lightlistnum); if (light.index != K_CHYBA) { p_lightlist[light.index] = light; } } else p_lightlist[light.index] = light; p_lightakt = p_lightlist + light.index; return (TRUE); } else return (FALSE); } int lo_chunk_load_static_light_mesh(FFILE f, OUT_CHUNK * p_ch) { STATIC_LIGHT *p_light; if (p_kont && p_ch->typ == CHUNK_STATIC_LIGHT_MESH) { p_light = (STATIC_LIGHT *) mmalloc(sizeof(p_light[0])); ffread(&p_light->akt, sizeof(p_light->akt), 1, f); str_read(p_light->jmeno, f); ffread(&p_light->index, sizeof(p_light->index), 1, f); ffread(&p_light->p, sizeof(p_light->p), 1, f); ffread(&p_light->r, sizeof(float), 1, f); ffread(&p_light->g, sizeof(float), 1, f); ffread(&p_light->b, sizeof(float), 1, f); ffread(&p_light->k1, sizeof(float), 4, f); ffread(&p_light->uhel, sizeof(p_light->uhel), 1, f); ffread(&p_light->utlum, sizeof(p_light->utlum), 1, f); ffread(&p_light->flag, sizeof(p_light->flag), 1, f); ffread(&p_light->flag2, sizeof(p_light->flag2), 1, f); p_light->flag2 |= SL2_MESH; p_light->p_mesh_data = p_kont; p_light->p_next = p_kont->p_slight; p_light->p_prev = NULL; p_kont->p_slight = p_light; if (p_light->p_next) { p_light->p_next->p_prev = p_light; } p_light_mesh = p_light; return (TRUE); } else return (FALSE); } /************************************************************************ Loading materialu */ int lo_chunk_load_mat(FFILE f, OUT_CHUNK * p_ch) { char pom[200]; int m; /* Vybere novy material + zvoli jej jako aktivni */ if (p_ch->typ == CHUNK_MATERIAL) { str_read(pom, f); if (lo_najdi_material(p_matlist, matlistnum, pom) != K_CHYBA) p_mat = NULL; else { if ((m = lo_najdi_prazdny_material(p_matlist, matlistnum)) == K_CHYBA) chyba("Malo materialu!"); p_mat = p_matlist[m] = vyrob_material(); p_mat->material_handle = m; strcpy(p_mat->jmeno, pom); } return (TRUE); } else return (FALSE); } int lo_chunk_load_mat_flags(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_FLAGS) { ffread(&p_mat->flag, sizeof(p_mat->flag), 1, f); ffread(&p_mat->flag2, sizeof(p_mat->flag2), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_mat_smat_pos(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_MAT_SMAT_POS) { ffread(&p_mat->smaterial_pozice, sizeof(p_mat->smaterial_pozice), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_color(FFILE f, OUT_CHUNK * p_ch) { MATERIAL *p_dxmat; char string[9]; if (p_mat && p_ch->typ == CHUNK_COLOR) { ffread(string, sizeof(char), 9, f); p_dxmat = &p_mat->dxmat; p_dxmat->ambient_r = (float) string[0] / MAX_BYTE; p_dxmat->ambient_g = (float) string[1] / MAX_BYTE; p_dxmat->ambient_b = (float) string[2] / MAX_BYTE; p_dxmat->diffuse_r = (float) string[3] / MAX_BYTE; p_dxmat->diffuse_g = (float) string[4] / MAX_BYTE; p_dxmat->diffuse_b = (float) string[5] / MAX_BYTE; p_dxmat->diffuse_a = 1.0f; p_dxmat->specular_r = (float) string[6] / MAX_BYTE; p_dxmat->specular_g = (float) string[7] / MAX_BYTE; p_dxmat->specular_b = (float) string[8] / MAX_BYTE; p_dxmat->faktor_r = 1.0f; p_dxmat->faktor_g = 1.0f; p_dxmat->faktor_b = 1.0f; p_dxmat->faktor_a = 1.0f; return (TRUE); } else return (FALSE); } int lo_chunk_load_color_ext(FFILE f, OUT_CHUNK * p_ch) { MATERIAL *p_dxmat; char string[16]; if (p_mat && p_ch->typ == CHUNK_COLOR_EXT) { ffread(string, sizeof(char), 16, f); p_dxmat = &p_mat->dxmat; p_dxmat->ambient_r = (float) string[0] / MAX_BYTE; p_dxmat->ambient_g = (float) string[1] / MAX_BYTE; p_dxmat->ambient_b = (float) string[2] / MAX_BYTE; //p_dxmat->ambient_a = (float)string[3]/MAX_BYTE; p_dxmat->diffuse_a = 1.0f; p_dxmat->diffuse_r = (float) string[4] / MAX_BYTE; p_dxmat->diffuse_g = (float) string[5] / MAX_BYTE; p_dxmat->diffuse_b = (float) string[6] / MAX_BYTE; p_dxmat->diffuse_a = (float) string[7] / MAX_BYTE; p_dxmat->specular_r = (float) string[8] / MAX_BYTE; p_dxmat->specular_g = (float) string[9] / MAX_BYTE; p_dxmat->specular_b = (float) string[10] / MAX_BYTE; //p_dxmat->specular_a = (float)string[11]/MAX_BYTE; p_dxmat->faktor_r = (float) string[12] / MAX_BYTE; p_dxmat->faktor_g = (float) string[13] / MAX_BYTE; p_dxmat->faktor_b = (float) string[14] / MAX_BYTE; p_dxmat->faktor_a = (float) string[15] / MAX_BYTE; return (TRUE); } else return (FALSE); } int lo_chunk_load_matanim_frame(FFILE f, OUT_CHUNK * p_ch) { ANIM_FRAME *p_fram; int frame, t; int flag = 0; if (p_mat && p_fanim && p_ch->typ == CHUNK_MATANIM_FRAME) { ffread(&frame, sizeof(frame), 1, f); assert(frame < p_fanim->framenum); p_fram = p_fanim->p_frame + frame; str_read(p_fram->file, f); ffread(&p_fram->time, sizeof(p_fram->time), 1, f); ffread(&p_fram->alfa, sizeof(p_fram->alfa), 1, f); ffread(&p_fram->u, sizeof(p_fram->u), 1, f); ffread(&p_fram->v, sizeof(p_fram->v), 1, f); ffread(&p_fram->flag, sizeof(p_fram->flag), 1, f); if ((t = lo_najdi_texturu(p_textlist, textlistnum, p_fram->file, flag)) == K_CHYBA) { if ((t = lo_najdi_volnou_texturu(p_textlist, textlistnum)) == K_CHYBA) chyba("Neni volna textura !"); strcpy(p_textlist[t].jmeno, p_fram->file); p_textlist[t].flag = flag; } p_fram->p_text = p_textlist + t; return (TRUE); } else return (FALSE); } int lo_chunk_load_matanim_frame_ext(FFILE f, OUT_CHUNK * p_ch) { ANIM_FRAME *p_fram; int frame, t; int flag = 0; if (p_mat && p_fanim && p_ch->typ == CHUNK_MATANIM_EFRAME) { ffread(&frame, sizeof(frame), 1, f); assert(frame < p_fanim->framenum); p_fram = p_fanim->p_frame + frame; ffread(&p_fram->time, sizeof(p_fram->time), 1, f); ffread(&p_fram->alfa, sizeof(p_fram->alfa), 1, f); ffread(&p_fram->u, sizeof(p_fram->u), 1, f); ffread(&p_fram->v, sizeof(p_fram->v), 1, f); ffread(&p_fram->flag, sizeof(p_fram->flag), 1, f); // Load jmeno a flag textury str_read(p_fram->file, f); ffread(&flag, sizeof(flag), 1, f); if ((t = lo_najdi_texturu(p_textlist, textlistnum, p_fram->file, flag)) == K_CHYBA) { if ((t = lo_najdi_volnou_texturu(p_textlist, textlistnum)) == K_CHYBA) chyba("Neni volna textura !"); strcpy(p_textlist[t].jmeno, p_fram->file); p_textlist[t].flag = flag; } p_fram->p_text = p_textlist + t; return (TRUE); } else return (FALSE); } int lo_chunk_load_matanim(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_MATANIM_EXT) { p_fanim = &p_mat->anim; p_mat->flag |= MAT_ANIM_FRAME; str_read(p_fanim->jmeno, f); ffread(&p_fanim->framenum, sizeof(p_fanim->framenum), 1, f); p_fanim->p_frame = (ANIM_FRAME *) mmalloc(sizeof(p_fanim->p_frame[0]) * p_fanim->framenum); return (TRUE); } else return (FALSE); } int lo_chunk_load_textmatrix(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_MATMATRIX_EXT) { ffread(p_mat->ttext, sizeof(p_mat->ttext[0]), 1, f); ffread(p_mat->ttext + 1, sizeof(p_mat->ttext[0]), 1, f); ffread(p_mat->ttext + 2, sizeof(p_mat->ttext[0]), 1, f); ffread(p_mat->ttext + 3, sizeof(p_mat->ttext[0]), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_mat_texgen_param(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_MAT_TEXGEN) { ffread(p_mat->texgen_koord_t, sizeof(p_mat->texgen_koord_t), 1, f); ffread(p_mat->texgen_koord_s, sizeof(p_mat->texgen_koord_s), 1, f); ffread(p_mat->texgen_koord_r, sizeof(p_mat->texgen_koord_r), 1, f); ffread(p_mat->texgen_koord_q, sizeof(p_mat->texgen_koord_q), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_matanim_text_1(FFILE f, OUT_CHUNK * p_ch) { ANIM_TEXT tmp, *p_track; int i; if (p_mat && p_ch->typ == CHUNK_MATANIM_T1) { p_mat->flag |= MAT2_T1_MATRIX; for (i = 0; i < MAX_TEXT_ANIM; i++) { if (!p_mat->p_atext[0][i]) break; } assert(i < MAX_TEXT_ANIM); p_mat->atextnum[0] = i + 1; ffread(&tmp, sizeof(tmp), 1, f); p_track = p_mat->p_atext[0][i] = key_vyrob_material_animace(tmp.pos_keys, tmp.rot_keys, tmp.scs_keys, tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if (p_track->pos_keys) { ffread(p_track->p_pos, sizeof(p_track->p_pos[0]), p_track->pos_keys, f); ffread(p_track->p_pkeys, sizeof(p_track->p_pkeys[0]), p_track->pos_keys, f); } if (p_track->piv_keys) { ffread(p_track->p_piv, sizeof(p_track->p_piv[0]), p_track->piv_keys, f); ffread(p_track->p_vkeys, sizeof(p_track->p_vkeys[0]), p_track->piv_keys, f); } if (p_track->rot_keys) { ffread(p_track->p_rot, sizeof(p_track->p_rot[0]), p_track->rot_keys, f); ffread(p_track->p_rkeys, sizeof(p_track->p_rkeys[0]), p_track->rot_keys, f); } if (p_track->scs_keys) { ffread(p_track->p_scale, sizeof(p_track->p_scale[0]), p_track->scs_keys, f); ffread(p_track->p_skeys, sizeof(p_track->p_skeys[0]), p_track->scs_keys, f); } return (TRUE); } else return (FALSE); } int lo_chunk_load_matanim_text_2(FFILE f, OUT_CHUNK * p_ch) { ANIM_TEXT tmp, *p_track; int i; if (p_mat && p_ch->typ == CHUNK_MATANIM_T2) { p_mat->flag |= MAT2_T2_MATRIX; for (i = 0; i < MAX_TEXT_ANIM; i++) { if (!p_mat->p_atext[1][i]) break; } assert(i < MAX_TEXT_ANIM); p_mat->atextnum[1] = i + 1; ffread(&tmp, sizeof(tmp), 1, f); p_track = p_mat->p_atext[1][i] = key_vyrob_material_animace(tmp.pos_keys, tmp.rot_keys, tmp.scs_keys, tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if (p_track->pos_keys) { ffread(p_track->p_pos, sizeof(p_track->p_pos[0]), p_track->pos_keys, f); ffread(p_track->p_pkeys, sizeof(p_track->p_pkeys[0]), p_track->pos_keys, f); } if (p_track->piv_keys) { ffread(p_track->p_piv, sizeof(p_track->p_piv[0]), p_track->piv_keys, f); ffread(p_track->p_vkeys, sizeof(p_track->p_vkeys[0]), p_track->piv_keys, f); } if (p_track->rot_keys) { ffread(p_track->p_rot, sizeof(p_track->p_rot[0]), p_track->rot_keys, f); ffread(p_track->p_rkeys, sizeof(p_track->p_rkeys[0]), p_track->rot_keys, f); } if (p_track->scs_keys) { ffread(p_track->p_scale, sizeof(p_track->p_scale[0]), p_track->scs_keys, f); ffread(p_track->p_skeys, sizeof(p_track->p_skeys[0]), p_track->scs_keys, f); } return (TRUE); } else return (FALSE); } int lo_chunk_load_matanim_text_3(FFILE f, OUT_CHUNK * p_ch) { ANIM_TEXT tmp, *p_track; int i; if (p_mat && p_ch->typ == CHUNK_MATANIM_T3) { p_mat->flag |= MAT2_T3_MATRIX; for (i = 0; i < MAX_TEXT_ANIM; i++) { if (!p_mat->p_atext[2][i]) break; } assert(i < MAX_TEXT_ANIM); p_mat->atextnum[2] = i + 1; ffread(&tmp, sizeof(tmp), 1, f); p_track = p_mat->p_atext[2][i] = key_vyrob_material_animace(tmp.pos_keys, tmp.rot_keys, tmp.scs_keys, tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if (p_track->pos_keys) { ffread(p_track->p_pos, sizeof(p_track->p_pos[0]), p_track->pos_keys, f); ffread(p_track->p_pkeys, sizeof(p_track->p_pkeys[0]), p_track->pos_keys, f); } if (p_track->piv_keys) { ffread(p_track->p_piv, sizeof(p_track->p_piv[0]), p_track->piv_keys, f); ffread(p_track->p_vkeys, sizeof(p_track->p_vkeys[0]), p_track->piv_keys, f); } if (p_track->rot_keys) { ffread(p_track->p_rot, sizeof(p_track->p_rot[0]), p_track->rot_keys, f); ffread(p_track->p_rkeys, sizeof(p_track->p_rkeys[0]), p_track->rot_keys, f); } if (p_track->scs_keys) { ffread(p_track->p_scale, sizeof(p_track->p_scale[0]), p_track->scs_keys, f); ffread(p_track->p_skeys, sizeof(p_track->p_skeys[0]), p_track->scs_keys, f); } return (TRUE); } else return (FALSE); } int lo_chunk_load_matanim_text_4(FFILE f, OUT_CHUNK * p_ch) { ANIM_TEXT tmp, *p_track; int i; if (p_mat && p_ch->typ == CHUNK_MATANIM_T4) { p_mat->flag |= MAT2_T4_MATRIX; for (i = 0; i < MAX_TEXT_ANIM; i++) { if (!p_mat->p_atext[3][i]) break; } assert(i < MAX_TEXT_ANIM); p_mat->atextnum[3] = i + 1; ffread(&tmp, sizeof(tmp), 1, f); p_track = p_mat->p_atext[3][i] = key_vyrob_material_animace(tmp.pos_keys, tmp.rot_keys, tmp.scs_keys, tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if (p_track->pos_keys) { ffread(p_track->p_pos, sizeof(p_track->p_pos[0]), p_track->pos_keys, f); ffread(p_track->p_pkeys, sizeof(p_track->p_pkeys[0]), p_track->pos_keys, f); } if (p_track->piv_keys) { ffread(p_track->p_piv, sizeof(p_track->p_piv[0]), p_track->piv_keys, f); ffread(p_track->p_vkeys, sizeof(p_track->p_vkeys[0]), p_track->piv_keys, f); } if (p_track->rot_keys) { ffread(p_track->p_rot, sizeof(p_track->p_rot[0]), p_track->rot_keys, f); ffread(p_track->p_rkeys, sizeof(p_track->p_rkeys[0]), p_track->rot_keys, f); } if (p_track->scs_keys) { ffread(p_track->p_scale, sizeof(p_track->p_scale[0]), p_track->scs_keys, f); ffread(p_track->p_skeys, sizeof(p_track->p_skeys[0]), p_track->scs_keys, f); } return (TRUE); } else return (FALSE); } int lo_chunk_load_mat_lesk(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_LESK) { ffread(&p_mat->lesk, sizeof(float), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_stage(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_STAG_TAG) { ffread(&p_mat->alfa_state, sizeof(p_mat->alfa_state), 1, f); ffread(&p_mat->text_state[0].text_stage, sizeof(int), 1, f); ffread(&p_mat->text_state[1].text_stage, sizeof(int), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_alfa_stage(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_ALFA_STAGE) { ffread(&p_mat->alfa_state, sizeof(p_mat->alfa_state), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_text_stage_1(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_TEXT_STAGE_1) { ffread(&p_mat->text_state[0].text_stage, sizeof(int), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_text_stage_2(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_TEXT_STAGE_2) { ffread(&p_mat->text_state[1].text_stage, sizeof(int), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_text_stage_3(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_TEXT_STAGE_3) { ffread(&p_mat->text_state[2].text_stage, sizeof(int), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_text_stage_4(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_TEXT_STAGE_4) { ffread(&p_mat->text_state[3].text_stage, sizeof(int), 1, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_text_stage_advaced(FFILE f, OUT_CHUNK * p_ch) { if (p_mat) { int num = p_ch->typ - CHUNK_TEXT_STAGE_AD_1; ffread(&p_mat->text_state[num].text_stage, sizeof(int), 1, f); ffread(&p_mat->text_state[num].textury, sizeof(int), 4, f); ffread(&p_mat->text_state[num].text_koord, sizeof(int), 4, f); ffread(&p_mat->text_state[num].text_funkce, sizeof(int), 4, f); ffread(&p_mat->text_state[num].text_ati_bump_matrix, sizeof(p_mat->text_state[num].text_ati_bump_matrix[0]), 4, f); return (TRUE); } else { return (FALSE); } } int lo_chunk_load_mat_env_spec(FFILE f, OUT_CHUNK * p_ch) { if (p_mat && p_ch->typ == CHUNK_ENVSPEC) { ffread(&p_mat->env_add1, sizeof(p_mat->env_add1), 1, f); ffread(&p_mat->env_add2, sizeof(p_mat->env_add2), 1, f); ffread(&p_mat->env_scale, sizeof(p_mat->env_scale), 1, f); ffread(&p_mat->env_r, sizeof(p_mat->env_r), 1, f); ffread(&p_mat->env_g, sizeof(p_mat->env_g), 1, f); ffread(&p_mat->env_b, sizeof(p_mat->env_b), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_mat_text_flag(FFILE f, OUT_CHUNK * p_ch) { if (p_mat) { int num = p_ch->typ - CHUNK_TEXT_FLAG_1; ffread(p_mat->textflag + num, sizeof(p_mat->textflag[num]), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_text(FFILE f, OUT_CHUNK * p_ch) { if (p_mat) { int t, num; switch (p_ch->typ) { case CHUNK_TEXT_1: num = 0; break; case CHUNK_TEXT_2: num = 1; break; case CHUNK_TEXT_3: num = 2; break; default: case CHUNK_TEXT_4: num = 3; break; } str_read(p_mat->textfile[num], f); if ((t = lo_najdi_texturu(p_textlist, textlistnum, p_mat->textfile[num], p_mat->textflag[num])) == K_CHYBA) { if ((t = lo_najdi_volnou_texturu(p_textlist, textlistnum)) == K_CHYBA) chyba("Neni volna textura !"); // Zaloz novou texturu strcpy(p_textlist[t].jmeno, p_mat->textfile[num]); p_textlist[t].flag = p_mat->textflag[num]; } p_mat->p_text[num] = p_textlist + t; return (TRUE); } else return (FALSE); } /************************************************************************ Loading kontejneru */ int lo_chunk_load_kont_jmeno(FFILE f, OUT_CHUNK * p_ch) { int pozice, i; char jmeno[200]; if (p_ch->typ == CHUNK_KONT_JMENO) { ffread(&pozice, sizeof(pozice), 1, f); str_read(jmeno, f); if (p_kontlist) { if (pozice == K_CHYBA) { if ((i = lo_najdi_volny_kontejner(p_kontlist, kontlistnum)) == K_CHYBA) { kprintf(1, "Cannot find free kont position!"); return (FALSE); } } else { i = pozice; //assert(!p_kontlist[i]); if (p_kontlist[i]) { kprintf(1, "Pozition %d is full (%s)", i, p_kontlist[i]->jmeno); if ((i = lo_najdi_volny_kontejner(p_kontlist, kontlistnum)) == K_CHYBA) { kprintf(1, "Cannot find free kont position!"); return (FALSE); } kprintf(1, "New position is %d kont %s", i, jmeno); } } p_kont = p_kontlist[i] = vyrob_kontejner(); strcpy(p_kont->jmeno, jmeno); } else { if (p_kont) { if (kont_load) { p_kont_old = p_kont; p_kont = NULL; } else { kont_load++; strcpy(p_kont->jmeno, jmeno); } } } p_kont->k2flag |= KONT2_LOADED; return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_low_jmeno(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_LOW_JMENO) { p_kont = (p_kont->p_next = vyrob_kontejner()); str_read(p_kont->jmeno, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_low_id(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_LOW_ID) { ffread(&p_kont->low_id, sizeof(p_kont->low_id), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_id(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_ID) { ffread(&p_kont->kontejner_ID, sizeof(p_kont->kontejner_ID), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_flag(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_FLAG) { ffread(&p_kont->kflag, sizeof(dword), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_flag_ext(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_FLAG_EXT) { ffread(&p_kont->m1flag, sizeof(dword), 1, f); ffread(&p_kont->m2flag, sizeof(dword), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_flag_ext_2(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_FLAG_EXT_2) { ffread(&p_kont->k2flag, sizeof(dword), 1, f); p_kont->k2flag |= KONT2_LOADED; return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_obb(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_OBB) { ffread(&p_kont->obb, sizeof(p_kont->obb), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_wmatrix(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_WMATRIX) { ffread(&p_kont->world, sizeof(p_kont->world), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_kont_mpmatrix(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_KONT_MPMATRIX) { p_kont->kflag |= KONT_MPMATRIX; ffread(&p_kont->mpmatrix, sizeof(p_kont->mpmatrix), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_jmeno(FFILE f, OUT_CHUNK * p_ch) { int i; // Nacte jmeno objektu + vybere novy objekt if (p_kont && p_ch->typ == CHUNK_OBJ_JMENO) { i = lo_najdi_volny_objekt_kont(p_kont); if (i == K_CHYBA) chyba("Neni volny objekt!"); p_obj = p_kont->p_obj[i] = vyrob_objekt(); str_read(p_obj->jmeno, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_ID(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_OBJ_ID) { ffread(&p_obj->Objekt_ID, sizeof(p_obj->Objekt_ID), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_pivot(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_OBJ_PIVOT) { ffread(&p_obj->pivot, sizeof(p_obj->pivot), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_obb(FFILE f, OUT_CHUNK * p_ch) { if (p_kont && p_ch->typ == CHUNK_OBJ_OBB) { ffread(&p_obj->obb, sizeof(p_obj->obb), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_material(FFILE f, OUT_CHUNK * p_ch) { char jmeno_materialu[200]; if (p_obj && p_ch->typ == CHUNK_OBJ_MATERIAL) { str_read(jmeno_materialu, f); if ((p_obj->material = lo_najdi_material(p_matlist, matlistnum, jmeno_materialu)) == K_CHYBA) { kprintf(1, "Cannot find material %s", jmeno_materialu); assert(0); } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_matrix(FFILE f, OUT_CHUNK * p_ch) { if (p_obj && p_ch->typ == CHUNK_OBJ_MATRIX_KEY) { ffread(&p_obj->m, sizeof(p_obj->m), 1, f); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_vertex(FFILE f, OUT_CHUNK * p_ch) { int pocet, i; float v[3]; if (p_obj && p_ch->typ == CHUNK_OBJ_VERTEXY) { if (!ffread(&pocet, sizeof(dword), 1, f)) chyba("Cteni"); p_obj->vertexnum = pocet; if (!(p_obj->p_vertex = (OBJEKT_BOD *) mmalloc(sizeof(OBJEKT_BOD) * pocet))) chyba("Nedostatek pameti..."); memset(p_obj->p_vertex, 0, sizeof(OBJEKT_BOD) * pocet); for (i = 0; i < pocet; i++) { if (!ffread(&v, sizeof(v), 1, f)) chyba("Cteni!"); p_obj->p_vertex[i].x = v[0]; p_obj->p_vertex[i].y = v[1]; p_obj->p_vertex[i].z = v[2]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_normal(FFILE f, OUT_CHUNK * p_ch) { int pocet, i; float v[3]; if (p_obj && p_obj->p_vertex && p_ch->typ == CHUNK_OBJ_NORMAL) { if (!ffread(&pocet, sizeof(dword), 1, f)) chyba("Cteni"); for (i = 0; i < pocet; i++) { if (!ffread(&v, sizeof(float), 3, f)) chyba("Cteni!"); p_obj->p_vertex[i].nx = v[0]; p_obj->p_vertex[i].ny = v[1]; p_obj->p_vertex[i].nz = v[2]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_face(FFILE f, OUT_CHUNK * p_ch) { int pocet; if (p_obj && p_ch->typ == CHUNK_OBJ_FACY) { if (!ffread(&pocet, sizeof(pocet), 1, f)) chyba("Cteni"); p_obj->facenum = pocet; p_obj->p_face = (FACE *) mmalloc(sizeof(FACE) * pocet); if (!ffread(p_obj->p_face, sizeof(p_obj->p_face[0]), pocet, f)) chyba("Cteni"); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_face_ext(FFILE f, OUT_CHUNK * p_ch) { if (p_obj && p_ch->typ == CHUNK_OBJ_FACY_OPT) { if (!ffread(&p_obj->optnum, sizeof(p_obj->optnum), 1, f)) chyba("Cteni"); p_obj->p_opt = (int *) mmalloc(sizeof(p_obj->p_opt[0]) * p_obj->optnum); if (!ffread(p_obj->p_opt, sizeof(p_obj->p_opt[0]), p_obj->optnum, f)) chyba("Cteni"); return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_mapy_1(FFILE f, OUT_CHUNK * p_ch) { float m[2]; int pocet, i; if (p_obj && p_ch->typ == CHUNK_OBJ_MAPY_1) { if (!ffread(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); assert(p_obj->vertexnum == pocet); for (i = 0; i < pocet; i++) { ffread(&m, sizeof(m), 1, f); p_obj->p_vertex[i].tu1 = m[0]; p_obj->p_vertex[i].tv1 = m[1]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_mapy_2(FFILE f, OUT_CHUNK * p_ch) { float m[2]; int pocet, i; if (p_obj && p_ch->typ == CHUNK_OBJ_MAPY_2) { if (!ffread(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); assert(p_obj->vertexnum == pocet); for (i = 0; i < pocet; i++) { ffread(&m, sizeof(m), 1, f); p_obj->p_vertex[i].tu2 = m[0]; p_obj->p_vertex[i].tv2 = m[1]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_mapy_3(FFILE f, OUT_CHUNK * p_ch) { float m[2]; int pocet, i; if (p_obj && p_ch->typ == CHUNK_OBJ_MAPY_3) { if (!ffread(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); assert(p_obj->vertexnum == pocet); for (i = 0; i < pocet; i++) { ffread(&m, sizeof(m), 1, f); p_obj->p_vertex[i].tu3 = m[0]; p_obj->p_vertex[i].tv3 = m[1]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_mapy_4(FFILE f, OUT_CHUNK * p_ch) { float m[2]; int pocet, i; if (p_obj && p_ch->typ == CHUNK_OBJ_MAPY_4) { if (!ffread(&pocet, sizeof(pocet), 1, f)) chyba("Zapis"); assert(p_obj->vertexnum == pocet); for (i = 0; i < pocet; i++) { ffread(&m, sizeof(m), 1, f); p_obj->p_vertex[i].tu4 = m[0]; p_obj->p_vertex[i].tv4 = m[1]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_barvy(FFILE f, OUT_CHUNK * p_ch) { int pocet, i; float v[4] = { 0, 0, 0, 0 }; if (p_obj && p_ch->typ == CHUNK_OBJ_BARVY) { ffread(&pocet, sizeof(pocet), 1, f); assert(p_obj->vertexnum == pocet); for (i = 0; i < pocet; i++) { if (!ffread(&v, sizeof(float), 4, f)) chyba("Zapis!"); p_obj->p_vertex[i].dr = v[0]; p_obj->p_vertex[i].dg = v[1]; p_obj->p_vertex[i].db = v[2]; } return (TRUE); } else return (FALSE); } int lo_chunk_load_obj_barvy_ext(FFILE f, OUT_CHUNK * p_ch) { int pocet, i; float v[4] = { 0, 0, 0, 0 }; if (p_obj && p_ch->typ == CHUNK_OBJ_BARVY_EXT) { ffread(&pocet, sizeof(pocet), 1, f); assert(p_obj->vertexnum == pocet); for (i = 0; i < pocet; i++) { if (!ffread(&v, sizeof(float), 4, f)) chyba("Read!"); p_obj->p_vertex[i].dr = v[0]; p_obj->p_vertex[i].dg = v[1]; p_obj->p_vertex[i].db = v[2]; p_obj->p_vertex[i].da = v[3]; if (!ffread(&v, sizeof(float), 4, f)) chyba("Read!"); p_obj->p_vertex[i].mdr = v[0]; p_obj->p_vertex[i].mdg = v[1]; p_obj->p_vertex[i].mdb = v[2]; p_obj->p_vertex[i].mda = v[3]; if (!ffread(&v, sizeof(float), 4, f)) chyba("Read!"); p_obj->p_vertex[i].sr = v[0]; p_obj->p_vertex[i].sg = v[1]; p_obj->p_vertex[i].sb = v[2]; if (!ffread(&v, sizeof(float), 4, f)) chyba("Read!"); p_obj->p_vertex[i].msr = v[0]; p_obj->p_vertex[i].msg = v[1]; p_obj->p_vertex[i].msb = v[2]; } return (TRUE); } else return (FALSE); } JOINT *lo_najdi_joint(JOINT * p_joint, int ID) { JOINT *t1; if (!p_joint) return (NULL); if (p_joint->joint_ID == ID) { return (p_joint); } else { if ((t1 = lo_najdi_joint(p_joint->p_child, ID))) return (t1); if ((t1 = lo_najdi_joint(p_joint->p_next, ID))) return (t1); return (NULL); } } int lo_chunk_load_obj_joint_ID(FFILE f, OUT_CHUNK * p_ch) { if (p_joint_animace && p_ch->typ == CHUNK_OBJ_JNT_ID) { JOINT *p_jnt = key_joint_vyrob(); int ID; int prev_ID; // oflaguj kontejner p_kont->k2flag |= KONT2_JOINT_ANIM; p_kont->kflag |= KONT_VERTEX_LIGHT; p_kont->kflag &= ~KONT_STATIC; ffread(&ID, sizeof(ID), 1, f); ffread(&prev_ID, sizeof(prev_ID), 1, f); p_joint = p_jnt; if (prev_ID == ROOT_ID) { if (!p_joint_animace->p_child) { p_joint_animace->p_child = p_joint; } else { p_joint->p_next = p_joint_animace->p_child->p_next; p_joint_animace->p_child->p_next = p_joint; } } else { JOINT *p_prev = lo_najdi_joint(p_joint_animace->p_child, prev_ID); if (p_prev->p_child) { p_joint->p_next = p_prev->p_next; p_prev->p_next = p_joint; } else { p_prev->p_child = p_joint; } } p_joint->joint_ID = ID; } return (TRUE); } int lo_chunk_load_obj_joint_pivot(FFILE f, OUT_CHUNK * p_ch) { if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_PIVOT) { ffread(&p_joint->pivot, sizeof(p_joint->pivot), 1, f); } return (TRUE); } int lo_chunk_load_obj_joint_flag(FFILE f, OUT_CHUNK * p_ch) { if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_FLAG) { ffread(&p_joint->flag, sizeof(p_joint->flag), 1, f); } return (TRUE); } int lo_chunk_load_obj_joint_vertexy(FFILE f, OUT_CHUNK * p_ch) { if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_VERT) { ffread(&p_joint->vertexnum, sizeof(p_joint->vertexnum), 1, f); p_joint->p_vertexlist = (int *) mmalloc(sizeof(p_joint->p_vertexlist[0]) * p_joint->vertexnum); ffread(p_joint->p_vertexlist, sizeof(p_joint->p_vertexlist[0]), p_joint->vertexnum, f); } return (TRUE); } int lo_chunk_load_obj_joint_pos(FFILE f, OUT_CHUNK * p_ch) { if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_POS) { ffread(&p_joint->pos_keys, sizeof(p_joint->pos_keys), 1, f); p_joint->p_pos = (BOD *) mmalloc(sizeof(p_joint->p_pos[0]) * p_joint->pos_keys); ffread(p_joint->p_pos, sizeof(p_joint->p_pos[0]), p_joint->pos_keys, f); } return (TRUE); } int lo_chunk_load_obj_joint_rot(FFILE f, OUT_CHUNK * p_ch) { if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_ROT) { ffread(&p_joint->rot_keys, sizeof(p_joint->rot_keys), 1, f); p_joint->p_rot = (QUAT *) mmalloc(sizeof(p_joint->p_rot[0]) * p_joint->rot_keys); ffread(p_joint->p_rot, sizeof(p_joint->p_rot[0]), p_joint->rot_keys, f); } return (TRUE); } int lo_chunk_load_obj_joint_scs(FFILE f, OUT_CHUNK * p_ch) { if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_SCS) { ffread(&p_joint->scs_keys, sizeof(p_joint->scs_keys), 1, f); p_joint->p_scs = (BOD *) mmalloc(sizeof(p_joint->p_scs[0]) * p_joint->scs_keys); ffread(p_joint->p_scs, sizeof(p_joint->p_scs[0]), p_joint->scs_keys, f); } return (TRUE); } /* Spline klice */ int lo_chunk_load_obj_joint_pos_spline(FFILE f, OUT_CHUNK * p_ch) { JOINT_KEYS *p_key; if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_KEYPOS) { if (!p_joint->p_keys) { p_key = p_joint->p_keys = (JOINT_KEYS *) mmalloc(sizeof(p_joint->p_keys[0])); } p_key = p_joint->p_keys; ffread(&p_key->pos_keys, sizeof(p_key->pos_keys), 1, f); p_key->p_pos = (BOD *) mmalloc(sizeof(p_key->p_pos[0]) * p_key->pos_keys); ffread(p_key->p_pos, sizeof(p_key->p_pos[0]), p_key->pos_keys, f); p_key->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_key->p_pkeys[0]) * p_key->pos_keys); ffread(p_key->p_pkeys, sizeof(p_key->p_pkeys[0]), p_key->pos_keys, f); } return (TRUE); } int lo_chunk_load_obj_joint_rot_spline(FFILE f, OUT_CHUNK * p_ch) { JOINT_KEYS *p_key; if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_KEYROT) { if (!p_joint->p_keys) { p_key = p_joint->p_keys = (JOINT_KEYS *) mmalloc(sizeof(p_joint->p_keys[0])); } p_key = p_joint->p_keys; ffread(&p_key->rot_keys, sizeof(p_key->rot_keys), 1, f); p_key->p_rot = (QUAT *) mmalloc(sizeof(p_key->p_rot[0]) * p_key->rot_keys); ffread(p_key->p_rot, sizeof(p_key->p_rot[0]), p_key->rot_keys, f); p_key->p_rkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_key->p_rkeys[0]) * p_key->rot_keys); ffread(p_key->p_rkeys, sizeof(p_key->p_rkeys[0]), p_key->rot_keys, f); } return (TRUE); } int lo_chunk_load_obj_joint_scs_spline(FFILE f, OUT_CHUNK * p_ch) { JOINT_KEYS *p_key; if (p_joint && p_ch->typ == CHUNK_OBJ_JNT_KEYSCS) { if (!p_joint->p_keys) { p_key = p_joint->p_keys = (JOINT_KEYS *) mmalloc(sizeof(p_joint->p_keys[0])); } p_key = p_joint->p_keys; ffread(&p_key->scs_keys, sizeof(p_key->scs_keys), 1, f); p_key->p_scale = (BOD *) mmalloc(sizeof(p_key->p_scale[0]) * p_key->scs_keys); ffread(p_key->p_scale, sizeof(p_key->p_scale[0]), p_key->scs_keys, f); p_key->p_skeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_key->p_skeys[0]) * p_key->scs_keys); ffread(p_key->p_skeys, sizeof(p_key->p_skeys[0]), p_key->scs_keys, f); } return (TRUE); } int lo_chunk_load_obj_joint_animace(FFILE f, OUT_CHUNK * p_ch) { if (p_obj && p_ch->typ == CHUNK_OBJ_JA) { JOINT_ANIMACE *p_anim = (JOINT_ANIMACE *) mmalloc(sizeof(p_anim[0])); str_read(p_anim->jmeno, f); p_anim->p_next = p_joint_animace; p_joint_animace = p_anim; p_joint_animace->p_next = p_obj->p_joit_animace; p_obj->p_joit_animace = p_joint_animace; } return (TRUE); } int lo_chunk_load_obj_joint_framy(FFILE f, OUT_CHUNK * p_ch) { if (p_joint_animace && p_ch->typ == CHUNK_OBJ_JA_FRAMU) { ffread(&p_joint_animace->framenum, sizeof(p_joint_animace->framenum), 1, f); } return (TRUE); } /****************************************************************************** Load sim animaci */ inline int lo_najdi_volny_sim(HIERARCHY_SIM * p_sim, int max) { int i; for (i = 0; i < max; i++) { if (!p_sim[i].keynum) return (i); } return (K_CHYBA); } int lo_chunk_load_sim_node(FFILE f, SIMPLE_TRACK_INFO * p_sim) { OUT_CHUNK ch; int klicu, i; ffread(&ch, sizeof(ch), 1, f); if (p_sim && (ch.typ == CHUNK_SIM_NODE || ch.typ == CHUNK_SIM_NODE_EXT || ch.typ == CHUNK_SIM_NODE_EXT2)) { memset((void *) p_sim, 0, sizeof(p_sim[0])); ffread(&p_sim->Objekt_ID, sizeof(p_sim->Objekt_ID), 1, f); ffread(&p_sim->flag, sizeof(p_sim->flag), 1, f); ffread(&p_sim->keynum, sizeof(p_sim->keynum), 1, f); ffread(&p_sim->pivot, sizeof(p_sim->pivot), 1, f); ffread(&p_sim->pivot3ds, sizeof(p_sim->pivot3ds), 1, f); ffread(&p_sim->childnum, sizeof(p_sim->childnum), 1, f); ffread(&klicu, sizeof(klicu), 1, f); if (klicu) { p_sim->p_pos = (BOD *) mmalloc(sizeof(p_sim->p_pos[0]) * p_sim->keynum); ffread(p_sim->p_pos, sizeof(p_sim->p_pos[0]), p_sim->keynum, f); } else { p_sim->p_pos = NULL; } ffread(&klicu, sizeof(klicu), 1, f); if (klicu) { p_sim->p_scale = (BOD *) mmalloc(sizeof(p_sim->p_scale[0]) * p_sim->keynum); ffread(p_sim->p_scale, sizeof(p_sim->p_scale[0]), p_sim->keynum, f); } else { p_sim->p_scale = NULL; } ffread(&klicu, sizeof(klicu), 1, f); if (klicu) { p_sim->p_at = (QUAT *) mmalloc(sizeof(p_sim->p_at[0]) * p_sim->keynum); ffread(p_sim->p_at, sizeof(p_sim->p_at[0]), p_sim->keynum, f); } else { p_sim->p_at = NULL; } if (ch.typ == CHUNK_SIM_NODE_EXT || ch.typ == CHUNK_SIM_NODE_EXT2) { ffread(&klicu, sizeof(klicu), 1, f); if (klicu) { p_sim->p_norm = (float *) mmalloc(sizeof(p_sim->p_norm[0]) * p_sim->keynum); ffread(p_sim->p_norm, sizeof(p_sim->p_norm[0]), p_sim->keynum, f); } else { p_sim->p_norm = NULL; } } if (ch.typ == CHUNK_SIM_NODE_EXT2) { p_sim->p_all_matrix = (GLMATRIX *) mmalloc(sizeof(p_sim->p_all_matrix[0])); ffread(p_sim->p_all_matrix, sizeof(p_sim->p_all_matrix[0]), 1, f); } if (p_sim->childnum) { p_sim->p_child = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_sim->p_child[0]) * p_sim->childnum); for (i = 0; i < p_sim->childnum; i++) lo_chunk_load_sim_node(f, p_sim->p_child + i); } return (TRUE); } else return (FALSE); } int lo_chunk_load_sim_root(FFILE f, OUT_CHUNK * p_ch) { int i; if (p_kont && p_ch->typ == CHUNK_SIM_ROOT) { if ((i = lo_najdi_volny_sim(p_kont->sim, KONT_MAX_ANIM)) == K_CHYBA) chyba("Fuck-off"); p_sim = p_kont->sim + i; memset(p_sim, 0, sizeof(p_sim[0])); ffread(&p_sim->flag, sizeof(p_sim->flag), 1, f); ffread(&p_sim->keynum, sizeof(p_sim->keynum), 1, f); ffread(&p_sim->jmeno, sizeof(p_sim->jmeno[0]), MAX_JMENO, f); ffread(&p_sim->childnum, sizeof(p_sim->childnum), 1, f); // udelej misto pro decka if (p_sim->childnum) { p_sim->p_child = (SIMPLE_TRACK_INFO *) malloc(sizeof(p_sim->p_child[0]) * p_sim->childnum); for (i = 0; i < p_sim->childnum; i++) lo_chunk_load_sim_node(f, p_sim->p_child + i); } key_sim_dopln_matrix_kont(p_kont, p_sim); return (TRUE); } else { p_sim = NULL; return (FALSE); } } /* Preskoc neznamy chunk */ int lo_chunk_load_neznamy(FFILE f, OUT_CHUNK * p_ch) { int delka = p_ch->velikost - sizeof(*p_ch); //kprintf(TRUE,"neznamy chunk typ %d velikost %d",p_ch->typ,p_ch->velikost); ffseek(f, delka, SEEK_CUR); return (TRUE); } /* Load vseho v kontejneru */ typedef int (LPLOADFUNCCHUNK) (FFILE f, OUT_CHUNK * p_ch); typedef struct _CHUNK_LOAD { LPLOADFUNCCHUNK *p_fce; int chunk; } CHUNK_LOAD; CHUNK_LOAD chload[] = { {lo_chunk_load_ambient, CHUNK_AMBIENT}, {lo_chunk_load_levelconfig, CHUNK_LEVEL_KONFIG_EXT}, {lo_chunk_load_mat, CHUNK_MATERIAL}, {lo_chunk_load_color, CHUNK_COLOR}, {lo_chunk_load_color_ext, CHUNK_COLOR_EXT}, {lo_chunk_load_matanim, CHUNK_MATANIM_EXT}, {lo_chunk_load_matanim_frame, CHUNK_MATANIM_FRAME}, {lo_chunk_load_matanim_frame_ext, CHUNK_MATANIM_EFRAME}, {lo_chunk_load_matanim_text_1, CHUNK_MATANIM_T1}, {lo_chunk_load_matanim_text_2, CHUNK_MATANIM_T2}, {lo_chunk_load_matanim_text_3, CHUNK_MATANIM_T3}, {lo_chunk_load_matanim_text_4, CHUNK_MATANIM_T4}, {lo_chunk_load_textmatrix, CHUNK_MATMATRIX_EXT}, {lo_chunk_load_stage, CHUNK_STAG_TAG}, {lo_chunk_load_text, CHUNK_TEXT_1}, {lo_chunk_load_text, CHUNK_TEXT_2}, {lo_chunk_load_text, CHUNK_TEXT_3}, {lo_chunk_load_text, CHUNK_TEXT_4}, {lo_chunk_load_mat_lesk, CHUNK_LESK}, {lo_chunk_load_mat_flags, CHUNK_FLAGS}, {lo_chunk_load_mat_smat_pos, CHUNK_MAT_SMAT_POS}, {lo_chunk_load_mat_env_spec, CHUNK_ENVSPEC}, {lo_chunk_load_mat_alfa_stage, CHUNK_ALFA_STAGE}, {lo_chunk_load_mat_text_stage_1, CHUNK_TEXT_STAGE_1}, {lo_chunk_load_mat_text_stage_2, CHUNK_TEXT_STAGE_2}, {lo_chunk_load_mat_text_stage_3, CHUNK_TEXT_STAGE_3}, {lo_chunk_load_mat_text_stage_4, CHUNK_TEXT_STAGE_4}, {lo_chunk_load_mat_text_stage_advaced, CHUNK_TEXT_STAGE_AD_1}, {lo_chunk_load_mat_text_stage_advaced, CHUNK_TEXT_STAGE_AD_2}, {lo_chunk_load_mat_text_stage_advaced, CHUNK_TEXT_STAGE_AD_3}, {lo_chunk_load_mat_text_stage_advaced, CHUNK_TEXT_STAGE_AD_4}, {lo_chunk_load_mat_text_flag, CHUNK_TEXT_FLAG_1}, {lo_chunk_load_mat_text_flag, CHUNK_TEXT_FLAG_2}, {lo_chunk_load_mat_text_flag, CHUNK_TEXT_FLAG_3}, {lo_chunk_load_mat_text_flag, CHUNK_TEXT_FLAG_4}, {lo_chunk_load_mat_texgen_param, CHUNK_MAT_TEXGEN}, {lo_chunk_load_kont_jmeno, CHUNK_KONT_JMENO}, {lo_chunk_load_kont_low_jmeno, CHUNK_KONT_LOW_JMENO}, {lo_chunk_load_kont_low_id, CHUNK_KONT_LOW_ID}, {lo_chunk_load_kont_id, CHUNK_KONT_ID}, {lo_chunk_load_kont_flag, CHUNK_KONT_FLAG}, {lo_chunk_load_kont_flag_ext, CHUNK_KONT_FLAG_EXT}, {lo_chunk_load_kont_flag_ext_2, CHUNK_KONT_FLAG_EXT_2}, {lo_chunk_load_kont_wmatrix, CHUNK_KONT_WMATRIX}, {lo_chunk_load_kont_mpmatrix, CHUNK_KONT_MPMATRIX}, {lo_chunk_load_kont_obb, CHUNK_KONT_OBB}, {lo_chunk_load_obj_jmeno, CHUNK_OBJ_JMENO}, {lo_chunk_load_obj_ID, CHUNK_OBJ_ID}, {lo_chunk_load_obj_pivot, CHUNK_OBJ_PIVOT}, {lo_chunk_load_obj_material, CHUNK_OBJ_MATERIAL}, {lo_chunk_load_obj_vertex, CHUNK_OBJ_VERTEXY}, {lo_chunk_load_obj_normal, CHUNK_OBJ_NORMAL}, {lo_chunk_load_obj_mapy_1, CHUNK_OBJ_MAPY_1}, {lo_chunk_load_obj_mapy_2, CHUNK_OBJ_MAPY_2}, {lo_chunk_load_obj_mapy_3, CHUNK_OBJ_MAPY_3}, {lo_chunk_load_obj_mapy_4, CHUNK_OBJ_MAPY_4}, {lo_chunk_load_obj_face, CHUNK_OBJ_FACY}, {lo_chunk_load_obj_face_ext, CHUNK_OBJ_FACY_OPT}, {lo_chunk_load_obj_barvy, CHUNK_OBJ_BARVY}, {lo_chunk_load_obj_barvy_ext, CHUNK_OBJ_BARVY_EXT}, {lo_chunk_load_obj_matrix, CHUNK_OBJ_MATRIX_KEY}, {lo_chunk_load_obj_obb, CHUNK_OBJ_OBB}, {lo_chunk_load_sim_root, CHUNK_SIM_ROOT}, {lo_chunk_load_static_light, CHUNK_STATIC_LIGHT}, {lo_chunk_load_static_light_mesh, CHUNK_STATIC_LIGHT_MESH}, {lo_chunk_load_dyn_light, CHUNK_DYNAMIC_LIGHT}, {lo_chunk_load_dyn_light_mesh, CHUNK_DYNAMIC_LIGHT_MESH}, {lo_chunk_load_extra_light, CHUNK_EXTRA_LIGHT}, {lo_chunk_load_extra_light_mesh, CHUNK_EXTRA_LIGHT_MESH}, {lo_chunk_load_zrcadlo_3, CHUNK_ZRCADLO_3}, {lo_chunk_load_zrcadlo_3_sub, CHUNK_ZRCADLO_3_POLOZKA}, {lo_chunk_load_flare, CHUNK_FLARE}, {lo_chunk_load_flare_mesh, CHUNK_FLARE_MESH}, {lo_chunk_load_flare_slozeny, CHUNK_FLARE_SLOZENY}, {lo_chunk_load_flare_light, CHUNK_FLARE_LIGHT}, {lo_chunk_load_flare_ext, CHUNK_FLARE_EXT}, {lo_chunk_load_flare_mesh_ext, CHUNK_FLARE_MESH_EXT}, {lo_chunk_load_flare_light_ext, CHUNK_FLARE_LIGHT_EXT}, {lo_chunk_load_mlho_kostek, CHUNK_MLHOKOSTKA}, {lo_chunk_load_mlho_kostek_2, CHUNK_MLHOKOSTKA_2}, {lo_chunk_load_environment, CHUNK_ENVIRONMENT}, {lo_chunk_load_kamset, CHUNK_KAMSET}, {lo_chunk_load_kamset_2, CHUNK_KAMSET_2}, {lo_chunk_load_obj_joint_animace, CHUNK_OBJ_JA}, {lo_chunk_load_obj_joint_ID, CHUNK_OBJ_JNT_ID}, {lo_chunk_load_obj_joint_framy, CHUNK_OBJ_JA_FRAMU}, {lo_chunk_load_obj_joint_pivot, CHUNK_OBJ_JNT_PIVOT}, {lo_chunk_load_obj_joint_flag, CHUNK_OBJ_JNT_FLAG}, {lo_chunk_load_obj_joint_vertexy, CHUNK_OBJ_JNT_VERT}, {lo_chunk_load_obj_joint_pos, CHUNK_OBJ_JNT_POS}, {lo_chunk_load_obj_joint_rot, CHUNK_OBJ_JNT_ROT}, {lo_chunk_load_obj_joint_scs, CHUNK_OBJ_JNT_SCS}, {lo_chunk_load_obj_joint_pos_spline, CHUNK_OBJ_JNT_KEYPOS}, {lo_chunk_load_obj_joint_rot_spline, CHUNK_OBJ_JNT_KEYROT}, {lo_chunk_load_obj_joint_scs_spline, CHUNK_OBJ_JNT_KEYSCS} }; int lo_load_chunky(FFILE f) { OUT_CHUNK ch; int load, i, j = 0, ret; while ((ret = ffread(&ch, sizeof(ch), 1, f)) && ret > 0) { load = 0; //pprintf("ch.typ = %d", ch.typ); assert(ch.typ >= 0 && ch.typ <= CHUNK_KAMSET_2); for (i = 0; i < (int) (sizeof(chload) / sizeof(chload[0])); i++) { if (chload[i].chunk == ch.typ) { load = chload[i].p_fce(f, &ch); break; } } if (!load) { lo_chunk_load_neznamy(f, &ch); } j++; } if (ret < 0) { if (ret == -1) { //kprintf(TRUE,"Chyba loadu projektu '%s'",strerror(errno)); } } return (j); } /* Nahraje vsechny materialy + prvni kontejner */ EDIT_KONTEJNER *lo_nahraj_kontejner_chunk(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_jmeno, int mat, int normal) { FFILE f; if ((f = ffopen(p_jmeno, "rb")) == NULL) { //kprintf(1,"Fail loading kont %s error '%s'",p_jmeno,strerror(errno)); return (NULL); } p_ambient = NULL; p_matlist = p_mat; matlistnum = max_mat; p_textlist = p_text; textlistnum = max_text; p_lightlist = NULL; lightlistnum = 0; p_zrcadlolist = NULL; p_zrcadloload = NULL; p_flarelist = NULL; p_flare = NULL; p_top_mlha = NULL; flarelistnum = 0; kont_load = 0; kontlistnum = 0; p_kontlist = NULL; p_kont_old = p_kont = vyrob_kontejner(); p_mat = NULL; p_obj = NULL; p_dlist = NULL; dlistnum = 0; p_elist = NULL; elistnum = 0; p_lenv = NULL; p_kamset = NULL; p_light_mesh = NULL; p_joint = NULL; p_joint_animace = NULL; lo_load_chunky(f); ffclose(f); p_kont->k2flag &= ~KONT2_LOADED; p_kont = p_kont_old; lo_chunk_stage_load_korekce(p_matlist, max_mat); p_kont->k2flag &= ~KONT2_LOADED; updatuj_kontejner_flag(p_kont, p_matlist); updatuj_kontejner_statistika(p_kont, FALSE); key_kontejner_sim_reanimuj(p_kont); if (normal) kont_norm_vect(p_kont); key_kosti_reanimuj_kont(p_kont); return (p_kont); } /* Nahraje vsechny veci z .prj */ int lo_nahraj_projekt(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER ** p_kontls, int kontnum, EDIT_TEXT_OLD * p_text, int max_text, char *p_jmeno, STATIC_LIGHT * p_light, int lightnum, ZDRCADLO_DESC * p_zrcadlo, int *p_zrcadlo_aktivni, LENS_FLARE * p_flarr, int flaremax, dword * p_amb, MLZNA_KOSTKA ** p_mlha, DYN_LIGHT * p_ddlight, int ddlightnum, EXTRA_DYN_LIGHT * p_eelight, int eelightnum, LEVEL_ENVIRONMENT * p_env, NASTAVENI_KAMER * p_kam, LEVEL_KONFIG * p_lev_konfig, int flag, int normal) { FFILE f; int i; if ((f = ffopen(p_jmeno, "rb")) == NULL) { //kprintf(1,"Fail loading kont %s error '%s'",p_jmeno,strerror(errno)); return (FALSE); } p_kontlist = (flag & LOAD_GEOM) ? p_kontls : NULL; kontlistnum = (flag & LOAD_GEOM) ? kontnum : 0; p_matlist = (flag & LOAD_MATERIALY) ? p_mat : NULL; matlistnum = (flag & LOAD_MATERIALY) ? max_mat : 0; p_textlist = (flag & LOAD_TEXTURY) ? p_text : NULL; textlistnum = (flag & LOAD_TEXTURY) ? max_text : 0; p_ambient = (flag & LOAD_AMBIENT) ? p_amb : NULL; p_zrcadlolist = (flag & LOAD_ZRCADLO) ? p_zrcadlo : NULL; p_zrcadloload = (flag & LOAD_ZRCADLO) ? p_zrcadlo_aktivni : NULL; p_lightlist = (flag & LOAD_STAT_LIGHT) ? p_light : NULL; lightlistnum = (flag & LOAD_STAT_LIGHT) ? lightnum : 0; p_dlist = (flag & LOAD_DYN_LIGHT) ? p_ddlight : NULL; dlistnum = (flag & LOAD_DYN_LIGHT) ? ddlightnum : 0; p_elist = (flag & LOAD_EXTRA_DYN_LIGHT) ? p_eelight : NULL; elistnum = (flag & LOAD_EXTRA_DYN_LIGHT) ? eelightnum : 0; p_top_mlha = (flag & LOAD_MLHA) ? *p_mlha : NULL; p_flarelist = (flag & LOAD_FLARE) ? p_flarr : NULL; flarelistnum = (flag & LOAD_FLARE) ? flaremax : 0; p_flare = NULL; p_lenv = (flag & LOAD_LEVEL_ENV) ? p_env : NULL; p_lc = (flag & LOAD_LEVEL_CONF) ? p_lev_konfig : NULL; p_kamset = (flag & LOAD_KAMERY) ? p_kam : NULL; p_kont = NULL; p_mat = NULL; p_obj = NULL; p_light_mesh = NULL; p_joint = NULL; p_joint_animace = NULL; lo_load_chunky(f); ffclose(f); lo_chunk_stage_load_korekce(p_matlist, max_mat); for (i = 0; i < kontnum; i++) { if (p_kontls[i] && p_kontls[i]->k2flag & KONT2_LOADED) { p_kontls[i]->k2flag &= ~KONT2_LOADED; updatuj_kontejner_flag(p_kontls[i], p_matlist); updatuj_kontejner_statistika(p_kontls[i], FALSE); lo_preved_flare_do_sceny(p_kontls[i]->p_slight, p_flarr, flaremax); lo_preved_svetla_do_sceny(p_kontls[i], p_light, lightnum, p_ddlight, ddlightnum, p_eelight, eelightnum); key_kontejner_sim_reanimuj(p_kontls[i]); if (normal) kont_norm_vect(p_kontls[i]); key_kosti_reanimuj_kont(p_kontls[i]); } } *p_mlha = p_top_mlha; return (TRUE); } int lo_nahraj_materialy_chunk(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file, int save) { FFILE f; p_matlist = p_mat; matlistnum = max_mat; p_textlist = p_text; textlistnum = max_text; p_lightlist = NULL; lightlistnum = 0; p_zrcadlolist = NULL; p_zrcadloload = NULL; p_flarelist = NULL; p_flare = NULL; p_top_mlha = NULL; flarelistnum = 0; kontlistnum = 0; kont_load = 0; p_kontlist = NULL; p_kont = NULL; p_mat = NULL; p_obj = NULL; p_dlist = NULL; dlistnum = 0; p_elist = NULL; elistnum = 0; p_lenv = NULL; p_kamset = NULL; p_light_mesh = NULL; p_joint = NULL; p_joint_animace = NULL; if ((f = ffopen(p_file, "rb")) == NULL) { //kprintf(1,"Fail loading material %s error '%s'",p_file,strerror(errno)); return (FALSE); } lo_load_chunky(f); ffclose(f); lo_chunk_stage_load_korekce(p_matlist, max_mat); return (TRUE); } void lo_chunk_stage_load_korekce(EDIT_MATERIAL ** p_mat, int num) { MATERIAL_TEXT_OLD *p_stg; int textur, i, j, s; for (j = 0; j < num; j++) { if (p_mat[j]) { /* korekce pruhlednosti */ if (alfa_stage_edit_blok[p_mat[j]->alfa_state].alfa_pruhledny) { p_mat[j]->flag |= MAT_PRUHLEDNY; } else p_mat[j]->flag &= ~MAT_PRUHLEDNY; /* Maskovany material */ if (p_mat[j]->alfa_state == STAGE_ALFA_MASKA) { p_mat[j]->flag2 |= MAT2_MASKA; } else { p_mat[j]->flag2 &= ~MAT2_MASKA; } /* korekce stagu */ for (i = 0; i < MAT_TEXTUR; i++) { if (!p_mat[j]->textfile[i][0]) { p_mat[j]->text_state[i].text_stage = K_CHYBA; } } /* Prepocitani textur */ p_stg = p_mat[j]->text_state; for (i = 0, textur = 0; i < MAT_TEXTUR; i++) { if ((s = p_stg->text_stage) != K_CHYBA) { textur += text_stage_edit_blok[s].delka; } p_stg++; } p_mat[j]->textur = textur; } } } berusky2-0.12/src/komat/Keyframe.cpp0000644000175000017500000032670713674426075014331 00000000000000/* Keyframovy animacni modul - slohnuto z: Splines & Quaternions (splines.txt) ----------------------------------- by Jochen Wilhelmy a.k.a. digisnap digisnap@cs.tu-berlin.de 06.08.1997 */ #include #include "compat_mini.h" #include "Berusky_universal.h" #include "3d_all.h" #define DELTA_INTERVAL 0.01f #define LIB3DS_EPSILON (1e-8) #define MAX_SIM_RADKU 2000 /****************************************************************************** Debug-rozhrani ****************************************************************************** */ void dbg_print_matrix(GLMATRIX * m) { #define PRESNOST2 "%f %f %f %f" dbgprintf(PRESNOST2, m->_11, m->_21, m->_31, m->_41); dbgprintf(PRESNOST2, m->_12, m->_22, m->_32, m->_42); dbgprintf(PRESNOST2, m->_13, m->_23, m->_33, m->_43); dbgprintf(PRESNOST2, m->_14, m->_24, m->_34, m->_44); } void kprintf_matrix(GLMATRIX * m) { #define PRESNOST2 "%f %f %f %f" kprintf(TRUE, PRESNOST2, m->_11, m->_21, m->_31, m->_41); kprintf(TRUE, PRESNOST2, m->_12, m->_22, m->_32, m->_42); kprintf(TRUE, PRESNOST2, m->_13, m->_23, m->_33, m->_43); kprintf(TRUE, PRESNOST2, m->_14, m->_24, m->_34, m->_44); } void kprint_matrix(GLMATRIX * m) { #define PRESNOST3 "%.2f %.2f %.2f %.2f" kprintf(TRUE, PRESNOST3, m->_11, m->_21, m->_31, m->_41); kprintf(TRUE, PRESNOST3, m->_12, m->_22, m->_32, m->_42); kprintf(TRUE, PRESNOST3, m->_13, m->_23, m->_33, m->_43); kprintf(TRUE, PRESNOST3, m->_14, m->_24, m->_34, m->_44); } void dbg_print_track_uhel(TRACK_INFO * p_track) { word i; dbgprintf("Uhlovy track...."); for (i = 0; i < p_track->rot_keys; i++) { dbgprintf("U: %d Uhel %f Osa [x = %f][y = %f][z = %f]", i, p_track->p_rot[i].angle * 180.0f / PI, p_track->p_rot[i].x, p_track->p_rot[i].y, p_track->p_rot[i].z); } } void dbg_print_track_quaternion(TRACK_INFO * p_track) { QUAT qa; word i; dbgprintf("Quat track...."); for (i = 0; i < p_track->rot_keys; i++) { key_rotkey_to_quat(p_track->p_rot + i, &qa); dbgprintf("A: %d Absolutne [x = %f][y = %f][z = %f][w = %f]", i, qa.x, qa.y, qa.z, qa.w); } } void dbg_print_track_abs(TRACK_INFO * p_track) { QUAT qa; word i; dbgprintf("Absolutni track..."); for (i = 0; i < p_track->rot_keys; i++) { qa = p_track->p_at[i]; dbgprintf("%d Absolutne [x = %f][y = %f][z = %f][w = %f]", i, qa.x, qa.y, qa.z, qa.w); } } void dbg_print_track_abs_uhel(TRACK_INFO * p_track) { QUAT qa; word i; dbgprintf("Absolutni uhlovy track..."); for (i = 0; i < p_track->rot_keys; i++) { quat_to_quat_angle(p_track->p_at + i, &qa); dbgprintf("U: %d Uhel %f Osa [x = %f][y = %f][z = %f]", i, qa.w * 180.0f / PI, qa.x, qa.y, qa.z); } } /*------------------------------------------------------------ Modifikonvane universalni fce. ------------------------------------------------------------ */ /* Pokud je frame klicem -> vrati jeho cislo, jinak K_CHYBA */ int key_je_frame_klic(KEY_POINT_BRS * p_list, int klicu, dword frame) { int l, p, s; dword time = frame * SIM_KONSTI; l = 0; p = klicu; if (!klicu || !p_list || time < p_list->time || time > p_list[klicu - 1].time) return (K_CHYBA); if (time == p_list->time) return (0); if (time == p_list[klicu - 1].time) return (klicu - 1); while (l != p) { // while(l < p) { s = l + ((p - l) >> 1); if (p_list[s].time == time) return (s); else { if (time > p_list[s].time) { if (time < p_list[s + 1].time) return (K_CHYBA); else l = s; } else p = s; } } return (K_CHYBA); } int key_je_time_klic(KEY_POINT_BRS * p_list, int klicu, dword time) { int l, p, s; l = 0; p = klicu; if (!klicu || !p_list || time < p_list->time || time > p_list[klicu - 1].time) return (K_CHYBA); if (time == p_list->time) return (0); if (time == p_list[klicu - 1].time) return (klicu - 1); while (l != p) { // while(l < p) { s = l + ((p - l) >> 1); if (p_list[s].time == time) return (s); else { if (time > p_list[s].time) { if (time < p_list[s + 1].time) return (K_CHYBA); else l = s; } else p = s; } } return (K_CHYBA); } // najde tento frame nebo nejblizsi levy klic inline static int key_najdi_klice(KEY_POINT_BRS * p_list, int klicu, dword time) { int l, p, s; l = 0; p = klicu; while (l != p) { s = l + ((p - l) >> 1); if (p_list[s].time == time) return (s); else { if (time > p_list[s].time) { if (time < p_list[s + 1].time) return (s); else l = s; } else p = s; } } return (K_CHYBA); } /* ---------------------- Interpolace floatu ---------------------- */ /* spocita tangentu k pozicnimu klici trida = 1 -> trida a = -1 -> trida b */ float key_tangent_float(float *p_body, KEY_POINT_BRS * p_keys, int kn, int keynum, int trida, int loop, float *p_tn) { float bias, continuity, tension; float t1, g1, g3; assert(kn < keynum); bias = p_keys[kn].bias; continuity = p_keys[kn].continuity; tension = p_keys[kn].tension; if (!kn) { if (keynum == 2) { *p_tn = (p_body[1] - p_body[0]) * (1.0f - tension); return (*p_tn); } else { if (loop) { // prvni klic g1 = (p_body[0] - p_body[keynum - 1]) * (1.0f + bias); g3 = (p_body[1] - p_body[0]) * (1.0f - bias) - g1; *p_tn = (g1 + g3 * (0.5f + trida * 0.5f * continuity)) * (1.0f - tension); } else { key_tangent_float(p_body, p_keys, 1, keynum, TRIDA_A, loop, &t1); *p_tn = ((p_body[kn + 1] - p_body[kn]) * 1.5f - t1 * 0.5f) * (1.0f - tension); } return (*p_tn); } } else if (kn == (keynum - 1)) { // konec - p(n-1), p(n) if (keynum == 2) { *p_tn = (p_body[kn] - p_body[kn - 1]) * (1.0f - tension); return (*p_tn); } else { if (loop) { // posledni klic g1 = (p_body[kn] - p_body[kn - 1]) * (1.0f + bias); g3 = (p_body[0] - p_body[kn]) * (1.0f - bias) - g1; *p_tn = (g1 + g3 * (0.5f + trida * 0.5f * continuity)) * (1.0f - tension); } else { key_tangent_float(p_body, p_keys, kn - 1, keynum, TRIDA_B, loop, &t1); *p_tn = ((p_body[kn] - p_body[kn - 1]) * 1.5f - t1 * 0.5f) * (1.0f - tension); } return (*p_tn); } } else { // stredni bod - mam p(n-1), p(n), p(n+1) g1 = (p_body[kn] - p_body[kn - 1]) * (1.0f + bias); g3 = (p_body[kn + 1] - p_body[kn]) * (1.0f - bias) - g1; *p_tn = (g1 + g3 * (0.5f + trida * 0.5f * continuity)) * (1.0f - tension); return (*p_tn); } } /* Prepocita kn, kn1, vraci t vraci: 0 - pouzit vse (kn,kn1,time) 1 - pouzit kn 2 - pouzit kn1 */ #define KN_ALL 0 //pouzit 2 klice + cas #define KN_KN 1 //pouzit klic 1 // Volat pouze pokud keynum > 1 !!! inline int key_track_prepocet_knt(KEY_POINT_BRS * p_keys, int keynum, int time, int endtime, int loop, int *p_kn, int *p_kn1, float *p_time) { int start, stop, k1; int dop, intrv; int t1, t2; k1 = keynum - 1; start = p_keys[0].time; stop = p_keys[k1].time; if (time > 2 * endtime) { time = endtime + time % endtime; } assert(time < 2 * endtime); if (time < start) { if (loop) { *p_kn = k1; *p_kn1 = 0; dop = endtime - stop; intrv = dop + start; *p_time = (intrv > DELTA_INTERVAL) ? (float) (time + dop) / (float) intrv : 0.0f; return (KN_ALL); } else { *p_kn = 0; return (KN_KN); } } else if (time >= stop) { if (loop) { *p_kn = k1; *p_kn1 = 0; // presah do dalsiho intervalu intrv = (endtime - stop) + start; *p_time = (intrv > DELTA_INTERVAL) ? (float) (time - stop) / (float) intrv : 0.0f; return (KN_ALL); } else { *p_kn = k1; return (KN_KN); } } else { if (keynum == 2) { *p_kn = 0; *p_kn1 = 1; t1 = p_keys[0].time; t2 = p_keys[1].time; } else { *p_kn = key_najdi_klice(p_keys, keynum, time); *p_kn1 = (*p_kn) + 1; t1 = p_keys[*p_kn].time; t2 = p_keys[*p_kn1].time; } *p_time = (float) (time - t1) / (float) (t2 - t1); return (KN_ALL); } } float key_track_interpolace_float(float *p_vysl, float *p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop) { float pt0, pt1; float t, t2, t3; int ret; int kn, kn1; if (keynum > 1) { ret = key_track_prepocet_knt(p_keys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { t2 = t * t; t3 = t2 * t; key_tangent_float(p_body, p_keys, kn, keynum, TRIDA_B, loop, &pt0); key_tangent_float(p_body, p_keys, kn1, keynum, TRIDA_A, loop, &pt1); return ((*p_vysl = p_body[kn] * (2 * t3 - 3 * t2 + 1) + pt0 * (t3 - 2 * t2 + t) + p_body[kn1] * (-2 * t3 + 3 * t2) + pt1 * (t3 - t2))); } else { return (*p_vysl = p_body[kn]); } } else { if (keynum) { return (*p_vysl = *p_body); } else return (FLT_MAX); } } float key_track_interpolace_float_linear(float *p_vysl, float *p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop) { float t, t2; int kn, kn1, ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_keys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { t2 = 1.0f - t; return (*p_vysl = p_body[kn] * t2 + p_body[kn1] * t); } else { return (*p_vysl = p_body[kn]); } } else { if (keynum) { return (*p_vysl = *p_body); } else return (FLT_MAX); } } /* ---------------------- Interpolace bodu ---------------------- */ /* spocita tangentu k pozicnimu klici trida = 1 -> trida a = -1 -> trida b */ BOD *key_tangent_bod(BOD * p_body, KEY_POINT_BRS * p_keys, int kn, int keynum, int trida, int loop, BOD * p_tn) { int kn_1 = kn - 1, // key k(n-1) kn1 = kn + 1; // key k(n+1) float bias, continuity, tension, tmp, tmp2; BOD *p_p0, *p_p1, *p_p2, t1, g1, g2, g3; bias = p_keys[kn].bias; continuity = p_keys[kn].continuity; tension = p_keys[kn].tension; if (!kn) { //kn = 0, zacatek - mam p(n), p(n+1) p_p1 = p_body + kn; p_p2 = p_body + kn1; if (keynum == 2) { //track ma jen 2 klice //b0 = (p1-p0)*(1-T) tmp = 1.0f - tension; p_tn->x = (p_p2->x - p_p1->x) * tmp; p_tn->y = (p_p2->y - p_p1->y) * tmp; p_tn->z = (p_p2->z - p_p1->z) * tmp; return (p_tn); } else { // zacatecni tangenta if (loop) { p_p0 = p_body + keynum - 1; } else { // trak ma vice klicu key_tangent_bod(p_body, p_keys, 1, keynum, TRIDA_A, loop, &t1); // b0 = ((p1 - p0)*1.5 - a1*0.5)*(1-T) tmp = 1.0f - tension; p_tn->x = ((p_p2->x - p_p1->x) * 1.5f - t1.x * 0.5f) * tmp; p_tn->y = ((p_p2->y - p_p1->y) * 1.5f - t1.y * 0.5f) * tmp; p_tn->z = ((p_p2->z - p_p1->z) * 1.5f - t1.z * 0.5f) * tmp; return (p_tn); } } } else if (kn == (keynum - 1)) { // konec - p(n-1), p(n) p_p0 = p_body + kn_1; p_p1 = p_body + kn; if (keynum == 2) { //track ma jen 2 klice //a1 = (p1-p0)*(1-T) tmp = 1.0f - tension; p_tn->x = (p_p1->x - p_p0->x) * tmp; p_tn->y = (p_p1->y - p_p0->y) * tmp; p_tn->z = (p_p1->z - p_p0->z) * tmp; return (p_tn); } else { if (loop) { // koncova tangenta p_p2 = p_body; } else { // bez opakovani key_tangent_bod(p_body, p_keys, kn_1, keynum, TRIDA_B, loop, &t1); // an = ((pn - p(n-1))*1.5 - b(n-1)*0.5)*(1-T) tmp = 1.0f - tension; p_tn->x = ((p_p1->x - p_p0->x) * 1.5f - t1.x * 0.5f) * tmp; p_tn->y = ((p_p1->y - p_p0->y) * 1.5f - t1.y * 0.5f) * tmp; p_tn->z = ((p_p1->z - p_p0->z) * 1.5f - t1.z * 0.5f) * tmp; return (p_tn); } } } else { // stredni bod - mam p(n-1), p(n), p(n+1) p_p0 = p_body + kn_1; p_p1 = p_body + kn; p_p2 = p_body + kn1; } // g1 = (pn - p(n-1))*(1+B) tmp = 1.0f + bias; g1.x = (p_p1->x - p_p0->x) * tmp; g1.y = (p_p1->y - p_p0->y) * tmp; g1.z = (p_p1->z - p_p0->z) * tmp; // g2 = (p(n+1) - pn)*(1-B) tmp = 1.0f - bias; g2.x = (p_p2->x - p_p1->x) * tmp; g2.y = (p_p2->y - p_p1->y) * tmp; g2.z = (p_p2->z - p_p1->z) * tmp; // g3 = g2 - g1, vektor_sub(&g2, &g1, &g3); /* tangent case a: an = (g1 + g3*(0.5 + 0.5*C))*(1-T), tangent case b: bn = (g1 + g3*(0.5 - 0.5*C))*(1-T). */ tmp = 1.0f - tension; tmp2 = 0.5f + trida * 0.5f * continuity; p_tn->x = (g1.x + g3.x * tmp2) * tmp; p_tn->y = (g1.y + g3.y * tmp2) * tmp; p_tn->z = (g1.z + g3.z * tmp2) * tmp; return (p_tn); } BOD *key_track_interpolace_bod(BOD * p_vysl, BOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop) { BOD *p0, *p1, pt0, pt1; float F1, F2, F3, F4; float t, t2, t3; int kn, kn1; int ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_keys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { t2 = t * t; t3 = t2 * t; key_tangent_bod(p_body, p_keys, kn, keynum, TRIDA_B, loop, &pt0); key_tangent_bod(p_body, p_keys, kn1, keynum, TRIDA_A, loop, &pt1); p0 = p_body + kn; p1 = p_body + kn1; F1 = 2 * t3 - 3 * t2 + 1; F2 = t3 - 2 * t2 + t; F3 = -2 * t3 + 3 * t2; F4 = t3 - t2; p_vysl->x = p0->x * F1 + pt0.x * F2 + p1->x * F3 + pt1.x * F4; p_vysl->y = p0->y * F1 + pt0.y * F2 + p1->y * F3 + pt1.y * F4; p_vysl->z = p0->z * F1 + pt0.z * F2 + p1->z * F3 + pt1.z * F4; } else { *p_vysl = p_body[kn]; } } else { if (keynum) { *p_vysl = *p_body; } } return (p_vysl); } BOD *key_track_interpolace_bod_linear(BOD * p_vysl, BOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop) { BOD *p_p0, *p_p1; float t, t2; int kn, kn1; int ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_keys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { t2 = 1.0f - t; p_p0 = p_body + kn; p_p1 = p_body + kn1; p_vysl->x = p_p0->x * t2 + p_p1->x * t; p_vysl->y = p_p0->y * t2 + p_p1->y * t; p_vysl->z = p_p0->z * t2 + p_p1->z * t; } else { *p_vysl = p_body[kn]; } } else { if (keynum) { *p_vysl = *p_body; } } return (p_vysl); } /* --------------------------- Interpolace ctyr-bodu --------------------------- */ /* spocita tangentu k pozicnimu klici trida = 1 -> trida a = -1 -> trida b */ WBOD *key_tangent_wbod(WBOD * p_body, KEY_POINT_BRS * p_keys, int kn, int keynum, int trida, int loop, WBOD * p_tn) { int kn_1 = kn - 1, // key k(n-1) kn1 = kn + 1; // key k(n+1) float bias, continuity, tension, tn1, bp1; WBOD *p_p0, *p_p1, *p_p2, t1, g1, g2, g3; bias = p_keys[kn].bias; continuity = p_keys[kn].continuity; tension = p_keys[kn].tension; if (!kn) { //kn = 0, zacatek - mam p(n), p(n+1) p_p1 = p_body + kn; p_p2 = p_body + kn1; if (keynum == 2) { //track ma jen 2 klice //b0 = (p1-p0)*(1-T) tn1 = (1.0f - tension); p_tn->x = (p_p2->x - p_p1->x) * tn1; p_tn->y = (p_p2->y - p_p1->y) * tn1; p_tn->z = (p_p2->z - p_p1->z) * tn1; p_tn->w = (p_p2->w - p_p1->w) * tn1; return (p_tn); } else { if (loop) { p_p0 = p_body + keynum - 1; } else { // trak ma vice klicu key_tangent_wbod(p_body, p_keys, 1, keynum, TRIDA_A, loop, &t1); tn1 = (1.0f - tension); // b0 = ((p1 - p0)*1.5 - a1*0.5)*(1-T) p_tn->x = ((p_p2->x - p_p1->x) * 1.5f - t1.x * 0.5f) * tn1; p_tn->y = ((p_p2->y - p_p1->y) * 1.5f - t1.y * 0.5f) * tn1; p_tn->z = ((p_p2->z - p_p1->z) * 1.5f - t1.z * 0.5f) * tn1; p_tn->w = ((p_p2->w - p_p1->w) * 1.5f - t1.w * 0.5f) * tn1; return (p_tn); } } } else if (kn == (keynum - 1)) { // konec - p(n-1), p(n) p_p0 = p_body + kn_1; p_p1 = p_body + kn; if (keynum == 2) { //track ma jen 2 klice //a1 = (p1-p0)*(1-T) tn1 = (1.0f - tension); p_tn->x = (p_p1->x - p_p0->x) * tn1; p_tn->y = (p_p1->y - p_p0->y) * tn1; p_tn->z = (p_p1->z - p_p0->z) * tn1; p_tn->w = (p_p1->w - p_p0->w) * tn1; return (p_tn); } else { if (loop) { p_p2 = p_body; } else { // bez opakovani key_tangent_wbod(p_body, p_keys, kn_1, keynum, TRIDA_B, loop, &t1); // an = ((pn - p(n-1))*1.5 - b(n-1)*0.5)*(1-T) tn1 = (1.0f - tension); p_tn->x = ((p_p1->x - p_p0->x) * 1.5f - t1.x * 0.5f) * tn1; p_tn->y = ((p_p1->y - p_p0->y) * 1.5f - t1.y * 0.5f) * tn1; p_tn->z = ((p_p1->z - p_p0->z) * 1.5f - t1.z * 0.5f) * tn1; p_tn->w = ((p_p1->w - p_p0->w) * 1.5f - t1.w * 0.5f) * tn1; return (p_tn); } } } else { // stredni bod - mam p(n-1), p(n), p(n+1) p_p0 = p_body + kn_1; p_p1 = p_body + kn; p_p2 = p_body + kn1; } bp1 = 1.0f + bias; // g1 = (pn - p(n-1))*(1+B) g1.x = (p_p1->x - p_p0->x) * bp1; g1.y = (p_p1->y - p_p0->y) * bp1; g1.z = (p_p1->z - p_p0->z) * bp1; g1.w = (p_p1->w - p_p0->w) * bp1; // g2 = (p(n+1) - pn)*(1-B) g2.x = (p_p2->x - p_p1->x) * bp1; g2.y = (p_p2->y - p_p1->y) * bp1; g2.z = (p_p2->z - p_p1->z) * bp1; g2.w = (p_p2->w - p_p1->w) * bp1; // g3 = g2 - g1, wvektor_sub(&g2, &g1, &g3); /* tangent case a: an = (g1 + g3*(0.5 + 0.5*C))*(1-T), tangent case b: bn = (g1 + g3*(0.5 - 0.5*C))*(1-T). */ tn1 = (1.0f - tension); bp1 = (0.5f + trida * 0.5f * continuity); p_tn->x = (g1.x + g3.x * bp1) * tn1; p_tn->y = (g1.y + g3.y * bp1) * tn1; p_tn->z = (g1.z + g3.z * bp1) * tn1; p_tn->w = (g1.w + g3.w * bp1) * tn1; return (p_tn); } WBOD *key_track_interpolace_wbod(WBOD * p_vysl, WBOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop) { WBOD *p0, *p1, pt0, pt1; float F1, F2, F3, F4; float t, t2, t3; int kn, kn1; int ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_keys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { t2 = t * t; t3 = t2 * t; key_tangent_wbod(p_body, p_keys, kn, keynum, TRIDA_B, loop, &pt0); key_tangent_wbod(p_body, p_keys, kn1, keynum, TRIDA_A, loop, &pt1); p0 = p_body + kn; p1 = p_body + kn1; F1 = 2 * t3 - 3 * t2 + 1; F2 = t3 - 2 * t2 + t; F3 = -2 * t3 + 3 * t2; F4 = t3 - t2; p_vysl->x = p0->x * F1 + pt0.x * F2 + p1->x * F3 + pt1.x * F4; p_vysl->y = p0->y * F1 + pt0.y * F2 + p1->y * F3 + pt1.y * F4; p_vysl->z = p0->z * F1 + pt0.z * F2 + p1->z * F3 + pt1.z * F4; p_vysl->w = p0->w * F1 + pt0.w * F2 + p1->w * F3 + pt1.w * F4; } else { *p_vysl = p_body[kn]; } } else { if (keynum) { *p_vysl = *p_body; } } return (p_vysl); } WBOD *key_track_interpolace_wbod_linear(WBOD * p_vysl, WBOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop) { WBOD *p_p0, *p_p1; float t, t2; int kn, kn1; int ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_keys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { t2 = 1.0f - t; p_p0 = p_body + kn; p_p1 = p_body + kn1; p_vysl->x = p_p0->x * t2 + p_p1->x * t; p_vysl->y = p_p0->y * t2 + p_p1->y * t; p_vysl->z = p_p0->z * t2 + p_p1->z * t; p_vysl->w = p_p0->w * t2 + p_p1->w * t; } else { *p_vysl = p_body[kn]; } } else { if (keynum) { *p_vysl = *p_body; } } return (p_vysl); } /* --------------------------- Interpolace Quaternionu --------------------------- */ QUAT *key_tangent_quat(QUAT * p_at, KEY_POINT_BRS * p_rkeys, int kn, int keynum, int trida, int loop, QUAT * p_q) { int kn_1 = kn - 1, // key k(n-1) kn1 = kn + 1; // key k(n+1) float bias, continuity, tension; QUAT q0, /*q1, */ q2, g1, g2, g3; bias = p_rkeys[kn].bias; continuity = p_rkeys[kn].continuity; tension = p_rkeys[kn].tension; if (!kn) { //kn = 0, zacatek - mam p(n), p(n+1) if (keynum == 2) { //track ma jen 2 klice return (slerp(p_at + kn, p_at + kn1, (1.0f - tension) / 3.0f, p_q)); } else { // prvni body (-1,0,1) if (loop) { return (slerp(p_at + kn, slerp(slerp(p_at + kn, p_at + keynum - 1, -(1 + bias) / 3.0f, &g1), slerp(p_at + kn, p_at + kn1, (1 - bias) / 3.0f, &g2), 0.5f + trida * 0.5f * continuity, &g3), trida * (tension - 1.0f), p_q)); } else { key_tangent_quat(p_at, p_rkeys, kn1, keynum, TRIDA_B, loop, &q2); return (slerp(p_at + kn, &q2, (1.0f - tension) * 0.5f, p_q)); } } } else if (kn == (int) keynum - 1) { // konec - p(n-1), p(n) if (keynum == 2) { //track ma jen 2 klice return (slerp(p_at + kn, p_at + kn_1, (1.0f - tension) / 3.0f, p_q)); } else { // posledni body bez opakovani if (loop) { // posledni (-2,-1,0) return (slerp(p_at + kn, slerp(slerp(p_at + kn, p_at + kn_1, -(1 + bias) / 3.0f, &g1), slerp(p_at + kn, p_at, (1 - bias) / 3.0f, &g2), 0.5f + trida * 0.5f * continuity, &g3), trida * (tension - 1.0f), p_q)); } else { key_tangent_quat(p_at, p_rkeys, kn_1, keynum, TRIDA_A, loop, &q0); return (slerp(p_at + kn, &q0, (1.0f - tension) * 0.5f, p_q)); } } } else { // stredni bod - mam q(n-1), q(n), q(n+1) return (slerp(p_at + kn, slerp(slerp(p_at + kn, p_at + kn_1, -(1 + bias) / 3.0f, &g1), slerp(p_at + kn, p_at + kn1, (1 - bias) / 3.0f, &g2), 0.5f + trida * 0.5f * continuity, &g3), trida * (tension - 1.0f), p_q)); } } QUAT *key_track_interpolace_quat(QUAT * p_quat, QUAT * p_at, KEY_POINT_BRS * p_rkeys, int time, int endtime, int keynum, int loop) { QUAT q0, q1, q2; QUAT qn, qn1; QUAT bn, an; int kn, kn1; float t; int ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_rkeys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { assert(0.0f <= t && t <= 1.0f); key_tangent_quat(p_at, p_rkeys, kn, keynum, TRIDA_B, loop, &bn); key_tangent_quat(p_at, p_rkeys, kn1, keynum, TRIDA_A, loop, &an); qn = p_at[kn]; qn1 = p_at[kn1]; slerp(&qn, &bn, t, &q0); slerp(&bn, &an, t, &q1); slerp(&an, &qn1, t, &q2); slerp(&q0, &q1, t, &qn); slerp(&q1, &q2, t, &qn1); return (slerp(&qn, &qn1, t, p_quat)); } else { *p_quat = p_at[kn]; return (p_quat); } } else { if (keynum) { *p_quat = *p_at; return (p_quat); } else return (NULL); } } QUAT *key_track_interpolace_quat_linear(QUAT * p_quat, QUAT * p_at, KEY_POINT_BRS * p_rkeys, int time, int endtime, int keynum, int loop) { int kn, kn1; float t; int ret; if (keynum > 1) { ret = key_track_prepocet_knt(p_rkeys, keynum, time, endtime, loop, &kn, &kn1, &t); if (ret == KN_ALL) { assert(0.0f <= t && t <= 1.0f); return (slerp(p_at + kn, p_at + kn1, t, p_quat)); } else { *p_quat = p_at[kn]; return (p_quat); } } else { if (keynum) { *p_quat = *p_at; return (p_quat); } else return (NULL); } } /* Pole hodnot o velikosti size_of_hodnota*keynum, p_keys*size_of_hodnota najdu frame a vlozim to tam */ int key_track_klic_vloz(byte ** p_hodnoty, KEY_POINT_BRS ** p_skeys, int keynum, int size_of_hodnota, byte * p_new_hodnota, KEY_POINT_BRS * p_new_keys) { KEY_POINT_BRS *p_nkeys; byte *p_nhod; KEY_POINT_BRS *p_keys = *p_skeys; byte *p_hod = *p_hodnoty; int i, j; dword new_time = p_new_keys->time; p_nhod = (byte *) mmalloc(size_of_hodnota * (keynum + 1)); p_nkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_nkeys[0]) * (keynum + 1)); // Vlozit pred nulovym framem if (keynum && new_time < p_keys[0].time) { p_nkeys[0] = *p_new_keys; memcpy(p_nhod, p_new_hodnota, size_of_hodnota); memcpy(p_nkeys + 1, p_keys, sizeof(p_nkeys[0]) * keynum); memcpy(p_nhod + size_of_hodnota, p_hod, size_of_hodnota * keynum); // Vlozit za nulovym framem } else if (!keynum || p_keys[keynum - 1].time < new_time) { memcpy(p_nkeys, p_keys, sizeof(p_nkeys[0]) * keynum); memcpy(p_nhod, p_hod, size_of_hodnota * keynum); p_nkeys[keynum] = *p_new_keys; memcpy(p_nhod + keynum * size_of_hodnota, p_new_hodnota, size_of_hodnota); } else { // kopie vseho bez noveho framu for (i = 0, j = 0; i < keynum; i++, j++) { if (p_keys[i].time <= new_time && new_time < p_keys[i + 1].time) { p_nkeys[j] = p_keys[i]; memcpy(p_nhod + j * size_of_hodnota, p_hod + i * size_of_hodnota, size_of_hodnota); j++; p_nkeys[j] = *p_new_keys; memcpy(p_nhod + j * size_of_hodnota, p_new_hodnota, size_of_hodnota); } else { p_nkeys[j] = p_keys[i]; memcpy(p_nhod + j * size_of_hodnota, p_hod + i * size_of_hodnota, size_of_hodnota); } } } free(p_keys); free(p_hod); *p_hodnoty = p_nhod; *p_skeys = p_nkeys; return (keynum + 1); } // Automaticke vlozeni klice do seznamu int key_track_klic_vloz_auto(byte ** p_hodnoty, KEY_POINT_BRS ** p_skeys, int keynum, int size_of_hodnota, byte * p_new_hodnota, KEY_POINT_BRS * p_new_keys) { int klic; if ((klic = key_je_frame_klic(*p_skeys, keynum, p_new_keys->time)) == K_CHYBA) { return (key_track_klic_vloz(p_hodnoty, p_skeys, keynum, size_of_hodnota, p_new_hodnota, p_new_keys)); } else { memcpy((*p_skeys) + klic, p_new_keys, sizeof(p_new_keys[0])); memcpy((*p_hodnoty) + klic * size_of_hodnota, p_new_hodnota, size_of_hodnota); return (keynum); } } int key_track_klic_smaz(byte ** p_hodnoty, KEY_POINT_BRS ** p_skeys, int *p_keynum, int size_of_hodnota, dword del_time) { KEY_POINT_BRS *p_nkeys; byte *p_nhod; KEY_POINT_BRS *p_keys = *p_skeys; byte *p_hod = *p_hodnoty; int i, j, keynum = *p_keynum; if (keynum == 1) { null_free((void **) p_hodnoty); null_free((void **) p_skeys); return ((*p_keynum = 0)); } else { p_nhod = (byte *) mmalloc(size_of_hodnota * (keynum - 1)); p_nkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_nkeys[0]) * (keynum - 1)); if (p_keys[keynum - 1].time == del_time) { memcpy(p_nkeys, p_keys, sizeof(p_nkeys[0]) * (keynum - 1)); memcpy(p_nhod, p_hod, size_of_hodnota * (keynum - 1)); } else { // kopie vseho bez noveho framu for (i = 0, j = 0; i < keynum; i++, j++) { if (p_keys[i].time != del_time) { p_nkeys[j] = p_keys[i]; memcpy(p_nhod + j * size_of_hodnota, p_hod + i * size_of_hodnota, size_of_hodnota); } else { j--; } } } free(p_keys); free(p_hod); *p_hodnoty = p_nhod; *p_skeys = p_nkeys; return ((*p_keynum)--); } } /***************************************************************************** Key-frame animace ***************************************************************************** */ void key_pivot_sub(EDIT_OBJEKT * p_obj, BOD * p_pivot) { int v; for (v = 0; v < p_obj->vertexnum; v++) { p_obj->p_vertex[v].x -= p_pivot->x; p_obj->p_vertex[v].y -= p_pivot->y; p_obj->p_vertex[v].z -= p_pivot->z; } } void key_tri_to_matrix_zero(GLMATRIX * p_m, HIERARCHY_TRACK_INFO * p_track) { if (p_track) { init_matrix(p_m); if (p_track->rot_keys) quat_to_matrix(p_m, p_track->p_at); if (p_track->scs_keys) { scale_matrix(p_m, p_track->p_scale[0].x, p_track->p_scale[0].y, p_track->p_scale[0].z); } if (p_track->pos_keys) { p_m->_41 = p_track->p_pos[0].x; p_m->_42 = p_track->p_pos[0].y; p_m->_43 = p_track->p_pos[0].z; } } } static int key_konec_prochazeni; /* Rekurzivne prida tri do tri-stromu */ static void key_tri_node_pridej(HIERARCHY_TRACK_INFO * p_tri, HIERARCHY_TRACK_INFO * p_child) { int i; if (key_konec_prochazeni) return; if (p_tri->objnum == p_child->parentnum) { key_tri_child_pridej(p_tri, p_child); key_konec_prochazeni = TRUE; } else { for (i = 0; i < p_tri->childnum && !key_konec_prochazeni; i++) { key_tri_node_pridej(p_tri->p_child[i], p_child); } } } /* rekurzivne prida tri node do rootu */ static void key_root_node_pridej(HIERARCHY_ROOT * p_root, HIERARCHY_TRACK_INFO * p_child) { int i; if (p_child->parentnum == ROOT_NODE) { key_root_child_pridej(p_root, p_child); key_konec_prochazeni = TRUE; } else { for (i = 0; i < p_root->childnum && !key_konec_prochazeni; i++) key_tri_node_pridej(p_root->p_child[i], p_child); } } /* vyrobi root animacni strom */ HIERARCHY_ROOT *key_root_vyrob_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_ROOT * p_root) { HIERARCHY_TRACK_INFO *p_tri; TRACK_INFO *p_track; EDIT_OBJEKT *p_obj; //int objnum = p_kont->objektu; int o; // nastaveni zakladnich veci for (o = 0; o < p_kont->max_objektu; o++) { if (p_kont->p_obj[o] && p_kont->p_obj[o]->p_track) break; } if (o >= p_kont->max_objektu) { //assert(0); return (NULL); } p_track = p_kont->p_obj[o]->p_track; p_root->framenum = p_track->framenum; p_root->delka = (float) p_root->framenum / (float) FRAMU_PER_SEC; // kopie vsech tracku + provazani objektu se scenou for (o = 0; o < p_kont->max_objektu; o++) { p_obj = p_kont->p_obj[o]; if (p_obj && (p_track = p_obj->p_track)) { // pokud tento objekt ma track p_tri = key_track_to_tri(p_obj->p_track); p_tri->p_obj = p_obj; key_zrus_track(&p_obj->p_track); key_konec_prochazeni = FALSE; key_root_node_pridej(p_root, p_tri); assert(key_konec_prochazeni); } } return (p_root); } static float key_najdi_otcovy_scaly(HIERARCHY_TRACK_INFO * p_track) { if (p_track->p_otec == NULL) return ((p_track->scs_keys) ? p_track->p_scale[0].x : 1.0f); else return ((p_track->scs_keys) ? p_track->p_scale[0].x * key_najdi_otcovy_scaly(p_track->p_otec) : key_najdi_otcovy_scaly(p_track->p_otec)); } static void key_tri_to_local(HIERARCHY_TRACK_INFO * p_track) { EDIT_OBJEKT *p_obj; GLMATRIX m; int i; p_obj = (EDIT_OBJEKT *) p_track->p_obj; if (key_najdi_otcovy_scaly(p_track) < 0.0f) scale_matrix(&p_obj->m, -1.0f, 1.0f, 1.0f); // proval to matici a jedeme transformuj_objekt_matici(p_obj, invert_matrix(&p_obj->m, &m)); if (p_track->childnum == 1) { key_tri_to_local(p_track->p_child[0]); } else { for (i = 0; i < p_track->childnum; i++) { key_tri_to_local(p_track->p_child[i]); } } } /* static void key_tri_to_local(HIERARCHY_TRACK_INFO *p_track) { EDIT_OBJEKT *p_obj; int i; p_obj = (EDIT_OBJEKT *)p_track->p_obj; if(key_najdi_otcovy_scaly(p_track) < 0.0f) { //scale_matrix(&p_obj->local_matrix,-1.0f,1.0f,1.0f); } if(p_track->childnum == 1) { key_tri_to_local(p_track->p_child[0]); } else { for(i = 0; i < p_track->childnum; i++) { key_tri_to_local(p_track->p_child[i]); } } } */ static void key_tri_to_world(HIERARCHY_TRACK_INFO * p_track) { EDIT_OBJEKT *p_obj, *p_otec; int i; p_obj = (EDIT_OBJEKT *) p_track->p_obj; key_tri_to_matrix_zero(&p_obj->m, p_track); if (p_track->p_otec) { p_otec = (EDIT_OBJEKT *) p_track->p_otec->p_obj; mat_mult(&p_obj->m, &p_otec->m, &p_obj->m); } pivotuj_matrix_tam(&p_track->pivot, &p_obj->m); if (p_track->childnum == 1) { key_tri_to_world(p_track->p_child[0]); } else { for (i = 0; i < p_track->childnum; i++) { key_tri_to_world(p_track->p_child[i]); } } } /* static void key_tri_to_world(HIERARCHY_TRACK_INFO *p_track) { EDIT_OBJEKT *p_obj,*p_otec; int i; p_obj = (EDIT_OBJEKT *)p_track->p_obj; //key_tri_to_matrix_zero(&p_obj->m, p_track); if(p_track->p_otec) { p_otec = (EDIT_OBJEKT *)p_track->p_otec->p_obj; mat_mult(&p_obj->m,&p_otec->m,&p_obj->m); } // pivotuj_matrix_tam(&p_track->pivot,&p_obj->m); if(p_track->childnum == 1) { key_tri_to_world(p_track->p_child[0]); } else { for(i = 0; i < p_track->childnum; i++) { key_tri_to_world(p_track->p_child[i]); } } } */ /* Prevede root do nulove vychozi pozice */ void key_root_to_zero(HIERARCHY_ROOT * p_root) { int i; for (i = 0; i < p_root->childnum; i++) { key_tri_to_local(p_root->p_child[i]); key_tri_to_world(p_root->p_child[i]); } } /* rekurzivni animace stromu/objektu - predavat i horni matici -> jako horni matice 0 je word-matrix ! */ void key_tri_to_matrix(HIERARCHY_TRACK_INFO * p_track, int time, GLMATRIX * p_otec, int loop) { EDIT_OBJEKT *p_obj; GLMATRIX m; QUAT q; BOD p; int i; // spocitej hierarchii p_obj = (EDIT_OBJEKT *) p_track->p_obj; // spocitej pozici + ostatni veci init_matrix(&m); if (p_track->p_pos) { key_track_interpolace_bod(&p, p_track->p_pos, p_track->p_pkeys, time, p_track->endtime, p_track->pos_keys, loop); m._41 = p.x; m._42 = p.y; m._43 = p.z; } if (p_track->p_at) { key_track_interpolace_quat(&q, p_track->p_at, p_track->p_rkeys, time, p_track->endtime, p_track->rot_keys, loop); quat_to_matrix(&m, &q); } if (p_track->p_scale) { key_track_interpolace_bod(&p, p_track->p_scale, p_track->p_skeys, time, p_track->endtime, p_track->scs_keys, loop); m._11 *= p.x; m._21 *= p.x; m._31 *= p.x; m._12 *= p.y; m._22 *= p.y; m._32 *= p.y; m._13 *= p.z; m._23 *= p.z; m._33 *= p.z; } if (p_track->p_at) { pivotuj_matrix_tam(&p_track->pivot, &m); } // spocitej hierarchii p_obj = (EDIT_OBJEKT *) p_track->p_obj; mat_mult(&m, p_otec, &p_obj->m); // aktualni*otec => vysledek if (p_track->childnum == 1) { key_tri_to_matrix(p_track->p_child[0], time, &p_obj->m, loop); } else { for (i = 0; i < p_track->childnum; i++) { key_tri_to_matrix(p_track->p_child[i], time, &p_obj->m, loop); } } } /* void key_tri_to_matrix(HIERARCHY_TRACK_INFO *p_track, int time, GLMATRIX *p_otec, int loop) { EDIT_OBJEKT *p_obj; GLMATRIX m; QUAT q; BOD p; int i; // spocitej hierarchii p_obj = (EDIT_OBJEKT *)p_track->p_obj; // spocitej pozici + ostatni veci init_matrix(&m); if(p_track->p_pos) { key_track_interpolace_bod(&p,p_track->p_pos,p_track->p_pkeys,time,p_track->endtime,p_track->pos_keys,loop); m._41 = p.x; m._42 = p.y; m._43 = p.z; } if(p_track->p_at) { key_track_interpolace_quat(&q,p_track->p_at,p_track->p_rkeys,time,p_track->endtime,p_track->rot_keys,loop); quat_to_matrix(&m,&q); } if(p_track->p_scale) { key_track_interpolace_bod(&p,p_track->p_scale,p_track->p_skeys,time,p_track->endtime,p_track->scs_keys,loop); scale_matrix(&m,p.x,p.y,p.z); } // spocitej hierarchii p_obj = (EDIT_OBJEKT *)p_track->p_obj; mat_mult(&m,p_otec,&m); // aktualni*otec => vysledek p_obj->m = m; pivotuj_matrix_tam(&p_track->pivot,&p_obj->m); mat_mult(&p_obj->local_matrix,&p_obj->m,&p_obj->m); if(p_track->childnum == 1) { key_tri_to_matrix(p_track->p_child[0], time, &m, loop); } else { for(i = 0; i < p_track->childnum; i++) { key_tri_to_matrix(p_track->p_child[i], time, &m, loop); } } } */ void key_root_to_matrix(HIERARCHY_ROOT * p_root, int time, GLMATRIX * p_otec) { GLMATRIX m; int i; if (!p_otec) { p_otec = init_matrix(&m); } for (i = 0; i < p_root->childnum; i++) key_tri_to_matrix(p_root->p_child[i], time, p_otec, p_root->flag & GK_LOOP); } // track veci TRACK_INFO *key_track_vyrob(int poskey, int rotkey, int scalekey) { TRACK_INFO *p_track; p_track = (TRACK_INFO *) mmalloc(sizeof(TRACK_INFO)); // pozicni klice p_track->pos_keys = poskey; p_track->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_pkeys[0]) * poskey); p_track->p_pos = (BOD *) mmalloc(sizeof(BOD) * poskey); // rotacni klice p_track->rot_keys = rotkey; p_track->p_rkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_rkeys[0]) * rotkey); p_track->p_rot = (ROTKEY *) mmalloc(sizeof(ROTKEY) * rotkey); p_track->p_at = (QUAT *) mmalloc(sizeof(p_track->p_at[0]) * rotkey); // scalovaci klice p_track->scs_keys = scalekey; p_track->p_skeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_skeys[0]) * scalekey); p_track->p_scale = (BOD *) mmalloc(sizeof(BOD) * scalekey); return (p_track); } HIERARCHY_TRACK_INFO *key_tri_vyrob_indir(HIERARCHY_TRACK_INFO * p_hir, int poskey, int rotkey, int scalekey) { memset((void *) p_hir, 0, sizeof(p_hir[0])); // pozicni klice if ((p_hir->pos_keys = poskey)) { p_hir->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_hir->p_pkeys[0]) * poskey); p_hir->p_pos = (BOD *) mmalloc(sizeof(BOD) * poskey); } // rotacni klice if ((p_hir->rot_keys = rotkey)) { p_hir->p_rkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_hir->p_rkeys[0]) * rotkey); p_hir->p_at = (QUAT *) mmalloc(sizeof(p_hir->p_at[0]) * rotkey); } // scalovaci klice if ((p_hir->scs_keys = scalekey)) { p_hir->p_scale = (BOD *) mmalloc(sizeof(BOD) * scalekey); p_hir->p_skeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_hir->p_skeys[0]) * scalekey); } return (p_hir); } HIERARCHY_TRACK_INFO *key_tri_vyrob(int poskey, int rotkey, int scalekey) { HIERARCHY_TRACK_INFO *p_hir; p_hir = (HIERARCHY_TRACK_INFO *) mmalloc(sizeof(HIERARCHY_TRACK_INFO)); key_tri_vyrob_indir(p_hir, poskey, rotkey, scalekey); return (p_hir); } HIERARCHY_TRACK_INFO *key_tri_vyrob_un_indir(void) { HIERARCHY_TRACK_INFO *p_hir; p_hir = (HIERARCHY_TRACK_INFO *) mmalloc(sizeof(HIERARCHY_TRACK_INFO)); return (p_hir); } // kopie tracku HIERARCHY_TRACK_INFO *key_track_to_tri(TRACK_INFO * p_track) { HIERARCHY_TRACK_INFO *p_tri = key_tri_vyrob(p_track->pos_keys, p_track->rot_keys, p_track->scs_keys); p_tri->objnum = p_track->objekt; p_tri->parentnum = p_track->parent; p_tri->pivot = p_track->pivot; p_tri->endtime = calc_endtime(p_track->framenum); if (p_track->pos_keys) { memcpy(p_tri->p_pkeys, p_track->p_pkeys, sizeof(p_track->p_pkeys[0]) * p_track->pos_keys); memcpy(p_tri->p_pos, p_track->p_pos, sizeof(p_track->p_pos[0]) * p_track->pos_keys); } if (p_track->rot_keys) { memcpy(p_tri->p_rkeys, p_track->p_rkeys, sizeof(p_track->p_rkeys[0]) * p_track->rot_keys); memcpy(p_tri->p_at, p_track->p_at, sizeof(p_track->p_at[0]) * p_track->rot_keys); } if (p_track->scs_keys) { memcpy(p_tri->p_skeys, p_track->p_skeys, sizeof(p_track->p_skeys[0]) * p_track->scs_keys); memcpy(p_tri->p_scale, p_track->p_scale, sizeof(p_track->p_scale[0]) * p_track->scs_keys); } return (p_tri); } void key_zrus_track(TRACK_INFO ** p_track) { TRACK_INFO *p_tri = *p_track; null_free((void **) &p_tri->p_pkeys); null_free((void **) &p_tri->p_pos); null_free((void **) &p_tri->p_rkeys); null_free((void **) &p_tri->p_rot); null_free((void **) &p_tri->p_at); null_free((void **) &p_tri->p_skeys); null_free((void **) &p_tri->p_scale); null_free((void **) &p_tri); *p_track = NULL; } // prida child do track_node void key_tri_child_pridej(HIERARCHY_TRACK_INFO * p_root, HIERARCHY_TRACK_INFO * p_child) { p_root->childnum += 1; p_root->p_child = (HIERARCHY_TRACK_INFO **) realloc(p_root->p_child, sizeof(p_root->p_child[0]) * p_root->childnum); p_root->p_child[p_root->childnum - 1] = p_child; p_child->p_otec = p_root; } // prida child do root_node void key_root_child_pridej(HIERARCHY_ROOT * p_root, HIERARCHY_TRACK_INFO * p_child) { p_root->childnum += 1; p_root->p_child = (HIERARCHY_TRACK_INFO **) realloc(p_root->p_child, sizeof(p_root->p_child[0]) * p_root->childnum); p_root->p_child[p_root->childnum - 1] = p_child; p_child->p_otec = NULL; } void key_tri_calc_absolutne(TRACK_INFO * p_track, QUAT * p_puvodni) { QUAT q(0, 0, 0, 1); word i; if (p_track->rot_keys) { if (!p_track->p_at) { p_track->p_at = (QUAT *) mmalloc(sizeof(p_track->p_at[0]) * p_track->rot_keys); } key_rotkey_to_quat(p_track->p_rot, p_track->p_at); for (i = 1; i < p_track->rot_keys; i++) { quat_mult(key_rotkey_to_quat(p_track->p_rot + i, &q), p_track->p_at + (i - 1), p_track->p_at + i); } } } void key_sim_calc_absolutne(SIMPLE_TRACK_INFO * p_sim) { QUAT q(0, 0, 0, 1), qz; int i, il; if (p_sim->p_at) { for (i = 0; i < p_sim->keynum; i++) { if (p_sim->p_at[i].x != FLT_MAX) break; } angle_to_quat(&qz, (BOD *) (&p_sim->p_at[i].x), p_sim->p_at[i].w); p_sim->p_at[i] = qz; il = i; for (i++; i < p_sim->keynum; i++) { if (p_sim->p_at[i].x != FLT_MAX) { angle_to_quat(&qz, (BOD *) & (p_sim->p_at[i].x), p_sim->p_at[i].w); quat_mult(&qz, p_sim->p_at + il, p_sim->p_at + i); il = i; } } } } /* 0. Key_frame prevest na matice 1. Vynasobit word matrix 2. Prevest zpet BOD *p_pos, QUAT *p_q, BOD *p_scs */ // cilovy kontejner - kopie tracku static void key_tri_to_tri_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_TRACK_INFO * p_cil, HIERARCHY_TRACK_INFO * p_src, HIERARCHY_TRACK_INFO * p_otec) { int i; p_cil->childnum = p_src->childnum; p_cil->endtime = p_src->endtime; p_cil->objnum = p_src->objnum; p_cil->parentnum = p_src->parentnum; p_cil->pivot = p_src->pivot; p_cil->p_obj = p_kont->p_obj[p_src->objnum]; p_cil->p_otec = p_otec; p_cil->p_m = &p_kont->p_obj[p_src->objnum]->m; if (p_cil->pos_keys) { memcpy(p_cil->p_pkeys, p_src->p_pkeys, sizeof(p_src->p_pkeys[0]) * p_cil->pos_keys); memcpy(p_cil->p_pos, p_src->p_pos, sizeof(p_src->p_pos[0]) * p_cil->pos_keys); } if (p_cil->scs_keys) { memcpy(p_cil->p_scale, p_src->p_scale, sizeof(p_src->p_scale[0]) * p_cil->scs_keys); } if (p_cil->rot_keys) { memcpy(p_cil->p_rkeys, p_src->p_rkeys, sizeof(p_src->p_rkeys[0]) * p_cil->rot_keys); memcpy(p_cil->p_at, p_src->p_at, sizeof(p_src->p_at[0]) * p_cil->rot_keys); } p_cil->p_child = (HIERARCHY_TRACK_INFO **) mmalloc(sizeof(p_cil->p_child[0]) * p_src->childnum); for (i = 0; i < p_src->childnum; i++) { p_cil->p_child[i] = key_tri_vyrob(p_src->p_child[i]->pos_keys, p_src->p_child[i]->rot_keys, p_src->p_child[i]->scs_keys); key_tri_to_tri_indir(p_kont, p_cil->p_child[i], p_src->p_child[i], p_cil); } } void key_root_to_root_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_ROOT * p_cil, HIERARCHY_ROOT * p_src) { int i; *p_cil = *p_src; p_cil->p_child = (HIERARCHY_TRACK_INFO **) mmalloc(sizeof(p_cil->p_child[0]) * p_src->childnum); for (i = 0; i < p_src->childnum; i++) { p_cil->p_child[i] = key_tri_vyrob(p_src->p_child[i]->pos_keys, p_src->p_child[i]->rot_keys, p_src->p_child[i]->scs_keys); key_tri_to_tri_indir(p_kont, p_cil->p_child[i], p_src->p_child[i], NULL); } } /* kopie sim-animaci */ /* typedef struct _SIMPLE_TRACK_INFO { int Objekt_ID; // id objektu ke kteremu animace patri dword flag; int keynum; // pocet klicu BOD *p_pos; // Mesh position keys BOD *p_scale; // Mesh scaling keys QUAT *p_at; // Absolutni traky BOD pivot; // pivot point animace -> kopiruje se do objektu BOD pivot3ds; // pivot 3ds animace GLMATRIX *p_m; // kam to hazet int childnum; // pocet svistich traku struct _SIMPLE_TRACK_INFO *p_child; // svisti traky struct _SIMPLE_TRACK_INFO *p_otec; // otcovy traky } SIMPLE_TRACK_INFO; */ // Kopie sim-animaci void key_sim_root_to_sim_root_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_cil, HIERARCHY_SIM * p_src) { int i; *p_cil = *p_src; p_cil->p_child = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_cil->p_child[0]) * p_src->childnum); for (i = 0; i < p_src->childnum; i++) { key_sim_to_sim_indir(p_cil->p_child + i, p_src->p_child + i); } key_sim_dopln_matrix_kont(p_kont, p_cil); } static void key_sim_dopln_matrix_kont_rec(EDIT_KONTEJNER * p_kont, SIMPLE_TRACK_INFO * p_sim) { EDIT_OBJEKT *p_obj; int i; p_obj = lo_najdi_objekt_kont_poiter_ID(p_kont, p_sim->Objekt_ID); if (p_obj) { p_sim->p_m = &p_obj->m; p_sim->p_object_norm = &p_obj->float_scale; } else { p_sim->p_m = NULL; p_sim->p_object_norm = NULL; } for (i = 0; i < p_sim->childnum; i++) { key_sim_dopln_matrix_kont_rec(p_kont, p_sim->p_child + i); } } // Doplni matice void key_sim_dopln_matrix_kont(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_src) { int i; for (i = 0; i < p_src->childnum; i++) { key_sim_dopln_matrix_kont_rec(p_kont, p_src->p_child + i); } } static void key_sim_dopln_matrix_mesh_rec(GAME_MESH_OLD * p_mesh, SIMPLE_TRACK_INFO * p_sim) { int i; for (i = 0; i < p_mesh->objektu; i++) { if (p_mesh->p_Objekt_ID[i] == p_sim->Objekt_ID) { p_sim->p_m = p_mesh->p_key + i; p_sim->p_obb_local = p_mesh->p_obb_local + i; p_sim->p_obb_world = p_mesh->p_obb_world + i; p_sim->p_object_norm = p_mesh->p_normal_scale ? p_mesh->p_normal_scale + i : NULL; for (i = 0; i < p_sim->childnum; i++) { key_sim_dopln_matrix_mesh_rec(p_mesh, p_sim->p_child + i); } return; } } // fuck-ati } void key_sim_dopln_matrix_mesh(GAME_MESH_OLD * p_mesh, SIMPLE_TRACK_INFO * p_sim) { int i; for (i = 0; i < p_sim->childnum; i++) { key_sim_dopln_matrix_mesh_rec(p_mesh, p_sim->p_child + i); } } /* typedef struct _HIERARCHY_SIM { float delka; // delka casu animace (fps) byte stav; // 0 = stop, 1 = run int flag; // flagy animace (GL_LOOP,GL_REMOVE) dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int keynum; // pocet klicu char jmeno[MAX_JMENO]; // jmeno animace int childnum; // pocet detskych traku SIMPLE_TRACK_INFO *p_child; } HIERARCHY_SIM; */ /* Rekurzivni extra-interpolator */ static void key_root_to_sim_indir_rec(EDIT_KONTEJNER * p_kont, SIMPLE_TRACK_INFO * p_sim, HIERARCHY_TRACK_INFO * p_root, int loop, int float_scale) { /* Kopie puvodnich traku */ key_tri_to_sim_indir(p_root, p_sim, loop, float_scale); p_sim->p_m = &p_kont->p_obj[p_root->objnum]->m; p_sim->Objekt_ID = p_kont->p_obj[p_root->objnum]->Objekt_ID; p_sim->pivot = p_root->pivot_sim; /* Vytvoreni stromu */ if (p_root->childnum) { int i; p_sim->childnum = p_root->childnum; p_sim->p_child = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_sim->p_child[0]) * p_root->childnum); for (i = 0; i < p_sim->childnum; i++) { p_sim->p_child[i].p_otec = p_sim; key_root_to_sim_indir_rec(p_kont, p_sim->p_child + i, p_root->p_child[i], loop, float_scale); } } } /* Prevod root - stromu do simple animacniho stromu */ void key_root_to_sim_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_sim, HIERARCHY_ROOT * p_root, int float_scale) { int i; if (!p_root->childnum) return; strcpy(p_sim->jmeno, p_root->jmeno); p_sim->childnum = p_root->childnum; p_sim->keynum = p_root->framenum; p_sim->p_child = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_sim->p_child[0]) * p_root->childnum); for (i = 0; i < p_sim->childnum; i++) { key_root_to_sim_indir_rec(p_kont, p_sim->p_child + i, p_root->p_child[i], p_root->flag & GK_LOOP, float_scale); } key_sim_dopln_matrix_kont(p_kont, p_sim); } /* Reanimuje kontejner word-matrix - vkladat akt_animace */ void key_kontejner_reanimuj(EDIT_KONTEJNER * p_kont, HIERARCHY_ROOT * p_root) { if (p_kont->kflag & KONT_KEYFRAME && p_root->framenum) { key_root_to_matrix(p_root, 0, kont_world_matrix(p_kont)); } } void key_kontejner_sim_reanimuj(EDIT_KONTEJNER * p_kont) { if (p_kont->kflag & KONT_KEYFRAME && p_kont->sim[p_kont->akt_animace].keynum) { key_sim_root_to_matrix(p_kont, p_kont->sim + p_kont->akt_animace, 0, kont_world_matrix(p_kont)); } } void key_kontejner_sim_reanimuj_pivoty(EDIT_KONTEJNER * p_kont) { HIERARCHY_SIM *p_sim; GLMATRIX m; int i; init_matrix(&m); if (p_kont->kflag & KONT_KEYFRAME) { p_sim = p_kont->sim + p_kont->akt_animace; if (p_sim->keynum) { for (i = 0; i < p_sim->childnum; i++) { key_sim_animuj_strom_pivoty(p_sim->p_child + i, 0, &m); } } } } void key_kontejner_retransformuj(EDIT_KONTEJNER * p_kont_top) { EDIT_KONTEJNER *p_kont = p_kont_top; EDIT_OBJEKT *p_obj; int o; while (p_kont) { if (p_kont->kflag & KONT_KEYFRAME) { for (o = 0; o < MAX_KONT_OBJEKTU; o++) { p_obj = p_kont->p_obj[o]; if (p_obj) { transformuj_objekt_matici(p_obj, &p_obj->m); init_matrix(&p_obj->m); } } } p_kont = p_kont->p_next; } } void key_mesh_reanimuj(GAME_MESH_OLD * p_mesh, int time, GLMATRIX * p_top) { SIMPLE_TRACK_INFO *p_sim = p_mesh->p_sim_aktivni; int i; assert(p_mesh->p_data->kflag & KONT_KEYFRAME); for (i = 0; i < p_sim->childnum; i++) { key_sim_animuj_strom(p_sim->p_child + i, time, p_top); } // Transformace obalky meshe obb_transformuj(&p_mesh->obb_local, p_top, &p_mesh->obb_world); key_mesh_recalc_normal_anim(p_mesh); } /**************************************************************************** Simple-track animace **************************************************************************** */ /* kopie sim->sim */ void key_sim_to_sim_indir(SIMPLE_TRACK_INFO * p_dest, SIMPLE_TRACK_INFO * p_src) { int i; *p_dest = *p_src; // kopie pozicnich klicu if (p_src->p_pos) { p_dest->p_pos = (BOD *) kopiruj_pole(p_src->p_pos, sizeof(p_src->p_pos[0]) * p_src->keynum); } // kopie rotacnich klicu if (p_src->p_at) { p_dest->p_at = (QUAT *) kopiruj_pole(p_src->p_at, sizeof(p_src->p_at[0]) * p_src->keynum); } // kopie scale klicu if (p_src->p_scale) { p_dest->p_scale = (BOD *) kopiruj_pole(p_src->p_scale, sizeof(p_src->p_scale[0]) * p_src->keynum); } // Kopie zero-matic if (p_src->p_all_matrix) { p_dest->p_all_matrix = (GLMATRIX *) kopiruj_pole(p_src->p_all_matrix, sizeof(p_src->p_all_matrix[0])); } if (p_dest->childnum) { p_dest->p_child = (SIMPLE_TRACK_INFO *) mmalloc(sizeof(p_dest->p_child[0]) * p_dest->childnum); for (i = 0; i < p_dest->childnum; i++) { key_sim_to_sim_indir(p_dest->p_child + i, p_src->p_child + i); } } } /* Rekurzivne animuje animacni strom */ void key_sim_animuj_strom(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_otec) { OBB_OLD *p_src, *p_dest; GLMATRIX m, *p_top = p_otec; int i; // animuj hierarchii if (p_sim->p_m) { p_top = mat_mult_dir(key_sim_to_matrix(p_sim, time, &m), p_otec, p_sim->p_m); p_src = p_sim->p_obb_local; p_dest = p_sim->p_obb_world; if (p_src && p_dest) { obb_transformuj(p_src, p_top, p_dest); } } // rozmazni i decka for (i = 0; i < p_sim->childnum; i++) { key_sim_animuj_strom(p_sim->p_child + i, time, p_top); } } void key_sim_animuj_strom_pivoty(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_otec) { GLMATRIX m, m1, *p_top = p_otec; int i; // animuj hierarchii if (p_sim->p_at || p_sim->p_pos || p_sim->p_scale) { p_top = mat_mult(key_sim_to_matrix(p_sim, time, &m), p_otec, &m1); } else { p_top = p_otec; } // Transformuje akt. pivot invert_matrix_copy(p_top, &m); transformuj_bod_bod_matici(&p_sim->pivot, &m); // rozmazni i decka for (i = 0; i < p_sim->childnum; i++) { key_sim_animuj_strom_pivoty(p_sim->p_child + i, time, p_top); } } /*------------------------------------------------------------------ Simple animace ------------------------------------------------------------------ */ /* Prevede tri do simple tracku */ SIMPLE_TRACK_INFO *key_tri_to_sim_indir(HIERARCHY_TRACK_INFO * p_track, SIMPLE_TRACK_INFO * p_sim, int loop, int float_scale) { int i, endtime; // prevedu hlavni track memset((void *) p_sim, 0, sizeof(SIMPLE_TRACK_INFO)); p_sim->keynum = calc_keynum(p_track->endtime); endtime = p_track->endtime; /* Kopie pozicnich klicu */ if (p_track->p_pos) { p_sim->p_pos = (BOD *) mmalloc(sizeof(p_sim->p_pos[0]) * p_sim->keynum); for (i = 0; i < p_sim->keynum; i++) key_track_interpolace_bod(p_sim->p_pos + i, p_track->p_pos, p_track->p_pkeys, i * SIM_KONSTI, endtime, p_track->pos_keys, loop); } /* Kopie rotacnich klicu */ if (p_track->p_at) { p_sim->p_at = (QUAT *) mmalloc(sizeof(p_sim->p_at[0]) * p_sim->keynum); p_sim->pivot3ds = p_track->pivot; key_track_quat_zkontroluj(p_track->p_at, p_track->rot_keys); for (i = 0; i < p_sim->keynum; i++) key_track_interpolace_quat(p_sim->p_at + i, p_track->p_at, p_track->p_rkeys, i * SIM_KONSTI, endtime, p_track->rot_keys, loop); } /* Kopie scale klicu */ if (p_track->p_scale) { if (float_scale) { BOD s; p_sim->p_norm = (float *) mmalloc(sizeof(p_sim->p_norm[0]) * p_sim->keynum); for (i = 0; i < p_sim->keynum; i++) { key_track_interpolace_bod(&s, p_track->p_scale, p_track->p_skeys, i * SIM_KONSTI, endtime, p_track->scs_keys, loop); p_sim->p_norm[i] = s.x; } } else { p_sim->p_scale = (BOD *) mmalloc(sizeof(p_sim->p_scale[0]) * p_sim->keynum); for (i = 0; i < p_sim->keynum; i++) key_track_interpolace_bod(p_sim->p_scale + i, p_track->p_scale, p_track->p_skeys, i * SIM_KONSTI, endtime, p_track->scs_keys, loop); } } return (p_sim); } /* Prevede tri linearne do simple tracku */ SIMPLE_TRACK_INFO *key_tri_to_sim_indir_lin(HIERARCHY_TRACK_INFO * p_track, SIMPLE_TRACK_INFO * p_sim, int loop) { int i, keynum, endtime; // prevedu hlavni track memset((void *) p_sim, 0, sizeof(SIMPLE_TRACK_INFO)); keynum = p_sim->keynum = calc_keynum(p_track->endtime); keynum--; endtime = p_track->endtime; /* Kopie pozicnich klicu */ if (p_track->p_pos) { p_sim->p_pos = (BOD *) mmalloc(sizeof(p_sim->p_pos[0]) * p_sim->keynum); for (i = 0; i < p_sim->keynum; i++) key_track_interpolace_bod_linear(p_sim->p_pos + i, p_track->p_pos, p_track->p_pkeys, i * SIM_KONSTI, endtime, p_track->pos_keys, loop); } /* Kopie rotacnich klicu */ if (p_track->p_at) { p_sim->p_at = (QUAT *) mmalloc(sizeof(p_sim->p_at[0]) * p_sim->keynum); p_sim->pivot3ds = p_track->pivot; key_track_quat_zkontroluj(p_track->p_at, p_track->rot_keys); for (i = 0; i < p_sim->keynum; i++) key_track_interpolace_quat_linear(p_sim->p_at + i, p_track->p_at, p_track->p_rkeys, i * SIM_KONSTI, endtime, p_track->rot_keys, loop); } /* Kopie scale klicu */ if (p_track->p_scale) { p_sim->p_scale = (BOD *) mmalloc(sizeof(p_sim->p_scale[0]) * p_sim->keynum); for (i = 0; i < p_sim->keynum; i++) key_track_interpolace_bod_linear(p_sim->p_scale + i, p_track->p_scale, p_track->p_skeys, i * SIM_KONSTI, endtime, p_track->scs_keys, loop); } return (p_sim); } void key_sim_zrus_vnitrek(SIMPLE_TRACK_INFO * p_sim) { null_free((void **) &p_sim->p_pos); null_free((void **) &p_sim->p_at); null_free((void **) &p_sim->p_scale); null_free((void **) &p_sim->p_all_matrix); } // Zrusi animacni strom sim animaci void key_sim_zrus(SIMPLE_TRACK_INFO * p_sim) { int i; if (p_sim->p_child) { for (i = 0; i < p_sim->childnum; i++) { key_sim_zrus(p_sim->p_child + i); } free(p_sim->p_child); } key_sim_zrus_vnitrek(p_sim); } void key_sim_root_zrus(HIERARCHY_SIM * p_sim) { int i; if (p_sim->p_child) { for (i = 0; i < p_sim->childnum; i++) { key_sim_zrus(p_sim->p_child + i); } free(p_sim->p_child); } memset(p_sim, 0, sizeof(p_sim[0])); } // ulozi simple animaci jako text-file /* C 20 // (pocet framu zacinajici od 0) V 0 0 0 // pivot point F 0 // Pro kazdy frame jeho cislo P 0 2 3 // relativni posun x,y,z R 0 0 0 0 // relativni rotace x,y,z + uhel S 0 0 0 // relativni scale x y z T 0 // tension O 0 // continuity B 0 // bias L 0 0 0 // tension/continuity/bias */ void key_sim_uloz(SIMPLE_TRACK_INFO * p_sim, char *p_file, char *p_dir) { BOD b; float uhel; FILE *f; int i; int loop = p_sim->flag & GK_LOOP; if (chdir(p_dir)) { ddw("Unable to change directory to %s"); return; } if (!(f = fopen(p_file, "w"))) { ddw("File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, p_dir); return; } fprintf(f, "C %d\n", p_sim->keynum); if (loop) fputs("N\n", f); fprintf(f, "M %f %f %f", p_sim->pivot3ds.x, p_sim->pivot3ds.y, p_sim->pivot3ds.z); fprintf(f, "O %f %f %f", p_sim->pivot.x, p_sim->pivot.y, p_sim->pivot.z); for (i = 0; i < p_sim->keynum; i++) { fprintf(f, "F %d\n", i); fprintf(f, "P %f %f %f\n", p_sim->p_pos[i].x, p_sim->p_pos[i].y, p_sim->p_pos[i].z); quat_to_angle(p_sim->p_at + i, &b, &uhel); uhel = (uhel / PI) * 180.0f; fprintf(f, "R %f %f %f %f\n", b.x, b.y, b.z, uhel); fprintf(f, "S %f %f %f\n", p_sim->p_scale[i].x, p_sim->p_scale[i].y, p_sim->p_scale[i].z); } fclose(f); } // load sim z text-file int key_sim_nahraj(char *p_subdir, SIMPLE_TRACK_INFO * p_sim, char *p_file, char *p_dir, int linear) { HIERARCHY_TRACK_INFO track; // load jako hierarchie -> prevedu do simple tracku KEY_POINT_BRS *p_spline = NULL; char line[1000], *p_pom; KFILE *f; int p, r, s, fr, loop = 0; BOD pivot(0.0f, 0.0f, 0.0f); BOD osa; float uhel; char **p_line; int l, lmax; if (chdir(p_dir)) { ddw("Unable to change directory to %s", p_dir); return (FALSE); } if (!(f = kopen(p_subdir, p_file, "r"))) { kprintf(TRUE, "File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, (p_dir)); return (FALSE); } else { kprintf(TRUE, "Nahravam animaci z %s...", p_file); } p_line = (char **) mmalloc(sizeof(p_line[0]) * MAX_SIM_RADKU); l = 0; while (kgets(line, 999, f)) { assert(l < MAX_SIM_RADKU); if (line[0] && line[0] != '\n' && line[0] != ';') { p_line[l] = (char *) kopiruj_pole(line, sizeof(char) * (strlen(line) + 1)); l++; } } kclose(f); lmax = l; p = r = s = 0; for (l = 0; l < lmax; l++) { p_pom = p_line[l]; switch (toupper(p_pom[0])) { case 'P': // posun p++; break; case 'R': // rotace r++; break; case 'S': // scale s++; break; default: break; } } key_tri_vyrob_indir(&track, p, r, s); p = r = s = fr = 0; for (l = 0; l < lmax; l++) { p_pom = p_line[l]; switch (toupper(p_pom[0])) { case 'F': // frame sscanf(p_pom + 1, "%d", &fr); break; case 'P': // posun track.p_pkeys[p].time = fr * SIM_KONSTI; p_spline = track.p_pkeys + p; sscanf(p_pom + 1, "%f %f %f", &track.p_pos[p].x, &track.p_pos[p].y, &track.p_pos[p].z); p++; break; case 'R': // rotace track.p_rkeys[r].time = fr * SIM_KONSTI; p_spline = track.p_rkeys + r; sscanf(p_pom + 1, "%f %f %f %f", &osa.x, &osa.y, &osa.z, &uhel); /* Korekce zaporneho uhlu */ if (uhel < 0.0f) { uhel = -uhel; osa.x = -osa.x; osa.y = -osa.y; osa.z = -osa.z; } uhel = DEG2RAD(uhel); angle_to_quat(track.p_at + r, &osa, uhel); r++; break; case 'S': // scale track.p_skeys[s].time = fr * SIM_KONSTI; p_spline = track.p_skeys + s; sscanf(p_pom + 1, "%f %f %f", &track.p_scale[s].x, &track.p_scale[s].y, &track.p_scale[s].z); s++; break; case 'L': if (p_spline) { sscanf(p_pom + 1, "%f %f %f", &p_spline->tension, &p_spline->continuity, &p_spline->bias); } break; case 'T': if (p_spline) { sscanf(p_pom + 1, "%f", &p_spline->tension); } break; case 'O': if (p_spline) { sscanf(p_pom + 1, "%f", &p_spline->continuity); } break; case 'B': if (p_spline) { sscanf(p_pom + 1, "%f", &p_spline->bias); } break; case 'C': // celkem framu sscanf(p_pom + 1, "%d", &track.endtime); track.endtime = calc_endtime(track.endtime); break; case 'N': // loop animace loop = TRUE; break; case 'V': // pivot sscanf(p_pom + 1, "%f %f %f", &pivot.x, &pivot.y, &pivot.z); break; case 'M': // 3ds pivot sscanf(p_pom + 1, "%f %f %f", &track.pivot.x, &track.pivot.y, &track.pivot.z); break; case 'Q': linear = TRUE; break; case 'W': linear = FALSE; break; default: break; } } for (l = 0; l < lmax; l++) { free(p_line[l]); } free(p_line); if (linear) { key_tri_to_sim_indir_lin(&track, p_sim, loop); } else { key_tri_to_sim_indir(&track, p_sim, loop, FALSE); } zrus_tri_vnitrek(&track); p_sim->pivot = pivot; // dokopiruj standartni pivot return (TRUE); } // rozsirene sim-animace load int key_sim_nahraj_extended(EDIT_KONTEJNER * p_kont, int cislo_anim, char *p_file, char *p_dir) { HIERARCHY_TRACK_INFO **p_track_list; HIERARCHY_TRACK_INFO *p_track; HIERARCHY_ROOT root; int akt_track; KEY_POINT_BRS *p_spline = NULL; char pom[1000]; char pom1[1000]; FILE *f; int p, r, s, fr, loop = 0, framu; BOD pivot(0.0f, 0.0f, 0.0f); BOD osa; float uhel; int i, objektu = 0, stop, ob, float_scale = FALSE; size_ptr end; if (chdir(p_dir)) { ddw("Unable to change directory to %s"); return (FALSE); } if (!(f = fopen(p_file, "r"))) { ddw("File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, (p_dir)); return (FALSE); } kprintf(TRUE, "Nahravam animaci z %s...", p_file); while (fgets(pom, 999, f)) { fgets_korekce(pom); if (pom[0] && pom[0] != '\n' && pom[0] != ';') { switch (toupper(pom[0])) { case 'C': // celkem framu sscanf(pom + 1, "%d", &framu); break; case 'X': switch (toupper(pom[1])) { case 'O': // vlastnik objektu++; break; case 'P': // otec break; } break; default: break; } } } if (!objektu) objektu = 1; p_track_list = (HIERARCHY_TRACK_INFO **) alloca(sizeof(p_track_list[0]) * objektu); akt_track = 0; stop = 0; do { p_track = p_track_list[akt_track++] = (HIERARCHY_TRACK_INFO *) alloca(sizeof(p_track[0])); memset((void *) p_track, 0, sizeof(p_track[0])); /* reset pivot-pointu */ pivot.x = pivot.y = pivot.z = FLT_MAX; /* Nactu jmena objektu */ fseek(f, stop, SEEK_SET); while (fgets(pom, 999, f)) { fgets_korekce(pom); if (pom[0] && pom[0] != '\n' && pom[0] != ';') { if (toupper(pom[0]) == 'X' && toupper(pom[1]) == 'O') { strcpy(p_track->jmeno, cti_za_znak(pom + 2, ' ')); continue; } if (toupper(pom[0]) == 'X' && toupper(pom[1]) == 'P') { strcpy(p_track->jmeno_otec, cti_za_znak(pom + 2, ' ')); continue; } if (toupper(pom[0]) == 'V') { sscanf(pom + 1, "%f %f %f", &pivot.x, &pivot.y, &pivot.z); break; } if (toupper(pom[0]) == 'F') { sscanf(pom + 1, "%d", &fr); break; } } } /* Nactu pozici za jmenama objektu */ stop = ftell(f); /* Nactu pocty klicu */ p = r = s = 0; while (fgets(pom, 999, f)) { fgets_korekce(pom); if (pom[0] && pom[0] != '\n' && pom[0] != ';') { if (toupper(pom[0]) == 'X') { break; } if (toupper(pom[0]) == 'P') { p++; continue; } if (toupper(pom[0]) == 'R') { r++; continue; } if (toupper(pom[0]) == 'S' || toupper(pom[0]) == 'U') { s++; continue; } } } /* Vyrobim animaci podle poctu klicu */ strcpy(pom, p_track->jmeno); strcpy(pom1, p_track->jmeno_otec); key_tri_vyrob_indir(p_track, p, r, s); strcpy(p_track->jmeno, pom); strcpy(p_track->jmeno_otec, pom1); p = r = s = 0; // fame zbylo zposledniho klice /* Vratim se za prvni frame a ctu klice */ fseek(f, stop, SEEK_SET); while ((end = (size_ptr) fgets(pom, 999, f))) { fgets_korekce(pom); if (pom[0] && pom[0] != '\n' && pom[0] != ';') { /* Test - je dalsi objekt? */ if (toupper(pom[0]) != 'X') stop = ftell(f); else break; /* neni - cti klice animace */ switch (toupper(pom[0])) { case 'F': // frame sscanf(pom + 1, "%d", &fr); break; case 'P': // posun p_track->p_pkeys[p].time = fr * SIM_KONSTI; p_spline = p_track->p_pkeys + p; sscanf(pom + 1, "%f %f %f", &p_track->p_pos[p].x, &p_track->p_pos[p].y, &p_track->p_pos[p].z); p++; break; case 'R': // rotace p_track->p_rkeys[r].time = fr * SIM_KONSTI; p_spline = p_track->p_rkeys + r; sscanf(pom + 1, "%f %f %f %f", &osa.x, &osa.y, &osa.z, &uhel); /* Korekce zaporneho uhlu */ if (uhel < 0.0f) { uhel = -uhel; osa.x = -osa.x; osa.y = -osa.y; osa.z = -osa.z; } uhel = DEG2RAD(uhel); angle_to_quat(p_track->p_at + r, &osa, uhel); r++; break; case 'S': // scale p_track->p_skeys[s].time = fr * SIM_KONSTI; p_spline = p_track->p_skeys + s; sscanf(pom + 1, "%f %f %f", &p_track->p_scale[s].x, &p_track->p_scale[s].y, &p_track->p_scale[s].z); s++; break; case 'U': // scale p_track->p_skeys[s].time = fr * SIM_KONSTI; p_spline = p_track->p_skeys + s; sscanf(pom + 1, "%f", &p_track->p_scale[s].x); p_track->p_scale[s].y = p_track->p_scale[s].z = 0.0f; float_scale = TRUE; s++; break; case 'L': if (p_spline) { sscanf(pom + 1, "%f %f %f", &p_spline->tension, &p_spline->continuity, &p_spline->bias); } break; case 'T': if (p_spline) { sscanf(pom + 1, "%f", &p_spline->tension); } break; case 'O': if (p_spline) { sscanf(pom + 1, "%f", &p_spline->continuity); } break; case 'B': if (p_spline) { sscanf(pom + 1, "%f", &p_spline->bias); } break; case 'N': // loop animace loop = TRUE; break; case 'V': // pivot sscanf(pom + 1, "%f %f %f", &pivot.x, &pivot.y, &pivot.z); break; case 'M': // 3ds pivot sscanf(pom + 1, "%f %f %f", &p_track->pivot.x, &p_track->pivot.y, &p_track->pivot.z); break; default: break; } } } p_track->pivot_sim = pivot; } while (end); fclose(f); assert(akt_track == objektu); /* Navazani animace na kontejner */ memset(&root, 0, sizeof(root)); for (i = 0; i < objektu; i++) { p_track = p_track_list[i]; ob = p_track->objnum = lo_najdi_objekt_kont(p_kont, p_track->jmeno); if (ob == K_CHYBA) { kprintf(TRUE, "!!!! Nenalezen objekt '%s' v kontejneru '%s'", p_track->jmeno, p_kont->jmeno); continue; } else { kprintf(TRUE, "Objekt %s OK", p_track->jmeno); } p_track->p_obj = p_kont->p_obj[ob]; if (p_track->pivot_sim.x != FLT_MAX && p_track->pivot_sim.y != FLT_MAX && p_track->pivot_sim.z != FLT_MAX) { p_kont->p_obj[ob]->pivot = p_track->pivot_sim; } p_track->parentnum = lo_najdi_objekt_kont(p_kont, p_track->jmeno_otec); if (p_track->parentnum == K_CHYBA) p_track->parentnum = ROOT_NODE; key_konec_prochazeni = FALSE; key_root_node_pridej(&root, p_track); p_track->endtime = calc_endtime(framu); } root.framenum = framu; kprintf(TRUE, "Framu animace %d", framu); if (loop) { kprintf(TRUE, "Loop animace"); root.flag |= GK_LOOP; } /* Prevod do sim-animaci */ key_root_to_sim_indir(p_kont, p_kont->sim + cislo_anim, &root, float_scale); p_kont->kflag |= (float_scale) ? KONT_NORMAL_ANIM | KONT_KEYFRAME : KONT_KEYFRAME; p_kont->kflag &= ~KONT_STATIC; return (TRUE); } // aplikuje siple track do matrice GLMATRIX *key_sim_to_matrix(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_m) { float frame, t, t1; BOD *p1, *p2; QUAT q; int kn, lasttime; if (p_sim->p_all_matrix) { *p_m = *p_sim->p_all_matrix; } else { init_matrix(p_m); lasttime = (p_sim->keynum - 1) * SIM_KONSTI; if (time < lasttime) { t = (float) time / SIM_KONST; frame = (float) floor((float) t); t -= frame; kn = ftoi(frame); t1 = 1.0f - t; if (p_sim->p_pos) { p1 = p_sim->p_pos + kn; p2 = p_sim->p_pos + kn + 1; p_m->_41 = p1->x * t1 + p2->x * t; p_m->_42 = p1->y * t1 + p2->y * t; p_m->_43 = p1->z * t1 + p2->z * t; } if (p_sim->p_at) { quat_to_matrix(p_m, slerp(p_sim->p_at + kn, p_sim->p_at + kn + 1, t, &q)); } if (p_sim->p_scale) { p1 = p_sim->p_scale + kn; p2 = p_sim->p_scale + kn + 1; scale_matrix(p_m, p1->x * t1 + p2->x * t, p1->y * t1 + p2->y * t, p1->z * t1 + p2->z * t); } if (p_sim->p_norm) { *p_sim->p_object_norm = p_sim->p_norm[kn] * t1 + p_sim->p_norm[kn + 1] * t; } } else { kn = p_sim->keynum - 1; if (p_sim->p_pos) { p1 = (BOD *) & p_m->_41; *p1 = p_sim->p_pos[kn]; } if (p_sim->p_at) { quat_to_matrix(p_m, p_sim->p_at + kn); } if (p_sim->p_scale) { p1 = p_sim->p_scale + kn; scale_matrix(p_m, p1->x, p1->y, p1->z); } if (p_sim->p_norm) { *p_sim->p_object_norm = p_sim->p_norm[kn]; } } pivotuj_matrix_tam(&p_sim->pivot3ds, p_m); pivotuj_matrix(p_m, &p_sim->pivot); } return (p_m); } void key_sim_root_to_matrix(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_sim, int time, GLMATRIX * p_m) { int i; for (i = 0; i < p_sim->childnum; i++) { key_sim_animuj_strom(p_sim->p_child + i, time, p_m); } if (p_kont->kflag & KONT_NORMAL_ANIM) { key_kontejner_recalc_normal_anim(p_kont); } } void key_kontejner_recalc_normal_anim(EDIT_KONTEJNER * p_kont) { EDIT_OBJEKT *p_obj; OBJ_VERTEX *p_vertex; BOD n; float last, akt, num, i; // pokud se last=aktualni - nic nedelam int o; for (o = 0; o < p_kont->objektu; o++) { if ((p_obj = p_kont->p_obj[o])) { if ((last = p_obj->float_scale_last) == (akt = p_obj->float_scale)) continue; p_vertex = p_obj->p_vertex; num = p_obj->vertexnum; for (i = 0; i < num; i++, p_vertex++) { vektor_add((BOD *) & p_vertex->x, vektor_mult_skalar((BOD *) & p_vertex->nx, -akt, &n), (BOD *) & p_vertex->px); } p_obj->float_scale_last = akt; } } } /* typedef struct _SIMPLE_TRACK_INFO { int Objekt_ID; // id objektu ke kteremu animace patri dword flag; int keynum; // pocet klicu BOD *p_pos; // Mesh position keys BOD *p_scale; // Mesh scaling keys QUAT *p_at; // Absolutni traky BOD pivot; // pivot point animace -> kopiruje se do objektu BOD pivot3ds; // pivot 3ds animace GLMATRIX *p_m; // kam to hazet int childnum; // pocet svistich traku struct _SIMPLE_TRACK_INFO *p_child; // svisti traky struct _SIMPLE_TRACK_INFO *p_otec; // otcovy traky } SIMPLE_TRACK_INFO; typedef struct _HIERARCHY_SIM { float delka; // delka casu animace (fps) char stav; // 0 = stop, 1 = run int flag; // flagy animace (GL_LOOP,GL_REMOVE) dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int keynum; // pocet klicu char jmeno[MAX_JMENO]; // jmeno animace int childnum; // pocet detskych traku SIMPLE_TRACK_INFO *p_child; } HIERARCHY_SIM; */ void key_sim_root_to_sim_indir(HIERARCHY_SIM * p_root, SIMPLE_TRACK_INFO * p_sim) { memset((void *) p_sim, 0, sizeof(SIMPLE_TRACK_INFO)); p_sim->flag = p_root->flag; p_sim->keynum = p_root->keynum; p_sim->childnum = p_root->childnum; p_sim->p_child = p_root->p_child; p_sim->Objekt_ID = K_CHYBA; memset(p_root, 0, sizeof(p_root[0])); } // aplikuje sim do matice a bodu GLMATRIX *key_sim_to_matrix_param(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_m, BOD * p_pos, QUAT * p_quat, BOD * p_scale) { float frame, t, t1; BOD *p1, *p2; int kn; int lasttime; init_matrix(p_m); lasttime = (p_sim->keynum - 1) * SIM_KONSTI; if (time < lasttime) { t = (float) time / SIM_KONST; frame = (float) floor((float) t); t -= frame; kn = ftoi(frame); t1 = 1.0f - t; if (p_sim->p_pos) { p1 = p_sim->p_pos + kn; p2 = p_sim->p_pos + kn + 1; p_pos->x = p_m->_41 = p1->x * t1 + p2->x * t; p_pos->y = p_m->_42 = p1->y * t1 + p2->y * t; p_pos->z = p_m->_43 = p1->z * t1 + p2->z * t; } else { vektor_set(p_pos, 0); } if (p_sim->p_at) { quat_to_matrix(p_m, slerp(p_sim->p_at + kn, p_sim->p_at + kn + 1, t, p_quat)); } else { quat_set_zero(p_quat); } if (p_sim->p_scale) { p1 = p_sim->p_scale + kn; p2 = p_sim->p_scale + kn + 1; p_scale->x = p1->x * t1 + p2->x * t; p_scale->y = p1->y * t1 + p2->y * t; p_scale->z = p1->z * t1 + p2->z * t; scale_matrix(p_m, p_scale->x, p_scale->y, p_scale->z); } else { vektor_set(p_scale, 1); } } else { kn = p_sim->keynum - 1; if (p_sim->p_pos) { p1 = (BOD *) & p_m->_41; *p_pos = *p1 = p_sim->p_pos[kn]; } else { vektor_set(p_pos, 0); } if (p_sim->p_at) { *p_quat = p_sim->p_at[kn]; quat_to_matrix(p_m, p_quat); } else { quat_set_zero(p_quat); } if (p_sim->p_scale) { p1 = p_sim->p_scale + kn; *p_scale = *p1; scale_matrix(p_m, p1->x, p1->y, p1->z); } else { vektor_set(p_scale, 1); } } return (p_m); } /* Prevede animaci kamery do kamery */ void key_kan_to_kamera(KAMERA * p_kam, KAMERA_TRACK_INFO * p_track, int time) { GLMATRIX m; int loop = p_track->flag & GK_LOOP; key_track_interpolace_bod(&p_kam->p, p_track->p_pos, p_track->p_pkeys, time, p_track->endtime, p_track->pos_keys, loop); key_track_interpolace_bod(&p_kam->t, p_track->p_trg, p_track->p_tkeys, time, p_track->endtime, p_track->trg_keys, loop); key_track_interpolace_float(&p_kam->roll, p_track->p_roll, p_track->p_rlkeys, time, p_track->endtime, p_track->roll_keys, loop); key_track_interpolace_float(&p_kam->fov, p_track->p_fov, p_track->p_fkeys, time, p_track->endtime, p_track->fov_keys, loop); calc_camera_3ds(&m, &p_kam->p_objekt->m, &p_kam->p, &p_kam->t, p_kam->roll); } /* Vyrobi animaci kamery */ int key_kamera_vyrob_indir(KAMERA_TRACK_INFO * p_track, int pos_keys, int trg_keys, int roll_keys, int fov_keys, int quat_keys) { memset(p_track, 0, sizeof(*p_track)); if ((p_track->pos_keys = pos_keys)) { p_track->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_pkeys[0]) * pos_keys); p_track->p_pos = (BOD *) mmalloc(sizeof(p_track->p_pos[0]) * pos_keys); } if ((p_track->trg_keys = trg_keys)) { p_track->p_tkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_tkeys[0]) * trg_keys); p_track->p_trg = (BOD *) mmalloc(sizeof(p_track->p_trg[0]) * trg_keys); } if ((p_track->roll_keys = roll_keys)) { p_track->p_rlkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_rlkeys[0]) * roll_keys); p_track->p_roll = (float *) mmalloc(sizeof(p_track->p_roll[0]) * roll_keys); } if ((p_track->fov_keys = fov_keys)) { p_track->p_fkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_fkeys[0]) * fov_keys); p_track->p_fov = (float *) mmalloc(sizeof(p_track->p_fov[0]) * fov_keys); } if ((p_track->quat_keys = quat_keys)) { p_track->p_qkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_track->p_qkeys[0]) * quat_keys); p_track->p_quat = (QUAT *) mmalloc(sizeof(p_track->p_quat[0]) * quat_keys); } return (TRUE); } /* Zrusi animaci kamery */ void key_kamera_zrus_indir(KAMERA_TRACK_INFO * p_track) { if (p_track->fov_keys) { null_free((void **) &p_track->p_fkeys); null_free((void **) &p_track->p_fov); } if (p_track->pos_keys) { null_free((void **) &p_track->p_pkeys); null_free((void **) &p_track->p_pos); } if (p_track->roll_keys) { null_free((void **) &p_track->p_rlkeys); null_free((void **) &p_track->p_roll); } if (p_track->trg_keys) { null_free((void **) &p_track->p_tkeys); null_free((void **) &p_track->p_trg); } if (p_track->quat_keys) { null_free((void **) &p_track->p_qkeys); null_free((void **) &p_track->p_quat); } memset(p_track, 0, sizeof(*p_track)); } /* Ulozi kameru */ int key_kamera_uloz(KAMERA_TRACK_INFO * p_track, char *p_jmeno_kamery, char *p_jmeno_anim, char *p_file, char *p_dir) { FILE *f; int i, keynum; int p, t, r, fv; if (chdir(p_dir)) { ddw("Unable to change directory to %s"); return (FALSE); } if (!(f = fopen(p_file, "w"))) { ddw("File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, (p_dir)); return (FALSE); } keynum = calc_keynum(p_track->endtime); fprintf(f, "C %d\n", keynum); fprintf(f, "J %s\n", p_jmeno_kamery); // jmeno kamery fprintf(f, "A %s\n", p_jmeno_anim); // jmeno animace for (i = 0; i < keynum; i++) { p = key_je_frame_klic(p_track->p_pkeys, p_track->pos_keys, i); t = key_je_frame_klic(p_track->p_tkeys, p_track->trg_keys, i); r = key_je_frame_klic(p_track->p_rlkeys, p_track->roll_keys, i); fv = key_je_frame_klic(p_track->p_fkeys, p_track->fov_keys, i); if (p != K_CHYBA || t != K_CHYBA || r != K_CHYBA || fv != K_CHYBA) { fprintf(f, "F %d\n", i); /* uloz pozici */ if (p != K_CHYBA) { fprintf(f, "P %f %f %f\n", p_track->p_pos[p].x, p_track->p_pos[p].y, p_track->p_pos[p].z); fprintf(f, "L %f %f %f\n", p_track->p_pkeys[p].tension, p_track->p_pkeys[p].continuity, p_track->p_pkeys[p].bias); } /* uloz cil */ if (t != K_CHYBA) { fprintf(f, "D %f %f %f\n", p_track->p_trg[t].x, p_track->p_trg[t].y, p_track->p_trg[t].z); fprintf(f, "L %f %f %f\n", p_track->p_tkeys[t].tension, p_track->p_tkeys[t].continuity, p_track->p_tkeys[t].bias); } /* uloz roll */ if (r != K_CHYBA) { fprintf(f, "D %f\n", RAD2DEG(p_track->p_roll[r])); fprintf(f, "L %f %f %f\n", p_track->p_rlkeys[r].tension, p_track->p_rlkeys[r].continuity, p_track->p_rlkeys[r].bias); } /* uloz fov */ if (fv != K_CHYBA) { fprintf(f, "V %f\n", RAD2DEG(p_track->p_fov[fv])); fprintf(f, "L %f %f %f\n", p_track->p_fkeys[fv].tension, p_track->p_fkeys[fv].continuity, p_track->p_fkeys[fv].bias); } } } fclose(f); return (TRUE); } /* Nahraje kameru */ int key_kamera_nahraj(KAMERA_TRACK_INFO * p_track, char *p_jmeno_kamery, char *p_jmeno_anim, char *p_subdir, char *p_file, char *p_dir) { KEY_POINT_BRS *p_spline = NULL; char line[1000]; char *p_pom; int p, t, r, fv, fr; float uhel; KFILE *f; char **p_line; int l, lmax; if (chdir(p_dir)) { ddw("Unable to change directory to %s"); return (FALSE); } if (!(f = kopen(p_subdir, p_file, "r"))) { kprintf(TRUE, "File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, (p_dir)); return (FALSE); } p_line = (char **) mmalloc(sizeof(p_line[0]) * MAX_SIM_RADKU); l = 0; while (kgets(line, 999, f)) { assert(l < MAX_SIM_RADKU); if (line[0] && line[0] != '\n' && line[0] != ';') { p_line[l] = (char *) kopiruj_pole(line, sizeof(char) * (strlen(line) + 1)); l++; } } kclose(f); lmax = l; p = t = r = fv = 0; for (l = 0; l < lmax; l++) { p_pom = p_line[l]; switch (toupper(p_pom[0])) { case 'P': // posun p++; break; case 'D': // rotace t++; break; case 'R': // roll r++; break; case 'V': // fov fv++; break; default: break; } } key_kamera_vyrob_indir(p_track, p, t, r, fv, 0); p = r = t = fr = fv = 0; for (l = 0; l < lmax; l++) { p_pom = p_line[l]; switch (toupper(p_pom[0])) { case 'F': // frame sscanf(p_pom + 1, "%d", &fr); break; case 'P': // posun p_spline = p_track->p_pkeys + p; // nastaveni aktivniho splajnu p_track->p_pkeys[p].time = fr * SIM_KONSTI; sscanf(p_pom + 1, "%f %f %f", &p_track->p_pos[p].x, &p_track->p_pos[p].y, &p_track->p_pos[p].z); p++; break; case 'D': // target p_track->p_tkeys[t].time = fr * SIM_KONSTI; p_spline = p_track->p_tkeys + t; // nastaveni aktivniho splajnu sscanf(p_pom + 1, "%f %f %f", &p_track->p_trg[t].x, &p_track->p_trg[t].y, &p_track->p_trg[t].z); t++; break; case 'R': // roll p_track->p_rlkeys[r].time = fr * SIM_KONSTI; p_spline = p_track->p_rlkeys + r; sscanf(p_pom + 1, "%f", &uhel); p_track->p_roll[r] = DEG2RAD(uhel); r++; break; case 'V': // roll p_track->p_fkeys[fv].time = fr * SIM_KONSTI; p_spline = p_track->p_fkeys + fv; sscanf(p_pom + 1, "%f", &uhel); p_track->p_fov[fv] = DEG2RAD(uhel); fv++; break; case 'L': if (p_spline) { sscanf(p_pom + 1, "%f %f %f", &p_spline->tension, &p_spline->continuity, &p_spline->bias); } break; case 'T': if (p_spline) { sscanf(p_pom + 1, "%f", &p_spline->tension); } break; case 'O': if (p_spline) { sscanf(p_pom + 1, "%f", &p_spline->continuity); } break; case 'B': if (p_spline) { sscanf(p_pom + 1, "%f", &p_spline->bias); } break; case 'C': // celkem framu sscanf(p_pom + 1, "%d", &p_track->endtime); p_track->endtime = calc_endtime(p_track->endtime); break; case 'J': // jmeno kamery strcpy(p_jmeno_kamery, p_pom + 2); break; case 'A': // jmeno animace strcpy(p_track->jmeno, p_pom + 2); break; } } zamen_koncovku_znak(p_jmeno_kamery, '\n', NULL); zamen_koncovku_znak(p_track->jmeno, '\n', NULL); return (TRUE); } int key_kamera_track_cti(KAMERA_TRACK_INFO * p_track, BOD * p_p, BOD * p_t, float *p_roll, float *p_fov) { if (p_track->pos_keys) { *p_p = p_track->p_pos[0]; } else { p_p->x = 0.0f; p_p->y = 0.0f; p_p->z = 0.0f; } if (p_track->trg_keys) { *p_t = p_track->p_trg[0]; } else { p_t->x = 0.0f; p_t->y = 0.0f; p_t->z = 0.0f; } if (p_track->roll_keys) { *p_roll = p_track->p_roll[0]; } else { *p_roll = 0.0f; } if (p_track->fov_keys) { *p_fov = p_track->p_fov[0]; } else { *p_fov = DEG2RAD(45.0f); } return (TRUE); } /* Animace t1-t2 materialu */ ANIM_TEXT *key_vyrob_material_animace(int poskey, int rotkey, int scalekey, int pivotkey) { ANIM_TEXT *p_mat = (ANIM_TEXT *) mmalloc(sizeof(p_mat[0])); if ((p_mat->pos_keys = poskey)) { p_mat->p_pos = (BOD *) mmalloc(sizeof(BOD) * poskey); p_mat->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_pkeys[0]) * poskey); } if ((p_mat->piv_keys = pivotkey)) { p_mat->p_piv = (BOD *) mmalloc(sizeof(BOD) * pivotkey); p_mat->p_vkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_vkeys[0]) * pivotkey); } if ((p_mat->rot_keys = rotkey)) { p_mat->p_rot = (float *) mmalloc(sizeof(p_mat->p_rot[0]) * rotkey); p_mat->p_rkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_rkeys[0]) * rotkey); } if ((p_mat->scs_keys = scalekey)) { p_mat->p_scale = (BOD *) mmalloc(sizeof(BOD) * scalekey); p_mat->p_skeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_skeys[0]) * scalekey); } return (p_mat); } ANIM_TEXT *key_kopiruj_material_animace(ANIM_TEXT * p_src) { ANIM_TEXT *p_mat = (ANIM_TEXT *) mmalloc(sizeof(p_mat[0])); int poskey = p_src->pos_keys; int pivkey = p_src->piv_keys; int rotkey = p_src->rot_keys; int scalekey = p_src->scs_keys; if ((p_mat->pos_keys = poskey)) { p_mat->p_pos = (BOD *) mmalloc(sizeof(p_mat->p_pos[0]) * poskey); p_mat->p_pkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_pkeys[0]) * poskey); memcpy(p_mat->p_pos, p_src->p_pos, sizeof(BOD) * poskey); memcpy(p_mat->p_pkeys, p_src->p_pkeys, sizeof(p_mat->p_pkeys[0]) * poskey); } if ((p_mat->piv_keys = pivkey)) { p_mat->p_piv = (BOD *) mmalloc(sizeof(p_mat->p_piv[0]) * pivkey); p_mat->p_vkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_vkeys[0]) * pivkey); memcpy(p_mat->p_piv, p_src->p_piv, sizeof(BOD) * pivkey); memcpy(p_mat->p_vkeys, p_src->p_vkeys, sizeof(p_mat->p_vkeys[0]) * pivkey); } if ((p_mat->rot_keys = rotkey)) { p_mat->p_rot = (float *) mmalloc(sizeof(p_mat->p_rot[0]) * rotkey); p_mat->p_rkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_rkeys[0]) * rotkey); memcpy(p_mat->p_rot, p_src->p_rot, sizeof(p_mat->p_rot[0]) * rotkey); memcpy(p_mat->p_rkeys, p_src->p_rkeys, sizeof(p_mat->p_rkeys[0]) * rotkey); } if ((p_mat->scs_keys = scalekey)) { p_mat->p_scale = (BOD *) mmalloc(sizeof(p_mat->p_scale[0]) * scalekey); p_mat->p_skeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_mat->p_skeys[0]) * scalekey); memcpy(p_mat->p_scale, p_src->p_scale, sizeof(p_src->p_scale[0]) * scalekey); memcpy(p_mat->p_skeys, p_src->p_skeys, sizeof(p_mat->p_skeys[0]) * scalekey); } return (p_mat); } void key_zrus_material_animace(ANIM_TEXT ** p_mat) { null_free((void **) &(*p_mat)->p_pos); null_free((void **) &(*p_mat)->p_piv); null_free((void **) &(*p_mat)->p_rot); null_free((void **) &(*p_mat)->p_scale); null_free((void **) &(*p_mat)); } /* Animace text-koordinatu materialu */ void key_sim_to_text_matrix(ANIM_TEXT * p_text, int time, GLMATRIX * p_ttext) { BOD *p; init_matrix(p_ttext); if (p_text->p_piv) { key_track_interpolace_bod_linear(&p_text->pivot, p_text->p_piv, p_text->p_vkeys, time, p_text->endtime, p_text->piv_keys, FALSE); } if (p_text->p_pos) { key_track_interpolace_bod_linear(&p_text->pos, p_text->p_pos, p_text->p_pkeys, time, p_text->endtime, p_text->pos_keys, FALSE); p_ttext->_41 = p_text->pos.x; p_ttext->_42 = p_text->pos.y; } if (p_text->p_rot) { key_track_interpolace_float_linear(&p_text->rot, p_text->p_rot, p_text->p_rkeys, time, p_text->endtime, p_text->rot_keys, FALSE); float_to_matrix(p_ttext, p_text->rot, p_text->p_piv ? &p_text->pivot : NULL); } if (p_text->p_scale) { p = &p_text->scs; key_track_interpolace_bod_linear(p, p_text->p_scale, p_text->p_skeys, time, p_text->endtime, p_text->scs_keys, FALSE); p_ttext->_11 *= p->x; p_ttext->_21 *= p->x; p_ttext->_12 *= p->y; p_ttext->_22 *= p->y; } } void key_mat_to_text_matrix(GLMATRIX * p_ttext, BOD * p_pos, float uhel, BOD * p_scale, BOD * p_pivot) { init_matrix(p_ttext); if (p_pos) { p_ttext->_41 = p_pos->x; p_ttext->_42 = p_pos->y; } if (uhel != 0.0f) float_to_matrix(p_ttext, uhel, p_pivot); if (p_scale) { p_ttext->_11 *= p_scale->x; p_ttext->_21 *= p_scale->x; p_ttext->_12 *= p_scale->y; p_ttext->_22 *= p_scale->y; } } // load text animace z text-file ANIM_TEXT *key_text_nahraj(char *p_file, char *p_dir) { ANIM_TEXT *p_track; KEY_POINT_BRS *p_spline = NULL; char pom[1000]; FILE *f; int p, r, s, v, fr; float uhel; if (chdir(p_dir)) { ddw("Unable to change directory to %s"); return (NULL); } if (!(f = fopen(p_file, "r"))) { ddw("File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, (p_dir)); return (NULL); } p = r = s = v = 0; while (fgets(pom, 999, f)) { if (pom[0] && pom[0] != '\n' && pom[0] != ';') { switch (toupper(pom[0])) { case 'P': // posun p++; break; case 'R': // rotace r++; break; case 'S': // scale s++; break; case 'V': // pivot v++; break; case 'F': // frame case 'C': // celkem framu case 'L': // spline-hodnoty break; } } } fseek(f, 0, SEEK_SET); p_track = key_vyrob_material_animace(p, r, s, v); p = r = s = v = fr = 0; while (fgets(pom, 999, f)) { if (pom[0] && pom[0] != '\n' && pom[0] != ';') { switch (toupper(pom[0])) { case 'F': // frame sscanf(pom + 1, "%d", &fr); break; case 'P': // posun p_track->p_pkeys[p].time = fr * SIM_KONSTI; p_spline = p_track->p_pkeys + p; sscanf(pom + 1, "%f %f %f", &p_track->p_pos[p].x, &p_track->p_pos[p].y, &p_track->p_pos[p].z); p++; break; case 'V': // pivot p_track->p_vkeys[v].time = fr * SIM_KONSTI; p_spline = p_track->p_vkeys + v; sscanf(pom + 1, "%f %f %f", &p_track->p_piv[v].x, &p_track->p_piv[v].y, &p_track->p_piv[v].z); v++; break; case 'R': // rotace p_track->p_rkeys[r].time = fr * SIM_KONSTI; p_spline = p_track->p_rkeys + r; sscanf(pom + 1, "%f", &uhel); p_track->p_rot[r] = DEG2RAD(uhel); r++; break; case 'S': // scale p_track->p_skeys[s].time = fr * SIM_KONSTI; p_spline = p_track->p_skeys + s; sscanf(pom + 1, "%f %f %f", &p_track->p_scale[s].x, &p_track->p_scale[s].y, &p_track->p_scale[s].z); s++; break; case 'L': if (p_spline) { sscanf(pom + 1, "%f %f %f", &p_spline->tension, &p_spline->continuity, &p_spline->bias); } break; case 'T': if (p_spline) { sscanf(pom + 1, "%f", &p_spline->tension); } break; case 'O': if (p_spline) { sscanf(pom + 1, "%f", &p_spline->continuity); } break; case 'B': if (p_spline) { sscanf(pom + 1, "%f", &p_spline->bias); } break; case 'C': // celkem framu sscanf(pom + 1, "%d", &p_track->endtime); p_track->endtime = calc_endtime(p_track->endtime); break; } } } fclose(f); return (p_track); } int key_text_uloz(ANIM_TEXT * p_track, char *p_file, char *p_dir) { FILE *f; int i, p, r, s, v, frame; int keynum; dword time; if (chdir(p_dir)) { ddw("Unable to change directory to %s"); return (FALSE); } if (!(f = fopen(p_file, "w"))) { ddw("File %s Line %d Chyba otevreni souboru '%s' v %s", __FILE__, __LINE__, p_file, (p_dir)); return (FALSE); } frame = p = r = s = v = 0; keynum = calc_keynum(p_track->endtime); fprintf(f, "C %d\n", keynum); for (i = 0; i < keynum; i++) { frame = 0; time = i * SIM_KONSTI; if (p < p_track->pos_keys && p_track->p_pkeys && p_track->p_pkeys[p].time == time) { fprintf(f, "F %d\n", i); frame++; fprintf(f, "P %f %f\n", p_track->p_pos[p].x, p_track->p_pos[p].y); p++; } if (v < p_track->piv_keys && p_track->p_vkeys && p_track->p_vkeys[v].time == time) { if (!frame) { fprintf(f, "F %d\n", i); frame++; } fprintf(f, "V %f %f\n", p_track->p_piv[v].x, p_track->p_piv[v].y); v++; } if (r < p_track->rot_keys && p_track->p_rkeys && p_track->p_rkeys[r].time == time) { if (!frame) { fprintf(f, "F %d\n", i); frame++; } fprintf(f, "R %f\n", RAD2DEG(p_track->p_rot[r])); r++; } if (s < p_track->scs_keys && p_track->p_skeys && p_track->p_skeys[s].time == time) { if (!frame) { fprintf(f, "F %d\n", i); frame++; } fprintf(f, "S %f %f\n", p_track->p_scale[s].x, p_track->p_scale[s].y); s++; } } fclose(f); return (TRUE); } void key_sim_root_vloz_pivoty_do_animace_rec(EDIT_KONTEJNER * p_kont, SIMPLE_TRACK_INFO * p_sim) { int i, o = lo_najdi_objekt_kont_ID(p_kont, p_sim->Objekt_ID); if (o != K_CHYBA) { p_sim->pivot = p_kont->p_obj[o]->pivot; } for (i = 0; i < p_sim->childnum; i++) { key_sim_root_vloz_pivoty_do_animace_rec(p_kont, p_sim->p_child + i); } } void key_sim_root_vloz_pivoty_do_animace(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_root) { int i; for (i = 0; i < p_root->childnum; i++) { key_sim_root_vloz_pivoty_do_animace_rec(p_kont, p_root->p_child + i); } } void key_sim_root_vloz_pivoty_do_animace_kont(EDIT_KONTEJNER * p_kont) { int i; for (i = 0; i < KONT_MAX_ANIM; i++) { if (p_kont->sim[i].keynum) key_sim_root_vloz_pivoty_do_animace(p_kont, p_kont->sim + i); } } /* Transformuje lokalni OBB meshe do globalni OBB Pri posunu celeho objektu */ void key_mesh_transformuj_obalky(GAME_MESH_OLD * p_mesh, GLMATRIX * p_mat) { OBB_OLD *p_src = p_mesh->p_obb_local; OBB_OLD *p_dst = p_mesh->p_obb_world; int i; for (i = 0; i < p_mesh->objektu; i++) { obb_transformuj(p_src + i, p_mat, p_dst + i); } obb_transformuj(&p_mesh->obb_local, p_mat, &p_mesh->obb_world); } /* Spocita pozuze obalku kontejneru - pri key-animaci kdy se obalky updatuji automaticky */ /* void key_mesh_calc_global_obalku(GAME_MESH_OLD *p_mesh) { obb_slep_aabb(&p_mesh->obb_world, p_mesh->p_obb_world, p_mesh->objektu); } */ void key_kont_updatuj_flagy(EDIT_KONTEJNER * p_kont) { int i, anum = 0; for (i = 0; i < KONT_MAX_ANIM; i++) { if (p_kont->sim[i].keynum) anum++; } if (!anum) { p_kont->kflag &= ~(KONT_KEYFRAME | KONT_NORMAL_ANIM); } } JOINT_KEYS *key_kost_spline_vyrob(JOINT * p_joint) { if (p_joint) { if (!p_joint->p_keys) { p_joint->p_keys = (JOINT_KEYS *) mmalloc(sizeof(p_joint->p_keys[0])); } return (p_joint->p_keys); } else { return (NULL); } } void key_kosti_updatuj_vertexy_rec(EDIT_OBJEKT * p_obj, JOINT * p_joint) { int i, v; for (i = 0; i < p_joint->vertexnum; i++) { v = p_joint->p_vertexlist[i]; if (v >= p_obj->vertexnum) { assert(v < p_obj->vertexnum); p_joint->p_vertexlist[i] = 0; } transformuj_bod_matici_bod((BOD *) (p_obj->p_vertex + v), &p_joint->m, p_obj->p_vertex_kosti + v); } // proved rekurzivni animace if (p_joint->p_next) key_kosti_updatuj_vertexy_rec(p_obj, p_joint->p_next); if (p_joint->p_child) key_kosti_updatuj_vertexy_rec(p_obj, p_joint->p_child); } void key_kosti_updatuj_vertexy(EDIT_OBJEKT * p_obj, JOINT_ANIMACE * p_animace) { if (p_animace && p_animace->p_child) { if (!p_obj->p_vertex_kosti) { int i; p_obj->p_vertex_kosti = (BOD *) mmalloc(sizeof(p_obj->p_vertex_kosti[0]) * p_obj->vertexnum); for (i = 0; i < p_obj->vertexnum; i++) { mujbod2bod(p_obj->p_vertex_kosti + i, p_obj->p_vertex + i); } } key_kosti_updatuj_vertexy_rec(p_obj, p_animace->p_child); } } void key_kosti_interpoluj_rec(JOINT * p_joint, int framenum, int loop) { JOINT_KEYS *p_key = p_joint->p_keys; int keynum = framenum; int endtime = calc_endtime(framenum); int i; init_matrix(&p_joint->m); if (p_joint->p_pos) { free(p_joint->p_pos); p_joint->p_pos = NULL; p_joint->pos_keys = 0; } if (p_joint->p_rot) { free(p_joint->p_rot); p_joint->p_rot = NULL; p_joint->rot_keys = 0; } if (p_joint->p_scs) { free(p_joint->p_scs); p_joint->p_scs = NULL; p_joint->scs_keys = 0; } if (p_key) { if (p_key->p_pos) { p_joint->p_pos = (BOD *) mmalloc(sizeof(p_joint->p_pos[0]) * keynum); p_joint->pos_keys = keynum; for (i = 0; i < keynum; i++) key_track_interpolace_bod(p_joint->p_pos + i, p_key->p_pos, p_key->p_pkeys, i * SIM_KONSTI, endtime, p_key->pos_keys, loop); } if (p_key->p_rot) { p_joint->p_rot = (QUAT *) mmalloc(sizeof(p_joint->p_rot[0]) * keynum); p_joint->rot_keys = keynum; for (i = 0; i < keynum; i++) { key_track_interpolace_quat(p_joint->p_rot + i, p_key->p_rot, p_key->p_rkeys, i * SIM_KONSTI, endtime, p_key->rot_keys, loop); } } if (p_key->p_scale) { p_joint->p_scs = (BOD *) mmalloc(sizeof(p_joint->p_scs[0]) * keynum); p_joint->scs_keys = keynum; for (i = 0; i < keynum; i++) key_track_interpolace_bod(p_joint->p_scs + i, p_key->p_scale, p_key->p_skeys, i * SIM_KONSTI, endtime, p_key->scs_keys, loop); } } // proved rekurzivni animace if (p_joint->p_next) key_kosti_interpoluj_rec(p_joint->p_next, framenum, loop); if (p_joint->p_child) key_kosti_interpoluj_rec(p_joint->p_child, framenum, loop); } // prepocita animace z klicu do linearni animace void key_kosti_interpoluj(JOINT_ANIMACE * p_animace) { if (p_animace) { key_kosti_interpoluj_rec(p_animace->p_child, p_animace->framenum, TRUE); } } void key_kosti_animuj_rec(JOINT * p_joint, GLMATRIX * p_top, int time, int keynum) { float frame, t, t1; BOD *p1, *p2, pv; int kn, lasttime; GLMATRIX *p_m = &p_joint->m; init_matrix(p_m); lasttime = (keynum - 1) * SIM_KONSTI; if (time < lasttime) { t = (float) time / SIM_KONST; frame = (float) floor((float) t); t -= frame; kn = ftoi(frame); t1 = 1.0f - t; if (p_joint->p_pos) { p1 = p_joint->p_pos + kn; p2 = p_joint->p_pos + kn + 1; p_joint->p.x = p_m->_41 = p1->x * t1 + p2->x * t; p_joint->p.y = p_m->_42 = p1->y * t1 + p2->y * t; p_joint->p.z = p_m->_43 = p1->z * t1 + p2->z * t; } if (p_joint->p_rot) { quat_to_matrix(p_m, slerp(p_joint->p_rot + kn, p_joint->p_rot + kn + 1, t, &p_joint->r)); } if (p_joint->p_scs) { p1 = p_joint->p_scs + kn; p2 = p_joint->p_scs + kn + 1; p_joint->s.x = p1->x * t1 + p2->x * t; p_joint->s.y = p1->y * t1 + p2->y * t; p_joint->s.z = p1->z * t1 + p2->z * t; scale_matrix(p_m, p_joint->s.x, p_joint->s.y, p_joint->s.z); } } else { kn = keynum - 1; if (p_joint->p_pos) { p1 = (BOD *) & p_m->_41; p_joint->p = *p1 = p_joint->p_pos[kn]; } if (p_joint->p_rot) { p_joint->r = p_joint->p_rot[kn]; quat_to_matrix(p_m, p_joint->p_rot + kn); } if (p_joint->p_scs) { p_joint->s = p_joint->p_scs[kn]; p1 = &p_joint->s; scale_matrix(p_m, p1->x, p1->y, p1->z); } } if (p_top) { transformuj_bod_matici_bod(&p_joint->pivot, p_top, &pv); pivotuj_matrix(p_m, &pv); } else { pivotuj_matrix(p_m, &p_joint->pivot); } if (p_top) { mat_mult(p_top, p_m, p_m); } if (p_joint->p_next) key_kosti_animuj_rec(p_joint->p_next, p_m, time, keynum); if (p_joint->p_child) key_kosti_animuj_rec(p_joint->p_child, p_m, time, keynum); } void key_kosti_animuj(JOINT_ANIMACE * p_animace) { if (p_animace) { key_kosti_animuj_rec(p_animace->p_child, NULL, p_animace->time, p_animace->framenum); } } #define MAX_TIME 0xfffffffe #define NO_TIME 0xffffffff void key_kosti_serad_klice(byte * p_hodnoty, KEY_POINT_BRS * p_skeys, int keynum, int size_of_hodnota) { KEY_POINT_BRS *p_nkeys = (KEY_POINT_BRS *) mmalloc(sizeof(p_nkeys[0]) * keynum); byte *p_nhod = (byte *) mmalloc(sizeof(byte) * size_of_hodnota * keynum); dword min_time, min_klic; int i, new_akt = 0; while (1) { min_time = MAX_TIME; for (i = 0; i < keynum; i++) { if (p_skeys[i].time <= min_time) { min_time = p_skeys[i].time; min_klic = i; } } if (min_time == MAX_TIME) break; p_nkeys[new_akt] = p_skeys[min_klic]; memcpy(p_nhod + new_akt * size_of_hodnota, p_hodnoty + min_klic * size_of_hodnota, sizeof(byte) * size_of_hodnota); new_akt++; p_skeys[min_klic].time = NO_TIME; } memcpy(p_hodnoty, p_nhod, sizeof(byte) * size_of_hodnota * keynum); memcpy(p_skeys, p_nkeys, sizeof(p_nkeys[0]) * keynum); free(p_nkeys); free(p_nhod); } /* Streamovy animace vertexu */ void key_kosti_stream_animuj_rec(JOINT_ANIMACE * p_anim, JOINT * p_joint, GLMATRIX * p_top, int time, int keynum) { float frame, t, t1, x1, y1, z1, x2, y2, z2; BOD *p1, *p2, pv; BOD *ps1in, *ps1out; BOD *ps2in, *ps2out; BOD *pv1, *pv2, *pv3, *pv4; int kn, lasttime, num, *p_ind, i, v; GLMATRIX *p_m; while (p_joint) { p_m = init_matrix(&p_joint->m); lasttime = (keynum - 1) * SIM_KONSTI; if (time < lasttime) { t = ((float) time) / SIM_KONST; frame = (float) floor((float) t); t -= frame; kn = ftoi(frame); t1 = 1.0f - t; if (p_joint->p_pos) { p1 = p_joint->p_pos + kn; p2 = p_joint->p_pos + kn + 1; p_m->_41 = p1->x * t1 + p2->x * t; p_m->_42 = p1->y * t1 + p2->y * t; p_m->_43 = p1->z * t1 + p2->z * t; } if (p_joint->p_rot) { quat_to_matrix(p_m, slerp(p_joint->p_rot + kn, p_joint->p_rot + kn + 1, t, &p_joint->r)); } if (p_joint->p_scs) { p1 = p_joint->p_scs + kn; p2 = p_joint->p_scs + kn + 1; scale_matrix(p_m, p1->x * t1 + p2->x * t, p1->y * t1 + p2->y * t, p1->z * t1 + p2->z * t); } } else { kn = keynum - 1; if (p_joint->p_pos) { p1 = (BOD *) & p_m->_41; *p1 = p_joint->p_pos[kn]; } if (p_joint->p_rot) { quat_to_matrix(p_m, p_joint->p_rot + kn); } if (p_joint->p_scs) { p1 = p_joint->p_scs + kn; scale_matrix(p_m, p1->x, p1->y, p1->z); } } if (p_top) { transformuj_bod_matici_bod(&p_joint->pivot, p_top, &pv); pivotuj_matrix(p_m, &pv); } else { pivotuj_matrix(p_m, &p_joint->pivot); } if (p_top) { mat_mult(p_top, p_m, p_m); } ps1in = p_anim->p_pos_in; ps1out = p_anim->p_pos_out; ps2in = p_anim->p_norm_in; ps2out = p_anim->p_norm_out; num = p_joint->vertexnum; p_ind = p_joint->p_vertexlist; if (ps1in && ps1out && ps2in && ps2out) { num = p_joint->vertexnum; p_ind = p_joint->p_vertexlist; for (i = 0; i < num; i++) { v = *p_ind++; pv1 = ps1in + v; pv2 = ps1out + v; pv3 = ps2in + v; pv4 = ps2out + v; x1 = pv1->x; y1 = pv1->y; z1 = pv1->z; x2 = pv3->x; y2 = pv3->y; z2 = pv3->z; pv2->x = p_m->_11 * x1 + p_m->_21 * y1 + p_m->_31 * z1 + p_m->_41; pv4->x = p_m->_11 * x2 + p_m->_21 * y2 + p_m->_31 * z2; pv2->y = p_m->_12 * x1 + p_m->_22 * y1 + p_m->_32 * z1 + p_m->_42; pv4->y = p_m->_12 * x2 + p_m->_22 * y2 + p_m->_32 * z2; pv2->z = p_m->_13 * x1 + p_m->_23 * y1 + p_m->_33 * z1 + p_m->_43; pv4->z = p_m->_13 * x2 + p_m->_23 * y2 + p_m->_33 * z2; } } if (p_joint->p_next) key_kosti_stream_animuj_rec(p_anim, p_joint->p_next, p_m, time, keynum); p_top = p_m; p_joint = p_joint->p_child; } } JOINT_KEYS *key_joint_kopiruj_spline(JOINT_KEYS * p_src) { if (p_src) { JOINT_KEYS *p_new = (JOINT_KEYS *) kopiruj_pole(p_src, sizeof(p_src[0])); p_new->p_pkeys = (KEY_POINT_BRS *) kopiruj_pole(p_new->p_pkeys, sizeof(p_new->p_pkeys[0]) * p_new->pos_keys); p_new->p_pos = (BOD *) kopiruj_pole(p_new->p_pos, sizeof(p_new->p_pos[0]) * p_new->pos_keys); p_new->p_rkeys = (KEY_POINT_BRS *) kopiruj_pole(p_new->p_rkeys, sizeof(p_new->p_rkeys[0]) * p_new->rot_keys); p_new->p_rot = (QUAT *) kopiruj_pole(p_new->p_rot, sizeof(p_new->p_rot[0]) * p_new->rot_keys); p_new->p_skeys = (KEY_POINT_BRS *) kopiruj_pole(p_new->p_skeys, sizeof(p_new->p_skeys[0]) * p_new->scs_keys); p_new->p_scale = (BOD *) kopiruj_pole(p_new->p_scale, sizeof(p_new->p_scale[0]) * p_new->scs_keys); return (p_new); } else { return (NULL); } } JOINT *key_joint_kopiruj(JOINT * p_src) { JOINT *p_new = (JOINT *) kopiruj_pole(p_src, sizeof(p_src[0])); p_new->p_vertexlist = (int *) kopiruj_pole(p_src->p_vertexlist, sizeof(p_new->p_vertexlist[0]) * p_new->vertexnum); p_new->p_pos = (BOD *) kopiruj_pole(p_src->p_pos, sizeof(p_new->p_pos[0]) * p_new->pos_keys); p_new->p_rot = (QUAT *) kopiruj_pole(p_src->p_rot, sizeof(p_new->p_rot[0]) * p_new->rot_keys); p_new->p_scs = (BOD *) kopiruj_pole(p_src->p_scs, sizeof(p_new->p_scs[0]) * p_new->scs_keys); p_new->p_keys = key_joint_kopiruj_spline(p_src->p_keys); return (p_new); } JOINT *key_joint_vyrob(void) { JOINT *p_src = (JOINT *) mmalloc(sizeof(p_src[0])); p_src->r.w = 1; p_src->s.x = p_src->s.y = p_src->s.z = 1.0f; init_matrix(&p_src->m); return (p_src); } JOINT *key_kosti_kopiruj_rec(JOINT * p_src) { JOINT *p_new = key_joint_kopiruj(p_src); if (p_src->p_next) p_new->p_next = key_kosti_kopiruj_rec(p_src->p_next); if (p_src->p_child) p_new->p_child = key_kosti_kopiruj_rec(p_src->p_child); return (p_new); } /* Skopiruje animace kosti */ JOINT_ANIMACE *key_kosti_kopiruj(JOINT_ANIMACE * p_src) { JOINT_ANIMACE *p_new = (JOINT_ANIMACE *) mmalloc(sizeof(p_src[0])); memcpy(p_new, p_src, sizeof(p_src[0])); p_new->p_child = key_kosti_kopiruj_rec(p_new->p_child); return (p_new); } JOINT_ANIMACE *key_kosti_kopiruj_animace(JOINT_ANIMACE * p_prvni) { JOINT_ANIMACE *p_tmp; JOINT_ANIMACE *p_frs = NULL; while (p_prvni) { if (!p_frs) { p_frs = p_tmp = key_kosti_kopiruj(p_prvni); } else { p_tmp->p_next = key_kosti_kopiruj(p_prvni); } p_prvni = p_prvni->p_next; } return (p_frs); } berusky2-0.12/src/komat/3dinterface.h0000644000175000017500000006132613674454641014413 00000000000000/* 3D interface */ #ifndef __3D_INTERFACE_H__ #define __3D_INTERFACE_H__ /* Stavovy stroj */ extern int glstav_blending; // blending on-off extern int glstav_cull; // cull mod extern int glstav_cull_mod; // jaka strana se orezava extern int glstav_lighting; // gl svetla extern int glstav_specular; // spekularni svetla extern int glstav_diffuse; // diffusni svetla extern int glstav_mlha; extern int glstav_mlha_causal; extern int glstav_array_diffuse; extern int glstav_array_specular; extern int glstav_array_normal; extern int glstav_genenv_s[6]; // 1 extern int glstav_genenv_t[6]; // 2 extern int glstav_genenv_r[6]; // 3 extern int glstav_genenv_q[6]; // 4 extern int glstav_multitext_units; extern int glstav_alfa_blok; extern int glstav_alfa_test; extern int glstav_text_blok[6]; extern int glstav_cliping; extern int glstav_pn_triangles; extern int glstav_deph_test; extern int glstav_zmask; extern int glstav_bump_mapping; extern int glstav_zmena_kamery; extern int glstav_text_akt; // aktivni texury extern int glstav_text_akt_client; // aktivni klientska texura extern int glstav_textury_1d[6]; // textury extern int glstav_textury_2d[6]; // textury extern GLuint glstav_last_text_1d[6]; // posledni textura extern GLuint glstav_last_text_2d[6]; // posledni textura extern int glstav_text_array[6]; // texturovaci pole extern int glstav_text_array_akt; // aktualni texturovaci pole extern int glstav_text_map_indicie[6]; // mapovaci indicie pro textury (cislo mapy, cislo stavu) extern int glstav_text_poly_indicie; // mapovaci indicie pro poly (cislo mapy) extern unsigned int glstav_posun_flagy2[6]; extern unsigned int glstav_texgen_on[6]; extern unsigned int glstav_texgen_eye_lin_flagy[6]; extern unsigned int glstav_texgen_sphere_flagy[6]; extern GLMATRIX glstav_texgen[6]; extern int glstav_view_x; extern int glstav_view_y; extern int glstav_view_dx; extern int glstav_view_dy; extern int glstav_matrix_2d_mod; //#define STATE_BLOK_PRUHL 50 // zpruhlednovaci state blok #define STATE_BLOK_PRUHL 50 #define STAGE_ALFA_FUNKCI 5 #define STAGE_TEXT_FUNKCI 9 extern STAGE_FUNC_ALFA p_alfa_stage_func[STAGE_ALFA_FUNKCI]; extern STAGE_FUNC p_text_stage_func[STAGE_TEXT_FUNKCI]; extern STAGE_FUNC_ELEM p_text_stage_func_elem[STAGE_TEXT_FUNKCI]; extern EDIT_STATE_ALFA_BLOK alfa_stage_edit_blok[STAGE_ALFA_FUNKCI + STATE_BLOK_PRUHL + 1]; extern EDIT_STATE_TEXT_BLOK text_stage_edit_blok[STAGE_TEXT_FUNKCI]; #define STAGE_ALFA_MASKA 4 #define BLOK_MODULACE 0 #define BLOK_ADD 1 #define BLOK_DECAL 2 #define BLOK_BLEND 3 #define BLOK_REPLACE 4 #define BLOK_DOT3_BUMP 5 #define BLOK_MODULACE2X 6 #define BLOK_BUMP_ENV 7 /* Define pro stage_funkce */ #define DOT3_BUMP 0 #define DOT3_TEXT 1 #define DOT3_ENV 2 #define DUDV_BUMP 0 // normalova mapa #define DUDV_ENV 1 // Environment-mapa #define DUDV_TEXT 2 // zakladni textura /* Automaticky nahrazovani */ #define AUTO_BUMP_DOT3 5 // dot3 color blok #define AUTO_BUMP_DOT3ENV 6 // dot3 env blok void nahod_state_bloky(void); #define MAX_WORD_MATRIX_STACK 32 extern GLMATRIX __mat_kamera; extern GLMATRIX __mat_world; extern GLMATRIX __mat_vysl; extern GLMATRIX __mat_camera_project; // transformuje 3D do 2D extern GLMATRIX __mat_init; extern GLMATRIX __mat_top_matrix[MAX_WORD_MATRIX_STACK]; // druha word-matrix -> top-matrix extern int __mat_top_matrix_akt; extern GLMATRIX __mat_tmp; extern int __mat_text[4]; #define TEXGEN_NIC 0 #define TEXGEN_SPHEREMAP 1 #define TEXGEN_EYE_LINEAR 2 void glstav_reset(void); // matmult top_matrix*wordl*camera*project /* Low-level matice */ inline GLMATRIX *set_matrix_texture(int num, GLMATRIX * p_text) { glMatrixMode(GL_TEXTURE); glLoadMatrixf((float *) p_text); __mat_text[num] = TRUE; return (p_text); } inline void ret_matrix_texture(int num) { if (__mat_text[num]) { glMatrixMode(GL_TEXTURE); glLoadIdentity(); __mat_text[num] = FALSE; } } inline GLMATRIX *get_matrix_world_camera(void) { return (&__mat_vysl); } inline GLMATRIX *set_matrix_world_top(GLMATRIX * p_top_world) { if (__mat_top_matrix_akt + 1 < MAX_WORD_MATRIX_STACK) { if (!__mat_top_matrix_akt) { __mat_top_matrix[0] = *p_top_world; } else { mat_mult_dir(__mat_top_matrix + __mat_top_matrix_akt - 1, p_top_world, __mat_top_matrix + __mat_top_matrix_akt); } mat_mult_dir(&__mat_world, __mat_top_matrix + __mat_top_matrix_akt, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_vysl); __mat_top_matrix_akt++; return (p_top_world); } else { return (NULL); } } inline void ret_matrix_world_top(void) { if (__mat_top_matrix_akt > 0) { __mat_top_matrix_akt--; if (__mat_top_matrix_akt) { mat_mult_dir(&__mat_world, __mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); } else { mat_mult_dir(&__mat_world, &__mat_kamera, &__mat_vysl); } glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_vysl); } } inline GLMATRIX *set_matrix_camera(GLMATRIX * p_cam) { memcpy(&__mat_kamera, p_cam, sizeof(GLMATRIX)); if (__mat_top_matrix_akt) { mat_mult_dir(&__mat_world, __mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); } else { mat_mult_dir(&__mat_world, &__mat_kamera, &__mat_vysl); } glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_vysl); glstav_zmena_kamery = TRUE; return (p_cam); } inline GLMATRIX *get_matrix_camera(GLMATRIX * p_cam) { memcpy(p_cam, &__mat_kamera, sizeof(GLMATRIX)); return (p_cam); } inline GLMATRIX *get_matrix_camera_point(void) { return (&__mat_kamera); } inline GLMATRIX *set_matrix_world(GLMATRIX * p_world) { memcpy(&__mat_world, p_world, sizeof(GLMATRIX)); if (__mat_top_matrix_akt) { mat_mult_dir(&__mat_world, __mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); } else { mat_mult_dir(&__mat_world, &__mat_kamera, &__mat_vysl); } glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_vysl); return (p_world); } inline void set_matrix_world_init(void) { memcpy(&__mat_world, &__mat_init, sizeof(GLMATRIX)); if (__mat_top_matrix_akt) { mat_mult_dir(&__mat_world, __mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); } else { mat_mult_dir(&__mat_world, &__mat_kamera, &__mat_vysl); } glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_vysl); } inline GLMATRIX *get_matrix_world(GLMATRIX * p_world) { memcpy(p_world, &__mat_world, sizeof(GLMATRIX)); return (p_world); } inline GLMATRIX *push_matrix_world(GLMATRIX * p_world) { GLMATRIX tmp1; glMatrixMode(GL_MODELVIEW); glPushMatrix(); if (__mat_top_matrix_akt) { mat_mult_dir(p_world, __mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); } else { mat_mult_dir(p_world, &__mat_kamera, &tmp1); } glLoadMatrixf((float *) &tmp1); return (p_world); } inline void pop_matrix_world(void) { glMatrixMode(GL_MODELVIEW); glPopMatrix(); } inline void set_matrix_all(GLMATRIX * p_cam, GLMATRIX * p_world) { memcpy(&__mat_kamera, p_cam, sizeof(GLMATRIX)); memcpy(&__mat_world, p_world, sizeof(GLMATRIX)); if (__mat_top_matrix_akt) { mat_mult_dir(&__mat_world, __mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_tmp); mat_mult_dir(&__mat_tmp, &__mat_kamera, &__mat_vysl); } else { mat_mult_dir(&__mat_world, &__mat_kamera, &__mat_vysl); } glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_vysl); glstav_zmena_kamery = TRUE; } inline GLMATRIX *set_matrix_project(GLMATRIX * p_project) { glMatrixMode(GL_PROJECTION); glLoadMatrixf((float *) p_project); return (p_project); } inline GLMATRIX *get_matrix_project(GLMATRIX * p_project) { return (p_project); } inline GLMATRIX *set_matrix_project_push(GLMATRIX * p_project) { glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixf((float *) p_project); return (p_project); } inline void set_matrix_project_pop(void) { glMatrixMode(GL_PROJECTION); glPopMatrix(); } inline void set_matrix_view(int x, int y, int max_x, int max_y) { glstav_view_x = x; glstav_view_y = y; glstav_view_dx = max_x; glstav_view_dy = max_y; glViewport(x, y, max_x, max_y); } inline void get_matrix_view(int *p_x, int *p_y, int *p_max_x, int *p_max_y) { *p_x = glstav_view_x; *p_y = glstav_view_y; *p_max_x = glstav_view_dx; *p_max_y = glstav_view_dy; } inline void set_matrix_2d(int xres, int yres) { if (!glstav_matrix_2d_mod) { glstav_matrix_2d_mod = TRUE; glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0.0f, xres, yres, 0.0f, 0.0f, 1.0f); } } inline void ret_matrix_2d(void) { if (glstav_matrix_2d_mod) { glstav_matrix_2d_mod = FALSE; glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } } inline void set_matrix_init(void) { init_matrix(&__mat_init); } inline GLMATRIX *get_matrix_init(void) { return (&__mat_init); } inline void set_matrix_camera_project(GLMATRIX * p_project) { if (__mat_top_matrix_akt) { mat_mult_dir(__mat_top_matrix + __mat_top_matrix_akt - 1, &__mat_kamera, &__mat_tmp); mat_mult_dir(&__mat_tmp, p_project, &__mat_camera_project); } else { mat_mult_dir(&__mat_kamera, p_project, &__mat_camera_project); } } inline GLMATRIX *get_matrix_camera_project(void) { return (&__mat_camera_project); } /* Nastaveni cullingu */ inline void cull_on(void) { if (!glstav_cull) { glEnable(GL_CULL_FACE); glstav_cull = TRUE; } } inline void cull_off(void) { if (glstav_cull) { glDisable(GL_CULL_FACE); glstav_cull = FALSE; } } inline void cull_back(void) { if (glstav_cull_mod != 1) { glstav_cull_mod = 1; glFrontFace(GL_CCW); } } inline void cull_front(void) { if (glstav_cull_mod != 2) { glstav_cull_mod = 2; glFrontFace(GL_CW); } } inline void cull_nastav(int cull) { if (!cull) { cull_off(); } else if (cull == 1) { cull_on(); cull_back(); } else if (cull == 2) { cull_on(); cull_front(); } } inline void cull_prehod(void) { if (glstav_cull_mod) { if (glstav_cull_mod == 1) { cull_front(); } else { cull_back(); } } } /* Blend-funkce */ inline void blend_set_one_zero(void) { if (glstav_blending) { glBlendFunc(GL_ONE, GL_ZERO); } } inline void blend_get_default(GLenum * p_src, GLenum * p_dest) { *p_src = GL_ONE; *p_dest = GL_ZERO; } inline void blend_set(GLenum src, GLenum dest) { if (glstav_blending) { glBlendFunc(src, dest); } } inline void blend_off(void) { if (glstav_blending) { glstav_blending = FALSE; glDisable(GL_BLEND); } } inline void blend_on(void) { if (!glstav_blending) { glstav_blending = TRUE; glEnable(GL_BLEND); } } inline void alfa_test_off(void) { if (glstav_alfa_test) { glstav_alfa_test = FALSE; glDisable(GL_ALPHA_TEST); } } inline void alfa_test_on(void) { if (!glstav_alfa_test) { glstav_alfa_test = TRUE; glEnable(GL_ALPHA_TEST); } } inline void blend_param(int stav) { if (stav) { blend_on(); } else { blend_off(); } } /* Svetla */ inline void light_ambient_f(float *p_ambient) { glLightfv(GL_LIGHT0, GL_AMBIENT, p_ambient); } inline void light_ambient_d(dword barva) { float amb[4] = { 0, 0, 0, 1 }; rgb_float(barva, amb); glLightfv(GL_LIGHT0, GL_AMBIENT, amb); } inline void light_on_off(int stav) { if (stav) { if (!glstav_lighting) { glstav_lighting = TRUE; glEnable(GL_LIGHTING); } } else { if (glstav_lighting) { glstav_lighting = FALSE; glDisable(GL_LIGHTING); } } } inline void light_shade_smooth(void) { glShadeModel(GL_SMOOTH); } inline void light_shade_flat(void) { glShadeModel(GL_FLAT); } /* Mlha */ void fog_param(int stav); void fog_on(void); void fog_off(void); void aktivuj_mlhu(void); inline void disable_fog(void); inline void enable_fog(void); /* Textury */ /* Textury - Sigle-texturing */ inline void text_init(void) { glstav_text_akt = 0; glstav_textury_1d[0] = TRUE; glstav_textury_2d[0] = TRUE; glstav_text_array[0] = FALSE; glstav_last_text_1d[0] = FALSE; glstav_last_text_2d[0] = FALSE; glstav_textury_1d[1] = FALSE; glstav_textury_2d[1] = FALSE; glstav_text_array[1] = FALSE; glstav_last_text_1d[1] = FALSE; glstav_last_text_2d[1] = FALSE; glstav_textury_1d[2] = FALSE; glstav_textury_2d[2] = FALSE; glstav_text_array[2] = FALSE; glstav_last_text_1d[2] = FALSE; glstav_last_text_2d[2] = FALSE; glstav_textury_1d[3] = FALSE; glstav_textury_2d[3] = FALSE; glstav_text_array[3] = FALSE; glstav_last_text_1d[3] = FALSE; glstav_last_text_2d[3] = FALSE; glActiveTextureARB(GL_TEXTURE1_ARB); glDisable(GL_TEXTURE_1D); glDisable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE0_ARB); glDisable(GL_TEXTURE_1D); glDisable(GL_TEXTURE_2D); } inline void text_set(GLuint text, GLenum typ) { if (typ == GL_TEXTURE_2D) { if (glstav_textury_2d[glstav_text_akt] && glstav_last_text_2d[glstav_text_akt] != text) { glstav_last_text_2d[glstav_text_akt] = text; glBindTexture(GL_TEXTURE_2D, text); } } else { if (glstav_textury_1d[glstav_text_akt] && glstav_last_text_1d[glstav_text_akt] != text) { glstav_last_text_1d[glstav_text_akt] = text; glBindTexture(GL_TEXTURE_1D, text); } } } inline void text_on(GLenum typ) { if (typ == GL_TEXTURE_2D) { if (!glstav_textury_2d[glstav_text_akt]) { glstav_textury_2d[glstav_text_akt] = TRUE; glEnable(GL_TEXTURE_2D); } if (glstav_textury_1d[glstav_text_akt]) { glstav_textury_1d[glstav_text_akt] = FALSE; glDisable(GL_TEXTURE_1D); } } else { if (!glstav_textury_1d[glstav_text_akt]) { glstav_textury_1d[glstav_text_akt] = TRUE; glEnable(GL_TEXTURE_1D); } if (glstav_textury_2d[glstav_text_akt]) { glstav_textury_2d[glstav_text_akt] = FALSE; glDisable(GL_TEXTURE_2D); } } } inline void text_off(GLenum typ) { if (typ == GL_TEXTURE_2D) { if (glstav_textury_2d[glstav_text_akt]) { glstav_textury_2d[glstav_text_akt] = FALSE; glDisable(GL_TEXTURE_2D); } } else { if (glstav_textury_1d[glstav_text_akt]) { glstav_textury_1d[glstav_text_akt] = FALSE; glDisable(GL_TEXTURE_1D); } } } inline int text_set_num(int num) { if (num < glstav_multitext_units) { if (glstav_text_akt != num) { glstav_text_akt = num; glActiveTextureARB(GL_TEXTURE0_ARB + num); } return (TRUE); } else { return (FALSE); } } inline int text_set_num_off(int num) { if (num < glstav_multitext_units) { if (glstav_textury_1d[num] || glstav_textury_2d[num]) { if (glstav_text_akt != num) { glstav_text_akt = num; glActiveTextureARB(GL_TEXTURE0_ARB + num); } if (glstav_textury_1d[num]) { glstav_textury_1d[num] = FALSE; glDisable(GL_TEXTURE_1D); } if (glstav_textury_2d[num]) { glstav_textury_2d[num] = FALSE; glDisable(GL_TEXTURE_2D); } } glstav_text_map_indicie[num] = K_CHYBA; return (TRUE); } else { return (FALSE); } } /* Odrazy */ inline void specular_on(void) { if (!glstav_specular) { glstav_specular = TRUE; glEnable(GL_COLOR_SUM_EXT); } } inline void specular_off(void) { if (glstav_specular) { glstav_specular = FALSE; glDisable(GL_COLOR_SUM_EXT); } } inline void specular_color(float r, float g, float b) { glSecondaryColor3fEXT(r, g, b); glDisable(GL_COLOR_SUM_EXT); } /* Diffusni barvy */ inline void diffuse_off(float r, float g, float b, float a) { glstav_diffuse = FALSE; glColor4f(r, g, b, a); } inline void diffuse_on(void) { glstav_diffuse = TRUE; } /* Rendering z poli */ inline void array_specular_set(int stav) { if (stav) { if (!glstav_array_specular) { glstav_array_specular = TRUE; glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); } } else { if (glstav_array_specular) { glstav_array_specular = FALSE; glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); } } } inline void array_specular_on(void) { if (!glstav_array_specular) { glstav_array_specular = TRUE; glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); } } inline void array_specular_off(void) { if (glstav_array_specular) { glstav_array_specular = FALSE; glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); } } inline void array_diffuse_on(void) { if (!glstav_array_diffuse) { glstav_array_diffuse = TRUE; glEnableClientState(GL_COLOR_ARRAY); } } inline void array_diffuse_off(void) { if (glstav_array_diffuse) { glstav_array_diffuse = FALSE; glDisableClientState(GL_COLOR_ARRAY); } } /* Normalove vektory */ inline void array_normal_set(int stav) { if (stav) { if (!glstav_array_normal) { glstav_array_normal = TRUE; glEnableClientState(GL_NORMAL_ARRAY); } } else { if (glstav_array_normal) { glstav_array_normal = FALSE; glDisableClientState(GL_NORMAL_ARRAY); } } } inline void array_normal_on(void) { if (!glstav_array_normal) { glstav_array_normal = TRUE; glEnableClientState(GL_NORMAL_ARRAY); } } inline void array_normal_off(void) { if (glstav_array_normal) { glstav_array_normal = FALSE; glDisableClientState(GL_NORMAL_ARRAY); } } /* Vertex-listy */ inline int array_text_set_num(int num) { if (num < glstav_multitext_units) { if (num != glstav_text_array_akt) { glstav_text_array_akt = num; glClientActiveTextureARB(GL_TEXTURE0_ARB + num); } return (TRUE); } else return (FALSE); } inline void array_text_on(void) { if (!glstav_text_array[glstav_text_array_akt]) { glstav_text_array[glstav_text_array_akt] = TRUE; glEnableClientState(GL_TEXTURE_COORD_ARRAY); } } inline void array_text_off(void) { if (glstav_text_array[glstav_text_array_akt]) { glstav_text_array[glstav_text_array_akt] = FALSE; glDisableClientState(GL_TEXTURE_COORD_ARRAY); } } /* Mlha */ inline void nastav_fog(MLZNA_KOSTKA * p_mlha) { if (p_mlha) { glFogi(GL_FOG_MODE, p_mlha->mod); glFogfv(GL_FOG_COLOR, &p_mlha->r); glFogf(GL_FOG_DENSITY, p_mlha->intenzita); glFogf(GL_FOG_START, p_mlha->start); glFogf(GL_FOG_END, p_mlha->stop); } } inline void disable_fog(void) { if (glstav_mlha) { glDisable(GL_FOG); glstav_mlha = FALSE; } } inline void enable_fog(void) { if (!glstav_mlha) { glEnable(GL_FOG); glstav_mlha = TRUE; } } inline void disable_fog_causal(void) { if (glstav_mlha && glstav_mlha_causal) { glstav_mlha_causal = FALSE; glDisable(GL_FOG); } } inline void enable_fog_causal(void) { if (glstav_mlha && !glstav_mlha_causal) { glstav_mlha_causal = TRUE; glEnable(GL_FOG); } } inline void text_sharp(float sharp) { sharp = -sharp; int i; for (i = 0; i < glstav_multitext_units; i++) { text_set_num(i); glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, sharp); } } inline void reset_kamera_flag(void) { glstav_zmena_kamery = FALSE; } /* #define TEXGEN_NIC 0 #define TEXGEN_SPHEREMAP 1 #define TEXGEN_EYE_LINEAR 2 */ inline void texgen_env_on(int num) { if (glstav_genenv_s[num] != TEXGEN_SPHEREMAP) { glstav_genenv_s[num] = TEXGEN_SPHEREMAP; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_S); } if (glstav_genenv_t[num] != TEXGEN_SPHEREMAP) { glstav_genenv_t[num] = TEXGEN_SPHEREMAP; glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_T); } if (glstav_genenv_r[num]) { glstav_genenv_r[num] = FALSE; glDisable(GL_TEXTURE_GEN_R); } if (glstav_genenv_q[num]) { glstav_genenv_q[num] = FALSE; glDisable(GL_TEXTURE_GEN_Q); } } // Musi se nastavit transformacni matice pro transformace tech souradnic inline void texgen_linear_eye_2d_on(int num, float *p_spar, float *p_tpar) { GLMATRIX *p_mat = glstav_texgen + num; if (!glstav_genenv_s[num]) glEnable(GL_TEXTURE_GEN_S); if (!glstav_genenv_t[num]) glEnable(GL_TEXTURE_GEN_T); if (glstav_genenv_s[num] != TEXGEN_EYE_LINEAR) { glstav_genenv_s[num] = TEXGEN_EYE_LINEAR; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); } if (glstav_genenv_t[num] != TEXGEN_EYE_LINEAR) { glstav_genenv_t[num] = TEXGEN_EYE_LINEAR; glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); } if (glstav_zmena_kamery || p_spar[0] != p_mat->_11 || p_spar[1] != p_mat->_21 || p_spar[2] != p_mat->_31 || p_spar[3] != p_mat->_41 || p_tpar[0] != p_mat->_12 || p_tpar[1] != p_mat->_22 || p_tpar[2] != p_mat->_32 || p_tpar[3] != p_mat->_42) { p_mat->_11 = p_spar[0]; p_mat->_21 = p_spar[1]; p_mat->_31 = p_spar[2]; p_mat->_41 = p_spar[3]; p_mat->_12 = p_tpar[0]; p_mat->_22 = p_tpar[1]; p_mat->_32 = p_tpar[2]; p_mat->_42 = p_tpar[3]; glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *) &__mat_kamera); glTexGenfv(GL_S, GL_EYE_PLANE, p_spar); glTexGenfv(GL_T, GL_EYE_PLANE, p_tpar); glLoadMatrixf((float *) &__mat_vysl); } if (glstav_genenv_r[num]) { glstav_genenv_r[num] = FALSE; glDisable(GL_TEXTURE_GEN_R); } if (glstav_genenv_q[num]) { glstav_genenv_q[num] = FALSE; glDisable(GL_TEXTURE_GEN_Q); } } inline void texgen_off(int num) { if (glstav_genenv_s[num]) { glstav_genenv_s[num] = FALSE; glDisable(GL_TEXTURE_GEN_S); } if (glstav_genenv_t[num]) { glstav_genenv_t[num] = FALSE; glDisable(GL_TEXTURE_GEN_T); } if (glstav_genenv_r[num]) { glstav_genenv_r[num] = FALSE; glDisable(GL_TEXTURE_GEN_R); } if (glstav_genenv_q[num]) { glstav_genenv_q[num] = FALSE; glDisable(GL_TEXTURE_GEN_Q); } } inline void deph_test_set(int stav) { if (stav) { if (!glstav_deph_test) { glstav_deph_test = TRUE; glEnable(GL_DEPTH_TEST); } } else { if (glstav_deph_test) { glstav_deph_test = FALSE; glDisable(GL_DEPTH_TEST); } } } inline void zmask_set(int stav) { if (stav) { if (!glstav_zmask) { glstav_zmask = TRUE; glDepthMask(TRUE); } } else { if (glstav_zmask) { glstav_zmask = FALSE; glDepthMask(FALSE); } } } inline void zmask_set_fleky(int stav) { glDepthMask((GLboolean) stav); } inline void set_alfa_blok(int blok) { if (blok != glstav_alfa_blok) { glstav_alfa_blok = blok; p_alfa_stage_func[alfa_stage_edit_blok[blok].funkce] (); } } inline void text_set_blok(int text, int blok) { if (blok != glstav_text_blok[text]) { glstav_text_blok[text] = blok; p_text_stage_func_elem[blok] (); } } inline void text_stage_func_nic(int last_text) { int i = last_text; if (i != K_CHYBA) { for (; i < MAT_TEXTUR; i++) { if (!text_set_num_off(i)) return; } } } inline void reset_stage_bloky(void) { glstav_alfa_blok = K_CHYBA; glstav_text_blok[0] = K_CHYBA; glstav_text_blok[0] = K_CHYBA; glstav_text_blok[1] = K_CHYBA; glstav_text_blok[2] = K_CHYBA; glstav_text_blok[3] = K_CHYBA; glstav_text_blok[4] = K_CHYBA; glstav_text_blok[5] = K_CHYBA; } inline void text_set_num_poly(int num) { text_set_num(num); text_on(GL_TEXTURE_2D); text_set_blok(num, BLOK_MODULACE); ret_matrix_texture(num); texgen_off(num); glstav_text_poly_indicie = num; } inline void text_stage_func_nic_poly(int last_text, int poly_text) { int i = last_text; if (i != K_CHYBA) { for (; i < MAT_TEXTUR; i++) { if (!text_set_num_off(i)) { break; } } } text_set_num_poly(poly_text); } /* Vertexove pole */ void vertex_array_ini(void); extern void (*mesh_vertex_array_init) (GAME_MESH_OLD * p_mesh); extern void (*mesh_vertex_array_zrus) (GAME_MESH_OLD * p_mesh); extern void (*mesh_vertex_array_upload) (GAME_MESH_OLD * p_mesh); extern void (*mesh_vertex_array_set) (GAME_MESH_OLD * p_mesh); extern void (*mesh_vertex_array_set_koord) (GAME_MESH_OLD * p_mesh); extern void (*poly_vertex_array_init) (EDIT_MESH_POLY * p_poly); extern void (*poly_vertex_array_zrus) (EDIT_MESH_POLY * p_poly); extern void (*poly_vertex_array_upload) (EDIT_MESH_POLY * p_poly); extern void (*poly_vertex_array_set) (EDIT_MESH_POLY * p_poly); extern void (*vertex_array_start_render) (void); extern void (*vertex_array_stop_render) (void); #define BUFFER_OFFSET(i) ((char *)NULL + (i)) #endif berusky2-0.12/src/komat/Texture.h0000644000175000017500000001743513674454660013667 00000000000000/* Header s texturam */ #ifndef __TEXTURE_H__ #define __TEXTURE_H__ #define DEF_MIP_LEVEL 9 // ABGR poradi slozek typedef struct _RBITMAP { int x, y; dword *data; float *data_float; } RBITMAP; typedef RBITMAP bitmapa; #define TEXT_GEN_DOT3 0x0001 //textura se prevede na dot3 #define TEXT_GEN_DUDV 0x0002 //textura se prevede na dudv #define TEXT_FLOYD 0x0004 //aplikovat floyda #define TEXT_GEN (TEXT_GEN_DOT3|TEXT_GEN_DUDV) #define TEXT2_POUZITA 0x0001 #define TEXT2_FLARE 0x0002 typedef struct _EDIT_TEXT_OLD { char jmeno[MAX_JMENO]; //jmeno textury bitmapa *p_bmp; // pointer na bitmapu textury GLuint text; // jmeno textury GLenum typ; // typ textury (1D/2D) byte load; // = 1 text je nahrana, 0 - neni nahrana int flag; // flag - TEXT_GEN_DOT3/.... int flag2; // flag - pouzita/flare... GLint format; // format texury int trida; // trida textury int mip; // mip_mapping int mip_filtr; // filtr aplikovany na mip-mapy int std_filtr; // std filtr GLint wrap_x; // wrap/clamp GLint wrap_y; int bump; int alfa_stage; // alfa-stage z textury int no_cull; // bez culingu int floyd; int floyd_transp; } EDIT_TEXT, EDIT_TEXT_OLD; typedef struct _EDIT_TEXT_DISK { char jmeno[MAX_JMENO]; // jmeno textury int tmp; GLuint text; // jmeno textury GLenum typ; // typ textury (1D/2D) byte load; // = 1 text je nahrana, 0 - neni nahrana int flag; // flag - TEXT_GEN_DOT3/.... int flag2; // flag - pouzita/flare... GLint format; // format texury int trida; // trida textury int mip; // mip_mapping int mip_filtr; // filtr aplikovany na mip-mapy int std_filtr; // std filtr GLint wrap_x; // wrap/clamp GLint wrap_y; int bump; int alfa_stage; // alfa-stage z textury int no_cull; // bez culingu int floyd; int floyd_transp; } EDIT_TEXT_DISK; // Konfigurace textury pro nahrani z disku (format&pod.) typedef struct _EDIT_TEXT_KONFIG { char bitmapa[200]; // bitmapa char alfamap[200]; // alfamapa textury GLenum typ; // typ textury (1D/2D/3D/4D/5D/6D) GLint format; // format texury GLint wrap_x; // wrap/clamp GLint wrap_y; int mip; // mip_mapping int mip_filtr; // filtr aplikovany na mip-mapy int alfa; // alfa kanal ? int std_filtr; int bump; int alfa_stage; // alfa-stage z textury int no_cull; // bez culingu int floyd; int floyd_transp; } EDIT_TEXT_KONFIG; #define KONCOVKA_TEXT_INFO ".btx" #define MASKA_TEXT_INFO "*.btx" #define KONCOVKA_ALFA "_a" #define TEXT_16BPP 16 #define TEXT_32BPP 32 #define TEXT_DTX 128 void txt_lightmap_konfig(EDIT_TEXT_KONFIG * p_konf); bitmapa *txt_bmp2textura(bitmapa * p_bmp, EDIT_TEXT_OLD * p_text, EDIT_TEXT_KONFIG * p_konf, int _2d_text); int txt_reload_lightmap(EDIT_TEXT_OLD * p_text, bitmapa * p_bmp); int txt_nahraj_texturu_do_vram(EDIT_TEXT_OLD * p_text, EDIT_TEXT_KONFIG * p_konf); int txt_zrus_texturu_z_vram(EDIT_TEXT_OLD * p_text); int txt_nahraj_lightmapu_z_bmp(char *p_file, KFILE * f, EDIT_TEXT_OLD * p_text, int save); int txt_nahraj_texturu_z_func(char *p_dir, char *p_file, EDIT_TEXT_OLD * p_text, int save, int load, EDIT_TEXT_KONFIG * p_konf, bitmapa * (*p_load) (char *p_dir, char *p_file)); int txt_nahraj_texturu_z_dds(char *p_dir, char *p_file, EDIT_TEXT_OLD * p_text, int save); //int txt_nahraj_texturu_z_lib(APAK_HANDLE * pHandle, char *p_file, // EDIT_TEXT_OLD * p_text, int save); //int txt_nahraj_texturu_z_tga(APAK_HANDLE * pHandle, char *p_file, // EDIT_TEXT_OLD * p_text); //int txt_nahraj_texturu_dot3(APAK_HANDLE * pHandle, char *p_file, // EDIT_TEXT_OLD * p_text, int save); int txt_to_dot3(EDIT_TEXT_OLD * p_text, int save); int txt_uvolni_texturu(EDIT_TEXT_OLD * p_text); int txt_zrus_texturu(EDIT_TEXT_OLD * p_text); int txt_zrus_texturu_ram(EDIT_TEXT_OLD * p_text); bitmapa *txt_bmp2dot3(bitmapa * p_bmp); void txt_default_konfig(char *p_file, EDIT_TEXT_KONFIG * p_konf, char *p_koncovka); int txt_uloz_btx(char *p_file, int typ, int wrap_x, int wrap_y); int txt_kopiruj(EDIT_TEXT_OLD * p_dest, EDIT_TEXT_OLD * p_src); int txt_vyrob_2D_texturu(int x, int y, int filtr, int format); int txt_zrus_2D_texturu(int *p_text); int txt_zrus_lightmapu(EDIT_TEXT_OLD * p_text); byte *file_read(char *p_dir, char *p_file, int *p_read); bitmapa *bmp_vyrob(int x, int y); bitmapa *bmp_nahraj(char *p_file); bitmapa *bmp_nahraj(char *p_dir, char *p_file); bitmapa *bmp_nahraj(KFILE * f); int bmp_uloz(char *p_file, bitmapa * p_bmp); int bmp_uloz_pack(FFILE f, bitmapa * p_bmp); void bmp_zrus(bitmapa ** p_bmp); bitmapa *bmp_kopituj(bitmapa * p_bmp); inline void bmp_cti_rozmery(bitmapa * p_bmp, int *p_x, int *p_y); inline int bmp_velikost(bitmapa * p_bmp); bitmapa *bmp_prehod(bitmapa * p_bmp); bitmapa *surface2bmp(SURFACE_SDL *p_surf); void bmp2surface(bitmapa *p_bmp, SURFACE_SDL *p_surf); typedef struct _bitmapa_pixel { byte r, g, b, a; } bitmapa_pixel; /* inline dword barva_to_bmp(dword barva) { return((barva << 8)|(barva >> 24)); } */ inline dword *bmp_getpixel_ref(bitmapa * p_bmp, int x, int y) { return (p_bmp->data + (p_bmp->x * y + x)); } inline dword bmp_getpixel(bitmapa * p_bmp, int x, int y) { return (p_bmp->data[p_bmp->x * y + x]); } inline bitmapa_pixel bmp_getpixel_pix(bitmapa * p_bmp, int x, int y) { bitmapa_pixel *p_pix = (bitmapa_pixel *) p_bmp->data; return (p_pix[p_bmp->x * y + x]); } inline void bmp_putpixel(bitmapa * p_bmp, int x, int y, dword barva) { p_bmp->data[p_bmp->x * y + x] = barva; } inline void bmp_putpixel_pix(bitmapa * p_bmp, int x, int y, bitmapa_pixel barva) { bitmapa_pixel *p_pix = (bitmapa_pixel *) p_bmp->data; p_pix[p_bmp->x * y + x] = barva; } inline void bmp_cti_rozmery(bitmapa * p_bmp, int *p_x, int *p_y) { if (p_bmp) { *p_x = p_bmp->x; *p_y = p_bmp->y; } else { *p_x = 0; *p_y = 0; } } // kopiruje bitmapu do druhe vetsi na zadane souradnice // src->dest inline void bmp_kopiruj_rec(bitmapa * p_src, bitmapa * p_desc, int xp, int yp) { int x, y; for (x = 0; x < p_src->x; x++) { for (y = 0; y < p_src->y; y++) { bmp_putpixel(p_desc, x + xp, y + yp, bmp_getpixel(p_src, x, y)); } } } // src->dest inline void bmp_vyber_rec(bitmapa * p_src, bitmapa * p_desc, int xp, int yp) { int x, y; for (x = 0; x < p_desc->x; x++) { for (y = 0; y < p_desc->y; y++) { bmp_putpixel(p_desc, x, y, bmp_getpixel(p_src, x + xp, y + yp)); } } } // kopie src->desc inline void bmp_kopiruj(bitmapa * p_src, bitmapa * p_desc) { p_desc->x = p_src->x; p_desc->y = p_src->y; memcpy(p_desc->data, p_src->data, sizeof(dword) * p_src->x * p_src->y); } inline void bmp_smaz(bitmapa * p_text, dword barva) { int i, n = p_text->x * p_text->y; dword *p_col = p_text->data; for (i = 0; i < n; i++, p_col++) *p_col = barva; } inline byte PackFloatInByte(float in) { return (byte) ((in + 1.0f) / 2.0f * 255.0f); } inline int bmp_velikost(bitmapa * p_bmp) { return (p_bmp->x * p_bmp->y * 4); } void bmp_to_16bit(bitmapa * p_bmp, byte maska, int pruh); /* #define TEXT_MENU 0 #define TEXT_SYSTEM 1 #define TEXT_PRVKY 2 #define TEXT_SCENA 3 #define TEXT_LIGHT 4 #define TEXT_TRID 5 */ void txt_trida(int trida); void edit_text_from_disk(EDIT_TEXT_DISK *p_src, EDIT_TEXT *p_desc); #endif berusky2-0.12/src/komat/Di.cpp0000644000175000017500000000037413674426075013107 00000000000000/* rutiny pro obsluhu mysi a klavesnice */ #include "3d_all.h" int key[POCET_KLAVES]; int key_pressed; MYSI_INFO mi; int zapni_kurzor(void) { ShowCursor(TRUE); return (TRUE); } int vypni_kurzor(void) { ShowCursor(FALSE); return (TRUE); } berusky2-0.12/src/komat/Vektor.h0000644000175000017500000002413313674426075013471 00000000000000/* Vektory */ #ifndef __VEKTORY_H #define __VEKTORY_H #define calc_vect(_a,_b,_v)\ { \ (_v.x) = (_b.x) - (_a.x); \ (_v.y) = (_b.y) - (_a.y); \ (_v.z) = (_b.z) - (_a.z); \ } \ #define calc_vect_dir_vec(_a,_b,_v)\ { \ _v.x = _b->x - _a.x; \ _v.y = _b->y - _a.y; \ _v.z = _b->z - _a.z; \ } \ #define calc_vect_dir(_a,_b,_v)\ { \ _v.x = _b->x - _a->x; \ _v.y = _b->y - _a->y; \ _v.z = _b->z - _a->z; \ } \ #define add_vect(_a,_b,_v) \ { \ _v.x = _b.x + _a.x; \ _v.y = _b.y + _a.y; \ _v.z = _b.z + _a.z; \ } \ #define sub_vect(_a,_b,_v) \ { \ _v.x = _b.x - _a.x; \ _v.y = _b.y - _a.y; \ _v.z = _b.z - _a.z; \ } \ #define skal_soucin(_a,_b) (float)(((_b.x)*(_a.x))+((_b.y)*(_a.y))+((_b.z)*(_a.z))) #define vel_vect(_a,vel) \ { \ vel = (float)sqrt(_a.x*_a.x + _a.y*_a.y + _a.z*_a.z);\ } \ #define vel_vect_sqrt(_a) (float)((_a.x)*(_a.x)+(_a.y)*(_a.y)+(_a.z)*(_a.z)) #define vzdal_bodu_dir(_a,_b) ((float)sqrt((_b->x-_a->x)*(_b->x-_a->x)+(_b->y-_a->y)*(_b->y-_a->y)+(_b->z-_a->z)*(_b->z-_a->z))) #define vzdal_bodu_dir_sqrt(_a,_b) ((float)((_b->x-_a->x)*(_b->x-_a->x)+(_b->y-_a->y)*(_b->y-_a->y)+(_b->z-_a->z)*(_b->z-_a->z))) #define vzdal_bodu_bod_sqrt(_a,_b) (((_b.x-_a.x)*(_b.x-_a.x)+(_b.y-_a.y)*(_b.y-_a.y)+(_b.z-_a.z)*(_b.z-_a.z))) #define vzdal_bodu_bod_vec(_a,_b) ((float)sqrt((_b.x-_a->x)*(_b.x-_a->x)+(_b.y-_a->y)*(_b.y-_a->y)+(_b.z-_a->z)*(_b.z-_a->z))) #define vzdal_bodu_bod_vec_sqrt(_a,_b) ((float)sqrt((_b.x-_a->x)*(_b.x-_a->x)+(_b.y-_a->y)*(_b.y-_a->y)+(_b.z-_a->z)*(_b.z-_a->z))) #define vel_vect_dir(_a) ((float)sqrt((_a.x)*(_a.x) + (_a.y)*(_a.y) + (_a.z)*(_a.z))) #define vel_vect_dir_2d(_a) ((float)sqrt((_a.x)*(_a.x) + (_a.y)*(_a.y))) #define vel_vect_dir_vect(_a) ((float)sqrt((_a->x)*(_a->x) + (_a->y)*(_a->y) + (_a->z)*(_a->z))) #define vel_vect_dir_vect_2d(_a) ((float)sqrt((_a->x)*(_a->x) + (_a->y)*(_a->y))) #define vzdal_bodu_xy(x1,y1,z1,x2,y2,z2) ((float)sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1))+((z2)-(z1))*((z2)-(z1)))) #define vzdal_bodu_2D_xy(x1,y1,x2,y2) ((float)sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))) #define interpoluj_vec(p_a,p_b,p_i)\ {\ (p_i)->x = ((p_a)->x+(p_b)->x)*0.5f;\ (p_i)->y = ((p_a)->y+(p_b)->y)*0.5f;\ (p_i)->z = ((p_a)->z+(p_b)->z)*0.5f;\ }\ #define interpoluj_vec_bod(a,b,i)\ {\ i.nx = (a.nx+b.nx)*0.5f;\ i.ny = (a.ny+b.ny)*0.5f;\ i.nz = (a.nz+b.nz)*0.5f;\ }\ inline float vektor_uhel(BOD * p_v1, BOD * p_v2) { return ((float) p_v1->x * p_v2->x + p_v1->y * p_v2->y + p_v1->z * p_v2->z); } inline float vektor_dot_product(BOD * p_v1, BOD * p_v2) { return ((float) p_v1->x * p_v2->x + p_v1->y * p_v2->y + p_v1->z * p_v2->z); } inline float wvektor_dot_product(WBOD * p_v1, WBOD * p_v2) { return ((float) p_v1->x * p_v2->x + p_v1->y * p_v2->y + p_v1->z * p_v2->z + p_v1->w * p_v2->w); } inline BOD *vektor_soucin(BOD * u, BOD * v, BOD * c) { c->x = u->y * v->z - u->z * v->y; c->y = u->z * v->x - u->x * v->z; c->z = u->x * v->y - u->y * v->x; return (c); } inline float vektor_velikost(BOD * v) { float dis = v->x * v->x + v->y * v->y + v->z * v->z; if (dis > 0.0f) return ((float) sqrt(dis)); else return (0.0f); } inline float vektor_velikost_2D(BOD * v) { float dis = v->x * v->x + v->y * v->y; if (dis > 0.0f) return ((float) sqrt(dis)); else return (0.0f); } inline float vektor_norm(BOD * v) { float vel2, vel = vektor_velikost(v); if (vel == 0) return (0.0f); //vel = 1; else { vel2 = 1.0f / vel; v->x *= vel2; v->y *= vel2; v->z *= vel2; return (vel); } } inline float vektor_norm_2D(BOD * v) { float vel2, vel = vektor_velikost_2D(v); if (vel == 0) return (0.0f); //vel = 1; else { vel2 = 1.0f / vel; v->x *= vel2; v->y *= vel2; return (vel); } } inline float vektor_norm_mult(BOD * v, float num) { float vel2, vel = vektor_velikost(v); if (vel == 0) return (0.0f); //vel = 1; else { vel2 = num / vel; v->x *= vel2; v->y *= vel2; v->z *= vel2; return (vel); } } inline float vektor_norm_mult_vektor(BOD * v, BOD * p_mult) { float n, vel = vektor_velikost(v); if (vel == 0) return (0.0f); //vel = 1; else { n = 1.0f / vel; v->x = v->x * n * p_mult->x; v->y = v->y * n * p_mult->y; v->z = v->z * n * p_mult->z; return (vel); } } inline BOD *vektor_add(BOD * v, BOD * u, BOD * c) { c->x = v->x + u->x; c->y = v->y + u->y; c->z = v->z + u->z; return (c); } inline BOD *vektor_mult(BOD * v, BOD * u, BOD * c) { c->x = v->x * u->x; c->y = v->y * u->y; c->z = v->z * u->z; return (c); } inline BOD *vektor_sub(BOD * v, BOD * u, BOD * c) { c->x = v->x - u->x; c->y = v->y - u->y; c->z = v->z - u->z; return (c); } inline BOD *vektor_set(BOD * v, float hodnota) { v->x = hodnota; v->y = hodnota; v->z = hodnota; return (v); } inline BOD *vektor_set_all(BOD * v, float x, float y, float z) { v->x = x; v->y = y; v->z = z; return (v); } // test na preteceni #define MAX_UP 1.0f inline BOD *vektor_norm_up(BOD * v) { if (v->x > MAX_UP) v->x = MAX_UP; if (v->y > MAX_UP) v->y = MAX_UP; if (v->z > MAX_UP) v->z = MAX_UP; return (v); } // test na podteceni #define MAX_DOWN 0.0f inline BOD *vektor_norm_down(BOD * v) { if (v->x < MAX_DOWN) v->x = MAX_DOWN; if (v->y < MAX_DOWN) v->y = MAX_DOWN; if (v->z < MAX_DOWN) v->z = MAX_DOWN; return (v); } inline BOD *vektor_norm_bump(BOD * v) { v->x = v->x * 0.5f + 0.5f; v->y = v->y * 0.5f + 0.5f; v->z = v->z * 0.5f + 0.5f; return (v); } inline BOD *vektor_bod(BOD * v, BOD * u, BOD * c, float t) { float t2 = 1.0f - t; c->x = v->x * t2 + u->x * t; c->y = v->y * t2 + u->y * t; c->z = v->z * t2 + u->z * t; return (c); } inline BOD *vektor_copy(BOD * c, BOD * v) { c->x = v->x; c->y = v->y; c->z = v->z; return (c); } inline WBOD *wvektor_sub(WBOD * v, WBOD * u, WBOD * c) { c->x = v->x - u->x; c->y = v->y - u->y; c->z = v->z - u->z; c->w = v->w - u->w; return (c); } inline BOD *vektor_mult_skalar(BOD * v, float mult, BOD * c) { c->x = v->x * mult; c->y = v->y * mult; c->z = v->z * mult; return (c); } inline BOD *vektor_scale(BOD * v, float mult) { v->x *= mult; v->y *= mult; v->z *= mult; return (v); } inline BOD *vektor_fabs(BOD * v, BOD * c) { c->x = (float) fabs(v->x); c->y = (float) fabs(v->y); c->z = (float) fabs(v->z); return (c); } inline BOD *vektor_inv(BOD * v) { v->x = -(v->x); v->y = -(v->y); v->z = -(v->z); return (v); } inline float vzdal_bodu(OBJ_VERTEX * a, OBJ_VERTEX * b) { return ((float) sqrt((b->x - a->x) * (b->x - a->x) + (b->y - a->y) * (b->y - a->y) + (b->z - a->z) * (b->z - a->z))); } inline float vzdal_bodu_bod(BOD * a, BOD * b) { float v = (b->x - a->x) * (b->x - a->x) + (b->y - a->y) * (b->y - a->y) + (b->z - a->z) * (b->z - a->z); return ((v > 0.0f) ? (float) sqrt(v) : v); } inline float vzdal_bodu_2D_bod(BOD * a, BOD * b) { float v = (b->x - a->x) * (b->x - a->x) + (b->z - a->z) * (b->z - a->z); return ((v > 0.0f) ? (float) sqrt(v) : v); } inline void calc_primku_2d(BOD * a, BOD * b, float *p_k, float *p_q) { *p_k = (a->y - b->y) / (a->x - b->x); *p_q = a->y - (*p_k) * a->x; } inline void calc_primku_3d(BOD * a, BOD * b, BOD * q) // t je parametr od 0 do 1 { q->x = b->x - a->x; q->y = b->y - a->y; q->z = b->z - a->z; } inline float norm_vect(float *p_x, float *p_y, float *p_z) { float vel = (float) sqrt((*p_x) * (*p_x) + (*p_y) * (*p_y) + (*p_z) * (*p_z)); if (vel == 0.0f) return (0.0f); //vel = 1; *p_x /= vel; *p_y /= vel; *p_z /= vel; return (vel); } inline float norm_vect_2D(float *p_x, float *p_y) { float vel = (float) sqrt((*p_x) * (*p_x) + (*p_y) * (*p_y)); *p_x /= vel; *p_y /= vel; return (vel); } inline float norm_rovinu(ROVINA * r) { float vel = (float) sqrt(r->x * r->x + r->y * r->y + r->z * r->z); if (vel == 0.0f) return (0.0f); //vel = 1; r->x /= vel; r->y /= vel; r->z /= vel; r->e /= vel; return (vel); } // p,a,b - primka inline float vzdal_bodu_a_primky(BOD * p, BOD * a, BOD * b) { float ti, v; float qx, qy, qz; BOD pr; // q = B-A qx = b->x - a->x; qy = b->y - a->y; qz = b->z - a->z; ti = (b->x - a->x) * (p->x - a->x) + (b->y - a->y) * (p->y - a->y) + (b->z - a->z) * (p->z - a->z); v = vzdal_bodu_dir(a, b); ti /= (v * v); // P = A - qt pr.x = a->x + qx * ti; pr.y = a->y + qy * ti; pr.z = a->z + qz * ti; return (vzdal_bodu_bod(&pr, p)); } // p,a,b - primka inline float vzdal_bodu_a_primky_bod(BOD * p, BOD * a, BOD * b, BOD * i) { float ti, v; float qx, qy, qz; // q = B-A qx = b->x - a->x; qy = b->y - a->y; qz = b->z - a->z; ti = (b->x - a->x) * (p->x - a->x) + (b->y - a->y) * (p->y - a->y) + (b->z - a->z) * (p->z - a->z); v = vzdal_bodu_dir(a, b); ti /= (v * v); // P = A - qt i->x = a->x + qx * ti; i->y = a->y + qy * ti; i->z = a->z + qz * ti; return (vzdal_bodu_dir(i, p)); } //vraci i bod na primce a->b inline float bod_primka_bod_bod(BOD * p, BOD * a, BOD * b, BOD * i) { float ti, v; float qx, qy, qz; // q = B-A qx = b->x - a->x; qy = b->y - a->y; qz = b->z - a->z; ti = (b->x - a->x) * (p->x - a->x) + (b->y - a->y) * (p->y - a->y) + (b->z - a->z) * (p->z - a->z); v = vzdal_bodu_dir(a, b); ti /= (v * v); // P = A - qt i->x = a->x + qx * ti; i->y = a->y + qy * ti; i->z = a->z + qz * ti; return (ti); } inline float vzdal_bodu_a_roviny(BOD * p, ROVINA * r) { return ((float) fabs(r->x * p->x + r->y * p->y + r->z * p->z + r->e)); } inline float vzdal_bodu_a_roviny_nabs(BOD * p, ROVINA * r) { return (r->x * p->x + r->y * p->y + r->z * p->z + r->e); } #endif berusky2-0.12/src/komat/Berusky3d_render.cpp0000644000175000017500000022552513674426075015774 00000000000000/* Rendering berusek */ #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kamery.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Berusky3d_castice2.h" #include "Berusky3d_kofola2d.h" extern G_KONFIG ber, *p_ber; #define TEST_DIFF 0 #define RIF(min,max) (((max)+(min))*0.5f) #define DIF(min,max) (((max)-(min))*0.5f) EDIT_MATERIAL *__p_last_mat; inline float ber_vzdal_bodu_z(BOD * p_stred, GLMATRIX * p_mat) { return (p_mat->_13 * p_stred->x + p_mat->_23 * p_stred->y + p_mat->_33 * p_stred->z + p_mat->_43); } static float __flare_faktor; /* Pointery na renderovaci funkce */ void (*ber_kresli_mesh_v1) (GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt); void (*ber_kresli_mesh_v2) (GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt); void (*ber_kresli_poly_v1) (EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat); int (*ber_nastav_material_single) (EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); int (*ber_nastav_material_single_poly) (EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag); void ber_nahod_render_funkce(void) { vertex_array_ini(); ber_nastav_material_single = ber_nastav_material_single_multi_spec; ber_nastav_material_single_poly = ber_nastav_material_single_poly_multi_spec; if (gl_ext::extlist_vertex_array) { kprintf(TRUE, "Array-Vertex function ok"); ber_kresli_poly_v1 = ber_kresli_poly_array; if (gl_ext::extlist_indicie_array) { kprintf(TRUE, "Array-Indices function ok"); ber_kresli_mesh_v1 = ber_kresli_mesh_array; ber_kresli_mesh_v2 = ber_kresli_mesh_array; } else { ber_kresli_mesh_v1 = ber_kresli_mesh_vertex_multitext; ber_kresli_mesh_v2 = ber_kresli_mesh_vertex_multitext_specular; } } else { ber_kresli_mesh_v1 = ber_kresli_mesh_vertex_multitext; ber_kresli_mesh_v2 = ber_kresli_mesh_vertex_multitext_specular; ber_kresli_poly_v1 = ber_kresli_poly_vertex_multitext_specular; } } /* Inicializacni funkce */ void ber_ini_vertex_arrays(void) { /* Povoleni vertex-arrays */ glEnable(GL_VERTEX_ARRAY_EXT); } // urci jestli jsou flare viditelne void ber_viditelnost_flare(G_KONFIG * p_ber, LENS_FLARE * p_flare) { GLMATRIX *p_camera_project = get_matrix_camera_project(); float pixel_z, t, xw, yw, zw, w, ryw, sx, sy, xq, yq; int s, nx, ny, maxx, maxy, ox, oy; LENS_FLARE_SLOZ *p_sloz; BOD p; get_matrix_view(&nx, &ny, &maxx, &maxy); ox = (maxx >> 1); oy = (maxy >> 1); __flare_faktor = (float) (maxx) / 10.0f; while (p_flare) { p_flare->vid = FALSE; if (!p_flare->akt) { p_flare = p_flare->p_next; continue; } if (p_flare->p_bod) { p = *p_flare->p_bod; } else { if (p_flare->p_svetlo) { p = p_flare->p_svetlo->p; } else { p = p_flare->p; } } w = 1.0f; transformuj_wbod_matici(&p.x, &p.y, &p.z, &w, p_camera_project); p_flare->vid = (0 < p.z && p.z < w && -w < p.x && p.x <= w && -w < p.y && p.y <= w); if (p.z > 0.0f && (p_flare->vid || p_flare->p_sloz)) { p_flare->wz = p.z; //wz musi byt vetsi nez 0 a mensi nez w xw = (maxx >> 1) * (p.x / w) + ox; yw = (maxy >> 1) * (p.y / w) + oy; zw = (0.5f) * (p.z / w) + 0.5f; p_flare->wx = xw; p_flare->wy = ryw = maxy - 1 - yw; if (!(p_flare->zflag & FLR_NO_ZTEST) && p_flare->vid) { glReadPixels(ftoi(xw), ny + ftoi(yw), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pixel_z); p_flare->vid = (pixel_z >= zw); } if (p_flare->p_sloz) { xq = (float) ox - xw; yq = (float) oy - ryw; p_sloz = p_flare->p_sloz; for (s = 0; s < SLOZ_FLARE; s++) { t = p_sloz[s].vzdal; if (t > 0.0f) { t *= 1.3f; p_sloz[s].wx = sx = xw + xq * t; p_sloz[s].wy = sy = ryw + yq * t; p_sloz[s].vid = (0 <= sx && sx < maxx && 0 <= sy && sy < maxy); } else { p_sloz[s].vid = FALSE; } } } } p_flare = p_flare->p_next; } } inline void ber_kresli_flare_pre(G_KONFIG * p_ber) { int __flare_x, __flare_y, __flare_maxx, __flare_maxy; get_matrix_view(&__flare_x, &__flare_y, &__flare_maxx, &__flare_maxy); set_matrix_2d(__flare_maxx, __flare_maxy); text_set_num(1); text_off(GL_TEXTURE_1D); text_off(GL_TEXTURE_2D); text_set_num(0); text_on(GL_TEXTURE_2D); blend_on(); deph_test_set(FALSE); disable_fog_causal(); specular_off(); } inline void ber_kresli_flare_po(G_KONFIG * p_ber) { deph_test_set(TRUE); ret_matrix_2d(); reset_stage_bloky(); enable_fog_causal(); } #define SLOZ_FLARE 14 // vykresli ty viditelne spolu s pruhlednyma mesh/poly void ber_kresli_flare(G_KONFIG * p_ber, LENS_FLARE * p_flare) { EDIT_TEXT *p_text; LENS_FLARE_SLOZ *p_sloz; float dx, dy, xw, yw; int s; ber_kresli_flare_pre(p_ber); while (p_flare) { if (!p_flare->vid || !p_flare->akt) { p_flare = p_flare->p_next; continue; } blend_set(GL_SRC_ALPHA, p_flare->alfa); // Nastavim material flaru p_text = p_flare->p_mat->p_text[0]; text_set(p_text->text, p_text->typ); glColor4fv(&p_flare->r); dx = p_flare->dx * __flare_faktor; dy = p_flare->dy * __flare_faktor; xw = p_flare->wx; yw = p_flare->wy; glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-dx + xw, dy + yw, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(dx + xw, dy + yw, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(dx + xw, -dy + yw, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-dx + xw, -dy + yw, 0.0f); glEnd(); if (p_flare->p_sloz) { p_sloz = p_flare->p_sloz; for (s = 0; s < SLOZ_FLARE; s++) { if (p_sloz[s].vid) { xw = p_sloz[s].wx; yw = p_sloz[s].wy; dx = p_sloz[s].dx * __flare_faktor; dy = p_sloz[s].dy * __flare_faktor; p_text = p_sloz[s].p_mat->p_text[0]; text_set(p_text->text, p_text->typ); glColor4fv(&p_sloz[s].r); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-dx + xw, dy + yw, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(dx + xw, dy + yw, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(dx + xw, -dy + yw, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-dx + xw, -dy + yw, 0.0f); glEnd(); } } } p_flare = p_flare->p_next; } ber_kresli_flare_po(p_ber); } inline void ber_render_polylistu_start(void) { set_matrix_world_init(); } int ber_nastav_material_single_multi_spec(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag) { MATERIAL_TEXT_OLD *p_stg; MATERIAL_TEXT_OLD *p_stg_smat; int i, s, t, rezerva_smat, rezerva_mat, pozice_smat, stage_smat; /* Nastaveni spekularni barvy */ if (p_mat->flag2 & (MAT2_SPECULAR | MAT2_ENV_SPEC) || kflag & KONT_DRAW_SPEC) specular_on(); else specular_off(); /* Nastaveni pruhlednosti */ if (kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { // ... prehozeni stage bloku + 50 set_alfa_blok(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage /* Alfa-blending */ set_alfa_blok(p_mat->alfa_state); } /* Test na duplicitu materialu */ if (!p_mat || __p_last_mat == p_mat) return (FALSE); __p_last_mat = p_mat; /* Nahozeni matrose-plazivce */ if (!p_smat || !p_smat->p_text[0]->load || p_mat->flag & MAT_NO_SCMT) { p_stg = p_mat->text_state; t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, 0)) == K_CHYBA) break; } else { // defaultni stage - nic text_stage_func_nic(t); break; } p_stg++; } } else { p_stg = p_mat->text_state; p_stg_smat = p_smat->text_state; pozice_smat = p_smat->smaterial_pozice; stage_smat = p_stg_smat->text_stage; if (p_smat->flag & MAT_SCENE_NUTNY) { rezerva_smat = p_smat->textur; rezerva_mat = 0; } else { rezerva_smat = 0; rezerva_mat = p_mat->textur; } t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if (i == pozice_smat) { if ((t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, rezerva_mat)) == K_CHYBA) break; rezerva_smat = 0; } if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, rezerva_smat)) == K_CHYBA) break; } else { // defaultni stage - nic - konec break; } p_stg++; } if (i < pozice_smat) { t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, 0); } text_stage_func_nic(t); } /* Nastaveni difusni barvy */ if (p_mat->flag2 & MAT2_DIFFUSE) { diffuse_on(); } else { diffuse_off(p_mat->dxmat.diffuse_r, p_mat->dxmat.diffuse_g, p_mat->dxmat.diffuse_b, p_mat->dxmat.diffuse_a); } /* Nastaveni z-bufferu */ deph_test_set((~p_mat->flag) & MAT_NO_ZTEST); zmask_set((~p_mat->flag) & MAT_NO_ZMASK); /* Nastaveni cullingu */ if (p_mat->flag & MAT_NO_CULL) cull_off(); else cull_on(); return (TRUE); } /* Strc to tam!!!! */ int ber_nastav_material_single_multi(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag) { MATERIAL_TEXT_OLD *p_stg; MATERIAL_TEXT_OLD *p_stg_smat; int i, s, t, rezerva_smat, rezerva_mat, pozice_smat, stage_smat; /* Nastaveni pruhlednosti */ if (kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { // ... prehozeni stage bloku + 50 set_alfa_blok(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage /* Alfa-blending */ set_alfa_blok(p_mat->alfa_state); } /* Test na duplicitu materialu */ if (!p_mat || __p_last_mat == p_mat) return (FALSE); __p_last_mat = p_mat; /* Nahozeni matrose-plazivce */ if (!p_smat || !p_smat->p_text[0]->load || p_mat->flag & MAT_NO_SCMT) { p_stg = p_mat->text_state; t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, 0)) == K_CHYBA) break; } else { // defaultni stage - nic text_stage_func_nic(t); break; } p_stg++; } } else { p_stg = p_mat->text_state; p_stg_smat = p_smat->text_state; pozice_smat = p_smat->smaterial_pozice; stage_smat = p_stg_smat->text_stage; if (p_smat->flag & MAT_SCENE_NUTNY) { rezerva_smat = p_smat->textur; rezerva_mat = 0; } else { rezerva_smat = 0; rezerva_mat = p_mat->textur; } t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if (i == pozice_smat) { if ((t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, rezerva_mat)) == K_CHYBA) break; rezerva_smat = 0; } if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, rezerva_smat)) == K_CHYBA) break; } else { // defaultni stage - nic - konec break; } p_stg++; } if (i < pozice_smat) { t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, 0); } text_stage_func_nic(t); } /* Nastaveni difusni barvy */ if (p_mat->flag2 & MAT2_DIFFUSE) { diffuse_on(); } else { diffuse_off(p_mat->dxmat.diffuse_r, p_mat->dxmat.diffuse_g, p_mat->dxmat.diffuse_b, p_mat->dxmat.diffuse_a); } /* Nastaveni z-bufferu */ deph_test_set((~p_mat->flag) & MAT_NO_ZTEST); zmask_set((~p_mat->flag) & MAT_NO_ZMASK); /* Nastaveni cullingu */ if (p_mat->flag & MAT_NO_CULL) cull_off(); else cull_on(); return (TRUE); } int ber_nastav_material_single_nic(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag) { MATERIAL_TEXT_OLD *p_stg; int s, t; /* Nastaveni pruhlednosti */ if (kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { // ... prehozeni stage bloku + 50 set_alfa_blok(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage /* Alfa-blending */ set_alfa_blok(p_mat->alfa_state); } /* Test na duplicitu materialu */ if (!p_mat || __p_last_mat == p_mat) return (FALSE); __p_last_mat = p_mat; /* Nahozeni matrose-plazivce */ p_stg = p_mat->text_state; t = 0; if ((s = p_stg->text_stage) != K_CHYBA) { p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, 0); } else { // defaultni stage - nic text_stage_func_nic(t); } /* Nastaveni difusni barvy */ if (p_mat->flag2 & MAT2_DIFFUSE) { diffuse_on(); } else { diffuse_off(p_mat->dxmat.diffuse_r, p_mat->dxmat.diffuse_g, p_mat->dxmat.diffuse_b, p_mat->dxmat.diffuse_a); } /* Nastaveni cullingu */ if (p_mat->flag & MAT_NO_CULL) cull_off(); else cull_on(); /* Nastaveni z-bufferu */ deph_test_set((~p_mat->flag) & MAT_NO_ZTEST); zmask_set((~p_mat->flag) & MAT_NO_ZMASK); return (TRUE); } /* Rendering meshe -> verze 1 -> multitexturing bez spekularu v poly */ void ber_kresli_mesh_array(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt) { int i, j, o, facenum, fnum2; int kflag = p_mesh->p_data->kflag; int key_flag = kflag & KONT_KEYFRAME; int *p_face, ind, gltyp; dword *p_vflag = p_mesh->p_kflag; #ifdef DEBUG_MOD p_ber->debug.meshu++; #endif if (!key_flag) { set_matrix_world(&p_mesh->m); } // Ma se mesh uploadoat do graficke pameti? if (p_mesh->p_data->k2flag & KONT2_UPLOAD) { mesh_vertex_array_upload(p_mesh); } mesh_vertex_array_set(p_mesh); o = p_mesh->objektu; for (i = 0; i < o; i++, p_vflag++) { // kresli to po objektech if ((*p_vflag) & KONT_VIDITELNY) { if (ber_nastav_material_single(p_ber->p_smat, p_mt[p_mesh->p_mat[i]], kflag) || !i) mesh_vertex_array_set_koord(p_mesh); #ifdef DEBUG_MOD p_ber->debug.bodu += p_mesh->objektnum[i]; p_ber->debug.objektu++; #endif if (key_flag) set_matrix_world(p_mesh->p_key + i); ind = p_mesh->facestart[i]; p_face = p_mesh->p_face + ind; facenum = p_mesh->facenum[i]; for (j = 0; j < facenum; j++) { fnum2 = *p_face++; gltyp = *p_face++; ind += 2; #ifdef DEBUG_MOD p_ber->debug.facu += fnum2; #endif if (gl_ext::extlist_arb_vertex_buffer) { glDrawElements(gltyp, fnum2, GL_UNSIGNED_INT, BUFFER_OFFSET(sizeof(p_mesh->p_face[0]) * (p_face - p_mesh->p_face))); } else { glElementPointerATI(GL_UNSIGNED_INT, p_face); glDrawElementArrayATI(gltyp, fnum2); } p_face += fnum2; } } } } /* Renderig meshe z poly-listu */ void ber_kresli_mesh_vertex_multitext_specular(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt) { BOD *p_vertex_pos = NULL; BODUV *p_vertex_text1 = NULL; BODUV *p_vertex_text2 = NULL; BODUV *p_vertex_text3 = NULL; BODUV *p_vertex_text4 = NULL; BODRGBA *p_vertex_diff = NULL; BODRGB *p_vertex_spec = NULL; BOD *p_vertex_normal; int *p_face; int v, i, j, o, d, facenum, fnum2; int kflag = p_mesh->p_data->kflag; int key_flag = kflag & KONT_KEYFRAME; dword *p_vflag = p_mesh->p_kflag; BODUV **p_map; int *p_int, ind; #ifdef DEBUG_MOD p_ber->debug.meshu++; #endif if (!key_flag) { set_matrix_world(&p_mesh->m); } o = p_mesh->objektu; p_vertex_pos = p_mesh->p_vertex_pos; p_vertex_normal = (glstav_pn_triangles || p_mesh-> p_data->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4)) ? p_mesh->p_vertex_norm : NULL; for (i = 0; i < o; i++, p_vflag++) { // kresli to po objektech if ((*p_vflag) & KONT_VIDITELNY) { if (ber_nastav_material_single(p_ber->p_smat, p_mt[p_mesh->p_mat[i]], kflag) || !i) { p_map = &p_mesh->p_vertex_uv1_material; p_int = glstav_text_map_indicie; if ((ind = *p_int++) != K_CHYBA) p_vertex_text1 = p_map[ind]; if ((ind = *p_int++) != K_CHYBA) p_vertex_text2 = p_map[ind]; if ((ind = *p_int++) != K_CHYBA) p_vertex_text3 = p_map[ind]; if ((ind = *p_int++) != K_CHYBA) p_vertex_text4 = p_map[ind]; if (kflag & KONT_DRAW_VODA) { if (glstav_diffuse) p_vertex_diff = p_mesh->p_vertex_diff_voda; p_vertex_spec = p_mesh->p_vertex_spec_voda; } else { if (glstav_diffuse) p_vertex_diff = p_mesh->p_vertex_diff; p_vertex_spec = p_mesh->p_vertex_spec; } } #ifdef DEBUG_MOD p_ber->debug.bodu += p_mesh->objektnum[i]; p_ber->debug.objektu++; #endif if (key_flag) set_matrix_world(p_mesh->p_key + i); p_face = p_mesh->p_face + p_mesh->facestart[i]; facenum = p_mesh->facenum[i]; for (j = 0; j < facenum; j++) { fnum2 = *p_face++; glBegin(*p_face++); #ifdef DEBUG_MOD p_ber->debug.facu += fnum2; #endif for (d = 0; d < fnum2; d++) { v = *p_face++; if (p_vertex_text1) glMultiTexCoord2fvARB(GL_TEXTURE0_ARB, (float *) (p_vertex_text1 + v)); if (p_vertex_text2) glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, (float *) (p_vertex_text2 + v)); if (p_vertex_text3) glMultiTexCoord2fvARB(GL_TEXTURE2_ARB, (float *) (p_vertex_text3 + v)); if (p_vertex_text4) glMultiTexCoord2fvARB(GL_TEXTURE3_ARB, (float *) (p_vertex_text4 + v)); if (p_vertex_spec) glSecondaryColor3fvEXT((float *) (p_vertex_spec + v)); if (p_vertex_normal) glNormal3fv((float *) (p_vertex_normal + v)); if (p_vertex_diff) glColor4fv((float *) (p_vertex_diff + v)); glVertex3fv((float *) (p_vertex_pos + v)); } glEnd(); } } } } void ber_kresli_mesh_vertex_multitext(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt) { BOD *p_vertex_pos = NULL; BODUV *p_vertex_text1 = NULL; BODUV *p_vertex_text2 = NULL; BODUV *p_vertex_text3 = NULL; BODUV *p_vertex_text4 = NULL; BODRGBA *p_vertex_diff = NULL; BOD *p_vertex_normal; int *p_face; int v, i, j, o, d, facenum, fnum2; int kflag = p_mesh->p_data->kflag; int key_flag = kflag & KONT_KEYFRAME; dword *p_vflag = p_mesh->p_kflag; BODUV **p_map; int *p_int, ind; #ifdef DEBUG_MOD p_ber->debug.meshu++; #endif if (!key_flag) { set_matrix_world(&p_mesh->m); } o = p_mesh->objektu; p_vertex_pos = p_mesh->p_vertex_pos; p_vertex_normal = glstav_pn_triangles || p_mesh-> p_data->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4) ? p_mesh->p_vertex_norm : NULL; for (i = 0; i < o; i++, p_vflag++) { // kresli to po objektech if ((*p_vflag) & KONT_VIDITELNY) { if (ber_nastav_material_single(p_ber->p_smat, p_mt[p_mesh->p_mat[i]], kflag) || !i) { p_map = &p_mesh->p_vertex_uv1_material; p_int = glstav_text_map_indicie; if ((ind = *p_int++) != K_CHYBA) p_vertex_text1 = p_map[ind]; if ((ind = *p_int++) != K_CHYBA) p_vertex_text2 = p_map[ind]; if ((ind = *p_int++) != K_CHYBA) p_vertex_text3 = p_map[ind]; if ((ind = *p_int++) != K_CHYBA) p_vertex_text4 = p_map[ind]; if (glstav_diffuse) p_vertex_diff = kflag & KONT_DRAW_VODA ? p_mesh-> p_vertex_diff_voda : p_mesh->p_vertex_diff; } #ifdef DEBUG_MOD p_ber->debug.bodu += p_mesh->objektnum[i]; p_ber->debug.objektu++; #endif if (key_flag) set_matrix_world(p_mesh->p_key + i); p_face = p_mesh->p_face + p_mesh->facestart[i]; facenum = p_mesh->facenum[i]; for (j = 0; j < facenum; j++) { fnum2 = *p_face++; glBegin(*p_face++); #ifdef DEBUG_MOD p_ber->debug.facu += fnum2; #endif for (d = 0; d < fnum2; d++) { v = *p_face++; if (p_vertex_text1) glMultiTexCoord2fvARB(GL_TEXTURE0_ARB, (float *) (p_vertex_text1 + v)); if (p_vertex_text2) glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, (float *) (p_vertex_text2 + v)); if (p_vertex_text3) glMultiTexCoord2fvARB(GL_TEXTURE2_ARB, (float *) (p_vertex_text3 + v)); if (p_vertex_text4) glMultiTexCoord2fvARB(GL_TEXTURE3_ARB, (float *) (p_vertex_text4 + v)); if (p_vertex_normal) glNormal3fv((float *) (p_vertex_normal + v)); if (p_vertex_diff) glColor4fv((float *) (p_vertex_diff + v)); glVertex3fv((float *) (p_vertex_pos + v)); } glEnd(); } } } } void ber_kresli_mesh_vertex(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mt) { BOD *p_vertex_pos = NULL; BOD *p_vertex_normal = NULL; BODUV *p_vertex_text1 = NULL; BODRGBA *p_vertex_diff = NULL; int v, i, j, o, d, facenum, fnum2; int kflag = p_mesh->p_data->kflag; int key_flag = kflag & KONT_KEYFRAME; int *p_face; dword *p_vflag = p_mesh->p_kflag; BODUV **p_map; int *p_int, ind; #ifdef DEBUG_MOD p_ber->debug.meshu++; #endif if (!key_flag) { set_matrix_world(&p_mesh->m); } o = p_mesh->objektu; p_vertex_pos = p_mesh->p_vertex_pos; p_vertex_normal = glstav_pn_triangles || p_mesh->p_data->m2flag & MAT2_CALC_MAP1 ? p_mesh->p_vertex_norm : NULL; for (i = 0; i < o; i++, p_vflag++) { // kresli to po objektech if ((*p_vflag) & KONT_VIDITELNY) { if (ber_nastav_material_single(p_ber->p_smat, p_mt[p_mesh->p_mat[i]], kflag) || !i) { p_map = &p_mesh->p_vertex_uv1_material; p_int = glstav_text_map_indicie; if ((ind = *p_int) != K_CHYBA) p_vertex_text1 = p_map[ind]; if (glstav_diffuse) p_vertex_diff = kflag & KONT_DRAW_VODA ? p_mesh-> p_vertex_diff_voda : p_mesh->p_vertex_diff; } #ifdef DEBUG_MOD p_ber->debug.bodu += p_mesh->objektnum[i]; p_ber->debug.objektu++; #endif if (key_flag) set_matrix_world(p_mesh->p_key + i); p_face = p_mesh->p_face + p_mesh->facestart[i]; facenum = p_mesh->facenum[i]; for (j = 0; j < facenum; j++) { fnum2 = *p_face++; glBegin(*p_face++); #ifdef DEBUG_MOD p_ber->debug.facu += fnum2; #endif if (p_vertex_normal) { for (d = 0; d < fnum2; d++) { v = *p_face++; if (p_vertex_text1) glTexCoord2fv((float *) (p_vertex_text1 + v)); if (p_vertex_diff) glColor4fv((float *) (p_vertex_diff + v)); glNormal3fv((float *) (p_vertex_normal + v)); glVertex3fv((float *) (p_vertex_pos + v)); } } else { for (d = 0; d < fnum2; d++) { v = *p_face++; if (p_vertex_text1) glTexCoord2fv((float *) (p_vertex_text1 + v)); if (p_vertex_diff) glColor4fv((float *) (p_vertex_diff + v)); glVertex3fv((float *) (p_vertex_pos + v)); } } glEnd(); } } } } void ber_kresli_obalku_mesh(GAME_MESH_OLD * p_mesh) { set_matrix_world_init(); obb_kresli_obalku(&p_mesh->obb_world, DDRGBA(1, 1, 1, 1), NULL); } void ber_kresli_obalku_poly(EDIT_MESH_POLY * p_poly) { set_matrix_world_init(); obb_kresli_obalku(&p_poly->obb, DDRGBA(1, 1, 1, 1), NULL); } inline void ber_kresli_mesh(GAME_MESH_OLD * p_mesh, EDIT_MATERIAL ** p_mat) { int kflag = p_mesh->p_data->kflag; int m2flag = p_mesh->p_data->m2flag; // Pripadne vypnuti mlhy if (kflag & KONT_NO_FOG) { disable_fog_causal(); } else { // Pripadne zapnuti mlhy if (p_mesh->p_mlha) { if (!p_ber->p_mlha_akt) enable_fog(); nastav_fog(p_mesh->p_mlha); } } #ifdef DEBUG_MOD_OBALKY ber_kresli_obalku_mesh(p_mesh); #endif // Nastaveni spec-env-mappingu if (m2flag & MAT2_ENV_SPEC && (p_ber->kamera.zmena || kflag & KONT_POHYB)) mesh_env_maping_spec(p_mesh, get_matrix_camera_point(), p_mat); // Nastaveni polygon-offsetu if (kflag & KONT_PLG_OFFSET) { glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -2.0f); } // Rendering samotneho meshe if (p_mesh->p_data->m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC) || p_mesh->p_data->kflag & KONT_DRAW_SPEC) { ber_kresli_mesh_v2(p_mesh, p_mat); } else { ber_kresli_mesh_v1(p_mesh, p_mat); } // Smazani polygon-offsetu if (kflag & KONT_PLG_OFFSET) { glDisable(GL_POLYGON_OFFSET_FILL); } // Odflagovani meshe if (kflag & KONT_POHYB_ZRUS) { p_mesh->p_data->kflag &= ~(KONT_POHYB_ZRUS | KONT_POHYB); } // Pripadne zapnuti mlhy if (p_mesh->p_data->kflag & KONT_NO_FOG) { enable_fog_causal(); } else { // Pripadne vypnuti mlhy if (p_mesh->p_mlha) { if (p_ber->p_mlha_akt) { nastav_fog(p_ber->p_mlha_akt); } else { disable_fog(); } } } } int ber_nastav_material_single_poly_multi_spec(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag) { MATERIAL_TEXT_OLD *p_stg; MATERIAL_TEXT_OLD *p_stg_smat; int i, s, t, rezerva_smat, rezerva_mat, pozice_smat, stage_smat, poly_text; /* Nastaveni spekularni barvy */ if (p_mat->flag2 & (MAT2_SPECULAR | MAT2_ENV_SPEC) || kflag & KONT_DRAW_SPEC) specular_on(); else specular_off(); /* Nastaveni pruhlednosti */ if (kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { // ... prehozeni stage bloku + 50 set_alfa_blok(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage /* Alfa-blending */ set_alfa_blok(p_mat->alfa_state); } /* Test na duplicitu materialu */ if (!p_mat || __p_last_mat == p_mat) return (FALSE); __p_last_mat = p_mat; /* Nahozeni matrose-plazivce */ if (!p_smat || !p_smat->p_text[0]->load || p_mat->flag & MAT_NO_SCMT) { p_stg = p_mat->text_state; t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, 1)) == K_CHYBA) break; } else { // defaultni stage - nic text_stage_func_nic_poly(t + 1, t); break; } p_stg++; } } else { p_stg = p_mat->text_state; p_stg_smat = p_smat->text_state; pozice_smat = p_smat->smaterial_pozice; stage_smat = p_stg_smat->text_stage; if (p_smat->flag & MAT_SCENE_NUTNY) { rezerva_smat = p_smat->textur + 1; rezerva_mat = 1; } else { rezerva_smat = 0; rezerva_mat = p_mat->textur + 1; } t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if (i == pozice_smat) { if ((t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, rezerva_mat)) == K_CHYBA) break; rezerva_smat = 1; } if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, rezerva_smat)) == K_CHYBA) break; } else { // defaultni stage - nic - konec break; } p_stg++; } poly_text = t++; if (i < pozice_smat) { t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, 1); } text_stage_func_nic_poly(t, poly_text); } /* Nastaveni difusni barvy */ if (p_mat->flag2 & MAT2_DIFFUSE) { diffuse_on(); } else { diffuse_off(p_mat->dxmat.diffuse_r, p_mat->dxmat.diffuse_g, p_mat->dxmat.diffuse_b, p_mat->dxmat.diffuse_a); } /* Nastaveni z-bufferu */ deph_test_set((~p_mat->flag) & MAT_NO_ZTEST); zmask_set((~p_mat->flag) & MAT_NO_ZMASK); /* Nastaveni cullingu */ if (p_mat->flag & MAT_NO_CULL) cull_off(); else cull_on(); return (TRUE); } int ber_nastav_material_single_poly_multi(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag) { MATERIAL_TEXT_OLD *p_stg; MATERIAL_TEXT_OLD *p_stg_smat; int i, s, t, rezerva_smat, rezerva_mat, pozice_smat, stage_smat, poly_text; /* Nastaveni pruhlednosti */ if (kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { // ... prehozeni stage bloku + 50 set_alfa_blok(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage /* Alfa-blending */ set_alfa_blok(p_mat->alfa_state); } /* Test na duplicitu materialu */ if (!p_mat || __p_last_mat == p_mat) return (FALSE); __p_last_mat = p_mat; /* Nahozeni matrose-plazivce */ if (!p_smat || !p_smat->p_text[0]->load || p_mat->flag & MAT_NO_SCMT) { p_stg = p_mat->text_state; t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, 1)) == K_CHYBA) break; } else { // defaultni stage - nic text_stage_func_nic_poly(t + 1, t); break; } p_stg++; } } else { p_stg = p_mat->text_state; p_stg_smat = p_smat->text_state; pozice_smat = p_smat->smaterial_pozice; stage_smat = p_stg_smat->text_stage; if (p_smat->flag & MAT_SCENE_NUTNY) { rezerva_smat = p_smat->textur + 1; rezerva_mat = 1; } else { rezerva_smat = 0; rezerva_mat = p_mat->textur + 1; } t = 0; for (i = 0; i < MAT_TEXTUR; i++) { if (i == pozice_smat) { if ((t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, rezerva_mat)) == K_CHYBA) break; rezerva_smat = 1; } if ((s = p_stg->text_stage) != K_CHYBA) { if ((t = p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, rezerva_smat)) == K_CHYBA) break; } else { // defaultni stage - nic - konec break; } p_stg++; } poly_text = t++; if (i < pozice_smat) { t = p_text_stage_func[stage_smat] (p_smat, text_stage_edit_blok + stage_smat, p_stg_smat, t, 1); } text_stage_func_nic_poly(t, poly_text); } /* Nastaveni difusni barvy */ if (p_mat->flag2 & MAT2_DIFFUSE) { diffuse_on(); } else { diffuse_off(p_mat->dxmat.diffuse_r, p_mat->dxmat.diffuse_g, p_mat->dxmat.diffuse_b, p_mat->dxmat.diffuse_a); } /* Nastaveni z-bufferu */ deph_test_set((~p_mat->flag) & MAT_NO_ZTEST); zmask_set((~p_mat->flag) & MAT_NO_ZMASK); /* Nastaveni cullingu */ if (p_mat->flag & MAT_NO_CULL) cull_off(); else cull_on(); return (TRUE); } int ber_nastav_material_single_poly_nic(EDIT_MATERIAL * p_smat, EDIT_MATERIAL * p_mat, dword kflag) { MATERIAL_TEXT_OLD *p_stg; int s, t; /* Nastaveni pruhlednosti */ if (kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { // ... prehozeni stage bloku + 50 set_alfa_blok(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage /* Alfa-blending */ set_alfa_blok(p_mat->alfa_state); } /* Test na duplicitu materialu */ if (!p_mat || __p_last_mat == p_mat) return (FALSE); __p_last_mat = p_mat; /* Nahozeni matrose-plazivce */ p_stg = p_mat->text_state; t = 0; if ((s = p_stg->text_stage) != K_CHYBA) { p_text_stage_func[s] (p_mat, text_stage_edit_blok + s, p_stg, t, 1); } else { // defaultni stage - nic text_stage_func_nic_poly(t + 1, t); } /* Nastaveni difusni barvy */ if (p_mat->flag2 & MAT2_DIFFUSE) { diffuse_on(); } else { diffuse_off(p_mat->dxmat.diffuse_r, p_mat->dxmat.diffuse_g, p_mat->dxmat.diffuse_b, p_mat->dxmat.diffuse_a); } /* Nastaveni z-bufferu */ deph_test_set((~p_mat->flag) & MAT_NO_ZTEST); zmask_set((~p_mat->flag) & MAT_NO_ZMASK); /* Nastaveni cullingu */ if (p_mat->flag & MAT_NO_CULL) cull_off(); else cull_on(); return (TRUE); } /* Rendering bez spekularu */ void ber_kresli_poly_array(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat) { int l, last = 0; /* Ma se poly uploadoat do graficke pameti? */ if (p_poly->kflag & KONT_UPLOAD) { poly_vertex_array_upload(p_poly); p_poly->kflag &= ~KONT_UPLOAD; } assert(p_mat[p_poly->material]); ber_nastav_material_single_poly(p_ber->p_smat, p_mat[p_poly->material], p_poly->kflag); poly_vertex_array_set(p_poly); #ifdef DEBUG_MOD p_ber->debug.poly++; p_ber->debug.facu += p_poly->facenum; p_ber->debug.bodu += p_poly->facenum; #endif for (l = 0; l < p_poly->lightnum; l++) { text_set(p_poly->p_light[l]->text, GL_TEXTURE_2D); glDrawArrays(GL_TRIANGLES, last, p_poly->p_lightnum[l]); last += p_poly->p_lightnum[l]; } } /* Rendering vcetne spekularu */ void ber_kresli_poly_vertex_multitext_specular(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat) { TEXT_KOORD *p_koord; EDIT_MATERIAL *p_amat = p_mat[p_poly->material]; int l, i, last = 0; int kflag = p_poly->kflag; int norm = glstav_pn_triangles || p_poly->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); int spec = (p_amat->flag2 & (MAT2_SPECULAR | MAT2_ENV_SPEC) || kflag & KONT_DRAW_SPEC); int *p_int, ind; assert(p_amat); ber_nastav_material_single_poly(p_ber->p_smat, p_amat, kflag); #ifdef DEBUG_MOD p_ber->debug.poly++; p_ber->debug.facu += p_poly->facenum; p_ber->debug.bodu += p_poly->facenum; #endif for (l = 0; l < p_poly->lightnum; l++) { text_set(p_poly->p_light[l]->text, GL_TEXTURE_2D); glBegin(GL_TRIANGLES); p_koord = p_poly->p_koord + last; for (i = 0; i < p_poly->p_lightnum[l]; i++) { p_int = glstav_text_map_indicie; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE0_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); p_int++; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); p_int++; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE2_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); p_int++; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE3_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + glstav_text_poly_indicie, &p_poly->p_koord[last + i].tul); if (norm) glNormal3fv(&p_koord[i].nx); if (spec) glSecondaryColor3fvEXT(&p_koord[i].sr); glColor4fv(&p_koord[i].dr); glVertex3fv(&p_koord[i].x); } glEnd(); last += p_poly->p_lightnum[l]; } } void ber_kresli_poly_vertex_multitext(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat) { TEXT_KOORD *p_koord; int l, i, last = 0; int norm = glstav_pn_triangles || p_poly->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); int *p_int, ind; assert(p_mat[p_poly->material]); ber_nastav_material_single_poly(p_ber->p_smat, p_mat[p_poly->material], p_poly->kflag); #ifdef DEBUG_MOD p_ber->debug.poly++; p_ber->debug.facu += p_poly->facenum; p_ber->debug.bodu += p_poly->facenum; #endif for (l = 0; l < p_poly->lightnum; l++) { text_set(p_poly->p_light[l]->text, GL_TEXTURE_2D); glBegin(GL_TRIANGLES); p_koord = p_poly->p_koord + last; for (i = 0; i < p_poly->p_lightnum[l]; i++) { p_int = glstav_text_map_indicie; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE0_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); p_int++; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); p_int++; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE2_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); p_int++; if ((ind = *p_int) != K_CHYBA) glMultiTexCoord2fvARB(GL_TEXTURE3_ARB, ((float *) (&p_poly->p_koord[last + i].tu1)) + ((ind) << 1)); glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + glstav_text_poly_indicie, &p_poly->p_koord[last + i].tul); glColor4fv(&p_koord[i].dr); if (norm) glNormal3fv(&p_koord[i].nx); glVertex3fv(&p_koord[i].x); } glEnd(); last += p_poly->p_lightnum[l]; } } void ber_kresli_poly_vertex(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat) { TEXT_KOORD *p_koord; int l, i, last = 0; int norm = glstav_pn_triangles || p_poly->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 | MAT2_CALC_MAP4); assert(p_mat[p_poly->material]); ber_nastav_material_single_poly(p_ber->p_smat, p_mat[p_poly->material], p_poly->kflag); #ifdef DEBUG_MOD p_ber->debug.poly++; p_ber->debug.facu += p_poly->facenum; p_ber->debug.bodu += p_poly->facenum; #endif if (norm) { for (l = 0; l < p_poly->lightnum; l++) { glBegin(GL_TRIANGLES); p_koord = p_poly->p_koord + last; for (i = 0; i < p_poly->p_lightnum[l]; i++) { glTexCoord2fv(&p_koord[i].tu1); glColor4fv(&p_koord[i].dr); glNormal3fv(&p_koord[i].nx); glVertex3fv(&p_koord[i].x); } glEnd(); last += p_poly->p_lightnum[l]; } } else { for (l = 0; l < p_poly->lightnum; l++) { glBegin(GL_TRIANGLES); p_koord = p_poly->p_koord + last; for (i = 0; i < p_poly->p_lightnum[l]; i++) { glTexCoord2fv(&p_koord[i].tu1); glColor4fv(&p_koord[i].dr); glVertex3fv(&p_koord[i].x); } glEnd(); last += p_poly->p_lightnum[l]; } } } inline void ber_kresli_poly(EDIT_MESH_POLY * p_poly, EDIT_MATERIAL ** p_mat) { int kamera_zmena = p_ber->kamera.zmena || p_ber->kamera.zmena_last; /* Pripadne vypnuti mlhy */ if (p_poly->kflag & KONT_NO_FOG) { disable_fog_causal(); } else { /* Pripadne zapnuti mlhy */ if (p_poly->p_mlha) { if (!p_ber->p_mlha_akt) enable_fog(); nastav_fog(p_poly->p_mlha); } } #ifdef DEBUG_MOD_OBALKY ber_kresli_obalku_poly(p_poly); #endif /* Env-spec mapping */ if (p_poly->m2flag & MAT2_ENV_SPEC && kamera_zmena) poly_env_maping_spec(p_poly, p_mat[p_poly->material], get_matrix_camera_point()); /* Rednering poly-listu */ ber_kresli_poly_v1(p_poly, p_mat); /* Pripadne zapnuti mlhy */ if (p_poly->kflag & KONT_NO_FOG) { enable_fog_causal(); } else { /* Pripadne vypnuti mlhy */ if (p_poly->p_mlha) { if (p_ber->p_mlha_akt) { nastav_fog(p_ber->p_mlha_akt); } else { disable_fog(); } } } } /* Rendering fleku */ void ber_kresli_fleky(G_KONFIG * p_ber, FLEK * p_topflek) { BOD *p_pos, *p_nx, *p_nz; FLEK *p_flek = p_topflek; glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, p_flek->bias); zmask_set_fleky(FALSE); while (p_flek) { if (!(p_flek->flag & FLEK_NEKRESLIT)) { ber_nastav_material_single(p_ber->p_smat, p_ber->p_mat[p_flek->material], FALSE); glColor3f(1.0f, 1.0f, 1.0f); if (p_flek->mesh != K_CHYBA) { set_matrix_world(&p_ber->p_mesh[p_flek->mesh]->m); } p_pos = &p_flek->p; p_nx = &p_flek->nx; p_nz = &p_flek->nz; glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(p_flek->u[0], p_flek->v[0]); glVertex3f(p_pos->x - p_nx->x - p_nz->x, p_pos->y - p_nx->y - p_nz->y, p_pos->z - p_nx->z - p_nz->z); glTexCoord2f(p_flek->u[1], p_flek->v[1]); glVertex3f(p_pos->x + p_nx->x - p_nz->x, p_pos->y + p_nx->y - p_nz->y, p_pos->z + p_nx->z - p_nz->z); glTexCoord2f(p_flek->u[3], p_flek->v[3]); glVertex3f(p_pos->x - p_nx->x + p_nz->x, p_pos->y - p_nx->y + p_nz->y, p_pos->z - p_nx->z + p_nz->z); glTexCoord2f(p_flek->u[2], p_flek->v[2]); glVertex3f(p_pos->x + p_nx->x + p_nz->x, p_pos->y + p_nx->y + p_nz->y, p_pos->z + p_nx->z + p_nz->z); glEnd(); } p_flek = p_flek->p_next; } glDisable(GL_POLYGON_OFFSET_FILL); zmask_set_fleky(TRUE); } /* Porovnani pruhlednych objektu */ static int ber_renderuj_scenu_pruhledne_compare(const void *p_r1, const void *p_r2) { return (ftoi((((PRUHLEDNY_OBJEKT *) p_r2)->vzdal - ((PRUHLEDNY_OBJEKT *) p_r1)->vzdal) * 1000.0f)); } /* Render hierarchie pruhlednych objektu */ void ber_renderuj_scenu_pruhledne(G_KONFIG * p_ber) { int i, last = K_CHYBA; if (p_ber->prhlnum) { qsort(p_ber->prhl, p_ber->prhlnum, sizeof(p_ber->prhl[0]), ber_renderuj_scenu_pruhledne_compare); for (i = 0; i < p_ber->prhlnum; i++) { // render pruhlednych objektu odzadu switch (p_ber->prhl[i].typ) { case PRUHLEDNY_MESH: if (last != PRUHLEDNY_MESH) { last = PRUHLEDNY_MESH; __p_last_mat = NULL; } ber_kresli_mesh((GAME_MESH_OLD *) p_ber->prhl[i].p_objekt, p_ber->p_mat); break; case PRUHLEDNY_POLY: if (last != PRUHLEDNY_POLY) { last = PRUHLEDNY_POLY; ber_render_polylistu_start(); __p_last_mat = NULL; } ber_kresli_poly((EDIT_MESH_POLY *) p_ber->prhl[i].p_objekt, p_ber->p_mat); break; default: break; } } } } void ber_renderuj_scenu_obyc(int zrc) { EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; int flag = zrc ? KONT_VIDITELNY_ZRC : KONT_VIDITELNY; /* Vyrobi list pruhlednosti */ ber_render_list_vyrob_pruhlist(p_ber); /* Reset posledniho materialu */ __p_last_mat = NULL; #ifdef DEBUG_MOD if (p_ber->debug_draty) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); #endif /* Render levelu - budu kreslit podle listu meshu */ ber_mesh_render_list_reset(p_ber); while ((p_mesh = ber_mesh_render_list_next_flag(p_ber, flag, KONT_VIDITELNY_PRUHL))) { ber_kresli_mesh(p_mesh, p_ber->p_mat); } /* Reset posledniho materialu */ __p_last_mat = NULL; /* Render poly-listu */ ber_render_polylistu_start(); ber_poly_render_list_reset(p_ber); while ((p_poly = ber_poly_render_list_next_flag(p_ber, flag, KONT_VIDITELNY_PRUHL))) { ber_kresli_poly(p_poly, p_ber->p_mat); } /* Reset posledniho materialu */ __p_last_mat = NULL; /* Zjisti viditelne flare */ if (p_ber->p_flare) ber_viditelnost_flare(p_ber, p_ber->p_flare); /* Kresli fleky sceny */ if (!zrc) { set_matrix_world_init(); disable_fog_causal(); if (p_ber->p_fleky) ber_kresli_fleky(p_ber, p_ber->p_fleky); if (p_ber->p_fleky_mesh) ber_kresli_fleky(p_ber, p_ber->p_fleky_mesh); enable_fog_causal(); } /* Render casticoveho systemu */ pe_renderuj(p_ber); /* Vykresli viditelne flare */ if (p_ber->p_flare) { disable_fog_causal(); ber_kresli_flare(p_ber, p_ber->p_flare); enable_fog_causal(); } /* Hromadny render pruhlednych objektu */ ber_renderuj_scenu_pruhledne(p_ber); #ifdef DEBUG_MOD if (p_ber->debug_draty) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); #endif } void ber_calc_clip_focus(G_KONFIG * p_ber) { BOD cp, *p_a, *p_b, *p_c, *p_d; cp.x = p_ber->p_invcam->_41; cp.y = p_ber->p_invcam->_42; cp.z = p_ber->p_invcam->_43; p_a = p_ber->zrc.p; p_b = p_ber->zrc.p + 1; p_c = p_ber->zrc.p + 2; p_d = p_ber->zrc.p + 3; calc_drovinu_bod(p_b, p_a, &cp, p_ber->zrc.r); calc_drovinu_bod(p_d, p_b, &cp, p_ber->zrc.r + 1); calc_drovinu_bod(p_c, p_d, &cp, p_ber->zrc.r + 2); calc_drovinu_bod(p_a, p_c, &cp, p_ber->zrc.r + 3); calc_drovinu_bod(p_a, p_c, p_b, p_ber->zrc.r + 4); } void ber_zrcadlo_nastav(void) { // Nastaveni propriet k zrcadlu -> klip roviny a pod. ber_calc_clip_focus(p_ber); assert(GL_MAX_CLIP_PLANES >= 4); glEnable(GL_CLIP_PLANE0); glEnable(GL_CLIP_PLANE1); glEnable(GL_CLIP_PLANE2); glEnable(GL_CLIP_PLANE3); glEnable(GL_CLIP_PLANE4); glClipPlane(GL_CLIP_PLANE0, (double *) (p_ber->zrc.r)); glClipPlane(GL_CLIP_PLANE1, (double *) (p_ber->zrc.r + 1)); glClipPlane(GL_CLIP_PLANE2, (double *) (p_ber->zrc.r + 2)); glClipPlane(GL_CLIP_PLANE3, (double *) (p_ber->zrc.r + 3)); glClipPlane(GL_CLIP_PLANE4, (double *) (p_ber->zrc.r + 4)); cull_front(); set_matrix_world_top(&p_ber->zrc.ref); set_matrix_camera_project(p_ber->p_project); } void ber_zrcadlo_zrus(void) { // Zruseni klipovacich rovin glDisable(GL_CLIP_PLANE0); glDisable(GL_CLIP_PLANE1); glDisable(GL_CLIP_PLANE2); glDisable(GL_CLIP_PLANE3); glDisable(GL_CLIP_PLANE4); // Zruseni cullingu cull_back(); ret_matrix_world_top(); set_matrix_camera_project(p_ber->p_project); // Reset materialu __p_last_mat = NULL; // Vykresleni zrcadloveho poly { ZDRCADLO_DESC_POLY *p_poly = p_ber->zrc.p_poly; int p; while (p_poly) { p = p_poly->poly; if (p != K_CHYBA && p_ber->p_poly[p].kflag & KONT_ZRCADLO) { ber_render_polylistu_start(); ber_kresli_poly(p_ber->p_poly + p, p_ber->p_mat); } p_poly = p_poly->p_next; } } } void ber_kresli_kofoli_cary(void) { KOFOLOVA_CARA *p_cara; int i; if (p_ber->car_a_kouzel && p_ber->p_cary) { deph_test_set(0); glBegin(GL_LINES); for (i = 0; i < p_ber->car_a_kouzel; i++) { p_cara = p_ber->p_cary + i; glColor3fv((float *) &p_cara->b1); glVertex3fv((float *) &p_cara->p1); glColor3fv((float *) &p_cara->b2); glVertex3fv((float *) &p_cara->p2); } glEnd(); deph_test_set(1); } } void ber_reset_render(void) { int i; glstav_text_akt = K_CHYBA; blend_off(); specular_off(); set_alfa_blok(0); zmask_set(TRUE); for (i = 0; i < MAT_TEXTUR; i++) { if (text_set_num(i)) { text_off(GL_TEXTURE_1D); text_off(GL_TEXTURE_2D); glstav_textury_1d[i] = FALSE; glstav_textury_2d[i] = FALSE; glstav_last_text_1d[i] = FALSE; glstav_last_text_2d[i] = FALSE; glstav_text_blok[i] = K_CHYBA; } } } /* Redering: 1. zrcadlova scena 2. deska zdcadla pruhedne + z_bufer on 3. vrchni scena */ void ber_renderuj_scenu(void) { int kamera_zmena = p_ber->kamera.zmena || p_ber->kamera.zmena_last; #ifdef DEBUG_MOD memset(&p_ber->debug, 0, sizeof(p_ber->debug)); #endif if (!p_ber->conf_menu_render) { /* Reset nastaveni textur & stage */ ber_reset_render(); text_sharp(txconf.text_ostrost); /* Animace kamer (Polarni/3ds) */ if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE) kani_updatuj(p_ber); /* Urci viditelnost meshu */ ber_render_list_vyrob(p_ber, p_ber->zrc_akt, kamera_zmena); /* Update materialovych animaci */ amat_updatuj(p_ber); /* Update animace textur */ tani_updatuj(p_ber); /* Update globalni animace */ rani_updatuj(p_ber); /* Updatuje mesh-key-frame animaci */ lani_updatuj(p_ber); /* Update chapadelniku */ chani_updatuj(p_ber); /* Update casticovych systemu */ pe_updatuj(p_ber); /* Animace svetel */ sdla_updatuj(p_ber); edla_updatuj(p_ber); /* Update dynamickych & statickych svetel */ dl_updatuj(p_ber); /* Update vodniho systemu */ vod_updatuj(p_ber->p_voda); /* Zapni/povol rendering mlhy */ ber_renderuj_mlhu(p_ber); /* Zpruhledneni prvku pred kamerou */ ber_zpruhledni_prvky(p_ber); /* Zpruhledneni objekty pred kamerou */ ber_kamera_zpruhledni_objekty(p_ber); if (karmin_aktivni) { glClear(GL_DEPTH_BUFFER_BIT); if (p_ber->conf_barva_pozadi_pouzit) glClear(GL_COLOR_BUFFER_BIT); set_matrix_world_init(); #ifdef DEBUG_MOD_OBALKY obbtree_kresli(&p_ber->obbtree, DDRGB(1, 0, 0)); #endif vertex_array_start_render(); if (p_ber->zrc_akt) { ber_zrcadlo_nastav(); ber_renderuj_scenu_obyc(TRUE); ber_zrcadlo_zrus(); } ber_renderuj_scenu_obyc(FALSE); vertex_array_stop_render(); ber_reset_render(); set_matrix_world_init(); ber_kresli_kofoli_cary(); #ifdef DEBUG_MOD set_matrix_2d(SCREEN_XRES, SCREEN_YRES); ber_tiskni_statistiku(p_ber); ret_matrix_2d(); if (p_ber->debug_light) dl_renderuj_svetla(p_ber); //ber_test_render_mysi(); #endif /* Nastaveni flagu zmeny kamery */ p_ber->kamera.zmena_last = p_ber->kamera.zmena; p_ber->kamera.zmena = FALSE; reset_kamera_flag(); /* Vypnuti scale-faktoru texturoveho filtru */ text_sharp(0.0f); } } /* Update fps */ ber_updatuj_fps(p_ber); /* Kofolovo nastaveni */ text_set_num(0); text_on(GL_TEXTURE_2D); text_set_blok(0, BLOK_MODULACE); } /* Prevzato z DX7 SDK */ void ber_updatuj_fps(G_KONFIG * p_ber) { #ifdef DEBUG_MOD static dword end = 0; static dword framu = 0; #endif static dword fin_time = 0; fin_time = timeGetTime() / DELICKA_CASU; p_ber->TimeLastFrame = fin_time - p_ber->TimeEndLastFrame; p_ber->TimeEndLastFrame = fin_time; p_ber->frame++; #ifdef DEBUG_MOD framu++; if (fin_time - end > 1000) { p_ber->fps = (1000 * framu) / (float) (fin_time - end); end = fin_time; framu = 0; } #endif } /* Rendering castic */ void pe_kresli_strepiny(G_KONFIG * p_ber, PARMETAC * p_par) { PAR_STREPINA *p_part; EDIT_MATERIAL *p_mat; GLMATRIX *p_cam = get_matrix_camera_point(); BOD up, rg; float r1x, r1y, r1z; float r2x, r2y, r2z; float r3x, r3y, r3z; float r4x, r4y, r4z; float x, y, z; float v1, v2, v3, v4; int frame, framelast; up.x = p_cam->_12; up.y = p_cam->_22; up.z = p_cam->_32; rg.x = p_cam->_11; rg.y = p_cam->_21; rg.z = p_cam->_31; r1x = -up.x - rg.x; r1y = -up.y - rg.y; r1z = -up.z - rg.z; r2x = -up.x + rg.x; r2y = -up.y + rg.y; r2z = -up.z + rg.z; r3x = up.x - rg.x; r3y = up.y - rg.y; r3z = up.z - rg.z; r4x = up.x + rg.x; r4y = up.y + rg.y; r4z = up.z + rg.z; if (p_par->flag & TPAR_NO_FOG) disable_fog_causal(); p_mat = p_ber->p_mat[p_par->material]; ber_nastav_material_single(NULL, p_mat, FALSE); frame = p_par->flag & TPAR_FRAME; if (frame) { framelast = amat_get_frame(p_mat); frame = (framelast != K_CHYBA); } p_part = (PAR_STREPINA *) p_par->p_first; while (p_part) { x = p_part->p.x; y = p_part->p.y; z = p_part->p.z; v1 = p_part->vel1; v2 = p_part->vel2; v3 = p_part->vel3; v4 = p_part->vel4; if (frame) amat_set_frame_text(p_mat, (int) floor(p_part->frame)); glColor3f(p_part->barva, p_part->barva, p_part->barva); glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(p_part->u1, p_part->v1); glVertex3f(x + r1x * v1, y + r1y * v1, z + r1z * v1); glTexCoord2f(p_part->u2, p_part->v2); glVertex3f(x + r2x * v2, y + r2y * v2, z + r2z * v2); glTexCoord2f(p_part->u3, p_part->v3); glVertex3f(x + r3x * v3, y + r3y * v3, z + r3z * v3); glTexCoord2f(p_part->u4, p_part->v4); glVertex3f(x + r4x * v4, y + r4y * v4, z + r4z * v4); glEnd(); p_part = p_part->p_next; } if (frame) amat_set_frame_text(p_mat, framelast); if (p_par->flag & TPAR_NO_FOG) enable_fog_causal(); } void pe_kresli_fleky(G_KONFIG * p_ber, PARMETAC * p_par) { EDIT_MATERIAL *p_mat; PAR_FLEK *p_part; BOD *p_bod; int frame, framelast; if (p_par->flag & TPAR_NO_FOG) disable_fog_causal(); p_mat = p_ber->p_mat[p_par->material]; frame = p_par->flag & TPAR_FRAME; if (frame) { framelast = amat_get_frame(p_mat); frame = (framelast != K_CHYBA); } ber_nastav_material_single(p_ber->p_smat, p_mat, FALSE); p_part = (PAR_FLEK *) p_par->p_first; while (p_part) { if (frame) amat_set_frame_text(p_mat, (int) floor(p_part->frame)); glColor4f(p_part->r, p_part->g, p_part->b, p_part->a); glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0, 0); p_bod = p_part->tmp; glVertex3f(p_bod->x, p_bod->y, p_bod->z); glTexCoord2f(1, 0); p_bod = p_part->tmp + 1; glVertex3f(p_bod->x, p_bod->y, p_bod->z); glTexCoord2f(0, 1); p_bod = p_part->tmp + 2; glVertex3f(p_bod->x, p_bod->y, p_bod->z); glTexCoord2f(1, 1); p_bod = p_part->tmp + 3; glVertex3f(p_bod->x, p_bod->y, p_bod->z); glEnd(); p_part = p_part->p_next; } if (frame) amat_set_frame_text(p_mat, framelast); if (p_par->flag & TPAR_NO_FOG) enable_fog_causal(); } /* Kresli coudy */ void pe_kresli_kour_stopu(G_KONFIG * p_ber, PARMETAC * p_mt) { GLMATRIX *p_camera_project = get_matrix_camera_project(); PARMETAC_HNIZDO *p_hnizdo; EDIT_MATERIAL *p_mat; PAR_KOUR_STOPA *p_par; BOD *p_bod, tmp[4], nx, ny, zup, up, zrg, cp(FLT_MAX, FLT_MAX, FLT_MAX), rg; float b1x, b1z, b2x, b2z, b3x, b3z, b4x, b4z; float b1y, b2y, b3y, b4y; float sx, sz; float tu, tv; float min_x, max_x, min_z, max_z; int frame, framelast; int clip = p_mt->flag & TPAR_2DCLIP; int par3d = p_mt->flag & TPAR_3D; int parhl = p_mt->flag & TPAR_HALF_LIFE; if (p_mt->flag & TPAR_NO_FOG) disable_fog_causal(); p_mat = p_ber->p_mat[p_mt->material]; frame = p_mt->flag & TPAR_FRAME; if (frame) { framelast = amat_get_frame(p_mat); frame = (framelast != K_CHYBA); } if (!par3d) { GLMATRIX *p_cam = get_matrix_world_camera(); zup.x = p_cam->_12; zup.y = p_cam->_22; zup.z = p_cam->_32; zrg.x = p_cam->_11; zrg.y = p_cam->_21; zrg.z = p_cam->_31; } if (parhl) { GLMATRIX inv; if(invert_matrix(get_matrix_world_camera(), &inv)) { cp.x = inv._41; cp.y = inv._42; cp.z = inv._43; } } ber_nastav_material_single(NULL, p_mat, FALSE); zmask_set_fleky(FALSE); cull_off(); #ifdef DEBUG_MOD p_ber->debug.hnizd = 0; p_ber->debug.hnizd_vid = 0; #endif // Prejedu pres vsechny hnizda p_hnizdo = p_mt->p_hnizdo; while (p_hnizdo) { #ifdef DEBUG_MOD_OBALKY kresli_oktanovou_bunku_minmax(&p_hnizdo->min, &p_hnizdo->max, DDRGBA(0, 0, 0, 1)); #endif #ifdef DEBUG_MOD p_ber->debug.hnizd++; #endif if (kd_visibility(&p_hnizdo->min, &p_hnizdo->max, p_camera_project)) { #ifdef DEBUG_MOD p_ber->debug.hnizd_vid++; #endif p_par = (PAR_KOUR_STOPA *) p_hnizdo->p_first; while (p_par) { if (frame) amat_set_frame_text(p_mat, (int) floor(p_par->frame)); if (!par3d) { // 2d fleky natocene ke kamere - Vypocti nove hodnoty vektor_mult_skalar(&zup, p_par->rychlost_x, &up); vektor_mult_skalar(&zrg, p_par->rychlost_y, &rg); vektor_sub(vektor_sub(&p_par->rp, &up, tmp), &rg, tmp); vektor_add(vektor_sub(&p_par->rp, &up, tmp + 1), &rg, tmp + 1); vektor_sub(vektor_add(&p_par->rp, &up, tmp + 2), &rg, tmp + 2); vektor_add(vektor_add(&p_par->rp, &up, tmp + 3), &rg, tmp + 3); } else if (par3d || parhl) { // par3d if (parhl) { BOD t1; vektor_soucin(&p_par->nx, vektor_sub(&cp, &p_par->rp, &t1), &ny); vektor_norm(&ny); vektor_scale(&ny, p_par->rychlost_y); vektor_mult_skalar(&p_par->nx, p_par->rychlost_x, &nx); } else { vektor_mult_skalar(&p_par->nx, p_par->rychlost_x, &nx); vektor_mult_skalar(&p_par->ny, p_par->rychlost_y, &ny); } vektor_sub(vektor_sub(&p_par->rp, &nx, tmp), &ny, tmp); vektor_sub(vektor_add(&p_par->rp, &nx, tmp + 1), &ny, tmp + 1); vektor_add(vektor_sub(&p_par->rp, &nx, tmp + 2), &ny, tmp + 2); vektor_add(vektor_add(&p_par->rp, &nx, tmp + 3), &ny, tmp + 3); } glColor4f(p_par->r, p_par->g, p_par->b, p_par->a); if (!clip) { glBegin(GL_TRIANGLE_STRIP); if (!p_par->rotace) { // rotace textury na castici glTexCoord2f(0, 0); glVertex3fv((float *) (tmp)); glTexCoord2f(1, 0); glVertex3fv((float *) (tmp + 1)); glTexCoord2f(0, 1); glVertex3fv((float *) (tmp + 2)); glTexCoord2f(1, 1); glVertex3fv((float *) (tmp + 3)); } else if (p_par->rotace == 3) { glTexCoord2f(0, 1); glVertex3fv((float *) (tmp)); glTexCoord2f(0, 0); glVertex3fv((float *) (tmp + 1)); glTexCoord2f(1, 1); glVertex3fv((float *) (tmp + 2)); glTexCoord2f(1, 0); glVertex3fv((float *) (tmp + 3)); } else if (p_par->rotace == 2) { glTexCoord2f(0, 1); glVertex3fv((float *) (tmp)); glTexCoord2f(1, 1); glVertex3fv((float *) (tmp + 1)); glTexCoord2f(0, 0); glVertex3fv((float *) (tmp + 2)); glTexCoord2f(1, 0); glVertex3fv((float *) (tmp + 3)); } else if (p_par->rotace == 1) { glTexCoord2f(1, 0); glVertex3fv((float *) (tmp)); glTexCoord2f(1, 1); glVertex3fv((float *) (tmp + 1)); glTexCoord2f(0, 0); glVertex3fv((float *) (tmp + 2)); glTexCoord2f(0, 1); glVertex3fv((float *) (tmp + 3)); } glEnd(); } else { min_x = p_par->x_min; max_x = p_par->x_max; min_z = p_par->z_min; max_z = p_par->z_max; p_bod = tmp; b1x = p_bod->x; b1y = p_bod->y; b1z = p_bod->z; p_bod = tmp + 1; b2x = p_bod->x; b2y = p_bod->y; b2z = p_bod->z; p_bod = tmp + 2; b3x = p_bod->x; b3y = p_bod->y; b3z = p_bod->z; p_bod = tmp + 3; b4x = p_bod->x; b4y = p_bod->y; b4z = p_bod->z; sx = p_par->p.x; sz = p_par->p.z; if (b1x < min_x && b2x < min_x && b3x < min_x && b4x < min_x) { p_par = p_par->p_next; continue; } if (b1x > max_x && b2x > max_x && b3x > max_x && b4x > max_x) { p_par = p_par->p_next; continue; } if (b1z < min_z && b2z < min_z && b3z < min_z && b4z < min_z) { p_par = p_par->p_next; continue; } if (b1z > max_z && b2z > max_z && b3z > max_z && b4z > max_z) { p_par = p_par->p_next; continue; } glBegin(GL_TRIANGLE_STRIP); if (b1x < min_x) { tu = 0.5f - 0.5f * (sx - min_x) / (sx - b1x); b1x = min_x; } else if (b1x > max_x) { tu = 0.5f + 0.5f * (max_x - sx) / (b1x - sx); b1x = max_x; } else { tu = 0.0f; } if (b1z < min_z) { tv = 0.5f - 0.5f * (sz - min_z) / (sz - b1z); b1z = min_z; } else if (b1z > max_z) { tv = 0.5f + 0.5f * (max_z - sz) / (b1z - sz); b1z = max_z; } else { tv = 0.0f; } glTexCoord2f(tu, tv); glVertex3f(b1x, b1y, b1z); if (b2x < min_x) { tu = 0.5f - 0.5f * (sx - min_x) / (sx - b2x); b2x = min_x; } else if (b2x > max_x) { tu = 0.5f + 0.5f * (max_x - sx) / (b2x - sx); b2x = max_x; } else { tu = 1.0f; } if (b2z < min_z) { tv = 0.5f - 0.5f * (sz - min_z) / (sz - b2z); b2z = min_z; } else if (b2z > max_z) { tv = 0.5f + 0.5f * (max_z - sz) / (b2z - sz); b2z = max_z; } else { tv = 0.0f; } glTexCoord2f(tu, tv); glVertex3f(b2x, b2y, b2z); if (b3x < min_x) { tu = 0.5f - 0.5f * (sx - min_x) / (sx - b3x); b3x = min_x; } else if (b3x > max_x) { tu = 0.5f + 0.5f * (max_x - sx) / (b3x - sx); b3x = max_x; } else { tu = 0.0f; } if (b3z < min_z) { tv = 0.5f - 0.5f * (sz - min_z) / (sz - b3z); b3z = min_z; } else if (b3z > max_z) { tv = 0.5f + 0.5f * (max_z - sz) / (b3z - sz); b3z = max_z; } else { tv = 1.0f; } glTexCoord2f(tu, tv); glVertex3f(b3x, b3y, b3z); if (b4x < min_x) { tu = 0.5f - 0.5f * (sx - min_x) / (sx - b4x); b4x = min_x; } else if (b4x > max_x) { tu = 0.5f + 0.5f * (max_x - sx) / (b4x - sx); b4x = max_x; } else { tu = 1.0f; } if (b4z < min_z) { tv = 0.5f - 0.5f * (sz - min_z) / (sz - b4z); b4z = min_z; } else if (b4z > max_z) { tv = 0.5f + 0.5f * (max_z - sz) / (b4z - sz); b4z = max_z; } else { tv = 1.0f; } glTexCoord2f(tu, tv); glVertex3f(b4x, b4y, b4z); glEnd(); } p_par = p_par->p_next; } } p_hnizdo = p_hnizdo->p_next; } if (frame) amat_set_frame_text(p_mat, framelast); cull_on(); zmask_set_fleky(TRUE); if (p_mt->flag & TPAR_NO_FOG) enable_fog_causal(); } void pe_renderuj(G_KONFIG * p_ber) { GLMATRIX *p_camera_project = get_matrix_camera_project(); PARMETAC *p_par = p_ber->p_par; PARMETAC *p_next = NULL; set_matrix_world_init(); while (p_par) { p_next = p_par->p_next; if (p_par->flag & TPAR_STREP) { if (p_par->pnum && kd_visibility(&p_par->min, &p_par->max, p_camera_project)) pe_kresli_strepiny(p_ber, p_par); } else if (p_par->flag & TPAR_KOUR_STOPA) { if (p_par->pnum) pe_kresli_kour_stopu(p_ber, p_par); } else if (p_par->flag & TPAR_FLEK) { if (p_par->pnum && kd_visibility(&p_par->min, &p_par->max, p_camera_project)) pe_kresli_fleky(p_ber, p_par); } else assert(0); p_par = p_next; } } void ber_renderuj_mlhu(G_KONFIG * p_ber) { MLZNA_KOSTKA *p_tmp = p_ber->p_mlha; MLZNA_KOSTKA *p_top = NULL; BOD *p_cbod = (BOD *) & p_ber->p_invcam->_41; int kamera_zmena = p_ber->kamera.zmena || p_ber->kamera.zmena_last; if (kamera_zmena) { while (p_tmp) { if (!p_tmp->p_kont && kd_je_bod_v_kostce(p_cbod, &p_tmp->min, &p_tmp->max) && (!p_top || p_tmp->priorita >= p_top->priorita)) { p_top = p_tmp; } p_tmp = p_tmp->p_next; } if (p_top) { if (p_ber->p_mlha_akt != p_top) { p_ber->p_mlha_akt = p_top; nastav_fog(p_top); enable_fog(); } } else { if (p_ber->p_mlha_akt) { p_ber->p_mlha_akt = NULL; disable_fog(); } } } } void ber_test_render_mysi(void) { BOD a, b, c, v(10, 10, 10); int ax, ay, bx, by, cx, cy; float z1, z2, z3; transf_2d_3d_z((float) mi.x, (float) mi.y, 500.0f, &a.x, &a.y, &a.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); transf_2d_3d_z((float) mi.x, (float) mi.y, 250.0f, &b.x, &b.y, &b.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); transf_2d_3d_z((float) mi.x, (float) mi.y, 0.01f, &c.x, &c.y, &c.z, p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); dbgprintf("m [%d %d]", mi.x, mi.y); dbgprintf("a3 [%f %f %f]", a.x, a.y, a.z); dbgprintf("b3 [%f %f %f]", b.x, b.y, b.z); dbgprintf("c3 [%f %f %f]", c.x, c.y, c.z); set_matrix_world_init(); kresli_oktanovou_bunku_minmax(&a, &v, 0xffffffff); kresli_kosoctverec(p_ber->p_project, p_ber->p_camera, get_matrix_init(), &a, 0.5f, 1.0f, 0.0f, 0.0f); kresli_kosoctverec(p_ber->p_project, p_ber->p_camera, get_matrix_init(), &b, 0.5f, 0.0f, 1.0f, 0.0f); kresli_kosoctverec(p_ber->p_project, p_ber->p_camera, get_matrix_init(), &c, 0.5f, 0.0f, 0.0f, 1.0f); transf_3d_2d(a.x, a.y, a.z, &ax, &ay, &z1, get_matrix_init(), p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); transf_3d_2d(b.x, b.y, b.z, &bx, &by, &z2, get_matrix_init(), p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); transf_3d_2d(c.x, c.y, c.z, &cx, &cy, &z3, get_matrix_init(), p_ber->p_camera, p_ber->p_project, SCREEN_XRES, SCREEN_YRES, SCREEN_XSTART, SCREEN_YSTART, p_ber->kam.near_plane, p_ber->kam.far_plane); dbgprintf("a2 [%d %d %f]", ax, ay, z1); dbgprintf("b2 [%d %d %f]", bx, by, z2); dbgprintf("c2 [%d %d %f]", cx, cy, z3); set_matrix_2d(SCREEN_XRES, SCREEN_YRES); kresli_ctverec_2d_diff(ax, ay, 10, 10, 1, 1, 1); kresli_ctverec_2d_diff(bx, by, 20, 20, 1, 1, 1); kresli_ctverec_2d_diff(cx, cy, 30, 30, 1, 1, 1); ret_matrix_2d(); } GAME_MESH_OLD *ber_vyrob_stinove_teleso(GAME_MESH_OLD * p_mesh, BOD * p_light) { return (NULL); } static int mesh_mat_num(GAME_MESH_OLD * p_mesh) { int i; for (i = 1; i < p_mesh->objektu; i++) { if (p_mesh->p_mat[i - 1] != p_mesh->p_mat[i]) return (K_CHYBA); } return ((int) p_mesh->p_mat[0]); } static int ber_mesh_render_list_setrid_compare(const void *p_m1, const void *p_m2) { int mat1 = mesh_mat_num(**(GAME_MESH_OLD ***) p_m1), mat2 = mesh_mat_num(**(GAME_MESH_OLD ***) p_m2); if (mat1 == K_CHYBA && mat2 == K_CHYBA) return (0); else { if (mat1 == K_CHYBA) return (1); if (mat2 == K_CHYBA) return (-1); return (mat1 - mat2); } } static int ber_poly_render_list_setrid_compare(const void *p_m1, const void *p_m2) { EDIT_MESH_POLY *p_p1 = *(EDIT_MESH_POLY **) p_m1; EDIT_MESH_POLY *p_p2 = *(EDIT_MESH_POLY **) p_m2; return (p_p1->material - p_p2->material); } void ber_render_list_setrid(G_KONFIG * p_ber) { qsort(p_ber->p_mesh_renderlist, p_ber->mesh_rendernum, sizeof(p_ber->p_mesh_renderlist[0]), ber_mesh_render_list_setrid_compare); qsort(p_ber->p_poly_renderlist, p_ber->poly_rendernum, sizeof(p_ber->p_poly_renderlist[0]), ber_poly_render_list_setrid_compare); } inline int obb_visibility_flag(OBB_OLD * p_obb, GLMATRIX * p_mat, int viz, int flag) { return (viz ? flag : obb_visibility(p_obb, p_mat)); } // viz = TRUE - automaticky viditelny inline int ber_render_list_vyrob_mesh(G_KONFIG * p_ber, int viz, GAME_MESH_OLD ** p_src, int add, GLMATRIX * p_mat, int viditelny_flag_add, int viditelny_flag_remove, int zmena_flag, int mail, int kamera_zmena) { GAME_MESH_OLD *p_mesh = *p_src; int *p_flag, kflag; OBB_OLD *p_obb; int j; int viditelny_zmena = FALSE; kflag = p_mesh->p_data->kflag; viditelny_zmena = FALSE; if (kflag & KONT_ZRCADLO) return (TRUE); if (viz || obb_visibility(&p_mesh->obb_world, p_mat)) { p_flag = (int *) p_mesh->p_kflag; if (p_mesh->objektu > 1) { int stat = (kflag & KONT_STATIC && !kamera_zmena); for (j = 0, p_obb = p_mesh->p_obb_world; j < p_mesh->objektu; j++, p_obb++, p_flag++) { if (obb_visibility_flag(p_obb, p_mat, stat, (*p_flag) & viditelny_flag_add)) { if (!((*p_flag) & viditelny_flag_add)) { // objekt nebyl driv viditelnej viditelny_zmena = TRUE; } *p_flag |= viditelny_flag_add; } else { *p_flag &= ~viditelny_flag_remove; } } } else { if (!((*p_flag) & viditelny_flag_add)) { // objekt nebyl driv viditelnej viditelny_zmena = TRUE; } *p_flag |= viditelny_flag_add; } if (viditelny_zmena || !(kflag & viditelny_flag_add) || p_mesh->mail + 1 != mail) kflag |= zmena_flag; else kflag &= ~zmena_flag; p_mesh->p_data->kflag = kflag | viditelny_flag_add; if (add) { assert(p_mesh->mail != mail); p_mesh->mail = mail; p_ber->p_mesh_renderlist[p_ber->mesh_rendernum++] = p_src; } return (TRUE); } else { p_mesh->p_data->kflag &= ~viditelny_flag_remove; p_flag = (int *) p_mesh->p_kflag; for (j = 0; j < p_mesh->objektu; j++, p_flag++) { *p_flag &= ~viditelny_flag_remove; } return (FALSE); } } // Overloaded convenience function for when `viditelny_flag_add' and // `viditelny_flag_remove' are the same. inline int ber_render_list_vyrob_mesh(G_KONFIG * p_ber, int viz, GAME_MESH_OLD ** p_src, int add, GLMATRIX * p_mat, int viditelny_flag, int zmena_flag, int mail, int kamera_zmena) { return ber_render_list_vyrob_mesh(p_ber, viz, p_src, add, p_mat, viditelny_flag, viditelny_flag, zmena_flag, mail, kamera_zmena); } inline void ber_render_list_vyrob_poly(G_KONFIG * p_ber, EDIT_MESH_POLY * p_poly, int add, GLMATRIX * p_mat, int viditelny_flag, int zmena_flag, int mail) { int kflag; kflag = p_poly->kflag; if (kflag & KONT_ZRCADLO) return; if (!(kflag & viditelny_flag) || p_poly->mail + 1 != mail) kflag |= zmena_flag; else kflag &= ~zmena_flag; p_poly->kflag = (kflag | viditelny_flag); if (add) { assert(p_poly->mail != mail); p_poly->mail = mail; p_ber->p_poly_renderlist[p_ber->poly_rendernum++] = p_poly; assert(p_ber->poly_rendernum <= p_ber->polynum); } } void ber_render_list_vyrob_rec(G_KONFIG * p_ber, OBB_TREE_OLD * p_prvni, GLMATRIX * p_m, GLMATRIX * p_zrc, int kamera_zmena, int mail) { EDIT_MESH_POLY *p_poly; OBB_TREE_ITEM_OLD *p_item; OBB_TREE_OLD *p_next; int i; p_item = p_prvni->p_item; for (i = 0; i < p_prvni->itnum; i++, p_item++) { if (kamera_zmena) { p_item->zrc_viditelny = p_zrc && obb_visibility(p_item->p_obb, p_zrc); p_item->viditelny = p_item->zrc_viditelny || obb_visibility(p_item->p_obb, p_m); } if (p_item->viditelny) { p_poly = p_item->p_poly; if (p_poly) { ber_render_list_vyrob_poly(p_ber, p_poly, TRUE, p_m, KONT_VIDITELNY, KONT_VIDITELNY_ZMENA, mail); } else { ber_render_list_vyrob_mesh(p_ber, TRUE, p_ber->p_mesh + p_item->mesh, TRUE, p_m, KONT_VIDITELNY, KONT_VIDITELNY_ZMENA, mail, kamera_zmena); } } if (p_zrc) { if (p_item->zrc_viditelny) { p_poly = p_item->p_poly; if (p_poly) { ber_render_list_vyrob_poly(p_ber, p_poly, !p_item->viditelny, p_zrc, KONT_VIDITELNY_ZRC, KONT_VIDITELNY_ZMENA, mail); } else { ber_render_list_vyrob_mesh(p_ber, TRUE, p_ber->p_mesh + p_item->mesh, !p_item->viditelny, p_zrc, KONT_VIDITELNY_ZRC, KONT_VIDITELNY_ZMENA, mail, kamera_zmena); } } } } p_next = p_prvni->p_next; for (i = 0; i < p_prvni->nextnum; i++, p_next++) { if (obb_visibility(&p_next->obb, p_m) || (p_zrc && obb_visibility(&p_next->obb, p_zrc))) ber_render_list_vyrob_rec(p_ber, p_next, p_m, p_zrc, kamera_zmena, mail); } } void ber_render_list_vyrob(G_KONFIG * p_ber, int zrcadlo, int kamera_zmena) { GLMATRIX *p_zrc, camera_project_zrc; GLMATRIX *p_camera_project = get_matrix_camera_project(); GAME_MESH_OLD ***p_src; int i, viditelny, zmena; int mail = ++p_ber->mail; /* Nastavi pocet pruhlednych objektu */ p_zrc = zrcadlo ? mat_mult_dir(__mat_top_matrix + __mat_top_matrix_akt, p_camera_project, &camera_project_zrc) : NULL; if (!p_ber->p_poly_renderlist) { p_ber->p_poly_renderlist = (EDIT_MESH_POLY **) mmalloc(sizeof(p_ber->p_poly_renderlist[0]) * p_ber->polynum * 2); p_ber->poly_rendernum = 0; p_ber->poly_renderakt = 0; } p_ber->mesh_rendernum = 0; p_ber->poly_rendernum = 0; /* Prihozeni statickych veci z obbtree render-listu */ if (obb_visibility(&p_ber->obbtree.obb, p_camera_project) || (p_zrc && obb_visibility(&p_ber->obbtree.obb, p_zrc))) { ber_render_list_vyrob_rec(p_ber, &p_ber->obbtree, p_camera_project, p_zrc, kamera_zmena, mail); } /* Prihozeni dynamickych veci z dynamickeho render-listu */ p_src = p_ber->p_dyn_meshlist; for (i = 0; i < p_ber->dyn_meshlistnum; i++, p_src++) { if (**p_src && !((**p_src)->nekreslit)) { zmena = kamera_zmena || (((**p_src)->p_data->kflag) & KONT_POHYB); viditelny = ber_render_list_vyrob_mesh(p_ber, FALSE, *p_src, TRUE, p_camera_project, KONT_VIDITELNY, KONT_VIDITELNY_ZMENA, mail, zmena); if (p_zrc) ber_render_list_vyrob_mesh(p_ber, FALSE, *p_src, !viditelny, p_zrc, // Only remove KONT_VIDITELNY_ZRC if the reflection is not // visible, because we don't want to hide the whole object // just because we can't see the reflection (which would // happen if we removed KONT_VIDITELNY as well). KONT_VIDITELNY | KONT_VIDITELNY_ZRC, KONT_VIDITELNY_ZRC, KONT_VIDITELNY_ZMENA, mail, zmena); } } /* Setrideni podle materialu */ ber_render_list_setrid(p_ber); } void ber_render_list_vyrob_pruhlist(G_KONFIG * p_ber) { GLMATRIX *p_mat = get_matrix_camera_project(); EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; /* A zaciname! */ p_ber->prhlnum = 0; /* Render Mesh-listu */ ber_mesh_render_list_reset(p_ber); while ((p_mesh = ber_mesh_render_list_next(p_ber))) { if (p_mesh->p_data->m1flag & MAT_PRUHLEDNY || p_mesh->p_data->kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { PRUHLEDNY_OBJEKT *p_pruhl = p_ber->prhl + p_ber->prhlnum++; assert(p_ber->prhlnum < MAX_PRHL_OBJEKTU); p_pruhl->vzdal = ber_vzdal_bodu_z(&p_mesh->obb_world.obb_stred, p_mat); p_pruhl->p_objekt = (void *) p_mesh; p_pruhl->typ = PRUHLEDNY_MESH; p_mesh->p_data->kflag |= KONT_VIDITELNY_PRUHL; } else { p_mesh->p_data->kflag &= ~KONT_VIDITELNY_PRUHL; } } /* Render poly-listu */ ber_poly_render_list_reset(p_ber); while ((p_poly = ber_poly_render_list_next(p_ber))) { if (p_poly->m1flag & MAT_PRUHLEDNY || p_poly->kflag & (KONT_DRAW_PRUHL | KONT_DRAW_CAMERA)) { PRUHLEDNY_OBJEKT *p_pruhl = p_ber->prhl + p_ber->prhlnum++; assert(p_ber->prhlnum < MAX_PRHL_OBJEKTU); p_pruhl->vzdal = ber_vzdal_bodu_z(&p_poly->obb.obb_stred, p_mat); p_pruhl->p_objekt = (void *) (p_poly); p_pruhl->typ = PRUHLEDNY_POLY; p_poly->kflag |= KONT_VIDITELNY_PRUHL; } else { p_poly->kflag &= ~KONT_VIDITELNY_PRUHL; } } } berusky2-0.12/src/komat/json_export.cpp0000644000175000017500000005652013674766375015143 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "3d_all.h" #include "Object.h" #include "json_export.h" #include int kom_get_mesh_id(MeshHandle prvek_handle); FILE * export_file = NULL; char export_level_dir[MAX_FILENAME]; void json_export_matrix(FILE *f, GLMATRIX *p_matrix, const char *p_name) { fprintf(f,"{\n"); fprintf(f," \"name\" : \"%s\",\n", p_name); fprintf(f," \"x-vector\" : [ %f, %f, %f, %f ],\n", p_matrix->_11,p_matrix->_21,p_matrix->_31,p_matrix->_41); fprintf(f," \"y-vector\" : [ %f, %f, %f, %f ],\n", p_matrix->_12,p_matrix->_22,p_matrix->_32,p_matrix->_42); fprintf(f," \"z-vector\" : [ %f, %f, %f, %f ],\n", p_matrix->_13,p_matrix->_23,p_matrix->_33,p_matrix->_43); fprintf(f," \"w-vector\" : [ %f, %f, %f, %f ]\n", p_matrix->_14,p_matrix->_24,p_matrix->_34,p_matrix->_44); fprintf(f," },\n"); } void json_export_texture(FILE *f, EDIT_TEXT *p_text) { fprintf(f,"{\n"); fprintf(f," \"type\" : \"texture\",\n"); fprintf(f," \"name\" : \"%s\",\n", p_text->jmeno); //fprintf(f," file: %s\n", p_text->p_bmp); fprintf(f,"}\n"); } /* typedef struct _EDIT_MATERIAL { // Jmeno materialu char jmeno[MAX_JMENO]; // Textury materialu char textfile[MAT_TEXTUR][MAX_JMENO]; EDIT_TEXT *p_text[MAT_TEXTUR]; int textflag[MAT_TEXTUR]; // flag textury GLMATRIX ttext[MAT_TEXTUR]; // matrice posunu co se dava jako settransformmatrix float texgen_koord_s[MAT_TEXTUR][4]; // texture-generovane veci float texgen_koord_t[MAT_TEXTUR][4]; // texture-generovane veci float texgen_koord_r[MAT_TEXTUR][4]; // texture-generovane veci float texgen_koord_q[MAT_TEXTUR][4]; // texture-generovane veci // Michaci funkce int alfa_state; // alfa blok MATERIAL_TEXT_OLD text_state[MAT_TEXTUR]; // texture bloky float lesk; // lesklost MATERIAL dxmat; // barva objektu ANIM_MATERIAL anim; // frame animace (u animovanych materialu) int atextnum[MAT_TEXTUR]; int atextakt[MAT_TEXTUR]; ANIM_TEXT *p_atext[MAT_TEXTUR][MAX_TEXT_ANIM]; // animace textur int smaterial_pozice; // pozice s-materialu int textur; // celkovy pocet textur ktery material pouziva dword flag; // flagy materialu dword flag2; // flagy2 materialu int material_handle; // handle materialu TDS_MAT_FLAGS tds; // modifikace importovane z 3d studia float env_r, // env spekularni barva env_g, env_b; float env_add1; // aditivni konstanta 1 float env_add2; // aditivni konstanta 2 float env_scale; // scale env uhlu struct _EDIT_MATERIAL *p_sub; // pole sub-materialu (pouze pro ase-loader) } EDIT_MATERIAL; */ void json_export_material(FILE *f, EDIT_MATERIAL *p_mat) { fprintf(f,"{\n"); fprintf(f," \"type\" : \"material\",\n"); fprintf(f," \"name\" : \"%s\",\n", p_mat->jmeno); fprintf(f," \"transparent\" : \"%d\",\n", (p_mat->flag&MAT_PRUHLEDNY) ? 1 : 0); fprintf(f," \"z_buffer_mask\" : \"%d\",\n", (p_mat->flag&MAT_NO_ZMASK) ? 0 : 1); fprintf(f," \"z_buffer_test\" : \"%d\",\n", (p_mat->flag&MAT_NO_ZTEST) ? 0 : 1); fprintf(f," \"backface_culling\" : \"%d\",\n", (p_mat->flag&MAT_NO_CULL) ? 0 : 1); fprintf(f," \"diffuse_color\" : \"%d\",\n", (p_mat->flag2&MAT2_DIFFUSE) ? 1 : 0); fprintf(f," \"specular_color\" : \"%d\",\n", (p_mat->flag2&MAT2_SPECULAR) ? 1 : 0); fprintf(f," \"textures\" : [ "); int i; for(i = 0; i < MAT_TEXTUR; i++) { // Vzdy nove vytvoreny string -> prazdny std::string text; text.append(p_mat->textfile[i]); // Compare vraci 0 pri shode if(text.compare("")){ // Prepis bmp na jpg text.resize(text.length() - 3); text.append("jpg"); if(i == 0){ fprintf(f,"\"%s\"", text.c_str()); } else{ fprintf(f,", \"%s\"", text.c_str()); } } } fprintf(f," ]\n"); fprintf(f,"}"); } void json_export_materialy(FILE *f, EDIT_MATERIAL ** p_mat, int max_mat) { int i; for(i = 0; i < max_mat; i++) { if(p_mat[i]) { json_export_material(f,p_mat[i]); if(i + 1 < max_mat) fprintf(f, ",\n"); } } } /* // Konstni animace objektu typedef struct _EDIT_OBJEKT { char jmeno[MAX_JMENO]; char jmeno_parent[MAX_JMENO]; int Objekt_ID; // ID objektu word vertexnum; OBJ_VERTEX *p_vertex; BOD *p_vertex_kosti; // kostni vertexy word facenum; word *p_face; dword *p_fsous; GLenum face_typ; // typ facu int optnum; // optimalizovane facy int *p_opt; word linenum; word *p_line; GLenum line_typ; // typ car int material; // pouzity material (z tabulky materialu) int material_sub; float float_scale; // aktualni float-scale float float_scale_last; // minuly float scale word x_rect; // x ctvercu objektu word y_rect; // y ctvercu objektu char kreslit; BOD pivot; // pivot-point objektu (relativni) char trans; // transformovane svetlo (je preveden na billboard a spocitane okoli) dword m1flag; // flagy objektu dword m2flag; // flagy objektu dword oflag; TRACK_INFO *p_track; // track info k animaci GLMATRIX m; // matrix k animacim OBB_OLD obb; void *p_tmp_top; // pomocny pointer na kontejner struct _EDIT_OBJEKT *p_tmp_next; // pomocny pointer na dalsi objekt JOINT_ANIMACE *p_joit_animace; // pointer na joint-animace struct _EDIT_OBJEKT *p_lod; // LOD objekty tohodlenctoho SIMPLE_TRACK_INFO *p_tmp_sim; } EDIT_OBJEKT; typedef struct _MUJ_BOD { float x, y, z; float px, py, pz; float nx, ny, nz; float mdr, mdg, mdb, mda; float dr, dg, db, da; float msr, msg, msb; float sr, sg, sb; float tu1, tv1; // 4 textury float tu2, tv2; float tu3, tv3; float tu4, tv4; // lightmapa float tul, tvl; } MUJ_BOD, OBJ_VERTEX, OBJEKT_BOD; */ void json_export_object(FILE *f, EDIT_OBJEKT *p_obj, EDIT_MATERIAL ** p_mat, int max_mat) { int i; fprintf(f," {\n"); fprintf(f," \"name\" : \"%s\",\n", p_obj->jmeno); fprintf(f," \"name_parent\" : \"%s\",\n", p_obj->jmeno_parent); fprintf(f," \"object_id\" : \"%d\",\n", p_obj->Objekt_ID); fprintf(f," \"material\" : \"%s\",\n", p_mat[p_obj->material]->jmeno); fprintf(f," \"vertexPositions\" : ["); for(i = 0; i < p_obj->vertexnum-1; i++) { fprintf(f,"%f,%f,%f,",(p_obj->p_vertex[i].x), (p_obj->p_vertex[i].y) ,(p_obj->p_vertex[i].z)); } fprintf(f,"%f,%f,%f",p_obj->p_vertex[p_obj->vertexnum-1].x, p_obj->p_vertex[p_obj->vertexnum-1].y, p_obj->p_vertex[p_obj->vertexnum-1].z); fprintf(f,"],\n"); fprintf(f," \"vertexDiffuse\" : ["); for(i = 0; i < p_obj->vertexnum-1; i++) { fprintf(f,"%f,%f,%f,%f,",(p_obj->p_vertex[i].mdr), (p_obj->p_vertex[i].mdg) ,(p_obj->p_vertex[i].mdb), (p_obj->p_vertex[i].mda)); } fprintf(f,"%f,%f,%f,%f",p_obj->p_vertex[p_obj->vertexnum-1].mdr, p_obj->p_vertex[p_obj->vertexnum-1].mdg, p_obj->p_vertex[p_obj->vertexnum-1].mdb, p_obj->p_vertex[p_obj->vertexnum-1].mda); fprintf(f,"],\n"); fprintf(f," \"vertexSpecular\" : ["); for(i = 0; i < p_obj->vertexnum-1; i++) { fprintf(f,"%f,%f,%f,",(p_obj->p_vertex[i].msr), (p_obj->p_vertex[i].msg) ,(p_obj->p_vertex[i].msb)); } fprintf(f,"%f,%f,%f",p_obj->p_vertex[p_obj->vertexnum-1].msr, p_obj->p_vertex[p_obj->vertexnum-1].msg, p_obj->p_vertex[p_obj->vertexnum-1].msb); fprintf(f,"],\n"); fprintf(f," \"vertexNormals\" : ["); for(i = 0; i < p_obj->vertexnum-1; i++) { fprintf(f,"%f,%f,%f,",p_obj->p_vertex[i].nx,p_obj->p_vertex[i].ny,p_obj->p_vertex[i].nz); } fprintf(f,"%f,%f,%f",p_obj->p_vertex[p_obj->vertexnum-1].nx, p_obj->p_vertex[p_obj->vertexnum-1].ny, p_obj->p_vertex[p_obj->vertexnum-1].nz); fprintf(f,"],\n"); fprintf(f," \"vertexTextureCoords0\" : ["); for(i = 0; i < p_obj->vertexnum-1; i++) { fprintf(f,"%f,%f,",p_obj->p_vertex[i].tu1,p_obj->p_vertex[i].tv1); } fprintf(f,"%f,%f",p_obj->p_vertex[p_obj->vertexnum-1].tu1, p_obj->p_vertex[p_obj->vertexnum-1].tv1); fprintf(f,"],\n"); fprintf(f," \"vertexTextureCoords1\" : ["); for(i = 0; i < p_obj->vertexnum-1; i++) { fprintf(f,"%f,%f,",p_obj->p_vertex[i].tu2,p_obj->p_vertex[i].tv2); } fprintf(f,"%f,%f",p_obj->p_vertex[p_obj->vertexnum-1].tu2, p_obj->p_vertex[p_obj->vertexnum-1].tv2); fprintf(f,"],\n"); fprintf(f," \"indices\" : ["); for(i = 0; i < p_obj->facenum-1; i++) { fprintf(f,"%d,",p_obj->p_face[i]); } fprintf(f,"%d",p_obj->p_face[p_obj->facenum-1]); fprintf(f,"]\n"); fprintf(f," }"); } void json_export_kont(FILE *f, EDIT_KONTEJNER *p_kont, EDIT_MATERIAL ** p_mat, int max_mat, int level) { int i; fprintf(f,"{\n"); fprintf(f," \"type\" : \"geometry_container\",\n"); fprintf(f," \"name\" : \"%s\",\n", p_kont->jmeno); fprintf(f," \"hierarchy_level\" : \"%d\",\n", level); fprintf(f," \"container_id\" : \"%d\",\n", p_kont->kontejner_ID); fprintf(f," \"prvek\" : \"%d\",\n", p_kont->kflag&KONT_PRVEK); fprintf(f," \"matrix\" : "); json_export_matrix(f, &p_kont->world, "world"); fprintf(f," \"geometry_objects\" : [\n"); for(i = 0; i < MAX_KONT_OBJEKTU; i++) { if(p_kont->p_obj[i]) { if(i != 0){ fprintf(f, ",\n"); } json_export_object(f,p_kont->p_obj[i], p_mat, max_mat); //if(i + 1 < MAX_KONT_OBJEKTU){ // fprintf(f, ","); //} } } fprintf(f,"\n ]\n"); fprintf(f,"}"); } /* typedef struct _EDIT_KONTEJNER { char jmeno[MAX_JMENO]; int kontejner_ID; // identifikacni cislo kontejneru -> jedinecne pri ukldani sceny EDIT_OBJEKT *p_obj[MAX_KONT_OBJEKTU]; GLMATRIX world; // hlavni modifikovaci matice (scale a pod -> nulova transfromace na stred) GLMATRIX mpmatrix; // pozicni matice - aktivni pouze pri ukladani/nahravani int max_objektu; char kreslit; int prvek; // pokud prvek -> je to logicky prvek k beruskam == K_CHYBA -> neni to prvek dword m1flag; // slepenec vsech materialu dword m2flag; // slepenec vsech materialu dword kflag; // slepenec vsech objektu dword k2flag; int facu; int bodu; int objektu; int mailbox; int kont; int low_id; // identifikator low/top-kontejneru OBB_OLD obb; MLZNA_KOSTKA *p_mlha; // pointer na mlznou kostku kontejneru HIERARCHY_SIM sim[KONT_MAX_ANIM]; // seznam animaci - sim-animace int akt_animace; // aktualne vybrana animace struct _STATIC_LIGHT *p_slight; // seznam statickych svetel struct _DYN_LIGHT *p_dlight; // seznam dynamickych svetel struct _EXTRA_DYN_LIGHT *p_edlight; // seznam extra svetel struct _EDIT_KONTEJNER *p_next; // dalsi kontejner v multi-mesh kontejnerech struct _EDIT_KONTEJNER *p_next_low; // dalsi kontejner v low hierarchii struct _EDIT_KONTEJNER *p_next_top; // top-kontejner } EDIT_KONTEJNER; */ void json_export_kont_single(EDIT_KONTEJNER *p_kont, EDIT_MATERIAL ** p_mat, int max_mat) { if(export_file) { int level = 0; while(p_kont) { json_export_kont(export_file, p_kont, p_mat, max_mat, level++); p_kont = p_kont->p_next; } } } /* // pouze na staticke objekty typedef struct _EDIT_MESH_POLY { //celej kontejner char jmeno[MAX_JMENO]; // jmeno poly int facenum; // co face to objekt TEXT_KOORD *p_koord; // list texture koordinatu - plosky po 3 LIGHTMAP_FACE *p_ind; // lightmapovaci indicie, je jich facenum/3 dword *p_fsous; // sousedni plosky dword m1flag; // flag materialu -> stejne jako u kontejneru dword m2flag; // flag mat 2 -> stejne jako u kontejneru dword kflag; // flag kontejneru dword k2flag; // flag kontejneru int material; // material poly int kont; // cislo kontejneru, ze ktereho bylo poly vyrobeno int poly; // poradove cislo poly v seznamu polyu MLZNA_KOSTKA *p_mlha; // mlzna kostka polyho int lightnum; // pocet lightmap int *p_lightnum; // pocty light-map EDIT_TEXT **p_light; // pole light-map char kreslit; int mail; // mailbox poly :) OBB_OLD obb; // Svetla poly - dynamicke void **p_dlight; // pole svetel meshu int lightmax; // velikost pole na svetla int lightakt; // aktualni vekikost // Svetla poly - extra-dynamicke int top_edlight; // top-svetlo void **p_edlight; // pole extra svetel meshu int edlightmax; // velikost pole na extra svetla int edlightakt; // aktualni velikost VERTEX_ARRAYS varray; // vertex-arrays } EDIT_MESH_POLY; for (l = 0; l < p_poly->lightnum; l++) { glBegin(GL_TRIANGLES); p_koord = p_poly->p_koord + last; for (i = 0; i < p_poly->p_lightnum[l]; i++) { glTexCoord2fv(&p_koord[i].tu1); glColor4fv(&p_koord[i].dr); glNormal3fv(&p_koord[i].nx); glVertex3fv(&p_koord[i].x); } glEnd(); last += p_poly->p_lightnum[l]; } */ void json_export_poly(FILE *f, EDIT_MESH_POLY *p_poly, EDIT_MATERIAL ** p_mat, int max_mat, int poly_id, EDIT_TEXT *p_light_list) { fprintf(f,"{\n"); fprintf(f," \"type\" : \"geometry_container_poly\",\n"); fprintf(f," \"name\" : \"%s\",\n", p_poly->jmeno); fprintf(f," \"container_id\" : \"%d\",\n", -1); fprintf(f," \"poly_id\" : \"%d\",\n", poly_id); fprintf(f," \"prvek\" : \"%d\",\n", p_poly->kflag&KONT_PRVEK); GLMATRIX m; init_matrix(&m); fprintf(f," \"matrix\" : "); json_export_matrix(f, &m, "world"); fprintf(f," \"geometry_objects\" : [\n"); fprintf(f," {\n"); fprintf(f," \"name\" : \"%s\",\n", p_poly->jmeno); fprintf(f," \"material\" : \"%s\",\n", p_mat[p_poly->material]->jmeno); fprintf(f," \"vertexPositions\" : ["); int i; TEXT_KOORD *p_koord = p_poly->p_koord; for(i = 0; i < p_poly->facenum-1; i++, p_koord++) { fprintf(f,"%f,%f,%f,",p_koord->x,p_koord->y,p_koord->z); } fprintf(f,"%f,%f,%f",p_koord->x,p_koord->y,p_koord->z); fprintf(f,"],\n"); fprintf(f," \"vertexNormals\" : ["); p_koord = p_poly->p_koord; for(i = 0; i < p_poly->facenum-1; i++, p_koord++) { fprintf(f,"%f,%f,%f,",p_koord->nx,p_koord->ny,p_koord->nz); } fprintf(f,"%f,%f,%f",p_koord->nx,p_koord->ny,p_koord->nz); fprintf(f,"],\n"); fprintf(f," \"vertexTextureCoords0\" : ["); p_koord = p_poly->p_koord; for(i = 0; i < p_poly->facenum-1; i++, p_koord++) { fprintf(f,"%f,%f,",p_koord->tu1,p_koord->tv1); } fprintf(f,"%f,%f",p_koord->tu1,p_koord->tv1); fprintf(f,"],\n"); fprintf(f," \"vertexTextureCoords1\" : ["); p_koord = p_poly->p_koord; for(i = 0; i < p_poly->facenum-1; i++, p_koord++) { fprintf(f,"%f,%f,",p_koord->tu2,p_koord->tv2); } fprintf(f,"%f,%f",p_koord->tu2,p_koord->tv2); fprintf(f,"],\n"); fprintf(f," \"vertexTextureCoordsLight\" : ["); p_koord = p_poly->p_koord; for(i = 0; i < p_poly->facenum-1; i++, p_koord++) { fprintf(f,"%f,%f,",p_koord->tul,p_koord->tvl); } fprintf(f,"%f,%f",p_koord->tul,p_koord->tvl); fprintf(f,"],\n"); fprintf(f,"\"indices_light_list\" : [\n"); int l,last = 0; for(l = 0; l < p_poly->lightnum; l++) { fprintf(f,"{\n"); fprintf(f," \"lightmap\" : \"%d\",\n", (int)(p_poly->p_light[l]-p_light_list)); fprintf(f," \"indices\" : ["); for (i = 0; i < p_poly->p_lightnum[l]; i++) { fprintf(f,"%d,",last+i); } last = i; fprintf(f,"]\n"); fprintf(f,"}\n"); } fprintf(f,"]\n"); fprintf(f," }\n ]\n"); fprintf(f,"}"); } void json_export_poly(EDIT_MESH_POLY *p_poly, int polynum, EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT *p_light_list) { fprintf((FILE*)export_file, ",\n"); //fprintf((FILE*)export_file, "\n\n\nPOLY EXPORT BEGIN\n\n\n"); if(export_file) { int i; for(i = 0; i < polynum; i++) { if(i != 0) {fprintf((FILE*)export_file, ",\n");} json_export_poly(export_file, p_poly+i, p_mat, max_mat, i, p_light_list); } } fprintf((FILE*)(export_file), ","); } /* typedef struct _STATIC_LIGHT { int akt; // aktivni svetlo char jmeno[MAX_JMENO]; // jmeno svetla int index; // index svetla (pozice + ID) BOD p; float r, g, b; float k1, k2, k3; // tlumici koeficienty float dosah; // max. dosah svetla char uhel; // tlumit podle uhlu svetla char utlum; // tlumit podle vzdalenosti void *p_flare; // flare svetla - pointer na nej int last_poly; // posledni hitovany poly int last_kont; // posledni hitovany kontejner int flag; // flag vlasnosti svetla -> update a podobne int flag2; // druhy flag -> vlastnosti void *p_mesh_data; // privazany mesh, ke kterymu to patri int bez_prev; // vyjmout z dyn osvetlovani struct _STATIC_LIGHT *p_next; // nasledujici svetlo (v seznamu u kontejneru) struct _STATIC_LIGHT *p_prev; // predchozi svetlo } STATIC_LIGHT; */ void json_export_svetlo(FILE *f, STATIC_LIGHT * p_light) { fprintf(f,"{\n"); fprintf(f," \"type\" : \"light\",\n"); fprintf(f," \"name\" : \"%s\",\n", p_light->jmeno); fprintf(f," \"position\" : [ %f, %f, %f],\n", p_light->p.x, p_light->p.y, p_light->p.z); fprintf(f," \"diffuse_color\" : [ %f, %f, %f],\n", p_light->r, p_light->g, p_light->b); fprintf(f," \"coeficients\" : [ %f, %f, %f],\n", p_light->k1, p_light->k2, p_light->k3); fprintf(f," \"max_range\" : \"%f\",\n", p_light->dosah); fprintf(f,"}"); } void json_export_svetla(FILE *f, STATIC_LIGHT * p_light, int lightnum) { int i; for(i = 0; i < lightnum; i++) { if(!p_light[i].akt) break; json_export_svetlo(f,p_light+i); fprintf(f, ",\n"); } } /* void json_export_level(EDIT_KONTEJNER **p_kont, int max_kont, EDIT_MATERIAL ** p_mat, int max_mat, STATIC_LIGHT * p_light, int lightnum) { if(export_file) { fprintf((FILE*)(export_file), "[\n"); json_export_materialy(export_file, p_mat, max_mat); json_export_kontejnery(export_file, p_kont, max_kont, p_mat, max_mat); json_export_svetla(export_file, p_light, lightnum); //fprintf((FILE*)(export_file), "\n]"); } } */ void json_export_materialy(EDIT_MATERIAL ** p_mat, int max_mat) { if(export_file) { json_export_materialy(export_file, p_mat, max_mat); } } void json_export_light(STATIC_LIGHT * p_light, int lightnum) { if(export_file) { json_export_svetla(export_file, p_light, lightnum); } } void json_export_lightmap(int num, bitmapa *p_bmp) { char file[MAX_FILENAME]; int ret = snprintf(file,sizeof(file),"%s/%s_%d.png", export_level_dir,"lightmap",num); assert(ret < (int) sizeof(file)); bmp_uloz(file, p_bmp); } char* name_cleaner(char* name) { if(name == NULL) return(NULL); int i; char *tempString = (char *)malloc(31*sizeof(char)); for(i = 0; i < 30; i++){ // pokud je nalezen ukoncovaci znak, koncim a vracim string if(name[i] == '\0'){ tempString[i] = '\0'; return tempString; } if((int)(name[i]) <= 127 && (int(name[i]) >= 32)){ tempString[i] = name[i]; } else{ tempString[i] = '_'; } } tempString[30] = '\0'; return tempString; } void json_export_level_item(FILE *f, LEVELINFO * p_Level, ITEMDESC *p_Item) { OBJECTDESC *p_Object = p_Item->p_Object; char *cleanedName = name_cleaner(p_Object->Name); if(cleanedName == NULL) return; fprintf(f," {\n"); fprintf(f," \"name\" : \"%s\",\n",cleanedName); fprintf(f," \"guid\" : \"%d\",\n",p_Object->GUID); fprintf(f," \"class\" : \"%d\",\n",p_Object->Class); fprintf(f," \"subclass\" : \"%d\",\n",p_Object->SubClass); fprintf(f," \"position\" : [ %d, %d, %d ],\n", p_Item->Pos[0], p_Item->Pos[2], p_Item->Pos[1]); fprintf(f," \"rotation\" : \"%d\",\n", p_Item->Rotation); fprintf(f," \"container_id\" : \"%d\"\n", kom_get_mesh_id(p_Item->Index_Of_Game_Mesh)); fprintf(f," }"); free(cleanedName); } void json_export_level(LEVELINFO * p_Level) { if(!export_file) return; FILE *f = export_file; fprintf((FILE*)(export_file), "\n"); fprintf(f,"{\n"); fprintf(f," \"type\" : \"level_logic\",\n"); fprintf(f," \"logic_level_size\" : [ %d, %d, %d],\n", p_Level->Size[0], p_Level->Size[2], p_Level->Size[1]); float x_start = finite(p_Level->LevelHeader.x_start) ? p_Level->LevelHeader.x_start : 0.0f; float y_start = finite(p_Level->LevelHeader.y_start) ? p_Level->LevelHeader.y_start : 0.0f; float z_start = finite(p_Level->LevelHeader.z_start) ? p_Level->LevelHeader.z_start : 0.0f; fprintf(f," \"level_start\" : [ %f, %f, %f],\n", x_start, y_start, z_start); fprintf(f," \"item_size\" : \"%d\",\n", X_PRVEK); fprintf(f," \"level_items_num\" : \"%d\",\n", p_Level->Count_Of_Items); fprintf(f," \"level_items\" : [\n"); for (int i = 0; i < p_Level->Count_Of_Items; i++){ if(i != 0){ fprintf(f, ",\n"); } json_export_level_item(f, p_Level, p_Level->Item+i); } fprintf((FILE*)(export_file), " ]\n"); fprintf(f,"}\n"); fprintf((FILE*)(export_file), "\n]\n"); } void json_export_start(char *p_file) { if(!export_file) { char *ret; export_file = fopen(p_file,"w"); assert(export_file); ret = getcwd(export_level_dir,MAX_FILENAME); assert(ret); } } void json_export_end(void) { if(export_file) { fclose(export_file); export_file = NULL; } } berusky2-0.12/src/komat/3d_typy.h0000644000175000017500000000113013674426075013602 00000000000000/* Univerzalni 3d typy */ #ifndef __3D_TYPY__ #define __3D_TYPY__ typedef struct { float u, v; } BODUV; typedef struct _ROVINA { float x, y, z, e; } ROVINA; typedef struct _ROVINAD { double x, y, z, e; } ROVINAD; typedef struct { float x, y, z, w; } WBOD; typedef struct { dword x, y; } BOD_2D; typedef struct { int x, y, z; } BOD3D, QBOD; typedef struct _BARVA_RGBA { float r, g, b, a; } BARVA_RGBA, BODRGBA, RGBA; typedef struct _BARVA_RGB { float r, g, b; } BARVA_RGB, BODRGB, RGB; typedef word FACE; typedef struct _RGB_M { float r, g, b; } RGB_M; #endif berusky2-0.12/src/komat/kfile.cpp0000644000175000017500000000001513674426075013635 00000000000000/* K-file */ berusky2-0.12/src/komat/Berusky3d_castice.cpp0000644000175000017500000011634313674426075016125 00000000000000/* Casticovy system pro Berusky II */ #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" extern G_KONFIG ber, *p_ber; ParHandle par_vyrob(void) { PARMETAC *p_par = (PARMETAC *) mmalloc(sizeof(p_par[0])); if (p_ber->p_par) { p_ber->p_par->p_prev = p_par; p_par->p_next = p_ber->p_par; } p_ber->p_par = p_par; return ((ParHandle) p_par); } ParHandle par_set_param(ParHandle ph, int material, int flag, BOD * p_pos, BOD * p_pivot) { PARMETAC *p_par = (PARMETAC *) ph; p_par->material = material; p_par->flag = flag; init_matrix(&p_par->world); p_par->world._41 = p_pos->x; p_par->world._42 = p_pos->y; p_par->world._43 = p_pos->z; return ((ParHandle) p_par); } ParHandle par_set_y_plane(ParHandle ph, float y_plane) { PARMETAC *p_par = (PARMETAC *) ph; p_par->y_plane = y_plane; return ((ParHandle) p_par); } void par_zrus(ParHandle ph) { PARMETAC *p_par = (PARMETAC *) ph; PARMETAC_HNIZDO *p_hnizdo = p_par->p_hnizdo, *p_next; if (p_par->p_flag) *(p_par->p_flag) = K_CHYBA; if (p_par->p_endfce) p_par->p_endfce(p_par->param, p_par->param2, reinterpret_cast(p_par->p_param)); if (p_ber->p_par == p_par) { // smaz prvni p_ber->p_par = p_par->p_next; if (p_par->p_next) p_par->p_next->p_prev = NULL; } else { p_par->p_prev->p_next = p_par->p_next; if (p_par->p_next) p_par->p_next->p_prev = p_par->p_prev; } while (p_hnizdo) { p_next = p_hnizdo->p_next; free(p_hnizdo); p_hnizdo = p_next; } free(p_par); } void par_zrus_end(PARMETAC * p_par) { PARMETAC_HNIZDO *p_hnizdo = p_par->p_hnizdo, *p_next; if (p_par->p_endfce) p_par->p_endfce(p_par->param, p_par->param2, reinterpret_cast(p_par->p_param)); while (p_hnizdo) { p_next = p_hnizdo->p_next; free(p_hnizdo); p_hnizdo = p_next; } free(p_par); } int par_get(ParHandle ph) { PARMETAC *p_par = (PARMETAC *) ph; return (p_par->pnum); } ParHandle par_pripoj_funkci(ParHandle ph, END_FUNKCE p_fce, size_ptr param, size_ptr param2, size_ptr p_param) { PARMETAC *p_par = (PARMETAC *) ph; p_par->p_endfce = p_fce; p_par->p_param = reinterpret_cast(p_param); p_par->param = param; p_par->param2 = param2; return (ph); } ParHandle par_go(ParHandle ph, int *p_flag, int start, int stop) { PARMETAC *p_par = (PARMETAC *) ph; PARMETAC_HNIZDO *p_hnizdo = p_par->p_hnizdo; p_par->flag |= TPAR_ANIMATE; p_par->p_flag = p_flag; p_par->start = p_ber->TimeEndLastFrame + start; if (stop) p_par->stop = p_ber->TimeEndLastFrame + stop; while (p_hnizdo) { p_hnizdo->time_last = p_par->start; if (p_par->flag & TPAR_FIRST_LOST) p_hnizdo->time_last += p_hnizdo->time_interval; p_hnizdo->time_last += p_hnizdo->time_first; p_hnizdo = p_hnizdo->p_next; } return (ph); } void par_vloz_strepy(ParHandle ph, PAR_STREPINA * p_part, int pocet) { PARMETAC *p_par = (PARMETAC *) ph; int i, p1; p_par->flag |= TPAR_STREP; p1 = pocet - 1; for (i = 1; i < p1; i++) { p_part[i].aktivni = TRUE; p_part[i].p_next = p_part + i + 1; p_part[i].p_prev = p_part + i - 1; transformuj_bod_bod_matici(&p_part[i].p, &p_par->world); } p_part[0].aktivni = TRUE; p_part[0].p_next = p_part + 1; p_part[0].p_prev = NULL; transformuj_bod_bod_matici(&p_part[0].p, &p_par->world); if (p1) { p_part[p1].p_prev = p_part + p1 - 1; transformuj_bod_bod_matici(&p_part[p1].p, &p_par->world); } p_part[p1].p_next = NULL; p_part[p1].aktivni = TRUE; p_par->p_first = p_part; p_par->pnum = pocet; } void *par_cti_prvni(ParHandle ph) { PARMETAC *p_par = (PARMETAC *) ph; return (p_par->p_first); } void par_vloz_fleky(ParHandle ph, PAR_FLEK * p_part, int pocet) { PARMETAC *p_par = (PARMETAC *) ph; int i, p1; p_par->flag |= TPAR_FLEK; p1 = pocet - 1; for (i = 1; i < p1; i++) { p_part[i].p_next = p_part + i + 1; p_part[i].p_prev = p_part + i - 1; transformuj_bod_bod_matici(&p_part[i].p, &p_par->world); } p_part[0].p_next = p_part + 1; p_part[0].p_prev = NULL; transformuj_bod_bod_matici(&p_part[0].p, &p_par->world); if (p1) { p_part[p1].p_prev = p_part + i - 1; transformuj_bod_bod_matici(&p_part[p1].p, &p_par->world); } p_part[p1].p_next = NULL; p_par->p_first = p_part; p_par->pnum = pocet; } int pe_updatuj_strepiny(G_KONFIG * p_ber, PARMETAC * p_par) { GAME_MESH_OLD *p_mesh; PAR_STREPINA *p_part; BOD t; BOD *p_str; BOD *p_max; BOD *p_min; float koef; int vid, atime; int htest; int x, y, z; int yplane_low; int yplane_top; int frame; atime = p_ber->TimeEndLastFrame; if (!(p_par->flag & TPAR_ANIMATE)) return (FALSE); if (p_par->start > atime) return (FALSE); if (p_par->stop && p_par->stop < atime) { *(p_par->p_flag) = K_CHYBA; return (FALSE); } frame = p_par->flag & TPAR_FRAME; htest = p_par->flag & TPAR_HTEST; yplane_top = p_par->flag & TPAR_YPLANE_TOP; yplane_low = p_par->flag & TPAR_YPLANE_LOW; koef = p_ber->TimeLastFrame / 1000.0f; p_min = &p_par->min; p_max = &p_par->max; p_min->x = -FLT_MAX; p_min->y = -FLT_MAX; p_min->z = -FLT_MAX; p_max->x = FLT_MAX; p_max->y = FLT_MAX; p_max->z = FLT_MAX; p_par->pnum = 0; p_part = (PAR_STREPINA *) p_par->p_first; while (p_part) { if (frame) { p_part->frame += p_part->framedelta * koef; } if (p_part->rychlost > 0.0f) { p_part->rychlost -= p_part->rychlost * (p_part->utlum * koef); if (p_part->rychlost < 0.0f) p_part->rychlost = 0.0f; } p_part->vaha += p_part->vaha * (p_part->g * koef); p_str = &p_part->p; vektor_add(p_str, vektor_mult_skalar(&p_part->dir, p_part->rychlost * koef, &t), p_str); p_str->y -= p_part->vaha * koef; vid = TRUE; if ((yplane_low && p_str->y < p_par->y_plane) || (yplane_top && p_str->y > p_par->y_plane)) { vid = 0; } else if (htest) { // test - neni pod podlahou if (p_str->y <= p_ber->y_start) { vid = 0; } else { x = (int) floor(p_str->x - p_ber->x_start) >> 1; y = (int) floor(p_str->y - p_ber->y_start) >> 1; z = (int) floor(p_str->z - p_ber->z_start) >> 1; if (x >= 0 && x < p_ber->x_num && y >= 0 && y < p_ber->y_num && z >= 0 && z < p_ber->z_num) { assert(ber_pozice_v_levelu(x, y, z, p_ber->x_num, p_ber->z_num) < p_ber->hitnum); vid = !p_ber->p_hit_list[ber_pozice_v_levelu(x, y, z, p_ber->x_num, p_ber->z_num)]; if (vid) { ber_mesh_render_list_reset(p_ber); while ((p_mesh = ber_mesh_render_list_next_flag(p_ber, KONT_PRVEK, KONT_DRAW_NOBALKA))) { if (obb_je_bod_v_kostce_aabb(&p_mesh->obb_world, p_str)) { vid = 0; goto konec_testu; } } } } else { vid = TRUE; } } } konec_testu:; p_part->aktivni = vid; //.. vyhod neaktivni castici ze seznamu if (!vid) { //p_part->p.x = p_part->p.y = p_part->p.z = 0.0f; if (p_part->p_prev) { // je uprostred p_part->p_prev->p_next = p_part->p_next; if (p_part->p_next) p_part->p_next->p_prev = p_part->p_prev; } else { // je na zacatku seznamu p_par->p_first = p_part->p_next; if (p_part->p_next) p_part->p_next->p_prev = NULL; } } else { if (p_str->x < p_min->x) p_min->x = p_str->x; if (p_str->y < p_min->y) p_min->y = p_str->y; if (p_str->z < p_min->z) p_min->z = p_str->z; if (p_str->x > p_max->x) p_max->x = p_str->x; if (p_str->y > p_max->y) p_max->y = p_str->y; if (p_str->z > p_max->z) p_max->z = p_str->z; p_par->pnum++; } p_part = p_part->p_next; } if (!p_par->pnum) { if (p_par->flag & TPAR_AUTOREMOVE) { par_zrus((ParHandle)p_par); // tady uz to neexistuje !!! } else { if (p_par->p_flag) *(p_par->p_flag) = K_CHYBA; if (p_par->p_endfce) p_par->p_endfce(p_par->param, p_par->param2, reinterpret_cast(p_par->p_param)); } return (FALSE); } return (p_par->pnum); } /* Updatovac fleku... */ int pe_updatuj_fleky(G_KONFIG * p_ber, PARMETAC * p_par) { PAR_FLEK *p_part; BOD *p_max; BOD *p_min; BOD *p_bod; BOD *p_pos, nx, ny; float koef; int vid, atime; int diff; int scale, scale2; int operace; int frame; atime = p_ber->TimeEndLastFrame; if (!(p_par->flag & TPAR_ANIMATE)) return (FALSE); if (p_par->start > atime) return (FALSE); if (p_par->stop && p_par->stop < atime) { *(p_par->p_flag) = K_CHYBA; return (FALSE); } koef = p_ber->TimeLastFrame / 1000.0f; p_min = &p_par->min; p_max = &p_par->max; p_min->x = -FLT_MAX; p_min->y = -FLT_MAX; p_min->z = -FLT_MAX; p_max->x = FLT_MAX; p_max->y = FLT_MAX; p_max->z = FLT_MAX; p_par->pnum = 0; scale = p_par->flag & TPAR_SCALE; scale2 = p_par->flag & TPAR_SCALE_ADD; diff = p_par->flag & TPAR_DIFF; operace = p_par->flag & TPAR_VETSI; frame = p_par->flag & TPAR_FRAME; p_part = (PAR_FLEK *) p_par->p_first; while (p_part) { if (scale) { p_part->rychlost_x += p_part->rychlost_x * (p_part->utlum_x * koef); p_part->rychlost_y += p_part->rychlost_y * (p_part->utlum_y * koef); } else if (scale2) { p_part->rychlost_x += (p_part->utlum_x * koef); p_part->rychlost_y += (p_part->utlum_y * koef); } if (diff) { p_part->r += p_part->dr * koef; p_part->g += p_part->dg * koef; p_part->b += p_part->db * koef; } if (frame) { p_part->frame += p_part->framedelta * koef; } p_part->a += p_part->da * koef; p_part->aktivni = vid = operace ? (p_part->a > p_part->ka) : (p_part->a < p_part->ka); //.. vyhod neaktivni castici ze seznamu if (!vid) { if (p_part->p_prev) { p_part->p_prev->p_next = p_part->p_next; if (p_part->p_next) p_part->p_next->p_prev = p_part->p_prev; } else { p_par->p_first = p_part->p_next; if (p_part->p_next) p_part->p_next->p_prev = NULL; } } else { p_pos = &p_part->p; vektor_mult_skalar(&p_part->nx, p_part->rychlost_x, &nx); vektor_mult_skalar(&p_part->ny, p_part->rychlost_y, &ny); // vypocet 4 tmp bodu p_bod = p_part->tmp; p_bod->x = p_pos->x - nx.x - ny.x; p_bod->y = p_pos->y - nx.y - ny.y; p_bod->z = p_pos->z - nx.z - ny.z; if (p_bod->x < p_min->x) p_min->x = p_bod->x; if (p_bod->y < p_min->y) p_min->y = p_bod->y; if (p_bod->z < p_min->z) p_min->z = p_bod->z; if (p_bod->x > p_max->x) p_max->x = p_bod->x; if (p_bod->y > p_max->y) p_max->y = p_bod->y; if (p_bod->z > p_max->z) p_max->z = p_bod->z; p_bod = p_part->tmp + 1; p_bod->x = p_pos->x + nx.x - ny.x; p_bod->y = p_pos->y + nx.y - ny.y; p_bod->z = p_pos->z + nx.z - ny.z; if (p_bod->x < p_min->x) p_min->x = p_bod->x; if (p_bod->y < p_min->y) p_min->y = p_bod->y; if (p_bod->z < p_min->z) p_min->z = p_bod->z; if (p_bod->x > p_max->x) p_max->x = p_bod->x; if (p_bod->y > p_max->y) p_max->y = p_bod->y; if (p_bod->z > p_max->z) p_max->z = p_bod->z; p_bod = p_part->tmp + 2; p_bod->x = p_pos->x - nx.x + ny.x; p_bod->y = p_pos->y - nx.y + ny.y; p_bod->z = p_pos->z - nx.z + ny.z; if (p_bod->x < p_min->x) p_min->x = p_bod->x; if (p_bod->y < p_min->y) p_min->y = p_bod->y; if (p_bod->z < p_min->z) p_min->z = p_bod->z; if (p_bod->x > p_max->x) p_max->x = p_bod->x; if (p_bod->y > p_max->y) p_max->y = p_bod->y; if (p_bod->z > p_max->z) p_max->z = p_bod->z; p_bod = p_part->tmp + 3; p_bod->x = p_pos->x + nx.x + ny.x; p_bod->y = p_pos->y + nx.y + ny.y; p_bod->z = p_pos->z + nx.z + ny.z; if (p_bod->x < p_min->x) p_min->x = p_bod->x; if (p_bod->y < p_min->y) p_min->y = p_bod->y; if (p_bod->z < p_min->z) p_min->z = p_bod->z; if (p_bod->x > p_max->x) p_max->x = p_bod->x; if (p_bod->y > p_max->y) p_max->y = p_bod->y; if (p_bod->z > p_max->z) p_max->z = p_bod->z; p_par->pnum++; } p_part = p_part->p_next; } if (!p_par->pnum) { if (p_par->flag & TPAR_AUTOREMOVE) { par_zrus((ParHandle) p_par); // tady uz to neexistuje !!! } else { if (p_par->p_flag) *(p_par->p_flag) = K_CHYBA; if (p_par->p_endfce) p_par->p_endfce(p_par->param, p_par->param2, reinterpret_cast(p_par->p_param)); } return (FALSE); } return (p_par->pnum); } /* ************************************************************************** Castice na koure - kourovy stopy ************************************************************************** */ int par_vloz_kour_stopu(ParHandle ph, PAR_KOUR_STOPA * p_part, int pocet) { PARMETAC *p_par = (PARMETAC *) ph; int i, p1; p_par->flag |= TPAR_KOUR_STOPA; p1 = pocet - 1; for (i = 0; i < p1; i++) { p_part[i].p_next = p_part + i + 1; } p_part[i].p_next = NULL; p_par->p_first = p_part; return (TRUE); } /* Set-Up hnizda */ HnizdoHandle par_vloz_hnizdo(ParHandle ph) { PARMETAC *p_par = (PARMETAC *) ph; PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) mmalloc(sizeof(p_hnizdo[0])); p_par->hnum++; p_hnizdo->p_next = p_par->p_hnizdo; if (p_hnizdo->p_next) p_hnizdo->p_next->p_prev = p_hnizdo; p_par->p_hnizdo = p_hnizdo; return ((ParHandle) p_hnizdo); } HnizdoHandle par_vloz_hnizdo_komplet(HnizdoHandle hh, int time_interval, BOD * p_pivot, PAR_KOUR_STOPA * p_part) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->p_pivot = p_pivot; p_hnizdo->time_interval = time_interval; p_hnizdo->rychlost_x = p_part->rychlost_x; p_hnizdo->rychlost_y = p_part->rychlost_y; p_hnizdo->utlum_x = p_part->utlum_x; p_hnizdo->utlum_y = p_part->utlum_y; p_hnizdo->r = p_part->r; p_hnizdo->g = p_part->g; p_hnizdo->b = p_part->b; p_hnizdo->a = p_part->a; p_hnizdo->dr = p_part->dr; p_hnizdo->dg = p_part->dg; p_hnizdo->db = p_part->db; p_hnizdo->da = p_part->da; p_hnizdo->ka = p_part->ka; return (hh); } HnizdoHandle par_vloz_hnizdo_timer(HnizdoHandle hh, int time_interval, int time_first) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->time_interval = time_interval; p_hnizdo->time_first = time_first; return (hh); } HnizdoHandle par_vloz_hnizdo_pust_castici(HnizdoHandle hh) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->time_last -= p_hnizdo->time_interval; return (hh); } PAR_KOUR_STOPA *par_vloz_hnizdo_pust_castice(ParHandle ph, HnizdoHandle hh, int pocet) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; PARMETAC *p_mt = (PARMETAC *) ph; PAR_KOUR_STOPA *p_par; int i; int dir; int par3d; dword atime; if (!p_hnizdo->p_pivot || !p_mt->p_first) return (NULL); atime = p_ber->TimeEndLastFrame; dir = p_mt->flag & TPAR_DIR; par3d = p_mt->flag & TPAR_3D; for (i = 0; i < pocet; i++) { if (!p_mt->p_first) return ((PAR_KOUR_STOPA *) p_hnizdo->p_first); p_par = (PAR_KOUR_STOPA *) p_mt->p_first; p_mt->p_first = p_par->p_next; p_par->p = *p_hnizdo->p_pivot; if (dir && p_hnizdo->p_dir) p_par->dir = *p_hnizdo->p_dir; if (par3d) { p_par->nx = *p_hnizdo->p_nx; p_par->ny = *p_hnizdo->p_ny; } p_par->time_vznik = atime; p_par->r = p_hnizdo->r; p_par->g = p_hnizdo->g; p_par->b = p_hnizdo->b; p_par->a = p_hnizdo->a; p_par->rychlost_x = p_hnizdo->rychlost_x; p_par->rychlost_y = p_hnizdo->rychlost_y; p_par->dr = p_hnizdo->dr; p_par->dg = p_hnizdo->dg; p_par->db = p_hnizdo->db; p_par->da = p_hnizdo->da; p_par->ka = p_hnizdo->ka; p_par->utlum_x = p_hnizdo->utlum_x; p_par->utlum_y = p_hnizdo->utlum_y; p_par->frame = p_hnizdo->frame; p_par->framedelta = p_hnizdo->framedelta; p_par->x_max = p_hnizdo->x_max; p_par->x_min = p_hnizdo->x_min; p_par->z_max = p_hnizdo->z_max; p_par->z_min = p_hnizdo->z_min; p_par->rotace = p_hnizdo->rotace; p_par->y_plane = p_hnizdo->y_plane; // Insert-first p_par->p_next = (PAR_KOUR_STOPA *) p_hnizdo->p_first; if (p_par->p_next) { p_par->p_next->p_prev = p_par; } p_hnizdo->p_first = p_par; p_par->p_prev = NULL; } return ((PAR_KOUR_STOPA *) p_hnizdo->p_first); } HnizdoHandle par_vloz_hnizdo_pivot(HnizdoHandle hh, BOD * p_pivot) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->p_pivot = p_pivot; return (hh); } HnizdoHandle par_vloz_hnizdo_rotaci(HnizdoHandle hh, char rotace) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->rotace = rotace; return (hh); } HnizdoHandle par_vloz_hnizdo_pivot_normal(HnizdoHandle hh, BOD * p_nx, BOD * p_ny) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->p_nx = p_nx; p_hnizdo->p_ny = p_ny; return (hh); } HnizdoHandle par_vloz_hnizdo_dir(HnizdoHandle hh, BOD * p_dir) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->p_dir = p_dir; return (hh); } HnizdoHandle par_vloz_hnizdo_vitr(HnizdoHandle hh, BOD * p_vitr) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->p_vitr = p_vitr; return (hh); } HnizdoHandle par_vloz_hnizdo_scale(HnizdoHandle hh, float rx, float ry, float utlum_x, float utlum_y) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->rychlost_x = rx; p_hnizdo->rychlost_y = ry; p_hnizdo->utlum_x = utlum_x; p_hnizdo->utlum_y = utlum_y; return (hh); } HnizdoHandle par_vloz_hnizdo_diff(HnizdoHandle hh, float r, float g, float b, float a, float dr, float dg, float db, float da, float ka) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->r = r; p_hnizdo->g = g; p_hnizdo->b = b; p_hnizdo->a = a; p_hnizdo->dr = dr; p_hnizdo->dg = dg; p_hnizdo->db = db; p_hnizdo->da = da; p_hnizdo->ka = ka; return (hh); } HnizdoHandle par_vloz_hnizdo_y_plane(HnizdoHandle hh, float y_plane) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->y_plane = y_plane; return (hh); } HnizdoHandle par_vloz_hnizdo_frame(HnizdoHandle hh, float frame, float framedelta) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->frame = frame; p_hnizdo->framedelta = framedelta; return (hh); } HnizdoHandle par_vloz_hnizdo_clip(HnizdoHandle hh, float min_x, float min_z, float max_x, float max_z) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; p_hnizdo->x_min = min_x; p_hnizdo->x_max = max_x; p_hnizdo->z_min = min_z; p_hnizdo->z_max = max_z; return (hh); } PARMETAC_HNIZDO *par_cti_hnizdo(HnizdoHandle hh) { return ((PARMETAC_HNIZDO *) hh); } PAR_KOUR_STOPA *par_cti_hnizdo_castice(HnizdoHandle hh) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; return ((PAR_KOUR_STOPA *) p_hnizdo->p_first); } int par_get_hnizda(ParHandle ph) { PARMETAC *p_par = (PARMETAC *) ph; return (p_par->hnum); } void par_zrus_hnizdo(ParHandle ph, HnizdoHandle hh) { PARMETAC_HNIZDO *p_hnizdo = (PARMETAC_HNIZDO *) hh; PARMETAC *p_par = (PARMETAC *) ph; PAR_KOUR_STOPA *p_next = (PAR_KOUR_STOPA *) p_hnizdo->p_first, *p_tmp; // Prevedu zbyvajici castice do spolecneho fondu while (p_next) { p_tmp = p_next->p_next; p_next->p_next = (PAR_KOUR_STOPA *) p_par->p_first; p_par->p_first = p_next; p_next = p_tmp; } // delete-first if (p_par->p_hnizdo == p_hnizdo) { p_par->p_hnizdo = p_hnizdo->p_next; if (p_par->p_hnizdo) { p_par->p_hnizdo->p_prev = NULL; } } else { p_hnizdo->p_prev->p_next = p_hnizdo->p_next; if (p_hnizdo->p_next) p_hnizdo->p_next->p_prev = p_hnizdo->p_prev; } free(p_hnizdo); } /* Updatuj */ int pe_updatuj_kour_stopa(G_KONFIG * p_ber, PARMETAC * p_mt) { GAME_MESH_OLD *p_mesh; PARMETAC_HNIZDO *p_hnizdo, *p_tmp; PAR_KOUR_STOPA *p_par, *p_next; BOD *p_max; BOD *p_min; BOD tmp; BOD *p_pivot = NULL; float koef; int tx, ty, tz; int vid, atime; int diff; int scale; int scale2; int operace; int vitr; int dir; int par3d; int parhl; int yplane_top; int yplane_low; int htest; int frame; int pivot; int flag; atime = p_ber->TimeEndLastFrame; if (!(p_mt->flag & TPAR_ANIMATE)) { return (FALSE); } if (p_mt->start > atime) { return (FALSE); } if (p_mt->stop && p_mt->stop < atime) { *(p_mt->p_flag) = K_CHYBA; return (FALSE); } koef = p_ber->TimeLastFrame / 1000.0f; p_mt->pnum = 0; p_mt->hnum = 0; flag = p_mt->flag; scale = flag & TPAR_SCALE; scale2 = flag & TPAR_SCALE_ADD; diff = flag & TPAR_DIFF; operace = flag & TPAR_VETSI; vitr = flag & TPAR_VITR; dir = flag & TPAR_DIR; par3d = flag & TPAR_3D; parhl = flag & TPAR_HALF_LIFE; yplane_top = flag & TPAR_YPLANE_TOP; yplane_low = flag & TPAR_YPLANE_LOW; htest = flag & TPAR_HTEST; frame = flag & TPAR_FRAME; pivot = flag & TPAR_POS_PIVOT; if (pivot) { p_pivot = p_mt->p_pivot; } p_hnizdo = p_mt->p_hnizdo; while (p_hnizdo) { p_hnizdo->pnum = 0; /* Pridani nove castice (pokud je na ne cas) - vezmu ji v seznamu volnych castic */ if (p_hnizdo->p_pivot && (int)atime - (int)p_hnizdo->time_last >= (int) p_hnizdo->time_interval) { p_hnizdo->time_last = atime; if (!p_mt->p_first) continue; p_par = (PAR_KOUR_STOPA *) p_mt->p_first; p_mt->p_first = p_par->p_next; p_par->p = *p_hnizdo->p_pivot; { VECT min(-FLT_MAX), max(FLT_MAX); kd_bunka_min_max(&p_par->p, &min, &max); } if (dir && p_hnizdo->p_dir) p_par->dir = *p_hnizdo->p_dir; if (par3d) { p_par->nx = *p_hnizdo->p_nx; p_par->ny = *p_hnizdo->p_ny; } p_par->time_vznik = atime; p_par->r = p_hnizdo->r; p_par->g = p_hnizdo->g; p_par->b = p_hnizdo->b; p_par->a = p_hnizdo->a; p_par->rychlost_x = p_hnizdo->rychlost_x; p_par->rychlost_y = p_hnizdo->rychlost_y; p_par->dr = p_hnizdo->dr; p_par->dg = p_hnizdo->dg; p_par->db = p_hnizdo->db; p_par->da = p_hnizdo->da; p_par->ka = p_hnizdo->ka; p_par->utlum_x = p_hnizdo->utlum_x; p_par->utlum_y = p_hnizdo->utlum_y; p_par->frame = p_hnizdo->frame; p_par->framedelta = p_hnizdo->framedelta; p_par->x_max = p_hnizdo->x_max; p_par->x_min = p_hnizdo->x_min; p_par->z_max = p_hnizdo->z_max; p_par->z_min = p_hnizdo->z_min; p_par->rotace = p_hnizdo->rotace; p_par->y_plane = p_hnizdo->y_plane; // Insert-first p_par->p_next = (PAR_KOUR_STOPA *) p_hnizdo->p_first; if (p_par->p_next) { p_par->p_next->p_prev = p_par; } p_hnizdo->p_first = p_par; p_par->p_prev = NULL; } p_min = &p_hnizdo->min; p_max = &p_hnizdo->max; p_min->x = -FLT_MAX; p_min->y = -FLT_MAX; p_min->z = -FLT_MAX; p_max->x = FLT_MAX; p_max->y = FLT_MAX; p_max->z = FLT_MAX; /* Update stavajicich */ p_par = (PAR_KOUR_STOPA *) p_hnizdo->p_first; while (p_par) { p_next = p_par->p_next; p_par->a += p_par->da * koef; vid = (operace) ? (p_par->a > p_par->ka) : (p_par->a < p_par->ka); //.. vyhod neaktivni castici ze seznamu if (!vid) { /* Vyrad castici z hnizda a strc ji do seznamu volnych castic */ if (p_par->p_prev) { p_par->p_prev->p_next = p_par->p_next; if (p_par->p_next) p_par->p_next->p_prev = p_par->p_prev; } else { p_hnizdo->p_first = p_par->p_next; if (p_par->p_next) p_par->p_next->p_prev = NULL; } /* Soupni ji od seznamu volnych castic */ p_par->p_next = (PAR_KOUR_STOPA *) p_mt->p_first; p_mt->p_first = p_par; } else { if (scale) { p_par->rychlost_x += p_par->rychlost_x * (p_par->utlum_x * koef); p_par->rychlost_y += p_par->rychlost_y * (p_par->utlum_y * koef); } else if (scale2) { p_par->rychlost_x += (p_par->utlum_x * koef); p_par->rychlost_y += (p_par->utlum_y * koef); } if (diff) { p_par->r += p_par->dr * koef; p_par->g += p_par->dg * koef; p_par->b += p_par->db * koef; } if (dir) { vektor_add(&p_par->p, vektor_mult_skalar(&p_par->dir, koef, &tmp), &p_par->p); } if (vitr) { vektor_add(&p_par->p, vektor_mult_skalar(p_hnizdo->p_vitr, koef, &tmp), &p_par->p); } if (frame) { p_par->frame += p_par->framedelta * koef; } // Aktivni castici pouzij k vypoctu kostky BOD *p_pos = &p_par->rp; if (pivot) { vektor_add(&p_par->p, p_pivot, p_pos); } else { *p_pos = p_par->p; } // Testy na umisteni castice v prostoru if ((yplane_low && p_pos->y < p_par->y_plane) || (yplane_top && p_pos->y > p_par->y_plane)) { // Vyrad castici z hnizda a strc ji do seznamu volnych castic vyrad_castici: if (p_par->p_prev) { p_par->p_prev->p_next = p_par->p_next; if (p_par->p_next) p_par->p_next->p_prev = p_par->p_prev; } else { p_hnizdo->p_first = p_par->p_next; if (p_par->p_next) p_par->p_next->p_prev = NULL; } // Soupni ji do seznamu volnych castic p_par->p_next = (PAR_KOUR_STOPA *) p_mt->p_first; p_mt->p_first = p_par; p_par = p_next; continue; } if (htest) { if (p_pos->y <= p_ber->y_start) { goto vyrad_castici; } else { tx = (int) floor(p_pos->x - p_ber->x_start) >> 1; ty = (int) floor(p_pos->y - p_ber->y_start) >> 1; tz = (int) floor(p_pos->z - p_ber->z_start) >> 1; if (tx >= 0 && tx < p_ber->x_num && ty >= 0 && ty < p_ber->y_num && tz >= 0 && tz < p_ber->z_num) { assert(ber_pozice_v_levelu(tx, ty, tz, p_ber->x_num, p_ber->z_num) < p_ber->hitnum); if (p_ber->p_hit_list[ber_pozice_v_levelu(tx, ty, tz, p_ber->x_num, p_ber->z_num)]) goto vyrad_castici; else { ber_mesh_render_list_reset(p_ber); while ((p_mesh = (GAME_MESH_OLD *) ber_mesh_render_list_next_flag(p_ber, KONT_PRVEK, KONT_DRAW_NOBALKA))) { if (obb_je_bod_v_kostce_aabb(&p_mesh->obb_world, p_pos)) { goto vyrad_castici; } } } } } } if (!par3d) { kd_bunka_min_max(p_pos, p_min, p_max); } else if (par3d || parhl) { kd_bunka_min_max_koule(p_pos, MAX(p_par->rychlost_x, p_par->rychlost_y), p_min, p_max); } p_hnizdo->pnum++; } p_par = p_next; } p_mt->pnum += p_hnizdo->pnum; p_tmp = p_hnizdo->p_next; // Zrusi se hnizdo if (p_mt->flag & TPAR_AUTOREMOVE && !p_hnizdo->pnum && !p_hnizdo->p_pivot) { par_zrus_hnizdo((ParHandle) p_mt, (HnizdoHandle) p_hnizdo); } else { p_mt->hnum++; } p_hnizdo = p_tmp; } return (p_mt->pnum); } /* Update casticovych systemu... */ void pe_updatuj(G_KONFIG * p_ber) { PARMETAC *p_par = p_ber->p_par; PARMETAC *p_next = NULL; while (p_par) { p_next = p_par->p_next; if (p_par->flag & TPAR_STREP) pe_updatuj_strepiny(p_ber, p_par); else if (p_par->flag & TPAR_KOUR_STOPA) pe_updatuj_kour_stopa(p_ber, p_par); else if (p_par->flag & TPAR_FLEK) pe_updatuj_fleky(p_ber, p_par); else assert(0); p_par = p_next; } } /* *************************************************************** Vodni dilo milesovsko *************************************************************** */ /* *************************************************************** Vodni dilo 2 *************************************************************** */ VodaHandle vod_vyrob(int meshu) { VODA2 *p_voda; p_voda = (VODA2 *) mmalloc(sizeof(p_voda[0])); p_voda->p_mesh = (GAME_MESH_OLD **) mmalloc(sizeof(p_voda->p_mesh[0]) * meshu); p_voda->meshmax = meshu; p_voda->p_next = p_ber->p_voda; if (p_voda->p_next) { p_voda->p_next->p_prev = p_voda; } p_ber->p_voda = p_voda; return ((VodaHandle) p_voda); } void vod_zrus_vodniky(VODNIK * p_vodnik) { VODNIK *p_next; while (p_vodnik) { p_next = p_vodnik->p_next; free(p_vodnik->p_vzdal); free(p_vodnik); p_vodnik = p_next; } } void vod_zrus(VODA2 ** p_tmp) { VODA2 *p_voda = *p_tmp; VODA2 *p_next; while (p_voda) { p_next = p_voda->p_next; vod_zrus_vodniky(p_voda->p_vodnik); free(p_voda->p_vertexy); free(p_voda->p_mesh); free(p_voda); p_voda = p_next; } if (p_tmp) *p_tmp = NULL; } VodaHandle vod_pridej_mesh(VodaHandle vh, MeshHandle mh) { int mesh = p_ber->p_prv_lev[mh]->mesh; VODA2 *p_voda = (VODA2 *) vh; GAME_MESH_OLD *p_mesh; if (mesh == K_CHYBA) return (K_CHYBA); else p_mesh = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; if (p_mesh) { p_voda->p_mesh[p_voda->meshnum++] = p_mesh; assert(p_voda->meshnum <= p_voda->meshmax); p_mesh->p_data->kflag |= KONT_DRAW_VODA; transformuj_mesh(p_mesh); mesh_pridej_vodavertexy(p_mesh); return (vh); } else // pridava se staticky mesh -> k_chyba return (K_CHYBA); } VodaHandle vod_uzavri_meshe(VodaHandle vh) { VODA2 *p_voda = (VODA2 *) vh; VODOVERTEX *p_vert; BOD *p_bod; BODRGBA *p_diff; BODRGB *p_spec; BODRGBA *p_diff_mat; BODRGB *p_spec_mat; int vert = 0, vnum; int i, j; for (i = 0; i < p_voda->meshnum; i++) { vert += p_voda->p_mesh[i]->vertexnum; } p_vert = p_voda->p_vertexy = (VODOVERTEX *)mmalloc(sizeof(p_voda->p_vertexy[0]) * vert); p_voda->vertexu = vert; vert = 0; for (i = 0; i < p_voda->meshnum; i++) { vnum = p_voda->p_mesh[i]->vertexnum; p_bod = p_voda->p_mesh[i]->p_vertex_pos; p_diff = p_voda->p_mesh[i]->p_vertex_diff_voda; p_spec = p_voda->p_mesh[i]->p_vertex_spec_voda; p_diff_mat = p_voda->p_mesh[i]->p_vertex_diff; p_spec_mat = p_voda->p_mesh[i]->p_vertex_spec; for (j = 0; j < vnum; j++) { p_vert[vert].p_pos = p_bod + j; p_vert[vert].p_diff = p_diff + j; p_vert[vert].p_diff_mat = p_diff_mat + j; if (p_spec) { p_vert[vert].p_spec_mat = p_spec_mat + j; p_vert[vert].p_spec = p_spec + j; } else { p_vert[vert].p_spec_mat = p_vert[vert].p_spec = NULL; } p_vert[vert].vyska = p_bod[j].y; vert++; } } assert(p_voda->vertexu == vert); return (vh); } VodnikHandle vod_vloz_vodnika(VodaHandle vh, BOD * p_pos, int flag, float amplituda, float perioda, float fi, float damplituda, float dperioda, float dfi) { VODOVERTEX *p_vert, *p_vr; VODA2 *p_voda = (VODA2 *) vh; float *p_vzdal; VODNIK *p_vodnik; int i; p_vodnik = (VODNIK *)mmalloc(sizeof(p_vodnik[0])); p_vodnik->p = *p_pos; p_vodnik->flag = flag; p_vodnik->amplituda = amplituda; p_vodnik->perioda = perioda; p_vodnik->fi = fi; p_vodnik->damplituda = damplituda; p_vodnik->dperioda = dperioda; p_vodnik->dfi = dfi; p_vodnik->vertexnum = p_voda->vertexu; p_vert = p_vodnik->p_vert = p_voda->p_vertexy; p_vzdal = p_vodnik->p_vzdal = (float *) mmalloc(sizeof(p_vzdal[0]) * p_vodnik->vertexnum); for (i = 0; i < p_vodnik->vertexnum; i++) { p_vr = p_vert + i; if (flag & VOD_BOD) { p_vzdal[i] = vzdal_bodu_bod(p_vr->p_pos, p_pos); } else { if (flag & VOD_X_PLANE) { p_vzdal[i] = fabsf(p_vr->p_pos->x - p_pos->x); } else if (flag & VOD_Y_PLANE) { p_vzdal[i] = fabsf(p_vr->p_pos->y - p_pos->y); } else { p_vzdal[i] = fabsf(p_vr->p_pos->z - p_pos->z); } } } p_vodnik->p_next = p_voda->p_vodnik; p_voda->p_vodnik = p_vodnik; return ((VodnikHandle) p_vodnik); } VodnikHandle vod_uprav_vodnika_par(VodnikHandle vh, float amplituda, float perioda, float fi, float damplituda, float dperioda, float dfi) { VODNIK *p_vodnik = (VODNIK *) vh; p_vodnik->amplituda = amplituda; p_vodnik->perioda = perioda; p_vodnik->fi = fi; p_vodnik->damplituda = damplituda; p_vodnik->dperioda = dperioda; p_vodnik->dfi = dfi; return (vh); } VodnikHandle vod_cti_vodnika_par(VodnikHandle vh, float *p_amplituda, float *p_perioda, float *p_fi, float *p_damplituda, float *p_dperioda, float *p_dfi) { VODNIK *p_vodnik = (VODNIK *) vh; *p_amplituda = p_vodnik->amplituda; *p_perioda = p_vodnik->perioda; *p_fi = p_vodnik->fi; *p_damplituda = p_vodnik->damplituda; *p_dperioda = p_vodnik->dperioda; *p_dfi = p_vodnik->dfi; return (vh); } VodnikHandle vod_uprav_vodnika_flag(VodnikHandle vh, int flag) { VODNIK *p_vodnik = (VODNIK *) vh; p_vodnik->flag = flag; return (vh); } VodnikHandle vod_cti_vodnika_flag(VodnikHandle vh, int *p_flag) { VODNIK *p_vodnik = (VODNIK *) vh; *p_flag = p_vodnik->flag; return (vh); } VodnikHandle vod_vloz_vodnika_diff(VodnikHandle vh, float dr, float dg, float db, float da) { VODNIK *p_vodnik = (VODNIK *) vh; p_vodnik->dr = dr; p_vodnik->dg = dg; p_vodnik->db = db; p_vodnik->da = da; return (vh); } VodnikHandle vod_vloz_vodnika_add_diff(VodnikHandle vh, float dr, float dg, float db, float da) { VODNIK *p_vodnik = (VODNIK *) vh; p_vodnik->adr = dr; p_vodnik->adg = dg; p_vodnik->adb = db; p_vodnik->ada = da; return (vh); } VodnikHandle vod_vloz_vodnika_spec(VodnikHandle vh, float sr, float sg, float sb) { VODNIK *p_vodnik = (VODNIK *) vh; p_vodnik->sr = sr; p_vodnik->sg = sg; p_vodnik->sb = sb; return (vh); } VodnikHandle vod_vloz_vodnika_add_spec(VodnikHandle vh, float sr, float sg, float sb) { VODNIK *p_vodnik = (VODNIK *) vh; p_vodnik->asr = sr; p_vodnik->asg = sg; p_vodnik->asb = sb; return (vh); } void vod_updatuj_vodniky(VODNIK * p_vodnik) { float koef = p_ber->TimeLastFrame / 1000.0f; float *p_sinus_table = p_ber->sinus_table; float vzdal, am, fi, per; int diff, diff1, diff2; int spec, spec1, spec2; VODOVERTEX *p_vert; float *p_vzdal; float sinus; float dr, dg, db, da; float sr, sg, sb; float adr, adg, adb, ada; float asr, asg, asb; int i; /* Zpet do vodniho sveta ! */ while (p_vodnik) { if (p_vodnik->flag & VOD_AKTIVNI) { p_vodnik->amplituda += p_vodnik->damplituda * koef; p_vodnik->perioda += p_vodnik->dperioda * koef; p_vodnik->fi += p_vodnik->dfi * koef; am = p_vodnik->amplituda; per = p_vodnik->perioda; fi = p_vodnik->fi; diff = p_vodnik->flag & (VOD_DIFF_MOD | VOD_DIFF_ADD | VOD_DIFF_SUB); if (diff) { diff1 = p_vodnik->flag & VOD_DIFF_MOD; diff2 = p_vodnik->flag & VOD_DIFF_ADD; //diff3 = p_vodnik->flag & VOD_DIFF_SUB; dr = p_vodnik->dr; dg = p_vodnik->dg; db = p_vodnik->db; da = p_vodnik->da; adr = p_vodnik->adr; adg = p_vodnik->adg; adb = p_vodnik->adb; ada = p_vodnik->ada; } spec = p_vodnik->flag & (VOD_SPEC_MOD | VOD_SPEC_ADD | VOD_SPEC_SUB); if (spec) { spec1 = p_vodnik->flag & VOD_SPEC_MOD; spec2 = p_vodnik->flag & VOD_SPEC_ADD; //spec3 = p_vodnik->flag & VOD_SPEC_SUB; sr = p_vodnik->sr; sg = p_vodnik->sg; sb = p_vodnik->sb; asr = p_vodnik->asr; asg = p_vodnik->asg; asb = p_vodnik->asb; } p_vzdal = p_vodnik->p_vzdal; for (i = 0; i < p_vodnik->vertexnum; i++) { p_vert = p_vodnik->p_vert + i; vzdal = per * p_vzdal[i] + fi; sinus = p_sinus_table[ftoi(vzdal) % SIN_TABLE_SIZE]; p_vert->sinus += sinus; p_vert->p_pos->y += am * sinus; sinus = p_vert->sinus; if (diff || spec) { if (sinus > 1.0f) sinus = 1.0f; if (sinus < 0.0f) sinus = 0.0f; } if (diff) { if (diff1) { p_vert->p_diff->r = p_vert->p_diff_mat->r * dr * sinus + adr; p_vert->p_diff->g = p_vert->p_diff_mat->g * dg * sinus + adg; p_vert->p_diff->b = p_vert->p_diff_mat->b * db * sinus + adb; p_vert->p_diff->a = p_vert->p_diff_mat->a * da * sinus + ada; } else if (diff2) { p_vert->p_diff->r = p_vert->p_diff_mat->r + dr * sinus + adr; p_vert->p_diff->g = p_vert->p_diff_mat->g + dg * sinus + adg; p_vert->p_diff->b = p_vert->p_diff_mat->b + db * sinus + adb; p_vert->p_diff->a = p_vert->p_diff_mat->a + da * sinus + ada; } else { p_vert->p_diff->r = p_vert->p_diff_mat->r - dr * sinus + adr; p_vert->p_diff->g = p_vert->p_diff_mat->g - dg * sinus + adg; p_vert->p_diff->b = p_vert->p_diff_mat->b - db * sinus + adb; p_vert->p_diff->a = p_vert->p_diff_mat->a - da * sinus + ada; } } if (spec) { if (spec1) { p_vert->p_spec->r = p_vert->p_spec_mat->r * sr * sinus + asr; p_vert->p_spec->g = p_vert->p_spec_mat->g * sg * sinus + asg; p_vert->p_spec->b = p_vert->p_spec_mat->b * sb * sinus + asb; } else if (spec2) { p_vert->p_spec->r = p_vert->p_spec_mat->r + sr * sinus + asr; p_vert->p_spec->g = p_vert->p_spec_mat->g + sg * sinus + asg; p_vert->p_spec->b = p_vert->p_spec_mat->b + sb * sinus + asb; } else { p_vert->p_spec->r = p_vert->p_spec_mat->r - sr * sinus + asr; p_vert->p_spec->g = p_vert->p_spec_mat->g - sg * sinus + asg; p_vert->p_spec->b = p_vert->p_spec_mat->b - sb * sinus + asb; } } } } p_vodnik = p_vodnik->p_next; } } void vod_updatuj(VODA2 * p_voda) { VODOVERTEX *p_vert; int i, m; while (p_voda) { // reset vody for (i = 0; i < p_voda->vertexu; i++) { p_vert = p_voda->p_vertexy + i; p_vert->p_pos->y = p_vert->vyska; p_vert->sinus = 0.0f; *p_vert->p_diff = *p_vert->p_diff_mat; if (p_vert->p_spec) *p_vert->p_spec = *p_vert->p_spec_mat; } vod_updatuj_vodniky(p_voda->p_vodnik); for (m = 0; m < p_voda->meshnum; m++) { p_voda->p_mesh[m]->p_data->k2flag |= KONT2_UPDATE_DIFF | KONT2_UPDATE_SPEC; } p_voda = p_voda->p_next; } } berusky2-0.12/src/komat/Berusky3d_castice2.h0000644000175000017500000000066513674426075015653 00000000000000/* Casticovy system pro Berusky II */ #ifndef __BERUSKY3D_CASTICE2_H_ #define __BERUSKY3D_CASTICE2_H_ int pe_updatuj_strepiny(G_KONFIG * p_ber, PARMETAC * p_par); int pe_updatuj_fleky(G_KONFIG * p_ber, PARMETAC * p_par); int pe_updatuj_kour_stopa(G_KONFIG * p_ber, PARMETAC * p_mt); void pe_updatuj(G_KONFIG * p_ber); void vod_zrus_vodniky(VODNIK * p_vodnik); void vod_zrus(VODA2 ** p_tmp); void vod_updatuj(VODA2 * p_voda); #endif berusky2-0.12/src/komat/Load_chunks.h0000644000175000017500000000304013674454652014445 00000000000000/* Chunky */ #ifndef __LOAD_CHUNKS_H_ #define __LOAD_CHUNKS_H_ int lo_uloz_kontejner_chunk(FFILE f, EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER * p_kont, int low); EDIT_KONTEJNER *lo_nahraj_kontejner_chunk(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_jmeno, int mat, int normal); int lo_uloz_material_chunk(FFILE f, EDIT_MATERIAL * p_mat); int lo_nahraj_materialy_chunk(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_TEXT * p_text, int max_text, char *p_file, int save); int lo_uloz_projekt(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER ** p_kontlist, int kontnum, char *p_jmeno, STATIC_LIGHT * p_light, int lightnum, ZDRCADLO_DESC * p_zrcadlo, LENS_FLARE * p_flarr, int flaremax, dword ambient, MLZNA_KOSTKA * p_mlha, DYN_LIGHT * p_ddlight, int ddlightnum, EXTRA_DYN_LIGHT * p_eelight, int eelightnum, LEVEL_ENVIRONMENT * p_env, NASTAVENI_KAMER * p_kam, LEVEL_KONFIG * p_lc, int level, int transf_static); int lo_nahraj_projekt(EDIT_MATERIAL ** p_mat, int max_mat, EDIT_KONTEJNER ** p_kontls, int kontnum, EDIT_TEXT_OLD * p_text, int max_text, char *p_jmeno, STATIC_LIGHT * p_light, int lightnum, ZDRCADLO_DESC * p_zrcadlo, int *p_zrcadlo_aktivni, LENS_FLARE * p_flarr, int flaremax, dword * p_amb, MLZNA_KOSTKA ** p_mlha, DYN_LIGHT * p_ddlight, int ddlightnum, EXTRA_DYN_LIGHT * p_eelight, int eelightnum, LEVEL_ENVIRONMENT * p_env, NASTAVENI_KAMER * p_kam, LEVEL_KONFIG * p_lev_konfig, int flag, int normal); void lo_chunk_stage_load_korekce(EDIT_MATERIAL ** p_mat, int num); #endif berusky2-0.12/src/komat/zlib_io.h0000644000175000017500000000215613674426075013647 00000000000000/* Stdio->zlib interface */ /* #define ZLIB_FILES #ifdef ZLIB_FILES */ #define FFILE gzFile #define ffopen gzopen #define ffread(buffer,s1,s2,f) gzread(f,buffer,(s1)*(s2)) #define ffwrite(buffer,s1,s2,f) gzwrite(f,buffer,(s1)*(s2)) #define ffseek gzseek #define fftell gztell #define ffclose gzclose #define ffputs(string,f) gzputs(f,string) #define ffgets(string,n,f) gzgets(f,string,n) #define ffputc(c,f) gzputc(f,c) #define ffgetc gzgetc #define ffeof gzeof /* #else #define FFILE FILE * #define ffopen fopen #define ffread(buffer,s1,s2,f) fread(buffer,s1,s2,f) #define ffwrite(buffer,s1,s2,f) fwrite(buffer,s1,s2,f) #define ffseek fseek #define fftell ftell #define ffclose fclose #define ffputs(string,f) fputs(string,f) #define ffgets(string,n,f) fgets(string,n,f) #define ffputc(c,f) fputc(c,f) #define ffgetc fgetc #define ffeof feof #endif */ berusky2-0.12/src/komat/3dmath.cpp0000644000175000017500000002776413674426075013747 00000000000000/* 3D matematicke funkce */ #include "3d_all.h" GLMATRIX *calc_reflex_matrix(GLMATRIX * p_mat, BOD * p_a, BOD * p_b, BOD * p_c) { float e; QUAT q; q.x = (p_b->y - p_a->y) * (p_c->z - p_a->z) - (p_c->y - p_a->y) * (p_b->z - p_a->z); q.y = (p_b->z - p_a->z) * (p_c->x - p_a->x) - (p_c->z - p_a->z) * (p_b->x - p_a->x); q.z = (p_b->x - p_a->x) * (p_c->y - p_a->y) - (p_c->x - p_a->x) * (p_b->y - p_a->y); norm_vect(&q.x, &q.y, &q.z); q.w = 0.0f; e = 2 * (q.x * p_a->x + q.y * p_a->y + q.z * p_a->z); /* Init na standartni kartezskou souradnou soustavu */ init_matrix(p_mat); /* Natoceni souradnic dle vektoru q */ quat_to_matrix(p_mat, &q); /* Posun souradnic do pozadovane roviny */ translate_matrix(p_mat, q.x * e, q.y * e, q.z * e); /* Reflexivituj souradnice */ scale_matrix(p_mat, -1.0f, -1.0f, -1.0f); return (p_mat); } /* prusek s rovninou r (paprsek A->B) se ulozi do bodu p */ int calc_prusek(ROVINA * r, OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * p) { #define TOL 0.001 float t; float c, j; float qx, qy, qz; // q = B-A qx = b->x - a->x; qy = b->y - a->y; qz = b->z - a->z; c = -(r->x * a->x + r->y * a->y + r->z * a->z + r->e); j = r->x * qx + r->y * qy + r->z * qz; if ((j < TOL) && (j > -TOL)) { return (0); // printf("Paprsek je rovnobezny z rovinou !"); } t = c / j; // P = A - qt p->x = a->x + qx * t; p->y = a->y + qy * t; p->z = a->z + qz * t; return (1); } int calc_prusek_bod(ROVINA * r, BOD * a, BOD * b, BOD * p) { #define TOL 0.001 float t; float c, j; float qx, qy, qz; // q = B-A qx = b->x - a->x; qy = b->y - a->y; qz = b->z - a->z; c = -(r->x * a->x + r->y * a->y + r->z * a->z + r->e); j = r->x * qx + r->y * qy + r->z * qz; if ((j < TOL) && (j > -TOL)) { return (0); // printf("Paprsek je rovnobezny z rovinou !"); } t = c / j; // P = A - qt p->x = a->x + qx * t; p->y = a->y + qy * t; p->z = a->z + qz * t; return (1); } /* Opravit pruseky !!!!!!!!!!!!!!!!! */ int prusek_face(OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * p, ROVINA * p_r, OBJ_VERTEX * _1, OBJ_VERTEX * _2, OBJ_VERTEX * _3) { if (calc_prusek(p_r, a, b, p)) { if (((p_r->x > p_r->z) && (p_r->x > p_r->y)) || (p_r->z == p_r->y)) return (je_uvnitr(_1->y, _1->z, _2->y, _2->z, _3->y, _3->z, p->y, p->z)); else if (((p_r->y > p_r->z) && (p_r->y > p_r->x)) || (p_r->z == p_r->x)) return (je_uvnitr(_1->x, _1->z, _2->x, _2->z, _3->x, _3->z, p->x, p->z)); else if (((p_r->z > p_r->x) && (p_r->z > p_r->y)) || (p_r->x == p_r->y)) return (je_uvnitr(_1->x, _1->y, _2->x, _2->y, _3->x, _3->y, p->x, p->y)); else return (FALSE); } else return (FALSE); } int prusek_face_editor(OBJ_VERTEX * a, OBJ_VERTEX * b, OBJ_VERTEX * p, OBJ_VERTEX * _1, OBJ_VERTEX * _2, OBJ_VERTEX * _3) { ROVINA r; calc_rovinu(_1, _2, _3, &r); if (calc_prusek(&r, a, b, p)) { r.x = (float) fabs(r.x); r.y = (float) fabs(r.y); r.z = (float) fabs(r.z); if (((r.x > r.z) && (r.x > r.y)) || (r.z == r.y)) return (je_uvnitr(_1->y, _1->z, _2->y, _2->z, _3->y, _3->z, p->y, p->z)); else if (((r.y > r.z) && (r.y > r.x)) || (r.z == r.x)) return (je_uvnitr(_1->x, _1->z, _2->x, _2->z, _3->x, _3->z, p->x, p->z)); else if (((r.z > r.x) && (r.z > r.y)) || (r.x == r.y)) return (je_uvnitr(_1->x, _1->y, _2->x, _2->y, _3->x, _3->y, p->x, p->y)); else return (FALSE); } else return (FALSE); } int intersect_triangle_point(OBJ_VERTEX * _1, OBJ_VERTEX * _2, OBJ_VERTEX * _3, BOD * p) { ROVINA r; calc_rovinu(_1, _2, _3, &r); r.x = (float) fabs(r.x); r.y = (float) fabs(r.y); r.z = (float) fabs(r.z); if (((r.x > r.z) && (r.x > r.y)) || (r.y == r.z)) // prumet do z/y return (je_uvnitr(_1->y, _1->z, _2->y, _2->z, _3->y, _3->z, p->y, p->z)); else if (((r.y > r.z) && (r.y > r.x)) || (r.x == r.z)) //prumet do x/z return (je_uvnitr(_1->x, _1->z, _2->x, _2->z, _3->x, _3->z, p->x, p->z)); else if (((r.z > r.x) && (r.z > r.y)) || (r.y == r.x)) // prumet do x/y return (je_uvnitr(_1->x, _1->y, _2->x, _2->y, _3->x, _3->y, p->x, p->y)); else { ddw("Velka chyba vrhani savle !"); return (FALSE); } } #define MAX_HRANOVA_VZDAL 0.0001f #define frvn(x,y,presnost) (fabs(x-y) < presnost) int je_uvnitr(float ax, float ay, float bx, float by, float cx, float cy, float px, float py) { float sp; int v = 0; int hrana = 0; #define calc_sp(a0,a1,b0,b1,p0,p1) ((b0 - a0)*(p1 - a1) - (b1 - a1)*(p0 - a0)) // Face je z a->b, b->c, c->a // Pod musi lezet nalevo (napravo) od vsech techto primek if (frvn(ax, px, MAX_HRANOVA_VZDAL) && frvn(ay, py, MAX_HRANOVA_VZDAL)) return (1); if (frvn(bx, px, MAX_HRANOVA_VZDAL) && frvn(by, py, MAX_HRANOVA_VZDAL)) return (1); if (frvn(cx, px, MAX_HRANOVA_VZDAL) && frvn(cy, py, MAX_HRANOVA_VZDAL)) return (1); //a->b sp = calc_sp(ax, ay, bx, by, px, py); if (MAX_HRANOVA_VZDAL > fabs(sp)) hrana = 1; else if (sp > 0) v += 1; else v -= 1; //b->c .. a = b, b = c sp = calc_sp(bx, by, cx, cy, px, py); if (MAX_HRANOVA_VZDAL > fabs(sp)) hrana = 1; else if (sp > 0) v += 1; else v -= 1; sp = calc_sp(cx, cy, ax, ay, px, py); if (MAX_HRANOVA_VZDAL > fabs(sp)) hrana = 1; else if (sp > 0) v += 1; else v -= 1; if (abs(v) == 3) return (1); else { if (abs(v) == 2 && hrana) return (1); else return (0); } } int intersect_triangle(BOD * p_orig, BOD * p_dir, BOD * p_v0, BOD * p_v1, BOD * p_v2, FLOAT * p_t, FLOAT * p_u, FLOAT * p_v) { BOD edge1, edge2, tvec, pvec, qvec; float det, inv_det; // spocitam ramena trojuhelnika edge1.x = p_v1->x - p_v0->x; edge1.y = p_v1->y - p_v0->y; edge1.z = p_v1->z - p_v0->z; edge2.x = p_v2->x - p_v0->x; edge2.y = p_v2->y - p_v0->y; edge2.z = p_v2->z - p_v0->z; // determinant - uhel mezi plochou dir&edge2 a vektorem edge1 // spocitam rovinu mezi dir&edge2 pvec.x = p_dir->y * edge2.z - p_dir->z * edge2.y; pvec.y = p_dir->z * edge2.x - p_dir->x * edge2.z; pvec.z = p_dir->x * edge2.y - p_dir->y * edge2.x; // uhel mezi normalovym vektorem plochy dir&edge2 a edge1 det = edge1.x * pvec.x + edge1.y * pvec.y + edge1.z * pvec.z; // lezi paprsek v rovine plosky (je rovnobezny s ploskou ?) // uhel mezi paprskem a ploskou je det // culling off if (det > -EPSILON && det < EPSILON) return (FALSE); // t = 0->orig tvec.x = p_orig->x - p_v0->x; tvec.y = p_orig->y - p_v0->y; tvec.z = p_orig->z - p_v0->z; // uhel mezi t a p *p_u = tvec.x * pvec.x + tvec.y * pvec.y + tvec.z * pvec.z; if (*p_u < 0.0f || *p_u > det) return (FALSE); // plocha mezi tvec a edge1 qvec.x = tvec.y * edge1.z - tvec.z * edge1.y; qvec.y = tvec.z * edge1.x - tvec.x * edge1.z; qvec.z = tvec.x * edge1.y - tvec.y * edge1.x; // uhel mezi p_dir a qvec *p_v = (p_dir->x * qvec.x + p_dir->y * qvec.y + p_dir->z * qvec.z); // test hranic s = u, t = v if (*p_v < 0.0f || *p_u + *p_v > det) return (FALSE); // spocitani t parametru *p_t = (edge2.x * qvec.x + edge2.y * qvec.y + edge2.z * qvec.z); inv_det = 1.0f / det; *p_u *= inv_det; *p_v *= inv_det; *p_t *= inv_det; return (TRUE); } int intersect_triangle_ncull(BOD * p_orig, BOD * p_dir, BOD * p_v0, BOD * p_v1, BOD * p_v2, FLOAT * p_t, FLOAT * p_u, FLOAT * p_v) { BOD edge1, edge2, tvec, pvec, qvec; float det, inv_det; // spocitam ramena trojuhelnika edge1.x = p_v1->x - p_v0->x; edge1.y = p_v1->y - p_v0->y; edge1.z = p_v1->z - p_v0->z; edge2.x = p_v2->x - p_v0->x; edge2.y = p_v2->y - p_v0->y; edge2.z = p_v2->z - p_v0->z; // determinant - uhel mezi plochou dir&edge2 a vektorem edge1 // spocitam rovinu mezi dir&edge2 pvec.x = p_dir->y * edge2.z - p_dir->z * edge2.y; pvec.y = p_dir->z * edge2.x - p_dir->x * edge2.z; pvec.z = p_dir->x * edge2.y - p_dir->y * edge2.x; // uhel mezi normalovym vektorem plochy dir&edge2 a edge1 det = edge1.x * pvec.x + edge1.y * pvec.y + edge1.z * pvec.z; // lezi paprsek v rovine plosky (je rovnobezny s ploskou ?) // uhel mezi paprskem a ploskou je det // culling off if (det > -EPSILON && det < EPSILON) return (FALSE); inv_det = 1.0f / det; // t = 0->orig tvec.x = p_orig->x - p_v0->x; tvec.y = p_orig->y - p_v0->y; tvec.z = p_orig->z - p_v0->z; // uhel mezi t a p *p_u = (tvec.x * pvec.x + tvec.y * pvec.y + tvec.z * pvec.z) * inv_det; if (*p_u < 0.0f || *p_u > 1.0f) return (FALSE); // plocha mezi tvec a edge1 qvec.x = tvec.y * edge1.z - tvec.z * edge1.y; qvec.y = tvec.z * edge1.x - tvec.x * edge1.z; qvec.z = tvec.x * edge1.y - tvec.y * edge1.x; // uhel mezi p_dir a qvec *p_v = (p_dir->x * qvec.x + p_dir->y * qvec.y + p_dir->z * qvec.z) * inv_det; // test hranic s = u, t = v if (*p_v < 0.0f || *p_u + *p_v > 1.0f) return (FALSE); // spocitani t parametru *p_t = (edge2.x * qvec.x + edge2.y * qvec.y + edge2.z * qvec.z) * inv_det; return (TRUE); } /* Spocita kamerovou matici */ GLMATRIX *calc_camera_3ds(GLMATRIX * p_cam, GLMATRIX * p_invcam, BOD * p_p, BOD * p_t, float roll) { GLMATRIX m; BOD x, y, z; vektor_norm(vektor_sub(p_t, p_p, &z)); y.x = y.z = 0.0f; y.y = 1.0f; vektor_norm(vektor_soucin(&y, &z, &x)); vektor_norm(vektor_soucin(&z, &x, &y)); p_cam->_14 = p_cam->_24 = p_cam->_34 = 0.0f; p_cam->_44 = 1.0f; p_cam->_41 = p_cam->_42 = p_cam->_43 = 0.0f; p_cam->_11 = x.x; p_cam->_21 = x.y; p_cam->_31 = x.z; p_cam->_12 = y.x; p_cam->_22 = y.y; p_cam->_32 = y.z; p_cam->_13 = z.x; p_cam->_23 = z.y; p_cam->_33 = z.z; translate_matrix(p_cam, -p_p->x, -p_p->y, -p_p->z); if (roll != 0.0f) { rotation_matrix_z(&m, roll); mat_mult(p_cam, &m, p_cam); } return (invert_matrix(p_cam, p_invcam)); } GLMATRIX *calc_camera_polar(GLMATRIX * p_cam, GLMATRIX * p_invcam, BOD * p_p, QUAT * p_quat, float vzdal) { p_invcam->_14 = p_invcam->_24 = p_invcam->_34 = 0.0f; p_invcam->_44 = 1.0f; p_invcam->_41 = p_p->x; p_invcam->_42 = p_p->y; p_invcam->_43 = p_p->z; quat_to_matrix(p_invcam, p_quat); // jednotkove vektory do kamery translate_matrix(p_invcam, 0, 0, -vzdal); //+posun return (invert_matrix(p_invcam, p_cam)); } void calc_camera(GLMATRIX * p_cmatrix, GLMATRIX * r_bod_matrix, float vzdal, float fi) { GLMATRIX m; m = *r_bod_matrix; rotate_matrix_x(&m, fi); translate_matrix(&m, 0, 0, -vzdal); invert_matrix(&m, p_cmatrix); } void calc_camera_bod(GLMATRIX * p_cmatrix, GLMATRIX * p_inv, BOD * p_p, float vzdal, float fi, float rfi) { init_matrix(p_inv); p_inv->_41 = p_p->x; p_inv->_42 = p_p->y; p_inv->_43 = p_p->z; rotate_matrix_y(p_inv, rfi); rotate_matrix_x(p_inv, fi); translate_matrix(p_inv, 0, 0, -vzdal); invert_matrix(p_inv, p_cmatrix); } void calc_r_bod(GLMATRIX * p_cmatrix, GLMATRIX * r_bod_matrix, float vzdal, float fi) { *r_bod_matrix = *p_cmatrix; translate_matrix(r_bod_matrix, 0, 0, vzdal); rotate_matrix_x(r_bod_matrix, -fi); } // prusecik primky a,b a bodu p void prusecik(BOD * p_a, BOD * p_b, BOD * p_p, BOD * p_I) { float t_i, vz; t_i = (p_b->x - p_a->x) * (p_p->x - p_a->x) + (p_b->y - p_a->y) * (p_p->y - p_a->y) + (p_b->z - p_a->z) * (p_p->z - p_a->z); vz = (float) vzdal_bodu_xy(p_a->x, p_a->y, p_a->z, p_b->x, p_b->y, p_b->z); t_i /= (vz * vz); p_I->x = p_a->x + (p_b->x - p_a->x) * t_i; p_I->y = p_a->y + (p_b->y - p_a->y) * t_i; p_I->z = p_a->z + (p_b->z - p_a->z) * t_i; } void prusecik_mujbod(MUJ_BOD * p_a, MUJ_BOD * p_b, MUJ_BOD * p_p, MUJ_BOD * p_I) { float t_i, vz; BOD q; t_i = (p_b->x - p_a->x) * (p_p->x - p_a->x) + (p_b->y - p_a->y) * (p_p->y - p_a->y) + (p_b->z - p_a->z) * (p_p->z - p_a->z); vz = (float) vzdal_bodu_xy(p_a->x, p_a->y, p_a->z, p_b->x, p_b->y, p_b->z); t_i /= (vz * vz); q.x = p_b->x - p_a->x; q.y = p_b->y - p_a->y; q.z = p_b->z - p_a->z; p_I->x = p_a->x + q.x * t_i; p_I->y = p_a->y + q.y * t_i; p_I->z = p_a->z + q.z * t_i; } berusky2-0.12/src/komat/Kdtree.h0000644000175000017500000001631613674426075013441 00000000000000/* Oktanovy stromy Scena + okoli -> KD strom Prvky -> obalky */ #ifndef __KDTREE_H #define __KDTREE_H #define KD_FULL_VISIBILITY 8 /* Bunka -> min/max - zpusob rozdeleni (x/y/z) - vzdalenost delici roviny - Prusecik focus s tim ctvercem (ray-tracing) - prusecik s kamerou */ #define KD_POLY 1 #define KD_MESH 2 typedef struct _KD_BUNKA { int mail; int polozek; void **p_polozka; //pole polozek (poly/kont) int *p_polozka_typ; // typy polozek (kontejner/poly) BOD min, max; int rovina; // delici rovina podstromu float vzdal; // vzdalenost od min int cislo; struct _KD_BUNKA *p_up; // otec stromu struct _KD_BUNKA *p_next; // dalsich 2 podstromu nebo nic } KD_BUNKA; void kd_strom_vyrob(EDIT_MESH_POLY * p_poly, int polynum, EDIT_KONTEJNER ** p_kont, int kontnum, KD_BUNKA * p_prvni); void kd_strom_tiskni(KD_BUNKA * p_prvni, int hloubka); int kd_visibility(BOD * p_min, BOD * p_max, GLMATRIX * p_m); int kd_visibility_full(BOD * p_min, BOD * p_max, GLMATRIX * p_m); int kd_intersect_kostku(BOD * p_a, BOD * p_b, BOD * p_min, BOD * p_max); int kd_intersect_kostku_dir(BOD * p_orig, BOD * p_dir, BOD * p_min, BOD * p_max); int kd_intersect_kostku_bod(BOD * p_a, BOD * p_b, BOD * p_min, BOD * p_max, BOD * p_p, float *p_t); int kd_intersect_kostku_bod_inter(BOD * p_a, BOD * p_b, BOD * p_min, BOD * p_max, BOD * p_p, float *p_t); void kresli_obalku(BOD min, BOD max, dword barva, GLMATRIX * p_tr); #define RIF(min,max) (((max)+(min))*0.5f) #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif inline void kd_korekce_bunky(BOD * p_min, BOD * p_max) { float tmp; if (p_min->x > p_max->x) { tmp = p_min->x; p_min->x = p_max->x; p_max->x = tmp; } if (p_min->y > p_max->y) { tmp = p_min->y; p_min->y = p_max->y; p_max->y = tmp; } if (p_min->z > p_max->z) { tmp = p_min->z; p_min->z = p_max->z; p_max->z = tmp; } } inline void kd_bunka_min(BOD * p_min, BOD * p_gmin) { if (p_min->x < p_gmin->x) p_gmin->x = p_min->x; if (p_min->y < p_gmin->y) p_gmin->y = p_min->y; if (p_min->z < p_gmin->z) p_gmin->z = p_min->z; } inline void kd_bunka_max(BOD * p_max, BOD * p_gmax) { if (p_max->x > p_gmax->x) p_gmax->x = p_max->x; if (p_max->y > p_gmax->y) p_gmax->y = p_max->y; if (p_max->z > p_gmax->z) p_gmax->z = p_max->z; } inline void kd_bunka_min_max(BOD * p_str, BOD * p_gmin, BOD * p_gmax) { if (p_str->x < p_gmin->x) p_gmin->x = p_str->x; if (p_str->y < p_gmin->y) p_gmin->y = p_str->y; if (p_str->z < p_gmin->z) p_gmin->z = p_str->z; if (p_str->x > p_gmax->x) p_gmax->x = p_str->x; if (p_str->y > p_gmax->y) p_gmax->y = p_str->y; if (p_str->z > p_gmax->z) p_gmax->z = p_str->z; } inline void kd_bunka_min_max_koule(BOD * p_str, float radius, BOD * p_gmin, BOD * p_gmax) { if (p_str->x + radius < p_gmin->x) p_gmin->x = p_str->x + radius; if (p_str->y + radius < p_gmin->y) p_gmin->y = p_str->y + radius; if (p_str->z + radius < p_gmin->z) p_gmin->z = p_str->z + radius; if (p_str->x - radius > p_gmax->x) p_gmax->x = p_str->x - radius; if (p_str->y - radius > p_gmax->y) p_gmax->y = p_str->y - radius; if (p_str->z - radius > p_gmax->z) p_gmax->z = p_str->z - radius; } inline float kd_bunka_obsah(BOD * p_min, BOD * p_max) { float a = p_max->x - p_min->x; float b = p_max->y - p_min->y; float c = p_max->z - p_min->z; return (a * a + b * b + c * c); } /* Stred bunky je RIF(min,max) */ inline BOD *kd_stred_bunky(BOD * p_min, BOD * p_max, BOD * p_bod) { p_bod->x = RIF(p_min->x, p_max->x); p_bod->y = RIF(p_min->y, p_max->y); p_bod->z = RIF(p_min->z, p_max->z); return (p_bod); } inline BOD *kd_len_bunky(BOD * p_min, BOD * p_max, BOD * p_len) { p_len->x = (p_max->x - p_min->x) * 0.5f; p_len->y = (p_max->y - p_min->y) * 0.5f; p_len->z = (p_max->z - p_min->z) * 0.5f; return (p_len); } inline void kd_bunka_expanze(BOD * p_stred, BOD * p_len, BOD * p_min, BOD * p_max) { vektor_sub(p_stred, p_len, p_min); vektor_add(p_stred, p_len, p_max); } inline void kd_bunka_expanze2(BOD * p_len, BOD * p_min, BOD * p_max) { BOD v(0, 0, 0); vektor_sub(&v, p_len, p_min); vektor_add(&v, p_len, p_max); } inline void kd_bunka_expanze3(float x, float y, float z, float dx, float dy, float dz, BOD * p_min, BOD * p_max) { p_min->x = x - dx; p_max->x = x + dx; p_min->y = y - dy; p_max->y = y + dy; p_min->z = z - dz; p_max->z = z + dz; } inline void kd_je_bod_v_kostce_orez(BOD * p_bod, BOD * p_min, BOD * p_max) { if (p_min->x > p_bod->x) p_bod->x = p_min->x; else { if (p_max->x < p_bod->x) p_bod->x = p_max->x; } if (p_min->y > p_bod->y) p_bod->y = p_min->y; else { if (p_max->y < p_bod->y) p_bod->y = p_max->y; } if (p_min->z > p_bod->z) p_bod->z = p_min->z; else { if (p_max->z < p_bod->z) p_bod->z = p_max->z; } } inline int kd_je_bod_v_kostce(BOD * p_bod, BOD * p_min, BOD * p_max) { return (p_min->x <= p_bod->x && p_bod->x <= p_max->x && p_min->y <= p_bod->y && p_bod->y <= p_max->y && p_min->z <= p_bod->z && p_bod->z <= p_max->z); } inline int kd_je_bod_v_bunce(KD_BUNKA * p_bunka, BOD * p_bod) { return (p_bunka->min.x <= p_bod->x && p_bod->x <= p_bunka->max.x && p_bunka->min.y <= p_bod->y && p_bod->y <= p_bunka->max.y && p_bunka->min.z <= p_bod->z && p_bod->z <= p_bunka->max.z); } inline int kd_je_bod_v_kostce_stred(BOD * p_bod, BOD * p_str, float vzdal) { return (p_str->x - vzdal <= p_bod->x && p_bod->x <= p_str->x + vzdal && p_str->y - vzdal <= p_bod->y && p_bod->y <= p_str->y + vzdal && p_str->z - vzdal <= p_bod->z && p_bod->z <= p_str->z + vzdal); } // rozdily mezi bodem a kostkou inline float kd_intersect_kostku_xyz(BOD * p_a, BOD * p_min, BOD * p_max, int rovina) { float v1, v2; // rovina X if (!rovina) { if (p_a->x >= p_min->x && p_a->x <= p_max->x) { return (0.0f); } else { v1 = (float) fabs(p_a->x - p_min->x); v2 = (float) fabs(p_a->x - p_max->x); return (v1 < v2 ? v1 : v2); } } else if (rovina == 1) { if (p_a->y >= p_min->y && p_a->y <= p_max->y) { return (0.0f); } else { v1 = (float) fabs(p_a->y - p_min->y); v2 = (float) fabs(p_a->y - p_max->y); return (v1 < v2 ? v1 : v2); } } else if (rovina == 2) { if (p_a->z >= p_min->z && p_a->z <= p_max->z) { return (0.0f); } else { v1 = (float) fabs(p_a->z - p_min->z); v2 = (float) fabs(p_a->z - p_max->z); return (v1 < v2 ? v1 : v2); } } return (FLT_MAX); } inline void kd_min_max_bod(BOD * p_a, BOD * p_min, BOD * p_max) { if (p_a->x < p_min->x) p_min->x = p_a->x; if (p_a->y < p_min->y) p_min->y = p_a->y; if (p_a->z < p_min->z) p_min->z = p_a->z; if (p_a->x > p_max->x) p_max->x = p_a->x; if (p_a->y > p_max->y) p_max->y = p_a->y; if (p_a->z > p_max->z) p_max->z = p_a->z; } inline int kd_min_max_valid(BOD * p_min, BOD * p_max) { return (p_min->x < p_max->x && p_min->y < p_max->y && p_min->z < p_max->z); } #endif berusky2-0.12/src/komat/Keyframe.h0000644000175000017500000003223213674426075013761 00000000000000/* Keyframovy animacni modul */ #ifndef __KEYFRAME_H #define __KEYFRAME_H #define TRIDA_A 1 // incoming case #define TRIDA_B -1 // outgoing case #define TRIDA_LOOP 2 // loop animace void dbg_print_matrix(GLMATRIX * m); void dbg_print_track_uhel(TRACK_INFO * p_track); void dbg_print_track_quaternion(TRACK_INFO * p_track); void dbg_print_track_abs(TRACK_INFO * p_track); void dbg_print_track_abs_uhel(TRACK_INFO * p_track); void kprint_matrix(GLMATRIX * m); void key_pivot_sub(EDIT_OBJEKT * p_obj, BOD * p_pivot); void key_tri_to_matrix_zero(GLMATRIX * p_m, HIERARCHY_TRACK_INFO * p_track); void key_root_to_zero(HIERARCHY_ROOT * p_root); void key_root_to_matrix(HIERARCHY_ROOT * p_root, int time, GLMATRIX * p_otec); TRACK_INFO *key_track_vyrob(int poskey, int rotkey, int scalekey); HIERARCHY_ROOT *key_root_vyrob_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_ROOT * p_root); HIERARCHY_TRACK_INFO *key_tri_vyrob_indir(HIERARCHY_TRACK_INFO * p_hir, int poskey, int rotkey, int scalekey); HIERARCHY_TRACK_INFO *key_tri_vyrob_un_indir(void); HIERARCHY_TRACK_INFO *key_tri_vyrob(int poskey, int rotkey, int scalekey); HIERARCHY_TRACK_INFO *key_track_to_tri(TRACK_INFO * p_track); BOD *key_position_tangent(HIERARCHY_TRACK_INFO * p_track, int kn, int trida, BOD * p_tn); inline QUAT *key_rotkey_to_quat(ROTKEY * p_rot, QUAT * p_q); void key_zrus_track(TRACK_INFO ** p_track); void key_tri_child_pridej(HIERARCHY_TRACK_INFO * p_root, HIERARCHY_TRACK_INFO * p_child); void key_root_child_pridej(HIERARCHY_ROOT * p_root, HIERARCHY_TRACK_INFO * p_child); void key_root_to_root_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_ROOT * p_cil, HIERARCHY_ROOT * p_src); void key_root_to_sim_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_sim, HIERARCHY_ROOT * p_root, int float_scale); void key_kontejner_reanimuj(EDIT_KONTEJNER * p_kont, HIERARCHY_ROOT * p_root); void key_kontejner_reanimuj_matrix(EDIT_KONTEJNER * p_kont, GLMATRIX * p_m); void key_sim_to_sim_indir(SIMPLE_TRACK_INFO * p_dest, SIMPLE_TRACK_INFO * p_src); void key_sim_animuj_strom(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_otec); SIMPLE_TRACK_INFO *key_sim_vyrob_indir(SIMPLE_TRACK_INFO * p_sim, int framenum); SIMPLE_TRACK_INFO *key_tri_to_sim_indir(HIERARCHY_TRACK_INFO * p_track, SIMPLE_TRACK_INFO * p_sim, int loop, int float_scale); void key_sim_uloz(SIMPLE_TRACK_INFO * p_sim, char *p_file, char *p_dir); int key_sim_nahraj(char *p_subdir, SIMPLE_TRACK_INFO * p_sim, char *p_file, char *p_dir, int linear); GLMATRIX *key_sim_to_matrix(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_m); GLMATRIX *key_sim_to_matrix_param(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_m, BOD * p_pos, QUAT * p_quat, BOD * p_scale); void key_sim_root_to_matrix(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_sim, int time, GLMATRIX * p_m); void key_mesh_reanimuj(GAME_MESH_OLD * p_mesh, int time, GLMATRIX * p_top); void key_kan_to_kamera(KAMERA * p_kam, KAMERA_TRACK_INFO * p_track, int time); int key_je_frame_klic(KEY_POINT_BRS * p_list, int klicu, dword frame); int key_je_time_klic(KEY_POINT_BRS * p_list, int klicu, dword time); void key_kontejner_retransformuj(EDIT_KONTEJNER * p_kont_top); void key_kontejner_recalc_normal_anim(EDIT_KONTEJNER * p_kont); void key_kont_updatuj_flagy(EDIT_KONTEJNER * p_kont); void key_sim_animuj_strom_pivoty(SIMPLE_TRACK_INFO * p_sim, int time, GLMATRIX * p_otec); void key_kontejner_sim_reanimuj_pivoty(EDIT_KONTEJNER * p_kont); int key_track_klic_vloz(byte ** p_hodnoty, KEY_POINT_BRS ** p_skeys, int keynum, int size_of_hodnota, byte * p_new_hodnota, KEY_POINT_BRS * p_new_keys); int key_track_klic_vloz_auto(byte ** p_hodnoty, KEY_POINT_BRS ** p_skeys, int keynum, int size_of_hodnota, byte * p_new_hodnota, KEY_POINT_BRS * p_new_keys); int key_track_klic_smaz(byte ** p_hodnoty, KEY_POINT_BRS ** p_skeys, int *p_keynum, int size_of_hodnota, dword del_time); int key_kamera_vyrob_indir(KAMERA_TRACK_INFO * p_track, int pos_keys, int trg_keys, int roll_keys, int fov_keys, int quat_keys); int key_kamera_uloz(KAMERA_TRACK_INFO * p_track, char *p_jmeno_kamery, char *p_jmeno_anim, char *p_file, char *p_dir); int key_kamera_nahraj(KAMERA_TRACK_INFO * p_track, char *p_jmeno_kamery, char *p_jmeno_anim, char *p_subdir, char *p_file, char *p_dir); void key_kamera_zrus_indir(KAMERA_TRACK_INFO * p_track); int key_kamera_track_cti(KAMERA_TRACK_INFO * p_track, BOD * p_p, BOD * p_t, float *p_roll, float *p_fov); float key_track_interpolace_float(float *p_vysl, float *p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop); BOD *key_track_interpolace_bod(BOD * p_vysl, BOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop); QUAT *key_track_interpolace_quat(QUAT * p_quat, QUAT * p_at, KEY_POINT_BRS * p_rkeys, int time, int endtime, int keynum, int loop); WBOD *key_track_interpolace_wbod(WBOD * p_vysl, WBOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop); float key_track_interpolace_float_linear(float *p_vysl, float *p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop); BOD *key_track_interpolace_bod_linear(BOD * p_vysl, BOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop); QUAT *key_track_interpolace_quat_linear(QUAT * p_quat, QUAT * p_at, KEY_POINT_BRS * p_rkeys, int time, int endtime, int keynum, int loop); WBOD *key_track_interpolace_wbod_linear(WBOD * p_vysl, WBOD * p_body, KEY_POINT_BRS * p_keys, int time, int endtime, int keynum, int loop); ANIM_TEXT *key_vyrob_material_animace(int poskey, int rotkey, int scalekey, int pivotkey); ANIM_TEXT *key_kopiruj_material_animace(ANIM_TEXT * p_src); void key_zrus_material_animace(ANIM_TEXT ** p_mat); void key_sim_to_text_matrix(ANIM_TEXT * p_text, int time, GLMATRIX * p_ttext); void key_mat_to_text_matrix(GLMATRIX * p_ttext, BOD * p_pos, float uhel, BOD * p_scale, BOD * p_pivot); ANIM_TEXT *key_text_nahraj(char *p_file, char *p_dir); int key_text_uloz(ANIM_TEXT * p_track, char *p_file, char *p_dir); void key_sim_zrus_vnitrek(SIMPLE_TRACK_INFO * p_sim); void key_sim_root_zrus(HIERARCHY_SIM * p_sim); void key_sim_zrus(SIMPLE_TRACK_INFO * p_sim); void key_tri_calc_absolutne(TRACK_INFO * p_track, QUAT * p_puvodni); void key_sim_root_to_sim_root_indir(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_cil, HIERARCHY_SIM * p_src); void key_sim_dopln_matrix_kont(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_src); void key_sim_root_to_sim_indir(HIERARCHY_SIM * p_root, SIMPLE_TRACK_INFO * p_sim); void key_kontejner_sim_reanimuj(EDIT_KONTEJNER * p_kont); void key_sim_dopln_matrix_mesh(GAME_MESH_OLD * p_mesh, SIMPLE_TRACK_INFO * p_sim); int key_sim_nahraj_extended(EDIT_KONTEJNER * p_kont, int cislo_anim, char *p_file, char *p_dir); void key_sim_root_vloz_pivoty_do_animace(EDIT_KONTEJNER * p_kont, HIERARCHY_SIM * p_root); void key_sim_root_vloz_pivoty_do_animace_kont(EDIT_KONTEJNER * p_kont); void key_mesh_transformuj_obalky(GAME_MESH_OLD * p_mesh, GLMATRIX * p_mat); void key_mesh_transformuj_obalky_keyframe(GAME_MESH_OLD * p_mesh, GLMATRIX * p_mat); //void key_mesh_calc_global_obalku(GAME_MESH_OLD *p_mesh); inline void key_mesh_recalc_normal_anim(GAME_MESH_OLD * p_mesh); void key_sim_calc_absolutne(SIMPLE_TRACK_INFO * p_sim); #define SIM_KONST 50.0f //delici kostanta casu pro sim animace #define SIM_KONSTI 50 //delici kostanta casu pro sim animace #define ROOT_NODE 0xffff // 20 framu/sec, 1 frame = 1 klic // framenum = keynum /* start - cas ktery se ma preskocit stop - cas konce (kdy se to konci) time_start - predpocitany absolutni cas startu animace time_stop - predpocitani absolutni cas konce animace time_delka - predpocitana delka animace time - relativni cas animace (0..delka) */ /* Prepocitava start/stop na casy start/stop animace */ inline void calc_time(dword framenum, dword next_time, dword start, dword stop, dword * pstart, dword * pstop, dword * time_start, dword * time_stop, dword * time_delka) { *pstart = start; *pstop = stop; *time_delka = !stop ? (framenum - 1) * SIM_KONSTI : stop; *time_start = next_time - start; *time_stop = *time_start + *time_delka; } inline void calc_time_bez_stop(dword framenum, dword next_time, dword pstart, dword pstop, dword * p_time_start, dword * p_time_stop, dword * p_time_delka) { *p_time_delka = !(pstop) ? (framenum - 1) * SIM_KONSTI : pstop; *p_time_start = next_time - pstart; *p_time_stop = *p_time_start + *p_time_delka; } inline void calc_time_end(dword endtime, dword next_time, dword start, dword stop, dword * p_pstart, dword * p_pstop, dword * p_time_start, dword * p_time_stop, dword * p_time_delka) { *p_pstart = start * SIM_KONSTI; *p_pstop = stop * SIM_KONSTI; *p_time_delka = !(*p_pstop) ? endtime : *p_pstop; *p_time_start = next_time - *p_pstart; *p_time_stop = *p_time_start + *p_time_delka; } /* int next_time = p_ber->TimeEndLastFrame; if((konec = (next_time > p_kam->time_stop))) { calc_time_loop(next_time, p_kam->start, p_kam->time_start, p_kam->time_stop, p_kam->time_delka, p_kam->time); */ /* Vypocet casu do dalsi smycky start - start cas animace next_time - */ inline void calc_time_loop(dword next_time, dword start, dword * p_time_start, dword * p_time_stop, dword * p_time_delka, dword * p_time) { *p_time_start = *p_time_stop - start; *p_time = next_time - *p_time_start; if (*p_time > 2 * (*p_time_delka)) { // pokud to je 2x pretocene, zacneme znova *p_time_start = next_time - start; *p_time = next_time - *p_time_start; } *p_time_stop = *p_time_start + *p_time_delka; } /* *p_time_start = *p_time_stop - start; *p_time_stop = *p_time_start + *p_time_delka; *p_time = next_time - *p_time_start; */ inline int calc_time_akt(int next_time, int time_start) { return (next_time - time_start); } inline int calc_endtime(int framenum) { // Leave the -1 or there will be a slight pause between walking // animations. If `framenum' is 0, we have to return 0 because // otherwise we would return a negative number. return framenum ? ((framenum - 1) * SIM_KONSTI) : 0; } inline int calc_keynum(int endtime) { return ((endtime / SIM_KONSTI) + 1); } inline int calc_framenum(int endtime) { return ((endtime / SIM_KONSTI) + 1); } inline int endtime2framenum(int endtime) { return ((endtime / SIM_KONSTI) + 1); } inline int time2frame(int time) { return (time / SIM_KONSTI); } inline float frame2sec(int frame) { return (frame * 0.05f); } inline int frame2time(int frame) { return (frame * SIM_KONSTI); } inline float time2sec(int time) { return (time / 1000.0f); } inline void key_mesh_recalc_normal_anim(GAME_MESH_OLD * p_mesh) { BOD *p_vertex; BOD *p_vertex_norm; BOD n, up(0, 1, 0); int o, i, kflag, vr; float last, akt, num; kflag = p_mesh->p_data->kflag; if (kflag & KONT_NORMAL_ANIM) { vr = kflag & KONT_NORMAL_ANIM_POS; for (o = 0; o < p_mesh->objektu; o++) { if ((last = p_mesh->p_normal_scale_last[o]) == (akt = p_mesh->p_normal_scale[o])) continue; p_vertex = p_mesh->p_vertex_pos + p_mesh->objektstart[o]; p_vertex_norm = p_mesh->p_vertex_norm + p_mesh->objektstart[o]; num = p_mesh->objektnum[o]; for (i = 0; i < num; i++, p_vertex++, p_vertex_norm++) { vektor_add(p_vertex, vektor_mult_skalar(p_vertex_norm, (last - akt), &n), p_vertex); if (vr) { vektor_add(p_vertex, vektor_mult_skalar(&up, (akt - last), &n), p_vertex); } } p_mesh->p_normal_scale_last[o] = akt; p_mesh->p_data->k2flag |= KONT2_UPDATE_POS; } } } JOINT_KEYS *key_kost_spline_vyrob(JOINT * p_joint); void key_kosti_updatuj_vertexy(EDIT_OBJEKT * p_obj, JOINT_ANIMACE * p_animace); void key_kosti_interpoluj(JOINT_ANIMACE * p_animace); void key_kosti_animuj(JOINT_ANIMACE * p_animace); void key_kosti_serad_klice(byte * p_hodnoty, KEY_POINT_BRS * p_skeys, int keynum, int size_of_hodnota); void key_kosti_stream_animuj_rec(JOINT_ANIMACE * p_anim, JOINT * p_joint, GLMATRIX * p_top, int time, int keynum); JOINT_ANIMACE *key_kosti_kopiruj(JOINT_ANIMACE * p_src); JOINT_ANIMACE *key_kosti_kopiruj_animace(JOINT_ANIMACE * p_prvni); JOINT *key_joint_vyrob(void); inline void key_kosti_reanimuj_kont(EDIT_KONTEJNER * p_kont) { EDIT_OBJEKT *p_obj; int i; if (p_kont->k2flag & KONT2_JOINT_ANIM) { for (i = 0; i < MAX_KONT_OBJEKTU; i++) { p_obj = p_kont->p_obj[i]; if (p_obj && p_obj->p_joit_animace) { key_kosti_interpoluj(p_obj->p_joit_animace); key_kosti_updatuj_vertexy(p_obj, p_obj->p_joit_animace); } } } } void kprintf_matrix(GLMATRIX * m); inline void key_kosti_stream_animuj(JOINT_ANIMACE * p_animace) { if (p_animace) { key_kosti_stream_animuj_rec(p_animace, p_animace->p_child, NULL, p_animace->time, p_animace->framenum); *p_animace->p_k2flag |= KONT2_UPDATE_POS | KONT2_UPDATE_NORM; } } inline void key_track_quat_zkontroluj(QUAT * p_quat, int keynum) { int i; for (i = 0; i < keynum; i++) { if (p_quat[i].x == 0 && p_quat[i].y == 0 && p_quat[i].z == 0 && p_quat[i].w == 0) p_quat[i].w = 1; } } #endif berusky2-0.12/src/komat/Berusky3d_kamery.cpp0000644000175000017500000011547513674426075016007 00000000000000/* berusky3d_animace.c Animacni modul k beruskam II posuny objektu kyframe animace objektu animacni hierachie */ #include #include #include #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_kamery.h" extern G_KONFIG ber, *p_ber; inline int bod_mezi(BOD * p, BOD * t, BOD * i) { BOD t1, i1; float vt1, vt2, vi1; vektor_sub(t, p, &t1); vektor_sub(i, p, &i1); vt1 = vektor_velikost(&t1); vektor_add(&t1, &i1, &i1); vektor_add(&t1, &t1, &t1); vt2 = vektor_velikost(&t1); vi1 = vektor_velikost(&i1); return (vi1 > vt1 && vi1 < vt2); } #define PRUHL_ALFA 0.35f void ber_kamera_zpruhledni_mesh(GAME_MESH_OLD * p_mesh, BOD * p_cam, BOD * p_stred) { BODRGBA *p_d, *p_dm; OBB_OLD *p_obb; int v, vn, o, in; int pruhlednych; BOD dir; vektor_sub(p_stred, p_cam, &dir); in = obb_intersect_line_dist(&p_mesh->obb_world, p_cam, &dir); if (in) { p_mesh->p_data->kflag |= KONT_DRAW_CAMERA; p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; p_d = p_mesh->p_vertex_diff; p_dm = p_mesh->p_vertex_diff_material; p_obb = p_mesh->p_obb_world; pruhlednych = 0; for (o = 0; o < p_mesh->objektu; o++, p_obb++) { vn = p_mesh->objektnum[o]; in = obb_intersect_line_dist(p_obb, p_cam, &dir); if (in && intersect_mesh_objekt(p_mesh, o, p_cam, &dir)) { pruhlednych++; for (v = 0; v < vn; v++, p_d++, p_dm++) { if (p_d->a > PRUHL_ALFA) p_d->a = PRUHL_ALFA; } } else { for (v = 0; v < vn; v++, p_d++, p_dm++) { p_d->a = p_dm->a; } } } if (!pruhlednych) { // Zrus pruhlednost - neni pruhledny zadny p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; } } else { p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; if (p_mesh->p_data->m1flag & MAT_PRUHLEDNY || p_mesh->p_data->m2flag & MAT2_MASKA) { ber_reset_mesh(p_mesh->p_vertex_diff, p_mesh->p_vertex_diff_material, p_mesh->vertexnum); p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; } } } void ber_kamera_zpruhledni_poly(EDIT_MESH_POLY * p_poly, BOD * p_cam, BOD * p_stred) { TEXT_KOORD *p_koord; BOD dir; int v, in, pl; vektor_sub(p_stred, p_cam, &dir); in = obb_intersect_line_dist(&p_poly->obb, p_cam, &dir); pl = intersect_poly(p_poly, p_cam, &dir); if (in && pl) { p_poly->kflag |= (KONT_UPLOAD | KONT_DRAW_CAMERA); p_koord = p_poly->p_koord; for (v = 0; v < p_poly->facenum; v++, p_koord++) { if (p_koord->da > PRUHL_ALFA) p_koord->da = PRUHL_ALFA; } } else { p_poly->kflag &= ~KONT_DRAW_CAMERA; if (p_poly->m1flag & MAT_PRUHLEDNY || p_poly->m2flag & MAT2_MASKA) { ber_reset_poly(p_poly->p_koord, p_poly->facenum); p_poly->k2flag |= KONT_UPLOAD; } } } /* viditelny objekt/poly pokud je kamera do nej kamera zariznuta pokud je na primce stred kamery/stred levelu */ void ber_kamera_zpruhledni_objekty(G_KONFIG * p_ber) { EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; GLMATRIX *p_inv = p_ber->p_invcam; int mh; static BOD lt(FLT_MAX, FLT_MAX, FLT_MAX); BOD t, p; int pohyb_kamery = p_ber->kamera.zmena || p_ber->kamera.zmena_last; if (!p_ber->conf_zpruhlednovac) return; mh = gl_Get_Active_Beetle_Mesh(); if (mh == K_CHYBA) return; t.x = p_ber->p_prv_lev[mh]->x; t.y = p_ber->p_prv_lev[mh]->y; t.z = p_ber->p_prv_lev[mh]->z; if (lt.x != t.x || lt.y != t.y || lt.z != t.z) { lt.x = t.x; lt.y = t.y; lt.z = t.z; pohyb_kamery = TRUE; } p.x = p_inv->_41; p.y = p_inv->_42; p.z = p_inv->_43; /* Projedu seznam viditelnych meshu */ ber_mesh_render_list_reset(p_ber); while ((p_mesh = ber_mesh_render_list_next_flag(p_ber, KONT_VIDITELNY, KONT_PRVEK))) { if (p_mesh->p_vertex_diff && (pohyb_kamery || p_mesh->p_data->kflag & KONT_POHYB)) ber_kamera_zpruhledni_mesh(p_mesh, &p, &t); } /* Projedu seznam viditelnych poly */ if (pohyb_kamery) { ber_poly_render_list_reset(p_ber); while ((p_poly = ber_poly_render_list_next_flag(p_ber, KONT_VIDITELNY, KONT_PRVEK))) { ber_kamera_zpruhledni_poly(p_poly, &p, &t); } } } void ber_kamera_zpruhledni_objekty_reset(G_KONFIG * p_ber) { EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; int i, kflag; for (i = 0; i < p_ber->meshnum; i++) { p_mesh = p_ber->p_mesh[i]; if (p_mesh && !(p_mesh->p_data->kflag & KONT_PRVEK)) { if ((p_mesh->p_data->m1flag & MAT_PRUHLEDNY || p_mesh->p_data->m2flag & MAT2_MASKA) && p_mesh->p_vertex_diff) { ber_reset_mesh(p_mesh->p_vertex_diff, p_mesh->p_vertex_diff_material, p_mesh->vertexnum); p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; } p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; } } p_poly = p_ber->p_poly; for (i = 0; i < p_ber->polynum; i++) { kflag = p_poly->kflag; if (!(kflag & KONT_PRVEK) && (kflag & KONT_DRAW_CAMERA)) { if (p_poly->m1flag & MAT_PRUHLEDNY || p_poly->m2flag & MAT2_MASKA) { ber_reset_poly(p_poly->p_koord, p_poly->facenum); p_poly->kflag |= KONT_UPLOAD; } p_poly->kflag &= ~KONT_DRAW_CAMERA; } p_poly++; } } int ber_kamera_korekce_vzdalenosti(G_KONFIG * p_ber, int korekce, int korekce_vzdal) { NASTAVENI_KAMER *p_kam = &p_ber->kam; BOD p, pos; GLMATRIX *p_cam = p_ber->p_camera, *p_invcam = p_ber->p_invcam; float t; calc_camera_bod(p_cam, p_invcam, p_ber->p_target, *p_ber->p_vzdal, *p_ber->p_fi, *p_ber->p_rfi); p_ber->kamera.zmena = TRUE; /* bez korekce - nic nedelej, prdime na to */ if (!korekce) { *p_ber->p_vzdal_kor = *p_ber->p_vzdal; set_matrix_camera(p_cam); set_matrix_camera_project(p_ber->p_project); return (FALSE); } else { /* je kamera v orezavaci kostce || je uplne mimo - kaslu na to */ if (kd_je_bod_v_kostce((BOD *) & (p_invcam->_41), &p_kam->min, &p_kam->max) || !kd_je_bod_v_kostce(p_ber->p_target, &p_kam->min, &p_kam->max)) { if (p_ber->kam.min_vzdal > *p_ber->p_vzdal) { *p_ber->p_vzdal_kor = p_ber->kam.min_vzdal; calc_camera_bod(p_cam, p_invcam, p_ber->p_target, *p_ber->p_vzdal_kor, *p_ber->p_fi, *p_ber->p_rfi); } else { *p_ber->p_vzdal_kor = *p_ber->p_vzdal; } set_matrix_camera(p_cam); set_matrix_camera_project(p_ber->p_project); return (TRUE); } else { /* kamera ma target v kostce a je mimo kostku - provedu korekci */ polar2kar(*p_ber->p_rfi, *p_ber->p_fi, *p_ber->p_vzdal, &pos); pos.x += p_ber->p_target->x; pos.y += p_ber->p_target->y; pos.z += p_ber->p_target->z; kd_intersect_kostku_bod_inter(p_ber->p_target, &pos, &p_kam->min, &p_kam->max, &p, &t); t = vzdal_bodu_bod(p_ber->p_target, &p) + p_ber->kam.near_plane; // vyberu ten blizsi bod *p_ber->p_vzdal_kor = (t > *p_ber->p_vzdal) ? *p_ber->p_vzdal : t; // pokud je to bliz nez povolena vzdalenost if (p_ber->kam.min_vzdal > *p_ber->p_vzdal_kor) *p_ber->p_vzdal_kor = p_ber->kam.min_vzdal; if (korekce_vzdal) { *p_ber->p_vzdal = *p_ber->p_vzdal_kor; } calc_camera_bod(p_cam, p_invcam, p_ber->p_target, *p_ber->p_vzdal_kor, *p_ber->p_fi, *p_ber->p_rfi); set_matrix_camera(p_cam); set_matrix_camera_project(p_ber->p_project); return (TRUE); } } } // kartezske souradnice -> polarni souradnice // prepocita kameru z jednoho modu do druheho inline void kam_set_mod(int mod) { BOD p; // Behem animace se neda nahazovat mod kamery if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE) return; // mod uz je nahozenej if (mod == (p_ber->kamera.aktivni & 0x3)) return; // 3ds->polarni if (p_ber->kamera.aktivni & GAME_KAMERA_3DS) { p_ber->kamera.aktivni &= (~0x3); p_ber->kamera.aktivni |= GAME_KAMERA_POLAR; p.x = p_ber->kamera.p.x - p_ber->kamera.t.x; p.y = p_ber->kamera.p.y - p_ber->kamera.t.y; p.z = p_ber->kamera.p.z - p_ber->kamera.t.z; kar2polar(&p, &p_ber->kamera.r, &p_ber->kamera.fi, &p_ber->kamera.vzdal); } else { // polarni->3ds p_ber->kamera.aktivni &= (~0x3); p_ber->kamera.aktivni |= GAME_KAMERA_3DS; p_ber->kamera.r = normalizuj_uhel(p_ber->kamera.r); polar2kar(p_ber->kamera.r, p_ber->kamera.fi, p_ber->kamera.vzdal, &p_ber->kamera.p); p_ber->kamera.p.x += p_ber->kamera.t.x; p_ber->kamera.p.y += p_ber->kamera.t.y; p_ber->kamera.p.z += p_ber->kamera.t.z; } } void kam_set_mod_param(int mod) { kam_set_mod(mod); } void kam_set_mod_3ds(void) { kam_set_mod(GAME_KAMERA_3DS); } void kam_set_mod_polar(void) { kam_set_mod(GAME_KAMERA_POLAR); } int kam_get_mod(void) { return (p_ber->kamera.aktivni & 0x3); } /* Nastavi kameru */ int kam_pol_set(BOD * p_p, float r, float fi, float vzdal, int korekce) { if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE && (*p_ber->p_mod) & GAME_KAMERA_3DS) return (K_CHYBA); if ((*p_ber->p_mod) & GAME_KAMERA_3DS) kam_set_mod(GAME_KAMERA_POLAR); *p_ber->p_target = *p_p; *p_ber->p_rfi = DEG2RAD(r); *p_ber->p_fi = DEG2RAD(fi); *p_ber->p_vzdal = vzdal; ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, FALSE); p_ber->kamera.zmena = TRUE; return (TRUE); } /* Pricte vlozene hodnoty ke stavajicim */ int kam_pol_add(BOD * p_p, float r, float fi, float vzdal, int korekce) { if ((*p_ber->p_mod) & GAME_KAMERA_3DS) kam_set_mod(GAME_KAMERA_POLAR); p_ber->p_target->x += p_p->x; p_ber->p_target->y += p_p->y; p_ber->p_target->z += p_p->z; *p_ber->p_rfi += DEG2RAD(r); *p_ber->p_fi += DEG2RAD(fi); *p_ber->p_vzdal += vzdal; ber_kamera_korekce_vzdalenosti(p_ber, korekce, FALSE); p_ber->kamera.zmena = TRUE; return (TRUE); } /* Cte nastaveni kamery */ int kam_pol_get(BOD * p_p, float *p_r, float *p_fi, float *p_vzdal) { if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE && (*p_ber->p_mod) & GAME_KAMERA_3DS) return (K_CHYBA); if ((*p_ber->p_mod) & GAME_KAMERA_3DS) kam_set_mod(GAME_KAMERA_POLAR); *p_p = *p_ber->p_target; *p_r = RAD2DEG(*p_ber->p_rfi); *p_fi = RAD2DEG(*p_ber->p_fi); *p_vzdal = *p_ber->p_vzdal_kor; return (TRUE); } /* Cte aktualni smer pozici kamery */ void kam_get_float(float *p_body) { p_body[0] = p_ber->p_invcam->_13; // vektor Z p_body[1] = p_ber->p_invcam->_23; p_body[2] = p_ber->p_invcam->_33; p_body[3] = p_ber->p_invcam->_12; // vektor Y p_body[4] = p_ber->p_invcam->_22; p_body[5] = p_ber->p_invcam->_32; } /* Cte pozici kamery + smery */ void kam_get_float_ext(float *p_dir, float *p_pos) { p_dir[0] = p_ber->p_invcam->_13; // vektor Z p_dir[1] = p_ber->p_invcam->_23; p_dir[2] = p_ber->p_invcam->_33; p_dir[3] = p_ber->p_invcam->_12; // vektor Y p_dir[4] = p_ber->p_invcam->_22; p_dir[5] = p_ber->p_invcam->_32; p_pos[0] = p_ber->p_invcam->_41; // Pozice kamery p_pos[1] = p_ber->p_invcam->_42; p_pos[2] = p_ber->p_invcam->_43; } /* Nastavi kameru */ int kam_3ds_set(BOD * p_pos, BOD * p_target, float roll) { if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE && (*p_ber->p_mod) & GAME_KAMERA_POLAR) return (K_CHYBA); if ((*p_ber->p_mod) & GAME_KAMERA_POLAR) kam_set_mod(GAME_KAMERA_3DS); // nastavi kameru calc_camera_3ds(p_ber->p_camera, p_ber->p_invcam, p_pos, p_target, roll); set_matrix_camera(p_ber->p_camera); set_matrix_camera_project(p_ber->p_project); p_ber->kamera.zmena = TRUE; // zapise *p_ber->p_target = *p_target; *p_ber->p_pos = *p_pos; *p_ber->p_roll = roll; return (TRUE); } /* Pricte kameru */ int kam_3ds_add(BOD * p_pos, BOD * p_target, float roll) { if ((*p_ber->p_mod) & GAME_KAMERA_POLAR) kam_set_mod(GAME_KAMERA_3DS); // zapise vektor_add(p_ber->p_target, p_target, p_ber->p_target); vektor_add(p_ber->p_pos, p_pos, p_ber->p_pos); *p_ber->p_roll += DEG2RAD(roll); calc_camera_3ds(p_ber->p_camera, p_ber->p_invcam, p_ber->p_pos, p_ber->p_target, *p_ber->p_roll); set_matrix_camera(p_ber->p_camera); set_matrix_camera_project(p_ber->p_project); p_ber->kamera.zmena = TRUE; return (TRUE); } /* Nacte kameru 3ds */ int kam_3ds_get(BOD * p_pos, BOD * p_target, float *p_roll) { if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE && (*p_ber->p_mod) & GAME_KAMERA_POLAR) return (K_CHYBA); if ((*p_ber->p_mod) & GAME_KAMERA_POLAR) kam_set_mod(GAME_KAMERA_3DS); *p_pos = *p_ber->p_pos; *p_target = *p_ber->p_target; *p_roll = *p_ber->p_roll; return (TRUE); } /******************************************** Polarni animace ******************************************** */ AnimHandle kam_pol_vyrob_animaci(int framenum, int pos_keys, int rot_keys, int vzdal_keys, int korekce) { int kam; int i; for (i = 0; i < p_ber->kamnum; i++) { if (!p_ber->kamery[i].flag) { kam = i; goto naslo_se_to2; } } if (p_ber->kamnum >= KAM_MAX_ANIM) { return (K_CHYBA); } else kam = p_ber->kamnum++; naslo_se_to2:; key_kamera_vyrob_indir(p_ber->kamery + kam, pos_keys, 0, vzdal_keys, 0, rot_keys); p_ber->kamery[kam].flag = (korekce) ? GAME_KAMERA_KOREKCE | GAME_KAMERA_POLAR : GAME_KAMERA_POLAR; p_ber->kamery[kam].endtime = calc_endtime(framenum); return (kam); } AnimHandle kam_pol_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->pos_keys) return (K_CHYBA); p_kam->p_pos[klic].x = x; p_kam->p_pos[klic].y = y; p_kam->p_pos[klic].z = z; p_kam->p_pkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle kam_pol_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD * p_p, int frame) { if (handle >= p_ber->kamnum || klic >= p_ber->kamery[handle].pos_keys) return (K_CHYBA); p_ber->kamery[handle].p_pos[klic] = *p_p; p_ber->kamery[handle].p_pkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle kam_pol_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->pos_keys) return (K_CHYBA); p_kam->p_pkeys[klic].tension = tension; p_kam->p_pkeys[klic].continuity = continuity; p_kam->p_pkeys[klic].bias = bias; return (handle); } AnimHandle kam_pol_vloz_klic_rotace(AnimHandle handle, int klic, float r, float fi, int frame) { if (handle >= p_ber->kamnum || klic >= p_ber->kamery[handle].quat_keys) return (K_CHYBA); kam_angle_to_quat(DEG2RAD(r), DEG2RAD(fi), p_ber->kamery[handle].p_quat + klic); p_ber->kamery[handle].p_qkeys[klic].time = frame * SIM_KONSTI; return (handle); } AnimHandle kam_pol_vloz_klic_rotace_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { if (handle >= p_ber->kamnum || klic >= p_ber->kamery[handle].quat_keys) return (K_CHYBA); p_ber->kamery[handle].p_qkeys[klic].bias = bias; p_ber->kamery[handle].p_qkeys[klic].continuity = continuity; p_ber->kamery[handle].p_qkeys[klic].tension = tension; return (handle); } AnimHandle kam_pol_vloz_klic_vzdal(AnimHandle handle, int klic, float vzdal, int frame, float tension, float continuity, float bias) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->roll_keys) return (K_CHYBA); p_kam->p_roll[klic] = vzdal; p_kam->p_rlkeys[klic].time = frame * SIM_KONSTI; p_kam->p_rlkeys[klic].tension = tension; p_kam->p_rlkeys[klic].bias = bias; p_kam->p_rlkeys[klic].continuity = continuity; return (handle); } AnimHandle kam_pol_vloz_klic_all(AnimHandle handle, int klic, BOD * p_p, float r, float fi, float vzdal, int frame, float tension) { KAMERA_TRACK_INFO *p_trk; int time = frame * SIM_KONSTI; p_trk = p_ber->kamery + handle; if (handle >= p_ber->kamnum) return (K_CHYBA); p_trk->p_pos[klic] = *p_p; p_trk->p_pkeys[klic].time = time; p_trk->p_pkeys[klic].tension = tension; kam_angle_to_quat(DEG2RAD(r), DEG2RAD(fi), p_trk->p_quat + klic); p_trk->p_qkeys[klic].time = time; p_trk->p_qkeys[klic].tension = tension; p_trk->p_roll[klic] = vzdal; p_trk->p_rlkeys[klic].time = time; p_trk->p_rlkeys[klic].tension = tension; return (handle); } AnimHandle kam_zrus_animaci(AnimHandle handle) { if (handle >= p_ber->kamnum) return (K_CHYBA); key_kamera_zrus_indir(p_ber->kamery + handle); memset(p_ber->kamery + handle, 0, sizeof(p_ber->kamery[0])); return (handle); } /******************************************** 3ds animace ******************************************** */ AnimHandle kam_3ds_vyrob_animaci(int framenum, int pos_keys, int target_keys, int roll_keys, int fov_keys) { int kam; int i; for (i = 0; i < p_ber->kamnum; i++) { if (!p_ber->kamery[i].flag) { kam = i; goto naslo_se_to2; } } if (p_ber->kamnum >= KAM_MAX_ANIM) { return (K_CHYBA); } else kam = p_ber->kamnum++; naslo_se_to2:; key_kamera_vyrob_indir(p_ber->kamery + kam, pos_keys, target_keys, roll_keys, fov_keys, 0); p_ber->kamery[kam].flag = GAME_KAMERA_3DS; p_ber->kamery[kam].endtime = calc_endtime(framenum); return (kam); } /* Load animace */ AnimHandle kam_3ds_nahraj_animaci(char *p_dir, char *p_jmeno) { char jmeno_kam[200]; int kam; int i; for (i = 0; i < p_ber->kamnum; i++) { if (!p_ber->kamery[i].flag) { kam = i; goto naslo_se_to2; } } if (p_ber->kamnum >= KAM_MAX_ANIM) { return (K_CHYBA); } else kam = p_ber->kamnum++; naslo_se_to2:; if (!key_kamera_nahraj(p_ber->kamery + kam, jmeno_kam, p_ber->kamery[kam].jmeno, p_dir, p_jmeno, GAME_DATA_DIR)) return (K_CHYBA); p_ber->kamery[kam].flag = GAME_KAMERA_3DS; return (kam); } /* Position-key */ AnimHandle kam_3ds_vloz_klic_posun(AnimHandle handle, int klic, float x, float y, float z, int frame) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->pos_keys) return (K_CHYBA); p_kam->p_pos[klic].x = x; p_kam->p_pos[klic].y = y; p_kam->p_pos[klic].z = z; p_kam->p_pkeys[klic].time = frame; return (handle); } AnimHandle kam_3ds_vloz_klic_posun_bod(AnimHandle handle, int klic, BOD * p_p, int frame) { if (handle >= p_ber->kamnum || klic >= p_ber->kamery[handle].pos_keys) return (K_CHYBA); p_ber->kamery[handle].p_pos[klic] = *p_p; p_ber->kamery[handle].p_pkeys[klic].time = frame; return (handle); } AnimHandle kam_3ds_vloz_klic_posun_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->pos_keys) return (K_CHYBA); p_kam->p_pkeys[klic].tension = tension; p_kam->p_pkeys[klic].continuity = continuity; p_kam->p_pkeys[klic].bias = bias; return (handle); } /* Target-key */ AnimHandle kam_3ds_vloz_klic_target(AnimHandle handle, int klic, float x, float y, float z, int frame) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->trg_keys) return (K_CHYBA); p_kam->p_trg[klic].x = x; p_kam->p_trg[klic].y = y; p_kam->p_trg[klic].z = z; p_kam->p_tkeys[klic].time = frame; return (handle); } AnimHandle kam_3ds_vloz_klic_target_bod(AnimHandle handle, int klic, BOD * p_target, int frame) { if (handle >= p_ber->kamnum || klic >= p_ber->kamery[handle].trg_keys) return (K_CHYBA); p_ber->kamery[handle].p_trg[klic] = *p_target; p_ber->kamery[handle].p_tkeys[klic].time = frame; return (handle); } AnimHandle kam_3ds_vloz_klic_target_parametry(AnimHandle handle, int klic, float tension, float continuity, float bias) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->trg_keys) return (K_CHYBA); p_kam->p_tkeys[klic].bias = bias; p_kam->p_tkeys[klic].tension = tension; p_kam->p_tkeys[klic].continuity = continuity; return (handle); } /* Roll-keys */ AnimHandle kam_3ds_vloz_klic_roll(AnimHandle handle, int klic, float roll, int frame, float tension, float continuity, float bias) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->roll_keys) return (K_CHYBA); p_kam->p_roll[klic] = roll; p_kam->p_rlkeys[klic].time = frame * SIM_KONSTI; p_kam->p_rlkeys[klic].bias = bias; p_kam->p_rlkeys[klic].tension = tension; p_kam->p_rlkeys[klic].continuity = continuity; return (handle); } /* Fov-keys */ AnimHandle kam_3ds_vloz_klic_fov(AnimHandle handle, int klic, float fov, int frame, float tension, float continuity, float bias) { KAMERA_TRACK_INFO *p_kam; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->fov_keys) return (K_CHYBA); p_kam->p_fov[klic] = fov; p_kam->p_fkeys[klic].time = frame * SIM_KONSTI; p_kam->p_fkeys[klic].bias = bias; p_kam->p_fkeys[klic].tension = tension; p_kam->p_fkeys[klic].continuity = continuity; return (handle); } /* Vlozit vsechny klice */ AnimHandle kam_3ds_vloz_klic_all(AnimHandle handle, int klic, BOD * p_p, BOD * p_t, float roll, int frame, float tension) { KAMERA_TRACK_INFO *p_kam; int time = frame * SIM_KONSTI; p_kam = p_ber->kamery + handle; if (handle >= p_ber->kamnum || klic >= p_kam->pos_keys || klic >= p_kam->trg_keys || klic >= p_kam->roll_keys) return (K_CHYBA); p_kam->p_pkeys[klic].time = time; p_kam->p_pkeys[klic].tension = tension; p_kam->p_pos[klic] = *p_p; p_kam->p_tkeys[klic].time = time; p_kam->p_tkeys[klic].tension = tension; p_kam->p_trg[klic] = *p_t; p_kam->p_rlkeys[klic].time = time; p_kam->p_rlkeys[klic].tension = tension; p_kam->p_roll[klic] = roll; return (handle); } /******************************************** Vsechny animace - Animacni stroj ******************************************** */ //start/stop animace RunHandle kam_start(AnimHandle a_handle, int *p_flag, int flag, int start, int stop) { if (p_ber->kamery[a_handle].endtime) { p_ber->kamera.p_anim = p_ber->kamery + a_handle; p_ber->kamera.aktivni = p_ber->kamery[a_handle].flag | GAME_KAMERA_ANIMACE; p_ber->kamera.p_flag = p_flag; p_ber->kamera.flag = flag; p_ber->kamera.a_handle = a_handle; *p_flag = 0; calc_time_end(p_ber->kamera.p_anim->endtime, p_ber->TimeEndLastFrame, start, stop, (dword *) & p_ber->kamera.start, (dword *) & p_ber->kamera.stop, (dword *) & p_ber->kamera.time_start, (dword *) & p_ber->kamera.time_stop, (dword *) & p_ber->kamera.time_delka); } else { // No animation is needed; reset the camera. kam_zrus_animaci(p_ber->kamera.a_handle); p_ber->kamnum = 0; } return (TRUE); } void kam_stop(void) { if (p_ber->kamera.aktivni & GAME_KAMERA_ANIMACE) { if (p_ber->kamera.flag & GK_REMOVE) { kam_zrus_animaci(p_ber->kamera.a_handle); p_ber->kamnum = 0; } p_ber->kamera.aktivni &= ~GAME_KAMERA_ANIMACE; p_ber->kamera.p_anim = NULL; p_ber->kamera.a_handle = K_CHYBA; } } void kani_updatuj(G_KONFIG * p_ber) { KAMERA_TRACK_INFO *p_track; GAME_KAMERA *p_kam; int konec, loop, zrusit = FALSE; int next_time = p_ber->TimeEndLastFrame; QUAT q(1.0f, 0.0f, 0.0f, 0.0f); p_kam = &p_ber->kamera; p_track = p_ber->kamera.p_anim; loop = p_kam->flag & GK_LOOP; if ((konec = (next_time > p_kam->time_stop))) { if (loop) { calc_time_loop(next_time, p_kam->start, (dword *) & p_kam->time_start, (dword *) & p_kam->time_stop, (dword *) & p_kam->time_delka, (dword *) & p_kam->time); if (p_kam->p_flag) *(p_kam->p_flag) = 0; konec = 0; } else { p_kam->time = p_kam->time_delka; zrusit = (p_kam->flag & GK_REMOVE); if (p_kam->p_flag) *(p_kam->p_flag) = K_CHYBA; } } else { p_kam->time = calc_time_akt(next_time, p_kam->time_start); if (p_kam->p_flag) *(p_kam->p_flag) = ftoi((p_kam->time / (float) p_kam->time_delka) * 100.0f); } if (p_kam->aktivni & GAME_KAMERA_3DS) { if (p_track->pos_keys) key_track_interpolace_bod(&p_kam->p, p_track->p_pos, p_track->p_pkeys, p_kam->time, p_track->endtime, p_track->pos_keys, loop); if (p_track->trg_keys) key_track_interpolace_bod(&p_kam->t, p_track->p_trg, p_track->p_tkeys, p_kam->time, p_track->endtime, p_track->trg_keys, loop); if (p_track->roll_keys) key_track_interpolace_float(&p_kam->roll, p_track->p_roll, p_track->p_rlkeys, p_kam->time, p_track->endtime, p_track->roll_keys, loop); calc_camera_3ds(p_ber->p_camera, p_ber->p_invcam, &p_kam->p, &p_kam->t, p_kam->roll); set_matrix_camera(p_ber->p_camera); set_matrix_camera_project(p_ber->p_project); p_ber->kamera.zmena = TRUE; } else { if (p_track->pos_keys) key_track_interpolace_bod(&p_kam->t, p_track->p_pos, p_track->p_pkeys, p_kam->time, p_track->endtime, p_track->pos_keys, loop); if (p_track->quat_keys) key_track_interpolace_quat(&q, p_track->p_quat, p_track->p_qkeys, p_kam->time, p_track->endtime, p_track->quat_keys, loop); if (p_track->roll_keys) key_track_interpolace_float(&p_kam->vzdal, p_track->p_roll, p_track->p_rlkeys, p_kam->time, p_track->endtime, p_track->roll_keys, loop); calc_camera_polar(p_ber->p_camera, p_ber->p_invcam, &p_kam->t, &q, p_kam->vzdal); quat_to_euler(&q, &p_kam->r, &p_kam->fi); ber_kamera_korekce_vzdalenosti(p_ber, p_ber->kam_omezeni, FALSE); p_ber->kamera.zmena = TRUE; } // Zrus animaci if (zrusit) kam_stop(); } /* Animace polarni */ RunHandle kam_pol_anim(BOD * p_p, float r, float fi, float vzdal, int *p_flag, int flag, int framenum, float tension) { GAME_KAMERA *p_kam = &p_ber->kamera; AnimHandle ah; kam_stop(); kam_set_mod(GAME_KAMERA_POLAR); ah = kam_pol_vyrob_animaci(framenum, 2, 2, 2, TRUE); kam_pol_vloz_klic_all(ah, 0, &p_kam->t, RAD2DEG(p_kam->r), RAD2DEG(p_kam->fi), p_kam->vzdal, 0, tension); kam_pol_vloz_klic_all(ah, 1, p_p, r, fi, vzdal, framenum - 1, tension); kam_start(ah, p_flag, flag | GK_REMOVE, 0, 0); return (0); } /* Animace polarni add */ RunHandle kam_pol_anim_add(BOD * p_p, float r, float fi, float vzdal, int *p_flag, int flag, int framenum, float tension) { GAME_KAMERA *p_kam = &p_ber->kamera; AnimHandle ah; BOD pp; kam_stop(); kam_set_mod(GAME_KAMERA_POLAR); ah = kam_pol_vyrob_animaci(framenum, 2, 2, 2, TRUE); kam_pol_vloz_klic_all(ah, 0, &p_kam->t, RAD2DEG(p_kam->r), RAD2DEG(p_kam->fi), p_kam->vzdal, 0, tension); kam_pol_vloz_klic_all(ah, 1, vektor_add(&p_kam->t, p_p, &pp), RAD2DEG(p_kam->r) + r, RAD2DEG(p_kam->fi) + fi, p_kam->vzdal + vzdal, framenum - 1, tension); kam_start(ah, p_flag, flag | GK_REMOVE, 0, 0); return (0); } /* Animace 3ds */ RunHandle kam_3ds_anim(BOD * p_p, BOD * p_t, float roll, int *p_flag, int flag, int framenum, float tension) { GAME_KAMERA *p_kam = &p_ber->kamera; AnimHandle ah; kam_stop(); kam_set_mod(GAME_KAMERA_3DS); ah = kam_3ds_vyrob_animaci(framenum, 2, 2, 2, 0); kam_3ds_vloz_klic_all(ah, 0, &p_kam->p, &p_kam->t, p_kam->roll, 0, tension); kam_3ds_vloz_klic_all(ah, 1, p_p, p_t, DEG2RAD(roll), framenum - 1, tension); kam_start(ah, p_flag, flag | GK_REMOVE, 0, 0); return (0); } /* Animace 3ds add */ RunHandle kam_3ds_anim_add(BOD * p_p, BOD * p_t, float roll, int *p_flag, int flag, int framenum, float tension) { GAME_KAMERA *p_kam = &p_ber->kamera; AnimHandle ah; BOD p, t; kam_stop(); kam_set_mod(GAME_KAMERA_3DS); ah = kam_3ds_vyrob_animaci(framenum, 2, 2, 2, 0); kam_3ds_vloz_klic_all(ah, 0, &p_kam->p, &p_kam->t, p_kam->roll, 0, tension); kam_3ds_vloz_klic_all(ah, 1, vektor_add(&p_kam->p, p_p, &p), vektor_add(&p_kam->t, p_t, &t), p_kam->roll + DEG2RAD(roll), framenum - 1, tension); kam_start(ah, p_flag, flag | GK_REMOVE, 0, 0); return (0); } static BOD __last_kam_bod; static void kam_privaz_kameru_updatuj(size_ptr a_handle) { GK_ANIM *p_gk = (GK_ANIM *) a_handle; BOD vysl; vektor_sub(&p_gk->p, &__last_kam_bod, &vysl); __last_kam_bod = p_gk->p; kam_pol_add(&vysl, 0, 0, 0, TRUE); } static void kam_privaz_kameru_start(size_ptr a_handle) { __last_kam_bod.x = __last_kam_bod.y = __last_kam_bod.z = 0.0f; } // Privaze target-point kamery na std. animaci MatrixHandle rani_privaz_kameru(RunHandle a_handle) { GK_ANIM *p_gk = (GK_ANIM *) a_handle; GKA_MATICE *p_mat; MatrixHandle matice; if (p_gk->matic < MAX_ANIM_MATIC) { matice = p_gk->matic++; p_mat = p_gk->p_mat + matice; p_mat->p_mat = NULL; p_mat->p_notify = NULL; p_mat->flagy = MESH_KAMERA; p_mat->fce_param = a_handle; p_mat->funkce_start = kam_privaz_kameru_start; p_mat->funkce_frame = kam_privaz_kameru_updatuj; p_mat->funkce_end = kam_privaz_kameru_updatuj; return (matice); } else return (K_CHYBA); } int kam_3ds_cti_klic(AnimHandle handle, float time, BOD * p_p, BOD * p_t, float *p_roll) { KAMERA_TRACK_INFO *p_track; int loop; int dtime; if (handle >= p_ber->kamnum) return (K_CHYBA); p_track = p_ber->kamery + handle; if (!p_track || p_track->flag & GAME_KAMERA_POLAR) return (K_CHYBA); loop = p_track->flag & GK_LOOP; if (time > 1.0f) time = 1.0f; else if (time < 0.0f) time = 0.0f; dtime = ftoi(time * p_track->endtime); if (p_track->pos_keys) { key_track_interpolace_bod(p_p, p_track->p_pos, p_track->p_pkeys, dtime, p_track->endtime, p_track->pos_keys, loop); } if (p_track->trg_keys) { key_track_interpolace_bod(p_t, p_track->p_trg, p_track->p_tkeys, dtime, p_track->endtime, p_track->trg_keys, loop); } if (p_track->roll_keys) { key_track_interpolace_float(p_roll, p_track->p_roll, p_track->p_rlkeys, dtime, p_track->endtime, p_track->roll_keys, loop); } else { *p_roll = 0.0f; } return (TRUE); } int kam_pol_cti_klic(AnimHandle handle, float time, BOD * p_t, float *p_r, float *p_fi, float *p_vzdal) { KAMERA_TRACK_INFO *p_track; int loop, dtime; QUAT q(1, 0, 0, 0); if (handle >= p_ber->kamnum) return (K_CHYBA); p_track = p_ber->kamery + handle; if (!p_track || p_track->flag & GAME_KAMERA_3DS) return (K_CHYBA); loop = p_track->flag & GK_LOOP; if (time > 1.0f) time = 1.0f; else if (time < 0.0f) time = 0.0f; dtime = ftoi(time * p_track->endtime); if (p_track->pos_keys) { key_track_interpolace_bod(p_t, p_track->p_pos, p_track->p_pkeys, dtime, p_track->endtime, p_track->pos_keys, loop); } else { p_t->set(0.0f); } if (p_track->quat_keys) { key_track_interpolace_quat(&q, p_track->p_quat, p_track->p_qkeys, dtime, p_track->endtime, p_track->quat_keys, loop); } if (p_track->roll_keys) { key_track_interpolace_float(p_vzdal, p_track->p_roll, p_track->p_rlkeys, dtime, p_track->endtime, p_track->roll_keys, loop); } else { *p_vzdal = 0; } quat_to_euler(&q, p_r, p_fi); return (TRUE); } void ber_zpruhledni_prvky_reset(G_KONFIG * p_ber) { EDIT_MESH_POLY *p_poly; GAME_MESH_OLD *p_mesh; int i; for (i = 0; i < p_ber->meshnum; i++) { p_mesh = p_ber->p_mesh[i]; if (p_mesh) { if (p_mesh->p_data->kflag & KONT_PRVEK && (p_mesh->p_data->m1flag & MAT_PRUHLEDNY || p_mesh->p_data->m2flag & MAT2_MASKA) && p_mesh->p_vertex_diff) { ber_reset_mesh(p_mesh->p_vertex_diff, p_mesh->p_vertex_diff_material, p_mesh->vertexnum); p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; } p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; } } p_poly = p_ber->p_poly; for (i = 0; i < p_ber->polynum; i++) { if (p_poly->kflag & (KONT_DRAW_CAMERA | KONT_PRVEK)) { if (p_poly->m1flag & MAT_PRUHLEDNY || p_poly->m2flag & MAT2_MASKA) { ber_reset_poly(p_poly->p_koord, p_poly->facenum); p_poly->kflag |= KONT_UPLOAD; } p_poly->kflag &= ~KONT_DRAW_CAMERA; } p_poly++; } } void ber_zpruhledni_prvky(G_KONFIG * p_ber) { EDIT_MESH_POLY *p_poly; TEXT_KOORD *p_koord; GLMATRIX *p_m = NULL; float ra, radius = p_ber->conf_pruhledna_kamera_radius; float vzdal, alfa; static BOD lt(FLT_MAX, FLT_MAX, FLT_MAX); GAME_MESH_OLD *p_mesh, *p_beruska; BOD t, p, i, *p_vrt, vr; BODRGBA *p_d; BODRGBA *p_dm; int mh, o, vs, vn; int v, key; word *p_objektstart; word *p_objektnum; BODRGBA *p_vertex_diff; BODRGBA *p_vertex_diff_material; BOD *p_vertex_pos; OBB_OLD *p_obb; int kamera_zmena = p_ber->kamera.zmena || p_ber->kamera.zmena_last; if (!p_ber->conf_pruhledna_kamera) return; mh = gl_Get_Active_Beetle_Mesh(); if (mh == K_CHYBA) return; t.x = p_ber->p_prv_lev[mh]->x; t.y = p_ber->p_prv_lev[mh]->y; t.z = p_ber->p_prv_lev[mh]->z; if (!kamera_zmena && lt.x == t.x && lt.y == t.y && lt.z == t.z) { return; } else { lt.x = t.x; lt.y = t.y; lt.z = t.z; } p_beruska = p_ber->p_mesh[p_ber->p_prv_lev[mh]->mesh]; p.x = p_ber->p_invcam->_41; p.y = p_ber->p_invcam->_42; p.z = p_ber->p_invcam->_43; //t - pozice berusky ber_mesh_render_list_reset(p_ber); while ((p_mesh = ber_mesh_render_list_next_flag(p_ber, KONT_VIDITELNY | KONT_PRVEK, FALSE))) { if (p_beruska == p_mesh) { p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; } else { BOD *p_str = &p_mesh->obb_world.obb_stred; bod_primka_bod_bod(p_str, &p, &t, &i); if (!bod_mezi(&p, &t, &i)) { if ((p_mesh->p_data->m1flag & MAT_PRUHLEDNY || p_mesh->p_data->m2flag & MAT2_MASKA) && p_mesh->p_vertex_diff) { ber_reset_mesh(p_mesh->p_vertex_diff, p_mesh->p_vertex_diff_material, p_mesh->vertexnum); p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; } p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; } else { vzdal = obb_vzdal_bod_aabb(&p_mesh->obb_world, &i); if (vzdal > radius) { if ((p_mesh->p_data->m1flag & MAT_PRUHLEDNY || p_mesh->p_data->m2flag & MAT2_MASKA) && p_mesh->p_vertex_diff) { ber_reset_mesh(p_mesh->p_vertex_diff, p_mesh->p_vertex_diff_material, p_mesh->vertexnum); p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; } p_mesh->p_data->kflag &= ~KONT_DRAW_CAMERA; } else { if (p_mesh->p_vertex_diff) { p_mesh->p_data->kflag |= KONT_DRAW_CAMERA; p_mesh->p_data->k2flag |= KONT2_UPDATE_DIFF; key = p_mesh->p_data->kflag & KONT_KEYFRAME; p_objektstart = p_mesh->objektstart; p_objektnum = p_mesh->objektnum; p_vertex_diff = p_mesh->p_vertex_diff; p_vertex_diff_material = p_mesh->p_vertex_diff_material; p_vertex_pos = p_mesh->p_vertex_pos; if (!key) p_m = &p_mesh->m; p_obb = p_mesh->p_obb_world; for (o = 0; o < p_mesh->objektu; o++, p_obb++) { vs = *p_objektstart++; vn = *p_objektnum++; p_d = p_vertex_diff + vs; p_dm = p_vertex_diff_material + vs; bod_primka_bod_bod(&p_obb->obb_stred, &p, &t, &i); if (obb_vzdal_bod_aabb(p_obb, &i) < radius) { if (key) p_m = p_mesh->p_key + o; p_vrt = p_vertex_pos + vs; for (v = 0; v < vn; v++, p_d++, p_dm++, p_vrt++) { transformuj_bod_matici_bod(p_vrt, p_m, &vr); ra = vzdal_bodu_a_primky(&vr, &p, &t); if (ra < radius) { alfa = (ra / radius); if (p_d->a > alfa) p_d->a = alfa; } else { p_d->a = p_dm->a; } } } else { for (v = 0; v < vn; v++, p_d++, p_dm++) { p_d->a = p_dm->a; } } } } } } } } ber_poly_render_list_reset(p_ber); while ((p_poly = ber_poly_render_list_next_flag(p_ber, KONT_VIDITELNY | KONT_PRVEK, FALSE))) { bod_primka_bod_bod(&p_poly->obb.obb_stred, &p, &t, &i); if (!bod_mezi(&p, &t, &i)) { if (p_poly->m1flag & MAT_PRUHLEDNY || p_poly->m2flag & MAT2_MASKA) { ber_reset_poly(p_poly->p_koord, p_poly->facenum); p_poly->kflag |= KONT_UPLOAD; } p_poly->kflag &= ~KONT_DRAW_CAMERA; continue; } vzdal = obb_vzdal_bod_aabb(&p_poly->obb, &i); if (vzdal > radius) { if (p_poly->m1flag & MAT_PRUHLEDNY || p_poly->m2flag & MAT2_MASKA) { ber_reset_poly(p_poly->p_koord, p_poly->facenum); p_poly->kflag |= KONT_UPLOAD; } p_poly->kflag &= ~KONT_DRAW_CAMERA; continue; } p_koord = p_poly->p_koord; for (v = 0; v < p_poly->facenum; v++, p_koord++) { ra = vzdal_bodu_a_primky((BOD *) (&p_koord->x), &p, &t); if (ra < radius) { alfa = (ra / radius); if (p_koord->da > alfa) p_koord->da = alfa; } else { p_koord->da = p_koord->mda; } } p_poly->kflag |= (KONT_UPLOAD | KONT_DRAW_CAMERA); } } #define KINO_POMER (6.0f/12.0f) void kam_kino_set_clear(G_KONFIG * p_ber) { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); } void kam_game_set_clear(G_KONFIG * p_ber) { float b[4]; if (p_ber->conf_barva_pozadi_pouzit) { rgb_float(p_ber->conf_barva_pozadi, b); glClearColor(b[0], b[1], b[2], 1.0f); } } typedef enum _CAMERA_SCREEN { CAMERA_NORMAL, CAMERA_KINO, } CAMERA_SCREEN; CAMERA_SCREEN camera_screen_mode = CAMERA_NORMAL; void kam_set_kino_screen(G_KONFIG * p_ber) { int kxres = SCREEN_XRES; int kyres = ftoi(SCREEN_XRES * KINO_POMER); if (kyres > SCREEN_YRES) kyres = SCREEN_YRES; int kx = SCREEN_XSTART, ky = SCREEN_YSTART + (SCREEN_YRES - kyres) / 2; set_matrix_view(kx, ky, kxres, kyres); projection_matrix(&p_ber->kamera.project, p_ber->kam.fov, (float) kxres / (float) kyres, p_ber->kam.near_plane, p_ber->kam.far_plane); set_matrix_project(&p_ber->kamera.project); camera_screen_mode = CAMERA_KINO; } void kam_set_normal_screen(G_KONFIG * p_ber) { set_matrix_view(SCREEN_XSTART, SCREEN_YSTART, SCREEN_XRES, SCREEN_YRES); projection_matrix(&p_ber->kamera.project, p_ber->kam.fov, (float) SCREEN_XRES / (float) SCREEN_YRES, p_ber->kam.near_plane, p_ber->kam.far_plane); set_matrix_project(&p_ber->kamera.project); camera_screen_mode = CAMERA_NORMAL; } void kam_set_last(G_KONFIG * p_ber) { if(camera_screen_mode == CAMERA_NORMAL) kam_set_normal_screen(p_ber); else kam_set_kino_screen(p_ber); } berusky2-0.12/src/komat/Texture_import.cpp0000644000175000017500000000337713674426075015613 00000000000000/* Import textur */ #include "3d_all.h" static KFILE *file_load; /* Importni interface soubory pro textury DDS vraci pocet plan -> 3/4 */ /* int txt_dds_to_bmp(APAK_HANDLE * pHandle, char *p_file, void **p_return) { unsigned char *p_data; unsigned char *p_rd; AUX_RGBImageRec *p_rec; RBITMAP *p_bmp; byte *p_src,r; int width; int height; int planes; int lTotalWidth; int rowBytes; int x,y,dl; if((file_load = kopen(pHandle,p_file,"rb")) == NULL) { return(FALSE); } p_data = nvDXTdecompress(width, height, planes, lTotalWidth, rowBytes); assert(width == lTotalWidth); // prehodi r<->b for(y = 0; y < height; y ++ ) { for(x = 0; x < width; x++) { p_src = p_data+(y*width*planes)+x*planes; r = p_src[2]; p_src[2] = p_src[0]; p_src[0] = r; } } // prehodi radky dl = sizeof(byte)*width*planes; p_rd = (byte *)malloc(dl*height); for(y = 0; y < height; y++ ) { memcpy(p_rd+(height-y-1)*dl,p_data+y*dl,dl); } memcpy(p_data,p_rd,dl*height); if(planes == 3) { p_rec = (AUX_RGBImageRec *)malloc(sizeof(*p_rec)); assert(p_rec); p_rec->sizeX = width; p_rec->sizeY = height; p_rec->data = p_data; *p_return = p_rec; } else { p_bmp = (RBITMAP *)malloc(sizeof(*p_bmp)); assert(p_bmp); p_bmp->x = width; p_bmp->y = height; p_bmp->data = (DWORD *)p_data; *p_return = p_bmp; } free(p_rd); kclose(file_load); return(planes); *p_return = NULL; return (0); } */ void WriteDTXnFile(DWORD count, void *buffer) { } void ReadDTXnFile(DWORD count, void *buffer) { kread(buffer, sizeof(byte), count, file_load); } berusky2-0.12/src/generator/0000755000175000017500000000000013676433304012771 500000000000000berusky2-0.12/src/generator/generator_random.h0000644000175000017500000000634013674426075016420 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __GENERATOR_RANDOM_H__ #define __GENERATOR_RANDOM_H__ /* * Generator type */ typedef enum { GENERATOR_GAUSS = 0, GENERATOR_RAND = 1 } RANDOM_GENERATOR_TYPE; /* * Generator class */ typedef class random_generator { public: /* Random number generator range is 0...1 */ static float generator_rand(void); /* Random number generator range is -1...1 */ static float generator_rand_0(void); /* Gauss random number generator center is 0.5 range is +- 0.5 */ static float generator_gauss(void); /* Gauss random number generator center is 0.0 range is +- 1.0 */ static float generator_gauss_0(void); /* Gauss random number generator center (and maximum) is 1.0 range is 1.0 - 0.0 */ static float generator_gauss_1(void); /* * Generate scattering */ static float generate_scattering(RANDOM_GENERATOR_TYPE generator_type); } RANDOM_GENERATOR; /* * Random generator fractal */ typedef class random_generator_fractal : public random_generator { /* * Fractal generator params */ public: /* <0,1> 0 - maximax disertion 1 - minimal disertion */ float generator_hurst; public: float generator_delta; float generator_center; public: void generator_range_set(float min, float max) { generator_delta = max - min; generator_center = min + generator_delta/2; } void generator_center_set(float center, float delta) { generator_delta = delta; generator_center = center; } void generator_hurst_set(float hurst) { generator_hurst = hurst; } public: /* * Generate height */ float generate_height(int iteration); static float generate_height(int iteration, float hurst, float center, float delta); public: random_generator_fractal(void); } RANDOM_GENERATOR_FRACTAL; #endif // __GENERATOR_RANDOM_H__ berusky2-0.12/src/generator/generator_random.cpp0000644000175000017500000000667613674426075016767 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include "generator_random.h" /* Random number generator range is 0...1 */ float random_generator::generator_rand(void) { return((float)rand()/(float)RAND_MAX); } /* Random number generator center is 0.0 range is +- 1.0 */ float random_generator::generator_rand_0(void) { return(generator_rand()*2.0f-1.0f); } /* Gauss random number generator center is 0.5 range is +- 0.5 */ float random_generator::generator_gauss(void) { #define ITERATIONS 10 float sum = 0; int i; for(i = 0; i < ITERATIONS; i++) sum += (float)rand() / (float)RAND_MAX; return(sum / ITERATIONS); } /* Gauss random number generator center is 0.0 range is +- 1.0 */ float random_generator::generator_gauss_0(void) { return(2.0f*(generator_gauss() - 0.5f)); } /* Gauss random number generator center (and maximum) is 1.0 range is 1.0 - 0.0 */ float random_generator::generator_gauss_1(void) { return(1.0f - fabs(generator_gauss_0())); } float random_generator::generate_scattering(RANDOM_GENERATOR_TYPE generator_type) { // Calculate a scattering float scattering = 0.0f; switch(generator_type) { case GENERATOR_RAND: scattering = random_generator::generator_rand_0(); break; case GENERATOR_GAUSS: scattering = random_generator::generator_gauss_0(); break; } return(scattering); } /* * Random generator fractal */ random_generator_fractal::random_generator_fractal(void) { generator_center = 0.0f; generator_delta = 1.0f; generator_hurst = 0.6f; } float random_generator_fractal::generate_height(int iteration) { float d = generator_delta/(powf(2.0f, 2.0f*generator_hurst*iteration)); float height_change = generator_gauss()*d - d / 2.0f + generator_center; return(height_change); } float random_generator_fractal::generate_height(int iteration, float hurst, float center, float delta) { float d = delta/(powf(2.0f, 2.0f*hurst*iteration)); float height_change = generator_gauss()*d - d / 2.0f + center; /* if(iteration == 0) return(1); else return(0); */ return(height_change); } berusky2-0.12/src/tmp/0000755000175000017500000000000013676433304011603 500000000000000berusky2-0.12/src/tmp/compat.cpp0000644000175000017500000004540413674426075013526 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include "3d_all.h" #include "ini.h" #include "3d_all.h" #include "Object.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "Berusky3d.h" #include "Berusky3d_ini.h" #include "Berusky3d_load.h" #include "Berusky3d_render.h" #include "Berusky3d_animace.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Berusky3d_kamery.h" #include "Berusky3d_kofola2d.h" float scale_factor[2]; float scale_back_factor[2]; char cCheckMusicExeption = 0; void Sleep(int ms) { SDL_Delay(ms); } int ftoi(float t) { return ((int) roundf(t)); } static int timeGetTimeSet = 0; void timeGetTimeInit(void) { timeGetTimeSet = 1; } unsigned int timeGetTime(void) { assert(timeGetTimeSet); return (current_time_get()); } //----------------------------------------------------------------------------- // ddx2 interface //----------------------------------------------------------------------------- extern char pBmpDir[MAX_FILENAME]; DeviceHandle ddxDevice; DeviceHandle ddxCursorDevice; int i_CursorDDX = 0; int i_CursorDDXChange = TRUE; int bDrawCursor = 0; int ddxInitDone = FALSE; int bFlip; static long bLastGameState = 1; extern MOUSE_INFO dim; int start_x = 0; int start_y = 0; #define CURSOR_DEVICE_DX 75 #define CURSOR_DEVICE_DY 75 //----------------------------------------------------------------------------- // Name: ddxDrawCursor() // Desc: Draw cursor. //----------------------------------------------------------------------------- void ddxDrawCursor(void) { if(bDrawCursor) { ddx2DrawCursor(i_CursorDDXChange ? i_CursorDDX : NO_SURFACE, dim.x_orig, dim.y_orig, CURSOR_DEVICE_DX, CURSOR_DEVICE_DY, TRANSCOLOR); if(i_CursorDDXChange) i_CursorDDXChange = FALSE; } } //----------------------------------------------------------------------------- // Name: DisplayFrame() // Desc: Blts a the sprites to the back buffer, then flips the // back buffer onto the primary buffer. //----------------------------------------------------------------------------- int DisplayFrame() { ddxPublish(); return(TRUE); } void ddxSetCursorSurface(int iSurface) { i_CursorDDX = iSurface; i_CursorDDXChange = TRUE; } int ddxInit(void) { if (!ddxInitDone) { ddx2Init(10000, RGB(255, 0, 255)); ddxSetCursor(1); ddxSetCursorSurface(0); ddxSetFlip(1); // Create cursor device ddxCursorDevice = ddx2DeviceCreate(TRUE, 32, TRUE); ddx2DeviceSetActive(ddxCursorDevice); ddx2DeviceSetBackBufferSize(CURSOR_DEVICE_DX, CURSOR_DEVICE_DY); ddx2DeviceSetBackBufferRect(0, 0, CURSOR_DEVICE_DX, CURSOR_DEVICE_DY); ddx2DeviceSetTextRenderRec(0, 0, CURSOR_DEVICE_DX, CURSOR_DEVICE_DY); ddx2DeviceSetScreenRec(0, 0, CURSOR_DEVICE_DX, CURSOR_DEVICE_DY); ddx2DeviceSetRender(TRUE); // Create screen device ddxDevice = ddx2DeviceCreate(TRUE, 32); ddx2DeviceSetActive(ddxDevice); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(0, 0, 1024, 768); ddx2DeviceSetTextRenderRec(0, 0, 1024, 768); ddx2DeviceSetScreenRecCallback(ddx2ScreenResDefaultCallback); ddx2DeviceSetRender(TRUE); ddxInitDone = TRUE; } return (TRUE); } void ddxRelease(void) { if (ddxInitDone) { ddx2DeviceRemove(ddxCursorDevice); ddx2DeviceRemove(ddxDevice); ddx2Release(); ddxInitDone = FALSE; } } void ddxPublish(void) { int i, x = 0; ddxDrawCursor(); if (!rline.rlast) ddx2SetRect(NULL, 0); else { ZeroMemory(rDrawRect, sizeof(RECT) * DRAW_RECT_NUM); for (i = 0; i < rline.rlast; i++) { if (!_2d_Is_InRectLine(rDrawRect, &rline.rect[i].rect, x)) { memcpy(&rDrawRect[x], &rline.rect[i].rect, sizeof(RECT)); x++; } } ddx2SetRect(rDrawRect, x); } spracuj_spravy(0); ddx2RenderujVse(p_ber); flip(); _2d_Clear_RectLine(&rline); } int ddxFindFreeSurface(void) { return (ddx2FindFreeSurface()); } int ddxReleaseBitmap(int iSurface) { return (ddx2ReleaseBitmap(iSurface)); } int ddxLoadList(char *pFileName, int bProgress) { if (bProgress) { ddxSetCursor(0); ddxSetFlip(0); } kprintf(1, "Kofola: - Load bitmap pro herni menu"); ddx2LoadList(pFileName, pBmpDir, BITMAP_DIR); if (bProgress) { ddxSetCursor(1); ddxSetFlip(1); } return (1); } int ddxLoadBitmap(char *pFileName, char* pDirName) { return (ddx2LoadBitmap(pFileName, pDirName)); } int ddxCreateSurface(int x, int y, int idx) { return (ddx2CreateSurface(x, y, idx)); } void ddxDrawSurfaceColorKey(int iSurface, int *com, int layer, COLORREF color) { ddx2DrawSurfaceColorKey(iSurface, com, layer, color); } void ddxDrawDisplayColorKey(int *com, int layer, COLORREF color) { ddx2DrawDisplayColorKey(com, layer, color); } void ddxDrawDisplay(int *com, int layer) { ddx2DrawDisplay(com, layer); } void ddxDrawSurface(int iSurface, int *com, int layer) { ddx2DrawSurface(iSurface, com, layer); } BOOL ddxTransparentBlt(int dcDestSurface, // handle to Dest DC int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc, // y-coord of source upper-left corner int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle UINT crTransparent // color to make transparent ) { bool ret = ddx2TransparentBlt(dcDestSurface, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dcSrcSurface, nXOriginSrc, nYOriginSrc, crTransparent); return (ret); } BOOL ddxTransparentBltDisplay(int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc, // y-coord of source upper-left corner int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle UINT crTransparent // color to make transparent ) { bool ret = ddx2TransparentBltDisplay(nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dcSrcSurface, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, crTransparent); return (ret); } BOOL ddxBitBlt(int dcDestSurface, // handle to Dest DC int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc // y-coord of source upper-left corner ) { return ddx2BitBlt(dcDestSurface, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dcSrcSurface, nXOriginSrc, nYOriginSrc); } BOOL ddxBitBltDisplay(int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc // y-coord of source upper-left corner ) { int ret = ddx2BitBltDisplay(nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dcSrcSurface, nXOriginSrc, nYOriginSrc); return (ret); } int ddxGetWidth(int iSurface) { return (ddx2GetWidth(iSurface)); } int ddxGetHight(int iSurface) { return (ddx2GetHeight(iSurface)); } void ddxCleareSurface(int iSurface) { ddx2CleareSurface(iSurface); } void ddxCleareSurfaceColor(int iSurface, COLORREF color) { ddx2CleareSurfaceColor(iSurface, color); } void ddxFillRect(int iSurface, RECT * rect, COLORREF color) { ddx2FillRect(iSurface, rect, color); } void ddxFillRectDisplay(RECT * rect, COLORREF color) { ddx2FillRect(DDX2_BACK_BUFFER, rect, color); } void ddxAddRectItem(void *p_rl, RECT rect, int iLayer) { ddx2AddRectItem((RECT_LINE *) p_rl, rect, iLayer); } int ddxStretchBltDisplay(RECT * rDest, int iSurface, RECT * rSource) { return(ddx2BitBltStretch(DDX2_BACK_BUFFER, rDest->left, rDest->top, rDest->right - rDest->left, rDest->bottom - rDest->top, iSurface, rSource->left, rSource->top, rSource->right - rSource->left, rSource->bottom - rSource->top)); } int ddxStretchBlt(int iSDest, RECT * rDest, int iSSource, RECT * rSource) { assert(0); // not implemented return(TRUE); } int ddxUpdateMouse(void) { spracuj_spravy(1); dim.x_orig = mi.x; dim.y_orig = mi.y; dim.dx = (int)ceil(mi.dx * scale_factor_x()); dim.dy = (int)ceil(mi.dy * scale_factor_y()); dim.x = (int)ceil(mi.x * scale_factor_x()); dim.y = (int)ceil(mi.y * scale_factor_y()); dim.rx = dim.x - start_x; dim.ry = dim.y - start_y; dim.t1 = dim.dt1 = mi.t1; dim.t2 = dim.dt2 = mi.t2; if (!dim.t1) dim.lt1 = 0; if (!dim.t2) dim.lt2 = 0; if (dim.t1 && dim.lt1) dim.t1 = 0; if (dim.t2 && dim.lt2) dim.t2 = 0; if (!dim.lt1 && dim.t1) { dim.lt1 = 1; dim.tf1 = 1; } if (!dim.lt2 && dim.t2) { dim.lt2 = 1; dim.tf2 = 1; } return TRUE; } void ddxSetFlip(char bSwitch) { bFlip = bSwitch; } void ddxSetCursor(char bSwitch) { bDrawCursor = bSwitch; ddx2DrawCursorSetDraw(bSwitch); } void ddxResizeCursorBack(int iSurface) { // We don't need this on Linux } void ddxRestore(AUDIO_DATA * p_ad) { static dword dwLastMenuMusicCheck = 0; if(karmin_aktivni && timeGetTime() - dwLastMenuMusicCheck > 20000) { if(!ogg_playing() && !cCheckMusicExeption) ap_Play_Song(0, 0, p_ad); dwLastMenuMusicCheck = timeGetTime(); } if (bLastGameState != karmin_aktivni) { bLastGameState = karmin_aktivni; // Game is restored if (bLastGameState) { if(!ogg_playing()) ap_Play_Song(0, 0, p_ad); } else { adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); ap_Stop_Song(p_ad); } } if (MenuCheckBossExit()) { gl_Kofola_End(1); } } void ddxSaveSurface(int idx) { // TODO assert(0); } void ddxCleareSurfaceColorDisplay(COLORREF color) { ddx2CleareSurfaceColor(DDX2_BACK_BUFFER, color); RECT r = {0,0,ddx2GetWidth(DDX2_BACK_BUFFER),ddx2GetHeight(DDX2_BACK_BUFFER)}; ddx2AddRectItem(&rline, r); } // Return always "windowed" mode int ddxGetMode(void) { return (TRUE); } void InitDirectDraw(void) { bInMenu = 1; } void FreeDirectDraw() { bInMenu = 0; } char *strlwr(char *cFile) { char *tmp = cFile; while (*tmp) { *tmp = tolower(*tmp); tmp++; } return (cFile); } void dbgprintf(char *p_tmp, ...) { } // Convert any encoding to another encoding, returning the number of // bytes in the encoded string. size_t ConvertEncoding(const char *fromEncoding, const char *toEncoding, char *lpFromStr, size_t cbFrom, char *lpToStr, size_t cbTo) { iconv_t cd; size_t ret; cd = iconv_open(toEncoding, fromEncoding); if (cd == (iconv_t)-1) return ((size_t)-1); if (!lpToStr) { size_t count = 0; do { // Use a temporary buffer in place of lpToStr. char buf[4096]; // An arbitrary size char *p_buf = buf; size_t buf_size = sizeof(buf); ret = iconv(cd, &lpFromStr, &cbFrom, &p_buf, &buf_size); if (ret == (size_t)-1 && errno != E2BIG) break; count += sizeof(buf) - buf_size; } while (ret == (size_t)-1); if (ret != (size_t)-1) ret = count; } else { size_t oldCbTo = cbTo; ret = iconv(cd, &lpFromStr, &cbFrom, &lpToStr, &cbTo); if (ret != (size_t)-1) ret = oldCbTo - cbTo; } if (iconv_close(cd)) return ((size_t)-1); return (ret); } // Converts UTF-8 to wide-char string int MultiByteToWideChar(int CodePage, int dwFlags, char *lpMultiByteStr, int cbMultiByte, WCHAR * lpWideCharStr, int cchWideChar) { size_t ret; size_t n_converted; cbMultiByte = strnlen(lpMultiByteStr, cbMultiByte); ret = ConvertEncoding("UTF8", "WCHAR_T", lpMultiByteStr, cbMultiByte, (char *)lpWideCharStr, cchWideChar*sizeof(WCHAR)); if (ret == (size_t)-1) return -1; n_converted = ret / sizeof(WCHAR); if (lpWideCharStr) { assert(n_converted < (size_t)cchWideChar); lpWideCharStr[n_converted] = L'\0'; } return n_converted; } int WideCharToMultiByte(int CodePage, int dwFlags, wchar_t * lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte, char *lpDefaultChar, int *lpUsedDefaultChar) { size_t ret; cchWideChar = wcsnlen(lpWideCharStr, cchWideChar); ret = ConvertEncoding("WCHAR_T", "UTF8", (char *)lpWideCharStr, cchWideChar*sizeof(WCHAR), lpMultiByteStr, cbMultiByte); if (ret == (size_t)-1) return -1; if (lpMultiByteStr) { assert(ret < (size_t)cbMultiByte); lpMultiByteStr[ret] = '\0'; } return ret; } void ShowCursor(bool state) { SDL_ShowCursor(state ? SDL_ENABLE : SDL_DISABLE); } void SetCursor(void *tmp) { // WinAPI - we don't need it } char *strupr(char *string) { // TODO assert(0); } void GetPrivateProfileString(const char *lpAppName, // section name const char *lpKeyName, // key name const char *lpDefault, // default key value char *lpReturnedString, int nSize, const char *lpFileName) // ini file name { ini_read_string_section(lpFileName, lpAppName, lpKeyName, lpReturnedString, nSize, lpDefault); path_correction(lpReturnedString, nSize); } int WritePrivateProfileString(const char *lpAppName, // section name const char *lpKeyName, const char *lpString, const char *lpFileName) { return(ini_write_string_section(lpFileName, lpAppName, lpKeyName, lpString)); } int GetPrivateProfileInt(const char *lpAppName, // section name const char *lpKeyName, int nDefault, const char *lpFileName) { return(ini_read_int_section(lpFileName, lpAppName, lpKeyName, nDefault)); } void wchar_windows_to_linux(word * p_in, int str_len, wchar_t * p_out) { int i; assert(str_len); p_out[0] = '\0'; for (i = 0; i < str_len; i++) *p_out++ = *p_in++; } void wchar_linux_to_windows(wchar_t * p_in, int str_len, word * p_out) { int i; assert(str_len); p_out[0] = '\0'; for (i = 0; i < str_len; i++) *p_out++ = *p_in++; } // in place replacement wchar_t *wchar_windows_to_linux(word * p_in, int bytes_in_len) { wchar_t *p_tmp = (wchar_t *) mmalloc(bytes_in_len * 2); wchar_windows_to_linux(p_in, bytes_in_len/2, p_tmp); return (p_tmp); } void window_set_title(char *p_title) { SDL_WM_SetCaption(p_title, NULL); } /* type definition for the "new" timer callback function */ Uint32 callback(Uint32 interval, void *param) { TIMERPROC func = (TIMERPROC) param; func(NULL, 0, 0, interval); return (interval); } TIMER_ID SetTimer(HWND hWnd, TIMER_ID nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc) { return (SDL_AddTimer(uElapse, callback, (void *) lpTimerFunc)); } UINT KillTimer(HWND hWnd, TIMER_ID uIDEvent) { return (SDL_RemoveTimer(uIDEvent)); } char current_working_dir[MAX_FILENAME]; char current_working_dir_file[MAX_FILENAME]; void working_dir_init(void) { char *ret = getcwd(current_working_dir, MAX_FILENAME); assert(ret); } char *working_file_get(const char *p_file) { return (return_path_ext(p_file, current_working_dir, current_working_dir_file, MAX_FILENAME)); } char *working_file_get(const char *p_file, char *p_target, int size) { return (return_path_ext(p_file, current_working_dir, p_target, size)); } void working_file_translate(char *p_file, int size) { return_path_ext(p_file, current_working_dir, current_working_dir_file, MAX_FILENAME); assert(size <= MAX_FILENAME); strcpy(p_file, current_working_dir_file); } void root_dir_attach(char *p_dir, char *p_root_dir) { char tmp[MAX_FILENAME]; strcpy(tmp, p_root_dir); strcat(tmp, "/"); strcat(tmp, p_dir); strcpy(p_dir, tmp); } void GetFileSize(FILE *f, dword *size) { *size = file_size_get(f); } #ifndef WINDOWS static char *p_file_mask; void file_filter_mask(char *p_file_mask_) { p_file_mask = p_file_mask_; } // returns TRUE = match int file_filter(const struct dirent *file) { const char *file_mask = p_file_mask ? p_file_mask : "*"; // remove "." and ".." dirs if(file->d_name[0] == '.') { if(file->d_name[1] == 0) return(0); if(file->d_name[1] == '.' && file->d_name[2] == 0) return(0); } return(!fnmatch(file_mask, file->d_name, 0)); } #endif berusky2-0.12/src/tmp/compat_mini.h0000644000175000017500000001260613674426075014205 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __COMPAT_MINI_H__ #define __COMPAT_MINI_H__ #ifdef __cplusplus extern "C" { #endif #include "compatibility.h" #include #include #include #ifndef WINDOWS #include #include #include #endif #define MAX_JMENO 50 #define TRUE (1==1) #define FALSE 0 #ifndef ERROR #define ERROR (-1) #endif #ifdef WINDOWS #define DIR_SLASH '\\' #define DIR_SLASH_STRING "\\" #elif LINUX #define DIR_SLASH '/' #define DIR_SLASH_STRING "/" #endif typedef unsigned char byte; typedef unsigned char BYTE; typedef unsigned short word; typedef unsigned short WORD; typedef unsigned int dword; typedef unsigned int COLORREF; typedef long LONG; typedef dword DWORD; typedef float FLOAT; typedef wchar_t WCHAR; typedef void *HWND; typedef void *HDC; typedef unsigned int UINT; typedef int BOOL; typedef void *HINSTANCE; typedef word FACE; typedef size_t size_ptr; extern dword karmin_aktivni; typedef struct _MOUSE_INFO { int x_orig, y_orig; int x, y; int rx, ry; int dx, dy; int t1, t2; int dt1, dt2; int d1, d2; int tf1, tf2; int lt1, lt2; } MOUSE_INFO; #define CP_ACP 0 #define HDC2DD -1 #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) | ((unsigned short)((unsigned char)(b))) << 8)) void kprintf(char log, const char *p_text, ...); void kprintfl(char log, const char *p_text, ...); void kerror(char log, const char *p_text, ...); void kwarning(char log, const char *p_text, ...); void ddw(const char *p_text, ...); #ifndef PATH_MAX #define PATH_MAX 1024 #endif /* #define MAX_FILENAME_LENGTH 256 #if PATH_MAX > MAX_FILENAME_LENGTH #define MAX_FILENAME MAX_FILENAME_LENGTH #else #define MAX_FILENAME PATH_MAX #endif */ #define MAX_FILENAME PATH_MAX extern char ini_file[MAX_FILENAME]; void Sleep(int ms); char *itoa(int d, char *buf, int base); void timeGetTimeInit(void); unsigned int timeGetTime(void); void GetFileSize(FILE *f, dword *size); void zero_memory(void *mem, int size); #define ZeroMemory(m,s) zero_memory(m,s) void newline_cut(char *p_line); #ifndef WINDOWS enum { EAX_ENVIRONMENT_GENERIC, EAX_ENVIRONMENT_PADDEDCELL, EAX_ENVIRONMENT_ROOM, EAX_ENVIRONMENT_BATHROOM, EAX_ENVIRONMENT_LIVINGROOM, EAX_ENVIRONMENT_STONEROOM, EAX_ENVIRONMENT_AUDITORIUM, EAX_ENVIRONMENT_CONCERTHALL, EAX_ENVIRONMENT_CAVE, EAX_ENVIRONMENT_ARENA, EAX_ENVIRONMENT_HANGAR, EAX_ENVIRONMENT_CARPETEDHALLWAY, EAX_ENVIRONMENT_HALLWAY, EAX_ENVIRONMENT_STONECORRIDOR, EAX_ENVIRONMENT_ALLEY, EAX_ENVIRONMENT_FOREST, EAX_ENVIRONMENT_CITY, EAX_ENVIRONMENT_MOUNTAINS, EAX_ENVIRONMENT_QUARRY, EAX_ENVIRONMENT_PLAIN, EAX_ENVIRONMENT_PARKINGLOT, EAX_ENVIRONMENT_SEWERPIPE, EAX_ENVIRONMENT_UNDERWATER, EAX_ENVIRONMENT_DRUGGED, EAX_ENVIRONMENT_DIZZY, EAX_ENVIRONMENT_PSYCHOTIC, EAX_ENVIRONMENT_COUNT }; #define THREAD_PRIORITY_TIME_CRITICAL 1 #define THREAD_PRIORITY_HIGHEST 2 #define THREAD_PRIORITY_ABOVE_NORMAL 3 #define THREAD_PRIORITY_NORMAL 4 #define THREAD_PRIORITY_BELOW_NORMAL 5 #define THREAD_PRIORITY_LOWEST 6 #define THREAD_PRIORITY_IDLE 7 #define STILL_ACTIVE 259 typedef unsigned long THREAD_ID; typedef pthread_t THREAD_HANDLE; typedef void * (*thread_routine)(void *); THREAD_HANDLE CreateThread(void *lpThreadAttributes, size_t dwStackSize, thread_routine lpStartAddress, void * lpParameter, dword dwCreationFlags, THREAD_ID *lpThreadId); int TerminateThread(THREAD_HANDLE hThread, dword dwExitCode); int CloseHandle(THREAD_HANDLE handle); void ExitThread(dword dwExitCode); int SetThreadPriority(THREAD_HANDLE hThread, int nPriority); int GetThreadPriority(THREAD_HANDLE hThread); int GetExitCodeThread(THREAD_HANDLE hThread, dword *lpExitCode); #else typedef unsigned long THREAD_ID; typedef void * THREAD_HANDLE; #endif #define POINTER_TO_INT(pointer) (*((int*)&(pointer))) #ifdef LINUX char * _strdate(char *p_tmp); char * _strtime(char *p_tmp); #endif #ifdef __cplusplus } #endif #endif // __COMPAT_MINI_H__ berusky2-0.12/src/tmp/alut_test.cpp0000644000175000017500000000721613674426075014246 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include "compat_mini.h" #include "adas.h" #define NUM_BUFFERS 3 #define NUM_SOURCES 3 #define NUM_ENVIRONMENTS 1 static ALfloat listenerPos[]={0.0,0.0,0.0}; static ALfloat listenerVel[]={0.0,0.0,0.0}; static ALfloat listenerOri[]={0.0,0.0,1.0, 0.0,1.0,0.0}; ALfloat pos[]={ 0.0, 0.0, 0.0}; ALfloat vel[]={ 0.0, 0.0, 0.0}; static ALuint buffer[NUM_BUFFERS]; static ALuint source[NUM_SOURCES]; //static ALuint environment[NUM_ENVIRONMENTS]; static ALsizei size,freq; static ALenum format; static ALvoid *data; //static int ch; #define HOME_DIR "/home/komat/Projekty/berusky2/data/" void init(int ini) { if(ini) { alutInit(0, NULL); } alListenerfv(AL_POSITION,listenerPos); alListenerfv(AL_VELOCITY,listenerVel); alListenerfv(AL_ORIENTATION,listenerOri); alGetError(); // clear any error messages // Generate buffers, or else no sound will happen! alGenBuffers(NUM_BUFFERS, buffer); if(alGetError() != AL_NO_ERROR) { kerror(TRUE, "- Error creating buffers !!\n"); } adasLoadWAVFile(HOME_DIR"1.wav", &format,&data,&size,reinterpret_cast(&freq),0); alBufferData(buffer[0],format,data,size,freq); adasUnloadWAV(format,data,size,freq); adasLoadWAVFile(HOME_DIR"2.wav", &format,&data,&size,reinterpret_cast(&freq),0); alBufferData(buffer[1],format,data,size,freq); adasUnloadWAV(format,data,size,freq); adasLoadWAVFile(HOME_DIR"3.wav", &format,&data,&size,reinterpret_cast(&freq),0); alBufferData(buffer[2],format,data,size,freq); adasUnloadWAV(format,data,size,freq); alGetError(); /* clear error */ alGenSources(NUM_SOURCES, source); if(alGetError() != AL_NO_ERROR) { kerror(TRUE,"- Error creating sources !!\n"); } int i; for(i = 0; i < NUM_SOURCES; i++) { alSourcef(source[i],AL_PITCH,1.0f); alSourcef(source[i],AL_GAIN,1.0f); alSourcefv(source[i],AL_POSITION,pos); alSourcefv(source[i],AL_VELOCITY,vel); alSourcei(source[i],AL_BUFFER,buffer[i]); alSourcei(source[i],AL_LOOPING,AL_TRUE); } } void alut_test(int ini) { kprintf(TRUE,"Alut_test..."); init(ini); alSourcePlay(source[0]); alSourcePlay(source[1]); alSourcePlay(source[2]); Sleep(2000); alSourceStop(source[2]); alSourceStop(source[1]); alSourceStop(source[0]); } berusky2-0.12/src/tmp/compat_mini.cpp0000644000175000017500000000747013674426075014543 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifdef __cplusplus extern "C" { #endif #include #include #include "compat_mini.h" dword karmin_aktivni = 1; void zero_memory(void *mem, int size) { memset(mem, 0, (size_t)size); } char *itoa(int d, char *buf, int base) { char *p = buf; char *p1, *p2; unsigned long ud = d; int divisor = 10; /* If %d is specified and D is minus, put `-' in the head. */ if (base == 'd' && d < 0) { *p++ = '-'; buf++; ud = -d; } else if (base == 'x') divisor = 16; /* Divide UD by DIVISOR until UD == 0. */ do { int remainder = ud % divisor; *p++ = (remainder < 10) ? remainder + '0' : remainder + 'A' - 10; } while (ud /= divisor); /* Terminate BUF. */ *p = 0; /* Reverse BUF. */ p1 = buf; p2 = p - 1; while (p1 < p2) { char tmp = *p1; *p1 = *p2; *p2 = tmp; p1++; p2--; } return(buf); } THREAD_HANDLE CreateThread(void *lpThreadAttributes, size_t dwStackSize, thread_routine lpStartAddress, void * lpParameter, dword dwCreationFlags, THREAD_ID *lpThreadId) { THREAD_HANDLE handle; pthread_create(&handle, NULL, lpStartAddress, lpParameter); return(handle); } int TerminateThread(THREAD_HANDLE hThread, dword dwExitCode) { int err; dword lpExitCode; (err = pthread_kill(hThread, SIGTERM)) || (err = GetExitCodeThread(hThread, &lpExitCode)); return err; } int CloseHandle(THREAD_HANDLE handle) { return 1; } void ExitThread(dword dwExitCode) { int ret; pthread_exit(&ret); } int SetThreadPriority(THREAD_HANDLE hThread, int nPriority) { return 1; } int GetThreadPriority(THREAD_HANDLE hThread) { return 0/*THREAD_PRIORITY_NORMAL*/; } int GetExitCodeThread(THREAD_HANDLE hThread, dword *lpExitCode) { *lpExitCode = 0; return(pthread_join(hThread, NULL)); } void newline_cut(char *p_line) { int len = strlen(p_line); if(len > 1 && (p_line[len-1] == '\n' || p_line[len-1] == '\r')) { p_line[len-1] = '\0'; len--; if(len > 1 && (p_line[len-1] == '\n' || p_line[len-1] == '\r')) { p_line[len-1] = '\0'; len--; } } } #ifdef LINUX char * _strdate(char *p_tmp) { time_t now = time(NULL); strftime(p_tmp, 50, "%D", localtime(&now)); //short month name return p_tmp; } char * _strtime(char *p_tmp) { time_t now = time((time_t*)NULL); struct tm *l_time = localtime(&now); sprintf(p_tmp, "%.2d:%.2d:%.2d", l_time->tm_hour, l_time->tm_min, l_time->tm_sec); return p_tmp; } #endif #ifdef __cplusplus } #endif berusky2-0.12/src/tmp/compat.h0000644000175000017500000002610013674455141013157 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * Michal Simonik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __COMPAT_H__ #define __COMPAT_H__ #include "compat_mini.h" typedef VECT2DF BODUV; typedef VECT3DF BOD; typedef VECT4DF WBOD; typedef RGBF BODRGB; typedef RGBAF BODRGBA; typedef RGBF RGB_M; typedef RGBAF BARVA_RGBA; typedef PLANE ROVINA; typedef struct _ROVINAD { double x, y, z, e; } ROVINAD; typedef struct _rect { int left; int top; int right; int bottom; } RECT, *PRECT; #include "kfile.h" #include "Texture.h" #include "Matrix.h" #include "Mat3d.h" #include "Vektor.h" #include "3dinterface.h" #include "3dproject.h" #include "3dmath.h" #include "obbo.h" #include "Quat.h" #include "Keyframe.h" #include "Load.h" #include "Load_out.h" #include "Di.h" #include "Ddx.h" #include "Load_chunks.h" #include "Kdtree.h" #include "2D_graphic.h" typedef void (*END_FUNKCE) (size_ptr param, size_ptr param2, size_ptr param3); #define RGB(r,g,b) int_rgb(r,g,b) #define TRANSCOLOR int_rgb(255, 0, 255) //----------------------------------------------------------------------------- // ddx2 interface //----------------------------------------------------------------------------- extern RECT_LINE rline; extern RECT rDrawRect[DRAW_RECT_NUM]; //------------------------------------------------------------------------------------------------ // Draw all //------------------------------------------------------------------------------------------------ void ddxPublish(void); //----------------------------------------------------------------------------- // Name: DisplayFrame() // Desc: Blts a the sprites to the back buffer, then flips the // back buffer onto the primary buffer. //----------------------------------------------------------------------------- int DisplayFrame(); //------------------------------------------------------------------------------------------------ // init 2d //------------------------------------------------------------------------------------------------ int ddxInit(void); //------------------------------------------------------------------------------------------------ // 2d release //------------------------------------------------------------------------------------------------ void ddxRelease(void); //------------------------------------------------------------------------------------------------ // finds first free index //------------------------------------------------------------------------------------------------ int ddxFindFreeSurface(void); //------------------------------------------------------------------------------------------------ // release bitmap //------------------------------------------------------------------------------------------------ int ddxReleaseBitmap(int iSurface); //------------------------------------------------------------------------------------------------ // load list of bitmaps from the bitmap directory //------------------------------------------------------------------------------------------------ int ddxLoadList(char *pFileName, int bProgress); //------------------------------------------------------------------------------------------------ // load bitmap from the bitmap directory //------------------------------------------------------------------------------------------------ int ddxLoadBitmap(char *pFileName, char *pDirName); //------------------------------------------------------------------------------------------------ // Create Surface //------------------------------------------------------------------------------------------------ int ddxCreateSurface(int x, int y, int idx); //------------------------------------------------------------------------------------------------ // nakresli obrazek //------------------------------------------------------------------------------------------------ void ddxDrawSurfaceColorKey(int iSurface, int *com, int layer, COLORREF color); void ddxDrawDisplayColorKey(int *com, int layer, COLORREF color); void ddxDrawDisplay(int *com, int layer); void ddxDrawSurface(int iSurface, int *com, int layer); BOOL ddxTransparentBlt(int dcDestSurface, // handle to Dest DC int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc, // y-coord of source upper-left corner int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle UINT crTransparent // color to make transparent ); BOOL ddxTransparentBltDisplay(int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc, // y-coord of source upper-left corner int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle UINT crTransparent // color to make transparent ); BOOL ddxBitBlt(int dcDestSurface, // handle to Dest DC int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc // y-coord of source upper-left corner ); BOOL ddxBitBltDisplay(int nXOriginDest, // x-coord of destination upper-left corner int nYOriginDest, // y-coord of destination upper-left corner int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle int dcSrcSurface, // handle to source DC int nXOriginSrc, // x-coord of source upper-left corner int nYOriginSrc // y-coord of source upper-left corner ); int ddxGetWidth(int iSurface); int ddxGetHight(int iSurface); void ddxCleareSurface(int iSurface); void ddxCleareSurfaceColor(int iSurface, COLORREF color); void ddxFillRect(int iSurface, RECT * rect, COLORREF color); void ddxFillRectDisplay(RECT * rect, COLORREF color); void ddxAddRectItem(void *p_rl, RECT rect, int iLayer); int ddxStretchBltDisplay(RECT * rDest, int iSurface, RECT * rSource); int ddxStretchBlt(int iSDest, RECT * rDest, int iSSource, RECT * rSource); int ddxUpdateMouse(void); void ddxSetFlip(char bSwitch); void ddxSetCursor(char bSwitch); void ddxResizeCursorBack(int iSurface); void ddxSetCursorSurface(int iSurface); void ddxRestore(AUDIO_DATA * p_ad); void ddxSaveSurface(int idx); void ddxCleareSurfaceColorDisplay(COLORREF color); int ddxGetMode(void); void InitDirectDraw(void); void FreeDirectDraw(void); char MenuCheckBossExit(void); char *strlwr(char *cFile); void dbgprintf(char *p_tmp, ...); int MultiByteToWideChar(int CodePage, int dwFlags, char *lpMultiByteStr, int cbMultiByte, WCHAR * lpWideCharStr, int cchWideChar); #define WC_COMPOSITECHECK 0 #define WC_DEFAULTCHAR 0 int WideCharToMultiByte(int CodePage, int dwFlags, wchar_t * lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte, char *lpDefaultChar, int *lpUsedDefaultChar); void ShowCursor(bool state); void SetCursor(void *tmp); char *strupr(char *string); void GetPrivateProfileString(const char *lpAppName, const char *lpKeyName, const char *lpDefault, char *lpReturnedString, int nSize, const char *lpFileName); int WritePrivateProfileString(const char *lpAppName, const char *lpKeyName, const char *lpString, const char *lpFileName); int GetPrivateProfileInt(const char *lpAppName, const char *lpKeyName, int nDefault, const char *lpFileName); inline void null_free(void **p_mem) { if ((*p_mem) != NULL) { free(*p_mem); *p_mem = NULL; } } wchar_t *wchar_windows_to_linux(word * p_in, int bytes_in_len); void wchar_windows_to_linux(word * p_in, int str_len, wchar_t * p_out); void wchar_linux_to_windows(wchar_t * p_in, int str_len, word * p_out); typedef SDL_TimerID TIMER_ID; typedef void (*TIMERPROC) (HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime); TIMER_ID SetTimer(HWND hWnd, TIMER_ID nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); UINT KillTimer(HWND hWnd, TIMER_ID uIDEvent); void working_dir_init(void); void working_file_translate(char *p_file, int size); char *working_file_get(const char *p_file); char *working_file_get(const char *p_file, char *p_target, int size); void root_dir_attach(char *p_dir, char *p_root_dir); void window_set_title(char *p_title); extern char cCheckMusicExeption; void alut_test(int ini); extern float scale_factor[2]; extern float scale_back_factor[2]; inline void scale_factor_set(void) { scale_factor[0] = (float) 1024.0f / (float) SCREEN_XRES; scale_factor[1] = (float) 768.0f / (float) SCREEN_YRES; scale_back_factor[0] = (float) SCREEN_XRES / 1024.0f; scale_back_factor[1] = (float) SCREEN_YRES / 768.0f; } inline float scale_factor_x(void) { return(scale_factor[0]); } inline float scale_factor_y(void) { return(scale_factor[1]); } inline float scale_back_factor_x(void) { return(scale_back_factor[0]); } inline float scale_back_factor_y(void) { return(scale_back_factor[1]); } #ifndef WINDOWS void file_filter_mask(char *p_file_mask_); int file_filter(const struct dirent *file); #endif #endif //__COMPAT_H__ berusky2-0.12/src/Makefile.in0000644000175000017500000115441113676430207012776 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = berusky2$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_berusky2_OBJECTS = 3D_graphic.$(OBJEXT) 3D_menus.$(OBJEXT) \ 3d_math.$(OBJEXT) Bind.$(OBJEXT) Camera.$(OBJEXT) \ Comics.$(OBJEXT) Command.$(OBJEXT) Dda.$(OBJEXT) \ Demo.$(OBJEXT) Init.$(OBJEXT) Menu.$(OBJEXT) Menu2.$(OBJEXT) \ Tools.$(OBJEXT) animend_functions.$(OBJEXT) controls.$(OBJEXT) \ controls3d.$(OBJEXT) credits.$(OBJEXT) font.$(OBJEXT) \ font3d.$(OBJEXT) game_init.$(OBJEXT) game_logic.$(OBJEXT) \ game_main.$(OBJEXT) grammar.$(OBJEXT) load_level.$(OBJEXT) \ menu_script.$(OBJEXT) profiles.$(OBJEXT) setup.$(OBJEXT) \ square_cut.$(OBJEXT) trigers.$(OBJEXT) volume.$(OBJEXT) \ water.$(OBJEXT) 3dinterface.$(OBJEXT) Berusky3d.$(OBJEXT) \ Berusky3d_castice.$(OBJEXT) Berusky3d_ini.$(OBJEXT) \ Berusky3d_kamery.$(OBJEXT) Berusky3d_kofola2d.$(OBJEXT) \ Berusky3d_kofola_interface.$(OBJEXT) Berusky3d_light.$(OBJEXT) \ Berusky3d_load.$(OBJEXT) Berusky3d_render.$(OBJEXT) \ Di.$(OBJEXT) Load.$(OBJEXT) Load_chunks.$(OBJEXT) \ Load_out.$(OBJEXT) compat.$(OBJEXT) 2D_graphic.$(OBJEXT) \ age.$(OBJEXT) alpha.$(OBJEXT) animation.$(OBJEXT) \ animation_time.$(OBJEXT) animation_track.$(OBJEXT) \ animation_track_bezier.$(OBJEXT) \ animation_track_linear.$(OBJEXT) bitmap.$(OBJEXT) \ box.$(OBJEXT) camera.$(OBJEXT) camera_interface.$(OBJEXT) \ color.$(OBJEXT) color_hsv.$(OBJEXT) draw.$(OBJEXT) \ ferguson.$(OBJEXT) gext.$(OBJEXT) glwrapper.$(OBJEXT) \ gpipe.$(OBJEXT) graph3d.$(OBJEXT) intersect.$(OBJEXT) \ lighting.$(OBJEXT) material.$(OBJEXT) \ material_texture.$(OBJEXT) matrix.$(OBJEXT) \ matrix_animated.$(OBJEXT) matrix_notified.$(OBJEXT) \ mesh.$(OBJEXT) normals.$(OBJEXT) obb.$(OBJEXT) \ object_base.$(OBJEXT) object_box.$(OBJEXT) \ object_geometry.$(OBJEXT) object_hierarchy.$(OBJEXT) \ object_list.$(OBJEXT) object_render_list.$(OBJEXT) \ object_scene.$(OBJEXT) object_transformation.$(OBJEXT) \ object_world.$(OBJEXT) polar.$(OBJEXT) print.$(OBJEXT) \ scene.$(OBJEXT) scene_import_3ds.$(OBJEXT) \ scene_import_b2m.$(OBJEXT) scene_import_txt.$(OBJEXT) \ scene_load.$(OBJEXT) selection.$(OBJEXT) surface.$(OBJEXT) \ surface_height.$(OBJEXT) surface_mask.$(OBJEXT) \ surface_sdl.$(OBJEXT) surface_sw.$(OBJEXT) \ texture_func.$(OBJEXT) texture_unit.$(OBJEXT) \ triangle.$(OBJEXT) vector.$(OBJEXT) vertex_arrays.$(OBJEXT) \ world_interface.$(OBJEXT) age_main.$(OBJEXT) events.$(OBJEXT) \ input.$(OBJEXT) timer.$(OBJEXT) change.$(OBJEXT) \ data_file.$(OBJEXT) ini.$(OBJEXT) log.$(OBJEXT) \ mem_alloc.$(OBJEXT) mtree.$(OBJEXT) utils.$(OBJEXT) \ animationk.$(OBJEXT) generator_random.$(OBJEXT) Ddx.$(OBJEXT) \ kfile.$(OBJEXT) Berusky3d_animace.$(OBJEXT) 3dmath.$(OBJEXT) \ 3dproject.$(OBJEXT) Mat3d.$(OBJEXT) Keyframe.$(OBJEXT) \ Texture.$(OBJEXT) Texture_import.$(OBJEXT) obbo.$(OBJEXT) \ Kdtree.$(OBJEXT) json_export.$(OBJEXT) \ ambient_sounds.$(OBJEXT) audio_plug-in.$(OBJEXT) \ 3d_math_k.$(OBJEXT) adas.$(OBJEXT) ogg_io.$(OBJEXT) \ ogg_stream.$(OBJEXT) compat_mini.$(OBJEXT) alut_test.$(OBJEXT) \ aabb.$(OBJEXT) berusky2_OBJECTS = $(am_berusky2_OBJECTS) berusky2_DEPENDENCIES = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = berusky2_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(berusky2_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/2D_graphic.Po \ ./$(DEPDIR)/3D_graphic.Po ./$(DEPDIR)/3D_menus.Po \ ./$(DEPDIR)/3d_math.Po ./$(DEPDIR)/3d_math_k.Po \ ./$(DEPDIR)/3dinterface.Po ./$(DEPDIR)/3dmath.Po \ ./$(DEPDIR)/3dproject.Po ./$(DEPDIR)/Berusky3d.Po \ ./$(DEPDIR)/Berusky3d_animace.Po \ ./$(DEPDIR)/Berusky3d_castice.Po ./$(DEPDIR)/Berusky3d_ini.Po \ ./$(DEPDIR)/Berusky3d_kamery.Po \ ./$(DEPDIR)/Berusky3d_kofola2d.Po \ ./$(DEPDIR)/Berusky3d_kofola_interface.Po \ ./$(DEPDIR)/Berusky3d_light.Po ./$(DEPDIR)/Berusky3d_load.Po \ ./$(DEPDIR)/Berusky3d_render.Po ./$(DEPDIR)/Bind.Po \ ./$(DEPDIR)/Camera.Po ./$(DEPDIR)/Comics.Po \ ./$(DEPDIR)/Command.Po ./$(DEPDIR)/Dda.Po ./$(DEPDIR)/Ddx.Po \ ./$(DEPDIR)/Demo.Po ./$(DEPDIR)/Di.Po ./$(DEPDIR)/Init.Po \ ./$(DEPDIR)/Kdtree.Po ./$(DEPDIR)/Keyframe.Po \ ./$(DEPDIR)/Load.Po ./$(DEPDIR)/Load_chunks.Po \ ./$(DEPDIR)/Load_out.Po ./$(DEPDIR)/Mat3d.Po \ ./$(DEPDIR)/Menu.Po ./$(DEPDIR)/Menu2.Po \ ./$(DEPDIR)/Texture.Po ./$(DEPDIR)/Texture_import.Po \ ./$(DEPDIR)/Tools.Po ./$(DEPDIR)/aabb.Po ./$(DEPDIR)/adas.Po \ ./$(DEPDIR)/age.Po ./$(DEPDIR)/age_main.Po \ ./$(DEPDIR)/alpha.Po ./$(DEPDIR)/alut_test.Po \ ./$(DEPDIR)/ambient_sounds.Po ./$(DEPDIR)/animation.Po \ ./$(DEPDIR)/animation_time.Po ./$(DEPDIR)/animation_track.Po \ ./$(DEPDIR)/animation_track_bezier.Po \ ./$(DEPDIR)/animation_track_linear.Po \ ./$(DEPDIR)/animationk.Po ./$(DEPDIR)/animend_functions.Po \ ./$(DEPDIR)/audio_plug-in.Po ./$(DEPDIR)/bitmap.Po \ ./$(DEPDIR)/box.Po ./$(DEPDIR)/camera.Po \ ./$(DEPDIR)/camera_interface.Po ./$(DEPDIR)/change.Po \ ./$(DEPDIR)/color.Po ./$(DEPDIR)/color_hsv.Po \ ./$(DEPDIR)/compat.Po ./$(DEPDIR)/compat_mini.Po \ ./$(DEPDIR)/controls.Po ./$(DEPDIR)/controls3d.Po \ ./$(DEPDIR)/credits.Po ./$(DEPDIR)/data_file.Po \ ./$(DEPDIR)/draw.Po ./$(DEPDIR)/events.Po \ ./$(DEPDIR)/ferguson.Po ./$(DEPDIR)/font.Po \ ./$(DEPDIR)/font3d.Po ./$(DEPDIR)/game_init.Po \ ./$(DEPDIR)/game_logic.Po ./$(DEPDIR)/game_main.Po \ ./$(DEPDIR)/generator_random.Po ./$(DEPDIR)/gext.Po \ ./$(DEPDIR)/glwrapper.Po ./$(DEPDIR)/gpipe.Po \ ./$(DEPDIR)/grammar.Po ./$(DEPDIR)/graph3d.Po \ ./$(DEPDIR)/ini.Po ./$(DEPDIR)/input.Po \ ./$(DEPDIR)/intersect.Po ./$(DEPDIR)/json_export.Po \ ./$(DEPDIR)/kfile.Po ./$(DEPDIR)/lighting.Po \ ./$(DEPDIR)/load_level.Po ./$(DEPDIR)/log.Po \ ./$(DEPDIR)/material.Po ./$(DEPDIR)/material_texture.Po \ ./$(DEPDIR)/matrix.Po ./$(DEPDIR)/matrix_animated.Po \ ./$(DEPDIR)/matrix_notified.Po ./$(DEPDIR)/mem_alloc.Po \ ./$(DEPDIR)/menu_script.Po ./$(DEPDIR)/mesh.Po \ ./$(DEPDIR)/mtree.Po ./$(DEPDIR)/normals.Po ./$(DEPDIR)/obb.Po \ ./$(DEPDIR)/obbo.Po ./$(DEPDIR)/object_base.Po \ ./$(DEPDIR)/object_box.Po ./$(DEPDIR)/object_geometry.Po \ ./$(DEPDIR)/object_hierarchy.Po ./$(DEPDIR)/object_list.Po \ ./$(DEPDIR)/object_render_list.Po ./$(DEPDIR)/object_scene.Po \ ./$(DEPDIR)/object_transformation.Po \ ./$(DEPDIR)/object_world.Po ./$(DEPDIR)/ogg_io.Po \ ./$(DEPDIR)/ogg_stream.Po ./$(DEPDIR)/polar.Po \ ./$(DEPDIR)/print.Po ./$(DEPDIR)/profiles.Po \ ./$(DEPDIR)/scene.Po ./$(DEPDIR)/scene_import_3ds.Po \ ./$(DEPDIR)/scene_import_b2m.Po \ ./$(DEPDIR)/scene_import_txt.Po ./$(DEPDIR)/scene_load.Po \ ./$(DEPDIR)/selection.Po ./$(DEPDIR)/setup.Po \ ./$(DEPDIR)/square_cut.Po ./$(DEPDIR)/surface.Po \ ./$(DEPDIR)/surface_height.Po ./$(DEPDIR)/surface_mask.Po \ ./$(DEPDIR)/surface_sdl.Po ./$(DEPDIR)/surface_sw.Po \ ./$(DEPDIR)/texture_func.Po ./$(DEPDIR)/texture_unit.Po \ ./$(DEPDIR)/timer.Po ./$(DEPDIR)/triangle.Po \ ./$(DEPDIR)/trigers.Po ./$(DEPDIR)/utils.Po \ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/vertex_arrays.Po \ ./$(DEPDIR)/volume.Po ./$(DEPDIR)/water.Po \ ./$(DEPDIR)/world_interface.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(berusky2_SOURCES) DIST_SOURCES = $(berusky2_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NM = @NM@ NMEDIT = @NMEDIT@ NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@ NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@ NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@ NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@ NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENGL_CFLAGS = @OPENGL_CFLAGS@ OPENGL_LIBS = @OPENGL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@ PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@ PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@ PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOUND_CFLAGS = @SOUND_CFLAGS@ SOUND_LIBS = @SOUND_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ X11_CFLAGS = @X11_CFLAGS@ X11_LIBS = @X11_LIBS@ XGETTEXT = @XGETTEXT@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = \ -Ikomat -Ikofola -Itmp -Iage/graph -Iage/include -Iage/support -Iage/utils -Igenerator -Iadas AM_CFLAGS = \ -D_FORTIFY_SOURCE=2\ -D_DEBUG -Wall -Wno-write-strings\ -g AM_CXXFLAGS = \ -D_FORTIFY_SOURCE=2\ -D_DEBUG -Wall -Wno-write-strings\ -g berusky2_SOURCES = \ kofola/3D_graphic.cpp\ kofola/3D_graphic.h\ kofola/3D_menus.cpp\ kofola/3D_menus.h\ kofola/3d_math.cpp\ kofola/3d_math.h\ kofola/Bind.cpp\ kofola/Bind.h\ kofola/Camera.cpp\ kofola/Comics.cpp\ kofola/Comics.h\ kofola/Command.cpp\ kofola/Command.h\ kofola/Dda.cpp\ kofola/Dda.h\ kofola/Demo.cpp\ kofola/Demo.h\ kofola/Init.cpp\ kofola/Menu.cpp\ kofola/Menu.h\ kofola/Menu2.cpp\ kofola/Menu2.h\ kofola/Object.h\ kofola/Setup.h\ kofola/Tools.cpp\ kofola/Tools.h\ kofola/animend_functions.cpp\ kofola/animend_functions.h\ kofola/camera.h\ kofola/codec.h\ kofola/config_types.h\ kofola/controls.cpp\ kofola/controls.h\ kofola/controls3d.cpp\ kofola/controls3d.h\ kofola/credits.cpp\ kofola/credits.h\ kofola/font.cpp\ kofola/font.h\ kofola/font3d.cpp\ kofola/font3d.h\ kofola/game_init.cpp\ kofola/game_init.h\ kofola/game_logic.cpp\ kofola/game_logic.h\ kofola/game_main.cpp\ kofola/game_main.h\ kofola/grammar.cpp\ kofola/grammar.h\ kofola/init.h\ kofola/level_environment.h\ kofola/load_level.cpp\ kofola/load_level.h\ kofola/menu_def.h\ kofola/menu_script.cpp\ kofola/menu_script.h\ kofola/profiles.cpp\ kofola/profiles.h\ kofola/secure.h\ kofola/setup.cpp\ kofola/square_cut.cpp\ kofola/square_cut.h\ kofola/trigers.cpp\ kofola/trigers.h\ kofola/volume.cpp\ kofola/volume.h\ kofola/water.cpp\ kofola/water.h\ komat/3d_all.h\ komat/3d_typy.h\ komat/3dinterface.cpp\ komat/3dinterface.h\ komat/Berusky3d.cpp\ komat/Berusky3d.h\ komat/Berusky3d_castice.cpp\ komat/Berusky3d_castice.h\ komat/Berusky3d_castice2.h\ komat/Berusky3d_ini.cpp\ komat/Berusky3d_ini.h\ komat/Berusky3d_kamery.cpp\ komat/Berusky3d_kamery.h\ komat/Berusky3d_kofola2d.cpp\ komat/Berusky3d_kofola2d.h\ komat/Berusky3d_kofola_interface.cpp\ komat/Berusky3d_kofola_interface.h\ komat/Berusky3d_light.cpp\ komat/Berusky3d_light.h\ komat/Berusky3d_load.cpp\ komat/Berusky3d_load.h\ komat/Berusky3d_render.cpp\ komat/Berusky3d_render.h\ komat/Berusky_universal.h\ komat/Ddx.h\ komat/Di.cpp\ komat/Di.h\ komat/Load.cpp\ komat/Load.h\ komat/Load_chunks.cpp\ komat/Load_chunks.h\ komat/Load_out.cpp\ komat/Load_out.h\ komat/kfile.h\ komat/mmalloc.h\ komat/zlib_io.h\ tmp/compat.cpp\ tmp/compat.h\ kofola/2D_graphic.cpp\ kofola/2D_graphic.h\ age/graph/age.cpp\ age/graph/age.h\ age/graph/alpha.cpp\ age/graph/alpha.h\ age/graph/animation.cpp\ age/graph/animation.h\ age/graph/animation_time.cpp\ age/graph/animation_time.h\ age/graph/animation_track.cpp\ age/graph/animation_track.h\ age/graph/animation_track_bezier.cpp\ age/graph/animation_track_bezier.h\ age/graph/animation_track_linear.cpp\ age/graph/animation_track_linear.h\ age/graph/bitmap.cpp\ age/graph/bitmap.h\ age/graph/box.cpp\ age/graph/box.h\ age/graph/camera.cpp\ age/graph/camera.h\ age/graph/camera_interface.cpp\ age/graph/camera_interface.h\ age/graph/color.cpp\ age/graph/color.h\ age/graph/color_helpers.h\ age/graph/color_hsv.cpp\ age/graph/color_hsv.h\ age/graph/color_operators.h\ age/graph/draw.cpp\ age/graph/draw.h\ age/graph/ferguson.cpp\ age/graph/ferguson.h\ age/graph/gext.cpp\ age/graph/gext.h\ age/graph/glwrapper.cpp\ age/graph/glwrapper.h\ age/graph/gpipe.cpp\ age/graph/gpipe.h\ age/graph/graph3d.cpp\ age/graph/graph3d.h\ age/graph/intersect.cpp\ age/graph/intersect.h\ age/graph/lighting.cpp\ age/graph/lighting.h\ age/graph/material.cpp\ age/graph/material.h\ age/graph/material_texture.cpp\ age/graph/material_texture.h\ age/graph/matrix.cpp\ age/graph/matrix.h\ age/graph/matrix_animated.cpp\ age/graph/matrix_animated.h\ age/graph/matrix_notified.cpp\ age/graph/matrix_notified.h\ age/graph/mesh.cpp\ age/graph/mesh.h\ age/graph/normals.cpp\ age/graph/normals.h\ age/graph/obb.cpp\ age/graph/obb.h\ age/graph/object_base.cpp\ age/graph/object_base.h\ age/graph/object_box.cpp\ age/graph/object_box.h\ age/graph/object_geometry.cpp\ age/graph/object_geometry.h\ age/graph/object_hierarchy.cpp\ age/graph/object_hierarchy.h\ age/graph/object_list.cpp\ age/graph/object_list.h\ age/graph/object_mark.h\ age/graph/object_name.h\ age/graph/object_render_list.cpp\ age/graph/object_render_list.h\ age/graph/object_scene.cpp\ age/graph/object_scene.h\ age/graph/object_select.h\ age/graph/object_transformation.cpp\ age/graph/object_transformation.h\ age/graph/object_world.cpp\ age/graph/object_world.h\ age/graph/polar.cpp\ age/graph/polar.h\ age/graph/print.cpp\ age/graph/print.h\ age/graph/quat.h\ age/graph/scene.cpp\ age/graph/scene.h\ age/graph/scene_import_3ds.cpp\ age/graph/scene_import_3ds.h\ age/graph/scene_import_b2m.cpp\ age/graph/scene_import_b2m.h\ age/graph/scene_import_txt.cpp\ age/graph/scene_import_txt.h\ age/graph/scene_load.cpp\ age/graph/scene_load.h\ age/graph/scene_reference.h\ age/graph/selection.cpp\ age/graph/selection.h\ age/graph/surface.cpp\ age/graph/surface.h\ age/graph/surface_height.cpp\ age/graph/surface_height.h\ age/graph/surface_mask.cpp\ age/graph/surface_mask.h\ age/graph/surface_sdl.cpp\ age/graph/surface_sdl.h\ age/graph/surface_sw.cpp\ age/graph/surface_sw.h\ age/graph/texture_func.cpp\ age/graph/texture_func.h\ age/graph/texture_unit.cpp\ age/graph/texture_unit.h\ age/graph/triangle.cpp\ age/graph/triangle.h\ age/graph/vector.cpp\ age/graph/vector.h\ age/graph/vector_operators.h\ age/graph/vertex_arrays.cpp\ age/graph/vertex_arrays.h\ age/graph/world_interface.cpp\ age/graph/world_interface.h\ age/include/compatibility.h\ age/include/defs.h\ age/include/defs_config.h\ age/include/floats.h\ age/include/opengl.h\ age/include/typ.h\ age/include/typ_graph.h\ age/support/age_main.cpp\ age/support/age_main.h\ age/support/events.cpp\ age/support/events.h\ age/support/events_types.h\ age/support/input.cpp\ age/support/input.h\ age/support/timer.cpp\ age/support/timer.h\ age/utils/array.h\ age/utils/barray.h\ age/utils/btree.h\ age/utils/change.cpp\ age/utils/change.h\ age/utils/data_file.cpp\ age/utils/data_file.h\ age/utils/flag.h\ age/utils/ini.cpp\ age/utils/ini.h\ age/utils/llist.h\ age/utils/llist_named.h\ age/utils/lock.h\ age/utils/log.cpp\ age/utils/log.h\ age/utils/mem_alloc.cpp\ age/utils/mem_alloc.h\ age/utils/mtree.cpp\ age/utils/mtree.h\ age/utils/mtree_named.h\ age/utils/stack.h\ age/utils/types.h\ age/utils/utils.cpp\ age/utils/utils.h\ kofola/animationk.cpp\ kofola/animationk.h\ generator/generator_random.cpp\ generator/generator_random.h\ komat/Ddx.cpp\ komat/kfile.cpp\ komat/Mat3d.h\ komat/3dmath.h\ komat/3dproject.h\ komat/Keyframe.h\ komat/Quat.h\ komat/Berusky3d_animace.cpp\ komat/Berusky3d_animace.h\ komat/3dmath.cpp\ komat/3dproject.cpp\ komat/Mat3d.cpp\ komat/Keyframe.cpp\ komat/Texture.cpp\ komat/Texture.h\ komat/Texture_import.cpp\ komat/Texture_import.h\ komat/obbo.cpp\ komat/obbo.h\ komat/Kdtree.cpp\ komat/Kdtree.h\ komat/Matrix.h\ komat/Vektor.h\ kofola/ambient_sounds.h\ komat/json_export.cpp\ komat/json_export.h\ kofola/ambient_sounds.cpp\ kofola/audio_plug-in.cpp\ kofola/audio_plug-in.h\ adas/3d_math_k.c\ adas/3d_math_k.h\ adas/adas.c\ adas/adas.h\ adas/adas_types.h\ adas/ogg_io.c\ adas/ogg_io.h\ adas/ogg_stream.c\ adas/ogg_stream.h\ tmp/compat_mini.cpp\ tmp/compat_mini.h\ tmp/alut_test.cpp\ age/graph/aabb.cpp\ age/graph/aabb.h berusky2_LDFLAGS = berusky2_LDADD = all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list berusky2$(EXEEXT): $(berusky2_OBJECTS) $(berusky2_DEPENDENCIES) $(EXTRA_berusky2_DEPENDENCIES) @rm -f berusky2$(EXEEXT) $(AM_V_CXXLD)$(berusky2_LINK) $(berusky2_OBJECTS) $(berusky2_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/2D_graphic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3D_graphic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3D_menus.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3d_math.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3d_math_k.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3dinterface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3dmath.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3dproject.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_animace.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_castice.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_ini.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_kamery.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_kofola2d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_kofola_interface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_light.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_load.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Berusky3d_render.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bind.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Camera.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Comics.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Command.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Dda.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Ddx.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Demo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Di.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Init.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Kdtree.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Keyframe.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Load.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Load_chunks.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Load_out.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mat3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Menu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Menu2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Texture.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Texture_import.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Tools.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aabb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adas.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/age.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/age_main.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alut_test.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ambient_sounds.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_time.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_track.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_track_bezier.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_track_linear.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animationk.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animend_functions.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_plug-in.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera_interface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/change.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color_hsv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat_mini.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controls.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controls3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/credits.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_file.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/draw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/events.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ferguson.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_init.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_logic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_main.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generator_random.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glwrapper.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpipe.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grammar.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graph3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intersect.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json_export.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_level.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material_texture.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix_animated.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix_notified.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem_alloc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_script.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mesh.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtree.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/normals.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obbo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_base.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_box.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_geometry.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_hierarchy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_list.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_render_list.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_scene.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_transformation.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_world.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_io.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_stream.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/polar.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/profiles.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scene.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scene_import_3ds.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scene_import_b2m.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scene_import_txt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scene_load.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selection.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/square_cut.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_height.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_mask.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_sdl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_sw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture_func.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture_unit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/triangle.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trigers.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vertex_arrays.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/water.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world_interface.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< 3d_math_k.o: adas/3d_math_k.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 3d_math_k.o -MD -MP -MF $(DEPDIR)/3d_math_k.Tpo -c -o 3d_math_k.o `test -f 'adas/3d_math_k.c' || echo '$(srcdir)/'`adas/3d_math_k.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3d_math_k.Tpo $(DEPDIR)/3d_math_k.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/3d_math_k.c' object='3d_math_k.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 3d_math_k.o `test -f 'adas/3d_math_k.c' || echo '$(srcdir)/'`adas/3d_math_k.c 3d_math_k.obj: adas/3d_math_k.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 3d_math_k.obj -MD -MP -MF $(DEPDIR)/3d_math_k.Tpo -c -o 3d_math_k.obj `if test -f 'adas/3d_math_k.c'; then $(CYGPATH_W) 'adas/3d_math_k.c'; else $(CYGPATH_W) '$(srcdir)/adas/3d_math_k.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3d_math_k.Tpo $(DEPDIR)/3d_math_k.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/3d_math_k.c' object='3d_math_k.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 3d_math_k.obj `if test -f 'adas/3d_math_k.c'; then $(CYGPATH_W) 'adas/3d_math_k.c'; else $(CYGPATH_W) '$(srcdir)/adas/3d_math_k.c'; fi` adas.o: adas/adas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adas.o -MD -MP -MF $(DEPDIR)/adas.Tpo -c -o adas.o `test -f 'adas/adas.c' || echo '$(srcdir)/'`adas/adas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adas.Tpo $(DEPDIR)/adas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/adas.c' object='adas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adas.o `test -f 'adas/adas.c' || echo '$(srcdir)/'`adas/adas.c adas.obj: adas/adas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adas.obj -MD -MP -MF $(DEPDIR)/adas.Tpo -c -o adas.obj `if test -f 'adas/adas.c'; then $(CYGPATH_W) 'adas/adas.c'; else $(CYGPATH_W) '$(srcdir)/adas/adas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adas.Tpo $(DEPDIR)/adas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/adas.c' object='adas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adas.obj `if test -f 'adas/adas.c'; then $(CYGPATH_W) 'adas/adas.c'; else $(CYGPATH_W) '$(srcdir)/adas/adas.c'; fi` ogg_io.o: adas/ogg_io.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ogg_io.o -MD -MP -MF $(DEPDIR)/ogg_io.Tpo -c -o ogg_io.o `test -f 'adas/ogg_io.c' || echo '$(srcdir)/'`adas/ogg_io.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ogg_io.Tpo $(DEPDIR)/ogg_io.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/ogg_io.c' object='ogg_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ogg_io.o `test -f 'adas/ogg_io.c' || echo '$(srcdir)/'`adas/ogg_io.c ogg_io.obj: adas/ogg_io.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ogg_io.obj -MD -MP -MF $(DEPDIR)/ogg_io.Tpo -c -o ogg_io.obj `if test -f 'adas/ogg_io.c'; then $(CYGPATH_W) 'adas/ogg_io.c'; else $(CYGPATH_W) '$(srcdir)/adas/ogg_io.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ogg_io.Tpo $(DEPDIR)/ogg_io.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/ogg_io.c' object='ogg_io.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ogg_io.obj `if test -f 'adas/ogg_io.c'; then $(CYGPATH_W) 'adas/ogg_io.c'; else $(CYGPATH_W) '$(srcdir)/adas/ogg_io.c'; fi` ogg_stream.o: adas/ogg_stream.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ogg_stream.o -MD -MP -MF $(DEPDIR)/ogg_stream.Tpo -c -o ogg_stream.o `test -f 'adas/ogg_stream.c' || echo '$(srcdir)/'`adas/ogg_stream.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ogg_stream.Tpo $(DEPDIR)/ogg_stream.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/ogg_stream.c' object='ogg_stream.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ogg_stream.o `test -f 'adas/ogg_stream.c' || echo '$(srcdir)/'`adas/ogg_stream.c ogg_stream.obj: adas/ogg_stream.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ogg_stream.obj -MD -MP -MF $(DEPDIR)/ogg_stream.Tpo -c -o ogg_stream.obj `if test -f 'adas/ogg_stream.c'; then $(CYGPATH_W) 'adas/ogg_stream.c'; else $(CYGPATH_W) '$(srcdir)/adas/ogg_stream.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ogg_stream.Tpo $(DEPDIR)/ogg_stream.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adas/ogg_stream.c' object='ogg_stream.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ogg_stream.obj `if test -f 'adas/ogg_stream.c'; then $(CYGPATH_W) 'adas/ogg_stream.c'; else $(CYGPATH_W) '$(srcdir)/adas/ogg_stream.c'; fi` .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< 3D_graphic.o: kofola/3D_graphic.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3D_graphic.o -MD -MP -MF $(DEPDIR)/3D_graphic.Tpo -c -o 3D_graphic.o `test -f 'kofola/3D_graphic.cpp' || echo '$(srcdir)/'`kofola/3D_graphic.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3D_graphic.Tpo $(DEPDIR)/3D_graphic.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/3D_graphic.cpp' object='3D_graphic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3D_graphic.o `test -f 'kofola/3D_graphic.cpp' || echo '$(srcdir)/'`kofola/3D_graphic.cpp 3D_graphic.obj: kofola/3D_graphic.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3D_graphic.obj -MD -MP -MF $(DEPDIR)/3D_graphic.Tpo -c -o 3D_graphic.obj `if test -f 'kofola/3D_graphic.cpp'; then $(CYGPATH_W) 'kofola/3D_graphic.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/3D_graphic.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3D_graphic.Tpo $(DEPDIR)/3D_graphic.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/3D_graphic.cpp' object='3D_graphic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3D_graphic.obj `if test -f 'kofola/3D_graphic.cpp'; then $(CYGPATH_W) 'kofola/3D_graphic.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/3D_graphic.cpp'; fi` 3D_menus.o: kofola/3D_menus.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3D_menus.o -MD -MP -MF $(DEPDIR)/3D_menus.Tpo -c -o 3D_menus.o `test -f 'kofola/3D_menus.cpp' || echo '$(srcdir)/'`kofola/3D_menus.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3D_menus.Tpo $(DEPDIR)/3D_menus.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/3D_menus.cpp' object='3D_menus.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3D_menus.o `test -f 'kofola/3D_menus.cpp' || echo '$(srcdir)/'`kofola/3D_menus.cpp 3D_menus.obj: kofola/3D_menus.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3D_menus.obj -MD -MP -MF $(DEPDIR)/3D_menus.Tpo -c -o 3D_menus.obj `if test -f 'kofola/3D_menus.cpp'; then $(CYGPATH_W) 'kofola/3D_menus.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/3D_menus.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3D_menus.Tpo $(DEPDIR)/3D_menus.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/3D_menus.cpp' object='3D_menus.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3D_menus.obj `if test -f 'kofola/3D_menus.cpp'; then $(CYGPATH_W) 'kofola/3D_menus.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/3D_menus.cpp'; fi` 3d_math.o: kofola/3d_math.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3d_math.o -MD -MP -MF $(DEPDIR)/3d_math.Tpo -c -o 3d_math.o `test -f 'kofola/3d_math.cpp' || echo '$(srcdir)/'`kofola/3d_math.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3d_math.Tpo $(DEPDIR)/3d_math.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/3d_math.cpp' object='3d_math.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3d_math.o `test -f 'kofola/3d_math.cpp' || echo '$(srcdir)/'`kofola/3d_math.cpp 3d_math.obj: kofola/3d_math.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3d_math.obj -MD -MP -MF $(DEPDIR)/3d_math.Tpo -c -o 3d_math.obj `if test -f 'kofola/3d_math.cpp'; then $(CYGPATH_W) 'kofola/3d_math.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/3d_math.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3d_math.Tpo $(DEPDIR)/3d_math.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/3d_math.cpp' object='3d_math.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3d_math.obj `if test -f 'kofola/3d_math.cpp'; then $(CYGPATH_W) 'kofola/3d_math.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/3d_math.cpp'; fi` Bind.o: kofola/Bind.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Bind.o -MD -MP -MF $(DEPDIR)/Bind.Tpo -c -o Bind.o `test -f 'kofola/Bind.cpp' || echo '$(srcdir)/'`kofola/Bind.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Bind.Tpo $(DEPDIR)/Bind.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Bind.cpp' object='Bind.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Bind.o `test -f 'kofola/Bind.cpp' || echo '$(srcdir)/'`kofola/Bind.cpp Bind.obj: kofola/Bind.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Bind.obj -MD -MP -MF $(DEPDIR)/Bind.Tpo -c -o Bind.obj `if test -f 'kofola/Bind.cpp'; then $(CYGPATH_W) 'kofola/Bind.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Bind.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Bind.Tpo $(DEPDIR)/Bind.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Bind.cpp' object='Bind.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Bind.obj `if test -f 'kofola/Bind.cpp'; then $(CYGPATH_W) 'kofola/Bind.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Bind.cpp'; fi` Camera.o: kofola/Camera.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Camera.o -MD -MP -MF $(DEPDIR)/Camera.Tpo -c -o Camera.o `test -f 'kofola/Camera.cpp' || echo '$(srcdir)/'`kofola/Camera.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Camera.Tpo $(DEPDIR)/Camera.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Camera.cpp' object='Camera.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Camera.o `test -f 'kofola/Camera.cpp' || echo '$(srcdir)/'`kofola/Camera.cpp Camera.obj: kofola/Camera.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Camera.obj -MD -MP -MF $(DEPDIR)/Camera.Tpo -c -o Camera.obj `if test -f 'kofola/Camera.cpp'; then $(CYGPATH_W) 'kofola/Camera.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Camera.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Camera.Tpo $(DEPDIR)/Camera.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Camera.cpp' object='Camera.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Camera.obj `if test -f 'kofola/Camera.cpp'; then $(CYGPATH_W) 'kofola/Camera.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Camera.cpp'; fi` Comics.o: kofola/Comics.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Comics.o -MD -MP -MF $(DEPDIR)/Comics.Tpo -c -o Comics.o `test -f 'kofola/Comics.cpp' || echo '$(srcdir)/'`kofola/Comics.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Comics.Tpo $(DEPDIR)/Comics.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Comics.cpp' object='Comics.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Comics.o `test -f 'kofola/Comics.cpp' || echo '$(srcdir)/'`kofola/Comics.cpp Comics.obj: kofola/Comics.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Comics.obj -MD -MP -MF $(DEPDIR)/Comics.Tpo -c -o Comics.obj `if test -f 'kofola/Comics.cpp'; then $(CYGPATH_W) 'kofola/Comics.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Comics.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Comics.Tpo $(DEPDIR)/Comics.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Comics.cpp' object='Comics.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Comics.obj `if test -f 'kofola/Comics.cpp'; then $(CYGPATH_W) 'kofola/Comics.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Comics.cpp'; fi` Command.o: kofola/Command.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Command.o -MD -MP -MF $(DEPDIR)/Command.Tpo -c -o Command.o `test -f 'kofola/Command.cpp' || echo '$(srcdir)/'`kofola/Command.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Command.Tpo $(DEPDIR)/Command.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Command.cpp' object='Command.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Command.o `test -f 'kofola/Command.cpp' || echo '$(srcdir)/'`kofola/Command.cpp Command.obj: kofola/Command.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Command.obj -MD -MP -MF $(DEPDIR)/Command.Tpo -c -o Command.obj `if test -f 'kofola/Command.cpp'; then $(CYGPATH_W) 'kofola/Command.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Command.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Command.Tpo $(DEPDIR)/Command.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Command.cpp' object='Command.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Command.obj `if test -f 'kofola/Command.cpp'; then $(CYGPATH_W) 'kofola/Command.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Command.cpp'; fi` Dda.o: kofola/Dda.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Dda.o -MD -MP -MF $(DEPDIR)/Dda.Tpo -c -o Dda.o `test -f 'kofola/Dda.cpp' || echo '$(srcdir)/'`kofola/Dda.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Dda.Tpo $(DEPDIR)/Dda.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Dda.cpp' object='Dda.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Dda.o `test -f 'kofola/Dda.cpp' || echo '$(srcdir)/'`kofola/Dda.cpp Dda.obj: kofola/Dda.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Dda.obj -MD -MP -MF $(DEPDIR)/Dda.Tpo -c -o Dda.obj `if test -f 'kofola/Dda.cpp'; then $(CYGPATH_W) 'kofola/Dda.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Dda.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Dda.Tpo $(DEPDIR)/Dda.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Dda.cpp' object='Dda.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Dda.obj `if test -f 'kofola/Dda.cpp'; then $(CYGPATH_W) 'kofola/Dda.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Dda.cpp'; fi` Demo.o: kofola/Demo.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Demo.o -MD -MP -MF $(DEPDIR)/Demo.Tpo -c -o Demo.o `test -f 'kofola/Demo.cpp' || echo '$(srcdir)/'`kofola/Demo.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Demo.Tpo $(DEPDIR)/Demo.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Demo.cpp' object='Demo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Demo.o `test -f 'kofola/Demo.cpp' || echo '$(srcdir)/'`kofola/Demo.cpp Demo.obj: kofola/Demo.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Demo.obj -MD -MP -MF $(DEPDIR)/Demo.Tpo -c -o Demo.obj `if test -f 'kofola/Demo.cpp'; then $(CYGPATH_W) 'kofola/Demo.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Demo.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Demo.Tpo $(DEPDIR)/Demo.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Demo.cpp' object='Demo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Demo.obj `if test -f 'kofola/Demo.cpp'; then $(CYGPATH_W) 'kofola/Demo.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Demo.cpp'; fi` Init.o: kofola/Init.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Init.o -MD -MP -MF $(DEPDIR)/Init.Tpo -c -o Init.o `test -f 'kofola/Init.cpp' || echo '$(srcdir)/'`kofola/Init.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Init.Tpo $(DEPDIR)/Init.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Init.cpp' object='Init.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Init.o `test -f 'kofola/Init.cpp' || echo '$(srcdir)/'`kofola/Init.cpp Init.obj: kofola/Init.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Init.obj -MD -MP -MF $(DEPDIR)/Init.Tpo -c -o Init.obj `if test -f 'kofola/Init.cpp'; then $(CYGPATH_W) 'kofola/Init.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Init.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Init.Tpo $(DEPDIR)/Init.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Init.cpp' object='Init.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Init.obj `if test -f 'kofola/Init.cpp'; then $(CYGPATH_W) 'kofola/Init.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Init.cpp'; fi` Menu.o: kofola/Menu.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Menu.o -MD -MP -MF $(DEPDIR)/Menu.Tpo -c -o Menu.o `test -f 'kofola/Menu.cpp' || echo '$(srcdir)/'`kofola/Menu.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Menu.Tpo $(DEPDIR)/Menu.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Menu.cpp' object='Menu.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Menu.o `test -f 'kofola/Menu.cpp' || echo '$(srcdir)/'`kofola/Menu.cpp Menu.obj: kofola/Menu.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Menu.obj -MD -MP -MF $(DEPDIR)/Menu.Tpo -c -o Menu.obj `if test -f 'kofola/Menu.cpp'; then $(CYGPATH_W) 'kofola/Menu.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Menu.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Menu.Tpo $(DEPDIR)/Menu.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Menu.cpp' object='Menu.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Menu.obj `if test -f 'kofola/Menu.cpp'; then $(CYGPATH_W) 'kofola/Menu.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Menu.cpp'; fi` Menu2.o: kofola/Menu2.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Menu2.o -MD -MP -MF $(DEPDIR)/Menu2.Tpo -c -o Menu2.o `test -f 'kofola/Menu2.cpp' || echo '$(srcdir)/'`kofola/Menu2.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Menu2.Tpo $(DEPDIR)/Menu2.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Menu2.cpp' object='Menu2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Menu2.o `test -f 'kofola/Menu2.cpp' || echo '$(srcdir)/'`kofola/Menu2.cpp Menu2.obj: kofola/Menu2.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Menu2.obj -MD -MP -MF $(DEPDIR)/Menu2.Tpo -c -o Menu2.obj `if test -f 'kofola/Menu2.cpp'; then $(CYGPATH_W) 'kofola/Menu2.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Menu2.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Menu2.Tpo $(DEPDIR)/Menu2.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Menu2.cpp' object='Menu2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Menu2.obj `if test -f 'kofola/Menu2.cpp'; then $(CYGPATH_W) 'kofola/Menu2.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Menu2.cpp'; fi` Tools.o: kofola/Tools.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Tools.o -MD -MP -MF $(DEPDIR)/Tools.Tpo -c -o Tools.o `test -f 'kofola/Tools.cpp' || echo '$(srcdir)/'`kofola/Tools.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Tools.Tpo $(DEPDIR)/Tools.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Tools.cpp' object='Tools.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Tools.o `test -f 'kofola/Tools.cpp' || echo '$(srcdir)/'`kofola/Tools.cpp Tools.obj: kofola/Tools.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Tools.obj -MD -MP -MF $(DEPDIR)/Tools.Tpo -c -o Tools.obj `if test -f 'kofola/Tools.cpp'; then $(CYGPATH_W) 'kofola/Tools.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Tools.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Tools.Tpo $(DEPDIR)/Tools.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/Tools.cpp' object='Tools.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Tools.obj `if test -f 'kofola/Tools.cpp'; then $(CYGPATH_W) 'kofola/Tools.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/Tools.cpp'; fi` animend_functions.o: kofola/animend_functions.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animend_functions.o -MD -MP -MF $(DEPDIR)/animend_functions.Tpo -c -o animend_functions.o `test -f 'kofola/animend_functions.cpp' || echo '$(srcdir)/'`kofola/animend_functions.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animend_functions.Tpo $(DEPDIR)/animend_functions.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/animend_functions.cpp' object='animend_functions.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animend_functions.o `test -f 'kofola/animend_functions.cpp' || echo '$(srcdir)/'`kofola/animend_functions.cpp animend_functions.obj: kofola/animend_functions.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animend_functions.obj -MD -MP -MF $(DEPDIR)/animend_functions.Tpo -c -o animend_functions.obj `if test -f 'kofola/animend_functions.cpp'; then $(CYGPATH_W) 'kofola/animend_functions.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/animend_functions.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animend_functions.Tpo $(DEPDIR)/animend_functions.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/animend_functions.cpp' object='animend_functions.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animend_functions.obj `if test -f 'kofola/animend_functions.cpp'; then $(CYGPATH_W) 'kofola/animend_functions.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/animend_functions.cpp'; fi` controls.o: kofola/controls.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT controls.o -MD -MP -MF $(DEPDIR)/controls.Tpo -c -o controls.o `test -f 'kofola/controls.cpp' || echo '$(srcdir)/'`kofola/controls.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controls.Tpo $(DEPDIR)/controls.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/controls.cpp' object='controls.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o controls.o `test -f 'kofola/controls.cpp' || echo '$(srcdir)/'`kofola/controls.cpp controls.obj: kofola/controls.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT controls.obj -MD -MP -MF $(DEPDIR)/controls.Tpo -c -o controls.obj `if test -f 'kofola/controls.cpp'; then $(CYGPATH_W) 'kofola/controls.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/controls.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controls.Tpo $(DEPDIR)/controls.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/controls.cpp' object='controls.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o controls.obj `if test -f 'kofola/controls.cpp'; then $(CYGPATH_W) 'kofola/controls.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/controls.cpp'; fi` controls3d.o: kofola/controls3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT controls3d.o -MD -MP -MF $(DEPDIR)/controls3d.Tpo -c -o controls3d.o `test -f 'kofola/controls3d.cpp' || echo '$(srcdir)/'`kofola/controls3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controls3d.Tpo $(DEPDIR)/controls3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/controls3d.cpp' object='controls3d.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o controls3d.o `test -f 'kofola/controls3d.cpp' || echo '$(srcdir)/'`kofola/controls3d.cpp controls3d.obj: kofola/controls3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT controls3d.obj -MD -MP -MF $(DEPDIR)/controls3d.Tpo -c -o controls3d.obj `if test -f 'kofola/controls3d.cpp'; then $(CYGPATH_W) 'kofola/controls3d.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/controls3d.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controls3d.Tpo $(DEPDIR)/controls3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/controls3d.cpp' object='controls3d.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o controls3d.obj `if test -f 'kofola/controls3d.cpp'; then $(CYGPATH_W) 'kofola/controls3d.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/controls3d.cpp'; fi` credits.o: kofola/credits.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT credits.o -MD -MP -MF $(DEPDIR)/credits.Tpo -c -o credits.o `test -f 'kofola/credits.cpp' || echo '$(srcdir)/'`kofola/credits.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/credits.Tpo $(DEPDIR)/credits.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/credits.cpp' object='credits.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o credits.o `test -f 'kofola/credits.cpp' || echo '$(srcdir)/'`kofola/credits.cpp credits.obj: kofola/credits.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT credits.obj -MD -MP -MF $(DEPDIR)/credits.Tpo -c -o credits.obj `if test -f 'kofola/credits.cpp'; then $(CYGPATH_W) 'kofola/credits.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/credits.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/credits.Tpo $(DEPDIR)/credits.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/credits.cpp' object='credits.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o credits.obj `if test -f 'kofola/credits.cpp'; then $(CYGPATH_W) 'kofola/credits.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/credits.cpp'; fi` font.o: kofola/font.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font.o -MD -MP -MF $(DEPDIR)/font.Tpo -c -o font.o `test -f 'kofola/font.cpp' || echo '$(srcdir)/'`kofola/font.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/font.Tpo $(DEPDIR)/font.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/font.cpp' object='font.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font.o `test -f 'kofola/font.cpp' || echo '$(srcdir)/'`kofola/font.cpp font.obj: kofola/font.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font.obj -MD -MP -MF $(DEPDIR)/font.Tpo -c -o font.obj `if test -f 'kofola/font.cpp'; then $(CYGPATH_W) 'kofola/font.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/font.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/font.Tpo $(DEPDIR)/font.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/font.cpp' object='font.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font.obj `if test -f 'kofola/font.cpp'; then $(CYGPATH_W) 'kofola/font.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/font.cpp'; fi` font3d.o: kofola/font3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font3d.o -MD -MP -MF $(DEPDIR)/font3d.Tpo -c -o font3d.o `test -f 'kofola/font3d.cpp' || echo '$(srcdir)/'`kofola/font3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/font3d.Tpo $(DEPDIR)/font3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/font3d.cpp' object='font3d.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font3d.o `test -f 'kofola/font3d.cpp' || echo '$(srcdir)/'`kofola/font3d.cpp font3d.obj: kofola/font3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font3d.obj -MD -MP -MF $(DEPDIR)/font3d.Tpo -c -o font3d.obj `if test -f 'kofola/font3d.cpp'; then $(CYGPATH_W) 'kofola/font3d.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/font3d.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/font3d.Tpo $(DEPDIR)/font3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/font3d.cpp' object='font3d.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font3d.obj `if test -f 'kofola/font3d.cpp'; then $(CYGPATH_W) 'kofola/font3d.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/font3d.cpp'; fi` game_init.o: kofola/game_init.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT game_init.o -MD -MP -MF $(DEPDIR)/game_init.Tpo -c -o game_init.o `test -f 'kofola/game_init.cpp' || echo '$(srcdir)/'`kofola/game_init.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/game_init.Tpo $(DEPDIR)/game_init.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/game_init.cpp' object='game_init.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o game_init.o `test -f 'kofola/game_init.cpp' || echo '$(srcdir)/'`kofola/game_init.cpp game_init.obj: kofola/game_init.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT game_init.obj -MD -MP -MF $(DEPDIR)/game_init.Tpo -c -o game_init.obj `if test -f 'kofola/game_init.cpp'; then $(CYGPATH_W) 'kofola/game_init.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/game_init.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/game_init.Tpo $(DEPDIR)/game_init.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/game_init.cpp' object='game_init.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o game_init.obj `if test -f 'kofola/game_init.cpp'; then $(CYGPATH_W) 'kofola/game_init.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/game_init.cpp'; fi` game_logic.o: kofola/game_logic.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT game_logic.o -MD -MP -MF $(DEPDIR)/game_logic.Tpo -c -o game_logic.o `test -f 'kofola/game_logic.cpp' || echo '$(srcdir)/'`kofola/game_logic.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/game_logic.Tpo $(DEPDIR)/game_logic.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/game_logic.cpp' object='game_logic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o game_logic.o `test -f 'kofola/game_logic.cpp' || echo '$(srcdir)/'`kofola/game_logic.cpp game_logic.obj: kofola/game_logic.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT game_logic.obj -MD -MP -MF $(DEPDIR)/game_logic.Tpo -c -o game_logic.obj `if test -f 'kofola/game_logic.cpp'; then $(CYGPATH_W) 'kofola/game_logic.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/game_logic.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/game_logic.Tpo $(DEPDIR)/game_logic.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/game_logic.cpp' object='game_logic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o game_logic.obj `if test -f 'kofola/game_logic.cpp'; then $(CYGPATH_W) 'kofola/game_logic.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/game_logic.cpp'; fi` game_main.o: kofola/game_main.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT game_main.o -MD -MP -MF $(DEPDIR)/game_main.Tpo -c -o game_main.o `test -f 'kofola/game_main.cpp' || echo '$(srcdir)/'`kofola/game_main.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/game_main.Tpo $(DEPDIR)/game_main.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/game_main.cpp' object='game_main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o game_main.o `test -f 'kofola/game_main.cpp' || echo '$(srcdir)/'`kofola/game_main.cpp game_main.obj: kofola/game_main.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT game_main.obj -MD -MP -MF $(DEPDIR)/game_main.Tpo -c -o game_main.obj `if test -f 'kofola/game_main.cpp'; then $(CYGPATH_W) 'kofola/game_main.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/game_main.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/game_main.Tpo $(DEPDIR)/game_main.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/game_main.cpp' object='game_main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o game_main.obj `if test -f 'kofola/game_main.cpp'; then $(CYGPATH_W) 'kofola/game_main.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/game_main.cpp'; fi` grammar.o: kofola/grammar.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT grammar.o -MD -MP -MF $(DEPDIR)/grammar.Tpo -c -o grammar.o `test -f 'kofola/grammar.cpp' || echo '$(srcdir)/'`kofola/grammar.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/grammar.Tpo $(DEPDIR)/grammar.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/grammar.cpp' object='grammar.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o grammar.o `test -f 'kofola/grammar.cpp' || echo '$(srcdir)/'`kofola/grammar.cpp grammar.obj: kofola/grammar.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT grammar.obj -MD -MP -MF $(DEPDIR)/grammar.Tpo -c -o grammar.obj `if test -f 'kofola/grammar.cpp'; then $(CYGPATH_W) 'kofola/grammar.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/grammar.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/grammar.Tpo $(DEPDIR)/grammar.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/grammar.cpp' object='grammar.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o grammar.obj `if test -f 'kofola/grammar.cpp'; then $(CYGPATH_W) 'kofola/grammar.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/grammar.cpp'; fi` load_level.o: kofola/load_level.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT load_level.o -MD -MP -MF $(DEPDIR)/load_level.Tpo -c -o load_level.o `test -f 'kofola/load_level.cpp' || echo '$(srcdir)/'`kofola/load_level.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/load_level.Tpo $(DEPDIR)/load_level.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/load_level.cpp' object='load_level.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o load_level.o `test -f 'kofola/load_level.cpp' || echo '$(srcdir)/'`kofola/load_level.cpp load_level.obj: kofola/load_level.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT load_level.obj -MD -MP -MF $(DEPDIR)/load_level.Tpo -c -o load_level.obj `if test -f 'kofola/load_level.cpp'; then $(CYGPATH_W) 'kofola/load_level.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/load_level.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/load_level.Tpo $(DEPDIR)/load_level.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/load_level.cpp' object='load_level.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o load_level.obj `if test -f 'kofola/load_level.cpp'; then $(CYGPATH_W) 'kofola/load_level.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/load_level.cpp'; fi` menu_script.o: kofola/menu_script.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT menu_script.o -MD -MP -MF $(DEPDIR)/menu_script.Tpo -c -o menu_script.o `test -f 'kofola/menu_script.cpp' || echo '$(srcdir)/'`kofola/menu_script.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/menu_script.Tpo $(DEPDIR)/menu_script.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/menu_script.cpp' object='menu_script.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o menu_script.o `test -f 'kofola/menu_script.cpp' || echo '$(srcdir)/'`kofola/menu_script.cpp menu_script.obj: kofola/menu_script.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT menu_script.obj -MD -MP -MF $(DEPDIR)/menu_script.Tpo -c -o menu_script.obj `if test -f 'kofola/menu_script.cpp'; then $(CYGPATH_W) 'kofola/menu_script.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/menu_script.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/menu_script.Tpo $(DEPDIR)/menu_script.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/menu_script.cpp' object='menu_script.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o menu_script.obj `if test -f 'kofola/menu_script.cpp'; then $(CYGPATH_W) 'kofola/menu_script.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/menu_script.cpp'; fi` profiles.o: kofola/profiles.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT profiles.o -MD -MP -MF $(DEPDIR)/profiles.Tpo -c -o profiles.o `test -f 'kofola/profiles.cpp' || echo '$(srcdir)/'`kofola/profiles.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/profiles.Tpo $(DEPDIR)/profiles.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/profiles.cpp' object='profiles.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o profiles.o `test -f 'kofola/profiles.cpp' || echo '$(srcdir)/'`kofola/profiles.cpp profiles.obj: kofola/profiles.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT profiles.obj -MD -MP -MF $(DEPDIR)/profiles.Tpo -c -o profiles.obj `if test -f 'kofola/profiles.cpp'; then $(CYGPATH_W) 'kofola/profiles.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/profiles.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/profiles.Tpo $(DEPDIR)/profiles.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/profiles.cpp' object='profiles.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o profiles.obj `if test -f 'kofola/profiles.cpp'; then $(CYGPATH_W) 'kofola/profiles.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/profiles.cpp'; fi` setup.o: kofola/setup.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT setup.o -MD -MP -MF $(DEPDIR)/setup.Tpo -c -o setup.o `test -f 'kofola/setup.cpp' || echo '$(srcdir)/'`kofola/setup.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/setup.Tpo $(DEPDIR)/setup.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/setup.cpp' object='setup.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o setup.o `test -f 'kofola/setup.cpp' || echo '$(srcdir)/'`kofola/setup.cpp setup.obj: kofola/setup.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT setup.obj -MD -MP -MF $(DEPDIR)/setup.Tpo -c -o setup.obj `if test -f 'kofola/setup.cpp'; then $(CYGPATH_W) 'kofola/setup.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/setup.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/setup.Tpo $(DEPDIR)/setup.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/setup.cpp' object='setup.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o setup.obj `if test -f 'kofola/setup.cpp'; then $(CYGPATH_W) 'kofola/setup.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/setup.cpp'; fi` square_cut.o: kofola/square_cut.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT square_cut.o -MD -MP -MF $(DEPDIR)/square_cut.Tpo -c -o square_cut.o `test -f 'kofola/square_cut.cpp' || echo '$(srcdir)/'`kofola/square_cut.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/square_cut.Tpo $(DEPDIR)/square_cut.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/square_cut.cpp' object='square_cut.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o square_cut.o `test -f 'kofola/square_cut.cpp' || echo '$(srcdir)/'`kofola/square_cut.cpp square_cut.obj: kofola/square_cut.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT square_cut.obj -MD -MP -MF $(DEPDIR)/square_cut.Tpo -c -o square_cut.obj `if test -f 'kofola/square_cut.cpp'; then $(CYGPATH_W) 'kofola/square_cut.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/square_cut.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/square_cut.Tpo $(DEPDIR)/square_cut.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/square_cut.cpp' object='square_cut.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o square_cut.obj `if test -f 'kofola/square_cut.cpp'; then $(CYGPATH_W) 'kofola/square_cut.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/square_cut.cpp'; fi` trigers.o: kofola/trigers.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT trigers.o -MD -MP -MF $(DEPDIR)/trigers.Tpo -c -o trigers.o `test -f 'kofola/trigers.cpp' || echo '$(srcdir)/'`kofola/trigers.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/trigers.Tpo $(DEPDIR)/trigers.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/trigers.cpp' object='trigers.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o trigers.o `test -f 'kofola/trigers.cpp' || echo '$(srcdir)/'`kofola/trigers.cpp trigers.obj: kofola/trigers.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT trigers.obj -MD -MP -MF $(DEPDIR)/trigers.Tpo -c -o trigers.obj `if test -f 'kofola/trigers.cpp'; then $(CYGPATH_W) 'kofola/trigers.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/trigers.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/trigers.Tpo $(DEPDIR)/trigers.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/trigers.cpp' object='trigers.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o trigers.obj `if test -f 'kofola/trigers.cpp'; then $(CYGPATH_W) 'kofola/trigers.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/trigers.cpp'; fi` volume.o: kofola/volume.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT volume.o -MD -MP -MF $(DEPDIR)/volume.Tpo -c -o volume.o `test -f 'kofola/volume.cpp' || echo '$(srcdir)/'`kofola/volume.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/volume.Tpo $(DEPDIR)/volume.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/volume.cpp' object='volume.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o volume.o `test -f 'kofola/volume.cpp' || echo '$(srcdir)/'`kofola/volume.cpp volume.obj: kofola/volume.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT volume.obj -MD -MP -MF $(DEPDIR)/volume.Tpo -c -o volume.obj `if test -f 'kofola/volume.cpp'; then $(CYGPATH_W) 'kofola/volume.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/volume.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/volume.Tpo $(DEPDIR)/volume.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/volume.cpp' object='volume.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o volume.obj `if test -f 'kofola/volume.cpp'; then $(CYGPATH_W) 'kofola/volume.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/volume.cpp'; fi` water.o: kofola/water.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT water.o -MD -MP -MF $(DEPDIR)/water.Tpo -c -o water.o `test -f 'kofola/water.cpp' || echo '$(srcdir)/'`kofola/water.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/water.Tpo $(DEPDIR)/water.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/water.cpp' object='water.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o water.o `test -f 'kofola/water.cpp' || echo '$(srcdir)/'`kofola/water.cpp water.obj: kofola/water.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT water.obj -MD -MP -MF $(DEPDIR)/water.Tpo -c -o water.obj `if test -f 'kofola/water.cpp'; then $(CYGPATH_W) 'kofola/water.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/water.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/water.Tpo $(DEPDIR)/water.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/water.cpp' object='water.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o water.obj `if test -f 'kofola/water.cpp'; then $(CYGPATH_W) 'kofola/water.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/water.cpp'; fi` 3dinterface.o: komat/3dinterface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3dinterface.o -MD -MP -MF $(DEPDIR)/3dinterface.Tpo -c -o 3dinterface.o `test -f 'komat/3dinterface.cpp' || echo '$(srcdir)/'`komat/3dinterface.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3dinterface.Tpo $(DEPDIR)/3dinterface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/3dinterface.cpp' object='3dinterface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3dinterface.o `test -f 'komat/3dinterface.cpp' || echo '$(srcdir)/'`komat/3dinterface.cpp 3dinterface.obj: komat/3dinterface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3dinterface.obj -MD -MP -MF $(DEPDIR)/3dinterface.Tpo -c -o 3dinterface.obj `if test -f 'komat/3dinterface.cpp'; then $(CYGPATH_W) 'komat/3dinterface.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/3dinterface.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3dinterface.Tpo $(DEPDIR)/3dinterface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/3dinterface.cpp' object='3dinterface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3dinterface.obj `if test -f 'komat/3dinterface.cpp'; then $(CYGPATH_W) 'komat/3dinterface.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/3dinterface.cpp'; fi` Berusky3d.o: komat/Berusky3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d.o -MD -MP -MF $(DEPDIR)/Berusky3d.Tpo -c -o Berusky3d.o `test -f 'komat/Berusky3d.cpp' || echo '$(srcdir)/'`komat/Berusky3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d.Tpo $(DEPDIR)/Berusky3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d.cpp' object='Berusky3d.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d.o `test -f 'komat/Berusky3d.cpp' || echo '$(srcdir)/'`komat/Berusky3d.cpp Berusky3d.obj: komat/Berusky3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d.obj -MD -MP -MF $(DEPDIR)/Berusky3d.Tpo -c -o Berusky3d.obj `if test -f 'komat/Berusky3d.cpp'; then $(CYGPATH_W) 'komat/Berusky3d.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d.Tpo $(DEPDIR)/Berusky3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d.cpp' object='Berusky3d.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d.obj `if test -f 'komat/Berusky3d.cpp'; then $(CYGPATH_W) 'komat/Berusky3d.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d.cpp'; fi` Berusky3d_castice.o: komat/Berusky3d_castice.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_castice.o -MD -MP -MF $(DEPDIR)/Berusky3d_castice.Tpo -c -o Berusky3d_castice.o `test -f 'komat/Berusky3d_castice.cpp' || echo '$(srcdir)/'`komat/Berusky3d_castice.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_castice.Tpo $(DEPDIR)/Berusky3d_castice.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_castice.cpp' object='Berusky3d_castice.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_castice.o `test -f 'komat/Berusky3d_castice.cpp' || echo '$(srcdir)/'`komat/Berusky3d_castice.cpp Berusky3d_castice.obj: komat/Berusky3d_castice.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_castice.obj -MD -MP -MF $(DEPDIR)/Berusky3d_castice.Tpo -c -o Berusky3d_castice.obj `if test -f 'komat/Berusky3d_castice.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_castice.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_castice.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_castice.Tpo $(DEPDIR)/Berusky3d_castice.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_castice.cpp' object='Berusky3d_castice.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_castice.obj `if test -f 'komat/Berusky3d_castice.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_castice.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_castice.cpp'; fi` Berusky3d_ini.o: komat/Berusky3d_ini.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_ini.o -MD -MP -MF $(DEPDIR)/Berusky3d_ini.Tpo -c -o Berusky3d_ini.o `test -f 'komat/Berusky3d_ini.cpp' || echo '$(srcdir)/'`komat/Berusky3d_ini.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_ini.Tpo $(DEPDIR)/Berusky3d_ini.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_ini.cpp' object='Berusky3d_ini.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_ini.o `test -f 'komat/Berusky3d_ini.cpp' || echo '$(srcdir)/'`komat/Berusky3d_ini.cpp Berusky3d_ini.obj: komat/Berusky3d_ini.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_ini.obj -MD -MP -MF $(DEPDIR)/Berusky3d_ini.Tpo -c -o Berusky3d_ini.obj `if test -f 'komat/Berusky3d_ini.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_ini.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_ini.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_ini.Tpo $(DEPDIR)/Berusky3d_ini.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_ini.cpp' object='Berusky3d_ini.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_ini.obj `if test -f 'komat/Berusky3d_ini.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_ini.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_ini.cpp'; fi` Berusky3d_kamery.o: komat/Berusky3d_kamery.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_kamery.o -MD -MP -MF $(DEPDIR)/Berusky3d_kamery.Tpo -c -o Berusky3d_kamery.o `test -f 'komat/Berusky3d_kamery.cpp' || echo '$(srcdir)/'`komat/Berusky3d_kamery.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_kamery.Tpo $(DEPDIR)/Berusky3d_kamery.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_kamery.cpp' object='Berusky3d_kamery.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_kamery.o `test -f 'komat/Berusky3d_kamery.cpp' || echo '$(srcdir)/'`komat/Berusky3d_kamery.cpp Berusky3d_kamery.obj: komat/Berusky3d_kamery.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_kamery.obj -MD -MP -MF $(DEPDIR)/Berusky3d_kamery.Tpo -c -o Berusky3d_kamery.obj `if test -f 'komat/Berusky3d_kamery.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_kamery.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_kamery.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_kamery.Tpo $(DEPDIR)/Berusky3d_kamery.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_kamery.cpp' object='Berusky3d_kamery.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_kamery.obj `if test -f 'komat/Berusky3d_kamery.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_kamery.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_kamery.cpp'; fi` Berusky3d_kofola2d.o: komat/Berusky3d_kofola2d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_kofola2d.o -MD -MP -MF $(DEPDIR)/Berusky3d_kofola2d.Tpo -c -o Berusky3d_kofola2d.o `test -f 'komat/Berusky3d_kofola2d.cpp' || echo '$(srcdir)/'`komat/Berusky3d_kofola2d.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_kofola2d.Tpo $(DEPDIR)/Berusky3d_kofola2d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_kofola2d.cpp' object='Berusky3d_kofola2d.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_kofola2d.o `test -f 'komat/Berusky3d_kofola2d.cpp' || echo '$(srcdir)/'`komat/Berusky3d_kofola2d.cpp Berusky3d_kofola2d.obj: komat/Berusky3d_kofola2d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_kofola2d.obj -MD -MP -MF $(DEPDIR)/Berusky3d_kofola2d.Tpo -c -o Berusky3d_kofola2d.obj `if test -f 'komat/Berusky3d_kofola2d.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_kofola2d.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_kofola2d.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_kofola2d.Tpo $(DEPDIR)/Berusky3d_kofola2d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_kofola2d.cpp' object='Berusky3d_kofola2d.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_kofola2d.obj `if test -f 'komat/Berusky3d_kofola2d.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_kofola2d.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_kofola2d.cpp'; fi` Berusky3d_kofola_interface.o: komat/Berusky3d_kofola_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_kofola_interface.o -MD -MP -MF $(DEPDIR)/Berusky3d_kofola_interface.Tpo -c -o Berusky3d_kofola_interface.o `test -f 'komat/Berusky3d_kofola_interface.cpp' || echo '$(srcdir)/'`komat/Berusky3d_kofola_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_kofola_interface.Tpo $(DEPDIR)/Berusky3d_kofola_interface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_kofola_interface.cpp' object='Berusky3d_kofola_interface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_kofola_interface.o `test -f 'komat/Berusky3d_kofola_interface.cpp' || echo '$(srcdir)/'`komat/Berusky3d_kofola_interface.cpp Berusky3d_kofola_interface.obj: komat/Berusky3d_kofola_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_kofola_interface.obj -MD -MP -MF $(DEPDIR)/Berusky3d_kofola_interface.Tpo -c -o Berusky3d_kofola_interface.obj `if test -f 'komat/Berusky3d_kofola_interface.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_kofola_interface.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_kofola_interface.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_kofola_interface.Tpo $(DEPDIR)/Berusky3d_kofola_interface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_kofola_interface.cpp' object='Berusky3d_kofola_interface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_kofola_interface.obj `if test -f 'komat/Berusky3d_kofola_interface.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_kofola_interface.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_kofola_interface.cpp'; fi` Berusky3d_light.o: komat/Berusky3d_light.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_light.o -MD -MP -MF $(DEPDIR)/Berusky3d_light.Tpo -c -o Berusky3d_light.o `test -f 'komat/Berusky3d_light.cpp' || echo '$(srcdir)/'`komat/Berusky3d_light.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_light.Tpo $(DEPDIR)/Berusky3d_light.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_light.cpp' object='Berusky3d_light.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_light.o `test -f 'komat/Berusky3d_light.cpp' || echo '$(srcdir)/'`komat/Berusky3d_light.cpp Berusky3d_light.obj: komat/Berusky3d_light.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_light.obj -MD -MP -MF $(DEPDIR)/Berusky3d_light.Tpo -c -o Berusky3d_light.obj `if test -f 'komat/Berusky3d_light.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_light.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_light.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_light.Tpo $(DEPDIR)/Berusky3d_light.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_light.cpp' object='Berusky3d_light.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_light.obj `if test -f 'komat/Berusky3d_light.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_light.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_light.cpp'; fi` Berusky3d_load.o: komat/Berusky3d_load.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_load.o -MD -MP -MF $(DEPDIR)/Berusky3d_load.Tpo -c -o Berusky3d_load.o `test -f 'komat/Berusky3d_load.cpp' || echo '$(srcdir)/'`komat/Berusky3d_load.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_load.Tpo $(DEPDIR)/Berusky3d_load.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_load.cpp' object='Berusky3d_load.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_load.o `test -f 'komat/Berusky3d_load.cpp' || echo '$(srcdir)/'`komat/Berusky3d_load.cpp Berusky3d_load.obj: komat/Berusky3d_load.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_load.obj -MD -MP -MF $(DEPDIR)/Berusky3d_load.Tpo -c -o Berusky3d_load.obj `if test -f 'komat/Berusky3d_load.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_load.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_load.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_load.Tpo $(DEPDIR)/Berusky3d_load.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_load.cpp' object='Berusky3d_load.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_load.obj `if test -f 'komat/Berusky3d_load.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_load.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_load.cpp'; fi` Berusky3d_render.o: komat/Berusky3d_render.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_render.o -MD -MP -MF $(DEPDIR)/Berusky3d_render.Tpo -c -o Berusky3d_render.o `test -f 'komat/Berusky3d_render.cpp' || echo '$(srcdir)/'`komat/Berusky3d_render.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_render.Tpo $(DEPDIR)/Berusky3d_render.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_render.cpp' object='Berusky3d_render.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_render.o `test -f 'komat/Berusky3d_render.cpp' || echo '$(srcdir)/'`komat/Berusky3d_render.cpp Berusky3d_render.obj: komat/Berusky3d_render.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_render.obj -MD -MP -MF $(DEPDIR)/Berusky3d_render.Tpo -c -o Berusky3d_render.obj `if test -f 'komat/Berusky3d_render.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_render.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_render.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_render.Tpo $(DEPDIR)/Berusky3d_render.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_render.cpp' object='Berusky3d_render.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_render.obj `if test -f 'komat/Berusky3d_render.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_render.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_render.cpp'; fi` Di.o: komat/Di.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Di.o -MD -MP -MF $(DEPDIR)/Di.Tpo -c -o Di.o `test -f 'komat/Di.cpp' || echo '$(srcdir)/'`komat/Di.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Di.Tpo $(DEPDIR)/Di.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Di.cpp' object='Di.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Di.o `test -f 'komat/Di.cpp' || echo '$(srcdir)/'`komat/Di.cpp Di.obj: komat/Di.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Di.obj -MD -MP -MF $(DEPDIR)/Di.Tpo -c -o Di.obj `if test -f 'komat/Di.cpp'; then $(CYGPATH_W) 'komat/Di.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Di.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Di.Tpo $(DEPDIR)/Di.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Di.cpp' object='Di.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Di.obj `if test -f 'komat/Di.cpp'; then $(CYGPATH_W) 'komat/Di.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Di.cpp'; fi` Load.o: komat/Load.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Load.o -MD -MP -MF $(DEPDIR)/Load.Tpo -c -o Load.o `test -f 'komat/Load.cpp' || echo '$(srcdir)/'`komat/Load.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Load.Tpo $(DEPDIR)/Load.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Load.cpp' object='Load.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Load.o `test -f 'komat/Load.cpp' || echo '$(srcdir)/'`komat/Load.cpp Load.obj: komat/Load.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Load.obj -MD -MP -MF $(DEPDIR)/Load.Tpo -c -o Load.obj `if test -f 'komat/Load.cpp'; then $(CYGPATH_W) 'komat/Load.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Load.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Load.Tpo $(DEPDIR)/Load.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Load.cpp' object='Load.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Load.obj `if test -f 'komat/Load.cpp'; then $(CYGPATH_W) 'komat/Load.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Load.cpp'; fi` Load_chunks.o: komat/Load_chunks.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Load_chunks.o -MD -MP -MF $(DEPDIR)/Load_chunks.Tpo -c -o Load_chunks.o `test -f 'komat/Load_chunks.cpp' || echo '$(srcdir)/'`komat/Load_chunks.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Load_chunks.Tpo $(DEPDIR)/Load_chunks.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Load_chunks.cpp' object='Load_chunks.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Load_chunks.o `test -f 'komat/Load_chunks.cpp' || echo '$(srcdir)/'`komat/Load_chunks.cpp Load_chunks.obj: komat/Load_chunks.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Load_chunks.obj -MD -MP -MF $(DEPDIR)/Load_chunks.Tpo -c -o Load_chunks.obj `if test -f 'komat/Load_chunks.cpp'; then $(CYGPATH_W) 'komat/Load_chunks.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Load_chunks.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Load_chunks.Tpo $(DEPDIR)/Load_chunks.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Load_chunks.cpp' object='Load_chunks.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Load_chunks.obj `if test -f 'komat/Load_chunks.cpp'; then $(CYGPATH_W) 'komat/Load_chunks.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Load_chunks.cpp'; fi` Load_out.o: komat/Load_out.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Load_out.o -MD -MP -MF $(DEPDIR)/Load_out.Tpo -c -o Load_out.o `test -f 'komat/Load_out.cpp' || echo '$(srcdir)/'`komat/Load_out.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Load_out.Tpo $(DEPDIR)/Load_out.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Load_out.cpp' object='Load_out.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Load_out.o `test -f 'komat/Load_out.cpp' || echo '$(srcdir)/'`komat/Load_out.cpp Load_out.obj: komat/Load_out.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Load_out.obj -MD -MP -MF $(DEPDIR)/Load_out.Tpo -c -o Load_out.obj `if test -f 'komat/Load_out.cpp'; then $(CYGPATH_W) 'komat/Load_out.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Load_out.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Load_out.Tpo $(DEPDIR)/Load_out.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Load_out.cpp' object='Load_out.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Load_out.obj `if test -f 'komat/Load_out.cpp'; then $(CYGPATH_W) 'komat/Load_out.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Load_out.cpp'; fi` compat.o: tmp/compat.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT compat.o -MD -MP -MF $(DEPDIR)/compat.Tpo -c -o compat.o `test -f 'tmp/compat.cpp' || echo '$(srcdir)/'`tmp/compat.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/compat.Tpo $(DEPDIR)/compat.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tmp/compat.cpp' object='compat.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o compat.o `test -f 'tmp/compat.cpp' || echo '$(srcdir)/'`tmp/compat.cpp compat.obj: tmp/compat.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT compat.obj -MD -MP -MF $(DEPDIR)/compat.Tpo -c -o compat.obj `if test -f 'tmp/compat.cpp'; then $(CYGPATH_W) 'tmp/compat.cpp'; else $(CYGPATH_W) '$(srcdir)/tmp/compat.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/compat.Tpo $(DEPDIR)/compat.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tmp/compat.cpp' object='compat.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o compat.obj `if test -f 'tmp/compat.cpp'; then $(CYGPATH_W) 'tmp/compat.cpp'; else $(CYGPATH_W) '$(srcdir)/tmp/compat.cpp'; fi` 2D_graphic.o: kofola/2D_graphic.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 2D_graphic.o -MD -MP -MF $(DEPDIR)/2D_graphic.Tpo -c -o 2D_graphic.o `test -f 'kofola/2D_graphic.cpp' || echo '$(srcdir)/'`kofola/2D_graphic.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/2D_graphic.Tpo $(DEPDIR)/2D_graphic.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/2D_graphic.cpp' object='2D_graphic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 2D_graphic.o `test -f 'kofola/2D_graphic.cpp' || echo '$(srcdir)/'`kofola/2D_graphic.cpp 2D_graphic.obj: kofola/2D_graphic.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 2D_graphic.obj -MD -MP -MF $(DEPDIR)/2D_graphic.Tpo -c -o 2D_graphic.obj `if test -f 'kofola/2D_graphic.cpp'; then $(CYGPATH_W) 'kofola/2D_graphic.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/2D_graphic.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/2D_graphic.Tpo $(DEPDIR)/2D_graphic.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/2D_graphic.cpp' object='2D_graphic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 2D_graphic.obj `if test -f 'kofola/2D_graphic.cpp'; then $(CYGPATH_W) 'kofola/2D_graphic.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/2D_graphic.cpp'; fi` age.o: age/graph/age.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT age.o -MD -MP -MF $(DEPDIR)/age.Tpo -c -o age.o `test -f 'age/graph/age.cpp' || echo '$(srcdir)/'`age/graph/age.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/age.Tpo $(DEPDIR)/age.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/age.cpp' object='age.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o age.o `test -f 'age/graph/age.cpp' || echo '$(srcdir)/'`age/graph/age.cpp age.obj: age/graph/age.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT age.obj -MD -MP -MF $(DEPDIR)/age.Tpo -c -o age.obj `if test -f 'age/graph/age.cpp'; then $(CYGPATH_W) 'age/graph/age.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/age.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/age.Tpo $(DEPDIR)/age.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/age.cpp' object='age.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o age.obj `if test -f 'age/graph/age.cpp'; then $(CYGPATH_W) 'age/graph/age.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/age.cpp'; fi` alpha.o: age/graph/alpha.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT alpha.o -MD -MP -MF $(DEPDIR)/alpha.Tpo -c -o alpha.o `test -f 'age/graph/alpha.cpp' || echo '$(srcdir)/'`age/graph/alpha.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alpha.Tpo $(DEPDIR)/alpha.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/alpha.cpp' object='alpha.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o alpha.o `test -f 'age/graph/alpha.cpp' || echo '$(srcdir)/'`age/graph/alpha.cpp alpha.obj: age/graph/alpha.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT alpha.obj -MD -MP -MF $(DEPDIR)/alpha.Tpo -c -o alpha.obj `if test -f 'age/graph/alpha.cpp'; then $(CYGPATH_W) 'age/graph/alpha.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/alpha.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alpha.Tpo $(DEPDIR)/alpha.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/alpha.cpp' object='alpha.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o alpha.obj `if test -f 'age/graph/alpha.cpp'; then $(CYGPATH_W) 'age/graph/alpha.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/alpha.cpp'; fi` animation.o: age/graph/animation.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation.o -MD -MP -MF $(DEPDIR)/animation.Tpo -c -o animation.o `test -f 'age/graph/animation.cpp' || echo '$(srcdir)/'`age/graph/animation.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation.Tpo $(DEPDIR)/animation.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation.cpp' object='animation.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation.o `test -f 'age/graph/animation.cpp' || echo '$(srcdir)/'`age/graph/animation.cpp animation.obj: age/graph/animation.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation.obj -MD -MP -MF $(DEPDIR)/animation.Tpo -c -o animation.obj `if test -f 'age/graph/animation.cpp'; then $(CYGPATH_W) 'age/graph/animation.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation.Tpo $(DEPDIR)/animation.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation.cpp' object='animation.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation.obj `if test -f 'age/graph/animation.cpp'; then $(CYGPATH_W) 'age/graph/animation.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation.cpp'; fi` animation_time.o: age/graph/animation_time.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_time.o -MD -MP -MF $(DEPDIR)/animation_time.Tpo -c -o animation_time.o `test -f 'age/graph/animation_time.cpp' || echo '$(srcdir)/'`age/graph/animation_time.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_time.Tpo $(DEPDIR)/animation_time.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_time.cpp' object='animation_time.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_time.o `test -f 'age/graph/animation_time.cpp' || echo '$(srcdir)/'`age/graph/animation_time.cpp animation_time.obj: age/graph/animation_time.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_time.obj -MD -MP -MF $(DEPDIR)/animation_time.Tpo -c -o animation_time.obj `if test -f 'age/graph/animation_time.cpp'; then $(CYGPATH_W) 'age/graph/animation_time.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_time.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_time.Tpo $(DEPDIR)/animation_time.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_time.cpp' object='animation_time.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_time.obj `if test -f 'age/graph/animation_time.cpp'; then $(CYGPATH_W) 'age/graph/animation_time.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_time.cpp'; fi` animation_track.o: age/graph/animation_track.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_track.o -MD -MP -MF $(DEPDIR)/animation_track.Tpo -c -o animation_track.o `test -f 'age/graph/animation_track.cpp' || echo '$(srcdir)/'`age/graph/animation_track.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_track.Tpo $(DEPDIR)/animation_track.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_track.cpp' object='animation_track.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_track.o `test -f 'age/graph/animation_track.cpp' || echo '$(srcdir)/'`age/graph/animation_track.cpp animation_track.obj: age/graph/animation_track.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_track.obj -MD -MP -MF $(DEPDIR)/animation_track.Tpo -c -o animation_track.obj `if test -f 'age/graph/animation_track.cpp'; then $(CYGPATH_W) 'age/graph/animation_track.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_track.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_track.Tpo $(DEPDIR)/animation_track.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_track.cpp' object='animation_track.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_track.obj `if test -f 'age/graph/animation_track.cpp'; then $(CYGPATH_W) 'age/graph/animation_track.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_track.cpp'; fi` animation_track_bezier.o: age/graph/animation_track_bezier.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_track_bezier.o -MD -MP -MF $(DEPDIR)/animation_track_bezier.Tpo -c -o animation_track_bezier.o `test -f 'age/graph/animation_track_bezier.cpp' || echo '$(srcdir)/'`age/graph/animation_track_bezier.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_track_bezier.Tpo $(DEPDIR)/animation_track_bezier.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_track_bezier.cpp' object='animation_track_bezier.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_track_bezier.o `test -f 'age/graph/animation_track_bezier.cpp' || echo '$(srcdir)/'`age/graph/animation_track_bezier.cpp animation_track_bezier.obj: age/graph/animation_track_bezier.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_track_bezier.obj -MD -MP -MF $(DEPDIR)/animation_track_bezier.Tpo -c -o animation_track_bezier.obj `if test -f 'age/graph/animation_track_bezier.cpp'; then $(CYGPATH_W) 'age/graph/animation_track_bezier.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_track_bezier.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_track_bezier.Tpo $(DEPDIR)/animation_track_bezier.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_track_bezier.cpp' object='animation_track_bezier.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_track_bezier.obj `if test -f 'age/graph/animation_track_bezier.cpp'; then $(CYGPATH_W) 'age/graph/animation_track_bezier.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_track_bezier.cpp'; fi` animation_track_linear.o: age/graph/animation_track_linear.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_track_linear.o -MD -MP -MF $(DEPDIR)/animation_track_linear.Tpo -c -o animation_track_linear.o `test -f 'age/graph/animation_track_linear.cpp' || echo '$(srcdir)/'`age/graph/animation_track_linear.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_track_linear.Tpo $(DEPDIR)/animation_track_linear.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_track_linear.cpp' object='animation_track_linear.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_track_linear.o `test -f 'age/graph/animation_track_linear.cpp' || echo '$(srcdir)/'`age/graph/animation_track_linear.cpp animation_track_linear.obj: age/graph/animation_track_linear.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_track_linear.obj -MD -MP -MF $(DEPDIR)/animation_track_linear.Tpo -c -o animation_track_linear.obj `if test -f 'age/graph/animation_track_linear.cpp'; then $(CYGPATH_W) 'age/graph/animation_track_linear.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_track_linear.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animation_track_linear.Tpo $(DEPDIR)/animation_track_linear.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/animation_track_linear.cpp' object='animation_track_linear.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_track_linear.obj `if test -f 'age/graph/animation_track_linear.cpp'; then $(CYGPATH_W) 'age/graph/animation_track_linear.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/animation_track_linear.cpp'; fi` bitmap.o: age/graph/bitmap.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bitmap.o -MD -MP -MF $(DEPDIR)/bitmap.Tpo -c -o bitmap.o `test -f 'age/graph/bitmap.cpp' || echo '$(srcdir)/'`age/graph/bitmap.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bitmap.Tpo $(DEPDIR)/bitmap.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/bitmap.cpp' object='bitmap.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bitmap.o `test -f 'age/graph/bitmap.cpp' || echo '$(srcdir)/'`age/graph/bitmap.cpp bitmap.obj: age/graph/bitmap.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bitmap.obj -MD -MP -MF $(DEPDIR)/bitmap.Tpo -c -o bitmap.obj `if test -f 'age/graph/bitmap.cpp'; then $(CYGPATH_W) 'age/graph/bitmap.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/bitmap.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bitmap.Tpo $(DEPDIR)/bitmap.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/bitmap.cpp' object='bitmap.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bitmap.obj `if test -f 'age/graph/bitmap.cpp'; then $(CYGPATH_W) 'age/graph/bitmap.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/bitmap.cpp'; fi` box.o: age/graph/box.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT box.o -MD -MP -MF $(DEPDIR)/box.Tpo -c -o box.o `test -f 'age/graph/box.cpp' || echo '$(srcdir)/'`age/graph/box.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box.Tpo $(DEPDIR)/box.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/box.cpp' object='box.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o box.o `test -f 'age/graph/box.cpp' || echo '$(srcdir)/'`age/graph/box.cpp box.obj: age/graph/box.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT box.obj -MD -MP -MF $(DEPDIR)/box.Tpo -c -o box.obj `if test -f 'age/graph/box.cpp'; then $(CYGPATH_W) 'age/graph/box.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/box.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box.Tpo $(DEPDIR)/box.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/box.cpp' object='box.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o box.obj `if test -f 'age/graph/box.cpp'; then $(CYGPATH_W) 'age/graph/box.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/box.cpp'; fi` camera.o: age/graph/camera.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.o -MD -MP -MF $(DEPDIR)/camera.Tpo -c -o camera.o `test -f 'age/graph/camera.cpp' || echo '$(srcdir)/'`age/graph/camera.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/camera.Tpo $(DEPDIR)/camera.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/camera.cpp' object='camera.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera.o `test -f 'age/graph/camera.cpp' || echo '$(srcdir)/'`age/graph/camera.cpp camera.obj: age/graph/camera.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.obj -MD -MP -MF $(DEPDIR)/camera.Tpo -c -o camera.obj `if test -f 'age/graph/camera.cpp'; then $(CYGPATH_W) 'age/graph/camera.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/camera.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/camera.Tpo $(DEPDIR)/camera.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/camera.cpp' object='camera.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera.obj `if test -f 'age/graph/camera.cpp'; then $(CYGPATH_W) 'age/graph/camera.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/camera.cpp'; fi` camera_interface.o: age/graph/camera_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera_interface.o -MD -MP -MF $(DEPDIR)/camera_interface.Tpo -c -o camera_interface.o `test -f 'age/graph/camera_interface.cpp' || echo '$(srcdir)/'`age/graph/camera_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/camera_interface.Tpo $(DEPDIR)/camera_interface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/camera_interface.cpp' object='camera_interface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera_interface.o `test -f 'age/graph/camera_interface.cpp' || echo '$(srcdir)/'`age/graph/camera_interface.cpp camera_interface.obj: age/graph/camera_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera_interface.obj -MD -MP -MF $(DEPDIR)/camera_interface.Tpo -c -o camera_interface.obj `if test -f 'age/graph/camera_interface.cpp'; then $(CYGPATH_W) 'age/graph/camera_interface.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/camera_interface.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/camera_interface.Tpo $(DEPDIR)/camera_interface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/camera_interface.cpp' object='camera_interface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera_interface.obj `if test -f 'age/graph/camera_interface.cpp'; then $(CYGPATH_W) 'age/graph/camera_interface.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/camera_interface.cpp'; fi` color.o: age/graph/color.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT color.o -MD -MP -MF $(DEPDIR)/color.Tpo -c -o color.o `test -f 'age/graph/color.cpp' || echo '$(srcdir)/'`age/graph/color.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/color.Tpo $(DEPDIR)/color.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/color.cpp' object='color.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o color.o `test -f 'age/graph/color.cpp' || echo '$(srcdir)/'`age/graph/color.cpp color.obj: age/graph/color.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT color.obj -MD -MP -MF $(DEPDIR)/color.Tpo -c -o color.obj `if test -f 'age/graph/color.cpp'; then $(CYGPATH_W) 'age/graph/color.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/color.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/color.Tpo $(DEPDIR)/color.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/color.cpp' object='color.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o color.obj `if test -f 'age/graph/color.cpp'; then $(CYGPATH_W) 'age/graph/color.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/color.cpp'; fi` color_hsv.o: age/graph/color_hsv.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT color_hsv.o -MD -MP -MF $(DEPDIR)/color_hsv.Tpo -c -o color_hsv.o `test -f 'age/graph/color_hsv.cpp' || echo '$(srcdir)/'`age/graph/color_hsv.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/color_hsv.Tpo $(DEPDIR)/color_hsv.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/color_hsv.cpp' object='color_hsv.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o color_hsv.o `test -f 'age/graph/color_hsv.cpp' || echo '$(srcdir)/'`age/graph/color_hsv.cpp color_hsv.obj: age/graph/color_hsv.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT color_hsv.obj -MD -MP -MF $(DEPDIR)/color_hsv.Tpo -c -o color_hsv.obj `if test -f 'age/graph/color_hsv.cpp'; then $(CYGPATH_W) 'age/graph/color_hsv.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/color_hsv.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/color_hsv.Tpo $(DEPDIR)/color_hsv.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/color_hsv.cpp' object='color_hsv.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o color_hsv.obj `if test -f 'age/graph/color_hsv.cpp'; then $(CYGPATH_W) 'age/graph/color_hsv.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/color_hsv.cpp'; fi` draw.o: age/graph/draw.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT draw.o -MD -MP -MF $(DEPDIR)/draw.Tpo -c -o draw.o `test -f 'age/graph/draw.cpp' || echo '$(srcdir)/'`age/graph/draw.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/draw.Tpo $(DEPDIR)/draw.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/draw.cpp' object='draw.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o draw.o `test -f 'age/graph/draw.cpp' || echo '$(srcdir)/'`age/graph/draw.cpp draw.obj: age/graph/draw.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT draw.obj -MD -MP -MF $(DEPDIR)/draw.Tpo -c -o draw.obj `if test -f 'age/graph/draw.cpp'; then $(CYGPATH_W) 'age/graph/draw.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/draw.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/draw.Tpo $(DEPDIR)/draw.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/draw.cpp' object='draw.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o draw.obj `if test -f 'age/graph/draw.cpp'; then $(CYGPATH_W) 'age/graph/draw.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/draw.cpp'; fi` ferguson.o: age/graph/ferguson.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ferguson.o -MD -MP -MF $(DEPDIR)/ferguson.Tpo -c -o ferguson.o `test -f 'age/graph/ferguson.cpp' || echo '$(srcdir)/'`age/graph/ferguson.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ferguson.Tpo $(DEPDIR)/ferguson.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/ferguson.cpp' object='ferguson.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ferguson.o `test -f 'age/graph/ferguson.cpp' || echo '$(srcdir)/'`age/graph/ferguson.cpp ferguson.obj: age/graph/ferguson.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ferguson.obj -MD -MP -MF $(DEPDIR)/ferguson.Tpo -c -o ferguson.obj `if test -f 'age/graph/ferguson.cpp'; then $(CYGPATH_W) 'age/graph/ferguson.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/ferguson.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ferguson.Tpo $(DEPDIR)/ferguson.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/ferguson.cpp' object='ferguson.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ferguson.obj `if test -f 'age/graph/ferguson.cpp'; then $(CYGPATH_W) 'age/graph/ferguson.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/ferguson.cpp'; fi` gext.o: age/graph/gext.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gext.o -MD -MP -MF $(DEPDIR)/gext.Tpo -c -o gext.o `test -f 'age/graph/gext.cpp' || echo '$(srcdir)/'`age/graph/gext.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gext.Tpo $(DEPDIR)/gext.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/gext.cpp' object='gext.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gext.o `test -f 'age/graph/gext.cpp' || echo '$(srcdir)/'`age/graph/gext.cpp gext.obj: age/graph/gext.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gext.obj -MD -MP -MF $(DEPDIR)/gext.Tpo -c -o gext.obj `if test -f 'age/graph/gext.cpp'; then $(CYGPATH_W) 'age/graph/gext.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/gext.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gext.Tpo $(DEPDIR)/gext.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/gext.cpp' object='gext.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gext.obj `if test -f 'age/graph/gext.cpp'; then $(CYGPATH_W) 'age/graph/gext.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/gext.cpp'; fi` glwrapper.o: age/graph/glwrapper.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT glwrapper.o -MD -MP -MF $(DEPDIR)/glwrapper.Tpo -c -o glwrapper.o `test -f 'age/graph/glwrapper.cpp' || echo '$(srcdir)/'`age/graph/glwrapper.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glwrapper.Tpo $(DEPDIR)/glwrapper.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/glwrapper.cpp' object='glwrapper.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o glwrapper.o `test -f 'age/graph/glwrapper.cpp' || echo '$(srcdir)/'`age/graph/glwrapper.cpp glwrapper.obj: age/graph/glwrapper.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT glwrapper.obj -MD -MP -MF $(DEPDIR)/glwrapper.Tpo -c -o glwrapper.obj `if test -f 'age/graph/glwrapper.cpp'; then $(CYGPATH_W) 'age/graph/glwrapper.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/glwrapper.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glwrapper.Tpo $(DEPDIR)/glwrapper.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/glwrapper.cpp' object='glwrapper.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o glwrapper.obj `if test -f 'age/graph/glwrapper.cpp'; then $(CYGPATH_W) 'age/graph/glwrapper.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/glwrapper.cpp'; fi` gpipe.o: age/graph/gpipe.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gpipe.o -MD -MP -MF $(DEPDIR)/gpipe.Tpo -c -o gpipe.o `test -f 'age/graph/gpipe.cpp' || echo '$(srcdir)/'`age/graph/gpipe.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gpipe.Tpo $(DEPDIR)/gpipe.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/gpipe.cpp' object='gpipe.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gpipe.o `test -f 'age/graph/gpipe.cpp' || echo '$(srcdir)/'`age/graph/gpipe.cpp gpipe.obj: age/graph/gpipe.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gpipe.obj -MD -MP -MF $(DEPDIR)/gpipe.Tpo -c -o gpipe.obj `if test -f 'age/graph/gpipe.cpp'; then $(CYGPATH_W) 'age/graph/gpipe.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/gpipe.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gpipe.Tpo $(DEPDIR)/gpipe.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/gpipe.cpp' object='gpipe.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gpipe.obj `if test -f 'age/graph/gpipe.cpp'; then $(CYGPATH_W) 'age/graph/gpipe.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/gpipe.cpp'; fi` graph3d.o: age/graph/graph3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graph3d.o -MD -MP -MF $(DEPDIR)/graph3d.Tpo -c -o graph3d.o `test -f 'age/graph/graph3d.cpp' || echo '$(srcdir)/'`age/graph/graph3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/graph3d.Tpo $(DEPDIR)/graph3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/graph3d.cpp' object='graph3d.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graph3d.o `test -f 'age/graph/graph3d.cpp' || echo '$(srcdir)/'`age/graph/graph3d.cpp graph3d.obj: age/graph/graph3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graph3d.obj -MD -MP -MF $(DEPDIR)/graph3d.Tpo -c -o graph3d.obj `if test -f 'age/graph/graph3d.cpp'; then $(CYGPATH_W) 'age/graph/graph3d.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/graph3d.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/graph3d.Tpo $(DEPDIR)/graph3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/graph3d.cpp' object='graph3d.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graph3d.obj `if test -f 'age/graph/graph3d.cpp'; then $(CYGPATH_W) 'age/graph/graph3d.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/graph3d.cpp'; fi` intersect.o: age/graph/intersect.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT intersect.o -MD -MP -MF $(DEPDIR)/intersect.Tpo -c -o intersect.o `test -f 'age/graph/intersect.cpp' || echo '$(srcdir)/'`age/graph/intersect.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/intersect.Tpo $(DEPDIR)/intersect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/intersect.cpp' object='intersect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o intersect.o `test -f 'age/graph/intersect.cpp' || echo '$(srcdir)/'`age/graph/intersect.cpp intersect.obj: age/graph/intersect.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT intersect.obj -MD -MP -MF $(DEPDIR)/intersect.Tpo -c -o intersect.obj `if test -f 'age/graph/intersect.cpp'; then $(CYGPATH_W) 'age/graph/intersect.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/intersect.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/intersect.Tpo $(DEPDIR)/intersect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/intersect.cpp' object='intersect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o intersect.obj `if test -f 'age/graph/intersect.cpp'; then $(CYGPATH_W) 'age/graph/intersect.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/intersect.cpp'; fi` lighting.o: age/graph/lighting.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lighting.o -MD -MP -MF $(DEPDIR)/lighting.Tpo -c -o lighting.o `test -f 'age/graph/lighting.cpp' || echo '$(srcdir)/'`age/graph/lighting.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lighting.Tpo $(DEPDIR)/lighting.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/lighting.cpp' object='lighting.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lighting.o `test -f 'age/graph/lighting.cpp' || echo '$(srcdir)/'`age/graph/lighting.cpp lighting.obj: age/graph/lighting.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lighting.obj -MD -MP -MF $(DEPDIR)/lighting.Tpo -c -o lighting.obj `if test -f 'age/graph/lighting.cpp'; then $(CYGPATH_W) 'age/graph/lighting.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/lighting.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lighting.Tpo $(DEPDIR)/lighting.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/lighting.cpp' object='lighting.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lighting.obj `if test -f 'age/graph/lighting.cpp'; then $(CYGPATH_W) 'age/graph/lighting.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/lighting.cpp'; fi` material.o: age/graph/material.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(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 'age/graph/material.cpp' || echo '$(srcdir)/'`age/graph/material.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/material.Tpo $(DEPDIR)/material.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/material.cpp' object='material.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.o `test -f 'age/graph/material.cpp' || echo '$(srcdir)/'`age/graph/material.cpp material.obj: age/graph/material.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(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 'age/graph/material.cpp'; then $(CYGPATH_W) 'age/graph/material.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/material.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/material.Tpo $(DEPDIR)/material.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/material.cpp' object='material.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.obj `if test -f 'age/graph/material.cpp'; then $(CYGPATH_W) 'age/graph/material.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/material.cpp'; fi` material_texture.o: age/graph/material_texture.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT material_texture.o -MD -MP -MF $(DEPDIR)/material_texture.Tpo -c -o material_texture.o `test -f 'age/graph/material_texture.cpp' || echo '$(srcdir)/'`age/graph/material_texture.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/material_texture.Tpo $(DEPDIR)/material_texture.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/material_texture.cpp' object='material_texture.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material_texture.o `test -f 'age/graph/material_texture.cpp' || echo '$(srcdir)/'`age/graph/material_texture.cpp material_texture.obj: age/graph/material_texture.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT material_texture.obj -MD -MP -MF $(DEPDIR)/material_texture.Tpo -c -o material_texture.obj `if test -f 'age/graph/material_texture.cpp'; then $(CYGPATH_W) 'age/graph/material_texture.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/material_texture.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/material_texture.Tpo $(DEPDIR)/material_texture.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/material_texture.cpp' object='material_texture.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material_texture.obj `if test -f 'age/graph/material_texture.cpp'; then $(CYGPATH_W) 'age/graph/material_texture.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/material_texture.cpp'; fi` matrix.o: age/graph/matrix.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT matrix.o -MD -MP -MF $(DEPDIR)/matrix.Tpo -c -o matrix.o `test -f 'age/graph/matrix.cpp' || echo '$(srcdir)/'`age/graph/matrix.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/matrix.Tpo $(DEPDIR)/matrix.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/matrix.cpp' object='matrix.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o matrix.o `test -f 'age/graph/matrix.cpp' || echo '$(srcdir)/'`age/graph/matrix.cpp matrix.obj: age/graph/matrix.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT matrix.obj -MD -MP -MF $(DEPDIR)/matrix.Tpo -c -o matrix.obj `if test -f 'age/graph/matrix.cpp'; then $(CYGPATH_W) 'age/graph/matrix.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/matrix.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/matrix.Tpo $(DEPDIR)/matrix.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/matrix.cpp' object='matrix.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o matrix.obj `if test -f 'age/graph/matrix.cpp'; then $(CYGPATH_W) 'age/graph/matrix.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/matrix.cpp'; fi` matrix_animated.o: age/graph/matrix_animated.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT matrix_animated.o -MD -MP -MF $(DEPDIR)/matrix_animated.Tpo -c -o matrix_animated.o `test -f 'age/graph/matrix_animated.cpp' || echo '$(srcdir)/'`age/graph/matrix_animated.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/matrix_animated.Tpo $(DEPDIR)/matrix_animated.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/matrix_animated.cpp' object='matrix_animated.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o matrix_animated.o `test -f 'age/graph/matrix_animated.cpp' || echo '$(srcdir)/'`age/graph/matrix_animated.cpp matrix_animated.obj: age/graph/matrix_animated.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT matrix_animated.obj -MD -MP -MF $(DEPDIR)/matrix_animated.Tpo -c -o matrix_animated.obj `if test -f 'age/graph/matrix_animated.cpp'; then $(CYGPATH_W) 'age/graph/matrix_animated.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/matrix_animated.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/matrix_animated.Tpo $(DEPDIR)/matrix_animated.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/matrix_animated.cpp' object='matrix_animated.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o matrix_animated.obj `if test -f 'age/graph/matrix_animated.cpp'; then $(CYGPATH_W) 'age/graph/matrix_animated.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/matrix_animated.cpp'; fi` matrix_notified.o: age/graph/matrix_notified.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT matrix_notified.o -MD -MP -MF $(DEPDIR)/matrix_notified.Tpo -c -o matrix_notified.o `test -f 'age/graph/matrix_notified.cpp' || echo '$(srcdir)/'`age/graph/matrix_notified.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/matrix_notified.Tpo $(DEPDIR)/matrix_notified.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/matrix_notified.cpp' object='matrix_notified.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o matrix_notified.o `test -f 'age/graph/matrix_notified.cpp' || echo '$(srcdir)/'`age/graph/matrix_notified.cpp matrix_notified.obj: age/graph/matrix_notified.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT matrix_notified.obj -MD -MP -MF $(DEPDIR)/matrix_notified.Tpo -c -o matrix_notified.obj `if test -f 'age/graph/matrix_notified.cpp'; then $(CYGPATH_W) 'age/graph/matrix_notified.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/matrix_notified.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/matrix_notified.Tpo $(DEPDIR)/matrix_notified.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/matrix_notified.cpp' object='matrix_notified.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o matrix_notified.obj `if test -f 'age/graph/matrix_notified.cpp'; then $(CYGPATH_W) 'age/graph/matrix_notified.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/matrix_notified.cpp'; fi` mesh.o: age/graph/mesh.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mesh.o -MD -MP -MF $(DEPDIR)/mesh.Tpo -c -o mesh.o `test -f 'age/graph/mesh.cpp' || echo '$(srcdir)/'`age/graph/mesh.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mesh.Tpo $(DEPDIR)/mesh.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/mesh.cpp' object='mesh.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mesh.o `test -f 'age/graph/mesh.cpp' || echo '$(srcdir)/'`age/graph/mesh.cpp mesh.obj: age/graph/mesh.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mesh.obj -MD -MP -MF $(DEPDIR)/mesh.Tpo -c -o mesh.obj `if test -f 'age/graph/mesh.cpp'; then $(CYGPATH_W) 'age/graph/mesh.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/mesh.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mesh.Tpo $(DEPDIR)/mesh.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/mesh.cpp' object='mesh.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mesh.obj `if test -f 'age/graph/mesh.cpp'; then $(CYGPATH_W) 'age/graph/mesh.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/mesh.cpp'; fi` normals.o: age/graph/normals.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT normals.o -MD -MP -MF $(DEPDIR)/normals.Tpo -c -o normals.o `test -f 'age/graph/normals.cpp' || echo '$(srcdir)/'`age/graph/normals.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/normals.Tpo $(DEPDIR)/normals.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/normals.cpp' object='normals.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o normals.o `test -f 'age/graph/normals.cpp' || echo '$(srcdir)/'`age/graph/normals.cpp normals.obj: age/graph/normals.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT normals.obj -MD -MP -MF $(DEPDIR)/normals.Tpo -c -o normals.obj `if test -f 'age/graph/normals.cpp'; then $(CYGPATH_W) 'age/graph/normals.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/normals.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/normals.Tpo $(DEPDIR)/normals.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/normals.cpp' object='normals.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o normals.obj `if test -f 'age/graph/normals.cpp'; then $(CYGPATH_W) 'age/graph/normals.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/normals.cpp'; fi` obb.o: age/graph/obb.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT obb.o -MD -MP -MF $(DEPDIR)/obb.Tpo -c -o obb.o `test -f 'age/graph/obb.cpp' || echo '$(srcdir)/'`age/graph/obb.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/obb.Tpo $(DEPDIR)/obb.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/obb.cpp' object='obb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o obb.o `test -f 'age/graph/obb.cpp' || echo '$(srcdir)/'`age/graph/obb.cpp obb.obj: age/graph/obb.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT obb.obj -MD -MP -MF $(DEPDIR)/obb.Tpo -c -o obb.obj `if test -f 'age/graph/obb.cpp'; then $(CYGPATH_W) 'age/graph/obb.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/obb.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/obb.Tpo $(DEPDIR)/obb.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/obb.cpp' object='obb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o obb.obj `if test -f 'age/graph/obb.cpp'; then $(CYGPATH_W) 'age/graph/obb.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/obb.cpp'; fi` object_base.o: age/graph/object_base.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_base.o -MD -MP -MF $(DEPDIR)/object_base.Tpo -c -o object_base.o `test -f 'age/graph/object_base.cpp' || echo '$(srcdir)/'`age/graph/object_base.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_base.Tpo $(DEPDIR)/object_base.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_base.cpp' object='object_base.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_base.o `test -f 'age/graph/object_base.cpp' || echo '$(srcdir)/'`age/graph/object_base.cpp object_base.obj: age/graph/object_base.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_base.obj -MD -MP -MF $(DEPDIR)/object_base.Tpo -c -o object_base.obj `if test -f 'age/graph/object_base.cpp'; then $(CYGPATH_W) 'age/graph/object_base.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_base.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_base.Tpo $(DEPDIR)/object_base.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_base.cpp' object='object_base.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_base.obj `if test -f 'age/graph/object_base.cpp'; then $(CYGPATH_W) 'age/graph/object_base.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_base.cpp'; fi` object_box.o: age/graph/object_box.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_box.o -MD -MP -MF $(DEPDIR)/object_box.Tpo -c -o object_box.o `test -f 'age/graph/object_box.cpp' || echo '$(srcdir)/'`age/graph/object_box.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_box.Tpo $(DEPDIR)/object_box.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_box.cpp' object='object_box.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_box.o `test -f 'age/graph/object_box.cpp' || echo '$(srcdir)/'`age/graph/object_box.cpp object_box.obj: age/graph/object_box.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_box.obj -MD -MP -MF $(DEPDIR)/object_box.Tpo -c -o object_box.obj `if test -f 'age/graph/object_box.cpp'; then $(CYGPATH_W) 'age/graph/object_box.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_box.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_box.Tpo $(DEPDIR)/object_box.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_box.cpp' object='object_box.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_box.obj `if test -f 'age/graph/object_box.cpp'; then $(CYGPATH_W) 'age/graph/object_box.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_box.cpp'; fi` object_geometry.o: age/graph/object_geometry.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_geometry.o -MD -MP -MF $(DEPDIR)/object_geometry.Tpo -c -o object_geometry.o `test -f 'age/graph/object_geometry.cpp' || echo '$(srcdir)/'`age/graph/object_geometry.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_geometry.Tpo $(DEPDIR)/object_geometry.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_geometry.cpp' object='object_geometry.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_geometry.o `test -f 'age/graph/object_geometry.cpp' || echo '$(srcdir)/'`age/graph/object_geometry.cpp object_geometry.obj: age/graph/object_geometry.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_geometry.obj -MD -MP -MF $(DEPDIR)/object_geometry.Tpo -c -o object_geometry.obj `if test -f 'age/graph/object_geometry.cpp'; then $(CYGPATH_W) 'age/graph/object_geometry.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_geometry.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_geometry.Tpo $(DEPDIR)/object_geometry.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_geometry.cpp' object='object_geometry.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_geometry.obj `if test -f 'age/graph/object_geometry.cpp'; then $(CYGPATH_W) 'age/graph/object_geometry.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_geometry.cpp'; fi` object_hierarchy.o: age/graph/object_hierarchy.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_hierarchy.o -MD -MP -MF $(DEPDIR)/object_hierarchy.Tpo -c -o object_hierarchy.o `test -f 'age/graph/object_hierarchy.cpp' || echo '$(srcdir)/'`age/graph/object_hierarchy.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_hierarchy.Tpo $(DEPDIR)/object_hierarchy.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_hierarchy.cpp' object='object_hierarchy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_hierarchy.o `test -f 'age/graph/object_hierarchy.cpp' || echo '$(srcdir)/'`age/graph/object_hierarchy.cpp object_hierarchy.obj: age/graph/object_hierarchy.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_hierarchy.obj -MD -MP -MF $(DEPDIR)/object_hierarchy.Tpo -c -o object_hierarchy.obj `if test -f 'age/graph/object_hierarchy.cpp'; then $(CYGPATH_W) 'age/graph/object_hierarchy.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_hierarchy.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_hierarchy.Tpo $(DEPDIR)/object_hierarchy.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_hierarchy.cpp' object='object_hierarchy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_hierarchy.obj `if test -f 'age/graph/object_hierarchy.cpp'; then $(CYGPATH_W) 'age/graph/object_hierarchy.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_hierarchy.cpp'; fi` object_list.o: age/graph/object_list.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_list.o -MD -MP -MF $(DEPDIR)/object_list.Tpo -c -o object_list.o `test -f 'age/graph/object_list.cpp' || echo '$(srcdir)/'`age/graph/object_list.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_list.Tpo $(DEPDIR)/object_list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_list.cpp' object='object_list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_list.o `test -f 'age/graph/object_list.cpp' || echo '$(srcdir)/'`age/graph/object_list.cpp object_list.obj: age/graph/object_list.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_list.obj -MD -MP -MF $(DEPDIR)/object_list.Tpo -c -o object_list.obj `if test -f 'age/graph/object_list.cpp'; then $(CYGPATH_W) 'age/graph/object_list.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_list.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_list.Tpo $(DEPDIR)/object_list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_list.cpp' object='object_list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_list.obj `if test -f 'age/graph/object_list.cpp'; then $(CYGPATH_W) 'age/graph/object_list.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_list.cpp'; fi` object_render_list.o: age/graph/object_render_list.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_render_list.o -MD -MP -MF $(DEPDIR)/object_render_list.Tpo -c -o object_render_list.o `test -f 'age/graph/object_render_list.cpp' || echo '$(srcdir)/'`age/graph/object_render_list.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_render_list.Tpo $(DEPDIR)/object_render_list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_render_list.cpp' object='object_render_list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_render_list.o `test -f 'age/graph/object_render_list.cpp' || echo '$(srcdir)/'`age/graph/object_render_list.cpp object_render_list.obj: age/graph/object_render_list.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_render_list.obj -MD -MP -MF $(DEPDIR)/object_render_list.Tpo -c -o object_render_list.obj `if test -f 'age/graph/object_render_list.cpp'; then $(CYGPATH_W) 'age/graph/object_render_list.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_render_list.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_render_list.Tpo $(DEPDIR)/object_render_list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_render_list.cpp' object='object_render_list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_render_list.obj `if test -f 'age/graph/object_render_list.cpp'; then $(CYGPATH_W) 'age/graph/object_render_list.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_render_list.cpp'; fi` object_scene.o: age/graph/object_scene.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_scene.o -MD -MP -MF $(DEPDIR)/object_scene.Tpo -c -o object_scene.o `test -f 'age/graph/object_scene.cpp' || echo '$(srcdir)/'`age/graph/object_scene.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_scene.Tpo $(DEPDIR)/object_scene.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_scene.cpp' object='object_scene.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_scene.o `test -f 'age/graph/object_scene.cpp' || echo '$(srcdir)/'`age/graph/object_scene.cpp object_scene.obj: age/graph/object_scene.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_scene.obj -MD -MP -MF $(DEPDIR)/object_scene.Tpo -c -o object_scene.obj `if test -f 'age/graph/object_scene.cpp'; then $(CYGPATH_W) 'age/graph/object_scene.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_scene.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_scene.Tpo $(DEPDIR)/object_scene.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_scene.cpp' object='object_scene.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_scene.obj `if test -f 'age/graph/object_scene.cpp'; then $(CYGPATH_W) 'age/graph/object_scene.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_scene.cpp'; fi` object_transformation.o: age/graph/object_transformation.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_transformation.o -MD -MP -MF $(DEPDIR)/object_transformation.Tpo -c -o object_transformation.o `test -f 'age/graph/object_transformation.cpp' || echo '$(srcdir)/'`age/graph/object_transformation.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_transformation.Tpo $(DEPDIR)/object_transformation.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_transformation.cpp' object='object_transformation.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_transformation.o `test -f 'age/graph/object_transformation.cpp' || echo '$(srcdir)/'`age/graph/object_transformation.cpp object_transformation.obj: age/graph/object_transformation.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_transformation.obj -MD -MP -MF $(DEPDIR)/object_transformation.Tpo -c -o object_transformation.obj `if test -f 'age/graph/object_transformation.cpp'; then $(CYGPATH_W) 'age/graph/object_transformation.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_transformation.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_transformation.Tpo $(DEPDIR)/object_transformation.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_transformation.cpp' object='object_transformation.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_transformation.obj `if test -f 'age/graph/object_transformation.cpp'; then $(CYGPATH_W) 'age/graph/object_transformation.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_transformation.cpp'; fi` object_world.o: age/graph/object_world.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_world.o -MD -MP -MF $(DEPDIR)/object_world.Tpo -c -o object_world.o `test -f 'age/graph/object_world.cpp' || echo '$(srcdir)/'`age/graph/object_world.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_world.Tpo $(DEPDIR)/object_world.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_world.cpp' object='object_world.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_world.o `test -f 'age/graph/object_world.cpp' || echo '$(srcdir)/'`age/graph/object_world.cpp object_world.obj: age/graph/object_world.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object_world.obj -MD -MP -MF $(DEPDIR)/object_world.Tpo -c -o object_world.obj `if test -f 'age/graph/object_world.cpp'; then $(CYGPATH_W) 'age/graph/object_world.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_world.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/object_world.Tpo $(DEPDIR)/object_world.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/object_world.cpp' object='object_world.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object_world.obj `if test -f 'age/graph/object_world.cpp'; then $(CYGPATH_W) 'age/graph/object_world.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/object_world.cpp'; fi` polar.o: age/graph/polar.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT polar.o -MD -MP -MF $(DEPDIR)/polar.Tpo -c -o polar.o `test -f 'age/graph/polar.cpp' || echo '$(srcdir)/'`age/graph/polar.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/polar.Tpo $(DEPDIR)/polar.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/polar.cpp' object='polar.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o polar.o `test -f 'age/graph/polar.cpp' || echo '$(srcdir)/'`age/graph/polar.cpp polar.obj: age/graph/polar.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT polar.obj -MD -MP -MF $(DEPDIR)/polar.Tpo -c -o polar.obj `if test -f 'age/graph/polar.cpp'; then $(CYGPATH_W) 'age/graph/polar.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/polar.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/polar.Tpo $(DEPDIR)/polar.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/polar.cpp' object='polar.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o polar.obj `if test -f 'age/graph/polar.cpp'; then $(CYGPATH_W) 'age/graph/polar.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/polar.cpp'; fi` print.o: age/graph/print.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT print.o -MD -MP -MF $(DEPDIR)/print.Tpo -c -o print.o `test -f 'age/graph/print.cpp' || echo '$(srcdir)/'`age/graph/print.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/print.Tpo $(DEPDIR)/print.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/print.cpp' object='print.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o print.o `test -f 'age/graph/print.cpp' || echo '$(srcdir)/'`age/graph/print.cpp print.obj: age/graph/print.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT print.obj -MD -MP -MF $(DEPDIR)/print.Tpo -c -o print.obj `if test -f 'age/graph/print.cpp'; then $(CYGPATH_W) 'age/graph/print.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/print.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/print.Tpo $(DEPDIR)/print.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/print.cpp' object='print.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o print.obj `if test -f 'age/graph/print.cpp'; then $(CYGPATH_W) 'age/graph/print.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/print.cpp'; fi` scene.o: age/graph/scene.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene.o -MD -MP -MF $(DEPDIR)/scene.Tpo -c -o scene.o `test -f 'age/graph/scene.cpp' || echo '$(srcdir)/'`age/graph/scene.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene.Tpo $(DEPDIR)/scene.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene.cpp' object='scene.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene.o `test -f 'age/graph/scene.cpp' || echo '$(srcdir)/'`age/graph/scene.cpp scene.obj: age/graph/scene.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene.obj -MD -MP -MF $(DEPDIR)/scene.Tpo -c -o scene.obj `if test -f 'age/graph/scene.cpp'; then $(CYGPATH_W) 'age/graph/scene.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene.Tpo $(DEPDIR)/scene.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene.cpp' object='scene.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene.obj `if test -f 'age/graph/scene.cpp'; then $(CYGPATH_W) 'age/graph/scene.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene.cpp'; fi` scene_import_3ds.o: age/graph/scene_import_3ds.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_import_3ds.o -MD -MP -MF $(DEPDIR)/scene_import_3ds.Tpo -c -o scene_import_3ds.o `test -f 'age/graph/scene_import_3ds.cpp' || echo '$(srcdir)/'`age/graph/scene_import_3ds.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_import_3ds.Tpo $(DEPDIR)/scene_import_3ds.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_import_3ds.cpp' object='scene_import_3ds.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_import_3ds.o `test -f 'age/graph/scene_import_3ds.cpp' || echo '$(srcdir)/'`age/graph/scene_import_3ds.cpp scene_import_3ds.obj: age/graph/scene_import_3ds.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_import_3ds.obj -MD -MP -MF $(DEPDIR)/scene_import_3ds.Tpo -c -o scene_import_3ds.obj `if test -f 'age/graph/scene_import_3ds.cpp'; then $(CYGPATH_W) 'age/graph/scene_import_3ds.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_import_3ds.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_import_3ds.Tpo $(DEPDIR)/scene_import_3ds.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_import_3ds.cpp' object='scene_import_3ds.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_import_3ds.obj `if test -f 'age/graph/scene_import_3ds.cpp'; then $(CYGPATH_W) 'age/graph/scene_import_3ds.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_import_3ds.cpp'; fi` scene_import_b2m.o: age/graph/scene_import_b2m.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_import_b2m.o -MD -MP -MF $(DEPDIR)/scene_import_b2m.Tpo -c -o scene_import_b2m.o `test -f 'age/graph/scene_import_b2m.cpp' || echo '$(srcdir)/'`age/graph/scene_import_b2m.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_import_b2m.Tpo $(DEPDIR)/scene_import_b2m.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_import_b2m.cpp' object='scene_import_b2m.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_import_b2m.o `test -f 'age/graph/scene_import_b2m.cpp' || echo '$(srcdir)/'`age/graph/scene_import_b2m.cpp scene_import_b2m.obj: age/graph/scene_import_b2m.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_import_b2m.obj -MD -MP -MF $(DEPDIR)/scene_import_b2m.Tpo -c -o scene_import_b2m.obj `if test -f 'age/graph/scene_import_b2m.cpp'; then $(CYGPATH_W) 'age/graph/scene_import_b2m.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_import_b2m.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_import_b2m.Tpo $(DEPDIR)/scene_import_b2m.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_import_b2m.cpp' object='scene_import_b2m.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_import_b2m.obj `if test -f 'age/graph/scene_import_b2m.cpp'; then $(CYGPATH_W) 'age/graph/scene_import_b2m.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_import_b2m.cpp'; fi` scene_import_txt.o: age/graph/scene_import_txt.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_import_txt.o -MD -MP -MF $(DEPDIR)/scene_import_txt.Tpo -c -o scene_import_txt.o `test -f 'age/graph/scene_import_txt.cpp' || echo '$(srcdir)/'`age/graph/scene_import_txt.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_import_txt.Tpo $(DEPDIR)/scene_import_txt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_import_txt.cpp' object='scene_import_txt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_import_txt.o `test -f 'age/graph/scene_import_txt.cpp' || echo '$(srcdir)/'`age/graph/scene_import_txt.cpp scene_import_txt.obj: age/graph/scene_import_txt.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_import_txt.obj -MD -MP -MF $(DEPDIR)/scene_import_txt.Tpo -c -o scene_import_txt.obj `if test -f 'age/graph/scene_import_txt.cpp'; then $(CYGPATH_W) 'age/graph/scene_import_txt.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_import_txt.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_import_txt.Tpo $(DEPDIR)/scene_import_txt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_import_txt.cpp' object='scene_import_txt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_import_txt.obj `if test -f 'age/graph/scene_import_txt.cpp'; then $(CYGPATH_W) 'age/graph/scene_import_txt.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_import_txt.cpp'; fi` scene_load.o: age/graph/scene_load.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_load.o -MD -MP -MF $(DEPDIR)/scene_load.Tpo -c -o scene_load.o `test -f 'age/graph/scene_load.cpp' || echo '$(srcdir)/'`age/graph/scene_load.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_load.Tpo $(DEPDIR)/scene_load.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_load.cpp' object='scene_load.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_load.o `test -f 'age/graph/scene_load.cpp' || echo '$(srcdir)/'`age/graph/scene_load.cpp scene_load.obj: age/graph/scene_load.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scene_load.obj -MD -MP -MF $(DEPDIR)/scene_load.Tpo -c -o scene_load.obj `if test -f 'age/graph/scene_load.cpp'; then $(CYGPATH_W) 'age/graph/scene_load.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_load.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scene_load.Tpo $(DEPDIR)/scene_load.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/scene_load.cpp' object='scene_load.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scene_load.obj `if test -f 'age/graph/scene_load.cpp'; then $(CYGPATH_W) 'age/graph/scene_load.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/scene_load.cpp'; fi` selection.o: age/graph/selection.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT selection.o -MD -MP -MF $(DEPDIR)/selection.Tpo -c -o selection.o `test -f 'age/graph/selection.cpp' || echo '$(srcdir)/'`age/graph/selection.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/selection.Tpo $(DEPDIR)/selection.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/selection.cpp' object='selection.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o selection.o `test -f 'age/graph/selection.cpp' || echo '$(srcdir)/'`age/graph/selection.cpp selection.obj: age/graph/selection.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT selection.obj -MD -MP -MF $(DEPDIR)/selection.Tpo -c -o selection.obj `if test -f 'age/graph/selection.cpp'; then $(CYGPATH_W) 'age/graph/selection.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/selection.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/selection.Tpo $(DEPDIR)/selection.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/selection.cpp' object='selection.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o selection.obj `if test -f 'age/graph/selection.cpp'; then $(CYGPATH_W) 'age/graph/selection.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/selection.cpp'; fi` surface.o: age/graph/surface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.o -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.o `test -f 'age/graph/surface.cpp' || echo '$(srcdir)/'`age/graph/surface.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface.cpp' object='surface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.o `test -f 'age/graph/surface.cpp' || echo '$(srcdir)/'`age/graph/surface.cpp surface.obj: age/graph/surface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.obj -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.obj `if test -f 'age/graph/surface.cpp'; then $(CYGPATH_W) 'age/graph/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface.cpp' object='surface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.obj `if test -f 'age/graph/surface.cpp'; then $(CYGPATH_W) 'age/graph/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface.cpp'; fi` surface_height.o: age/graph/surface_height.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_height.o -MD -MP -MF $(DEPDIR)/surface_height.Tpo -c -o surface_height.o `test -f 'age/graph/surface_height.cpp' || echo '$(srcdir)/'`age/graph/surface_height.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_height.Tpo $(DEPDIR)/surface_height.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_height.cpp' object='surface_height.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_height.o `test -f 'age/graph/surface_height.cpp' || echo '$(srcdir)/'`age/graph/surface_height.cpp surface_height.obj: age/graph/surface_height.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_height.obj -MD -MP -MF $(DEPDIR)/surface_height.Tpo -c -o surface_height.obj `if test -f 'age/graph/surface_height.cpp'; then $(CYGPATH_W) 'age/graph/surface_height.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_height.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_height.Tpo $(DEPDIR)/surface_height.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_height.cpp' object='surface_height.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_height.obj `if test -f 'age/graph/surface_height.cpp'; then $(CYGPATH_W) 'age/graph/surface_height.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_height.cpp'; fi` surface_mask.o: age/graph/surface_mask.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_mask.o -MD -MP -MF $(DEPDIR)/surface_mask.Tpo -c -o surface_mask.o `test -f 'age/graph/surface_mask.cpp' || echo '$(srcdir)/'`age/graph/surface_mask.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_mask.Tpo $(DEPDIR)/surface_mask.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_mask.cpp' object='surface_mask.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_mask.o `test -f 'age/graph/surface_mask.cpp' || echo '$(srcdir)/'`age/graph/surface_mask.cpp surface_mask.obj: age/graph/surface_mask.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_mask.obj -MD -MP -MF $(DEPDIR)/surface_mask.Tpo -c -o surface_mask.obj `if test -f 'age/graph/surface_mask.cpp'; then $(CYGPATH_W) 'age/graph/surface_mask.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_mask.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_mask.Tpo $(DEPDIR)/surface_mask.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_mask.cpp' object='surface_mask.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_mask.obj `if test -f 'age/graph/surface_mask.cpp'; then $(CYGPATH_W) 'age/graph/surface_mask.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_mask.cpp'; fi` surface_sdl.o: age/graph/surface_sdl.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_sdl.o -MD -MP -MF $(DEPDIR)/surface_sdl.Tpo -c -o surface_sdl.o `test -f 'age/graph/surface_sdl.cpp' || echo '$(srcdir)/'`age/graph/surface_sdl.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_sdl.Tpo $(DEPDIR)/surface_sdl.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_sdl.cpp' object='surface_sdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_sdl.o `test -f 'age/graph/surface_sdl.cpp' || echo '$(srcdir)/'`age/graph/surface_sdl.cpp surface_sdl.obj: age/graph/surface_sdl.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_sdl.obj -MD -MP -MF $(DEPDIR)/surface_sdl.Tpo -c -o surface_sdl.obj `if test -f 'age/graph/surface_sdl.cpp'; then $(CYGPATH_W) 'age/graph/surface_sdl.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_sdl.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_sdl.Tpo $(DEPDIR)/surface_sdl.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_sdl.cpp' object='surface_sdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_sdl.obj `if test -f 'age/graph/surface_sdl.cpp'; then $(CYGPATH_W) 'age/graph/surface_sdl.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_sdl.cpp'; fi` surface_sw.o: age/graph/surface_sw.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_sw.o -MD -MP -MF $(DEPDIR)/surface_sw.Tpo -c -o surface_sw.o `test -f 'age/graph/surface_sw.cpp' || echo '$(srcdir)/'`age/graph/surface_sw.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_sw.Tpo $(DEPDIR)/surface_sw.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_sw.cpp' object='surface_sw.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_sw.o `test -f 'age/graph/surface_sw.cpp' || echo '$(srcdir)/'`age/graph/surface_sw.cpp surface_sw.obj: age/graph/surface_sw.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface_sw.obj -MD -MP -MF $(DEPDIR)/surface_sw.Tpo -c -o surface_sw.obj `if test -f 'age/graph/surface_sw.cpp'; then $(CYGPATH_W) 'age/graph/surface_sw.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_sw.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/surface_sw.Tpo $(DEPDIR)/surface_sw.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/surface_sw.cpp' object='surface_sw.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface_sw.obj `if test -f 'age/graph/surface_sw.cpp'; then $(CYGPATH_W) 'age/graph/surface_sw.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/surface_sw.cpp'; fi` texture_func.o: age/graph/texture_func.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture_func.o -MD -MP -MF $(DEPDIR)/texture_func.Tpo -c -o texture_func.o `test -f 'age/graph/texture_func.cpp' || echo '$(srcdir)/'`age/graph/texture_func.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texture_func.Tpo $(DEPDIR)/texture_func.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/texture_func.cpp' object='texture_func.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture_func.o `test -f 'age/graph/texture_func.cpp' || echo '$(srcdir)/'`age/graph/texture_func.cpp texture_func.obj: age/graph/texture_func.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture_func.obj -MD -MP -MF $(DEPDIR)/texture_func.Tpo -c -o texture_func.obj `if test -f 'age/graph/texture_func.cpp'; then $(CYGPATH_W) 'age/graph/texture_func.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/texture_func.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texture_func.Tpo $(DEPDIR)/texture_func.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/texture_func.cpp' object='texture_func.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture_func.obj `if test -f 'age/graph/texture_func.cpp'; then $(CYGPATH_W) 'age/graph/texture_func.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/texture_func.cpp'; fi` texture_unit.o: age/graph/texture_unit.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture_unit.o -MD -MP -MF $(DEPDIR)/texture_unit.Tpo -c -o texture_unit.o `test -f 'age/graph/texture_unit.cpp' || echo '$(srcdir)/'`age/graph/texture_unit.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texture_unit.Tpo $(DEPDIR)/texture_unit.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/texture_unit.cpp' object='texture_unit.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture_unit.o `test -f 'age/graph/texture_unit.cpp' || echo '$(srcdir)/'`age/graph/texture_unit.cpp texture_unit.obj: age/graph/texture_unit.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture_unit.obj -MD -MP -MF $(DEPDIR)/texture_unit.Tpo -c -o texture_unit.obj `if test -f 'age/graph/texture_unit.cpp'; then $(CYGPATH_W) 'age/graph/texture_unit.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/texture_unit.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texture_unit.Tpo $(DEPDIR)/texture_unit.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/texture_unit.cpp' object='texture_unit.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture_unit.obj `if test -f 'age/graph/texture_unit.cpp'; then $(CYGPATH_W) 'age/graph/texture_unit.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/texture_unit.cpp'; fi` triangle.o: age/graph/triangle.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT triangle.o -MD -MP -MF $(DEPDIR)/triangle.Tpo -c -o triangle.o `test -f 'age/graph/triangle.cpp' || echo '$(srcdir)/'`age/graph/triangle.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/triangle.Tpo $(DEPDIR)/triangle.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/triangle.cpp' object='triangle.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o triangle.o `test -f 'age/graph/triangle.cpp' || echo '$(srcdir)/'`age/graph/triangle.cpp triangle.obj: age/graph/triangle.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT triangle.obj -MD -MP -MF $(DEPDIR)/triangle.Tpo -c -o triangle.obj `if test -f 'age/graph/triangle.cpp'; then $(CYGPATH_W) 'age/graph/triangle.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/triangle.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/triangle.Tpo $(DEPDIR)/triangle.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/triangle.cpp' object='triangle.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o triangle.obj `if test -f 'age/graph/triangle.cpp'; then $(CYGPATH_W) 'age/graph/triangle.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/triangle.cpp'; fi` vector.o: age/graph/vector.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.o -MD -MP -MF $(DEPDIR)/vector.Tpo -c -o vector.o `test -f 'age/graph/vector.cpp' || echo '$(srcdir)/'`age/graph/vector.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vector.Tpo $(DEPDIR)/vector.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/vector.cpp' object='vector.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vector.o `test -f 'age/graph/vector.cpp' || echo '$(srcdir)/'`age/graph/vector.cpp vector.obj: age/graph/vector.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.obj -MD -MP -MF $(DEPDIR)/vector.Tpo -c -o vector.obj `if test -f 'age/graph/vector.cpp'; then $(CYGPATH_W) 'age/graph/vector.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/vector.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vector.Tpo $(DEPDIR)/vector.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/vector.cpp' object='vector.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vector.obj `if test -f 'age/graph/vector.cpp'; then $(CYGPATH_W) 'age/graph/vector.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/vector.cpp'; fi` vertex_arrays.o: age/graph/vertex_arrays.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vertex_arrays.o -MD -MP -MF $(DEPDIR)/vertex_arrays.Tpo -c -o vertex_arrays.o `test -f 'age/graph/vertex_arrays.cpp' || echo '$(srcdir)/'`age/graph/vertex_arrays.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vertex_arrays.Tpo $(DEPDIR)/vertex_arrays.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/vertex_arrays.cpp' object='vertex_arrays.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vertex_arrays.o `test -f 'age/graph/vertex_arrays.cpp' || echo '$(srcdir)/'`age/graph/vertex_arrays.cpp vertex_arrays.obj: age/graph/vertex_arrays.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vertex_arrays.obj -MD -MP -MF $(DEPDIR)/vertex_arrays.Tpo -c -o vertex_arrays.obj `if test -f 'age/graph/vertex_arrays.cpp'; then $(CYGPATH_W) 'age/graph/vertex_arrays.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/vertex_arrays.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vertex_arrays.Tpo $(DEPDIR)/vertex_arrays.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/vertex_arrays.cpp' object='vertex_arrays.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vertex_arrays.obj `if test -f 'age/graph/vertex_arrays.cpp'; then $(CYGPATH_W) 'age/graph/vertex_arrays.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/vertex_arrays.cpp'; fi` world_interface.o: age/graph/world_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT world_interface.o -MD -MP -MF $(DEPDIR)/world_interface.Tpo -c -o world_interface.o `test -f 'age/graph/world_interface.cpp' || echo '$(srcdir)/'`age/graph/world_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/world_interface.Tpo $(DEPDIR)/world_interface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/world_interface.cpp' object='world_interface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o world_interface.o `test -f 'age/graph/world_interface.cpp' || echo '$(srcdir)/'`age/graph/world_interface.cpp world_interface.obj: age/graph/world_interface.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT world_interface.obj -MD -MP -MF $(DEPDIR)/world_interface.Tpo -c -o world_interface.obj `if test -f 'age/graph/world_interface.cpp'; then $(CYGPATH_W) 'age/graph/world_interface.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/world_interface.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/world_interface.Tpo $(DEPDIR)/world_interface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/world_interface.cpp' object='world_interface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o world_interface.obj `if test -f 'age/graph/world_interface.cpp'; then $(CYGPATH_W) 'age/graph/world_interface.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/world_interface.cpp'; fi` age_main.o: age/support/age_main.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT age_main.o -MD -MP -MF $(DEPDIR)/age_main.Tpo -c -o age_main.o `test -f 'age/support/age_main.cpp' || echo '$(srcdir)/'`age/support/age_main.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/age_main.Tpo $(DEPDIR)/age_main.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/age_main.cpp' object='age_main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o age_main.o `test -f 'age/support/age_main.cpp' || echo '$(srcdir)/'`age/support/age_main.cpp age_main.obj: age/support/age_main.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT age_main.obj -MD -MP -MF $(DEPDIR)/age_main.Tpo -c -o age_main.obj `if test -f 'age/support/age_main.cpp'; then $(CYGPATH_W) 'age/support/age_main.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/age_main.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/age_main.Tpo $(DEPDIR)/age_main.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/age_main.cpp' object='age_main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o age_main.obj `if test -f 'age/support/age_main.cpp'; then $(CYGPATH_W) 'age/support/age_main.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/age_main.cpp'; fi` events.o: age/support/events.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT events.o -MD -MP -MF $(DEPDIR)/events.Tpo -c -o events.o `test -f 'age/support/events.cpp' || echo '$(srcdir)/'`age/support/events.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/events.Tpo $(DEPDIR)/events.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/events.cpp' object='events.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o events.o `test -f 'age/support/events.cpp' || echo '$(srcdir)/'`age/support/events.cpp events.obj: age/support/events.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT events.obj -MD -MP -MF $(DEPDIR)/events.Tpo -c -o events.obj `if test -f 'age/support/events.cpp'; then $(CYGPATH_W) 'age/support/events.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/events.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/events.Tpo $(DEPDIR)/events.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/events.cpp' object='events.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o events.obj `if test -f 'age/support/events.cpp'; then $(CYGPATH_W) 'age/support/events.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/events.cpp'; fi` input.o: age/support/input.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT input.o -MD -MP -MF $(DEPDIR)/input.Tpo -c -o input.o `test -f 'age/support/input.cpp' || echo '$(srcdir)/'`age/support/input.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/input.Tpo $(DEPDIR)/input.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/input.cpp' object='input.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o input.o `test -f 'age/support/input.cpp' || echo '$(srcdir)/'`age/support/input.cpp input.obj: age/support/input.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT input.obj -MD -MP -MF $(DEPDIR)/input.Tpo -c -o input.obj `if test -f 'age/support/input.cpp'; then $(CYGPATH_W) 'age/support/input.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/input.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/input.Tpo $(DEPDIR)/input.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/input.cpp' object='input.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o input.obj `if test -f 'age/support/input.cpp'; then $(CYGPATH_W) 'age/support/input.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/input.cpp'; fi` timer.o: age/support/timer.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT timer.o -MD -MP -MF $(DEPDIR)/timer.Tpo -c -o timer.o `test -f 'age/support/timer.cpp' || echo '$(srcdir)/'`age/support/timer.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/timer.Tpo $(DEPDIR)/timer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/timer.cpp' object='timer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o timer.o `test -f 'age/support/timer.cpp' || echo '$(srcdir)/'`age/support/timer.cpp timer.obj: age/support/timer.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT timer.obj -MD -MP -MF $(DEPDIR)/timer.Tpo -c -o timer.obj `if test -f 'age/support/timer.cpp'; then $(CYGPATH_W) 'age/support/timer.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/timer.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/timer.Tpo $(DEPDIR)/timer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/support/timer.cpp' object='timer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o timer.obj `if test -f 'age/support/timer.cpp'; then $(CYGPATH_W) 'age/support/timer.cpp'; else $(CYGPATH_W) '$(srcdir)/age/support/timer.cpp'; fi` change.o: age/utils/change.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT change.o -MD -MP -MF $(DEPDIR)/change.Tpo -c -o change.o `test -f 'age/utils/change.cpp' || echo '$(srcdir)/'`age/utils/change.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/change.Tpo $(DEPDIR)/change.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/change.cpp' object='change.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o change.o `test -f 'age/utils/change.cpp' || echo '$(srcdir)/'`age/utils/change.cpp change.obj: age/utils/change.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT change.obj -MD -MP -MF $(DEPDIR)/change.Tpo -c -o change.obj `if test -f 'age/utils/change.cpp'; then $(CYGPATH_W) 'age/utils/change.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/change.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/change.Tpo $(DEPDIR)/change.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/change.cpp' object='change.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o change.obj `if test -f 'age/utils/change.cpp'; then $(CYGPATH_W) 'age/utils/change.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/change.cpp'; fi` data_file.o: age/utils/data_file.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT data_file.o -MD -MP -MF $(DEPDIR)/data_file.Tpo -c -o data_file.o `test -f 'age/utils/data_file.cpp' || echo '$(srcdir)/'`age/utils/data_file.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/data_file.Tpo $(DEPDIR)/data_file.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/data_file.cpp' object='data_file.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data_file.o `test -f 'age/utils/data_file.cpp' || echo '$(srcdir)/'`age/utils/data_file.cpp data_file.obj: age/utils/data_file.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT data_file.obj -MD -MP -MF $(DEPDIR)/data_file.Tpo -c -o data_file.obj `if test -f 'age/utils/data_file.cpp'; then $(CYGPATH_W) 'age/utils/data_file.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/data_file.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/data_file.Tpo $(DEPDIR)/data_file.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/data_file.cpp' object='data_file.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data_file.obj `if test -f 'age/utils/data_file.cpp'; then $(CYGPATH_W) 'age/utils/data_file.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/data_file.cpp'; fi` ini.o: age/utils/ini.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ini.o -MD -MP -MF $(DEPDIR)/ini.Tpo -c -o ini.o `test -f 'age/utils/ini.cpp' || echo '$(srcdir)/'`age/utils/ini.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ini.Tpo $(DEPDIR)/ini.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/ini.cpp' object='ini.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ini.o `test -f 'age/utils/ini.cpp' || echo '$(srcdir)/'`age/utils/ini.cpp ini.obj: age/utils/ini.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ini.obj -MD -MP -MF $(DEPDIR)/ini.Tpo -c -o ini.obj `if test -f 'age/utils/ini.cpp'; then $(CYGPATH_W) 'age/utils/ini.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/ini.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ini.Tpo $(DEPDIR)/ini.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/ini.cpp' object='ini.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ini.obj `if test -f 'age/utils/ini.cpp'; then $(CYGPATH_W) 'age/utils/ini.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/ini.cpp'; fi` log.o: age/utils/log.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log.o -MD -MP -MF $(DEPDIR)/log.Tpo -c -o log.o `test -f 'age/utils/log.cpp' || echo '$(srcdir)/'`age/utils/log.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/log.Tpo $(DEPDIR)/log.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/log.cpp' object='log.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log.o `test -f 'age/utils/log.cpp' || echo '$(srcdir)/'`age/utils/log.cpp log.obj: age/utils/log.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log.obj -MD -MP -MF $(DEPDIR)/log.Tpo -c -o log.obj `if test -f 'age/utils/log.cpp'; then $(CYGPATH_W) 'age/utils/log.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/log.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/log.Tpo $(DEPDIR)/log.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/log.cpp' object='log.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log.obj `if test -f 'age/utils/log.cpp'; then $(CYGPATH_W) 'age/utils/log.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/log.cpp'; fi` mem_alloc.o: age/utils/mem_alloc.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mem_alloc.o -MD -MP -MF $(DEPDIR)/mem_alloc.Tpo -c -o mem_alloc.o `test -f 'age/utils/mem_alloc.cpp' || echo '$(srcdir)/'`age/utils/mem_alloc.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mem_alloc.Tpo $(DEPDIR)/mem_alloc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/mem_alloc.cpp' object='mem_alloc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mem_alloc.o `test -f 'age/utils/mem_alloc.cpp' || echo '$(srcdir)/'`age/utils/mem_alloc.cpp mem_alloc.obj: age/utils/mem_alloc.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mem_alloc.obj -MD -MP -MF $(DEPDIR)/mem_alloc.Tpo -c -o mem_alloc.obj `if test -f 'age/utils/mem_alloc.cpp'; then $(CYGPATH_W) 'age/utils/mem_alloc.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/mem_alloc.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mem_alloc.Tpo $(DEPDIR)/mem_alloc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/mem_alloc.cpp' object='mem_alloc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mem_alloc.obj `if test -f 'age/utils/mem_alloc.cpp'; then $(CYGPATH_W) 'age/utils/mem_alloc.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/mem_alloc.cpp'; fi` mtree.o: age/utils/mtree.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mtree.o -MD -MP -MF $(DEPDIR)/mtree.Tpo -c -o mtree.o `test -f 'age/utils/mtree.cpp' || echo '$(srcdir)/'`age/utils/mtree.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mtree.Tpo $(DEPDIR)/mtree.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/mtree.cpp' object='mtree.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mtree.o `test -f 'age/utils/mtree.cpp' || echo '$(srcdir)/'`age/utils/mtree.cpp mtree.obj: age/utils/mtree.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mtree.obj -MD -MP -MF $(DEPDIR)/mtree.Tpo -c -o mtree.obj `if test -f 'age/utils/mtree.cpp'; then $(CYGPATH_W) 'age/utils/mtree.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/mtree.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mtree.Tpo $(DEPDIR)/mtree.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/mtree.cpp' object='mtree.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mtree.obj `if test -f 'age/utils/mtree.cpp'; then $(CYGPATH_W) 'age/utils/mtree.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/mtree.cpp'; fi` utils.o: age/utils/utils.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utils.o -MD -MP -MF $(DEPDIR)/utils.Tpo -c -o utils.o `test -f 'age/utils/utils.cpp' || echo '$(srcdir)/'`age/utils/utils.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/utils.Tpo $(DEPDIR)/utils.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/utils.cpp' object='utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utils.o `test -f 'age/utils/utils.cpp' || echo '$(srcdir)/'`age/utils/utils.cpp utils.obj: age/utils/utils.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utils.obj -MD -MP -MF $(DEPDIR)/utils.Tpo -c -o utils.obj `if test -f 'age/utils/utils.cpp'; then $(CYGPATH_W) 'age/utils/utils.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/utils.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/utils.Tpo $(DEPDIR)/utils.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/utils/utils.cpp' object='utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utils.obj `if test -f 'age/utils/utils.cpp'; then $(CYGPATH_W) 'age/utils/utils.cpp'; else $(CYGPATH_W) '$(srcdir)/age/utils/utils.cpp'; fi` animationk.o: kofola/animationk.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animationk.o -MD -MP -MF $(DEPDIR)/animationk.Tpo -c -o animationk.o `test -f 'kofola/animationk.cpp' || echo '$(srcdir)/'`kofola/animationk.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animationk.Tpo $(DEPDIR)/animationk.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/animationk.cpp' object='animationk.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animationk.o `test -f 'kofola/animationk.cpp' || echo '$(srcdir)/'`kofola/animationk.cpp animationk.obj: kofola/animationk.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animationk.obj -MD -MP -MF $(DEPDIR)/animationk.Tpo -c -o animationk.obj `if test -f 'kofola/animationk.cpp'; then $(CYGPATH_W) 'kofola/animationk.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/animationk.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/animationk.Tpo $(DEPDIR)/animationk.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/animationk.cpp' object='animationk.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animationk.obj `if test -f 'kofola/animationk.cpp'; then $(CYGPATH_W) 'kofola/animationk.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/animationk.cpp'; fi` generator_random.o: generator/generator_random.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT generator_random.o -MD -MP -MF $(DEPDIR)/generator_random.Tpo -c -o generator_random.o `test -f 'generator/generator_random.cpp' || echo '$(srcdir)/'`generator/generator_random.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generator_random.Tpo $(DEPDIR)/generator_random.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='generator/generator_random.cpp' object='generator_random.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o generator_random.o `test -f 'generator/generator_random.cpp' || echo '$(srcdir)/'`generator/generator_random.cpp generator_random.obj: generator/generator_random.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT generator_random.obj -MD -MP -MF $(DEPDIR)/generator_random.Tpo -c -o generator_random.obj `if test -f 'generator/generator_random.cpp'; then $(CYGPATH_W) 'generator/generator_random.cpp'; else $(CYGPATH_W) '$(srcdir)/generator/generator_random.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generator_random.Tpo $(DEPDIR)/generator_random.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='generator/generator_random.cpp' object='generator_random.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o generator_random.obj `if test -f 'generator/generator_random.cpp'; then $(CYGPATH_W) 'generator/generator_random.cpp'; else $(CYGPATH_W) '$(srcdir)/generator/generator_random.cpp'; fi` Ddx.o: komat/Ddx.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Ddx.o -MD -MP -MF $(DEPDIR)/Ddx.Tpo -c -o Ddx.o `test -f 'komat/Ddx.cpp' || echo '$(srcdir)/'`komat/Ddx.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Ddx.Tpo $(DEPDIR)/Ddx.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Ddx.cpp' object='Ddx.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Ddx.o `test -f 'komat/Ddx.cpp' || echo '$(srcdir)/'`komat/Ddx.cpp Ddx.obj: komat/Ddx.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Ddx.obj -MD -MP -MF $(DEPDIR)/Ddx.Tpo -c -o Ddx.obj `if test -f 'komat/Ddx.cpp'; then $(CYGPATH_W) 'komat/Ddx.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Ddx.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Ddx.Tpo $(DEPDIR)/Ddx.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Ddx.cpp' object='Ddx.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Ddx.obj `if test -f 'komat/Ddx.cpp'; then $(CYGPATH_W) 'komat/Ddx.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Ddx.cpp'; fi` kfile.o: komat/kfile.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT kfile.o -MD -MP -MF $(DEPDIR)/kfile.Tpo -c -o kfile.o `test -f 'komat/kfile.cpp' || echo '$(srcdir)/'`komat/kfile.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kfile.Tpo $(DEPDIR)/kfile.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/kfile.cpp' object='kfile.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o kfile.o `test -f 'komat/kfile.cpp' || echo '$(srcdir)/'`komat/kfile.cpp kfile.obj: komat/kfile.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT kfile.obj -MD -MP -MF $(DEPDIR)/kfile.Tpo -c -o kfile.obj `if test -f 'komat/kfile.cpp'; then $(CYGPATH_W) 'komat/kfile.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/kfile.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kfile.Tpo $(DEPDIR)/kfile.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/kfile.cpp' object='kfile.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o kfile.obj `if test -f 'komat/kfile.cpp'; then $(CYGPATH_W) 'komat/kfile.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/kfile.cpp'; fi` Berusky3d_animace.o: komat/Berusky3d_animace.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_animace.o -MD -MP -MF $(DEPDIR)/Berusky3d_animace.Tpo -c -o Berusky3d_animace.o `test -f 'komat/Berusky3d_animace.cpp' || echo '$(srcdir)/'`komat/Berusky3d_animace.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_animace.Tpo $(DEPDIR)/Berusky3d_animace.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_animace.cpp' object='Berusky3d_animace.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_animace.o `test -f 'komat/Berusky3d_animace.cpp' || echo '$(srcdir)/'`komat/Berusky3d_animace.cpp Berusky3d_animace.obj: komat/Berusky3d_animace.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Berusky3d_animace.obj -MD -MP -MF $(DEPDIR)/Berusky3d_animace.Tpo -c -o Berusky3d_animace.obj `if test -f 'komat/Berusky3d_animace.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_animace.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_animace.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Berusky3d_animace.Tpo $(DEPDIR)/Berusky3d_animace.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Berusky3d_animace.cpp' object='Berusky3d_animace.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Berusky3d_animace.obj `if test -f 'komat/Berusky3d_animace.cpp'; then $(CYGPATH_W) 'komat/Berusky3d_animace.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Berusky3d_animace.cpp'; fi` 3dmath.o: komat/3dmath.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3dmath.o -MD -MP -MF $(DEPDIR)/3dmath.Tpo -c -o 3dmath.o `test -f 'komat/3dmath.cpp' || echo '$(srcdir)/'`komat/3dmath.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3dmath.Tpo $(DEPDIR)/3dmath.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/3dmath.cpp' object='3dmath.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3dmath.o `test -f 'komat/3dmath.cpp' || echo '$(srcdir)/'`komat/3dmath.cpp 3dmath.obj: komat/3dmath.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3dmath.obj -MD -MP -MF $(DEPDIR)/3dmath.Tpo -c -o 3dmath.obj `if test -f 'komat/3dmath.cpp'; then $(CYGPATH_W) 'komat/3dmath.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/3dmath.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3dmath.Tpo $(DEPDIR)/3dmath.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/3dmath.cpp' object='3dmath.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3dmath.obj `if test -f 'komat/3dmath.cpp'; then $(CYGPATH_W) 'komat/3dmath.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/3dmath.cpp'; fi` 3dproject.o: komat/3dproject.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3dproject.o -MD -MP -MF $(DEPDIR)/3dproject.Tpo -c -o 3dproject.o `test -f 'komat/3dproject.cpp' || echo '$(srcdir)/'`komat/3dproject.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3dproject.Tpo $(DEPDIR)/3dproject.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/3dproject.cpp' object='3dproject.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3dproject.o `test -f 'komat/3dproject.cpp' || echo '$(srcdir)/'`komat/3dproject.cpp 3dproject.obj: komat/3dproject.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 3dproject.obj -MD -MP -MF $(DEPDIR)/3dproject.Tpo -c -o 3dproject.obj `if test -f 'komat/3dproject.cpp'; then $(CYGPATH_W) 'komat/3dproject.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/3dproject.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/3dproject.Tpo $(DEPDIR)/3dproject.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/3dproject.cpp' object='3dproject.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 3dproject.obj `if test -f 'komat/3dproject.cpp'; then $(CYGPATH_W) 'komat/3dproject.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/3dproject.cpp'; fi` Mat3d.o: komat/Mat3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mat3d.o -MD -MP -MF $(DEPDIR)/Mat3d.Tpo -c -o Mat3d.o `test -f 'komat/Mat3d.cpp' || echo '$(srcdir)/'`komat/Mat3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Mat3d.Tpo $(DEPDIR)/Mat3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Mat3d.cpp' object='Mat3d.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mat3d.o `test -f 'komat/Mat3d.cpp' || echo '$(srcdir)/'`komat/Mat3d.cpp Mat3d.obj: komat/Mat3d.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mat3d.obj -MD -MP -MF $(DEPDIR)/Mat3d.Tpo -c -o Mat3d.obj `if test -f 'komat/Mat3d.cpp'; then $(CYGPATH_W) 'komat/Mat3d.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Mat3d.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Mat3d.Tpo $(DEPDIR)/Mat3d.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Mat3d.cpp' object='Mat3d.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mat3d.obj `if test -f 'komat/Mat3d.cpp'; then $(CYGPATH_W) 'komat/Mat3d.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Mat3d.cpp'; fi` Keyframe.o: komat/Keyframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Keyframe.o -MD -MP -MF $(DEPDIR)/Keyframe.Tpo -c -o Keyframe.o `test -f 'komat/Keyframe.cpp' || echo '$(srcdir)/'`komat/Keyframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Keyframe.Tpo $(DEPDIR)/Keyframe.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Keyframe.cpp' object='Keyframe.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Keyframe.o `test -f 'komat/Keyframe.cpp' || echo '$(srcdir)/'`komat/Keyframe.cpp Keyframe.obj: komat/Keyframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Keyframe.obj -MD -MP -MF $(DEPDIR)/Keyframe.Tpo -c -o Keyframe.obj `if test -f 'komat/Keyframe.cpp'; then $(CYGPATH_W) 'komat/Keyframe.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Keyframe.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Keyframe.Tpo $(DEPDIR)/Keyframe.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Keyframe.cpp' object='Keyframe.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Keyframe.obj `if test -f 'komat/Keyframe.cpp'; then $(CYGPATH_W) 'komat/Keyframe.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Keyframe.cpp'; fi` Texture.o: komat/Texture.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Texture.o -MD -MP -MF $(DEPDIR)/Texture.Tpo -c -o Texture.o `test -f 'komat/Texture.cpp' || echo '$(srcdir)/'`komat/Texture.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Texture.Tpo $(DEPDIR)/Texture.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Texture.cpp' object='Texture.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Texture.o `test -f 'komat/Texture.cpp' || echo '$(srcdir)/'`komat/Texture.cpp Texture.obj: komat/Texture.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Texture.obj -MD -MP -MF $(DEPDIR)/Texture.Tpo -c -o Texture.obj `if test -f 'komat/Texture.cpp'; then $(CYGPATH_W) 'komat/Texture.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Texture.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Texture.Tpo $(DEPDIR)/Texture.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Texture.cpp' object='Texture.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Texture.obj `if test -f 'komat/Texture.cpp'; then $(CYGPATH_W) 'komat/Texture.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Texture.cpp'; fi` Texture_import.o: komat/Texture_import.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Texture_import.o -MD -MP -MF $(DEPDIR)/Texture_import.Tpo -c -o Texture_import.o `test -f 'komat/Texture_import.cpp' || echo '$(srcdir)/'`komat/Texture_import.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Texture_import.Tpo $(DEPDIR)/Texture_import.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Texture_import.cpp' object='Texture_import.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Texture_import.o `test -f 'komat/Texture_import.cpp' || echo '$(srcdir)/'`komat/Texture_import.cpp Texture_import.obj: komat/Texture_import.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Texture_import.obj -MD -MP -MF $(DEPDIR)/Texture_import.Tpo -c -o Texture_import.obj `if test -f 'komat/Texture_import.cpp'; then $(CYGPATH_W) 'komat/Texture_import.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Texture_import.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Texture_import.Tpo $(DEPDIR)/Texture_import.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Texture_import.cpp' object='Texture_import.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Texture_import.obj `if test -f 'komat/Texture_import.cpp'; then $(CYGPATH_W) 'komat/Texture_import.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Texture_import.cpp'; fi` obbo.o: komat/obbo.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT obbo.o -MD -MP -MF $(DEPDIR)/obbo.Tpo -c -o obbo.o `test -f 'komat/obbo.cpp' || echo '$(srcdir)/'`komat/obbo.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/obbo.Tpo $(DEPDIR)/obbo.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/obbo.cpp' object='obbo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o obbo.o `test -f 'komat/obbo.cpp' || echo '$(srcdir)/'`komat/obbo.cpp obbo.obj: komat/obbo.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT obbo.obj -MD -MP -MF $(DEPDIR)/obbo.Tpo -c -o obbo.obj `if test -f 'komat/obbo.cpp'; then $(CYGPATH_W) 'komat/obbo.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/obbo.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/obbo.Tpo $(DEPDIR)/obbo.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/obbo.cpp' object='obbo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o obbo.obj `if test -f 'komat/obbo.cpp'; then $(CYGPATH_W) 'komat/obbo.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/obbo.cpp'; fi` Kdtree.o: komat/Kdtree.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Kdtree.o -MD -MP -MF $(DEPDIR)/Kdtree.Tpo -c -o Kdtree.o `test -f 'komat/Kdtree.cpp' || echo '$(srcdir)/'`komat/Kdtree.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Kdtree.Tpo $(DEPDIR)/Kdtree.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Kdtree.cpp' object='Kdtree.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Kdtree.o `test -f 'komat/Kdtree.cpp' || echo '$(srcdir)/'`komat/Kdtree.cpp Kdtree.obj: komat/Kdtree.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Kdtree.obj -MD -MP -MF $(DEPDIR)/Kdtree.Tpo -c -o Kdtree.obj `if test -f 'komat/Kdtree.cpp'; then $(CYGPATH_W) 'komat/Kdtree.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Kdtree.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Kdtree.Tpo $(DEPDIR)/Kdtree.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/Kdtree.cpp' object='Kdtree.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Kdtree.obj `if test -f 'komat/Kdtree.cpp'; then $(CYGPATH_W) 'komat/Kdtree.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/Kdtree.cpp'; fi` json_export.o: komat/json_export.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT json_export.o -MD -MP -MF $(DEPDIR)/json_export.Tpo -c -o json_export.o `test -f 'komat/json_export.cpp' || echo '$(srcdir)/'`komat/json_export.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/json_export.Tpo $(DEPDIR)/json_export.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/json_export.cpp' object='json_export.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o json_export.o `test -f 'komat/json_export.cpp' || echo '$(srcdir)/'`komat/json_export.cpp json_export.obj: komat/json_export.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT json_export.obj -MD -MP -MF $(DEPDIR)/json_export.Tpo -c -o json_export.obj `if test -f 'komat/json_export.cpp'; then $(CYGPATH_W) 'komat/json_export.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/json_export.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/json_export.Tpo $(DEPDIR)/json_export.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='komat/json_export.cpp' object='json_export.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o json_export.obj `if test -f 'komat/json_export.cpp'; then $(CYGPATH_W) 'komat/json_export.cpp'; else $(CYGPATH_W) '$(srcdir)/komat/json_export.cpp'; fi` ambient_sounds.o: kofola/ambient_sounds.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ambient_sounds.o -MD -MP -MF $(DEPDIR)/ambient_sounds.Tpo -c -o ambient_sounds.o `test -f 'kofola/ambient_sounds.cpp' || echo '$(srcdir)/'`kofola/ambient_sounds.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ambient_sounds.Tpo $(DEPDIR)/ambient_sounds.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/ambient_sounds.cpp' object='ambient_sounds.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ambient_sounds.o `test -f 'kofola/ambient_sounds.cpp' || echo '$(srcdir)/'`kofola/ambient_sounds.cpp ambient_sounds.obj: kofola/ambient_sounds.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ambient_sounds.obj -MD -MP -MF $(DEPDIR)/ambient_sounds.Tpo -c -o ambient_sounds.obj `if test -f 'kofola/ambient_sounds.cpp'; then $(CYGPATH_W) 'kofola/ambient_sounds.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/ambient_sounds.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ambient_sounds.Tpo $(DEPDIR)/ambient_sounds.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/ambient_sounds.cpp' object='ambient_sounds.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ambient_sounds.obj `if test -f 'kofola/ambient_sounds.cpp'; then $(CYGPATH_W) 'kofola/ambient_sounds.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/ambient_sounds.cpp'; fi` audio_plug-in.o: kofola/audio_plug-in.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audio_plug-in.o -MD -MP -MF $(DEPDIR)/audio_plug-in.Tpo -c -o audio_plug-in.o `test -f 'kofola/audio_plug-in.cpp' || echo '$(srcdir)/'`kofola/audio_plug-in.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audio_plug-in.Tpo $(DEPDIR)/audio_plug-in.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/audio_plug-in.cpp' object='audio_plug-in.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audio_plug-in.o `test -f 'kofola/audio_plug-in.cpp' || echo '$(srcdir)/'`kofola/audio_plug-in.cpp audio_plug-in.obj: kofola/audio_plug-in.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audio_plug-in.obj -MD -MP -MF $(DEPDIR)/audio_plug-in.Tpo -c -o audio_plug-in.obj `if test -f 'kofola/audio_plug-in.cpp'; then $(CYGPATH_W) 'kofola/audio_plug-in.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/audio_plug-in.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audio_plug-in.Tpo $(DEPDIR)/audio_plug-in.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kofola/audio_plug-in.cpp' object='audio_plug-in.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audio_plug-in.obj `if test -f 'kofola/audio_plug-in.cpp'; then $(CYGPATH_W) 'kofola/audio_plug-in.cpp'; else $(CYGPATH_W) '$(srcdir)/kofola/audio_plug-in.cpp'; fi` compat_mini.o: tmp/compat_mini.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT compat_mini.o -MD -MP -MF $(DEPDIR)/compat_mini.Tpo -c -o compat_mini.o `test -f 'tmp/compat_mini.cpp' || echo '$(srcdir)/'`tmp/compat_mini.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/compat_mini.Tpo $(DEPDIR)/compat_mini.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tmp/compat_mini.cpp' object='compat_mini.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o compat_mini.o `test -f 'tmp/compat_mini.cpp' || echo '$(srcdir)/'`tmp/compat_mini.cpp compat_mini.obj: tmp/compat_mini.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT compat_mini.obj -MD -MP -MF $(DEPDIR)/compat_mini.Tpo -c -o compat_mini.obj `if test -f 'tmp/compat_mini.cpp'; then $(CYGPATH_W) 'tmp/compat_mini.cpp'; else $(CYGPATH_W) '$(srcdir)/tmp/compat_mini.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/compat_mini.Tpo $(DEPDIR)/compat_mini.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tmp/compat_mini.cpp' object='compat_mini.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o compat_mini.obj `if test -f 'tmp/compat_mini.cpp'; then $(CYGPATH_W) 'tmp/compat_mini.cpp'; else $(CYGPATH_W) '$(srcdir)/tmp/compat_mini.cpp'; fi` alut_test.o: tmp/alut_test.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT alut_test.o -MD -MP -MF $(DEPDIR)/alut_test.Tpo -c -o alut_test.o `test -f 'tmp/alut_test.cpp' || echo '$(srcdir)/'`tmp/alut_test.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alut_test.Tpo $(DEPDIR)/alut_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tmp/alut_test.cpp' object='alut_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o alut_test.o `test -f 'tmp/alut_test.cpp' || echo '$(srcdir)/'`tmp/alut_test.cpp alut_test.obj: tmp/alut_test.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT alut_test.obj -MD -MP -MF $(DEPDIR)/alut_test.Tpo -c -o alut_test.obj `if test -f 'tmp/alut_test.cpp'; then $(CYGPATH_W) 'tmp/alut_test.cpp'; else $(CYGPATH_W) '$(srcdir)/tmp/alut_test.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alut_test.Tpo $(DEPDIR)/alut_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tmp/alut_test.cpp' object='alut_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o alut_test.obj `if test -f 'tmp/alut_test.cpp'; then $(CYGPATH_W) 'tmp/alut_test.cpp'; else $(CYGPATH_W) '$(srcdir)/tmp/alut_test.cpp'; fi` aabb.o: age/graph/aabb.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT aabb.o -MD -MP -MF $(DEPDIR)/aabb.Tpo -c -o aabb.o `test -f 'age/graph/aabb.cpp' || echo '$(srcdir)/'`age/graph/aabb.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/aabb.Tpo $(DEPDIR)/aabb.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/aabb.cpp' object='aabb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o aabb.o `test -f 'age/graph/aabb.cpp' || echo '$(srcdir)/'`age/graph/aabb.cpp aabb.obj: age/graph/aabb.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT aabb.obj -MD -MP -MF $(DEPDIR)/aabb.Tpo -c -o aabb.obj `if test -f 'age/graph/aabb.cpp'; then $(CYGPATH_W) 'age/graph/aabb.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/aabb.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/aabb.Tpo $(DEPDIR)/aabb.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='age/graph/aabb.cpp' object='aabb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o aabb.obj `if test -f 'age/graph/aabb.cpp'; then $(CYGPATH_W) 'age/graph/aabb.cpp'; else $(CYGPATH_W) '$(srcdir)/age/graph/aabb.cpp'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/2D_graphic.Po -rm -f ./$(DEPDIR)/3D_graphic.Po -rm -f ./$(DEPDIR)/3D_menus.Po -rm -f ./$(DEPDIR)/3d_math.Po -rm -f ./$(DEPDIR)/3d_math_k.Po -rm -f ./$(DEPDIR)/3dinterface.Po -rm -f ./$(DEPDIR)/3dmath.Po -rm -f ./$(DEPDIR)/3dproject.Po -rm -f ./$(DEPDIR)/Berusky3d.Po -rm -f ./$(DEPDIR)/Berusky3d_animace.Po -rm -f ./$(DEPDIR)/Berusky3d_castice.Po -rm -f ./$(DEPDIR)/Berusky3d_ini.Po -rm -f ./$(DEPDIR)/Berusky3d_kamery.Po -rm -f ./$(DEPDIR)/Berusky3d_kofola2d.Po -rm -f ./$(DEPDIR)/Berusky3d_kofola_interface.Po -rm -f ./$(DEPDIR)/Berusky3d_light.Po -rm -f ./$(DEPDIR)/Berusky3d_load.Po -rm -f ./$(DEPDIR)/Berusky3d_render.Po -rm -f ./$(DEPDIR)/Bind.Po -rm -f ./$(DEPDIR)/Camera.Po -rm -f ./$(DEPDIR)/Comics.Po -rm -f ./$(DEPDIR)/Command.Po -rm -f ./$(DEPDIR)/Dda.Po -rm -f ./$(DEPDIR)/Ddx.Po -rm -f ./$(DEPDIR)/Demo.Po -rm -f ./$(DEPDIR)/Di.Po -rm -f ./$(DEPDIR)/Init.Po -rm -f ./$(DEPDIR)/Kdtree.Po -rm -f ./$(DEPDIR)/Keyframe.Po -rm -f ./$(DEPDIR)/Load.Po -rm -f ./$(DEPDIR)/Load_chunks.Po -rm -f ./$(DEPDIR)/Load_out.Po -rm -f ./$(DEPDIR)/Mat3d.Po -rm -f ./$(DEPDIR)/Menu.Po -rm -f ./$(DEPDIR)/Menu2.Po -rm -f ./$(DEPDIR)/Texture.Po -rm -f ./$(DEPDIR)/Texture_import.Po -rm -f ./$(DEPDIR)/Tools.Po -rm -f ./$(DEPDIR)/aabb.Po -rm -f ./$(DEPDIR)/adas.Po -rm -f ./$(DEPDIR)/age.Po -rm -f ./$(DEPDIR)/age_main.Po -rm -f ./$(DEPDIR)/alpha.Po -rm -f ./$(DEPDIR)/alut_test.Po -rm -f ./$(DEPDIR)/ambient_sounds.Po -rm -f ./$(DEPDIR)/animation.Po -rm -f ./$(DEPDIR)/animation_time.Po -rm -f ./$(DEPDIR)/animation_track.Po -rm -f ./$(DEPDIR)/animation_track_bezier.Po -rm -f ./$(DEPDIR)/animation_track_linear.Po -rm -f ./$(DEPDIR)/animationk.Po -rm -f ./$(DEPDIR)/animend_functions.Po -rm -f ./$(DEPDIR)/audio_plug-in.Po -rm -f ./$(DEPDIR)/bitmap.Po -rm -f ./$(DEPDIR)/box.Po -rm -f ./$(DEPDIR)/camera.Po -rm -f ./$(DEPDIR)/camera_interface.Po -rm -f ./$(DEPDIR)/change.Po -rm -f ./$(DEPDIR)/color.Po -rm -f ./$(DEPDIR)/color_hsv.Po -rm -f ./$(DEPDIR)/compat.Po -rm -f ./$(DEPDIR)/compat_mini.Po -rm -f ./$(DEPDIR)/controls.Po -rm -f ./$(DEPDIR)/controls3d.Po -rm -f ./$(DEPDIR)/credits.Po -rm -f ./$(DEPDIR)/data_file.Po -rm -f ./$(DEPDIR)/draw.Po -rm -f ./$(DEPDIR)/events.Po -rm -f ./$(DEPDIR)/ferguson.Po -rm -f ./$(DEPDIR)/font.Po -rm -f ./$(DEPDIR)/font3d.Po -rm -f ./$(DEPDIR)/game_init.Po -rm -f ./$(DEPDIR)/game_logic.Po -rm -f ./$(DEPDIR)/game_main.Po -rm -f ./$(DEPDIR)/generator_random.Po -rm -f ./$(DEPDIR)/gext.Po -rm -f ./$(DEPDIR)/glwrapper.Po -rm -f ./$(DEPDIR)/gpipe.Po -rm -f ./$(DEPDIR)/grammar.Po -rm -f ./$(DEPDIR)/graph3d.Po -rm -f ./$(DEPDIR)/ini.Po -rm -f ./$(DEPDIR)/input.Po -rm -f ./$(DEPDIR)/intersect.Po -rm -f ./$(DEPDIR)/json_export.Po -rm -f ./$(DEPDIR)/kfile.Po -rm -f ./$(DEPDIR)/lighting.Po -rm -f ./$(DEPDIR)/load_level.Po -rm -f ./$(DEPDIR)/log.Po -rm -f ./$(DEPDIR)/material.Po -rm -f ./$(DEPDIR)/material_texture.Po -rm -f ./$(DEPDIR)/matrix.Po -rm -f ./$(DEPDIR)/matrix_animated.Po -rm -f ./$(DEPDIR)/matrix_notified.Po -rm -f ./$(DEPDIR)/mem_alloc.Po -rm -f ./$(DEPDIR)/menu_script.Po -rm -f ./$(DEPDIR)/mesh.Po -rm -f ./$(DEPDIR)/mtree.Po -rm -f ./$(DEPDIR)/normals.Po -rm -f ./$(DEPDIR)/obb.Po -rm -f ./$(DEPDIR)/obbo.Po -rm -f ./$(DEPDIR)/object_base.Po -rm -f ./$(DEPDIR)/object_box.Po -rm -f ./$(DEPDIR)/object_geometry.Po -rm -f ./$(DEPDIR)/object_hierarchy.Po -rm -f ./$(DEPDIR)/object_list.Po -rm -f ./$(DEPDIR)/object_render_list.Po -rm -f ./$(DEPDIR)/object_scene.Po -rm -f ./$(DEPDIR)/object_transformation.Po -rm -f ./$(DEPDIR)/object_world.Po -rm -f ./$(DEPDIR)/ogg_io.Po -rm -f ./$(DEPDIR)/ogg_stream.Po -rm -f ./$(DEPDIR)/polar.Po -rm -f ./$(DEPDIR)/print.Po -rm -f ./$(DEPDIR)/profiles.Po -rm -f ./$(DEPDIR)/scene.Po -rm -f ./$(DEPDIR)/scene_import_3ds.Po -rm -f ./$(DEPDIR)/scene_import_b2m.Po -rm -f ./$(DEPDIR)/scene_import_txt.Po -rm -f ./$(DEPDIR)/scene_load.Po -rm -f ./$(DEPDIR)/selection.Po -rm -f ./$(DEPDIR)/setup.Po -rm -f ./$(DEPDIR)/square_cut.Po -rm -f ./$(DEPDIR)/surface.Po -rm -f ./$(DEPDIR)/surface_height.Po -rm -f ./$(DEPDIR)/surface_mask.Po -rm -f ./$(DEPDIR)/surface_sdl.Po -rm -f ./$(DEPDIR)/surface_sw.Po -rm -f ./$(DEPDIR)/texture_func.Po -rm -f ./$(DEPDIR)/texture_unit.Po -rm -f ./$(DEPDIR)/timer.Po -rm -f ./$(DEPDIR)/triangle.Po -rm -f ./$(DEPDIR)/trigers.Po -rm -f ./$(DEPDIR)/utils.Po -rm -f ./$(DEPDIR)/vector.Po -rm -f ./$(DEPDIR)/vertex_arrays.Po -rm -f ./$(DEPDIR)/volume.Po -rm -f ./$(DEPDIR)/water.Po -rm -f ./$(DEPDIR)/world_interface.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/2D_graphic.Po -rm -f ./$(DEPDIR)/3D_graphic.Po -rm -f ./$(DEPDIR)/3D_menus.Po -rm -f ./$(DEPDIR)/3d_math.Po -rm -f ./$(DEPDIR)/3d_math_k.Po -rm -f ./$(DEPDIR)/3dinterface.Po -rm -f ./$(DEPDIR)/3dmath.Po -rm -f ./$(DEPDIR)/3dproject.Po -rm -f ./$(DEPDIR)/Berusky3d.Po -rm -f ./$(DEPDIR)/Berusky3d_animace.Po -rm -f ./$(DEPDIR)/Berusky3d_castice.Po -rm -f ./$(DEPDIR)/Berusky3d_ini.Po -rm -f ./$(DEPDIR)/Berusky3d_kamery.Po -rm -f ./$(DEPDIR)/Berusky3d_kofola2d.Po -rm -f ./$(DEPDIR)/Berusky3d_kofola_interface.Po -rm -f ./$(DEPDIR)/Berusky3d_light.Po -rm -f ./$(DEPDIR)/Berusky3d_load.Po -rm -f ./$(DEPDIR)/Berusky3d_render.Po -rm -f ./$(DEPDIR)/Bind.Po -rm -f ./$(DEPDIR)/Camera.Po -rm -f ./$(DEPDIR)/Comics.Po -rm -f ./$(DEPDIR)/Command.Po -rm -f ./$(DEPDIR)/Dda.Po -rm -f ./$(DEPDIR)/Ddx.Po -rm -f ./$(DEPDIR)/Demo.Po -rm -f ./$(DEPDIR)/Di.Po -rm -f ./$(DEPDIR)/Init.Po -rm -f ./$(DEPDIR)/Kdtree.Po -rm -f ./$(DEPDIR)/Keyframe.Po -rm -f ./$(DEPDIR)/Load.Po -rm -f ./$(DEPDIR)/Load_chunks.Po -rm -f ./$(DEPDIR)/Load_out.Po -rm -f ./$(DEPDIR)/Mat3d.Po -rm -f ./$(DEPDIR)/Menu.Po -rm -f ./$(DEPDIR)/Menu2.Po -rm -f ./$(DEPDIR)/Texture.Po -rm -f ./$(DEPDIR)/Texture_import.Po -rm -f ./$(DEPDIR)/Tools.Po -rm -f ./$(DEPDIR)/aabb.Po -rm -f ./$(DEPDIR)/adas.Po -rm -f ./$(DEPDIR)/age.Po -rm -f ./$(DEPDIR)/age_main.Po -rm -f ./$(DEPDIR)/alpha.Po -rm -f ./$(DEPDIR)/alut_test.Po -rm -f ./$(DEPDIR)/ambient_sounds.Po -rm -f ./$(DEPDIR)/animation.Po -rm -f ./$(DEPDIR)/animation_time.Po -rm -f ./$(DEPDIR)/animation_track.Po -rm -f ./$(DEPDIR)/animation_track_bezier.Po -rm -f ./$(DEPDIR)/animation_track_linear.Po -rm -f ./$(DEPDIR)/animationk.Po -rm -f ./$(DEPDIR)/animend_functions.Po -rm -f ./$(DEPDIR)/audio_plug-in.Po -rm -f ./$(DEPDIR)/bitmap.Po -rm -f ./$(DEPDIR)/box.Po -rm -f ./$(DEPDIR)/camera.Po -rm -f ./$(DEPDIR)/camera_interface.Po -rm -f ./$(DEPDIR)/change.Po -rm -f ./$(DEPDIR)/color.Po -rm -f ./$(DEPDIR)/color_hsv.Po -rm -f ./$(DEPDIR)/compat.Po -rm -f ./$(DEPDIR)/compat_mini.Po -rm -f ./$(DEPDIR)/controls.Po -rm -f ./$(DEPDIR)/controls3d.Po -rm -f ./$(DEPDIR)/credits.Po -rm -f ./$(DEPDIR)/data_file.Po -rm -f ./$(DEPDIR)/draw.Po -rm -f ./$(DEPDIR)/events.Po -rm -f ./$(DEPDIR)/ferguson.Po -rm -f ./$(DEPDIR)/font.Po -rm -f ./$(DEPDIR)/font3d.Po -rm -f ./$(DEPDIR)/game_init.Po -rm -f ./$(DEPDIR)/game_logic.Po -rm -f ./$(DEPDIR)/game_main.Po -rm -f ./$(DEPDIR)/generator_random.Po -rm -f ./$(DEPDIR)/gext.Po -rm -f ./$(DEPDIR)/glwrapper.Po -rm -f ./$(DEPDIR)/gpipe.Po -rm -f ./$(DEPDIR)/grammar.Po -rm -f ./$(DEPDIR)/graph3d.Po -rm -f ./$(DEPDIR)/ini.Po -rm -f ./$(DEPDIR)/input.Po -rm -f ./$(DEPDIR)/intersect.Po -rm -f ./$(DEPDIR)/json_export.Po -rm -f ./$(DEPDIR)/kfile.Po -rm -f ./$(DEPDIR)/lighting.Po -rm -f ./$(DEPDIR)/load_level.Po -rm -f ./$(DEPDIR)/log.Po -rm -f ./$(DEPDIR)/material.Po -rm -f ./$(DEPDIR)/material_texture.Po -rm -f ./$(DEPDIR)/matrix.Po -rm -f ./$(DEPDIR)/matrix_animated.Po -rm -f ./$(DEPDIR)/matrix_notified.Po -rm -f ./$(DEPDIR)/mem_alloc.Po -rm -f ./$(DEPDIR)/menu_script.Po -rm -f ./$(DEPDIR)/mesh.Po -rm -f ./$(DEPDIR)/mtree.Po -rm -f ./$(DEPDIR)/normals.Po -rm -f ./$(DEPDIR)/obb.Po -rm -f ./$(DEPDIR)/obbo.Po -rm -f ./$(DEPDIR)/object_base.Po -rm -f ./$(DEPDIR)/object_box.Po -rm -f ./$(DEPDIR)/object_geometry.Po -rm -f ./$(DEPDIR)/object_hierarchy.Po -rm -f ./$(DEPDIR)/object_list.Po -rm -f ./$(DEPDIR)/object_render_list.Po -rm -f ./$(DEPDIR)/object_scene.Po -rm -f ./$(DEPDIR)/object_transformation.Po -rm -f ./$(DEPDIR)/object_world.Po -rm -f ./$(DEPDIR)/ogg_io.Po -rm -f ./$(DEPDIR)/ogg_stream.Po -rm -f ./$(DEPDIR)/polar.Po -rm -f ./$(DEPDIR)/print.Po -rm -f ./$(DEPDIR)/profiles.Po -rm -f ./$(DEPDIR)/scene.Po -rm -f ./$(DEPDIR)/scene_import_3ds.Po -rm -f ./$(DEPDIR)/scene_import_b2m.Po -rm -f ./$(DEPDIR)/scene_import_txt.Po -rm -f ./$(DEPDIR)/scene_load.Po -rm -f ./$(DEPDIR)/selection.Po -rm -f ./$(DEPDIR)/setup.Po -rm -f ./$(DEPDIR)/square_cut.Po -rm -f ./$(DEPDIR)/surface.Po -rm -f ./$(DEPDIR)/surface_height.Po -rm -f ./$(DEPDIR)/surface_mask.Po -rm -f ./$(DEPDIR)/surface_sdl.Po -rm -f ./$(DEPDIR)/surface_sw.Po -rm -f ./$(DEPDIR)/texture_func.Po -rm -f ./$(DEPDIR)/texture_unit.Po -rm -f ./$(DEPDIR)/timer.Po -rm -f ./$(DEPDIR)/triangle.Po -rm -f ./$(DEPDIR)/trigers.Po -rm -f ./$(DEPDIR)/utils.Po -rm -f ./$(DEPDIR)/vector.Po -rm -f ./$(DEPDIR)/vertex_arrays.Po -rm -f ./$(DEPDIR)/volume.Po -rm -f ./$(DEPDIR)/water.Po -rm -f ./$(DEPDIR)/world_interface.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: berusky2-0.12/src/adas/0000755000175000017500000000000013676433304011713 500000000000000berusky2-0.12/src/adas/ogg_stream.c0000644000175000017500000004765613674426075014155 00000000000000//------------------------------------------------------------------------------------------------ // includes //------------------------------------------------------------------------------------------------ #include #include "ogg_stream.h" #include #include "compat_mini.h" #include #include #include //------------------------------------------------------------------------------------------------ // libraries //------------------------------------------------------------------------------------------------ /* #ifdef _DEBUG #pragma comment(lib,"lib\\ogg_d.lib") #pragma comment(lib,"lib\\vorbis_d.lib") #pragma comment(lib,"lib\\vorbisfile_d.lib") #endif #ifndef _DEBUG #pragma comment(lib,"lib\\ogg.lib") #pragma comment(lib,"lib\\vorbis.lib") #pragma comment(lib,"lib\\vorbisfile.lib") #endif */ //------------------------------------------------------------------------------------------------ // types definitions //------------------------------------------------------------------------------------------------ typedef struct { OggVorbis_File vf; // pointer to ogg vorbis file structure vorbis_info *vi; // pointer to ogg vorbis file info structure FILE *file; // pointer to ogg file char Name[256]; // name of file int Current_Bitstream; // currnt bit stream char Data[131072]; // decompresed data char bEof; // End Of File ALsizei Size; // size of buffer (Data[]) ALuint Frequece; // frequence ALenum Format; // format (16, 8, stereo, mono) ALuint Buffer[3]; // pointers of buffer ALuint Source; // sound source float Gain; // gain (volume) float Pitch; // pitch float Position[3]; // position of source float Velocity[3]; // velocity THREAD_ID ThreadID; // Decompression/Play Thread ID THREAD_HANDLE Thread; // pointer to D/P Thread int Shot_down; // shot down thred signal char bSetup; // Stream was Set void *Setup_Flag; // Flag to set, when setuping is done THREAD_HANDLE Setup_Thread; // pointer to Setup Thread THREAD_ID Setup_ThreadID; // Setup Thread ID } ADAS_OGG_STRUCTURE; //------------------------------------------------------------------------------------------------ // global declarations //------------------------------------------------------------------------------------------------ static ADAS_OGG_STRUCTURE ogg; // OGG structure extern char bDevice; //static FILE *d_file; //------------------------------------------------------------------------------------------------ // function declarations //------------------------------------------------------------------------------------------------ void * adas_OGG_Proc( void *lpParameter ); void * adas_OGG_Setup_Thread( void *lpParameter ); long adas_OGG_Read_Stream(ADAS_OGG_STRUCTURE *p_ogg); void adas_Set_Last_Error(char *p_Text); void adas_Set_Last_Warning(char *p_Text); void adas_OGG_Init(void) { memset(&ogg, 0, sizeof(ADAS_OGG_STRUCTURE)); ogg.bEof = 2; } //---------------------------------------------------------------------------------------------- // Open OGG stream //---------------------------------------------------------------------------------------------- int adas_OGG_Open_Stream(char *p_File_Name) { int i,result; if(!bDevice) return 0; strcpy(ogg.Name, p_File_Name); ogg.file = fopen(ogg.Name,"rb"); if (!ogg.file) { adas_Set_Last_Error("File not found"); return 0; } result = ov_open(ogg.file,&ogg.vf,NULL,0); if (result < 0) { fclose(ogg.file); switch(result) { case OV_EREAD: adas_Set_Last_Error("A read from media returned an error."); break; case OV_ENOTVORBIS: adas_Set_Last_Error("Bitstream is not Vorbis data."); break; case OV_EVERSION: adas_Set_Last_Error("Vorbis version mismatch."); break; case OV_EBADHEADER: adas_Set_Last_Error("Invalid Vorbis bitstream header."); break; case OV_EFAULT: adas_Set_Last_Error("Internal logic fault; indicates a bug or heap/stack corruption."); break; } return 0; } ogg.vi = ov_info(&ogg.vf,-1); ogg.bEof = 0; alGetError(); alGenBuffers(3,ogg.Buffer); if(alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create buffer"); ov_clear(&ogg.vf); return 0; } for(i=0;i<3;i++) if (!alIsBuffer(ogg.Buffer[i])) { adas_Set_Last_Error("Unable to create buffer"); ov_clear(&ogg.vf); return 0; } alGetError(); alGenSources(1,&ogg.Source); if(alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create source"); ov_clear(&ogg.vf); alDeleteBuffers(2,ogg.Buffer); return 0; } if (!alIsSource(ogg.Source)) { adas_Set_Last_Error("Unable to create source"); ov_clear(&ogg.vf); alDeleteBuffers(2,ogg.Buffer); return 0; } ogg.bSetup = 0; ogg.Thread = 0; ogg.Setup_Thread = 0; ogg.Setup_Flag = NULL; return 1; } //---------------------------------------------------------------------------------------------- // Close OGG stream //---------------------------------------------------------------------------------------------- void adas_OGG_Close_Stream(void) { if(!bDevice) return; alDeleteBuffers(3,ogg.Buffer); alDeleteSources(1,&ogg.Source); ov_clear(&ogg.vf); } //---------------------------------------------------------------------------------------------- // Read OGG stream // adas_OGG_Read_Stream: critical read // adas_OGG_Read_StreamA: read optimized for segment play time // adas_OGG_Read_StreamB: read and analize stream (NOT FOR PLAYING!!!) //---------------------------------------------------------------------------------------------- long adas_OGG_Read_Stream(ADAS_OGG_STRUCTURE *p_ogg) { long lReturn; long lTotal = 0; if(!bDevice) return 0; while (lTotal < sizeof(p_ogg->Data)) { lReturn = ov_read(&p_ogg->vf, &p_ogg->Data[lTotal], sizeof(p_ogg->Data)-lTotal, 0, 2, 1, &p_ogg->Current_Bitstream); switch(lReturn) { case 0: memset((void *)&p_ogg->Data[lTotal], 0, sizeof(p_ogg->Data)-lTotal); p_ogg->bEof++; return lTotal; break; case OV_HOLE: adas_Set_Last_Warning("There was an interruption in the data. (one of: garbage \ between\npages, loss of sync followed by recapture, or a \ corrupt page)."); break; case OV_EBADLINK: adas_Set_Last_Warning("an invalid stream section was supplied to libvorbisfile, \ or the requested link is corrupt."); break; default: lTotal += lReturn; break; } if(ogg.Shot_down) return lTotal; } return lTotal; } long adas_OGG_Read_StreamA(ADAS_OGG_STRUCTURE *p_ogg, int Critical_Time) { long lReturn; long lTotal = 0; long lWait, lLostTime = 0; int dwStart, dwFinish, dwEplased; if(!bDevice) return 0; while (lTotal < sizeof(p_ogg->Data)) { dwStart = timeGetTime(); lReturn = ov_read(&p_ogg->vf, &p_ogg->Data[lTotal], sizeof(p_ogg->Data)-lTotal, 0, 2, 1, &p_ogg->Current_Bitstream); switch(lReturn) { case 0: memset((void *)&p_ogg->Data[lTotal], 0, sizeof(p_ogg->Data)-lTotal); p_ogg->bEof++; return lTotal; break; case OV_HOLE: adas_Set_Last_Warning("There was an interruption in the data. (one of: garbage \ between\npages, loss of sync followed by recapture, or a \ corrupt page)."); break; case OV_EBADLINK: adas_Set_Last_Warning("an invalid stream section was supplied to libvorbisfile, \ or the requested link is corrupt."); break; default: lTotal += lReturn; break; } if(ogg.Shot_down) return lTotal; dwFinish = timeGetTime(); dwEplased = dwFinish - dwStart; lWait = Critical_Time - dwEplased + lLostTime; if(lWait > 0) { Sleep(lWait); lLostTime = 0; } else lLostTime = lWait; } return lTotal; } long adas_OGG_Read_StreamB(ADAS_OGG_STRUCTURE *p_ogg, FILE *p_size_file, FILE *p_cycles_file) { long lReturn; long lTotal = 0; int iCounter = 0; while (lTotal < sizeof(p_ogg->Data)) { lReturn = ov_read(&p_ogg->vf, &p_ogg->Data[lTotal], sizeof(p_ogg->Data)-lTotal, 0, 2, 1, &p_ogg->Current_Bitstream); iCounter++; if(p_size_file) { fprintf(p_size_file,"%ld\n",lReturn); } switch(lReturn) { case 0: memset((void *)&p_ogg->Data[lTotal], 0, sizeof(p_ogg->Data)-lTotal); p_ogg->bEof++; return lTotal; break; case OV_HOLE: adas_Set_Last_Warning("There was an interruption in the data. (one of: garbage \ between\npages, loss of sync followed by recapture, or a \ corrupt page)."); break; case OV_EBADLINK: adas_Set_Last_Warning("an invalid stream section was supplied to libvorbisfile, \ or the requested link is corrupt."); break; default: lTotal += lReturn; break; } } if(p_cycles_file) fprintf(p_cycles_file,"%d\n",iCounter); return lTotal; } //------------------------------------------------------------------------------------------------ // set position of OGG stream //------------------------------------------------------------------------------------------------ void adas_OGG_Set_Position(float *v) { if(!bDevice) return; alSourcefv(ogg.Source,AL_POSITION,v); memcpy(ogg.Position,v,3*sizeof(float)); } //------------------------------------------------------------------------------------------------ // set Source Relative //------------------------------------------------------------------------------------------------ void adas_OGG_Set_Source_Relative(char bValue) { if(!bDevice) return; alSourcei(ogg.Source,AL_SOURCE_RELATIVE, bValue); } //------------------------------------------------------------------------------------------------ // set velocity of OGG stream //------------------------------------------------------------------------------------------------ void adas_OGG_Set_Velocity(float *v) { if(!bDevice) return; alSourcefv(ogg.Source,AL_VELOCITY,v); memcpy(ogg.Velocity,v,3*sizeof(float)); } //------------------------------------------------------------------------------------------------ // set gain of OGG stream //------------------------------------------------------------------------------------------------ void adas_OGG_Set_Gain(float v) { if(!bDevice) return; alSourcef(ogg.Source,AL_GAIN,v); ogg.Gain = v; } //------------------------------------------------------------------------------------------------ // set pitch of OGG stream //------------------------------------------------------------------------------------------------ void adas_OGG_Set_Pitch(float v) { if(!bDevice) return; alSourcef(ogg.Source,AL_PITCH,v); ogg.Pitch = v; } //------------------------------------------------------------------------------------------------ // play OGG stream //------------------------------------------------------------------------------------------------ int adas_OGG_Play_Stream(void) { if(!bDevice) return 0; if (ogg.Thread) return 0; alSourcefv(ogg.Source,AL_POSITION,ogg.Position); alSourcefv(ogg.Source,AL_VELOCITY,ogg.Velocity); alSourcef(ogg.Source,AL_GAIN,ogg.Gain); alSourcef(ogg.Source,AL_PITCH,ogg.Pitch); alSourcei(ogg.Source,AL_LOOPING,0); ogg.Format = AL_FORMAT_STEREO16; ogg.Size = sizeof(ogg.Data); ogg.Frequece = ogg.vi->rate; ogg.Shot_down = 0; ogg.Thread = CreateThread( NULL, 0, adas_OGG_Proc, (void *)&ogg, 0, &(ogg.ThreadID)); if (ogg.Thread) return 1; return 0; } //---------------------------------------------------------------------------------------------- // Set Ogg decompresion Thread priority //---------------------------------------------------------------------------------------------- void adas_OGG_Set_Priority(int Priority) { if (!ogg.Thread) return; if(Priority > 3) Priority = 3; switch ( Priority ) { case 3: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_TIME_CRITICAL); break; case 2: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_HIGHEST); break; case 1: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_ABOVE_NORMAL); break; case 0: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_NORMAL); break; case -1: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_BELOW_NORMAL); break; case -2: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_LOWEST); break; case -3: SetThreadPriority(ogg.Thread,THREAD_PRIORITY_IDLE); break; } } //---------------------------------------------------------------------------------------------- // Get Ogg decompresion Thread priority //---------------------------------------------------------------------------------------------- int adas_OGG_Get_Priority(void) { return GetThreadPriority(ogg.Thread); } //---------------------------------------------------------------------------------------------- // Set OGG Setup Stream //---------------------------------------------------------------------------------------------- int adas_OGG_Setup_Stream(void *p_Flag) { if(!bDevice) return 0; if ((ogg.Thread) || (ogg.Setup_Thread)) return 0; alSourcefv(ogg.Source,AL_POSITION,ogg.Position); alSourcefv(ogg.Source,AL_VELOCITY,ogg.Velocity); alSourcef(ogg.Source,AL_GAIN,ogg.Gain); alSourcef(ogg.Source,AL_PITCH,ogg.Pitch); alSourcei(ogg.Source,AL_LOOPING,0); ogg.Format = AL_FORMAT_STEREO16; ogg.Size = sizeof(ogg.Data); ogg.Frequece = ogg.vi->rate; ogg.Shot_down = 0; ogg.Setup_Flag = 0; if (p_Flag) ogg.Setup_Flag = p_Flag; ogg.Setup_Thread = CreateThread( NULL, 0, adas_OGG_Setup_Thread, (void *)&ogg, 0, &(ogg.Setup_ThreadID)); if (ogg.Setup_Thread) { //ogg.bSetup = 1; return 1; } return 0; } //---------------------------------------------------------------------------------------------- // OGG setup thread //---------------------------------------------------------------------------------------------- void * adas_OGG_Setup_Thread( void *lpParameter ) { ADAS_OGG_STRUCTURE *p_ogg = (ADAS_OGG_STRUCTURE *) lpParameter; int i; if(!p_ogg->bSetup) for(i=0;i<3;i++) { adas_OGG_Read_Stream(p_ogg); alBufferData(p_ogg->Buffer[i], p_ogg->Format, &p_ogg->Data, p_ogg->Size, p_ogg->Frequece); if(p_ogg->Shot_down) { p_ogg->bEof = 2; ExitThread(0); } } *(int *)p_ogg->Setup_Flag = 1; p_ogg->bSetup = 1; return 0; } //---------------------------------------------------------------------------------------------- // ogg decompression and playing proc //---------------------------------------------------------------------------------------------- void * adas_OGG_Proc( void *lpParameter ) { ADAS_OGG_STRUCTURE *p_ogg = (ADAS_OGG_STRUCTURE *) lpParameter; char buffer = 0; int processed = 0; int state,i; FILE *file;//, *d_file; char text[256]; int cycles, time; int dwStart, dwFinish, dwEplased; long losttime = 0; strcpy(text, ogg.Name); text[(strlen(ogg.Name)-3)] = '\0'; //TODO - newline? strcat(text,"cyc"); file = fopen(text,"r"); if(!file) { adas_Set_Last_Error("file not found."); p_ogg->bEof = 2; ExitThread(0); } if(!p_ogg->bSetup) { for(i=0;i<3;i++) { if (fgets(text,256, file) == NULL) { adas_Set_Last_Error("Cannot read file"); p_ogg->bEof = 2; fclose(file); ExitThread(0); } cycles = atoi(text); time = (int)floor(750.0f / (float)cycles); adas_OGG_Read_StreamA(p_ogg, time); alBufferData(p_ogg->Buffer[i], p_ogg->Format, &p_ogg->Data, p_ogg->Size, p_ogg->Frequece); if(p_ogg->Shot_down) { p_ogg->bEof = 2; fclose(file); ExitThread(0); } } } else { for(i=0;i<3;i++) { if (fgets(text,256, file) == NULL) { adas_Set_Last_Error("Cannot read file"); p_ogg->bEof = 2; fclose(file); ExitThread(0); } } } alSourceQueueBuffers(p_ogg->Source,3,p_ogg->Buffer); alSourcePlay(p_ogg->Source); p_ogg->bEof = 0; while(!p_ogg->Shot_down) { alGetSourcei(p_ogg->Source, AL_BUFFERS_PROCESSED, &processed); if(processed > 0) { if (!p_ogg->bEof) { alSourceUnqueueBuffers(p_ogg->Source,1,&p_ogg->Buffer[(int)buffer]); if (fgets(text,256, file) == NULL) { adas_Set_Last_Error("Cannot read file"); p_ogg->bEof = 2; fclose(file); ExitThread(0); } cycles = atoi(text); dwStart = timeGetTime(); if(losttime > 100) { // fprintf(d_file,"critical decopression - lost time = %d\n",losttime); adas_OGG_Read_Stream(p_ogg); } else { time = (int)floor(750.0f / (float)(cycles+6)); // fprintf(d_file,"normal decopression - lost time = %d\n",losttime); adas_OGG_Read_StreamA(p_ogg, time); } alBufferData(p_ogg->Buffer[(int)buffer], p_ogg->Format, &p_ogg->Data, p_ogg->Size, p_ogg->Frequece); alSourceQueueBuffers(p_ogg->Source,1,&p_ogg->Buffer[(int)buffer]); dwFinish = timeGetTime(); dwEplased = dwFinish - dwStart; losttime += (dwEplased - 750); if(losttime < 0) losttime = 0; } else { alGetSourcei(p_ogg->Source, AL_SOURCE_STATE, &state); if (state == AL_STOPPED) { alSourceStop(p_ogg->Source); alSourceUnqueueBuffers(p_ogg->Source,3,p_ogg->Buffer); p_ogg->bEof++; fclose(file); // fclose(d_file); ExitThread(0); } } buffer ++; if (buffer > 2) buffer = 0; processed = 0; } Sleep(10); } alSourceStop(p_ogg->Source); alSourceUnqueueBuffers(p_ogg->Source,3,p_ogg->Buffer); ogg.bEof = 2; fclose(file); // fclose(d_file); return 0; } //------------------------------------------------------------------------------------------------ // stop OGG stream //------------------------------------------------------------------------------------------------ void adas_OGG_Stop_Stream(void) { dword Exit_Code = STILL_ACTIVE; if(!bDevice) return; if(!ogg.Thread) return; ogg.Shot_down = 1; while(Exit_Code == STILL_ACTIVE) GetExitCodeThread(ogg.Thread, &Exit_Code); CloseHandle(ogg.Thread); ogg.Thread = 0; ogg.ThreadID = 0; } //------------------------------------------------------------------------------------------------ // seek OGG stream //------------------------------------------------------------------------------------------------ void adas_OGG_Seek_Stream(double dValue) { if(!bDevice) return; ov_time_seek(&ogg.vf, dValue); } //------------------------------------------------------------------------------------------------ // check if is OGG stream playing //------------------------------------------------------------------------------------------------ int adas_Is_OGG_Stream_Playing(void) { if(!bDevice) return 0; if ((ogg.bEof >= 0) && (ogg.bEof < 2)) return 1; else return 0; } //------------------------------------------------------------------------------------------------ // Analyze OGG stream //------------------------------------------------------------------------------------------------ int adas_OGG_Analyze_Stream(char *p_ogg_file, char *p_size_file, char *p_cycles_file) { int result; FILE *pf_size_file, *pf_cycles_file; // open stream ogg.file = fopen(p_ogg_file,"rb"); if (!ogg.file) { adas_Set_Last_Error("File not found"); return 0; } pf_size_file = fopen(p_size_file,"w"); if(!pf_size_file) { adas_Set_Last_Error("Unable to create file"); fclose(ogg.file); return 0; } pf_cycles_file = fopen(p_cycles_file,"w"); if(!pf_cycles_file) { adas_Set_Last_Error("Unable to create file"); fclose(ogg.file); fclose(pf_size_file); return 0; } result = ov_open(ogg.file,&ogg.vf,NULL,0); if (result < 0) { fclose(ogg.file); switch(result) { case OV_EREAD: adas_Set_Last_Error("A read from media returned an error."); break; case OV_ENOTVORBIS: adas_Set_Last_Error("Bitstream is not Vorbis data."); break; case OV_EVERSION: adas_Set_Last_Error("Vorbis version mismatch."); break; case OV_EBADHEADER: adas_Set_Last_Error("Invalid Vorbis bitstream header."); break; case OV_EFAULT: adas_Set_Last_Error("Internal logic fault; indicates a bug or heap/stack corruption."); break; } return 0; } ogg.vi = ov_info(&ogg.vf,-1); ogg.bEof = 0; // analyze stream while(!ogg.bEof) adas_OGG_Read_StreamB(&ogg, pf_size_file, pf_cycles_file); fprintf(pf_cycles_file,"_EOF_\n"); // close stream fclose(ogg.file); fclose(pf_size_file); fclose(pf_cycles_file); return 1; } berusky2-0.12/src/adas/3d_math_k.h0000644000175000017500000000113713674426075013644 00000000000000#ifndef __3D_MATHEMATIC_ #define __3D_MATHEMATIC_ #ifdef __cplusplus extern "C" { #endif // Calculate lungth of vector float Vector_Length(float *Vector); // Normalize vector float Normalize_Vector(float *Vector); // Add two vectors void Add_Vector(float *Vector1, float *Vector2, float *vResult); // Sub two vectors void Sub_Vector(float *Vector1, float *Vector2, float *vResult); // Multiple vector with constant void Multiple_Vector(float *Vector, float Const); // Make vectors void Make_Vector(float *Vector1, float *Vector2, float *vResult); #ifdef __cplusplus } #endif #endif berusky2-0.12/src/adas/ogg_io.h0000644000175000017500000000057113674426075013257 00000000000000#ifndef __ogg_h__ #define __ogg_h__ #include #include #include #ifdef __cplusplus extern "C" { #endif #define BUFFER_SIZE (4096 * 22) int ogg_open(char *file, float gain); void ogg_release(); char ogg_playback(); char ogg_playing(); char ogg_update(); void ogg_gain(float gain); #ifdef __cplusplus } #endif #endif // __ogg_h__ berusky2-0.12/src/adas/3d_math_k.c0000644000175000017500000000443613674426075013644 00000000000000#include //------------------------------------------------------------------------------------------------ // Calculate lungth of vector //------------------------------------------------------------------------------------------------ float Vector_Length(float *Vector) { return (float)sqrt(Vector[0]*Vector[0] + Vector[1]*Vector[1] + Vector[2]*Vector[2]); } //------------------------------------------------------------------------------------------------ // Normalize vector //------------------------------------------------------------------------------------------------ float Normalize_Vector(float *Vector) { float size = Vector_Length(Vector); if(size == 0) return 0.0f; Vector[0] /= size; Vector[1] /= size; Vector[2] /= size; return size; } //------------------------------------------------------------------------------------------------ // Add two vectors //------------------------------------------------------------------------------------------------ void Add_Vector(float *Vector1, float *Vector2, float *vResult) { vResult[0] = Vector1[0] + Vector2[0]; vResult[1] = Vector1[1] + Vector2[1]; vResult[2] = Vector1[2] + Vector2[2]; } //------------------------------------------------------------------------------------------------ // Sub two vectors //------------------------------------------------------------------------------------------------ void Sub_Vector(float *Vector1, float *Vector2, float *vResult) { vResult[0] = Vector1[0] - Vector2[0]; vResult[1] = Vector1[1] - Vector2[1]; vResult[2] = Vector1[2] - Vector2[2]; } //------------------------------------------------------------------------------------------------ // Multiple vector with constant //------------------------------------------------------------------------------------------------ void Multiple_Vector(float *Vector, float Const) { Vector[0] *= Const; Vector[1] *= Const; Vector[2] *= Const; } //------------------------------------------------------------------------------------------------ // Sub two vectors //------------------------------------------------------------------------------------------------ void Make_Vector(float *Vector1, float *Vector2, float *vResult) { vResult[0] = Vector2[0] - Vector1[0]; vResult[1] = Vector2[1] - Vector1[1]; vResult[2] = Vector2[2] - Vector1[2]; }berusky2-0.12/src/adas/adas_types.h0000644000175000017500000000407413674426075014152 00000000000000#ifndef _ADAS_TYPES_H_ #define _ADAS_TYPES_H_ //------------------------------------------------------------------------------------------------ // constants declarations //------------------------------------------------------------------------------------------------ #define ALL_SOUND_SOURCES 0xFFFFFFF #define PARTICULAR_SOUND_SOURCE 0xFFFFFFE #define ALL_TYPES 0x0000000 #define NORMAL_TYPE 0x0000001 #define LOOPING_TYPE 0x0000002 #define SCREAM_TYPE 0x0000003 #define HDD 0x0000004 #define RAM 0x0000005 #define BOUNDING_BOX 0x0000006 #define BOUNDING_SPHERE 0x0000007 #define UNDEFINED_VALUE -0xFFFFFFF //------------------------------------------------------------------------------------------------ // types definitions //------------------------------------------------------------------------------------------------ typedef struct { char Channels; // number of channels. One sound can be played in one // channel. 32 channels = max 32 sounds in one time char *Implementation; // string defined in OpenAL float Scale_Factor; // factor of distance scaling } ADAS_INIT_DATA; typedef struct { float LBF_point[3]; // Left, Bottom, Front point float RTB_point[3]; // Right, Top, Back point float Radius; // Radius of Sound Source (for Bounding sphere) int Type; // Type of bounding object (see definitions) } BOUNDING_OBJECT; typedef struct { int Wave_Index; // index of wave int Owner; // owner of sound source char Type; // type of sound source float Pos[3]; // starting position float Velocity[3]; // velocity float Gain; // gain (volume) float Pitch; // pitch char Source_Relative; // position will be interpreted as relative to // listener long Obstruction; float ObstructionLF; long wall_occlusion; float wall_occlusionLF; float wall_occlusion_room; long out_room; long out_roomHF; float out_room_rolloff; float out_air_absorbtion; BOUNDING_OBJECT Bounding_Object; } ADAS_SOUND_SOURCE_DATA; #endif berusky2-0.12/src/adas/ogg_stream.h0000644000175000017500000000222513674426075014141 00000000000000#ifndef __OGG_STREAM_ #define __OGG_STREAM_ #ifdef __cplusplus extern "C" { #endif void adas_OGG_Init(void); // open OGG stream int adas_OGG_Open_Stream(char *p_File_Name); // close OGG stream void adas_OGG_Close_Stream(void); // Set OGG Setup Stream int adas_OGG_Setup_Stream(void *p_Flag); // play OGG stream int adas_OGG_Play_Stream(void); // set position of OGG stream void adas_OGG_Set_Position(float *v); // set Source Relative void adas_OGG_Set_Source_Relative(char bValue); // set velocity of OGG stream void adas_OGG_Set_Velocity(float *v); // set gain of OGG stream void adas_OGG_Set_Gain(float v); // set pitch of OGG stream void adas_OGG_Set_Pitch(float v); // stop OGG stream void adas_OGG_Stop_Stream(void); // seek OGG stream void adas_OGG_Seek_Stream(double dValue); // check if is OGG stream playing int adas_Is_OGG_Stream_Playing(void); // Set Ogg decompresion Thread priority void adas_OGG_Set_Priority(int Priority); // Get Ogg decompresion Thread priority int adas_OGG_Get_Priority(void); // Analyze OGG stream int adas_OGG_Analyze_Stream(char *p_ogg_file, char *p_size_file, char *p_cicles_file); #ifdef __cplusplus } #endif #endif berusky2-0.12/src/adas/adas.c0000644000175000017500000023435413674426075012727 00000000000000//------------------------------------------------------------------------------------------------ // includes //------------------------------------------------------------------------------------------------ #include #include #include #include #include "compat_mini.h" #include "3d_math.h" #include "adas.h" //------------------------------------------------------------------------------------------------ // libraries //------------------------------------------------------------------------------------------------ /* #pragma comment(lib,"lib\\ALut.lib") #pragma comment(lib,"lib\\OpenAL32.lib") #pragma comment(lib,"lib\\eax.lib") #pragma comment(lib,"lib\\eaxguid.lib") #pragma comment(lib,"winmm.lib") */ //------------------------------------------------------------------------------------------------ // constants declarations //------------------------------------------------------------------------------------------------ #define SIZEOFSOUNDDATA 1000 // Max. number of Sound Data structures (max. wav // files loaded) #define MAXQUEUED 16 // Max. of queued buffers to sound source #define ADAS_VERSION_LOW 1 // low version of AnakreoN Digital Audio System #define ADAS_VERSION_HI 1 // hi version of AnakreoN Digital Audio System //------------------------------------------------------------------------------------------------ // types definitions //------------------------------------------------------------------------------------------------ typedef struct { THREAD_ID ThreadID; // Manager Thread ID THREAD_HANDLE Thread; // pointer to Manager Thread int Shot_down; // shot down signal } ADAS_MANAGER; typedef struct { int Owner; // owner of sound source int Type; // type of sound source ALuint Buffer[MAXQUEUED]; // pointer do buffer ALuint Source; // poinet to OpenAL source int Wave_Index[MAXQUEUED]; // wave index, which is played int Lock; // security lock (deallocation is not // allowed) void *p_callback; // callback flag is set when source is // destroyed char Buffer_Pointer; // pointer to free buffer in line int Buffer_Source[MAXQUEUED]; // RAM = Buffer is from RAM // HDD = Buffer is from HDD // UNDEFINED_VALUE = Undefined source BOUNDING_OBJECT Bounding_Object; // Bounding Object for creating large // sound dources } ADAS_SOUND_SOURCE; typedef struct { ALsizei Size; // size fo data ALuint Frequece; // frequence ALenum Format; // format (8, 16, stereo, mono) ALvoid *Data; // pointer to data ALuint Buffer; // pointer to buffer int Wave_Index; // index of wave in data } ADAS_SOUND_DATA; typedef struct { char Name[30]; // name of wave int Index; // uniqe index } ADAS_WAVEFILEDESC; //------------------------------------------------------------------------------------------------ // global declarations //------------------------------------------------------------------------------------------------ typedef void *EAXSet; typedef void *EAXGet; static ADAS_MANAGER Manager; // Manager for sound sources static ADAS_INIT_DATA ADAS_data; // general data: sound dir, app. pointer,... static ADAS_SOUND_SOURCE *SoundSource; // Pointer to structure SoundSource static ALCcontext *p_Context = 0; // Pointer to device kontext static ALCdevice *p_Device = 0; // Pointer to device static ALuint p_DummySource = 0; // EAX Dummy Buffer static EAXSet p_EAXSet = 0; // Pointer to EAXSet function static EAXGet p_EAXGet = 0; // Pointer to EAXGet functionstatic ALboolean bEAXExtPresent; // EAX device presentation static ADAS_WAVEFILEDESC *WaveFile; // Pointer to structure which holds wave indexes static ADAS_SOUND_DATA *SoundData; // Pointer to structure SoundData static int Size_of_Indexes; // size of WaveFile static int Size_of_Sound_Data; // size of Sound Data char Last_Error[256]; // text of last error int bLast_Error; // last error set char Last_Warning[256]; // text of last warning int bLast_Warning; // last warning set char bDevice = 0; // was device found? static char sound_dir[MAX_FILENAME]; //------------------------------------------------------------------------------------------------ // function declarations //------------------------------------------------------------------------------------------------ void * adas_ManagerProc(void *lpParameter); int adas_Translate_Wave(char *p_Wave_Name); char *adas_Translate_Index(int Wave_Index); int adas_Get_Free_Source(void); int adas_Find_Sound(int Wave_Index); int adas_Load_Wave(ADAS_SOUND_SOURCE * p_ss); void adas_Release(ADAS_SOUND_SOURCE * p_ss); int adas_Run_Manager(void); void adas_Shot_Down_Manager(void); void adas_Set_Source_Propertiesl(ADAS_SOUND_SOURCE * p_ss, ALuint uiValue, long lValue); void adas_Set_Source_Propertiesf(ADAS_SOUND_SOURCE * p_ss, ALuint uiValue, float fValue); void adas_Set_Source_Propertiesdw(ADAS_SOUND_SOURCE * p_ss, ALuint uiValue, unsigned long dwValue); void adas_Update_Positions(float *v); //------------------------------------------------------------------------------------------------ // Get error message //------------------------------------------------------------------------------------------------ int adas_Get_Last_Error(char *p_Text, int Size) { if (bLast_Error) { if (Size > 256) Size = 256; strncpy(p_Text, Last_Error, Size); return 1; } return 0; } //------------------------------------------------------------------------------------------------ // Get warning message //------------------------------------------------------------------------------------------------ int adas_Get_Last_Warning(char *p_Text, int Size) { if (bLast_Warning) { if (Size > 256) Size = 256; strncpy(p_Text, Last_Warning, Size); return 1; } return 0; } //------------------------------------------------------------------------------------------------ // reset error & warning message //------------------------------------------------------------------------------------------------ void adas_Reset_Last_Error(void) { strcpy(Last_Error, ""); bLast_Error = 0; strcpy(Last_Warning, ""); bLast_Warning = 0; } //------------------------------------------------------------------------------------------------ // Set error message //------------------------------------------------------------------------------------------------ void adas_Set_Last_Error(char *p_Text) { fprintf(stderr,"adas_Set_Last_Error(): %s\n",p_Text); strcpy(Last_Error, p_Text); bLast_Error = 1; } //------------------------------------------------------------------------------------------------ // Set warning message //------------------------------------------------------------------------------------------------ void adas_Set_Last_Warning(char *p_Text) { fprintf(stderr,"adas_Set_Last_Error(): %s\n",p_Text); strcpy(Last_Warning, p_Text); bLast_Warning = 1; } //------------------------------------------------------------------------------------------------ // init's AnakreoN Digital Audio System: // Following is a brief description of the 3 different implementations // that can be created. // // DirectSound3D // // Uses Direct Sound 3D to render the Open AL audio. This implementation will // benefit from Direct Sound 3D accelerators like the SB Live ! Applications must // use this implementation if they wish to use EAX extensions. // // DirectSound // // This implimentation uses software mixing with output to a // DSound stereo buffer. This implimentation offers the best // comprimise of speed and latency for all cards. However, EAX // extensions will not be available. // // Default // // This implimentation utilizes software mixing with output to // mmsystem. It offers the best solution across Win9x and NT // platforms. It does however offer the highest latency. //------------------------------------------------------------------------------------------------ void adas_Init(ADAS_INIT_DATA * p_adas_data) { int i, j; float v_3[] = { 0.0, 0.0, 0.0 }; float v_6[] = { 0.0, 0.0, 1.0, 0.0, 1.0, 0.0 }; ADAS_SOUND_SOURCE *pSource; memcpy(&ADAS_data, p_adas_data, sizeof(ADAS_INIT_DATA)); p_Device = alcOpenDevice(p_adas_data->Implementation); if (p_Device) { bDevice = 1; p_Context = alcCreateContext(p_Device, NULL); if (p_Context) { //Set active context if (alcMakeContextCurrent(p_Context)) { int bEAXExtPresent = alIsExtensionPresent("EAX2.0"); if (!bEAXExtPresent) { adas_Set_Last_Warning("No EAX2.0 Extension found"); } else { p_EAXSet = (EAXSet) alGetProcAddress("EAXSet"); p_EAXGet = (EAXGet) alGetProcAddress("EAXGet"); if (!p_EAXSet || !p_EAXGet) { adas_Set_Last_Error("Cannot find EAXSet and/or EAXGet function"); bEAXExtPresent = 0; } if (bEAXExtPresent) { // The DirectSound3D implementation of Open AL will hold on to any EAX parameters // IF no Open AL Sources have been generated. Because we may wish to update the 3D // graphs of the EAX Listener parameters before the user loads a sample, we generate // a dummy source here. (Under normal circumstances there is no reason to do this) alGetError(); alGenSources(1, &p_DummySource); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create source"); return; } if (!alIsSource(p_DummySource)) { adas_Set_Last_Error("Unable to create source"); return; } } } SoundSource = (ADAS_SOUND_SOURCE *)malloc(ADAS_data.Channels * sizeof(ADAS_SOUND_SOURCE)); if (!SoundSource) { adas_Set_Last_Error("Out of Memory"); return; } ZeroMemory(SoundSource, ADAS_data.Channels * sizeof(ADAS_SOUND_SOURCE)); for (i = 0; i < ADAS_data.Channels; i++) { pSource = &SoundSource[i]; pSource->Source = 0; for (j = 0; j < MAXQUEUED; j++) { pSource->Buffer[j] = 0; pSource->Wave_Index[j] = UNDEFINED_VALUE; pSource->Buffer_Source[j] = UNDEFINED_VALUE; } pSource->Owner = UNDEFINED_VALUE; pSource->Type = UNDEFINED_VALUE; pSource->Buffer_Pointer = 0; } adas_Run_Manager(); adas_Set_Listener_Position(v_3); adas_Set_Listener_Velocity(v_3); adas_Set_Listener_Orientation(v_6); if(!alutInitWithoutContext(NULL,NULL)) { adas_Set_Last_Error("Unable to init ALUT."); alcDestroyContext(p_Context); alcCloseDevice(p_Device); p_Context = NULL; p_Device = NULL; } // succesfull exit return; } else { adas_Set_Last_Error("Unable to set active context."); bDevice = 1; } alcDestroyContext(p_Context); p_Context = NULL; } else { adas_Set_Last_Error("Unable to create context."); bDevice = 1; } alcCloseDevice(p_Device); p_Device = NULL; } else adas_Set_Last_Error("Unable to open device."); } //------------------------------------------------------------------------------------------------ // releases AnakreoN Digital Audio System //------------------------------------------------------------------------------------------------ void adas_Exit(void) { if (!bDevice) return; adas_Shot_Down_Manager(); if (p_DummySource) alDeleteSources(1, &p_DummySource); alutExit(); alcDestroyContext(p_Context); p_Context = 0; alcCloseDevice(p_Device); p_Device = 0; free((void *)SoundSource); SoundSource = NULL; } //------------------------------------------------------------------------------------------------ // load sound data & init memory //------------------------------------------------------------------------------------------------ unsigned long adas_Load_First(char *p_Index_File, char *p_File_Name) { FILE *file = NULL; char data[100]; dword Return; int i; ALboolean loop = 0; ADAS_SOUND_DATA *pSound; if (!bDevice) return 0; if ((!p_File_Name) || (!p_Index_File)) return 0; SoundData = (ADAS_SOUND_DATA *) malloc(SIZEOFSOUNDDATA * sizeof(ADAS_SOUND_DATA)); if (!SoundData) { adas_Set_Last_Error("Out of memory"); return 0; } file = fopen(p_Index_File, "r"); if (!file) { adas_Set_Last_Error("Index file not found"); return 0; } if (fgets(data, 100, file) == NULL) { adas_Set_Last_Error("Unable to read index file"); fclose(file); file = NULL; return 0; } Size_of_Indexes = atoi(data); WaveFile = (ADAS_WAVEFILEDESC *) malloc(Size_of_Indexes * sizeof(ADAS_WAVEFILEDESC)); if (!WaveFile) { adas_Set_Last_Error("Out of memory"); fclose(file); file = NULL; return 0; } for (i = 0; i < Size_of_Indexes; i++) { if (fgets(data, 100, file) == NULL) { adas_Set_Last_Error("Unable to read index file"); fclose(file); file = NULL; free(WaveFile); WaveFile = NULL; return 0; } newline_cut(data); strcpy(WaveFile[i].Name, data); if (fgets(data, 100, file) == NULL) { adas_Set_Last_Error("Unable to read index file"); fclose(file); file = NULL; free(WaveFile); WaveFile = NULL; return 0; } WaveFile[i].Index = atoi(data); } fclose(file); file = NULL; file = fopen(p_File_Name, "r"); if (file) { GetFileSize(file, &Return); fclose(file); Size_of_Sound_Data = 0; pSound = &SoundData[Size_of_Sound_Data]; alGetError(); alGenBuffers(1, &pSound->Buffer); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (!alIsBuffer(pSound->Buffer)) { adas_Set_Last_Error("Unable to create buffer"); return 0; } adasLoadWAVFile(p_File_Name, &pSound->Format, &pSound->Data, &pSound->Size, &pSound->Frequece, &loop); alBufferData(pSound->Buffer, pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); adasUnloadWAV(pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); pSound->Wave_Index = adas_Translate_Wave(p_File_Name); Size_of_Sound_Data++; return Return; } else { adas_Set_Last_Error("File not found"); return 0; } } unsigned long adas_Load_FirstMemory(char *p_Index_File, void *p_File, long File_Size, char *p_File_Name) { FILE *file = NULL; char data[100]; int i; ALboolean loop = 0; ADAS_SOUND_DATA *pSound; if (!bDevice) return 0; if ((!p_File) || (!p_Index_File) || (!p_File_Name)) return 0; SoundData = (ADAS_SOUND_DATA *)malloc(SIZEOFSOUNDDATA * sizeof(ADAS_SOUND_DATA)); if (!SoundData) { adas_Set_Last_Error("Out of memory"); return 0; } ZeroMemory(SoundData, SIZEOFSOUNDDATA * sizeof(ADAS_SOUND_DATA)); file = fopen(p_Index_File, "r"); if (!file) { adas_Set_Last_Error("Index file not found"); return 0; } if (fgets(data, 100, file) == NULL) { adas_Set_Last_Error("Unable to read index file"); fclose(file); file = NULL; return 0; } Size_of_Indexes = atoi(data); WaveFile = (ADAS_WAVEFILEDESC *) malloc(Size_of_Indexes * sizeof(ADAS_WAVEFILEDESC)); if (!WaveFile) { adas_Set_Last_Error("Out of memory"); fclose(file); file = NULL; return 0; } ZeroMemory(WaveFile, Size_of_Indexes*sizeof(ADAS_WAVEFILEDESC)); for (i = 0; i < Size_of_Indexes; i++) { if (fgets(data, 100, file) == NULL) { adas_Set_Last_Error("Unable to read index file"); fclose(file); file = NULL; free(WaveFile); WaveFile = NULL; return 0; } newline_cut(data); strcpy(WaveFile[i].Name, data); if (fgets(data, 100, file) == NULL) { adas_Set_Last_Error("Unable to read index file"); fclose(file); file = NULL; free(WaveFile); WaveFile = NULL; return 0; } WaveFile[i].Index = atoi(data); } fclose(file); file = NULL; Size_of_Sound_Data = 0; pSound = &SoundData[Size_of_Sound_Data]; alGetError(); alGenBuffers(1, &pSound->Buffer); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (!alIsBuffer(pSound->Buffer)) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (adasLoadWAVMemory(p_File, File_Size, &pSound->Format, &pSound->Data, &pSound->Size, &pSound->Frequece, &loop)) { alBufferData(pSound->Buffer, pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); adasUnloadWAV(pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); pSound->Wave_Index = adas_Translate_Wave(p_File_Name); Size_of_Sound_Data++; } else { adas_Set_Last_Error("Unable to convert audio data (adasLoadWAVMemory)"); return 0; } return 1; } //------------------------------------------------------------------------------------------------ // load sound data //------------------------------------------------------------------------------------------------ unsigned long adas_Load_Next(char *p_File_Name) { FILE *file = NULL; dword Return; ALboolean loop = 0; ADAS_SOUND_DATA *pSound; if (!bDevice) return 0; if ((Size_of_Sound_Data > SIZEOFSOUNDDATA) || (!p_File_Name)) return 0; if (chdir(sound_dir)) return 0; file = fopen(p_File_Name, "r"); if (file) { GetFileSize(file, &Return); fclose(file); pSound = &SoundData[Size_of_Sound_Data]; alGetError(); alGenBuffers(1, &pSound->Buffer); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (!alIsBuffer(pSound->Buffer)) { adas_Set_Last_Error("Unable to create buffer"); return 0; } adasLoadWAVFile(p_File_Name, &pSound->Format, &pSound->Data, &pSound->Size, &pSound->Frequece, &loop); alBufferData(pSound->Buffer, pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); adasUnloadWAV(pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); pSound->Wave_Index = adas_Translate_Wave(p_File_Name); Size_of_Sound_Data++; return Return; } else { adas_Set_Last_Error("File not found"); return 0; } } unsigned long adas_Load_NextMemory(void *p_File, long File_Size, char *p_File_Name) { ALboolean loop = 0; ADAS_SOUND_DATA *pSound; if (!bDevice) return 0; if ((Size_of_Sound_Data > SIZEOFSOUNDDATA) || (!p_File_Name) || (!p_File)) return 0; pSound = &SoundData[Size_of_Sound_Data]; alGetError(); alGenBuffers(1, &pSound->Buffer); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (!alIsBuffer(pSound->Buffer)) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (adasLoadWAVMemory(p_File, File_Size, &pSound->Format, &pSound->Data, &pSound->Size, &pSound->Frequece, &loop)) { alBufferData(pSound->Buffer, pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); adasUnloadWAV(pSound->Format, pSound->Data, pSound->Size, pSound->Frequece); pSound->Wave_Index = adas_Translate_Wave(p_File_Name); Size_of_Sound_Data++; } else { adas_Set_Last_Error("Unable to convert audio data (adasLoadWAVMemory)"); return 0; } return 1; } //------------------------------------------------------------------------------------------------ // releases loaded sound data //------------------------------------------------------------------------------------------------ void adas_Release_Loaded_Data(void) { int i; if (!bDevice) return; for (i = 0; i < Size_of_Sound_Data; i++) alDeleteBuffers(1, &SoundData[i].Buffer); if (WaveFile) { free((void *)WaveFile); WaveFile = NULL; } if (SoundData) { free((void *)SoundData); SoundData = NULL; } } //------------------------------------------------------------------------------------------------ // Set distance model //------------------------------------------------------------------------------------------------ int adas_Set_Distance_Model(long Distance_Model) { if (!bDevice) return 0; alGetError(); alDistanceModel(Distance_Model); if (alGetError() != AL_NO_ERROR) return 0; else return 1; return 0; } //------------------------------------------------------------------------------------------------ // Set distance model //------------------------------------------------------------------------------------------------ int adas_Set_Doppler_Factor(float Doppler_Factor) { if (!bDevice) return 0; alGetError(); alDopplerFactor(Doppler_Factor); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Set distance model //------------------------------------------------------------------------------------------------ int adas_Set_Doppler_Velocity(float Doppler_Velocity) { if (!bDevice) return 0; alGetError(); alDopplerVelocity(Doppler_Velocity); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Set Listener Position //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Position(float *v) { if (!bDevice) return 0; v[0] *= ADAS_data.Scale_Factor; v[1] *= ADAS_data.Scale_Factor; v[2] *= ADAS_data.Scale_Factor; alGetError(); alListenerfv(AL_POSITION, v); if (alGetError() == AL_NO_ERROR) { adas_Update_Positions(v); return 1; } else return 0; return 0; } //------------------------------------------------------------------------------------------------ // Set Listener Gain //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Gain(float v) { if (!bDevice) return 0; alGetError(); alListenerf(AL_GAIN, v); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Set Listener Velocity //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Velocity(float *v) { if (!bDevice) return 0; alGetError(); alListenerfv(AL_VELOCITY, v); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Set Listener Orientation //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Orientation(float *v) { if (!bDevice) return 0; alGetError(); alListenerfv(AL_ORIENTATION, v); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Get Listener Gain //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Gain(float *v) { if (!bDevice) return 0; alGetError(); alGetListenerf(AL_GAIN, v); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Get Listener Position //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Position(float *v) { if (!bDevice) return 0; alGetError(); alGetListenerfv(AL_POSITION, v); v[0] *= 1.0f / ADAS_data.Scale_Factor; v[1] *= 1.0f / ADAS_data.Scale_Factor; v[2] *= 1.0f / ADAS_data.Scale_Factor; if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Get Listener Velocity //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Velocity(float *v) { if (!bDevice) return 0; alGetError(); alGetListenerfv(AL_VELOCITY, v); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Get Listener Orientation //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Orientation(float *v) { if (!bDevice) return 0; alGetError(); alGetListenerfv(AL_ORIENTATION, v); if (alGetError() != AL_NO_ERROR) return 0; else return 1; } //------------------------------------------------------------------------------------------------ // Find free sound source //------------------------------------------------------------------------------------------------ int adas_Get_Free_Source(void) { int i; if (!bDevice) return -1; for (i = 0; i < ADAS_data.Channels; i++) if (!SoundSource[i].Source) return i; return -1; } //------------------------------------------------------------------------------------------------ // Find sound data in memory //------------------------------------------------------------------------------------------------ int adas_Find_Sound(int Wave_Index) { int i; if (!bDevice) return -1; for (i = 0; i < Size_of_Sound_Data; i++) if (SoundData[i].Wave_Index == Wave_Index) return i; return -1; } //------------------------------------------------------------------------------------------------ // Translate wave name to index //------------------------------------------------------------------------------------------------ int adas_Translate_Wave(char *p_Wave_Name) { int i; if (!bDevice) return -1; for (i = 0; i < Size_of_Indexes; i++) if (!strcasecmp(WaveFile[i].Name, p_Wave_Name)) return WaveFile[i].Index; return -1; } //------------------------------------------------------------------------------------------------ // Translate wave index to name //------------------------------------------------------------------------------------------------ char *adas_Translate_Index(int Wave_Index) { int i; if (!bDevice) return NULL; for (i = 0; i < Size_of_Indexes; i++) if (WaveFile[i].Index == Wave_Index) return WaveFile[i].Name; return NULL; } //------------------------------------------------------------------------------------------------ // Load wave //------------------------------------------------------------------------------------------------ int adas_Load_Wave(ADAS_SOUND_SOURCE * p_ss) { char text[100]; char *name = NULL; ALsizei Size; ALuint Frequece; ALenum Format; ALvoid *Data; ALboolean loop; if (!bDevice) return 0; alGetError(); alGenBuffers(1, &p_ss->Buffer[(int)p_ss->Buffer_Pointer]); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create buffer"); return 0; } if (!alIsBuffer(p_ss->Buffer[(int)p_ss->Buffer_Pointer])) { adas_Set_Last_Error("Unable to create buffer"); return 0; } name = adas_Translate_Index(p_ss->Wave_Index[(int)p_ss->Buffer_Pointer]); if (!name) return 0; strcpy(text, name); if (chdir(sound_dir)) return 0; if (!adasLoadWAVFile(text, &Format, &Data, &Size, &Frequece, &loop)) return 0; alBufferData(p_ss->Buffer[(int)p_ss->Buffer_Pointer], Format, Data, Size, Frequece); adasUnloadWAV(Format, Data, Size, Frequece); return 1; } //------------------------------------------------------------------------------------------------ // Create Sound Source //------------------------------------------------------------------------------------------------ int adas_Create_Source(ADAS_SOUND_SOURCE_DATA * p_ssd, void **p_callback) { int Src_Index, Mem_Index; ADAS_SOUND_SOURCE *p_ss; if (!bDevice) return -1; Src_Index = adas_Get_Free_Source(); if (Src_Index == -1) return -1; p_ss = &SoundSource[Src_Index]; Mem_Index = adas_Find_Sound(p_ssd->Wave_Index); p_ss->Buffer_Pointer = 0; p_ss->Wave_Index[0] = p_ssd->Wave_Index; p_ss->Owner = p_ssd->Owner; p_ss->Type = p_ssd->Type; if (p_ssd->Bounding_Object.Type == BOUNDING_BOX) { int i; memcpy(&p_ss->Bounding_Object, &p_ssd->Bounding_Object, sizeof(BOUNDING_OBJECT)); for (i = 0; i < 3; i++) { p_ss->Bounding_Object.LBF_point[i] *= ADAS_data.Scale_Factor; p_ss->Bounding_Object.RTB_point[i] *= ADAS_data.Scale_Factor; } } if (p_ssd->Bounding_Object.Type == BOUNDING_SPHERE) p_ss->Bounding_Object.Radius = p_ssd->Bounding_Object.Radius * ADAS_data.Scale_Factor; if (Mem_Index == -1) { /* p_ss->Lock = 1; if (!adas_Load_Wave(p_ss)) return -1; alGetError(); alGenSources(1,&p_ss->Source); if(alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create source"); alDeleteBuffers(1,&p_ss->Buffer[0]); return -1; } if (!alIsSource(p_ss->Source)) { adas_Set_Last_Error("Unable to create source"); alDeleteBuffers(1,&p_ss->Buffer[0]); return -1; } p_ss->Buffer_Source[p_ss->Buffer_Pointer] = HDD; alSourcei(p_ss->Source,AL_BUFFER,p_ss->Buffer[0]);*/ return -1; } else { p_ss->Lock = 1; alGetError(); alGenSources(1, &p_ss->Source); if (alGetError() != AL_NO_ERROR) { adas_Set_Last_Error("Unable to create source"); return -1; } if (!alIsSource(p_ss->Source)) { adas_Set_Last_Error("Unable to create source"); return -1; } p_ss->Buffer_Source[(int)p_ss->Buffer_Pointer] = RAM; p_ss->Buffer[0] = SoundData[Mem_Index].Buffer; alSourcei(p_ss->Source, AL_BUFFER, p_ss->Buffer[0]); } p_ssd->Pos[0] *= ADAS_data.Scale_Factor; p_ssd->Pos[1] *= ADAS_data.Scale_Factor; p_ssd->Pos[2] *= ADAS_data.Scale_Factor; alSourcef(p_ss->Source, AL_PITCH, p_ssd->Pitch); alSourcef(p_ss->Source, AL_GAIN, p_ssd->Gain); alSourcei(p_ss->Source, AL_SOURCE_RELATIVE, p_ssd->Source_Relative); alSourcefv(p_ss->Source, AL_POSITION, p_ssd->Pos); alSourcefv(p_ss->Source, AL_VELOCITY, p_ssd->Velocity); if (p_ss->Type == 2) alSourcei(p_ss->Source, AL_LOOPING, 1); else alSourcei(p_ss->Source, AL_LOOPING, 0); /* if(p_ssd->Obstruction != UNDEFINED_VALUE) adas_Set_Source_Obstruction(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->Obstruction); if(p_ssd->ObstructionLF != UNDEFINED_VALUE) adas_Set_Source_ObstructionLF(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->ObstructionLF); if(p_ssd->wall_occlusion != UNDEFINED_VALUE) adas_Set_Source_Occlusion(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->wall_occlusion); if(p_ssd->wall_occlusionLF != UNDEFINED_VALUE) adas_Set_Source_OcclusionLF(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->wall_occlusionLF); if(p_ssd->wall_occlusion_room != UNDEFINED_VALUE) adas_Set_Source_Occlusion_Room(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->wall_occlusion_room); if(p_ssd->out_room != UNDEFINED_VALUE) adas_Set_Source_Room(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->out_room); if(p_ssd->out_roomHF != UNDEFINED_VALUE) adas_Set_Source_RoomHF(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->out_roomHF); if(p_ssd->out_room_rolloff != UNDEFINED_VALUE) adas_Set_Source_Rolloff(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->out_room_rolloff); if(p_ssd->out_air_absorbtion != UNDEFINED_VALUE) adas_Set_Source_Absorption(PARTICULAR_SOUND_SOURCE,UNDEFINED_VALUE,Src_Index,p_ssd->out_air_absorbtion); */ alSourcePlay(p_ss->Source); *p_callback = &SoundSource[Src_Index].p_callback; p_ss->Lock = 0; p_ss->Buffer_Pointer++; return Src_Index; } //------------------------------------------------------------------------------------------------ // Release sound sources //------------------------------------------------------------------------------------------------ void adas_Release(ADAS_SOUND_SOURCE * p_ss) { int i; if (!bDevice) return; p_ss->Lock = 2; alSourceStop(p_ss->Source); alDeleteSources(1, &p_ss->Source); for (i = 0; i < p_ss->Buffer_Pointer; i++) if (p_ss->Buffer[i] && (p_ss->Buffer_Source[i] != RAM)) alDeleteBuffers(1, &p_ss->Buffer[i]); p_ss->Source = 0; for (i = 0; i < p_ss->Buffer_Pointer; i++) { p_ss->Buffer[i] = 0; p_ss->Buffer_Source[i] = UNDEFINED_VALUE; p_ss->Wave_Index[i] = UNDEFINED_VALUE; } p_ss->Owner = UNDEFINED_VALUE; p_ss->Type = UNDEFINED_VALUE; /*if (p_ss->p_callback) *(int *)p_ss->p_callback = 0;*/ } //------------------------------------------------------------------------------------------------ // Release sound sources //------------------------------------------------------------------------------------------------ void adas_Release_Source(int Owner, int Type, int Index) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) adas_Release(&SoundSource[Index]); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) { if (SoundSource[i].Type != SCREAM_TYPE) adas_Release(&SoundSource[i]); } else if (SoundSource[i].Type == Type) adas_Release(&SoundSource[i]); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) adas_Release(&SoundSource[i]); } } //------------------------------------------------------------------------------------------------ // Set cube position //------------------------------------------------------------------------------------------------ void adas_Set_Bounding_Object_PositionA(ADAS_SOUND_SOURCE * p_source, float *v) { float size[3]; int i; if (p_source->Bounding_Object.Type == BOUNDING_SPHERE) for (i = 0; i < 3; i++) p_source->Bounding_Object.LBF_point[i] = v[i]; else { for (i = 0; i < 3; i++) size[i] = (p_source->Bounding_Object.RTB_point[i] - p_source->Bounding_Object.LBF_point[i]) / 2.0f; for (i = 0; i < 3; i++) { p_source->Bounding_Object.LBF_point[i] = v[i] - size[i]; p_source->Bounding_Object.RTB_point[i] = v[i] + size[i]; } } } void adas_Set_Bounding_Object_Position(int Owner, int Type, int Index, float *v) { if (!bDevice) return; v[0] *= ADAS_data.Scale_Factor; v[1] *= ADAS_data.Scale_Factor; v[2] *= ADAS_data.Scale_Factor; if (Owner == PARTICULAR_SOUND_SOURCE) adas_Set_Bounding_Object_PositionA(&SoundSource[Index], v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) adas_Set_Bounding_Object_PositionA(&SoundSource[i], v); else if (SoundSource[i].Type == Type) adas_Set_Bounding_Object_PositionA(&SoundSource[i], v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) adas_Set_Bounding_Object_PositionA(&SoundSource[i], v); } } //------------------------------------------------------------------------------------------------ // Set sound sources position //------------------------------------------------------------------------------------------------ void adas_Set_Source_Position(int Owner, int Type, int Index, float *v) { if (!bDevice) return; v[0] *= ADAS_data.Scale_Factor; v[1] *= ADAS_data.Scale_Factor; v[2] *= ADAS_data.Scale_Factor; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcefv(SoundSource[Index].Source, AL_POSITION, v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) alSourcefv(SoundSource[i].Source, AL_POSITION, v); else if (SoundSource[i].Type == Type) alSourcefv(SoundSource[i].Source, AL_POSITION, v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcefv(SoundSource[i].Source, AL_POSITION, v); } } void adas_Update_Cube_Pos(ADAS_SOUND_SOURCE * p_s, int index, float *v) { int j; float pos[3]; for (j = 0; j < 3; j++) { if (v[j] < p_s->Bounding_Object.LBF_point[j]) pos[j] = p_s->Bounding_Object.LBF_point[j]; else if (v[j] > p_s->Bounding_Object.RTB_point[j]) pos[j] = p_s->Bounding_Object.RTB_point[j]; else pos[j] = v[j]; } adas_Set_Source_Position(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, index, pos); } void adas_Update_Sphere_Pos(ADAS_SOUND_SOURCE * p_s, int index, float *v) { float Direction[3], Distance, SourcePos[3]; adas_Get_Source_Position(index, SourcePos); Sub_Vector(v, SourcePos, Direction); Distance = Vector_Length(Direction); if (Distance <= p_s->Bounding_Object.Radius) { adas_Set_Source_Position(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, index, v); } Normalize_Vector(Direction); Multiple_Vector(Direction, p_s->Bounding_Object.Radius); Add_Vector(SourcePos, Direction, SourcePos); adas_Set_Source_Position(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, index, SourcePos); } //------------------------------------------------------------------------------------------------ // Update position of floating sound sources //------------------------------------------------------------------------------------------------ void adas_Update_Positions(float *v) { int i; ADAS_SOUND_SOURCE *p_s; for (i = 0; i < ADAS_data.Channels; i++) { p_s = &SoundSource[i]; if (p_s->Lock != 2) switch (p_s->Bounding_Object.Type) { case BOUNDING_BOX: adas_Update_Cube_Pos(p_s, i, v); break; case BOUNDING_SPHERE: adas_Update_Sphere_Pos(p_s, i, v); break; } } } //------------------------------------------------------------------------------------------------ // Set sound sources pitch //------------------------------------------------------------------------------------------------ void adas_Set_Source_Pitch(int Owner, int Type, int Index, float v) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcef(SoundSource[Index].Source, AL_PITCH, v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) alSourcef(SoundSource[i].Source, AL_PITCH, v); else if (SoundSource[i].Type == Type) alSourcef(SoundSource[i].Source, AL_PITCH, v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcef(SoundSource[i].Source, AL_PITCH, v); } } //------------------------------------------------------------------------------------------------ // Set sound sources gain //------------------------------------------------------------------------------------------------ void adas_Set_Source_Gain(int Owner, int Type, int Index, float v) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcef(SoundSource[Index].Source, AL_GAIN, v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) alSourcef(SoundSource[i].Source, AL_GAIN, v); else if (SoundSource[i].Type == Type) alSourcef(SoundSource[i].Source, AL_GAIN, v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcef(SoundSource[i].Source, AL_GAIN, v); } } //------------------------------------------------------------------------------------------------ // Set sound sources min. gain //------------------------------------------------------------------------------------------------ void adas_Set_Source_Min_Gain(int Owner, int Type, int Index, float v) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcef(SoundSource[Index].Source, AL_MIN_GAIN, v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) alSourcef(SoundSource[i].Source, AL_MIN_GAIN, v); else if (SoundSource[i].Type == Type) alSourcef(SoundSource[i].Source, AL_MIN_GAIN, v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcef(SoundSource[i].Source, AL_MIN_GAIN, v); } } //------------------------------------------------------------------------------------------------ // Set sound sources max. gain //------------------------------------------------------------------------------------------------ void adas_Set_Source_Max_Gain(int Owner, int Type, int Index, float v) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcef(SoundSource[Index].Source, AL_MAX_GAIN, v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) alSourcef(SoundSource[i].Source, AL_MAX_GAIN, v); else if (SoundSource[i].Type == Type) alSourcef(SoundSource[i].Source, AL_MAX_GAIN, v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcef(SoundSource[i].Source, AL_MAX_GAIN, v); } } //------------------------------------------------------------------------------------------------ // Set sound sources velocity //------------------------------------------------------------------------------------------------ void adas_Set_Source_Velocity(int Owner, int Type, int Index, float *v) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcefv(SoundSource[Index].Source, AL_VELOCITY, v); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) alSourcefv(SoundSource[i].Source, AL_VELOCITY, v); else if (SoundSource[i].Type == Type) alSourcefv(SoundSource[i].Source, AL_VELOCITY, v); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcefv(SoundSource[i].Source, AL_VELOCITY, v); } } //------------------------------------------------------------------------------------------------ // Pause sound source //------------------------------------------------------------------------------------------------ void adas_Pause_Source(int Owner, int Type, int Index) { if (!bDevice) return; if ((Owner == PARTICULAR_SOUND_SOURCE) && SoundSource[Index].Source) alSourcePause(SoundSource[Index].Source); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if ((Type == ALL_TYPES) && SoundSource[i].Source) alSourcePause(SoundSource[i].Source); else if ((SoundSource[i].Type == Type) && (SoundSource[i].Source != UNDEFINED_VALUE)) alSourcePause(SoundSource[i].Source); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcePause(SoundSource[i].Source); } } //------------------------------------------------------------------------------------------------ // Pause sound source //------------------------------------------------------------------------------------------------ void adas_Resume_Source(int Owner, int Type, int Index) { if (!bDevice) return; if ((Owner == PARTICULAR_SOUND_SOURCE) && SoundSource[Index].Source) alSourcePlay(SoundSource[Index].Source); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if ((Type == ALL_TYPES) && SoundSource[i].Source) alSourcePlay(SoundSource[i].Source); else if ((SoundSource[i].Type == Type) && SoundSource[i].Source) alSourcePlay(SoundSource[i].Source); } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcePlay(SoundSource[i].Source); } } //------------------------------------------------------------------------------------------------ // cheks, if is particular owher playing selected sound data //------------------------------------------------------------------------------------------------ int adas_Is_Sound_Processed(int Wave_Index, int Owner) { int i; if (!bDevice) return 0; for (i = 0; i < ADAS_data.Channels; i++) if ((SoundSource[i].Owner == Owner) && (SoundSource[i].Wave_Index[0] == Wave_Index)) return 1; return 0; } //------------------------------------------------------------------------------------------------ // sel all sources volume (gain) //------------------------------------------------------------------------------------------------ void adas_Set_All_Source_Volume(float fValue) { int i; if (!bDevice) return; if (fValue < 0) fValue = 0.001f; if (fValue > 1) fValue = 1.0f; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) alSourcef(SoundSource[i].Source, AL_GAIN, fValue); } //------------------------------------------------------------------------------------------------ // run sound source manager //------------------------------------------------------------------------------------------------ int adas_Run_Manager(void) { if (!bDevice) return 0; Manager.Shot_down = 0; Manager.Thread = CreateThread(NULL, 16384, adas_ManagerProc, (void *)&Manager, 0, &(Manager.ThreadID)); if (Manager.Thread) return 1; else return 0; } //---------------------------------------------------------------------------------------------- // sound source manager thread //---------------------------------------------------------------------------------------------- void * adas_ManagerProc(void *lpParameter) { ADAS_MANAGER *p_m = (ADAS_MANAGER *) lpParameter; int i, status; if (!bDevice) return NULL; while (!p_m->Shot_down) { for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) { alGetSourcei(SoundSource[i].Source, AL_SOURCE_STATE, &status); if ((status == AL_STOPPED) && !SoundSource[i].Lock) adas_Release_Source(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, i); } Sleep(250); } return NULL; } //------------------------------------------------------------------------------------------------ // run sound source manager //------------------------------------------------------------------------------------------------ void adas_Shot_Down_Manager(void) { dword Exit_Code; if (!bDevice) return; Manager.Shot_down = 1; Sleep(500); GetExitCodeThread(Manager.Thread, &Exit_Code); if ((Exit_Code != STILL_ACTIVE)) { CloseHandle(Manager.Thread); Manager.Thread = 0; Manager.ThreadID = 0; } else { TerminateThread(Manager.Thread, 1); CloseHandle(Manager.Thread); Manager.Thread = 0; Manager.ThreadID = 0; } } #ifdef WIDOWS //------------------------------------------------------------------------------------------------ // set all listeners parametrs //------------------------------------------------------------------------------------------------ int adas_Set_All_Listener_Properties(LPEAXLISTENERPROPERTIES lpData) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ALLPARAMETERS, 0, lpData, sizeof(EAXLISTENERPROPERTIES)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners room //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Room(long lValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ROOM, 0, &lValue, sizeof(long)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners roomHF //------------------------------------------------------------------------------------------------ int adas_Set_Listener_RoomHF(long lValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ROOMHF, 0, &lValue, sizeof(long)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners room rolloff //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Room_Rolloff(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners room decay time //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Decay_Time(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_DECAYTIME, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners room decay HFRatio //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Decay_HFRatio(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_DECAYHFRATIO, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners reflections //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Reflections(long lValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REFLECTIONS, 0, &lValue, sizeof(long)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners reflections delay //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Reflections_Delay(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners reverb //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Reverb(LONG lValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REVERB, 0, &lValue, sizeof(long)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners reverb delay //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Reverb_Delay(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REVERBDELAY, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners environment //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Environment(unsigned long dwValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT, 0, &dwValue, sizeof(unsigned long)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners environment size //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Environment_Size(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners environment diffusion //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Environment_Diffusion(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners air absoprtion //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Air_Absorption(float fValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF, 0, &fValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners flags //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Flags(unsigned long dwValue) { if (p_EAXSet) return p_EAXSet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwValue, sizeof(unsigned long)); return 0; } //------------------------------------------------------------------------------------------------ // set listeners scale delay time //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Scale_Decay_Time(int bValue) { if (p_EAXGet) { unsigned long dwFlags; p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwFlags, sizeof(unsigned long)); dwFlags &= (0xFFFFFFFF ^ EAXLISTENERFLAGS_DECAYTIMESCALE); if (bValue) dwFlags |= EAXLISTENERFLAGS_DECAYTIMESCALE; return adas_Set_Listener_Flags(dwFlags); } return 0; } //------------------------------------------------------------------------------------------------ // set listeners scale reflections //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Scale_Reflections(int bValue) { if (p_EAXGet) { unsigned long dwFlags; p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwFlags, sizeof(unsigned long)); dwFlags &= (0xFFFFFFFF ^ EAXLISTENERFLAGS_REFLECTIONSSCALE); if (bValue) dwFlags |= EAXLISTENERFLAGS_REFLECTIONSSCALE; return adas_Set_Listener_Flags(dwFlags); } return 0; } //------------------------------------------------------------------------------------------------ // set listeners scale reflections delay //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Scale_Reflections_Delay(int bValue) { if (p_EAXGet) { unsigned long dwFlags; p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwFlags, sizeof(unsigned long)); dwFlags &= (0xFFFFFFFF ^ EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE); if (bValue) dwFlags |= EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE; return adas_Set_Listener_Flags(dwFlags); } return 0; } //------------------------------------------------------------------------------------------------ // set listeners scale reverb //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Scale_Reverb(int bValue) { if (p_EAXGet) { unsigned long dwFlags; p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwFlags, sizeof(unsigned long)); dwFlags &= (0xFFFFFFFF ^ EAXLISTENERFLAGS_REVERBSCALE); if (bValue) dwFlags |= EAXLISTENERFLAGS_REVERBSCALE; return adas_Set_Listener_Flags(dwFlags); } return 0; } //------------------------------------------------------------------------------------------------ // set listeners scale reverb delay //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Scale_Reverb_Delay(int bValue) { if (p_EAXGet) { unsigned long dwFlags; p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwFlags, sizeof(unsigned long)); dwFlags &= (0xFFFFFFFF ^ EAXLISTENERFLAGS_REVERBDELAYSCALE); if (bValue) dwFlags |= EAXLISTENERFLAGS_REVERBDELAYSCALE; return adas_Set_Listener_Flags(dwFlags); } return 0; } //------------------------------------------------------------------------------------------------ // set listeners clip decayHF //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Clip_DecayHF(int bValue) { if (p_EAXGet) { unsigned long dwFlags; p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_FLAGS, 0, &dwFlags, sizeof(unsigned long)); dwFlags &= (0xFFFFFFFF ^ EAXLISTENERFLAGS_DECAYHFLIMIT); if (bValue) dwFlags |= EAXLISTENERFLAGS_DECAYHFLIMIT; return adas_Set_Listener_Flags(dwFlags); } return 0; } //------------------------------------------------------------------------------------------------ // get all listener properties //------------------------------------------------------------------------------------------------ int adas_Get_All_Listener_Properties(LPEAXLISTENERPROPERTIES lpData) { if (p_EAXGet) return p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ALLPARAMETERS, 0, lpData, sizeof(EAXLISTENERPROPERTIES)); return 0; } //------------------------------------------------------------------------------------------------ // get listener decay time //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Decay_Time(float *pfValue) { if (p_EAXGet) return p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_DECAYTIME, 0, pfValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // get listener Reflections //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Reflections(long *plValue) { if (p_EAXGet) return p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REFLECTIONS, 0, plValue, sizeof(long)); return 0; } //------------------------------------------------------------------------------------------------ // get listener Reflections Delay //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Reflections_Delay(float *pfValue) { if (p_EAXGet) return p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY, 0, pfValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // get listener reverb //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Reverb(long *plValue) { if (p_EAXGet) return p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REVERB, 0, plValue, sizeof(long)); return 0; } //------------------------------------------------------------------------------------------------ // get listener reverb delay //------------------------------------------------------------------------------------------------ int adas_Get_Listener_Reverb_Delay(float *pfValue) { if (p_EAXGet) return p_EAXGet(&DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_REVERBDELAY, 0, pfValue, sizeof(float)); return 0; } //------------------------------------------------------------------------------------------------ // set listener rolloff //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Rolloff(float fValue) { if (!bDevice) return 0; alListenerf(AL_ROLLOFF_FACTOR, fValue); return 0; } //------------------------------------------------------------------------------------------------ // set all source properties //------------------------------------------------------------------------------------------------ void adas_Set_Source_All_Properties(int Owner, int Type, int Index, LPEAXBUFFERPROPERTIES lpData) { if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_ALLPARAMETERS, SoundSource[Index].Source, lpData, sizeof(EAXBUFFERPROPERTIES)); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Owner == Owner) { if (Type == ALL_TYPES) { if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_ALLPARAMETERS, SoundSource[i].Source, lpData, sizeof(EAXBUFFERPROPERTIES)); } else if (SoundSource[i].Type == Type) { if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_ALLPARAMETERS, SoundSource[i].Source, lpData, sizeof(EAXBUFFERPROPERTIES)); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_ALLPARAMETERS, SoundSource[i].Source, lpData, sizeof(EAXBUFFERPROPERTIES)); } } //------------------------------------------------------------------------------------------------ // set source properties //------------------------------------------------------------------------------------------------ void adas_Set_Source_Propertiesl(ADAS_SOUND_SOURCE * p_ss, ALuint uiValue, long lValue) { if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, uiValue, p_ss->Source, &lValue, sizeof(LONG)); } void adas_Set_Source_Propertiesf(ADAS_SOUND_SOURCE * p_ss, ALuint uiValue, float fValue) { if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, uiValue, p_ss->Source, &fValue, sizeof(long)); } void adas_Set_Source_Propertiesdw(ADAS_SOUND_SOURCE * p_ss, ALuint uiValue, unsigned long dwValue) { if (p_EAXSet) p_EAXSet(&DSPROPSETID_EAX_BufferProperties, uiValue, p_ss->Source, &dwValue, sizeof(long)); } //------------------------------------------------------------------------------------------------ // set source properties //------------------------------------------------------------------------------------------------ void adas_Set_Source_lEAXproperty(int Owner, int Type, int Index, long lValue, ALuint Property) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) adas_Set_Source_Propertiesl(&SoundSource[Index], Property, lValue); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) adas_Set_Source_Propertiesl(p_Source, Property, lValue); else if (p_Source->Type == Type) adas_Set_Source_Propertiesl(p_Source, Property, lValue); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) adas_Set_Source_Propertiesl(p_Source, Property, lValue); } } } void adas_Set_Source_fEAXproperty(int Owner, int Type, int Index, float fValue, ALuint Property) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) adas_Set_Source_Propertiesf(&SoundSource[Index], Property, fValue); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) adas_Set_Source_Propertiesf(p_Source, Property, fValue); else if (p_Source->Type == Type) adas_Set_Source_Propertiesf(p_Source, Property, fValue); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) adas_Set_Source_Propertiesf(p_Source, Property, fValue); } } } void adas_Set_Source_dwEAXproperty(int Owner, int Type, int Index, unsigned long dwValue, ALuint Property) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) adas_Set_Source_Propertiesdw(&SoundSource[Index], Property, dwValue); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) adas_Set_Source_Propertiesdw(p_Source, Property, dwValue); else if (p_Source->Type == Type) adas_Set_Source_Propertiesdw(p_Source, Property, dwValue); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) adas_Set_Source_Propertiesdw(p_Source, Property, dwValue); } } } #endif #ifdef LINUX //------------------------------------------------------------------------------------------------ // set listeners environment //------------------------------------------------------------------------------------------------ int adas_Set_Listener_Environment(unsigned long dwValue) { return 0; } #endif //------------------------------------------------------------------------------------------------ // set source OPENAL properties //------------------------------------------------------------------------------------------------ void adas_Set_Source_fOPENALproperty(int Owner, int Type, int Index, float fValue, ALenum Property) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcef(SoundSource[Index].Source, Property, fValue); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) alSourcef(SoundSource[Index].Source, Property, fValue); else if (p_Source->Type == Type) alSourcef(p_Source->Source, Property, fValue); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) alSourcef(p_Source->Source, Property, fValue); } } } void adas_Set_Source_vOPENALproperty(int Owner, int Type, int Index, float *vValue, ALenum Property) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcefv(SoundSource[Index].Source, Property, vValue); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) alSourcefv(p_Source->Source, Property, vValue); else if (p_Source->Type == Type) alSourcefv(p_Source->Source, Property, vValue); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) alSourcefv(p_Source->Source, Property, vValue); } } } void adas_Set_Source_dwOPENALproperty(int Owner, int Type, int Index, unsigned long dwValue, ALenum Property) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcei(SoundSource[Index].Source, Property, dwValue); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) alSourcei(p_Source->Source, Property, dwValue); else if (p_Source->Type == Type) alSourcei(p_Source->Source, Property, dwValue); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) alSourcei(p_Source->Source, Property, dwValue); } } } //------------------------------------------------------------------------------------------------ // set source cone outside volume //------------------------------------------------------------------------------------------------ void adas_Set_Source_Cone_Outside_Volume(int Owner, int Type, int Index, long lValue) { ADAS_SOUND_SOURCE *p_Source; if (!bDevice) return; if (Owner == PARTICULAR_SOUND_SOURCE) alSourcef(SoundSource[Index].Source, AL_CONE_OUTER_GAIN, (float)pow(10, (float)lValue / 2000.0f)); if (Owner < PARTICULAR_SOUND_SOURCE) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Owner == Owner) { if (Type == ALL_TYPES) alSourcef(p_Source->Source, AL_CONE_OUTER_GAIN, (float)pow(10, (float)lValue / 2000.0f)); else if (p_Source->Type == Type) alSourcef(p_Source->Source, AL_CONE_OUTER_GAIN, (float)pow(10, (float)lValue / 2000.0f)); } } } if (Owner == ALL_SOUND_SOURCES) { int i; for (i = 0; i < ADAS_data.Channels; i++) { p_Source = &SoundSource[i]; if (p_Source->Source) alSourcef(p_Source->Source, AL_CONE_OUTER_GAIN, (float)pow(10, (float)lValue / 2000.0f)); } } } //------------------------------------------------------------------------------------------------ // get sound of sound sources //------------------------------------------------------------------------------------------------ int adas_Query_Sources(void) { int i, r = 0; if (!bDevice) return 0; for (i = 0; i < ADAS_data.Channels; i++) if (SoundSource[i].Source) r++; return r; } //------------------------------------------------------------------------------------------------ // get source position //------------------------------------------------------------------------------------------------ int adas_Get_Source_Position(int Index, float *fValue) { if (!bDevice) return 0; alGetError(); alGetSourcefv(SoundSource[Index].Source, AL_POSITION, fValue); fValue[0] *= 1.0f / ADAS_data.Scale_Factor; fValue[1] *= 1.0f / ADAS_data.Scale_Factor; fValue[2] *= 1.0f / ADAS_data.Scale_Factor; if (alGetError() != AL_NO_ERROR) return 1; else return 0; } //------------------------------------------------------------------------------------------------ // queue a sound to source //------------------------------------------------------------------------------------------------ int adas_Queue_Sound(int Source, int Wave_Index) { int Mem_Index; ADAS_SOUND_SOURCE *p_ss; if (!bDevice) return 0; if (!SoundSource[Source].Source) return 0; p_ss = &SoundSource[Source]; if (p_ss->Buffer_Pointer > MAXQUEUED) return 0; Mem_Index = adas_Find_Sound(Wave_Index); p_ss->Wave_Index[(int)p_ss->Buffer_Pointer] = Wave_Index; if (Mem_Index == -1) { p_ss->Lock = 1; if (!adas_Load_Wave(p_ss)) return 0; alSourceQueueBuffers(p_ss->Source, 1, &p_ss->Buffer[(int)p_ss->Buffer_Pointer]); p_ss->Buffer_Source[(int)p_ss->Buffer_Pointer] = HDD; p_ss->Lock = 0; } else { p_ss->Lock = 1; p_ss->Buffer[(int)p_ss->Buffer_Pointer] = SoundData[Mem_Index].Buffer; alSourceQueueBuffers(p_ss->Source, 1, &p_ss->Buffer[(int)p_ss->Buffer_Pointer]); p_ss->Buffer_Source[(int)p_ss->Buffer_Pointer] = RAM; p_ss->Lock = 0; } p_ss->Buffer_Pointer++; return 1; } //------------------------------------------------------------------------------------------------ // unqueue a sound to source //------------------------------------------------------------------------------------------------ void adas_Unqueue_Sound(int Source, int Sounds) { int i; ADAS_SOUND_SOURCE *p_ss; p_ss = &SoundSource[Source]; for (i = 0; i < Sounds; i++) { alSourceUnqueueBuffers(p_ss->Source, 1, &p_ss->Buffer[i]); if ((p_ss->Buffer_Source[i] != RAM) && (p_ss->Buffer_Source[i] != UNDEFINED_VALUE)) alDeleteBuffers(1, &p_ss->Buffer[i]); p_ss->Buffer_Source[i] = UNDEFINED_VALUE; p_ss->Buffer[i] = 0; p_ss->Wave_Index[i] = UNDEFINED_VALUE; } memcpy((void *)&p_ss->Buffer_Source[0], (void *)&p_ss->Buffer_Source[Sounds], (p_ss->Buffer_Pointer - Sounds) * sizeof(int)); memcpy((void *)&p_ss->Buffer[0], (void *)&p_ss->Buffer[Sounds], (p_ss->Buffer_Pointer - Sounds) * sizeof(ALuint)); memcpy((void *)&p_ss->Wave_Index[0], (void *)&p_ss->Wave_Index[Sounds], (p_ss->Buffer_Pointer - Sounds) * sizeof(ALuint)); p_ss->Buffer_Pointer -= Sounds; } //------------------------------------------------------------------------------------------------ // Returns load source of queued buffers in sound source //------------------------------------------------------------------------------------------------ void adas_Get_Load_Source(int Source, int *p_Load, int Size_of_Load) { int i; ADAS_SOUND_SOURCE *p_ss; p_ss = &SoundSource[Source]; for (i = 0; i < Size_of_Load; i++) if (i < MAXQUEUED) { p_Load[i] = p_ss->Buffer_Source[i]; } else break; } //------------------------------------------------------------------------------------------------ // returns version of Anakreon Digital Audio System //------------------------------------------------------------------------------------------------ void adas_Get_Version(int *piHi, int *piLow) { *piHi = ADAS_VERSION_HI; *piLow = ADAS_VERSION_LOW; } //------------------------------------------------------------------------------------------------ // get current device context //------------------------------------------------------------------------------------------------ ALCcontext *adas_Get_Context(void) { return p_Context; } //------------------------------------------------------------------------------------------------ // get current device //------------------------------------------------------------------------------------------------ ALCdevice *adas_Get_Device(void) { return p_Device; } void * adasLoadWAVFile(const char * filename, ALenum * format, void **data, ALsizei * size, ALuint * frequency, ALboolean * loop) { ALfloat freq; *data = alutLoadMemoryFromFile(filename, format, size, &freq); if (!(*data)) { fprintf(stderr, "ADAS: adasLoadWAVFile(): %s\n", alutGetErrorString(alutGetError())); return (FALSE); } *frequency = (ALuint)freq; *loop = AL_FALSE; return (*data); } void * adasLoadWAVMemory(ALbyte * buffer, ALsizei buffer_length, ALenum * format, void **data, ALsizei * size, ALuint * frequency, ALboolean * loop) { ALfloat freq; *data = alutLoadMemoryFromFileImage(buffer, buffer_length, format, size, &freq); if (!(*data)) { fprintf(stderr, "ADAS: adasLoadWAVMemory(): %s\n", alutGetErrorString(alutGetError())); return (FALSE); } *frequency = (ALuint)freq; *loop = AL_FALSE; return (*data); } void adasUnloadWAV(ALenum format, ALvoid * data, ALsizei size, ALsizei frequency) { free(data); } void adas_set_sound_dir(char *p_dir) { strcpy(sound_dir, p_dir); } berusky2-0.12/src/adas/ogg_io.c0000644000175000017500000001077713674426075013263 00000000000000#include "compat_mini.h" #include "ogg_io.h" FILE* oggFile; OggVorbis_File oggStream; vorbis_info* vorbisInfo; vorbis_comment* vorbisComment; ALuint buffers[3]; ALuint source; ALenum format; THREAD_ID threadid; THREAD_HANDLE thread; char ogg_stop; extern char bDevice; char ogg_check(); void ogg_empty(); char ogg_stream(ALuint buffer); void * ogg_proc( void *lpParameter ); void ogg_gain(float gain) { if(!bDevice) return; if(!thread) return; alSourcef (source, AL_GAIN, gain); } int ogg_open(char *file, float gain) { int result; if(!bDevice) return 0; if(!(oggFile = fopen(file, "rb"))) return 0; if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0) { fclose(oggFile); return 0; } vorbisInfo = ov_info(&oggStream, -1); vorbisComment = ov_comment(&oggStream, -1); if(vorbisInfo->channels == 1) format = AL_FORMAT_MONO16; else format = AL_FORMAT_STEREO16; alGenBuffers(3, buffers); ogg_check(); alGenSources(1, &source); ogg_check(); alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0); alSourcef (source, AL_ROLLOFF_FACTOR, 0.0 ); alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE ); alSourcef (source, AL_GAIN, gain ); return 1; } void ogg_release() { dword exit_code = STILL_ACTIVE; if(!bDevice) return; if(!thread) return; ogg_stop = 1; while(exit_code == STILL_ACTIVE) GetExitCodeThread(thread, &exit_code); CloseHandle(thread); thread = 0; threadid = 0; alSourceStop(source); ogg_empty(); alDeleteSources(1, &source); ogg_check(); alDeleteBuffers(3, buffers); ogg_check(); ov_clear(&oggStream); } char ogg_playback() { if(!bDevice) return 0; if(ogg_playing()) return 1; if(!ogg_stream(buffers[0])) return 0; if(!ogg_stream(buffers[1])) return 0; if(!ogg_stream(buffers[2])) return 0; alSourceQueueBuffers(source, 3, buffers); ogg_stop = 0; thread = CreateThread( NULL, 0, ogg_proc, NULL, 0, &(threadid)); if(!thread) return 0; SetThreadPriority(thread,THREAD_PRIORITY_HIGHEST); //SetThreadPriority(thread,THREAD_PRIORITY_ABOVE_NORMAL); return 1; } char ogg_playing() { ALenum state; if(!bDevice) return 0; if(!thread) return 0; alGetSourcei(source, AL_SOURCE_STATE, &state); return (state == AL_PLAYING); } char ogg_update() { int processed; char active = 1; if(!bDevice) return 0; if(!thread) return 0; alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); while(processed--) { ALuint buffer; alSourceUnqueueBuffers(source, 1, &buffer); ogg_check(); active = ogg_stream(buffer); alSourceQueueBuffers(source, 1, &buffer); ogg_check(); } return active; } char ogg_stream(ALuint buffer) { char pcm[BUFFER_SIZE]; int size = 0; int section; int result; while(size < BUFFER_SIZE) { result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, §ion); if(result > 0) size += result; else if(result < 0) return 0; else break; } if(size == 0) return 0; alBufferData(buffer, format, pcm, size, vorbisInfo->rate); ogg_check(); return 1; } void ogg_empty() { int queued; if(!bDevice) return; if(!thread) return; alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); while(queued--) { ALuint buffer; alSourceUnqueueBuffers(source, 1, &buffer); ogg_check(); } } char ogg_check() { int error = alGetError(); if(error != AL_NO_ERROR) return 1; return 0; } void * ogg_proc( void *lpParameter ) { alSourcePlay(source); while(ogg_update()) { if(ogg_stop) { alSourceStop(source); ExitThread(0); return 0; } if(!ogg_playing()) { alSourceStop(source); if(ogg_update()) alSourcePlay(source); else break; } Sleep(4); } //ogg_release(); ExitThread(0); thread = 0; threadid = 0; alSourceStop(source); ogg_empty(); alDeleteSources(1, &source); ogg_check(); alDeleteBuffers(3, buffers); ogg_check(); ov_clear(&oggStream); return NULL; } berusky2-0.12/src/adas/adas.h0000644000175000017500000003036613674426075012731 00000000000000#ifndef _ADAS_H_ #define _ADAS_H_ //------------------------------------------------------------------------------------------------ // includes //------------------------------------------------------------------------------------------------ #include "adas_types.h" #include "ogg_stream.h" #include "ogg_io.h" #include #include #include #ifdef __cplusplus extern "C" { #endif //Init AnakreoN Digital Sound System: // Following is a brief description of the 3 different implementations // that can be created. // // DirectSound3D // // Uses Direct Sound 3D to render the Open AL audio. This implementation will // benefit from Direct Sound 3D accelerators like the SB Live ! Applications must // use this implementation if they wish to use EAX extensions. // // DirectSound // // This implimentation uses software mixing with output to a // DSound stereo buffer. This implimentation offers the best // comprimise of speed and latency for all cards. However, EAX // extensions will not be available. // // Default // // This implimentation utilizes software mixing with output to // mmsystem. It offers the best solution across Win9x and NT // platforms. It does however offer the highest latency. void adas_Init( ADAS_INIT_DATA *p_adas_data ); //Release AnakreoN Digital Sound System void adas_Exit(void); // Set distance model int adas_Set_Distance_Model(long Distance_Model); // Set distance model int adas_Set_Doppler_Factor(float Doppler_Factor); // Set distance model int adas_Set_Doppler_Velocity(float Doppler_Velocity); // load sound data & init memory unsigned long adas_Load_First(char *p_Index_File, char *p_File_Name); unsigned long adas_Load_FirstMemory(char *p_Index_File, void *p_File, long File_Size, char *p_File_Name); // load sound data unsigned long adas_Load_Next(char *p_File_Name); unsigned long adas_Load_NextMemory(void *p_File, long File_Size, char *p_File_Name); // releases loaded sound data void adas_Release_Loaded_Data(void); // Set Listener Gain int adas_Set_Listener_Gain(float v); // Set Listener Position int adas_Set_Listener_Position(float *v); // Set Listener Velocity int adas_Set_Listener_Velocity(float *v); // Set Listener Orientation int adas_Set_Listener_Orientation(float *v); // Get Listener Gain int adas_Get_Listener_Gain(float *v); // Get Listener Position int adas_Get_Listener_Position(float *v); // Get Listener Velocity int adas_Get_Listener_Velocity(float *v); // Get Listener Orientation int adas_Get_Listener_Orientation(float *v); // Create Sound Source int adas_Create_Source(ADAS_SOUND_SOURCE_DATA *p_ssd, void **p_callback); // queue a sound to source int adas_Queue_Sound(int Source, int Wave_Index); // unqueue a sound to source void adas_Unqueue_Sound(int Source, int Sounds); // Returns load source of queued buffers in sound source void adas_Get_Load_Source(int Source, int *p_Load, int Size_of_Load); // Release sound source void adas_Release_Source(int Owner, int Type, int Index); // Pause sound source void adas_Pause_Source(int Owner, int Type, int Index); // Resume sound source void adas_Resume_Source(int Owner, int Type, int Index); // cheks, if is particular owher playing selected sound data int adas_Is_Sound_Processed(int Wave_Index, int Owner); // sel all sources volume (gain) void adas_Set_All_Source_Volume(float fValue); #ifdef WINDOWS // set all listeners parametrs int adas_Set_All_Listener_Properties(LPEAXLISTENERPROPERTIES lpData); #endif // set listeners room int adas_Set_Listener_Room(long lValue); // set listeners roomHF int adas_Set_Listener_RoomHF(long lValue); // set listeners room rolloff int adas_Set_Listener_Room_Rolloff(float fValue); // set listeners room decay time int adas_Set_Listener_Decay_Time(float fValue); // set listeners room decay HFRatio int adas_Set_Listener_Decay_HFRatio(float fValue); // set listeners reflections int adas_Set_Listener_Reflections(long lValue); // set listeners reflections delay int adas_Set_Listener_Reflections_Delay(float fValue); // set listeners reverb int adas_Set_Listener_Reverb(long lValue); // set listeners reverb delay int adas_Set_Listener_Reverb_Delay(float fValue); // set listeners environment int adas_Set_Listener_Environment(unsigned long dwValue); // set listeners environment size int adas_Set_Listener_Environment_Size(float fValue); // set listeners environment diffusion int adas_Set_Listener_Environment_Diffusion(float fValue); // set listeners air absoprtion int adas_Set_Listener_Air_Absorption(float fValue); // set listeners flags int adas_Set_Listener_Flags(unsigned long dwValue); // set listeners scale delay time int adas_Set_Listener_Scale_Decay_Time(int bValue); // set listeners scale reflections int adas_Set_Listener_Scale_Reflections(int bValue); // set listeners scale reflections delay int adas_Set_Listener_Scale_Reflections_Delay(int bValue); // set listeners scale reverb int adas_Set_Listener_Scale_Reverb(int bValue); // set listeners scale reverb delay int adas_Set_Listener_Scale_Reverb_Delay(int bValue); // set listeners clip decayHF int adas_Set_Listener_Clip_DecayHF(int bValue); #ifdef WINDOWS // get all listener properties int adas_Get_All_Listener_Properties(LPEAXLISTENERPROPERTIES lpData); #endif // get listener decay time int adas_Get_Listener_Decay_Time(float* pfValue); // get listener Reflections int adas_Get_Listener_Reflections(long* plValue); // get listener Reflections Delay int adas_Get_Listener_Reflections_Delay(float* pfValue); // get listener reverb int adas_Get_Listener_Reverb(long* plValue); // get listener reverb delay int adas_Get_Listener_Reverb_Delay(float* pfValue); // set listener rolloff int adas_Set_Listener_Rolloff(float fValue); #ifdef WINDOWS // set source properties void adas_Set_Source_All_Properties(int Owner, int Type, int Index, LPEAXBUFFERPROPERTIES lpData); #endif // Set cube position void adas_Set_Bounding_Object_Position(int Owner, int Type, int Index, float *v); // Set sound sources position void adas_Set_Source_Position(int Owner, int Type, int Index, float *v); // Set sound sources pitch void adas_Set_Source_Pitch(int Owner, int Type, int Index, float v); // Set sound sources gain void adas_Set_Source_Gain(int Owner, int Type, int Index, float v); // Set sound sources min. gain void adas_Set_Source_Min_Gain(int Owner, int Type, int Index, float v); // Set sound sources max. gain void adas_Set_Source_Max_Gain(int Owner, int Type, int Index, float v); // Set sound sources velocity void adas_Set_Source_Velocity(int Owner, int Type, int Index, float *v); // set source EAX properties void adas_Set_Source_lEAXproperty (int Owner, int Type, int Index, long lValue, ALuint Property); void adas_Set_Source_fEAXproperty (int Owner, int Type, int Index, float fValue, ALuint Property); void adas_Set_Source_dwEAXproperty(int Owner, int Type, int Index, unsigned long dwValue, ALuint Property); // set source direct #define adas_Set_Source_Direct(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_DIRECT) // set source directHF #define adas_Set_Source_DirectHF(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_DIRECTHF) // set source room #define adas_Set_Source_Room(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_ROOM) // set source roomHF #define adas_Set_Source_RoomHF(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_ROOMHF) // set source rolloff #define adas_Set_Source_Rolloff(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR) // set source outsideHF volume #define adas_Set_Source_Outside(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF) // set source absorption #define adas_Set_Source_Absorption(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR) // set source flags #define adas_Set_Source_Flags(Owner, Type, Index, dwValue) adas_Set_Source_dwEAXproperty(Owner, Type, Index, dwValue, DSPROPERTY_EAXBUFFER_FLAGS) // set source obstruction #define adas_Set_Source_Obstruction(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_OBSTRUCTION) // set source obstructionLF #define adas_Set_Source_ObstructionLF(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO) // set source occlusion #define adas_Set_Source_Occlusion(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_OCCLUSION) // set source occlusionLF #define adas_Set_Source_OcclusionLF(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO) // set source occlusion room #define adas_Set_Source_Occlusion_Room(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO) // set source OPENAL properties void adas_Set_Source_fOPENALproperty (int Owner, int Type, int Index, float fValue, ALenum Property); void adas_Set_Source_vOPENALproperty (int Owner, int Type, int Index, float *vValue, ALenum Property); void adas_Set_Source_dwOPENALproperty(int Owner, int Type, int Index, unsigned long dwValue, ALenum Property); // set source min distance #define adas_Set_Source_Min_Distance(Owner, Type, Index, fValue) adas_Set_Source_fOPENALproperty (Owner, Type, Index, fValue, AL_MIN_DISTANCE); // set source max distance #define adas_Set_Source_Max_Distance(Owner, Type, Index, fValue) adas_Set_Source_fOPENALproperty (Owner, Type, Index, fValue, AL_MAX_DISTANCE); // set source reference distance #define adas_Set_Source_Reference_Distance(Owner, Type, Index, fValue) adas_Set_Source_fOPENALproperty (Owner, Type, Index, fValue, AL_REFERENCE_DISTANCE); // set source orientation #define adas_Set_Source_Cone_Orientation(Owner, Type, Index, vValue) adas_Set_Source_vOPENALproperty (Owner, Type, Index, *vValue, AL_DIRECTION); // set source inside angle #define adas_Set_Source_Cone_Inside_Angle(Owner, Type, Index, dwValue) adas_Set_Source_dwOPENALproperty (Owner, Type, Index, dwValue, AL_CONE_INNER_ANGLE); // set source cone outside angle #define adas_Set_Source_Cone_Outside_Angle(Owner, Type, Index, dwValue) adas_Set_Source_dwOPENALproperty (Owner, Type, Index, dwValue, AL_CONE_OUTER_ANGLE); // set source cone outside volume void adas_Set_Source_Cone_Outside_Volume(int Owner, int Type, int Index, long lValue); // get source position int adas_Get_Source_Position(int Index, float *fValue); // get sound of sound sources int adas_Query_Sources(void); // Get error message int adas_Get_Last_Error(char *p_Text, int Size); // Get warning message int adas_Get_Last_Warning(char *p_Text, int Size); // reset error message void adas_Reset_Last_Error(void); //returns version of Anakreon Digital Audio System void adas_Get_Version(int *piHi, int *piLow); // get current device context ALCcontext *adas_Get_Context(void); // get current device ALCdevice *adas_Get_Device(void); // Replacements for alutLoadWAV{File,Memory} and alutUnloadWAV void * adasLoadWAVFile(const char *filename, ALenum *format, void **data, ALsizei *size, ALuint *frequency, ALboolean *loop); void * adasLoadWAVMemory(ALbyte *buffer, ALsizei buffer_length, ALenum *format, void **data, ALsizei *size, ALuint *frequency, ALboolean *loop); void adasUnloadWAV(ALenum format, ALvoid *data, ALsizei size, ALsizei frequency); void adas_set_sound_dir(char *p_dir); #ifdef __cplusplus } #endif #endif berusky2-0.12/src/age/0000755000175000017500000000000013676433304011537 500000000000000berusky2-0.12/src/age/graph/0000755000175000017500000000000013676433304012640 500000000000000berusky2-0.12/src/age/graph/obb.h0000644000175000017500000002051613674426075013504 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Oriented Bounding Bores and Trees */ #ifndef __OBB_H__ #define __OBB_H__ class obb; typedef class obb OBB; /* * OBB envelope * * Precalculated bounding points * * */ typedef class obb : public box { public: VECT3DF dir[3]; // OBB direction vectors VECT3DF center; // Center of the OBB VECT3DF len; // Lengths public: virtual obb * copy(void) { return(new obb); } public: virtual void set(void) { center.set(0,0,0); dir[0].set(1,0,0); dir[1].set(0,1,0); dir[2].set(0,0,1); len.set(1,1,1); } virtual void set(VECT *p_min, VECT *p_max) { ::center_get(p_min,p_max,¢er); ::length_get(p_min,p_max,&len); dir[0].set(1,0,0); dir[1].set(0,1,0); dir[2].set(0,0,1); } virtual void set(float x, float y, float z, float dx, float dy, float dz) { } virtual void set_len(VECT *p_center, VECT *p_len) { } virtual void set_len(VECT *p_len) { } void set_most_precise(VECT *p_vertex, int vertexnum, tface *p_face, int facenum); void set_precise(VECT *p_vertex, int vertexnum, tface *p_face, int facenum); void set_fast(VECT *p_vertex, int vertexnum, tface *p_face, int facenum); virtual void set(VECT *p_vertex, int vertexnum, tface *p_face, int facenum); virtual void set(GLMATRIX *p_mat, VECT *p_vertex, int vertexnum, tface *p_face, int facenum); virtual void set(class box *p_src); public: void set(VECT *p_center, VECT **p_dir, VECT *p_len) { center = *p_center; dir[0] = *p_dir[0]; dir[1] = *p_dir[1]; dir[2] = *p_dir[2]; len = *p_len; } void set(OBB *p_list, int num); public: virtual void adjust(VECT *p_vec); virtual void adjust(VECT *p_center, float radius); public: void adjust_len(VECT *p_vec); void adjust(class obb *p_obb); public: virtual VECT * center_get(VECT *p_vec) { *p_vec = center; return(p_vec); } virtual VECT * center_get(GLMATRIX *p_mat, VECT *p_vec) { *p_vec = center; return(matrix_transformate(p_vec,p_mat)); } virtual VECT * length_get(VECT *p_len) { *p_len = len; return(p_len); } public: virtual bool visible(GLMATRIX *p_m); virtual bool visible_full(GLMATRIX *p_m); public: virtual bool inside(VECT *p_vert) { VECT v,v1; v1 = *p_vert - center; v.x = vect_dot_product(dir[0],v1); v.y = vect_dot_product(dir[1],v1); v.z = vect_dot_product(dir[2],v1); if(fabsf(v.x) <= fabsf(len.x) && fabsf(v.y) <= fabsf(len.y) && fabsf(v.z) <= fabsf(len.z)) return(TRUE); else return(FALSE); } virtual bool inside(GLMATRIX *p_m, VECT *p_vec) { obb tmp = *this; tmp.transformate(p_m); return(inside(p_vec)); } public: virtual int intersect_vector(VECT *p_a, VECT *p_b, VECT *p_intersect = NULL, float *p_t = NULL); virtual int intersect_vector(GLMATRIX *p_m, VECT *p_a, VECT *p_b, VECT *p_intersect = NULL, float *p_t = NULL) { obb tmp = *this; tmp.transformate(p_m); return(tmp.intersect_vector(p_a,p_b,p_intersect,p_t)); } virtual int intersect(VECT *p_orig, VECT *p_dir, VECT *p_intersect = NULL, float *p_t = NULL); virtual int intersect(GLMATRIX *p_m, VECT *p_orig, VECT *p_dir, VECT *p_intersect = NULL, float *p_t = NULL) { obb tmp = *this; tmp.transformate(p_m); return(tmp.intersect(p_orig,p_dir,p_intersect,p_t)); } public: static bool intersect(OBB *p_obb1, OBB *p_obb2); public: bool intersect(OBB *p_obb) { return(intersect(this,p_obb)); } public: virtual bool intersect(BOX *p_box); virtual float intersect_plane(VECT *p_a, PLANE_TYPE type) { return(0.0f); }; virtual void intersect_point(VECT *p_vec) {}; public: float dist(VECT *p_vert) { VECT v,v1,v2; v1 = *p_vert - center; v.x = vect_dot_product(dir[0],v1); v.y = vect_dot_product(dir[1],v1); v.z = vect_dot_product(dir[2],v1); v2 = v1; v2.norm(); v2 *= len; if(fabsf(v1.x) <= fabsf(v2.x) && fabsf(v1.y) <= fabsf(v2.y) && fabsf(v1.z) <= fabsf(v2.z)) { return(0.0f); } else { v1 -= v2; return(v1.size()); } } public: void draw(GLMATRIX *p_m, RGBB color); public: void print(char *p_name = NULL); private: static void transformate(class obb *p_src, GLMATRIX *p_m, class obb *p_dest); public: BOX * transformate(GLMATRIX *p_m); public: virtual AABB * to_aabb(AABB *p_dest); virtual OBB * to_obb(OBB *p_dest); public: /* float dist_plane_x(float x) { float min = aabb_get()->min.x, max = aabb_get()->max.x; float dist1,dist2; if(min <= x && x <= max) return(0.0f); else { dist1 = fabsf(min-x); dist2 = fabsf(max-x); return(dist1 > dist2 ? dist1 : dist2); } } float dist_plane_y(float y) { float min = aabb_get()->min.y, max = aabb_get()->max.y; float dist1,dist2; if(min <= y && y <= max) return(0.0f); else { dist1 = fabsf(min-y); dist2 = fabsf(max-y); return(dist1 > dist2 ? dist1 : dist2); } } float dist_plane_z(float z) { float min = aabb_get()->min.z, max = aabb_get()->max.z; float dist1,dist2; if(min <= z && z <= max) return(0.0f); else { dist1 = fabsf(min-z); dist2 = fabsf(max-z); return(dist1 > dist2 ? dist1 : dist2); } } */ public: #define OBB_BORDER_VERTEXNUM 8 VECT border[OBB_BORDER_VERTEXNUM]; public: virtual int border_vertexnum_get(void) { return(OBB_BORDER_VERTEXNUM); } virtual VECT * border_get(VECT *p_border); private: void border_update(void) { border_get(border); } public: // transformates World -> OBB GLMATRIX * matrix_to_obb_get(GLMATRIX *p_mat) { p_mat->rotation_set(dir,dir+1,dir+2); p_mat->translation_set(-center.x,-center.y,-center.z); return(p_mat); } // transformates OBB -> World GLMATRIX * matrix_to_world_get(GLMATRIX *p_mat) { matrix_to_obb_get(p_mat); return(p_mat->invert()); } public: obb(void) { type = BOX_OBB; } obb(class obb *p_src) { *this = *p_src; } /* * Create an obb from one and more obb's */ obb(class obb *p_list, int num) { type = BOX_OBB; set(p_list, num); } obb(class box *p_src); } OBB; /* OBB Envelope tree - an envelope */ typedef class obb_tree_item { OBB *p_obb; void *p_item; int viditelny; int zrc_viditelny; } OBB_TREE_ITEM; /* OBB Envelope tree */ typedef class obb_tree { int mail; OBB obb; int itnum; // polozky stromu OBB_TREE_ITEM *p_item; class obb_tree *p_up; // otec stromu int nextnum; // pocet podobalek class obb_tree *p_next; // podobalky public: //void obb_tree::kresli(dword barva); } OBB_TREE; #endif // __OBB_H__ berusky2-0.12/src/age/graph/object_box.h0000644000175000017500000000616413674426075015063 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Basic object intersection interface */ typedef class object_box : public object_world { FRAME_CHANGE_INTERFACE chng; private: bool global_object_box_changed(void) { return(chng.changed()); } void global_object_box_change_set(void) { chng.change_set(); } /* * Object boxes - local */ public: virtual BOX * object_box_get(void) { return(NULL); } virtual bool object_box_changed(void) { return(FALSE); } virtual void object_box_set(BOX *p_box) { } public: virtual BOX_TYPE object_box_type_get(void) { return(BOX_NONE); } virtual void object_box_type_set(BOX_TYPE type) { } /* * Object boxes - global */ protected: BOX *p_box_global; public: BOX * object_box_global_get(void) { return(p_box_global ? p_box_global : object_box_get()); } private: bool box_child_changed(void) { object_box *p_child = (object_box *)render_hierarchy_child_get(); while(p_child) { if(p_child->object_box_changed() || p_child->global_object_box_changed()) return(TRUE); p_child = (object_box *)p_child->render_hierarchy_sibling_get(); } return(FALSE); } BOX * box_child_create(void); public: int object_box_hierarchy_update(bool forced = FALSE) { if(forced || object_box_changed() || box_child_changed()) { if(p_box_global) delete p_box_global; p_box_global = box_child_create(); global_object_box_change_set(); return(TRUE); } else { return(FALSE); } } public: object_box(class scene *p_scene) : object_world(p_scene), p_box_global(NULL) { } ~object_box(void) { if(p_box_global) delete p_box_global; } } OBJECT_BOX; berusky2-0.12/src/age/graph/color_operators.h0000644000175000017500000005313513674454611016156 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* color classes */ #ifndef __COLOR_OPERATORS_H__ #define __COLOR_OPERATORS_H__ /* * Unary operators */ #define OP_UNARY_RGB_1(type,type_scalar) bool operator<=(type src) { return(r <= src.r && g <= src.g && b <= src.b); } #define OP_UNARY_RGB_2(type,type_scalar) bool operator>=(type src) { return(r >= src.r && g >= src.g && b >= src.b); } #define OP_UNARY_RGB_3(type,type_scalar) bool operator<(type src) { return(r < src.r && g < src.g && b < src.b); } #define OP_UNARY_RGB_4(type,type_scalar) bool operator>(type src) { return(r > src.r && g > src.g && b > src.b); } #define OP_UNARY_RGB_5(type,type_scalar) bool operator==(type src) { return(r == src.r && g == src.g && b == src.b); } #define OP_UNARY_RGB_6(type,type_scalar) bool operator!=(type src) { return(r != src.r || g != src.g || b != src.b); } #define OP_UNARY_RGB_7(type,type_scalar) void operator+=(type src) { r += src.r; g += src.g; b += src.b; norm_color(); } #define OP_UNARY_RGB_8(type,type_scalar) void operator-=(type src) { r -= src.r; g -= src.g; b -= src.b; norm_color(); } #define OP_UNARY_RGB_9(type,type_scalar) void operator*=(type src) { r *= src.r; g *= src.g; b *= src.b; norm_color(); } #define OP_UNARY_RGB_10(type,type_scalar) void operator/=(type src) { r /= src.r; g /= src.g; b /= src.b; norm_color(); } #define OP_UNARY_RGB_11(type,type_scalar) void operator+=(type_scalar src) { r += src; g += src; b += src; norm_color(); } #define OP_UNARY_RGB_12(type,type_scalar) void operator-=(type_scalar src) { r -= src; g -= src; b -= src; norm_color(); } #define OP_UNARY_RGB_13(type,type_scalar) void operator*=(type_scalar src) { r *= src; g *= src; b *= src; norm_color(); } #define OP_UNARY_RGB_14(type,type_scalar) void operator/=(type_scalar src) { r /= src; g /= src; b /= src; norm_color(); } #define OP_UNARY_RGB_15(type,type_scalar) type operator+(type src) { type tmp; tmp.r=r+src.r;tmp.g=g+src.g;tmp.b=b+src.b; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_16(type,type_scalar) type operator-(type src) { type tmp; tmp.r=r-src.r;tmp.g=g-src.g;tmp.b=b-src.b; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_17(type,type_scalar) type operator*(type src) { type tmp; tmp.r=r*src.r;tmp.g=g*src.g;tmp.b=b*src.b; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_18(type,type_scalar) type operator/(type src) { type tmp; tmp.r=r/src.r;tmp.g=g/src.g;tmp.b=b/src.b; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_19(type,type_scalar) type operator+(type_scalar src) { type tmp; tmp.r=r+src;tmp.g=g+src;tmp.b=b+src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_20(type,type_scalar) type operator-(type_scalar src) { type tmp; tmp.r=r-src;tmp.g=g-src;tmp.b=b-src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_21(type,type_scalar) type operator*(type_scalar src) { type tmp; tmp.r=r*src;tmp.g=g*src;tmp.b=b*src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_22(type,type_scalar) type operator/(type_scalar src) { type tmp; tmp.r=r/src;tmp.g=g/src;tmp.b=b/src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGB_23(type,type_scalar) void set(void) { r = g = b = 0; }; #define OP_UNARY_RGB_24(type,type_scalar) void set(type_scalar src) { r = g = b = src; }; #define OP_UNARY_RGB_25(type,type_scalar) void set(type_scalar r_, type_scalar g_, type_scalar b_) { r = r_; g = g_; b = b_; }; #define OP_UNARY_RGB_26(type,type_scalar) void norm_max(type_scalar src) { if(r > src) r = src; if(g > src) g = src; if(b > src) b = src; }; #define OP_UNARY_RGB_27(type,type_scalar) void norm_max(type src) { if(r > src.r) r = src.r; if(g > src.g) g = src.g; if(b > src.b) b = src.b; }; #define OP_UNARY_RGB_28(type,type_scalar) void norm_min(type_scalar src) { if(r < src) r = src; if(g < src) g = src; if(b < src) b = src; }; #define OP_UNARY_RGB_29(type,type_scalar) void norm_min(type src) { if(r < src.r) r = src.r; if(g < src.g) g = src.g; if(b < src.b) b = src.b; }; #define OP_UNARY_RGB_30(type,type_scalar) void norm_color(type_scalar src_max, type_scalar src_min) { norm_max(src_max); norm_min(src_min); }; #define OP_UNARY_RGB_31(type,type_scalar) void norm_color(type src_max, type src_min) { norm_max(src_max); norm_min(src_min); }; #define OP_UNARY_RGB(type,type_scalar) \ OP_UNARY_RGB_1(type,type_scalar) \ OP_UNARY_RGB_2(type,type_scalar) \ OP_UNARY_RGB_3(type,type_scalar) \ OP_UNARY_RGB_4(type,type_scalar) \ OP_UNARY_RGB_5(type,type_scalar) \ OP_UNARY_RGB_6(type,type_scalar) \ OP_UNARY_RGB_7(type,type_scalar) \ OP_UNARY_RGB_8(type,type_scalar) \ OP_UNARY_RGB_9(type,type_scalar) \ OP_UNARY_RGB_10(type,type_scalar) \ OP_UNARY_RGB_11(type,type_scalar) \ OP_UNARY_RGB_12(type,type_scalar) \ OP_UNARY_RGB_13(type,type_scalar) \ OP_UNARY_RGB_14(type,type_scalar) \ OP_UNARY_RGB_15(type,type_scalar) \ OP_UNARY_RGB_16(type,type_scalar) \ OP_UNARY_RGB_17(type,type_scalar) \ OP_UNARY_RGB_18(type,type_scalar) \ OP_UNARY_RGB_19(type,type_scalar) \ OP_UNARY_RGB_20(type,type_scalar) \ OP_UNARY_RGB_21(type,type_scalar) \ OP_UNARY_RGB_22(type,type_scalar) \ OP_UNARY_RGB_23(type,type_scalar) \ OP_UNARY_RGB_24(type,type_scalar) \ OP_UNARY_RGB_25(type,type_scalar) \ OP_UNARY_RGB_26(type,type_scalar) \ OP_UNARY_RGB_27(type,type_scalar) \ OP_UNARY_RGB_28(type,type_scalar) \ OP_UNARY_RGB_29(type,type_scalar) \ OP_UNARY_RGB_30(type,type_scalar) \ OP_UNARY_RGB_31(type,type_scalar) \ /* * Binary operators */ #define OP_BINARY_RGB_1(type,type_scalar) bool operator<=(type src1, type src2) { return(src1.r <= src2.r && src1.g <= src2.g && src1.b <= src2.b); } #define OP_BINARY_RGB_2(type,type_scalar) bool operator>=(type src1, type src2) { return(src1.r >= src2.r && src1.g >= src2.g && src1.b >= src2.b); } #define OP_BINARY_RGB_3(type,type_scalar) bool operator< (type src1, type src2) { return(src1.r < src2.r && src1.g < src2.g && src1.b < src2.b); } #define OP_BINARY_RGB_4(type,type_scalar) bool operator> (type src1, type src2) { return(src1.r > src2.r && src1.g > src2.g && src1.b > src2.b); } #define OP_BINARY_RGB_5(type,type_scalar) bool operator==(type src1, type src2) { return(src1.r == src2.r && src1.g == src2.g && src1.b == src2.b); } #define OP_BINARY_RGB_6(type,type_scalar) bool operator!=(type src1, type src2) { return(src1.r != src2.r || src1.g != src2.g || src1.b != src2.b); } #define OP_BINARY_RGB_7(type,type_scalar) type operator+(type src1, type src2) { type tmp; tmp.r=src1.r+src2.r; tmp.g=src1.g+src2.g; tmp.b=src1.b+src2.b; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGB_8(type,type_scalar) type operator-(type src1, type src2) { type tmp; tmp.r=src1.r-src2.r; tmp.g=src1.g-src2.g; tmp.b=src1.b-src2.b; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGB_9(type,type_scalar) type operator*(type src1, type src2) { type tmp; tmp.r=src1.r*src2.r; tmp.g=src1.g*src2.g; tmp.b=src1.b*src2.b; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGB_10(type,type_scalar) type operator/(type src1, type src2) { type tmp; tmp.r=src1.r/src2.r; tmp.g=src1.g/src2.g; tmp.b=src1.b/src2.b; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGB(type,type_scalar) \ OP_BINARY_RGB_1(type,type_scalar) \ OP_BINARY_RGB_2(type,type_scalar) \ OP_BINARY_RGB_3(type,type_scalar) \ OP_BINARY_RGB_4(type,type_scalar) \ OP_BINARY_RGB_5(type,type_scalar) \ OP_BINARY_RGB_6(type,type_scalar) \ OP_BINARY_RGB_7(type,type_scalar) \ OP_BINARY_RGB_8(type,type_scalar) \ OP_BINARY_RGB_9(type,type_scalar) \ OP_BINARY_RGB_10(type,type_scalar) \ /* * Unary operators */ #define OP_UNARY_RGBA_1(type,type_scalar) bool operator<=(type src) { return(r <= src.r && g <= src.g && b <= src.b && a <= src.a); } #define OP_UNARY_RGBA_2(type,type_scalar) bool operator>=(type src) { return(r >= src.r && g >= src.g && b >= src.b && a >= src.a); } #define OP_UNARY_RGBA_3(type,type_scalar) bool operator<(type src) { return(r < src.r && g < src.g && b < src.b && a < src.a); } #define OP_UNARY_RGBA_4(type,type_scalar) bool operator>(type src) { return(r > src.r && g > src.g && b > src.b && a > src.a); } #define OP_UNARY_RGBA_5(type,type_scalar) bool operator==(type src) { return(r == src.r && g == src.g && b == src.b && a == src.a); } #define OP_UNARY_RGBA_6(type,type_scalar) bool operator!=(type src) { return(r != src.r && g != src.g && b != src.b && a != src.a); } #define OP_UNARY_RGBA_7(type,type_scalar) void operator+=(type src) { r += src.r; g += src.g; b += src.b; a += src.a; norm_color(); } #define OP_UNARY_RGBA_8(type,type_scalar) void operator-=(type src) { r -= src.r; g -= src.g; b -= src.b; a -= src.a; norm_color(); } #define OP_UNARY_RGBA_9(type,type_scalar) void operator*=(type src) { r *= src.r; g *= src.g; b *= src.b; a *= src.a; norm_color(); } #define OP_UNARY_RGBA_10(type,type_scalar) void operator/=(type src) { r /= src.r; g /= src.g; b /= src.b; a /= src.a; norm_color(); } #define OP_UNARY_RGBA_11(type,type_scalar) void operator+=(type_scalar src) { r += src; g += src; b += src; a += src; norm_color(); } #define OP_UNARY_RGBA_12(type,type_scalar) void operator-=(type_scalar src) { r -= src; g -= src; b -= src; a -= src; norm_color(); } #define OP_UNARY_RGBA_13(type,type_scalar) void operator*=(type_scalar src) { r *= src; g *= src; b *= src; a *= src; norm_color(); } #define OP_UNARY_RGBA_14(type,type_scalar) void operator/=(type_scalar src) { r /= src; g /= src; b /= src; a /= src; norm_color(); } #define OP_UNARY_RGBA_15(type,type_scalar) type operator+(type src) { type tmp; tmp.r=r+src.r;tmp.g=g+src.g;tmp.b=b+src.b;tmp.a=a+src.a; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_16(type,type_scalar) type operator-(type src) { type tmp; tmp.r=r-src.r;tmp.g=g-src.g;tmp.b=b-src.b;tmp.a=a-src.a; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_17(type,type_scalar) type operator*(type src) { type tmp; tmp.r=r*src.r;tmp.g=g*src.g;tmp.b=b*src.b;tmp.a=a*src.a; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_18(type,type_scalar) type operator/(type src) { type tmp; tmp.r=r/src.r;tmp.g=g/src.g;tmp.b=b/src.b;tmp.a=a/src.a; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_19(type,type_scalar) type operator+(type_scalar src) { type tmp; tmp.r=r+src;tmp.g=g+src;tmp.b=b+src;tmp.a=a+src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_20(type,type_scalar) type operator-(type_scalar src) { type tmp; tmp.r=r-src;tmp.g=g-src;tmp.b=b-src;tmp.a=a-src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_21(type,type_scalar) type operator*(type_scalar src) { type tmp; tmp.r=r*src;tmp.g=g*src;tmp.b=b*src;tmp.a=a*src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_22(type,type_scalar) type operator/(type_scalar src) { type tmp; tmp.r=r/src;tmp.g=g/src;tmp.b=b/src;tmp.a=a/src; tmp.norm_color(); return(tmp); } #define OP_UNARY_RGBA_23(type,type_scalar) void set(void) { r = g = b = a = 0; }; #define OP_UNARY_RGBA_24(type,type_scalar) void set(type_scalar src) { r = g = b = a = src; }; #define OP_UNARY_RGBA_25(type,type_scalar) void set(type_scalar r_, type_scalar g_, type_scalar b_, type_scalar a_) { r = r_; g = g_; b = b_; a = a_;}; #define OP_UNARY_RGBA_26(type,type_scalar) void norm_max(type_scalar src) { if(r > src) r = src; if(g > src) g = src; if(b > src) b = src; if(a > src) a = src; }; #define OP_UNARY_RGBA_27(type,type_scalar) void norm_max(type src) { if(r > src.r) r = src.r; if(g > src.g) g = src.g; if(b > src.b) b = src.b; if(a > src.a) a = src.a; }; #define OP_UNARY_RGBA_28(type,type_scalar) void norm_min(type_scalar src) { if(r < src) r = src; if(g < src) g = src; if(b < src) b = src; if(a < src) a = src; }; #define OP_UNARY_RGBA_29(type,type_scalar) void norm_min(type src) { if(r < src.r) r = src.r; if(g < src.g) g = src.g; if(b < src.b) b = src.b; if(a < src.a) a = src.a; }; #define OP_UNARY_RGBA_30(type,type_scalar) void norm_color(type_scalar src_max, type_scalar src_min) { norm_max(src_max); norm_min(src_min); }; #define OP_UNARY_RGBA_31(type,type_scalar) void norm_color(type src_max, type src_min) { norm_max(src_max); norm_min(src_min); }; #define OP_UNARY_RGBA(type,type_scalar) \ OP_UNARY_RGBA_1(type,type_scalar) \ OP_UNARY_RGBA_2(type,type_scalar) \ OP_UNARY_RGBA_3(type,type_scalar) \ OP_UNARY_RGBA_4(type,type_scalar) \ OP_UNARY_RGBA_5(type,type_scalar) \ OP_UNARY_RGBA_6(type,type_scalar) \ OP_UNARY_RGBA_7(type,type_scalar) \ OP_UNARY_RGBA_8(type,type_scalar) \ OP_UNARY_RGBA_9(type,type_scalar) \ OP_UNARY_RGBA_10(type,type_scalar) \ OP_UNARY_RGBA_11(type,type_scalar) \ OP_UNARY_RGBA_12(type,type_scalar) \ OP_UNARY_RGBA_13(type,type_scalar) \ OP_UNARY_RGBA_14(type,type_scalar) \ OP_UNARY_RGBA_15(type,type_scalar) \ OP_UNARY_RGBA_16(type,type_scalar) \ OP_UNARY_RGBA_17(type,type_scalar) \ OP_UNARY_RGBA_18(type,type_scalar) \ OP_UNARY_RGBA_19(type,type_scalar) \ OP_UNARY_RGBA_20(type,type_scalar) \ OP_UNARY_RGBA_21(type,type_scalar) \ OP_UNARY_RGBA_22(type,type_scalar) \ OP_UNARY_RGBA_23(type,type_scalar) \ OP_UNARY_RGBA_24(type,type_scalar) \ OP_UNARY_RGBA_25(type,type_scalar) \ OP_UNARY_RGBA_26(type,type_scalar) \ OP_UNARY_RGBA_27(type,type_scalar) \ OP_UNARY_RGBA_28(type,type_scalar) \ OP_UNARY_RGBA_29(type,type_scalar) \ OP_UNARY_RGBA_30(type,type_scalar) \ OP_UNARY_RGBA_31(type,type_scalar) \ /* * Unary operators */ #define OP_UNARY_HSV_5(type,type_scalar) bool operator==(type src) { return(h == src.h && s == src.s && v == src.v); } #define OP_UNARY_HSV_6(type,type_scalar) bool operator!=(type src) { return(h != src.h || s != src.s || v != src.v); } #define OP_UNARY_HSV_23(type,type_scalar) void set(void) { h = s = v = 0; }; #define OP_UNARY_HSV_24(type,type_scalar) void set(type_scalar src) { h = s = v = src; }; #define OP_UNARY_HSV_25(type,type_scalar) void set(type_scalar h_, type_scalar s_, type_scalar v_) { h = h_; s = s_; v = v_; }; #define OP_UNARY_HSV(type,type_scalar) \ OP_UNARY_HSV_5(type,type_scalar) \ OP_UNARY_HSV_6(type,type_scalar) \ OP_UNARY_HSV_23(type,type_scalar) \ OP_UNARY_HSV_24(type,type_scalar) \ OP_UNARY_HSV_25(type,type_scalar) \ /* * Binary operators */ #define OP_BINARY_RGBA_1(type,type_scalar) bool operator<=(type src1, type src2) { return(src1.r <= src2.r && src1.g <= src2.g && src1.b <= src2.b && src1.a <= src2.a); } #define OP_BINARY_RGBA_2(type,type_scalar) bool operator>=(type src1, type src2) { return(src1.r >= src2.r && src1.g >= src2.g && src1.b >= src2.b && src1.a >= src2.a); } #define OP_BINARY_RGBA_3(type,type_scalar) bool operator< (type src1, type src2) { return(src1.r < src2.r && src1.g < src2.g && src1.b < src2.b && src1.a < src2.a); } #define OP_BINARY_RGBA_4(type,type_scalar) bool operator> (type src1, type src2) { return(src1.r > src2.r && src1.g > src2.g && src1.b > src2.b && src1.a > src2.a); } #define OP_BINARY_RGBA_5(type,type_scalar) bool operator==(type src1, type src2) { return(src1.r == src2.r && src1.g == src2.g && src1.b == src2.b && src1.a == src2.a); } #define OP_BINARY_RGBA_6(type,type_scalar) bool operator!=(type src1, type src2) { return(src1.r != src2.r || src1.g != src2.g || src1.b != src2.b || src1.a != src2.a); } #define OP_BINARY_RGBA_7(type,type_scalar) type operator+(type src1, type src2) { type tmp; tmp.r=src1.r+src2.r; tmp.g=src1.g+src2.g; tmp.b=src1.b+src2.b; tmp.a=src1.a+src2.a; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGBA_8(type,type_scalar) type operator-(type src1, type src2) { type tmp; tmp.r=src1.r-src2.r; tmp.g=src1.g-src2.g; tmp.b=src1.b-src2.b; tmp.a=src1.a-src2.a; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGBA_9(type,type_scalar) type operator*(type src1, type src2) { type tmp; tmp.r=src1.r*src2.r; tmp.g=src1.g*src2.g; tmp.b=src1.b*src2.b; tmp.a=src1.a*src2.a; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGBA_10(type,type_scalar) type operator/(type src1, type src2) { type tmp; tmp.r=src1.r/src2.r; tmp.g=src1.g/src2.g; tmp.b=src1.b/src2.b; tmp.a=src1.a/src2.a; tmp.norm_color(); return(tmp); } #define OP_BINARY_RGBA(type,type_scalar) \ OP_BINARY_RGBA_1(type,type_scalar) \ OP_BINARY_RGBA_2(type,type_scalar) \ OP_BINARY_RGBA_3(type,type_scalar) \ OP_BINARY_RGBA_4(type,type_scalar) \ OP_BINARY_RGBA_5(type,type_scalar) \ OP_BINARY_RGBA_6(type,type_scalar) \ OP_BINARY_RGBA_7(type,type_scalar) \ OP_BINARY_RGBA_8(type,type_scalar) \ OP_BINARY_RGBA_9(type,type_scalar) \ OP_BINARY_RGBA_10(type,type_scalar) \ /* Color operation type */ /* * Describes color/other element blending operation */ typedef struct blend_operation { ARITMETIC_OPERATOR op; bool blend; float blend_factor; public: blend_operation(ARITMETIC_OPERATOR func = OPERATION_SET) { op = func; blend = FALSE; blend_factor = FLOAT_UNDEFINED; } } BLEND_OPERATION; /* * Blending operators */ #define OP_OPERATION(type, type_scalar) \ \ inline type blend(BLEND_OPERATION op, type dest, type src) \ { \ if(op.blend) { \ float alpha_src = (op.blend_factor != FLOAT_UNDEFINED) ? op.blend_factor : src.alpha_get(); \ float alpha_dest = 1.0f - alpha_src; \ \ dest *= alpha_dest; \ src *= alpha_src; \ } \ \ switch(op.op) { \ case OPERATION_SET: \ return(src); \ case OPERATION_ADD: \ return(dest+src); \ case OPERATION_SUB: \ return(dest-src); \ case OPERATION_MODULATE: \ return(dest*src); \ case OPERATION_MODULATE2X: \ return(dest*src*2.0f); \ } \ return(dest); \ } \ \ inline type interpolate(type src1, type src2, float t) \ { \ float t2 = 1.0f - t; \ return(src1*t + src2*t2); \ } \ inline type interpolate_cos(type src1, type src2, float t) \ { \ float f = (1.0f - cosf(t*PI))*0.5f; \ float f2 = 1.0f - f; \ return(src1*f + src2*f2); \ } inline float blend(BLEND_OPERATION op, float dest, float src) { if(op.blend && op.blend_factor != FLOAT_UNDEFINED) { float alpha_src = op.blend_factor; float alpha_dest = 1.0f - alpha_src; dest *= alpha_dest; src *= alpha_src; } switch(op.op) { case OPERATION_SET: return(src); case OPERATION_ADD: return(dest+src); case OPERATION_SUB: return(dest-src); case OPERATION_MODULATE: return(dest*src); case OPERATION_MODULATE2X: return(dest*(src*2.0f)); } return(dest); } #endif //__COLOR_OPERATORS_H__ berusky2-0.12/src/age/graph/scene_reference.h0000644000175000017500000000345313674426075016056 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Reference to scene */ #ifndef __SCENE_REFERENCE_H__ #define __SCENE_REFERENCE_H__ class scene; typedef class scene SCENE; typedef struct scene_reference { private: class scene *p_scene; public: class scene * scene_get(void) { return(p_scene); } void scene_set(class scene * p_ref_scene) { p_scene = p_ref_scene; } public: scene_reference(class scene *p_ref) { p_scene = p_ref; } } OBJECT_SCENE_REFERENCE; #endif // __SCENE_REFERENCE_H__ berusky2-0.12/src/age/graph/surface_mask.h0000644000175000017500000001076513674426075015412 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SURFACE_MASK_H__ #define __SURFACE_MASK_H__ // General mask interface - it's provided by various class typedef class mask_interface { public: virtual tpos width_get(void) = 0; virtual tpos height_get(void) = 0; virtual bool mask_get(int x, int y) = 0; virtual void mask_set(int x, int y, bool mask) = 0; } MASK_INTERFACE; /* * Basic surface mask class (boolean) */ typedef class surface_mask : public surface, public mask_interface { protected: BIT_ARRAY pixels; public: bool loaded(void) { return(pixels.loaded()); } void * pixels_get(void) { return(NULL); } void * pixels_get(tpos x, tpos y) { return(NULL); } protected: tpos width; tpos height; public: tpos width_get(void) { return(width); } tpos height_get(void) { return(height); } void size_get(tpos *p_dx, tpos *p_dy) { *p_dx = width; *p_dy = height; } int index_get(tpos x, tpos y) { return(y*width + x); } public: bool load(const char *p_file, SURFACE_FORMAT format = SURFACE_TEXTURE) { return(FALSE); } bool load_alpha(const char *p_file) { return(FALSE); } bool save(const char *p_file, IMAGE_FORMAT format = IMAGE_BMP) { return(FALSE); } void copy(class surface_mask *p_src) { assert(0); } void move(class surface_mask *p_src) { assert(0); } public: void clear(void) { pixels.clear(); } void create(tpos width, tpos height, SURFACE_FORMAT format = SURFACE_TEXTURE) { this->width = width; this->height = height; pixels.create(width*height); } void create(SURFACE *p_surf, SURFACE_FORMAT format = SURFACE_TEXTURE) { assert(0); } public: void fill(tcolor mask) { pixels.set(mask); } void fill(tpos sx, tpos sy, tpos dx, tpos dy, tcolor mask) { if(loaded()) { int x,y; for(y = 0; y < dy; y++) { for(x = 0; x < dx; x++) { if(pixel_valid(sx+x,sy+y)) { pixels.set(index_get(sx+x,sy+y), (bool)mask); } } } } } void blit(class surface_mask *p_dst, tpos tx = 0, tpos ty = 0) { assert(0); } void blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_mask *p_dst, tpos tx = 0, tpos ty = 0) { assert(0); } void scale(int nx, int ny) { assert(0); } /* * Mask bitmaps */ bool pixel_get(int x, int y) { if(loaded() && pixel_valid(x,y)) { return(pixels.get(index_get(x,y))); } return(FALSE); } void pixel_set(int x, int y, bool mask) { if(loaded() && pixel_valid(x,y)) { pixels.set(index_get(x,y), mask); } } /* * Mask interface */ bool mask_get(int x, int y) { return(pixel_get(x,y)); } void mask_set(int x, int y, bool mask) { pixel_set(x,y,mask); } public: surface_mask(void) : surface(MASK_SURFACE, PIXEL_BOOL), width(0), height(0) { } surface_mask(tpos width, tpos height) : surface(MASK_SURFACE, PIXEL_BOOL), width(0), height(0) { create(width,height); } ~surface_mask(void) { clear(); } } SURFACE_MASK; #endif // __SURFACE_MASK_H__ berusky2-0.12/src/age/graph/object_base.h0000644000175000017500000000516313674426075015203 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Base scene object It's used as base for all superior scene objects (boxes/transformations and so on) */ #ifndef __OBJECT_BASE_H__ #define __OBJECT_BASE_H__ /* A base class for all objects It contains some basic functions (optional) and reference counting. */ typedef class object_base { int reference_num; public: int reference_get(void) { return(reference_num); } int reference_add(void) { reference_num++; return(reference_num); } int reference_dec(void) { assert(reference_num > 0); reference_num--; return(reference_num); } public: /* * Creates internal content of the object * it can be called only once and usually from object constructor */ void create(void) { } /* * Clear all internal values of the object * it can be called from object constructor many times */ void clear(void) { } /* * Destroy the object (if it isn't referenced) */ void destroy(void) { assert(reference_num >= 0); if(reference_num == 0) delete this; } /* void operator delete(void *p_tmp) { assert(0); } */ public: object_base(void) { reference_num = 0; } virtual ~object_base(void) { assert(reference_num == 0); } } OBJECT_BASE; #endif // __OBJECT_BASE_H__ berusky2-0.12/src/age/graph/selection.cpp0000644000175000017500000000302313674426075015254 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" bool selection_search(void *p_search_data, LLIST_ITEM *p_current) { OBJECT_SELECT *p_object = (OBJECT_SELECT *)p_search_data; return(p_object == ((SELECTED_OBJECT_ITEM *)p_current)->object_get()); } berusky2-0.12/src/age/graph/object_base.cpp0000644000175000017500000001364513674426075015542 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* * Object selection */ void scene_object::select(void) { // Check if it's already selected if(is_selected()) return; // If not, mark it as selected... object_select::select(); // ...and add to selection list SCENE * p_scene = scene_get(); if(p_scene) { //p_scene->selection_add(this); } } // TODO -> muze se delat i vyber materialu a podobne? -> Zatim jen pro geometricke // objekty protoze maji v sobe typ objektu void scene_object::unselect(void) { if(!is_selected()) return; object_select::unselect(); SCENE * p_scene = scene_get(); if(p_scene) { //p_scene->selection_remove(this); } } /* * Print */ void scene_object::print(int ident) { } /* * Is the mesh in render hierrachy? */ bool scene_object::is_render_hierarchy(void) { return(mark_get(MARK_RENDERER_HIERARCHY)); } /* * Insert mesh to scene render hierarchy * mesh will be rendered after it. * It's base on the mesh parrent name. */ bool scene_object::render_hierarchy_insert(const char *p_parent_name) { SCENE *p_scene = scene_get(); if(p_scene) { return(p_scene->render_hierarchy_insert(this, p_parent_name)); } return(FALSE); } bool scene_object::render_hierarchy_insert(SCENE_OBJECT *p_parent) { SCENE *p_scene = scene_get(); if(p_scene) { return(p_scene->render_hierarchy_insert(this,p_parent)); } return(FALSE); } /* * Remove mesh from render hierarchy, * it will not be rendered any more. */ bool scene_object::render_hierarchy_remove(void) { SCENE *p_scene = scene_get(); if(p_scene) { return(p_scene->render_hierarchy_remove(this)); } return(FALSE); } /* * Searches for object it sub-tree of this object */ SCENE_OBJECT * scene_object::render_hierarchy_find(const char *p_name) { if(p_name) { OBJECT_HIERARCHY_ITERATOR it = render_hierarchy_next_new(); SCENE_OBJECT *p_act; while((p_act = (SCENE_OBJECT *)hierarchy_next(&it))) { if(p_act->match_name(p_name)) return(p_act); } } return(NULL); } /* * Get siblings (objects on the same level) */ SCENE_OBJECT * scene_object::render_hierarchy_sibling_get(void) { return((SCENE_OBJECT *)hierarchy_sibling_get()); } SCENE_OBJECT * scene_object::render_hierarchy_sibling_last_get(void) { return((SCENE_OBJECT *)hierarchy_sibling_last_get()); } /* * Get first and last chold of this object * Seek between childs with render_hierarchy_sibling_get() */ SCENE_OBJECT * scene_object::render_hierarchy_child_get(void) { return((SCENE_OBJECT *)hierarchy_child_get()); } SCENE_OBJECT * scene_object::render_hierarchy_child_last_get(void) { return((SCENE_OBJECT *)hierarchy_child_last_get()); } /* * Get parent of this object */ SCENE_OBJECT * scene_object::render_hierarchy_parent_get(void) { return((SCENE_OBJECT *)hierarchy_parent_get()); } OBJECT_HIERARCHY_ITERATOR scene_object::render_hierarchy_next_new(void) { return(OBJECT_HIERARCHY_ITERATOR(this)); } /* * Next-in-flow object */ SCENE_OBJECT * scene_object::render_hierarchy_next(OBJECT_HIERARCHY_ITERATOR *p_it) { return((SCENE_OBJECT *)hierarchy_next(p_it)); } bool scene_object::is_render_hierarchy_root(void) { return(is_hierarchy_root()); } void scene_object::render_hierarchy_root_set(void) { return(hierarchy_root_set()); } void scene_object::render_hierarchy_root_clear(void) { return(hierarchy_root_clear()); } /* * Scene Object Tree routines */ bool scene_object_tree::hierarchy_insert(SCENE_OBJECT *p_obj, SCENE_OBJECT *p_parent) { // Is it re-insert? if(p_obj->mark_get(MARK_RENDERER_HIERARCHY)) { p_obj->hierarchy_remove(); } else { p_obj->mark_set(MARK_RENDERER_HIERARCHY); } // Newly inserted object is a root // so add it to top of the hierarchy if(p_obj->is_hierarchy_root()) { root.hierarchy_child_add(p_obj->hierarchy_child_get()); } else { if(p_parent == NULL) { root.hierarchy_child_add(p_obj); } else { p_parent->hierarchy_child_add(p_obj); } } return(TRUE); } /* * Scene Object Tree routines */ bool scene_object_tree::hierarchy_insert(SCENE_OBJECT *p_obj, const char *p_parent_name) { if(p_obj->is_hierarchy_root()) { hierarchy_insert(p_obj,(SCENE_OBJECT *)NULL); } else { SCENE_OBJECT *p_parent = root.render_hierarchy_find(p_parent_name); hierarchy_insert(p_obj,p_parent); } return(TRUE); } bool scene_object_tree::hierarchy_remove(SCENE_OBJECT *p_obj) { if(p_obj->mark_get(MARK_RENDERER_HIERARCHY)) { p_obj->hierarchy_remove(); p_obj->mark_clear(MARK_RENDERER_HIERARCHY); return(FALSE); } return(TRUE); } berusky2-0.12/src/age/graph/mesh.cpp0000644000175000017500000003463013674426075014233 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Meshes */ #include "age.h" // ******************************** // Mesh vertexes // ******************************** void mesh_vertex::vertex_allocate(void) { int i; for(i = 0; i < position_num; i++) { if(!p_pos[i]) p_pos[i] = (VECT *)mmalloc(sizeof(p_pos[0][0])*vertexnum); } for(i = 0; i < normal_num; i++) { if(!p_norm[i]) p_norm[i] = (VECT *)mmalloc(sizeof(p_norm[0][0])*vertexnum); } for(i = 0; i < diffuse_num; i++) { if(!p_diffuse[i]) p_diffuse[i] = (RGBAF *)mmalloc(sizeof(p_diffuse[0][0])*vertexnum); } for(i = 0; i < specular_num; i++) { if(!p_specular[i]) p_specular[i] = (RGBF *)mmalloc(sizeof(p_specular[0][0])*vertexnum); } for(i = 0; i < text_num; i++) { if(!p_uv[i]) p_uv[i] = (VECTUV *)mmalloc(sizeof(p_uv[0][0])*vertexnum); } } void mesh_vertex::vertex_delete(void) { int i; for(i = 0; i < position_num; i++) { if(p_pos[i]) ffree(p_pos[i]); } for(i = 0; i < normal_num; i++) { if(p_norm[i]) ffree(p_norm[i]); } for(i = 0; i < diffuse_num; i++) { if(p_diffuse[i]) ffree(p_diffuse[i]); } for(i = 0; i < specular_num; i++) { if(p_specular[i]) ffree(p_specular[i]); } for(i = 0; i < text_num; i++) { if(p_uv[i]) ffree(p_uv[i]); } } void mesh_vertex::array_position_add(int num) { int new_num = position_num+num; p_pos = (VECT **)rrealloc(p_pos,new_num*sizeof(p_pos[0])); int i; for(i = position_num; i < new_num; i++) p_pos[i] = (VECT *)mmalloc(sizeof(p_pos[0][0])*vertexnum); position_num = new_num; } void mesh_vertex::array_normal_add(int num) { int new_num = normal_num+num; p_norm = (VECT **)rrealloc(p_norm,new_num*sizeof(p_norm[0])); int i; for(i = normal_num; i < new_num; i++) p_norm[i] = (VECT *)mmalloc(sizeof(p_norm[0][0])*vertexnum); normal_num = new_num; } void mesh_vertex::array_diff_add(int num) { int new_num = diffuse_num+num; p_diffuse = (RGBAF **)rrealloc(p_diffuse,new_num*sizeof(p_diffuse[0])); int i; for(i = diffuse_num; i < new_num; i++) p_diffuse[i] = (RGBAF *)mmalloc(sizeof(p_diffuse[0][0])*vertexnum); diffuse_num = new_num; } void mesh_vertex::array_spec_add(int num) { int new_num = specular_num+num; p_specular = (RGBF **)rrealloc(p_specular,new_num*sizeof(p_specular[0])); int i; for(i = specular_num; i < new_num; i++) p_specular[i] = (RGBF *)mmalloc(sizeof(p_specular[0][0])*vertexnum); specular_num = new_num; } void mesh_vertex::array_text_add(int num) { int new_num = text_num+num; p_uv = (VECTUV **)rrealloc(p_uv,new_num*sizeof(p_uv[0])); int i; for(i = text_num; i < new_num; i++) p_uv[i] = (VECTUV *)mmalloc(sizeof(p_uv[0][0])*vertexnum); text_num = new_num; } void mesh_vertex::array_set(int positions, int normals, int diff, int spec, int texts) { if(positions) array_position_add(positions); if(normals) array_normal_add(normals); if(diff) array_diff_add(diff); if(spec) array_spec_add(spec); if(texts) array_text_add(texts); } void mesh_vertex::array_delete(void) { if(p_pos) ffree(p_pos) if(p_norm) ffree(p_norm) if(p_diffuse) ffree(p_diffuse) if(p_specular) ffree(p_specular) if(p_uv) ffree(p_uv); } VECT * mesh_vertex::position_get(int num) { assert(num >= 0); if(locked()) { if(num >= position_num) { array_position_add((num+1)-position_num); } return(p_pos[num]); } else { return(NULL); } } VECT * mesh_vertex::normal_get(int num) { assert(num >= 0); if(locked()) { if(num >= normal_num) { array_normal_add((num+1)-normal_num); } return(p_norm[num]); } else { return(NULL); } } RGBAF * mesh_vertex::diffuse_get(int num) { assert(num >= 0); if(locked()) { if(num >= diffuse_num) { array_diff_add((num+1)-diffuse_num); } return(p_diffuse[num]); } else { return(NULL); } } RGBF * mesh_vertex::specular_get(int num) { assert(num >= 0); if(locked()) { if(num >= specular_num) { array_spec_add((num+1)-specular_num); } return(p_specular[num]); } else { return(NULL); } } VECTUV * mesh_vertex::uv_get(int num) { assert(num >= 0); if(locked()) { if(num >= text_num) { array_text_add((num+1)-text_num); } return(p_uv[num]); } else { return(NULL); } } // submit one indice for rendering (direct-mode) void mesh_vertex::set(int indice) { int i; for(i = 0; i < text_num; i++) { if(p_uv[i]) { //pprintf("[%d][%d] glMultiTexCoord2fvARB(%f,%f)",indice,i,p_uv[i][indice].u,p_uv[i][indice].v); glMultiTexCoord2fvARB(gl_ext::ext_multitexture_text_index[i],(float *)(p_uv[i]+indice)); } } if(specular_num && p_specular[0]) { //pprintf("[%d] glSecondaryColor3fvEXT(%f,%f,%f)",indice,p_specular[0][indice].r,p_specular[0][indice].g,p_specular[0][indice].b); glSecondaryColor3fvEXT((float *)(p_specular[0]+indice)); } if(diffuse_num && p_diffuse[0]) { //pprintf("[%d] glColor4fv(%f,%f,%f,%f)",indice,p_diffuse[0][indice].r,p_diffuse[0][indice].g,p_diffuse[0][indice].b,p_diffuse[0][indice].a); glColor4fv((float *)(p_diffuse[0]+indice)); } if(normal_num && p_norm[0]) { //pprintf("[%d] glNormal3fv(%f,%f,%f)",indice,p_norm[0][indice].x,p_norm[0][indice].y,p_norm[0][indice].z); glNormal3fv((float *)(p_norm[0]+indice)); } if(p_pos[0]) { //pprintf("[%d] glVertex3fv(%f,%f,%f)",indice,p_pos[0][indice].x,p_pos[0][indice].y,p_pos[0][indice].z); glVertex3fv((float *)(p_pos[0]+indice)); } } // ******************************** // Mesh faces // ******************************** void mesh_face_list::draw_direct(void) { assert(p_vertex != NULL); glBegin(GL_TRIANGLES); int i; for(i = 0; i < facenum; i++) p_vertex->set(p_face[i]); glEnd(); } void mesh_face_list::draw_array(void) { } // ******************************** // Mesh geometry // ******************************** void mesh_geometry::box_update(bool force) { if((force || flag_get(GEOMETRY_BOX_DIRTY)) && vertexnum_get() && facenum_get()) { if(!p_box) { p_box = box_create(box_type); } lock(); p_box->set(position_get(), vertexnum_get(), faces_get(), facenum_get()); unlock(); flag_clear(GEOMETRY_BOX_DIRTY); box_change_set(); } } void mesh_geometry::normals_update(bool force) { if((force || flag_get(GEOMETRY_NORMALS_DIRTY)) && vertexnum_get() && facenum_get()) { lock(); normals_calc(position_get(),vertexnum_get(), faces_get(),facenum_get(), normal_get()); unlock(); flag_set(GEOMETRY_NORMALS_DIRTY); } } void mesh_geometry::draw_normals(void) { lock(); if(position_get()) { if(flag_get(GEOMETRY_NORMALS_DIRTY)) normals_update(); int i,vertexnum = vertexnum_get(); VECT *p_vert = position_get(); VECT *p_norm = normal_get(); if(p_norm == NULL) return; mesh_material::set_default(); glColor3f(0.0f,0.0f,1.0f); glBegin(GL_LINES); for(i = 0; i < vertexnum; i++) { glVertex3fv((float *)(p_vert+i)); VECT endpoint = p_norm[i]*10.0f; endpoint += p_vert[i]; glVertex3fv((float *)(&endpoint)); } glEnd(); } unlock(); } void mesh_geometry::face_invert(void) { int f; int facenum = facenum_get(); for(f = 0; f < facenum; f+=3) { int i1 = ((MESH_FACE_LIST *)p_face)->get(f); int i2 = ((MESH_FACE_LIST *)p_face)->get(f+1); ((MESH_FACE_LIST *)p_face)->set(f, i2); ((MESH_FACE_LIST *)p_face)->set(f+1,i1); } } VECT * mesh_geometry::center_get(VECT *p_center) { lock(); if(position_get()) { int i,vertexnum = vertexnum_get(); VECT *p_vert = position_get(); p_center->set(); for(i = 0; i < vertexnum; i++) { *p_center += p_vert[i]; } *p_center *= (1.0f/(float)(vertexnum)); } unlock(); return(p_center); } VECT * mesh_geometry::size_get(VECT *p_size) { lock(); if(position_get()) { AABB tmp(position_get(),vertexnum_get(),NULL,0); tmp.size_get(p_size); } unlock(); return(p_size); } void mesh_geometry::transformate(GLMATRIX *p_mt) { lock(LOCK_READ_WRITE); if(position_get()) { int i,vertexnum = vertexnum_get(); VECT *p_vert = position_get(); for(i = 0; i < vertexnum; i++) { p_mt->transformate(p_vert+i); } } unlock(); } // ******************************** // Whole game mesh // ******************************** void game_mesh::draw_world_set(void) { SCENE *p_scene = scene_get(); if(p_scene) { GPIPE *p_gpipe = p_scene->gpipe_get(); assert(p_gpipe); p_gpipe->world_set(world_global_get()); } } void game_mesh::draw_box(void) { BOX *p_box = object_box_get(); if(p_box) { mesh_material::set_default(); p_box->draw(NULL,RGBB(0,255,0)); } } void game_mesh::draw_pivot(void) { GRAPH3D *p_graph = scene_get()->graph_get(); VECT pivot; if(p_geom && p_graph) { p_geom->pivot_get(&pivot); p_graph->draw_cross(&pivot, 1.0f); } } void game_mesh::draw_selection(void) { mesh_material::set_selection(); p_geom->draw(); } void game_mesh::draw(void) { if(p_geom) { /* Set a world matrix */ draw_world_set(); /* Set material */ if(p_mat) { p_mat->set(); } else { mesh_material::set_default(); } /* Draw geometry */ p_geom->draw(); /* Draw normals if requested */ if(graph3d::config.draw_debug_normals) { p_geom->draw_normals(); } /* Draw selection if this object is selected */ if(graph3d::config.draw_selection) { if(mark_get(MARK_SELECTED)) { draw_selection(); } } } /* Draw pivot if requested */ if(graph3d::config.draw_pivots) { draw_pivot(); } /* Draw bouding boxes if requested */ else { if(graph3d::config.draw_bouding_boxes) { draw_box(); } } } void game_mesh::print(int ident) { pprintf("%*cMesh name '%s'",ident,' ',name); pprintf("%*cMesh parent name '%s'",ident,' ',render_hierarchy_parent_get() ? render_hierarchy_parent_get()->name_get() : "None"); pprintf("%*cMaterial name '%s'",ident,' ',p_mat ? p_mat->name_get() : "NULL"); GLMATRIX *p_world = world_get(); p_world->print("Global world matrix",ident); p_world = world_get(); p_world->print("Local world matrix",ident); /* pprintf("%*cMesh vertexes",ident,' '); MESH_GEOMETRY *p_geom = lock(LOCK_READ); if(p_geom) { int num = p_geom->vertexnum_get(); VECT *p_pos = p_geom->position_get(); int i; for(i = 0; i < num; i++, p_pos++) { pprintf("%*c[V:%d][%f,%f,%f]",ident,' ',i,p_pos->x,p_pos->y,p_pos->z); } } unlock(FALSE); */ } VECT * game_mesh::vertex_position_object_space_get(int *p_vertexnum) { MESH_GEOMETRY *p_geom = lock(LOCK_READ); int vertexnum = p_geom->vertexnum_get(); VECT * p_vect = NULL; if(vertexnum) { p_vect = (VECT *)mmalloc(sizeof(p_vect[0])*vertexnum); memcpy(p_vect, p_geom->position_get(), sizeof(p_vect[0])*vertexnum); } unlock(); *p_vertexnum = vertexnum; return(p_vect); } VECT * game_mesh::vertex_position_world_space_get(int *p_vertexnum) { VECT *p_vect = vertex_position_object_space_get(p_vertexnum); if(p_vect) { int vertexnum = *p_vertexnum; GLMATRIX *p_mat = world_global_get(); p_mat->transformate(p_vect,vertexnum); } return(p_vect); } VECT * game_mesh::vertex_position_camera_space_get(int *p_vertexnum) { VECT *p_vect = vertex_position_world_space_get(p_vertexnum); if(p_vect) { GPIPE *p_pipe = gpipe_get(); p_pipe->world_to_camera(p_vect,*p_vertexnum); } return(p_vect); } VECT2DI * game_mesh::vertex_position_screen_space_get(int *p_vertexnum) { VECT2DI *p_vect_2d = NULL; int vertexnum; VECT *p_vect = vertex_position_world_space_get(&vertexnum); if(p_vect) { p_vect_2d = (VECT2DI *)mmalloc(sizeof(p_vect_2d[0])*vertexnum); (gpipe_get())->world_to_screen(p_vect,vertexnum,p_vect_2d); *p_vertexnum = vertexnum; ffree(p_vect); } return(p_vect_2d); } tface * game_mesh::faces_get(int *p_facenum) { MESH_GEOMETRY *p_geom = lock(LOCK_READ); int facenum = p_geom->facenum_get(); tface * p_faces = NULL; if(facenum) { p_faces = (tface *)mmalloc(sizeof(p_faces[0])*facenum); memcpy(p_faces, p_geom->faces_get(), sizeof(p_faces[0])*facenum); } unlock(); *p_facenum = facenum; return(p_faces); } void game_mesh::mesh_remove(void) { SCENE *p_scene = scene_get(); assert(p_scene != NULL); p_scene->mesh_remove(this); } game_mesh::game_mesh(class scene *p_scene) : scene_object_geometry(p_scene) { p_geom = NULL; p_mat = NULL; object_type_set(SCENE_OBJECT_MESH); object_box_type_set(BOX_OBB); } game_mesh::game_mesh(class game_mesh &src) : scene_object_geometry(NULL) { assert(0); } game_mesh::~game_mesh(void) { geometry_delete(); } void game_mesh_list::print(void) { GAME_MESH *p_tmp = (GAME_MESH *)object_list_get_first(); while(p_tmp) { p_tmp->print(); p_tmp = (GAME_MESH *)(p_tmp->object_list_next()); } } berusky2-0.12/src/age/graph/animation_track_linear.cpp0000644000175000017500000001234613674426075017774 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* KEY_TYPE anim_track_linear::key_get_time(int time, int *p_kn, int *p_kn1, float *p_time) { int lasttime = (keynum-1)*LINEAR_FRAMES_DELAYI; if(time < lasttime) { t = (float)time/LINEAR_FRAMES_DELAYI; float frame = (float)floor((float)t); t -= frame; kn = (int)frame; t1 = 1.0f-t; } else { kn = keynum-1; t = t1 = 0.0f; } } */ KEY_TYPE anim_track_linear::key_get_time(int time, int *p_kn, int *p_kn1, float *p_time) { int keynum = keynum_get(); int start,stop,k1; int dop,intrv; int t1,t2; k1 = keynum-1; start = 0; stop = keynum*LINEAR_FRAMES_DELAYI; int endtime = length_get(); if(flag_get(FLAG_TRACK_LOOP) && time > 2*endtime) { time = endtime + time%endtime; } if(time < start) { if(flag_get(FLAG_TRACK_LOOP)) { *p_kn = k1; *p_kn1 = 0; dop = endtime-stop; intrv = dop+start; *p_time = (intrv > DELTA_INTERVAL) ? (float)(time+dop)/(float)intrv : 0.0f; return(KEYS_ALL); } else { *p_kn = 0; return(KEYS_ONE); } } else if(time >= stop) { if(flag_get(FLAG_TRACK_LOOP)) { *p_kn = k1; *p_kn1 = 0; intrv = (endtime-stop)+start; *p_time = (intrv > DELTA_INTERVAL) ? (float)(time-stop)/(float)intrv : 0.0f; return(KEYS_ALL); } else { *p_kn = k1; return(KEYS_ONE); } } else { if(keynum == 2) { *p_kn = 0; *p_kn1 = 1; t1 = key_get(0)->time; t2 = key_get(1)->time; } else { *p_kn = key_get_internal(time); *p_kn1 = (*p_kn)+1; t1 = key_get(*p_kn)->time; t2 = key_get(*p_kn1)->time; } *p_time = (float)(time-t1)/(float)(t2-t1); return(KEYS_ALL); } } VECT * anim_track_lin_vect::interpolate(VECT *p_result, int time) { VECT *p_p0,*p_p1; float t,t2; int kn,kn1; int ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { t2 = 1.0f-t; p_p0 = p_track[kn].value_get(); p_p1 = p_track[kn1].value_get(); p_result->x = p_p0->x*t2 + p_p1->x*t; p_result->y = p_p0->y*t2 + p_p1->y*t; p_result->z = p_p0->z*t2 + p_p1->z*t; } else { *p_result = p_track[kn].value; } } else { if(keynum) { *p_result = p_track->value; } } return(p_result); } QUAT * anim_track_lin_quat::interpolate(QUAT *p_result, int time) { int kn,kn1; float t; int ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { assert(0.0f <= t && t <= 1.0f); return(slerp(p_track[kn].value_get(),p_track[kn1].value_get(),t,p_result)); } else { *p_result = p_track[kn].value; return(p_result); } } else { if(keynum) { *p_result = p_track->value; return(p_result); } else return(NULL); } } float anim_track_lin_float::interpolate(float *p_result, int time) { float t,t2; int kn,kn1,ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { t2 = 1.0f-t; return(*p_result = p_track[kn].value*t2+p_track[kn1].value*t); } else { return(*p_result = p_track[kn].value); } } else { if(keynum) { return(*p_result = p_track->value); } else return(FLT_MAX); } } WVECT * anim_track_lin_wvect::interpolate(WVECT *p_result, int time) { WVECT *p_p0,*p_p1; float t,t2; int kn,kn1; int ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { t2 = 1.0f-t; p_p0 = p_track[kn].value_get(); p_p1 = p_track[kn1].value_get(); p_result->x = p_p0->x*t2 + p_p1->x*t; p_result->y = p_p0->y*t2 + p_p1->y*t; p_result->z = p_p0->z*t2 + p_p1->z*t; p_result->w = p_p0->w*t2 + p_p1->w*t; } else { *p_result = p_track[kn].value; } } else { if(keynum) { *p_result = p_track->value; } } return(p_result); } berusky2-0.12/src/age/graph/gpipe.cpp0000644000175000017500000000262213674426075014377 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Constants and types #include "age.h" // Global geometry pipeline GPIPE *p_gpipe = NULL; berusky2-0.12/src/age/graph/glwrapper.h0000644000175000017500000005136413674426075014752 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* A wrapper for some OpenGL functions */ #ifndef __GLWRAPPER_H__ #define __GLWRAPPER_H__ // **************************************************************************** // Global gl state flag // **************************************************************************** extern bool gl_active; // **************************************************************************** // Culling settings // **************************************************************************** typedef class gl_cull_mod { public: static int cull_state; // cull mode static int cull_side; // which side public: static void on(bool force = FALSE) { if(!cull_state || force) { glEnable(GL_CULL_FACE); cull_state = TRUE; } } static void off(bool force = FALSE) { if(cull_state || force) { glDisable(GL_CULL_FACE); cull_state = FALSE; } } static void set(int state, bool force = FALSE) { if(state) { on(); } else { off(); } } static void set_all(int mod, bool force = FALSE) { if(!mod) { off(force); } else if(mod == 1) { on(force); back(force); } else if(mod == 2) { on(force); front(force); } } static void back(bool force = FALSE) { if(cull_side != 1 || force) { cull_side = 1; glFrontFace(GL_CCW); } } static void front(bool force = FALSE) { if(cull_side != 2 || force) { cull_side = 2; glFrontFace(GL_CW); } } static void change(bool force = FALSE) { if(cull_side) { if(cull_side == 1) { front(force); } else { back(force); } } } } GL_CULL_MOD_STATE; // **************************************************************************** // Specular color settings // **************************************************************************** typedef class gl_specular { static int specular_state; // spekularni svetla public: static void on(bool force = FALSE) { if(!specular_state || force) { specular_state = TRUE; glEnable(GL_COLOR_SUM_EXT); } } static void off(bool force = FALSE) { if(specular_state || force) { specular_state = FALSE; glDisable(GL_COLOR_SUM_EXT); } } static void set(float r, float g, float b) { glSecondaryColor3fEXT(r,g,b); } } GL_SPECULAR_STATE; // **************************************************************************** // Diffuse color settings // **************************************************************************** typedef class gl_diffuse { static int diffuse_state; public: static void off(bool force = FALSE) { diffuse_state = FALSE; } static void on(bool force = FALSE) { diffuse_state = TRUE; } public: static void set(float r, float g, float b, float a) { glColor4f(r,g,b,a); } static void set(byte r, byte g, byte b, byte a) { glColor4ub(r,g,b,a); } static void set(RGBB *p_color) { glColor3ub(p_color->r,p_color->g,p_color->b); } static void set(RGBAF *p_color) { glColor4f(p_color->r,p_color->g,p_color->b,p_color->a); } } GL_DIFFUSE_STATE; // **************************************************************************** // Fog settings // **************************************************************************** typedef class gl_fog { static int fog_state; static int fog_state_temporary; public: void disable(bool force = FALSE) { if(fog_state || force) { glDisable(GL_FOG); fog_state = FALSE; } } void enable(bool force = FALSE) { if(!fog_state || force) { glEnable(GL_FOG); fog_state = TRUE; } } /* void disable_temporary(bool force = FALSE) { if(fog_state && fog_state_temporary) { fog_state_temporary = FALSE; glDisable(GL_FOG); } } void enable_temporary(bool force = FALSE) { if(fog_state && !fog_state_temporary) { fog_state_temporary = TRUE; glEnable(GL_FOG); } } */ } GL_FOG_STATE; // **************************************************************************** // Light settings // **************************************************************************** typedef class gl_light { static int lighting_state; // gl svetla public: static void ambient(float *p_ambient) { glLightfv( GL_LIGHT0, GL_AMBIENT, p_ambient); } static void ambient(dword barva) { float amb[4] = {0,0,0,1}; rgb_float(barva,amb); glLightfv( GL_LIGHT0, GL_AMBIENT, amb); } static void set(int state, bool force = FALSE) { if(state) { if(!lighting_state || force) { lighting_state = TRUE; glEnable(GL_LIGHTING); } } else { if(lighting_state || force) { lighting_state = FALSE; glDisable(GL_LIGHTING); } } } static void on(bool force = FALSE) { set(TRUE,force); } static void off(bool force = FALSE) { set(FALSE,force); } static void smooth(void) { glShadeModel(GL_SMOOTH); } static void flat(void) { glShadeModel(GL_FLAT); } } GL_LIGHT_STATE; // **************************************************************************** // Nastaveni Z-bufferu // **************************************************************************** typedef class gl_z_buffer { static int depth_test_state; static int zmask_state; public: static void on(bool force = FALSE); static void off(bool force = FALSE); static void test(int state, bool force = FALSE) { if(state) { on(force); } else { off(force); } } static void mask_on(bool force = FALSE) { if(!zmask_state || force) { zmask_state = TRUE; glDepthMask(TRUE); } } static void mask_off(bool force = FALSE) { if(zmask_state || force) { zmask_state = FALSE; glDepthMask(FALSE); } } static void mask_set(int state, bool force = FALSE) { if(state) { mask_on(force); } else { mask_off(force); } } static void mask_set_spots(int state) { glDepthMask((GLboolean)state); } } GL_Z_BUFFER_STATE; /* *************************************************************************** Assigned textures in OpenGL texture units *************************************************************************** */ typedef class gl_texture { public: static int multitext_units; // Max textures static int text_akt; // cislo aktivni textury static int textures_2d[MAX_GL_TEXT_UNITS]; // textury on/off static int textures_1d[MAX_GL_TEXT_UNITS]; // textury on/off static GLint last_text_2d[MAX_GL_TEXT_UNITS]; // posledni textura static GLint last_text_1d[MAX_GL_TEXT_UNITS]; // posledni textura static GLenum arb_translation_table[MAX_GL_TEXT_UNITS];// = {GL_TEXTURE0_ARB,GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB, GL_TEXTURE4_ARB, GL_TEXTURE5_ARB}; public: // Reset nastaveni static void reset(void) { for(int i = 0; i < MAX_GL_TEXT_UNITS; i++) { textures_1d[i] = FALSE; textures_2d[i] = FALSE; last_text_1d[i] = FALSE; last_text_2d[i] = FALSE; } for(int i = 1; i < MAX_GL_TEXT_UNITS; i++) { glActiveTextureARB(arb_translation_table[i]); glDisable(GL_TEXTURE_1D); glDisable(GL_TEXTURE_2D); } glActiveTextureARB(arb_translation_table[0]); glDisable(GL_TEXTURE_1D); glDisable(GL_TEXTURE_2D); text_akt = ERROR; } // Nastavi texturu static void set(GLint text, GLenum typ) { if(typ == GL_TEXTURE_2D) { if(textures_2d[text_akt] && last_text_2d[text_akt] != text) { last_text_2d[text_akt] = text; glBindTexture(GL_TEXTURE_2D, text); } } else { if(textures_1d[text_akt] && last_text_1d[text_akt] != text) { last_text_1d[text_akt] = text; glBindTexture(GL_TEXTURE_1D, text); } } } // Zapne texturing static void on(GLenum typ) { if(typ == GL_TEXTURE_2D) { if(!textures_2d[text_akt]) { textures_2d[text_akt] = TRUE; glEnable(GL_TEXTURE_2D); } if(textures_1d[text_akt]) { textures_1d[text_akt] = FALSE; glDisable(GL_TEXTURE_1D); } } else { if(!textures_1d[text_akt]) { textures_1d[text_akt] = TRUE; glEnable(GL_TEXTURE_1D); } if(textures_2d[text_akt]) { textures_2d[text_akt] = FALSE; glDisable(GL_TEXTURE_2D); } } } // Turn off textures static void off(GLenum typ) { if(typ == GL_TEXTURE_2D) { if(textures_2d[text_akt]) { textures_2d[text_akt] = FALSE; glDisable(GL_TEXTURE_2D); } } else { if(textures_1d[text_akt]) { textures_1d[text_akt] = FALSE; glDisable(GL_TEXTURE_1D); } } } // Turn off textures static void off(void) { if(textures_2d[text_akt]) { textures_2d[text_akt] = FALSE; glDisable(GL_TEXTURE_2D); } if(textures_1d[text_akt]) { textures_1d[text_akt] = FALSE; glDisable(GL_TEXTURE_1D); } } // Nastavi aktivni texturu static int set_num(int text_unit) { if(text_unit < multitext_units) { if(text_akt != text_unit) { text_akt = text_unit; glActiveTextureARB(arb_translation_table[text_unit]); } return(TRUE); } else { return(FALSE); } } // Nastavi aktivni texturu a vypne ji static int set_num_off(int text_unit) { if(text_unit < multitext_units) { if(textures_1d[text_unit] || textures_2d[text_unit]) { if(text_akt != text_unit) { text_akt = text_unit; glActiveTextureARB(arb_translation_table[text_unit]); } if(textures_1d[text_unit]) { textures_1d[text_unit] = FALSE; glDisable(GL_TEXTURE_1D); } if(textures_2d[text_unit]) { textures_2d[text_unit] = FALSE; glDisable(GL_TEXTURE_2D); } } return(TRUE); } else { return(FALSE); } } // Nastavi ostrost textur static void sharp(float sharp) { if(gl_ext::extlist_text_sharp) { sharp = -sharp; int i; for(i = 0; i < multitext_units; i++) { set_num(i); glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,GL_TEXTURE_LOD_BIAS_EXT,sharp); } } } static int multitext_units_get(void) { return(multitext_units); } static void multitext_units_set(int text_units) { multitext_units = text_units; } public: static void init(int text_units) { multitext_units_set(text_units); } } GL_TEXTURE_STATE; /* *************************************************************************** Texure-coordinates generator setup *************************************************************************** */ #define TEXGEN_NIC 0 #define TEXGEN_SPHEREMAP 1 #define TEXGEN_EYE_LINEAR 2 typedef class gl_texture_coordinates { // Texture generator configuration /* public: static int texgen_s[MAX_GL_TEXT_UNITS]; static int texgen_t[MAX_GL_TEXT_UNITS]; static int texgen_r[MAX_GL_TEXT_UNITS]; static int texgen_q[MAX_GL_TEXT_UNITS]; public: static void generator_off(int unit) { if(texgen_s[unit]) { texgen_s[unit] = FALSE; glDisable(GL_TEXTURE_GEN_S); } if(texgen_t[unit]) { texgen_t[unit] = FALSE; glDisable(GL_TEXTURE_GEN_T); } if(texgen_r[unit]) { texgen_r[unit] = FALSE; glDisable(GL_TEXTURE_GEN_R); } if(texgen_q[unit]) { texgen_q[unit] = FALSE; glDisable(GL_TEXTURE_GEN_Q); } } static void generator_on_s(int unit, int mode_s, int mode_t, int mode_r, int mode_q) { if(texgen_s[unit] != TEXGEN_SPHEREMAP) { texgen_s[unit] = TEXGEN_SPHEREMAP; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_S); } if(texgen_t[unit] != TEXGEN_SPHEREMAP) { texgen_t[unit] = TEXGEN_SPHEREMAP; glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_T); } if(texgen_r[unit]) { texgen_r[unit] = FALSE; glDisable(GL_TEXTURE_GEN_R); } if(texgen_q[unit]) { texgen_q[unit] = FALSE; glDisable(GL_TEXTURE_GEN_Q); } } static void linear_eye_2d_on(int text_unit, float *p_spar, float *p_tpar) { GLMATRIX *p_mat = texgen+text_unit; if(!texgen_s[text_unit]) glEnable(GL_TEXTURE_GEN_S); if(!texgen_t[text_unit]) glEnable(GL_TEXTURE_GEN_T); if(texgen_s[text_unit] != TEXGEN_EYE_LINEAR) { texgen_s[text_unit] = TEXGEN_EYE_LINEAR; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); } if(texgen_t[text_unit] != TEXGEN_EYE_LINEAR) { texgen_t[text_unit] = TEXGEN_EYE_LINEAR; glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); } if(camera_change || p_spar[0] != p_mat->_11 || p_spar[1] != p_mat->_21 || p_spar[2] != p_mat->_31 || p_spar[3] != p_mat->_41 || p_tpar[0] != p_mat->_12 || p_tpar[1] != p_mat->_22 || p_tpar[2] != p_mat->_32 || p_tpar[3] != p_mat->_42) { p_mat->_11 = p_spar[0]; p_mat->_21 = p_spar[1]; p_mat->_31 = p_spar[2]; p_mat->_41 = p_spar[3]; p_mat->_12 = p_tpar[0]; p_mat->_22 = p_tpar[1]; p_mat->_32 = p_tpar[2]; p_mat->_42 = p_tpar[3]; glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *)get_camera()); glTexGenfv(GL_S,GL_EYE_PLANE,p_spar); glTexGenfv(GL_T,GL_EYE_PLANE,p_tpar); glLoadMatrixf((float *)get_final()); } if(texgen_r[text_unit]) { texgen_r[text_unit] = FALSE; glDisable(GL_TEXTURE_GEN_R); } if(texgen_q[text_unit]) { texgen_q[text_unit] = FALSE; glDisable(GL_TEXTURE_GEN_Q); } } */ // Texture coordinates transformation public: static GLMATRIX text_matrix[MAX_GL_TEXT_UNITS]; static bool text_matrix_state[MAX_GL_TEXT_UNITS]; public: static void matrix_on(int unit, GLMATRIX *p_text) { glMatrixMode(GL_TEXTURE); glLoadMatrixf((float *)p_text); text_matrix_state[unit] = TRUE; } static void matrix_off(int unit) { if(text_matrix_state[unit]) { glMatrixMode(GL_TEXTURE); glLoadIdentity(); text_matrix_state[unit] = FALSE; } } } GL_TEXTURE_COORDINATES_STATE; /* *************************************************************************** Texture operations in texture units *************************************************************************** */ #define TYP_TEXT_COLOR 0 #define TYP_TEXT_DOT3 1 #define TYP_TEXT_DUDV 2 #define MAX_TEXTURE_OPERATORS 10 #define TEXT_OPERATOR_MODULATION 0 #define TEXT_OPERATOR_MODULATION2X 1 #define TEXT_OPERATOR_ADD 2 #define TEXT_OPERATOR_DECAL 3 #define TEXT_OPERATOR_BLEND 4 #define TEXT_OPERATOR_REPLACE 5 #define TEXT_OPERATOR_DOT3_BUMP 6 typedef class gl_texture_operators { // Array of texture operators static void (*op_func[MAX_TEXTURE_OPERATORS])(void); static int op_last[MAX_GL_TEXT_UNITS]; // Texture operators static void op_modulation(void); static void op_modulation_comb(void); static void op_modulation_2x_comb(void); static void op_add(void); static void op_add_comb(void); static void op_decal(void); static void op_blend(void); static void op_replace(void); static void op_dot3_bump(void); public: static void set(int text_unit, int oper) { assert(oper >= 0 && oper < MAX_TEXTURE_OPERATORS); if(oper != op_last[text_unit]) { op_last[text_unit] = oper; op_func[oper](); } } static void off(int text_unit) { int i = text_unit; if(i != ERROR) { for(; i < MAX_GL_TEXT_UNITS; i++) { if(!gl_texture::set_num_off(i)) return; } } } /* static void op_set_num_poly(int text_unit) { gl_texture::set_num(text_unit); gl_texture::on(GL_TEXTURE_2D); op_modulation(); // ret_matrix_texture(text_unit); // __UPR__ //text_poly_indicie = text_unit; } static void op_set_nic_poly(int last_text, int poly_text) { int i = last_text; if(i != ERROR) { for(; i < MAX_GL_TEXT_UNITS; i++) { if(!gl_texture::set_num_off(i)) { break; } } } op_set_num_poly(poly_text); } */ static void reset(void) { for(int i = 0; i < MAX_GL_TEXT_UNITS; i++) { op_last[i] = ERROR; } } static void init(void) { reset(); } public: gl_texture_operators(void) { reset(); } } GL_TEXTURE_OPERATORS_STATE; /********************************************************************** Fog cubes ********************************************************************* */ /* typedef class fog_cube : public llist_item { char name[MAX_NAME]; // jmeno mlzne kostky BOD min,max; // rozmery kostky int flag; // flagy mlhy int mod; // mod mlhy (linear/exp/exp2) int priorita; // priorita mlzne kostky float start; // zacatek float stop; // konec float intenzita; // intenzita RGfloat r,g,b,a; // barva void *p_kont; // pointer na kontejner ke kteremu je privazana int poly; // zazba na poly public: fog_cube(void) { poly = K_CHYBA; a = 1.0f; mod = GL_LINEAR; max.x = 10.0f; max.y = 10.0f; max.z = 10.0f; } mlzna_kostka(char *p_jmeno) { fog_cube(); strcpy(jmeno,p_jmeno); } fog_cube(class fog_cube &src) { *this = src; p_kont = NULL; } ~fog_cube(void) { } // - Navazovani udelat staticky // - alokaci/free udelat virtualne static void set(class mlzna_kostka *p_mlha) { if(p_mlha) { glFogi(GL_FOG_MODE, p_mlha->mod); glFogfv(GL_FOG_COLOR, &p_mlha->r); glFogf(GL_FOG_DENSITY, p_mlha->intenzita); glFogf(GL_FOG_START, p_mlha->start); glFogf(GL_FOG_END, p_mlha->stop); } } void set(void) { glFogi(GL_FOG_MODE, mod); glFogfv(GL_FOG_COLOR, &r); glFogf(GL_FOG_DENSITY, intenzita); glFogf(GL_FOG_START, start); glFogf(GL_FOG_END, stop); } } FOG_CUBE; */ /********************************************************************** List of fog cubes ********************************************************************* */ /* typedef struct mlho_kostka_list : public llist_head { MLZNA_KOSTKA *p_first; public: MLZNA_KOSTKA * zrus_mlhokostku_all(MLZNA_KOSTKA *p_first) { MLZNA_KOSTKA *p_tmp; while(p_first) { p_tmp = p_first->p_next; free(p_first); p_first = p_tmp; } return(NULL); } } MLHO_KOSTKA_LIST; */ /* void zrus_mlhokostku(MLZNA_KOSTKA **p_first, MLZNA_KOSTKA *p_maz) { MLZNA_KOSTKA *p_tmp,*p_prev; if(!p_first) { p_maz->p_kont = NULL; } else { if((*p_first) == p_maz) { (*p_first) = p_maz->p_next; } else { p_tmp = (*p_first)->p_next; p_prev = (*p_first); while(p_tmp) { if(p_tmp == p_maz) { p_prev->p_next = p_maz->p_next; break; } else { p_prev = p_tmp; p_tmp = p_tmp->p_next; } } } free(p_maz); } } */ #endif //__GLWRAPPER_H__ berusky2-0.12/src/age/graph/aabb.h0000644000175000017500000002437213674426075013633 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Axis aligned boundig boxes (AABB) */ #ifndef __AABB_H__ #define __AABB_H__ #include #define ADJUST_PREP_FLT(min, max) { (min) = FLT_MAX; (max) = FLT_MIN; } #define ADJUST_PREP_INT(min, max) { (min) = INT_MAX; (max) = INT_MIN; } #define ADJUST_MIN(min, a) { if((a) < (min)) (min) = (a); } #define ADJUST_MAX(max, a) { if((a) > (max)) (max) = (a); } #define ADJUST(min, max, a) { if((a) < (min)) (min) = (a); if((a) > (max)) (max) = (a); } #define INSIDE(base, a, lenght) (((base) <= (a)) && ((a) < (base+lenght))) #define INSIDE_RANGE(min, a, max) (((min) <= (a)) && ((a) < (max))) #ifndef RIF #define RIF(min,max) (((max)+(min))*0.5f) #endif #ifndef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef MAXA #define MAXA(a,b) (abs(a) > abs(b) ? (a) : (b)) #endif #ifndef MAX3 #define MAX3(a,b,c) ((a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c))) #endif #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #ifndef MIN3 #define MIN3(a,b,c) ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c))) #endif #define MIN_MAX_SORT(min_out, max_out, min_in, max_in) \ { \ min_out = MIN(min_in, max_in); \ max_out = MAX(min_in, max_in); \ } \ #define AABB_BORDER_VERTEXNUM 8 typedef class aabb : public box { public: VECT min; VECT max; public: virtual aabb * copy(void) { return(new aabb); } public: virtual void set(void) { min.max(); max.min(); } virtual void set(VECT *p_min, VECT *p_max) { min = *p_min; max = *p_max; } virtual void set(float x, float y, float z, float dx, float dy, float dz) { min.set(x-dx,y-dy,z-dz); max.set(x+dx,y+dy,z+dz); } virtual void set_len(VECT *p_center, VECT *p_len) { min = *p_center - *p_len; max = *p_center + *p_len; } virtual void set_len(VECT *p_len) { min.set(-p_len->x,-p_len->y,-p_len->z); max.set( p_len->x, p_len->y, p_len->z); } virtual void set(VECT *p_list, int num, tface *p_face, int facenum) { int i; set(p_list,p_list); for(i = 1; i < num; i++) { adjust(p_list+i); } } virtual void set(GLMATRIX *p_mat, VECT *p_list, int num, tface *p_face, int facenum) { int i; VECT t; matrix_transformate(p_list,p_mat,&t); set(&t,&t); for(i = 1; i < num; i++) { adjust(matrix_transformate(p_list+i,p_mat,&t)); } } virtual void set(class box *p_src); void set(aabb *p_list, int num) { int i; *this = p_list[0]; if(num == 1) { return; } for(i = 1; i < num; i++) { adjust(p_list+i); } } public: void adjust_min(VECT *p_vec) { if(p_vec->x < min.x) min.x = p_vec->x; if(p_vec->y < min.y) min.y = p_vec->y; if(p_vec->z < min.z) min.z = p_vec->z; } void adjust_max(VECT *p_vec) { if(p_vec->x > max.x) max.x = p_vec->x; if(p_vec->y > max.y) max.y = p_vec->y; if(p_vec->z > max.z) max.z = p_vec->z; } virtual void adjust(VECT *p_vec) { if(p_vec->x < min.x) min.x = p_vec->x; if(p_vec->y < min.y) min.y = p_vec->y; if(p_vec->z < min.z) min.z = p_vec->z; if(p_vec->x > max.x) max.x = p_vec->x; if(p_vec->y > max.y) max.y = p_vec->y; if(p_vec->z > max.z) max.z = p_vec->z; } void adjust(VECT vec) { if(vec.x < min.x) min.x = vec.x; if(vec.y < min.y) min.y = vec.y; if(vec.z < min.z) min.z = vec.z; if(vec.x > max.x) max.x = vec.x; if(vec.y > max.y) max.y = vec.y; if(vec.z > max.z) max.z = vec.z; } virtual void adjust(VECT *p_center, float radius) { if(p_center->x+radius < min.x) min.x = p_center->x+radius; if(p_center->y+radius < min.y) min.y = p_center->y+radius; if(p_center->z+radius < min.z) min.z = p_center->z+radius; if(p_center->x-radius > max.x) max.x = p_center->x-radius; if(p_center->y-radius > max.y) max.y = p_center->y-radius; if(p_center->z-radius > max.z) max.z = p_center->z-radius; } void adjust(class aabb *p_aabb) { adjust(&p_aabb->min); adjust(&p_aabb->max); } public: virtual VECT * center_get(VECT *p_vec) { p_vec->x = RIF(min.x, max.x); p_vec->y = RIF(min.y, max.y); p_vec->z = RIF(min.z, max.z); return(p_vec); } virtual VECT * center_get(GLMATRIX *p_mat, VECT *p_vec) { p_vec->x = RIF(min.x, max.x); p_vec->y = RIF(min.y, max.y); p_vec->z = RIF(min.z, max.z); return(matrix_transformate(p_vec,p_mat)); } virtual VECT * length_get(VECT *p_len) { p_len->x = (max.x-min.x)*0.5f; p_len->y = (max.y-min.y)*0.5f; p_len->z = (max.z-min.z)*0.5f; return(p_len); } virtual VECT * size_get(VECT *p_size) { p_size->x = (max.x-min.x); p_size->y = (max.y-min.y); p_size->z = (max.z-min.z); return(p_size); } public: virtual bool visible(GLMATRIX *p_m); virtual bool visible_full(GLMATRIX *p_m); public: virtual bool inside(VECT *p_vec) { return(min.x <= p_vec->x && p_vec->x <= max.x && min.y <= p_vec->y && p_vec->y <= max.y && min.z <= p_vec->z && p_vec->z <= max.z); } virtual bool inside(GLMATRIX *p_m, VECT *p_vec) { aabb tmp = *this; tmp.transformate(p_m); return(inside(p_vec)); } public: virtual int intersect_vector(VECT *p_a, VECT *p_b, VECT *p_intersect = NULL, float *p_t = NULL); virtual int intersect_vector(GLMATRIX *p_m, VECT *p_a, VECT *p_b, VECT *p_intersect = NULL, float *p_t = NULL) { aabb tmp = *this; tmp.transformate(p_m); return(tmp.intersect_vector(p_a,p_b,p_intersect,p_t)); } virtual int intersect(VECT *p_orig, VECT *p_dir, VECT *p_intersect = NULL, float *p_t = NULL) { VECT p; p = *p_orig + *p_dir; return(intersect_vector(p_orig,&p,p_intersect,p_t)); } virtual int intersect(GLMATRIX *p_m, VECT *p_orig, VECT *p_dir, VECT *p_intersect = NULL, float *p_t = NULL) { aabb tmp = *this; tmp.transformate(p_m); return(tmp.intersect(p_orig,p_dir,p_intersect,p_t)); } public: virtual bool intersect(BOX *p_box); virtual float intersect_plane(VECT *p_a, PLANE_TYPE type); virtual void intersect_point(VECT *p_vec); public: bool intersect(aabb *p_box); public: virtual float dist(VECT *p_vec) { if(inside(p_vec)) return(0.0f); /* VECT v1,v2; vect_sub(p_vert,¢er,&v1); v2 = v1; v2.norm_mult(&len); if(fabsf(v1.x) <= fabsf(v2.x) && fabsf(v1.y) <= fabsf(v2.y) && fabsf(v1.z) <= fabsf(v2.z)) { return(0.0f); } else { return(vect_size(v1.sub(&v2))); } */ return(0.0f); } public: virtual void draw(GLMATRIX *p_m, RGBB color); public: virtual int border_vertexnum_get(void) { return(AABB_BORDER_VERTEXNUM); } virtual VECT * border_get(VECT *p_border); public: void correction(void) { if(min.x > max.x) { float tmp = min.x; min.x = max.x; max.x = tmp; } if(min.y > max.y) { float tmp = min.y; min.y = max.y; max.y = tmp; } if(min.z > max.z) { float tmp = min.z; min.z = max.z; max.z = tmp; } } public: virtual BOX * transformate(GLMATRIX *p_m) { matrix_transformate(&min,p_m); matrix_transformate(&max,p_m); correction(); return(this); } public: virtual float volume_get(void) { float a = max.x-min.x; float b = max.y-min.y; float c = max.z-min.z; return(a*a+b*b+c*c); } public: virtual AABB * to_aabb(AABB *p_dest); virtual OBB * to_obb(OBB *p_dest); public: aabb(void) { set(); type = BOX_AABB; } aabb(VECT *p_min, VECT *p_max) { set(p_min, p_max); type = BOX_AABB; } aabb(VECT *p_len) { set_len(p_len); type = BOX_AABB; } aabb(float x, float y, float z, float dx, float dy, float dz) { set(x, y, z, dx, dy, dz); type = BOX_AABB; } aabb(class aabb *p_src) { *this = *p_src; type = BOX_AABB; } aabb(class aabb *p_src, int num) { type = BOX_AABB; int i; for(i = 0; i < num; i++) adjust(p_src+i); } aabb(VECT *p_list, int num, tface *p_face, int facenum) { set(p_list, num, p_face, facenum); type = BOX_AABB; } aabb(GLMATRIX *p_mat, VECT *p_list, int num, tface *p_face, int facenum) { set(p_mat, p_list, num, p_face, facenum); type = BOX_AABB; } aabb(class box *p_src); } AABB; inline VECT * center_get(VECT *p_min, VECT *p_max, VECT *p_center) { p_center->x = RIF(p_min->x, p_max->x); p_center->y = RIF(p_min->y, p_max->y); p_center->z = RIF(p_min->z, p_max->z); return(p_center); } inline VECT * length_get(VECT *p_min, VECT *p_max, VECT *p_len) { p_len->x = (p_max->x-p_min->x)*0.5f; p_len->y = (p_max->y-p_min->y)*0.5f; p_len->z = (p_max->z-p_min->z)*0.5f; return(p_len); } #endif // __AABB_H__ berusky2-0.12/src/age/graph/scene_load.cpp0000644000175000017500000021754613674426075015404 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" // ************************************************************************ // Materials // *********************************************************************** // ********************************************************************** // Ulozeni environmentu /* int lo_chunk_save_environment(FHANDLE f, LEVEL_ENVIRONMENT *p_env) { DATA_CHUNK ch; ch.typ = CHUNK_ENVIRONMENT; ch.velikost = sizeof(ch)+sizeof(p_env[0]); file_write(f,&ch,sizeof(ch),1,f); file_write(f,p_env,sizeof(p_env[0]),1,f); return(TRUE); } */ // ********************************************************************** // Ulozeni omezeni a nastaveni kamer /* int lo_chunk_save_kamset(FHANDLE f, NASTAVENI_KAMER *p_kam) { DATA_CHUNK ch; ch.typ = CHUNK_KAMSET; ch.velikost = sizeof(ch)+ sizeof(p_kam->far_plane)+ sizeof(p_kam->fov)+ sizeof(p_kam->max_uhel)+ sizeof(p_kam->min_uhel)+ sizeof(p_kam->min_vzdal)+ sizeof(p_kam->max_vzdal); file_write(&ch,sizeof(ch),1,f); file_write(&p_kam->far_plane,sizeof(p_kam->far_plane),1,f); file_write(&p_kam->fov,sizeof(p_kam->fov),1,f); file_write(&p_kam->max_uhel,sizeof(p_kam->max_uhel),1,f); file_write(&p_kam->min_uhel,sizeof(p_kam->min_uhel),1,f); file_write(&p_kam->min_vzdal,sizeof(p_kam->min_vzdal),1,f); file_write(&p_kam->max_vzdal,sizeof(p_kam->max_vzdal),1,f); return(TRUE); } int lo_chunk_save_kamset_2(FHANDLE f, NASTAVENI_KAMER *p_kam) { DATA_CHUNK ch; ch.typ = CHUNK_KAMSET_2; ch.velikost = sizeof(ch)+ sizeof(p_kam->max)+ sizeof(p_kam->min); file_write(&ch,sizeof(ch),1,f); file_write(&p_kam->max,sizeof(p_kam->max),1,f); file_write(&p_kam->min,sizeof(p_kam->min),1,f); return(TRUE); } */ /* ********************************************************************** Ulozeni dynamickeho svetla int lo_chunk_save_dyn_light_anim(FHANDLE f, DYN_LIGHT_ANIM *p_an, int extra) { file_write(&p_an->pos_keys,sizeof(p_an->pos_keys),1,f); file_write(p_an->p_pkeys,sizeof(p_an->p_pkeys[0]),p_an->pos_keys,f); file_write(p_an->p_pos,sizeof(p_an->p_pos[0]),p_an->pos_keys,f); file_write(&p_an->trg_keys,sizeof(p_an->trg_keys),1,f); file_write(p_an->p_tkeys,sizeof(p_an->p_tkeys[0]),p_an->trg_keys,f); file_write(p_an->p_trg,sizeof(p_an->p_trg[0]),p_an->trg_keys,f); file_write(&p_an->dos_keys,sizeof(p_an->dos_keys),1,f); file_write(p_an->p_dskeys,sizeof(p_an->p_dskeys[0]),p_an->dos_keys,f); file_write(p_an->p_dosah,sizeof(p_an->p_dosah[0]),p_an->dos_keys,f); if(!extra) { file_write(&p_an->diff_keys,sizeof(p_an->diff_keys),1,f); file_write(p_an->p_dfkeys,sizeof(p_an->p_dfkeys[0]),p_an->diff_keys,f); file_write(p_an->p_diff,sizeof(p_an->p_diff[0]),p_an->diff_keys,f); } else { int i; p_an->p_diff = (BARVA_RGBA *)mmalloc(sizeof(p_an->p_diff[0])*p_an->alfa_keys); for(i = 0 ; i < p_an->alfa_keys; i++) { p_an->p_diff[i].r = p_an->p_diff[i].g = p_an->p_diff[i].b = p_an->p_diff[i].a = p_an->p_alfa[i]; } file_write(&p_an->alfa_keys,sizeof(p_an->alfa_keys),1,f); file_write(p_an->p_akeys,sizeof(p_an->p_akeys[0]),p_an->alfa_keys,f); file_write(p_an->p_diff,sizeof(p_an->p_diff[0]),p_an->alfa_keys,f); null_free(p_an->p_diff); } file_write(&p_an->spec_keys,sizeof(p_an->spec_keys),1,f); file_write(p_an->p_spkeys,sizeof(p_an->p_spkeys[0]),p_an->spec_keys,f); file_write(p_an->p_spec,sizeof(p_an->p_spec[0]),p_an->spec_keys,f); return(TRUE); } int lo_chunk_get_dyn_light_size(FHANDLE f, DYN_LIGHT_ANIM *p_an) { return(sizeof(p_an->pos_keys)+ sizeof(p_an->p_pkeys[0])*p_an->pos_keys+ sizeof(p_an->p_pos[0])*p_an->pos_keys+ sizeof(p_an->trg_keys)+ sizeof(p_an->p_tkeys[0])*p_an->trg_keys+ sizeof(p_an->p_trg[0])*p_an->trg_keys+ sizeof(p_an->dos_keys)+ sizeof(p_an->p_dskeys[0])*p_an->dos_keys+ sizeof(p_an->p_dosah[0])*p_an->dos_keys+ sizeof(p_an->diff_keys)+ sizeof(p_an->p_dfkeys[0])*p_an->diff_keys+ sizeof(p_an->p_diff[0])*p_an->diff_keys+ sizeof(p_an->spec_keys)+ sizeof(p_an->p_spkeys[0])*p_an->spec_keys+ sizeof(p_an->p_spec[0])*p_an->spec_keys); } int lo_chunk_save_dyn_light(FHANDLE f, DYN_LIGHT *p_light) { DATA_CHUNK ch; ch.typ = CHUNK_DYNAMIC_LIGHT; ch.velikost = sizeof(ch)+sizeof(p_light->akt)+sizeof(byte)+sizeof(p_light->np)+ sizeof(p_light->dir)+sizeof(p_light->look_max)+sizeof(p_light->dosah)+ sizeof(p_light->min)+sizeof(p_light->max)+sizeof(p_light->theta)+ sizeof(p_light->dr)+sizeof(p_light->dg)+sizeof(p_light->db)+ sizeof(p_light->an_flag)+sizeof(p_light->flag); if(p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } file_write(&ch,sizeof(ch),1,f); file_write(&p_light->akt,sizeof(p_light->akt),1,f); file_write(p_light->name,sizeof(byte),strlen(p_light->name)+1,f); file_write(&p_light->np,sizeof(p_light->np),1,f); file_write(&p_light->dir,sizeof(p_light->dir),1,f); file_write(&p_light->look_max,sizeof(p_light->look_max),1,f); file_write(&p_light->dosah,sizeof(p_light->dosah),1,f); file_write(&p_light->min,sizeof(p_light->min),1,f); file_write(&p_light->max,sizeof(p_light->max),1,f); file_write(&p_light->theta,sizeof(p_light->theta),1,f); file_write(&p_light->dr,sizeof(p_light->dr),1,f); file_write(&p_light->dg,sizeof(p_light->dg),1,f); file_write(&p_light->db,sizeof(p_light->db),1,f); file_write(&p_light->sr,sizeof(p_light->sr),1,f); file_write(&p_light->sg,sizeof(p_light->sg),1,f); file_write(&p_light->sb,sizeof(p_light->sb),1,f); file_write(&p_light->flag,sizeof(p_light->flag),1,f); file_write(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_write(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_write(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); if(p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an, FALSE); } return(TRUE); } // ulozi linearni seznam svetel int lo_chunk_save_dyn_light_mesh(FHANDLE f, DYN_LIGHT *p_light) { DATA_CHUNK ch; while(p_light) { ch.typ = CHUNK_DYNAMIC_LIGHT_MESH; ch.velikost = sizeof(ch)+sizeof(p_light->akt)+sizeof(byte)+sizeof(p_light->np)+ sizeof(p_light->dir)+sizeof(p_light->look_max)+sizeof(p_light->dosah)+ sizeof(p_light->min)+sizeof(p_light->max)+sizeof(p_light->theta)+ sizeof(p_light->dr)+sizeof(p_light->dg)+sizeof(p_light->db)+ sizeof(p_light->an_flag)+sizeof(p_light->flag); if(p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } file_write(&ch,sizeof(ch),1,f); file_write(&p_light->akt,sizeof(p_light->akt),1,f); file_write(p_light->name,sizeof(byte),strlen(p_light->name)+1,f); file_write(&p_light->np,sizeof(p_light->np),1,f); file_write(&p_light->dir,sizeof(p_light->dir),1,f); file_write(&p_light->look_max,sizeof(p_light->look_max),1,f); file_write(&p_light->dosah,sizeof(p_light->dosah),1,f); file_write(&p_light->min,sizeof(p_light->min),1,f); file_write(&p_light->max,sizeof(p_light->max),1,f); file_write(&p_light->theta,sizeof(p_light->theta),1,f); file_write(&p_light->dr,sizeof(p_light->dr),1,f); file_write(&p_light->dg,sizeof(p_light->dg),1,f); file_write(&p_light->db,sizeof(p_light->db),1,f); file_write(&p_light->sr,sizeof(p_light->sr),1,f); file_write(&p_light->sg,sizeof(p_light->sg),1,f); file_write(&p_light->sb,sizeof(p_light->sb),1,f); file_write(&p_light->flag,sizeof(p_light->flag),1,f); file_write(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_write(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_write(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); if(p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an,FALSE); } p_light = p_light->p_next; } return(TRUE); } */ /* *********************************************************** Ulozeni extra-svetel *********************************************************** int lo_chunk_save_extra_light(FHANDLE f, EXTRA_DYN_LIGHT *p_light) { DATA_CHUNK ch; ch.typ = CHUNK_EXTRA_LIGHT; ch.velikost = sizeof(ch)+sizeof(p_light->akt)+sizeof(byte)+ sizeof(p_light->flag)+sizeof(p_light->mflag)+ sizeof(p_light->ktrida)+sizeof(p_light->np)+ sizeof(p_light->dir)+sizeof(p_light->dosah)+ sizeof(p_light->theta)+sizeof(p_light->utlum)+ sizeof(p_light->gourand)+4*sizeof(p_light->da)+ sizeof(p_light->sr)+sizeof(p_light->sg)+sizeof(p_light->sb)+ sizeof(p_light->an_flag)+sizeof(p_light->an.endtime); if(p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } file_write(&ch,sizeof(ch),1,f); file_write(&p_light->akt,sizeof(p_light->akt),1,f); file_write(p_light->name,sizeof(byte),strlen(p_light->name)+1,f); file_write(&p_light->flag,sizeof(p_light->flag),1,f); file_write(&p_light->mflag,sizeof(p_light->mflag),1,f); file_write(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_write(&p_light->np,sizeof(p_light->np),1,f); file_write(&p_light->dir,sizeof(p_light->dir),1,f); file_write(&p_light->dosah,sizeof(p_light->dosah),1,f); file_write(&p_light->theta,sizeof(p_light->theta),1,f); file_write(&p_light->utlum,sizeof(p_light->utlum),1,f); file_write(&p_light->gourand,sizeof(p_light->gourand),1,f); file_write(&p_light->da,sizeof(p_light->da),4,f); // alfa se ulozi jako duplikovana file_write(&p_light->sr,sizeof(p_light->sr),1,f); file_write(&p_light->sg,sizeof(p_light->sg),1,f); file_write(&p_light->sb,sizeof(p_light->sb),1,f); file_write(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_write(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); if(p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an,TRUE); } return(TRUE); } int lo_chunk_save_extra_light_mesh(FHANDLE f, EXTRA_DYN_LIGHT *p_light) { DATA_CHUNK ch; while(p_light) { ch.typ = CHUNK_EXTRA_LIGHT_MESH; ch.velikost = sizeof(ch)+sizeof(p_light->akt)+sizeof(byte)+ sizeof(p_light->flag)+sizeof(p_light->mflag)+ sizeof(p_light->ktrida)+sizeof(p_light->np)+ sizeof(p_light->dir)+sizeof(p_light->dosah)+ sizeof(p_light->theta)+sizeof(p_light->utlum)+ sizeof(p_light->gourand)+4*sizeof(p_light->da)+ sizeof(p_light->sr)+sizeof(p_light->sg)+sizeof(p_light->sb)+ sizeof(p_light->an_flag)+sizeof(p_light->an.endtime); if(p_light->an.endtime) { ch.velikost += lo_chunk_get_dyn_light_size(f, &p_light->an); } file_write(&ch,sizeof(ch),1,f); file_write(&p_light->akt,sizeof(p_light->akt),1,f); file_write(p_light->name,sizeof(byte),strlen(p_light->name)+1,f); file_write(&p_light->flag,sizeof(p_light->flag),1,f); file_write(&p_light->mflag,sizeof(p_light->mflag),1,f); file_write(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_write(&p_light->np,sizeof(p_light->np),1,f); file_write(&p_light->dir,sizeof(p_light->dir),1,f); file_write(&p_light->dosah,sizeof(p_light->dosah),1,f); file_write(&p_light->theta,sizeof(p_light->theta),1,f); file_write(&p_light->utlum,sizeof(p_light->utlum),1,f); file_write(&p_light->gourand,sizeof(p_light->gourand),1,f); file_write(&p_light->da,sizeof(p_light->da),4,f); file_write(&p_light->sr,sizeof(p_light->sr),1,f); file_write(&p_light->sg,sizeof(p_light->sg),1,f); file_write(&p_light->sb,sizeof(p_light->sb),1,f); file_write(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_write(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); if(p_light->an.endtime) { lo_chunk_save_dyn_light_anim(f, &p_light->an,TRUE); } p_light = p_light->p_next; } return(TRUE); } ********************************************************************** Ulozeni mlho-kostek void lo_chunk_save_mlhokostku(FHANDLE f, MLZNA_KOSTKA *p_top, int kont) { DATA_CHUNK ch; int kid; while(p_top) { if(!kont && p_top->p_kont) { p_top = p_top->p_next; // uloz vsechny mlho-kostky bez kontejnerovych continue; } ch.typ = CHUNK_MLHOKOSTKA_2; ch.velikost = sizeof(ch)+ sizeof(byte)+ sizeof(BOD)+ sizeof(BOD)+ sizeof(p_top->flag)+ sizeof(p_top->mod)+ sizeof(p_top->priorita)+ sizeof(p_top->start)+ sizeof(p_top->stop)+ sizeof(p_top->intenzita)+ sizeof(float)*4+ sizeof(int)+sizeof(int); file_write(&ch,sizeof(ch),1,f); file_write(p_top->name,sizeof(byte),strlen(p_top->name)+1,f); file_write(&p_top->min,sizeof(BOD),1,f); file_write(&p_top->max,sizeof(BOD),1,f); file_write(&p_top->flag,sizeof(p_top->flag),1,f); file_write(&p_top->mod,sizeof(p_top->mod),1,f); file_write(&p_top->priorita,sizeof(p_top->priorita),1,f); file_write(&p_top->start,sizeof(p_top->start),1,f); file_write(&p_top->stop,sizeof(p_top->stop),1,f); file_write(&p_top->intenzita,sizeof(p_top->intenzita),1,f); file_write(&p_top->r,sizeof(float)*4,1,f); kid = p_top->p_kont ? 1 : K_CHYBA; file_write(&kid,sizeof(kid),1,f); file_write(&p_top->poly,sizeof(p_top->poly),1,f); if(kont) // pokud je kont - uloz 1 kostku kontejneru return; p_top = p_top->p_next; } } ********************************************************************** Ulozeni flare void lo_chunk_save_flare(FHANDLE f, LENS_FLARE *p_flare, EDIT_MATERIAL **p_mat, int light) { DATA_CHUNK ch; char pom[200]; int nic = K_CHYBA; if(!p_flare) return; strcpy(pom,p_mat[p_flare->material]->name); ch.typ = light ? CHUNK_FLARE_LIGHT_EXT : CHUNK_FLARE_EXT; ch.velikost = sizeof(ch)+ sizeof(BOD)+ sizeof(float)*4+ sizeof(float)*2+ sizeof(int)+ sizeof(int)+ sizeof(int)+ strlen(pom)+1; file_write(&ch,sizeof(ch),1,f); file_write(&p_flare->p,sizeof(BOD),1,f); // umisteni file_write(&p_flare->r,sizeof(float),4,f); // barva file_write(&p_flare->dx,sizeof(float),2,f); // rozmery file_write(&nic,sizeof(int),1,f); // navazani file_write(&p_flare->alfa,sizeof(int),1,f); file_write(&p_flare->zflag,sizeof(int),1,f); file_write(pom,sizeof(byte),strlen(pom)+1,f); } void lo_chunk_save_flare_mesh(FHANDLE f, LENS_FLARE *p_flare, EDIT_MATERIAL **p_mat) { DATA_CHUNK ch; char pom[200]; int nic = K_CHYBA; if(!p_flare) return; strcpy(pom,p_mat[p_flare->material]->name); ch.typ = CHUNK_FLARE_MESH_EXT; ch.velikost = sizeof(ch)+ sizeof(BOD)+ sizeof(float)*4+ sizeof(float)*2+ sizeof(int)+ sizeof(int)+ sizeof(int)+ strlen(pom)+1; file_write(&ch,sizeof(ch),1,f); file_write(&p_flare->p,sizeof(BOD),1,f); // umisteni file_write(&p_flare->r,sizeof(float),4,f); // barva file_write(&p_flare->dx,sizeof(float),2,f); // rozmery //file_write(&p_flare->svetlo,sizeof(int),1,f); // navazani file_write(&nic,sizeof(int),1,f); // navazani file_write(&p_flare->alfa,sizeof(int),1,f); file_write(&p_flare->zflag,sizeof(int),1,f); file_write(pom,sizeof(byte),strlen(pom)+1,f); } void lo_chunk_save_flare_slozeny(FHANDLE f, LENS_FLARE *p_flare, EDIT_MATERIAL **p_mat) { DATA_CHUNK ch; char pom[SLOZ_FLARE][200]; int s,d = 0; if(!p_flare || !p_flare->p_sloz) return; for(s = 0; s < SLOZ_FLARE; s++) { if(p_flare->p_sloz[s].vzdal > 0.0f) strcpy(pom[s],p_mat[p_flare->p_sloz[s].material]->name); else pom[s][0] = 0; d += strlen(pom[s])+1; } ch.typ = CHUNK_FLARE_SLOZENY; ch.velikost = sizeof(ch)+ sizeof(float)*SLOZ_FLARE+ sizeof(float)*4*SLOZ_FLARE+ sizeof(float)*2*SLOZ_FLARE+ d; file_write(&ch,sizeof(ch),1,f); for(s = 0; s < SLOZ_FLARE; s++) { file_write(&p_flare->p_sloz[s].vzdal,sizeof(float),1,f); file_write(&p_flare->p_sloz[s].r,sizeof(float),4,f); file_write(&p_flare->p_sloz[s].dx,sizeof(float),2,f); file_write(pom[s],sizeof(byte),strlen(pom[s])+1,f); } } */ /* ********************************************************************** Ulozeni ambientu void lo_chunk_save_ambient(FHANDLE f, dword ambient) { DATA_CHUNK ch; ch.typ = CHUNK_AMBIENT; ch.velikost = sizeof(ch)+sizeof(ambient); file_write(&ch,sizeof(ch),1,f); file_write(&ambient,sizeof(ambient),1,f); } ********************************************************************** Ulozeni ambientu void lo_chunk_save_lc_ext(FHANDLE f, LEVEL_KONFIG *p_lc) { DATA_CHUNK ch; ch.typ = CHUNK_LEVEL_KONFIG_EXT; ch.velikost = sizeof(ch)+ sizeof(p_lc->barva_pozadi)+ sizeof(p_lc->barva_pozadi_aktivni)+ sizeof(p_lc->zm.aktivni)+ sizeof(p_lc->zm.v_start)+ sizeof(p_lc->zm.v_stop)+ sizeof(p_lc->zm.h_start)+ sizeof(p_lc->zm.h_stop)+ sizeof(p_lc->zm.barva); file_write(&ch,sizeof(ch),1,f); file_write(&p_lc->barva_pozadi,sizeof(p_lc->barva_pozadi),1,f); file_write(&p_lc->barva_pozadi_aktivni,sizeof(p_lc->barva_pozadi_aktivni),1,f); file_write(&p_lc->zm.aktivni,sizeof(p_lc->zm.aktivni),1,f); file_write(&p_lc->zm.v_start,sizeof(p_lc->zm.v_start),1,f); file_write(&p_lc->zm.v_stop,sizeof(p_lc->zm.v_stop),1,f); file_write(&p_lc->zm.h_start,sizeof(p_lc->zm.h_start),1,f); file_write(&p_lc->zm.h_stop,sizeof(p_lc->zm.h_stop),1,f); file_write(&p_lc->zm.barva,sizeof(p_lc->zm.barva),1,f); } ********************************************************************** Ulozeni zrcadla void lo_chunk_preved_zrcadlo(EDIT_KONTEJNER **p_kont, int kontnum, ZDRCADLO_DESC *p_desc) { ZDRCADLO_DESC_POLY *p_tmp = p_desc->p_poly; while(p_tmp) { int k = p_tmp->zrcadlo_k; if(k != K_CHYBA && k < kontnum && p_kont[k]) { p_tmp->id_kont = p_kont[k]->kontejner_ID; } else { p_tmp->id_kont = K_CHYBA; } p_tmp = p_tmp->p_next; } } void lo_chunk_save_zrcadlo_sub(FHANDLE f, ZDRCADLO_DESC_POLY *p_desc) { DATA_CHUNK ch; ch.typ = CHUNK_ZRCADLO_3_POLOZKA; ch.velikost = sizeof(ch)+sizeof(p_desc[0]); file_write(&ch,sizeof(ch),1,f); file_write(p_desc,sizeof(p_desc[0]),1,f); } void lo_chunk_save_zrcadlo(FHANDLE f, ZDRCADLO_DESC *p_desc) { ZDRCADLO_DESC_POLY *p_poly; DATA_CHUNK ch; ch.typ = CHUNK_ZRCADLO_3; ch.velikost = sizeof(ch)+sizeof(ZDRCADLO_DESC); file_write(&ch,sizeof(ch),1,f); file_write(p_desc,sizeof(ZDRCADLO_DESC),1,f); p_poly = p_desc->p_poly; while(p_poly) { lo_chunk_save_zrcadlo_sub(f, p_poly); p_poly = p_poly->p_next; } } */ /* ********************************************************************** Ulozeni svetel int lo_chunk_save_static_light(FHANDLE f, STATIC_LIGHT *p_light, EDIT_MATERIAL **p_mat) { LENS_FLARE *p_flare; DATA_CHUNK ch; int j; ch.typ = CHUNK_STATIC_LIGHT; ch.velikost = sizeof(ch)+sizeof(p_light->akt)+strlen(p_light->name)+1+ sizeof(p_light->index)+sizeof(p_light->p)+sizeof(float)*3+ sizeof(float)*4+sizeof(p_light->uhel)+sizeof(p_light->utlum) +sizeof(p_light->flag)+sizeof(p_light->flag2); file_write(&ch,sizeof(ch),1,f); file_write(&p_light->akt,sizeof(p_light->akt),1,f); file_write(p_light->name,sizeof(byte),strlen(p_light->name)+1,f); file_write(&p_light->index,sizeof(p_light->index),1,f); file_write(&p_light->p,sizeof(p_light->p),1,f); file_write(&p_light->r,sizeof(float),1,f); file_write(&p_light->g,sizeof(float),1,f); file_write(&p_light->b,sizeof(float),1,f); file_write(&p_light->k1,sizeof(float),4,f); file_write(&p_light->uhel,sizeof(p_light->uhel),1,f); file_write(&p_light->utlum,sizeof(p_light->utlum),1,f); file_write(&p_light->flag,sizeof(p_light->flag),1,f); file_write(&p_light->flag2,sizeof(p_light->flag2),1,f); p_flare = (LENS_FLARE *)p_light->p_flare; if(p_flare && p_flare->akt) { lo_uloz_material_chunk(f, p_flare->p_mat); lo_chunk_save_flare(f,p_flare,p_mat,TRUE); if(p_flare->p_sloz) { for(j = 0; j < SLOZ_FLARE; j++) { if(p_flare->p_sloz[j].vzdal > 0.0f) lo_uloz_material_chunk(f, p_flare->p_sloz[j].p_mat); } lo_chunk_save_flare_slozeny(f,p_flare,p_mat); } } return(TRUE); } int lo_chunk_save_static_light_mesh(FHANDLE f, STATIC_LIGHT *p_light, EDIT_MATERIAL **p_mat) { LENS_FLARE *p_flare; DATA_CHUNK ch; int j; while(p_light) { // Ulozeni statickeho svetla ch.typ = CHUNK_STATIC_LIGHT_MESH; ch.velikost = sizeof(ch)+sizeof(p_light->akt)+strlen(p_light->name)+1+ sizeof(p_light->index)+sizeof(p_light->p)+sizeof(float)*3+ sizeof(float)*4+sizeof(p_light->uhel)+sizeof(p_light->utlum) +sizeof(p_light->flag)+sizeof(p_light->flag2); file_write(&ch,sizeof(ch),1,f); file_write(&p_light->akt,sizeof(p_light->akt),1,f); file_write(p_light->name,sizeof(byte),strlen(p_light->name)+1,f); file_write(&p_light->index,sizeof(p_light->index),1,f); file_write(&p_light->p,sizeof(p_light->p),1,f); file_write(&p_light->r,sizeof(float),1,f); file_write(&p_light->g,sizeof(float),1,f); file_write(&p_light->b,sizeof(float),1,f); file_write(&p_light->k1,sizeof(float),4,f); file_write(&p_light->uhel,sizeof(p_light->uhel),1,f); file_write(&p_light->utlum,sizeof(p_light->utlum),1,f); file_write(&p_light->flag,sizeof(p_light->flag),1,f); file_write(&p_light->flag2,sizeof(p_light->flag2),1,f); // Ulozeni flaru ke statickemu svetlu p_flare = (LENS_FLARE *)p_light->p_flare; if(p_flare && p_flare->akt) { lo_uloz_material_chunk(f, p_flare->p_mat); lo_chunk_save_flare_mesh(f,p_flare,p_mat); if(p_flare->p_sloz) { for(j = 0; j < SLOZ_FLARE; j++) { if(p_flare->p_sloz[j].vzdal > 0.0f) lo_uloz_material_chunk(f, p_flare->p_sloz[j].p_mat); } lo_chunk_save_flare_slozeny(f,p_flare,p_mat); } } // Dalsi svetlo p_light = p_light->p_next; } return(TRUE); } */ /* ********************************************************************* Ukladani animaci int lo_chunk_save_keyframe_root(FHANDLE f, HIERARCHY_ROOT *p_root) { DATA_CHUNK ch; if(p_root) { ch.typ = CHUNK_KEYFRAME_ROT2; ch.velikost = sizeof(ch)+sizeof(HIERARCHY_ROOT); file_write(&ch,sizeof(ch),1,f); file_write(p_root,sizeof(*p_root),1,f); return(TRUE); } else return(FALSE); } int lo_chunk_save_keyframe_node(FHANDLE f, HIERARCHY_TRACK_INFO *p_node) { char name[200]; char otec[200]; DATA_CHUNK ch; if(p_node) { strcpy(name,((EDIT_OBJEKT *)(p_node->p_obj))->name); strcpy(otec,p_node->p_otec ? ((EDIT_OBJEKT *)(p_node->p_otec->p_obj))->name : ROOT_NODE_JMENO); ch.typ = CHUNK_KEYFRAME_NODE; ch.velikost = sizeof(ch)+ sizeof(HIERARCHY_TRACK_INFO)+ strlen(name)+1+strlen(otec)+1; file_write(&ch,sizeof(ch),1,f); file_write(name,sizeof(byte),strlen(name)+1,f); file_write(otec,sizeof(byte),strlen(otec)+1,f); file_write(p_node,sizeof(*p_node),1,f); return(TRUE); } else return(FALSE); } int lo_chunk_save_keyframe_node_pos(FHANDLE f, HIERARCHY_TRACK_INFO *p_node) { DATA_CHUNK ch; if(p_node) { ch.typ = CHUNK_KEYFRAME_POS; ch.velikost = sizeof(ch)+ sizeof(p_node->p_pos[0])*p_node->pos_keys+ sizeof(p_node->p_pkeys[0])*p_node->pos_keys; file_write(&ch,sizeof(ch),1,f); file_write(p_node->p_pos,sizeof(p_node->p_pos[0]),p_node->pos_keys,f); file_write(p_node->p_pkeys,sizeof(p_node->p_pkeys[0]),p_node->pos_keys,f); return(TRUE); } else return(FALSE); } int lo_chunk_save_keyframe_node_rot(FHANDLE f, HIERARCHY_TRACK_INFO *p_node) { DATA_CHUNK ch; if(p_node) { ch.typ = CHUNK_KEYFRAME_ROT; ch.velikost = sizeof(ch)+ sizeof(p_node->p_at[0])*p_node->rot_keys+ sizeof(p_node->p_rkeys[0])*p_node->rot_keys; file_write(&ch,sizeof(ch),1,f); file_write(p_node->p_at,sizeof(p_node->p_at[0]),p_node->rot_keys,f); file_write(p_node->p_rkeys,sizeof(p_node->p_rkeys[0]),p_node->rot_keys,f); return(TRUE); } else return(FALSE); } int lo_chunk_save_keyframe_node_scale(FHANDLE f, HIERARCHY_TRACK_INFO *p_node) { DATA_CHUNK ch; if(p_node) { ch.typ = CHUNK_KEYFRAME_SCS; ch.velikost = sizeof(ch)+ sizeof(p_node->p_scale[0])*p_node->scs_keys+ sizeof(p_node->p_skeys[0])*p_node->scs_keys; file_write(&ch,sizeof(ch),1,f); file_write(p_node->p_scale,sizeof(p_node->p_scale[0]),p_node->scs_keys,f); file_write(p_node->p_skeys,sizeof(p_node->p_skeys[0]),p_node->scs_keys,f); return(TRUE); } else return(FALSE); } Ulozi root vcetne vsech decek int lo_chunk_save_keyframe_child(FHANDLE f, HIERARCHY_TRACK_INFO *p_node) { int i; lo_chunk_save_keyframe_node(f,p_node); lo_chunk_save_keyframe_node_pos(f,p_node); lo_chunk_save_keyframe_node_rot(f,p_node); lo_chunk_save_keyframe_node_scale(f,p_node); for(i = 0; i < p_node->childnum; i++) lo_chunk_save_keyframe_child(f,p_node->p_child[i]); return(TRUE); } int lo_chunk_save_keyframe(FHANDLE f, HIERARCHY_ROOT *p_root) { int i; lo_chunk_save_keyframe_root(f,p_root); for(i = 0; i < p_root->childnum; i++) { lo_chunk_save_keyframe_child(f, p_root->p_child[i]); } return(TRUE); } *********************************************************************** Ulozeni sim-animaci #define CHUNK_SIM_ROOT 2020 // hlavicka key-framove animace #define CHUNK_SIM_NODE 2021 // vetev animace - pro jeden objekt typedef struct _HIERARCHY_SIM { float delka; // delka casu animace (fps) byte stav; // 0 = stop, 1 = run int flag; // flagy animace (GL_LOOP,GL_REMOVE) dword time; // aktualni cas animace dword time_start; // aktualni start dword time_stop; // aktualni stop dword time_delka; // aktualni delka animace dword start; dword stop; int keynum; // pocet klicu byte name[MAX_JMENO]; // name animace int childnum; // pocet detskych traku SIMPLE_TRACK_INFO *p_child; } HIERARCHY_SIM; int lo_chunk_save_sim_root(FHANDLE f, HIERARCHY_SIM *p_sim) { DATA_CHUNK ch; if(p_sim) { ch.typ = CHUNK_SIM_ROOT; ch.velikost = sizeof(ch)+ sizeof(p_sim->flag)+ sizeof(p_sim->keynum)+ sizeof(p_sim->name[0])*MAX_JMENO+ sizeof(p_sim->childnum); file_write(&ch,sizeof(ch),1,f); file_write(&p_sim->flag,sizeof(p_sim->flag),1,f); file_write(&p_sim->keynum,sizeof(p_sim->keynum),1,f); file_write(&p_sim->name,sizeof(p_sim->name[0]),MAX_JMENO,f); file_write(&p_sim->childnum,sizeof(p_sim->childnum),1,f); return(TRUE); } else return(FALSE); } int lo_chunk_save_sim_node_ext_all_matrix(FHANDLE f, SIMPLE_TRACK_INFO *p_sim) { if(p_sim && p_sim->p_all_matrix) { file_write(p_sim->p_all_matrix,sizeof(p_sim->p_all_matrix[0]),1,f); return(TRUE); } else { return(FALSE); } } int lo_chunk_save_sim_node_ext(FHANDLE f, SIMPLE_TRACK_INFO *p_sim) { DATA_CHUNK ch; int klicu,i; if(p_sim) { ch.typ = p_sim->p_all_matrix ? CHUNK_SIM_NODE_EXT2 : CHUNK_SIM_NODE_EXT; ch.velikost = sizeof(ch)+ sizeof(p_sim->Objekt_ID)+ sizeof(p_sim->flag)+ sizeof(p_sim->keynum)+ sizeof(p_sim->pivot)+ sizeof(p_sim->pivot3ds)+ sizeof(p_sim->childnum)+ sizeof(klicu)*3+(p_sim->p_pos ? sizeof(p_sim->p_pos[0])*p_sim->keynum:0) +(p_sim->p_scale ? sizeof(p_sim->p_scale[0])*p_sim->keynum : 0) +(p_sim->p_at ? sizeof(p_sim->p_at[0])*p_sim->keynum : 0) +(p_sim->p_norm ? sizeof(p_sim->p_norm[0])*p_sim->keynum : 0) +(p_sim->p_all_matrix ? sizeof(p_sim->p_all_matrix[0]) : 0); file_write(&ch,sizeof(ch),1,f); file_write(&p_sim->Objekt_ID,sizeof(p_sim->Objekt_ID),1,f); file_write(&p_sim->flag,sizeof(p_sim->flag),1,f); file_write(&p_sim->keynum,sizeof(p_sim->keynum),1,f); file_write(&p_sim->pivot,sizeof(p_sim->pivot),1,f); file_write(&p_sim->pivot3ds,sizeof(p_sim->pivot3ds),1,f); file_write(&p_sim->childnum,sizeof(p_sim->childnum),1,f); klicu = p_sim->p_pos ? p_sim->keynum : 0; file_write(&klicu,sizeof(klicu),1,f); if(klicu) file_write(p_sim->p_pos,sizeof(p_sim->p_pos[0]),p_sim->keynum,f); klicu = p_sim->p_scale ? p_sim->keynum : 0; file_write(&klicu,sizeof(klicu),1,f); if(klicu) file_write(p_sim->p_scale,sizeof(p_sim->p_scale[0]),p_sim->keynum,f); klicu = p_sim->p_at ? p_sim->keynum : 0; file_write(&klicu,sizeof(klicu),1,f); if(klicu) file_write(p_sim->p_at,sizeof(p_sim->p_at[0]),p_sim->keynum,f); klicu = p_sim->p_norm ? p_sim->keynum : 0; file_write(&klicu,sizeof(klicu),1,f); if(klicu) file_write(p_sim->p_norm,sizeof(p_sim->p_norm[0]),p_sim->keynum,f); if(p_sim->p_all_matrix) lo_chunk_save_sim_node_ext_all_matrix(f, p_sim); for(i = 0; i < p_sim->childnum; i++) lo_chunk_save_sim_node_ext(f,p_sim->p_child+i); return(TRUE); } else return(FALSE); } Ulozi koren sim animace int lo_chunk_save_sim(FHANDLE f, HIERARCHY_SIM *p_sim) { int i; lo_chunk_save_sim_root(f,p_sim); for(i = 0; i < p_sim->childnum; i++) { lo_chunk_save_sim_node_ext(f, p_sim->p_child+i); } return(TRUE); } int lo_uloz_materialy_chunk_kont(FHANDLE f, EDIT_MATERIAL **p_mat, int max_mat, EDIT_KONTEJNER *p_kont, int kontrola) { int i,j; Uloz pouzite materialy for(i = 0; i < max_mat; i++) { if(p_mat[i]) { for(j = 0; j < p_kont->max_objektu; j++) { if(p_kont->p_obj[j] && p_kont->p_obj[j]->material == i) { if(!kontrola || !(p_mat[i]->flag&(MAT_POUZITY|MAT_SYSTEM))) lo_uloz_material_chunk(f, p_mat[i]); break; } } } } return(TRUE); } int lo_uloz_materialy_chunk_pouzite(FHANDLE f, EDIT_MATERIAL **p_mat, int max_mat) { int i; Uloz pouzite materialy for(i = 0; i < max_mat; i++) { if(p_mat[i] && p_mat[i]->flag&(MAT_POUZITY|MAT_SYSTEM)) { lo_uloz_material_chunk(f, p_mat[i]); } } return(TRUE); } // Ulozi vsechny veci do .prj int lo_uloz_projekt(EDIT_MATERIAL **p_mat, int max_mat, EDIT_KONTEJNER **p_kontlist, int kontnum, char *p_name, STATIC_LIGHT *p_light, int lightnum, ZDRCADLO_DESC *p_zrcadlo, LENS_FLARE *p_flarr, int flaremax, dword ambient, MLZNA_KOSTKA *p_mlha, DYN_LIGHT *p_ddlight, int ddlightnum, EXTRA_DYN_LIGHT *p_eelight, int eelightnum, LEVEL_ENVIRONMENT *p_env, NASTAVENI_KAMER *p_kam, LEVEL_KONFIG *p_lc, int level, int transf_static) { EDIT_KONTEJNER *p_kont; FHANDLE f; int i,j,kID; Preved scenu na jedinecna jmena //lo_kontlist_jedinecne_jmena(p_kontlist,kontnum); if((f = ffopen(p_name,"wb")) == NULL) { return(FALSE); } Ulozim ambientni svetlo sceny lo_chunk_save_ambient(f,ambient); Ulozeni konfigurace levelu - pokud je if(p_lc) { lo_chunk_save_lc_ext(f, p_lc); } Ulozeni pouzitych materialu lo_uloz_materialy_chunk_pouzite(f, p_mat, max_mat); Uloz kontejnery kID = K_CHYBA; for(j = 0; j < kontnum; j++) { if((p_kont = p_kontlist[j])) { if(level) kID++; lo_uloz_materialy_chunk_kont(f, p_mat, max_mat, p_kont,TRUE); lo_chunk_save_kontejner(f, p_kont, p_mat, max_mat, FALSE, K_CHYBA, kID, transf_static); p_kont = p_kont->p_next; while(p_kont) { lo_uloz_materialy_chunk_kont(f, p_mat, max_mat, p_kont,TRUE); lo_chunk_save_kontejner(f, p_kont, p_mat, max_mat, TRUE, K_CHYBA, kID, transf_static); p_kont = p_kont->p_next; } } } Staticka svetla sceny if(p_light) { for(i = 0; i < lightnum; i++) { if(p_light[i].akt && !(p_light[i].flag2&SL2_MESH)) lo_chunk_save_static_light(f,p_light+i,p_mat); } } Uloz dynamicka svetla sceny if(p_ddlight) { for(i = 0; i < ddlightnum; i++) if(p_ddlight[i].akt && !(p_ddlight[i].flag&SDL_MESH)) lo_chunk_save_dyn_light(f, p_ddlight+i); } Extra a efektova svetla sceny if(p_eelight) { for(i = 0; i < eelightnum; i++) if(p_eelight[i].akt && !(p_eelight[i].flag&EDL_MESH)) lo_chunk_save_extra_light(f, p_eelight+i); } Zrcadlo if(p_zrcadlo) { lo_chunk_preved_zrcadlo(p_kontlist, kontnum, p_zrcadlo); lo_chunk_save_zrcadlo(f,p_zrcadlo); } Flare efekty + jejich materialy (pouze ze sceny) for(i = 0; i < flaremax; i++) { if(p_flarr[i].akt && !p_flarr[i].p_svetlo) { lo_uloz_material_chunk(f, p_flarr[i].p_mat); lo_chunk_save_flare(f,p_flarr+i,p_mat,FALSE); if(p_flarr[i].p_sloz) { for(j = 0; j < SLOZ_FLARE; j++) { if(p_flarr[i].p_sloz[j].vzdal > 0.0f) lo_uloz_material_chunk(f, p_flarr[i].p_sloz[j].p_mat); } lo_chunk_save_flare_slozeny(f,p_flarr+i,p_mat); } } } Mlho-kostku lo_chunk_save_mlhokostku(f, p_mlha, FALSE); Ulozeni environmentu if(p_env) { lo_chunk_save_environment(f, p_env); } Ulozeni nastaveni kamer if(p_kam) { lo_chunk_save_kamset(f, p_kam); lo_chunk_save_kamset_2(f, p_kam); } ffclose(f); return(j); } *********************************************************************** Loading objektu/materialu pres chunk Globalni promenne pro loading Nabinduje se na p_cnf->p_mat static int matlistnum; // pocet nactenych materialu static EDIT_MATERIAL **p_matlist; // aktualni material static ANIM_MATERIAL *p_fanim; // aktualni frame animace static int textlistnum; // list textur static EDIT_TEXT *p_textlist; // list textur static EDIT_KONTEJNER **p_kontlist; // seznam kontejneru static int kontlistnum; // max pocet kontejneru static int kont_load; static EDIT_KONTEJNER *p_kont_old; // stary kontejner static EDIT_KONTEJNER *p_kont; // aktualni kontejner static EDIT_MATERIAL *p_mat; // aktualni material static EDIT_OBJEKT *p_obj; // aktualni objekt static SIMPLE_TRACK_INFO *p_sim_node; // aktivni loadovaci node static HIERARCHY_SIM *p_sim; // aktivni loadovaci root static STATIC_LIGHT *p_lightlist; static STATIC_LIGHT *p_lightakt; // aktualni staticke svetlo static int lightlistnum; static STATIC_LIGHT *p_light_mesh; static ZDRCADLO_DESC *p_zrcadlolist; static int *p_zrcadloload; static LENS_FLARE *p_flarelist; // seznam flaru static LENS_FLARE *p_flare; // posledni nahrany flare static int flarelistnum; static MLZNA_KOSTKA *p_top_mlha; static dword *p_ambient; static DYN_LIGHT *p_dlist; // seznam dynamickych svetel static int dlistnum; static EXTRA_DYN_LIGHT *p_elist; // seznam extra svetel static int elistnum; static LEVEL_ENVIRONMENT *p_lenv; static NASTAVENI_KAMER *p_kamset; static LEVEL_KONFIG *p_lc; static JOINT *p_joint; static JOINT_ANIMACE *p_joint_animace; ********************************************************************** Loading environmentu int lo_chunk_load_environment(FHANDLE f, DATA_CHUNK *p_ch) { if(p_ch->typ == CHUNK_ENVIRONMENT) { if(p_lenv) { file_read(p_lenv,sizeof(p_lenv[0]),1,f); } else { LEVEL_ENVIRONMENT env; file_read(&env,sizeof(env),1,f); } return(TRUE); } else return(FALSE); } ********************************************************************** Loading kamsetu int lo_chunk_load_kamset(FHANDLE f, DATA_CHUNK *p_ch) { if(p_kamset && p_ch->typ == CHUNK_KAMSET) { file_read(&p_kamset->far_plane,sizeof(p_kamset->far_plane),1,f); file_read(&p_kamset->fov,sizeof(p_kamset->fov),1,f); file_read(&p_kamset->max_uhel,sizeof(p_kamset->max_uhel),1,f); file_read(&p_kamset->min_uhel,sizeof(p_kamset->min_uhel),1,f); file_read(&p_kamset->min_vzdal,sizeof(p_kamset->min_vzdal),1,f); file_read(&p_kamset->max_vzdal,sizeof(p_kamset->max_vzdal),1,f); return(TRUE); } else return(FALSE); } int lo_chunk_load_kamset_2(FHANDLE f, DATA_CHUNK *p_ch) { if(p_kamset && p_ch->typ == CHUNK_KAMSET_2) { file_read(&p_kamset->max,sizeof(p_kamset->max),1,f); file_read(&p_kamset->min,sizeof(p_kamset->min),1,f); return(TRUE); } else return(FALSE); } ********************************************************************** Loading dynamickeho svetla int lo_chunk_load_dyn_light_anim(FHANDLE f, DYN_LIGHT_ANIM *p_an, int extra) { file_read(&p_an->pos_keys,sizeof(p_an->pos_keys),1,f); if(p_an->pos_keys) { p_an->p_pkeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_an->p_pkeys[0])*p_an->pos_keys); file_read(p_an->p_pkeys,sizeof(p_an->p_pkeys[0]),p_an->pos_keys,f); p_an->p_pos = (BOD *)mmalloc(sizeof(p_an->p_pos[0])*p_an->pos_keys); file_read(p_an->p_pos,sizeof(p_an->p_pos[0]),p_an->pos_keys,f); } else { p_an->p_pkeys = NULL; p_an->p_pos = NULL; } file_read(&p_an->trg_keys,sizeof(p_an->trg_keys),1,f); if(p_an->trg_keys) { p_an->p_tkeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_an->p_tkeys[0])*p_an->trg_keys); file_read(p_an->p_tkeys,sizeof(p_an->p_tkeys[0]),p_an->trg_keys,f); p_an->p_trg = (BOD *)mmalloc(sizeof(p_an->p_trg[0])*p_an->trg_keys); file_read(p_an->p_trg,sizeof(p_an->p_trg[0]),p_an->trg_keys,f); } else { p_an->p_tkeys = NULL; p_an->p_trg = NULL; } file_read(&p_an->dos_keys,sizeof(p_an->dos_keys),1,f); if(p_an->dos_keys) { p_an->p_dskeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_an->p_dskeys[0])*p_an->dos_keys); file_read(p_an->p_dskeys,sizeof(p_an->p_dskeys[0]),p_an->dos_keys,f); p_an->p_dosah = (BOD *)mmalloc(sizeof(p_an->p_dosah[0])*p_an->dos_keys); file_read(p_an->p_dosah,sizeof(p_an->p_dosah[0]),p_an->dos_keys,f); } else { p_an->p_dskeys = NULL; p_an->p_dosah = NULL; } if(extra) { file_read(&p_an->alfa_keys,sizeof(p_an->alfa_keys),1,f); p_an->diff_keys = 0; p_an->p_dfkeys = NULL; p_an->p_diff = NULL; if(p_an->alfa_keys) { int i; p_an->p_akeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_an->p_akeys[0])*p_an->alfa_keys); file_read(p_an->p_akeys,sizeof(p_an->p_akeys[0]),p_an->alfa_keys,f); p_an->p_diff = (BARVA_RGBA *)mmalloc(sizeof(p_an->p_diff[0])*p_an->alfa_keys); file_read(p_an->p_diff,sizeof(p_an->p_diff[0]),p_an->alfa_keys,f); p_an->p_alfa = (float *)mmalloc(sizeof(p_an->p_alfa[0])*p_an->alfa_keys); for(i = 0; i < p_an->alfa_keys; i++) { p_an->p_alfa[i] = p_an->p_diff[i].a; } null_free(p_an->p_diff); } else { p_an->p_akeys = NULL; p_an->p_alfa = NULL; } } else { file_read(&p_an->diff_keys,sizeof(p_an->diff_keys),1,f); p_an->alfa_keys = 0; p_an->p_akeys = NULL; p_an->p_alfa = NULL; if(p_an->diff_keys) { p_an->p_dfkeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_an->p_dfkeys[0])*p_an->diff_keys); file_read(p_an->p_dfkeys,sizeof(p_an->p_dfkeys[0]),p_an->diff_keys,f); p_an->p_diff = (BARVA_RGBA *)mmalloc(sizeof(p_an->p_diff[0])*p_an->diff_keys); file_read(p_an->p_diff,sizeof(p_an->p_diff[0]),p_an->diff_keys,f); } else { p_an->p_dfkeys = NULL; p_an->p_diff = NULL; } } file_read(&p_an->spec_keys,sizeof(p_an->spec_keys),1,f); if(p_an->spec_keys) { p_an->p_spkeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_an->p_spkeys[0])*p_an->spec_keys); file_read(p_an->p_spkeys,sizeof(p_an->p_spkeys[0]),p_an->spec_keys,f); p_an->p_spec = (BARVA_RGBA *)mmalloc(sizeof(p_an->p_spec[0])*p_an->spec_keys); file_read(p_an->p_spec,sizeof(p_an->p_spec[0]),p_an->spec_keys,f); } else { p_an->p_spkeys = NULL; p_an->p_spec = NULL; } return(TRUE); } int lo_chunk_load_dyn_light(FHANDLE f, DATA_CHUNK *p_ch) { DYN_LIGHT *p_light; if(p_ch->typ == CHUNK_DYNAMIC_LIGHT && p_dlist) { p_light = lo_najdi_volne_dsvetlo_point(p_dlist,dlistnum); if(p_light) { file_read(&p_light->akt,sizeof(p_light->akt),1,f); str_read(p_light->name,f); file_read(&p_light->np,sizeof(p_light->np),1,f); file_read(&p_light->dir,sizeof(p_light->dir),1,f); file_read(&p_light->look_max,sizeof(p_light->look_max),1,f); file_read(&p_light->dosah,sizeof(p_light->dosah),1,f); file_read(&p_light->min,sizeof(p_light->min),1,f); file_read(&p_light->max,sizeof(p_light->max),1,f); file_read(&p_light->theta,sizeof(p_light->theta),1,f); file_read(&p_light->dr,sizeof(p_light->dr),1,f); file_read(&p_light->dg,sizeof(p_light->dg),1,f); file_read(&p_light->db,sizeof(p_light->db),1,f); file_read(&p_light->sr,sizeof(p_light->sr),1,f); file_read(&p_light->sg,sizeof(p_light->sg),1,f); file_read(&p_light->sb,sizeof(p_light->sb),1,f); file_read(&p_light->flag,sizeof(p_light->flag),1,f); file_read(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_read(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_read(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); p_light->tp = p_light->np; if(p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an,FALSE); } return(TRUE); } else return(FALSE); } else return(FALSE); } int lo_chunk_load_dyn_light_mesh(FHANDLE f, DATA_CHUNK *p_ch) { DYN_LIGHT *p_light; if(p_kont && p_ch->typ == CHUNK_DYNAMIC_LIGHT_MESH) { p_light = (DYN_LIGHT *)mmalloc(sizeof(p_light[0])); file_read(&p_light->akt,sizeof(p_light->akt),1,f); str_read(p_light->name,f); file_read(&p_light->np,sizeof(p_light->np),1,f); file_read(&p_light->dir,sizeof(p_light->dir),1,f); file_read(&p_light->look_max,sizeof(p_light->look_max),1,f); file_read(&p_light->dosah,sizeof(p_light->dosah),1,f); file_read(&p_light->min,sizeof(p_light->min),1,f); file_read(&p_light->max,sizeof(p_light->max),1,f); file_read(&p_light->theta,sizeof(p_light->theta),1,f); file_read(&p_light->dr,sizeof(p_light->dr),1,f); file_read(&p_light->dg,sizeof(p_light->dg),1,f); file_read(&p_light->db,sizeof(p_light->db),1,f); file_read(&p_light->sr,sizeof(p_light->sr),1,f); file_read(&p_light->sg,sizeof(p_light->sg),1,f); file_read(&p_light->sb,sizeof(p_light->sb),1,f); file_read(&p_light->flag,sizeof(p_light->flag),1,f); file_read(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_read(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_read(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); p_light->tp = p_light->np; if(p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an,FALSE); } p_light->p_mesh_data = p_kont; p_light->p_next = p_kont->p_dlight; p_light->p_prev = NULL; p_kont->p_dlight = p_light; if(p_light->p_next) { p_light->p_next->p_prev = p_light; } return(TRUE); } else return(FALSE); } ************************************************************** Nahraje Extra svetla ************************************************************** int lo_chunk_load_extra_light(FHANDLE f, DATA_CHUNK *p_ch) { EXTRA_DYN_LIGHT *p_light; if(p_ch->typ == CHUNK_EXTRA_LIGHT && p_elist) { p_light = lo_najdi_volne_extra_svetlo_point(p_elist,elistnum); if(p_light) { file_read(&p_light->akt,sizeof(p_light->akt),1,f); str_read(p_light->name,f); file_read(&p_light->flag,sizeof(p_light->flag),1,f); file_read(&p_light->mflag,sizeof(p_light->mflag),1,f); file_read(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_read(&p_light->np,sizeof(p_light->np),1,f); file_read(&p_light->dir,sizeof(p_light->dir),1,f); file_read(&p_light->dosah,sizeof(p_light->dosah),1,f); file_read(&p_light->theta,sizeof(p_light->theta),1,f); file_read(&p_light->utlum,sizeof(p_light->utlum),1,f); file_read(&p_light->gourand,sizeof(p_light->gourand),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->sr,sizeof(p_light->sr),1,f); file_read(&p_light->sg,sizeof(p_light->sg),1,f); file_read(&p_light->sb,sizeof(p_light->sb),1,f); file_read(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_read(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); p_light->tp = p_light->np; if(p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an,TRUE); } return(TRUE); } else return(FALSE); } else return(FALSE); } int lo_chunk_load_extra_light_mesh(FHANDLE f, DATA_CHUNK *p_ch) { EXTRA_DYN_LIGHT *p_light; if(p_kont && p_ch->typ == CHUNK_EXTRA_LIGHT_MESH) { p_light = (EXTRA_DYN_LIGHT *)mmalloc(sizeof(p_light[0])); file_read(&p_light->akt,sizeof(p_light->akt),1,f); str_read(p_light->name,f); file_read(&p_light->flag,sizeof(p_light->flag),1,f); file_read(&p_light->mflag,sizeof(p_light->mflag),1,f); file_read(&p_light->ktrida,sizeof(p_light->ktrida),1,f); file_read(&p_light->np,sizeof(p_light->np),1,f); file_read(&p_light->dir,sizeof(p_light->dir),1,f); file_read(&p_light->dosah,sizeof(p_light->dosah),1,f); file_read(&p_light->theta,sizeof(p_light->theta),1,f); file_read(&p_light->utlum,sizeof(p_light->utlum),1,f); file_read(&p_light->gourand,sizeof(p_light->gourand),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->da,sizeof(p_light->da),1,f); file_read(&p_light->sr,sizeof(p_light->sr),1,f); file_read(&p_light->sg,sizeof(p_light->sg),1,f); file_read(&p_light->sb,sizeof(p_light->sb),1,f); file_read(&p_light->an_flag,sizeof(p_light->an_flag),1,f); file_read(&p_light->an.endtime,sizeof(p_light->an.endtime),1,f); p_light->tp = p_light->np; if(p_light->an.endtime) { lo_chunk_load_dyn_light_anim(f, &p_light->an,TRUE); } p_light->p_mesh_data = p_kont; p_light->p_next = p_kont->p_edlight; p_light->p_prev = NULL; p_kont->p_edlight = p_light; if(p_light->p_next) { p_light->p_next->p_prev = p_light; } return(TRUE); } else return(FALSE); } *********************************************************************** Loading mlho-kostek int lo_chunk_load_mlho_kostek(FHANDLE f, DATA_CHUNK *p_ch) { MLZNA_KOSTKA *p_top; if(p_ch->typ == CHUNK_MLHOKOSTKA) { p_top = vyrob_mlhokostku(""); str_read(p_top->name,f); file_read(&p_top->min,sizeof(BOD),1,f); file_read(&p_top->max,sizeof(BOD),1,f); file_read(&p_top->flag,sizeof(p_top->flag),1,f); file_read(&p_top->mod,sizeof(p_top->mod),1,f); file_read(&p_top->priorita,sizeof(p_top->priorita),1,f); file_read(&p_top->start,sizeof(p_top->start),1,f); file_read(&p_top->stop,sizeof(p_top->stop),1,f); file_read(&p_top->intenzita,sizeof(p_top->intenzita),1,f); file_read(&p_top->r,sizeof(float)*4,1,f); p_top->p_next = p_top_mlha; p_top_mlha = p_top; return(TRUE); } else return(FALSE); } int lo_chunk_load_mlho_kostek_2(FHANDLE f, DATA_CHUNK *p_ch) { MLZNA_KOSTKA *p_top; int kid; if(p_ch->typ == CHUNK_MLHOKOSTKA_2) { p_top = vyrob_mlhokostku(""); str_read(p_top->name,f); file_read(&p_top->min,sizeof(BOD),1,f); file_read(&p_top->max,sizeof(BOD),1,f); file_read(&p_top->flag,sizeof(p_top->flag),1,f); file_read(&p_top->mod,sizeof(p_top->mod),1,f); file_read(&p_top->priorita,sizeof(p_top->priorita),1,f); file_read(&p_top->start,sizeof(p_top->start),1,f); file_read(&p_top->stop,sizeof(p_top->stop),1,f); file_read(&p_top->intenzita,sizeof(p_top->intenzita),1,f); file_read(&p_top->r,sizeof(float)*4,1,f); file_read(&kid,sizeof(int),1,f); if(kid != K_CHYBA) { p_kont->p_mlha = p_top; p_top->p_kont = p_kont; } file_read(&p_top->poly,sizeof(p_top->poly),1,f); p_top->p_next = p_top_mlha; p_top_mlha = p_top; return(TRUE); } else return(FALSE); } *********************************************************************** Loading flaru int lo_chunk_load_flare(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int i,nic; if(p_flarelist && p_ch->typ == CHUNK_FLARE) { // najiti flare if((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1,"Neni volny flare !"); p_flare = NULL; assert(0); return(FALSE); } p_flare = p_flarelist+i; memset(p_flare,0,sizeof(p_flare[0])); file_read(&p_flare->p,sizeof(BOD),1,f); file_read(&p_flare->r,sizeof(float),4,f); file_read(&p_flare->dx,sizeof(float),2,f); file_read(&nic,sizeof(int),1,f); file_read(&p_flare->alfa,sizeof(int),1,f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; // load materialu str_read(pom,f); if((p_flare->material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return(TRUE); } else return(FALSE); } int lo_chunk_load_flare_ext(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int i,nic; if(p_flarelist && p_ch->typ == CHUNK_FLARE_EXT) { // najiti flare if((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1,"Neni volny flare !"); p_flare = NULL; assert(0); return(FALSE); } p_flare = p_flarelist+i; memset(p_flare,0,sizeof(p_flare[0])); file_read(&p_flare->p,sizeof(BOD),1,f); file_read(&p_flare->r,sizeof(float),4,f); file_read(&p_flare->dx,sizeof(float),2,f); file_read(&nic,sizeof(int),1,f); file_read(&p_flare->alfa,sizeof(int),1,f); file_read(&p_flare->zflag,sizeof(int),1,f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; // load materialu str_read(pom,f); if((p_flare->material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return(TRUE); } else return(FALSE); } int lo_chunk_load_flare_light(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int i,nic; if(p_flarelist && p_lightakt && p_ch->typ == CHUNK_FLARE_LIGHT) { if((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1,"Neni volny flare !"); p_flare = NULL; assert(0); return(FALSE); } p_flare = p_flarelist+i; file_read(&p_flare->p,sizeof(BOD),1,f); file_read(&p_flare->r,sizeof(float),4,f); file_read(&p_flare->dx,sizeof(float),2,f); file_read(&nic,sizeof(int),1,f); file_read(&p_flare->alfa,sizeof(int),1,f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; p_flare->p_svetlo = p_lightakt; p_lightakt->p_flare = p_flare; // load materialu str_read(pom,f); if((p_flare->material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return(TRUE); } else return(FALSE); } int lo_chunk_load_flare_light_ext(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int i,nic; if(p_flarelist && p_lightakt && p_ch->typ == CHUNK_FLARE_LIGHT_EXT) { if((i = lo_najdi_volny_flare(p_flarelist, flarelistnum)) == K_CHYBA) { kprintf(1,"Neni volny flare !"); p_flare = NULL; assert(0); return(FALSE); } p_flare = p_flarelist+i; file_read(&p_flare->p,sizeof(BOD),1,f); file_read(&p_flare->r,sizeof(float),4,f); file_read(&p_flare->dx,sizeof(float),2,f); file_read(&nic,sizeof(int),1,f); file_read(&p_flare->alfa,sizeof(int),1,f); file_read(&p_flare->zflag,sizeof(int),1,f); p_flare->index = i; p_flare->p_next = p_flare->p_prev = NULL; p_flare->p_bod = NULL; p_flare->akt = TRUE; p_flare->p_svetlo = p_lightakt; p_lightakt->p_flare = p_flare; // load materialu str_read(pom,f); if((p_flare->material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return(TRUE); } else return(FALSE); } int lo_chunk_load_flare_mesh(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int nic; if(p_light_mesh && p_ch->typ == CHUNK_FLARE_MESH) { // vyroba flare p_flare = (LENS_FLARE *)mmalloc(sizeof(p_flare[0])); file_read(&p_flare->p,sizeof(BOD),1,f); file_read(&p_flare->r,sizeof(float),4,f); file_read(&p_flare->dx,sizeof(float),2,f); file_read(&nic,sizeof(int),1,f); file_read(&p_flare->alfa,sizeof(int),1,f); p_flare->akt = TRUE; p_flare->p_svetlo = p_light_mesh; p_flare->p_next = (LENS_FLARE *)p_light_mesh->p_flare; p_light_mesh->p_flare = p_flare; // load materialu str_read(pom,f); if((p_flare->material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return(TRUE); } else return(FALSE); } int lo_chunk_load_flare_mesh_ext(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int nic; if(p_light_mesh && p_ch->typ == CHUNK_FLARE_MESH_EXT) { // vyroba flare p_flare = (LENS_FLARE *)mmalloc(sizeof(p_flare[0])); file_read(&p_flare->p,sizeof(BOD),1,f); file_read(&p_flare->r,sizeof(float),4,f); file_read(&p_flare->dx,sizeof(float),2,f); file_read(&nic,sizeof(int),1,f); file_read(&p_flare->alfa,sizeof(int),1,f); file_read(&p_flare->zflag,sizeof(int),1,f); p_flare->akt = TRUE; p_flare->p_svetlo = p_light_mesh; p_flare->p_next = (LENS_FLARE *)p_light_mesh->p_flare; p_light_mesh->p_flare = p_flare; // load materialu str_read(pom,f); if((p_flare->material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); p_flare->p_mat = NULL; assert(0); } else p_flare->p_mat = (p_flare->material < matlistnum) ? p_matlist[p_flare->material] : NULL; return(TRUE); } else return(FALSE); } // Ulozeni slozeneho flare int lo_chunk_load_flare_slozeny(FHANDLE f, DATA_CHUNK *p_ch) { char pom[200]; int s; if(p_flare && p_ch->typ == CHUNK_FLARE_SLOZENY) { p_flare->p_sloz = (LENS_FLARE_SLOZ *)mmalloc(sizeof(p_flare->p_sloz[0])*SLOZ_FLARE); for(s = 0; s < SLOZ_FLARE; s++) { file_read(&p_flare->p_sloz[s].vzdal,sizeof(float),1,f); file_read(&p_flare->p_sloz[s].r,sizeof(float),4,f); file_read(&p_flare->p_sloz[s].dx,sizeof(float),2,f); str_read(pom,f); if(p_flare->p_sloz[s].vzdal > 0.0f) { if((p_flare->p_sloz[s].material = lo_najdi_material(p_matlist,matlistnum,pom)) == K_CHYBA) { kprintf(1,"Cannot find material %s",pom); assert(0); } p_flare->p_sloz[s].p_mat = (p_flare->p_sloz[s].material < matlistnum) ? p_matlist[p_flare->p_sloz[s].material] : NULL; } else { p_flare->p_sloz[s].p_mat = NULL; p_flare->p_sloz[s].material = 0; } } return(TRUE); } else return(FALSE); } *********************************************************************** Loading ambientu int lo_chunk_load_ambient(FHANDLE f, DATA_CHUNK *p_ch) { if(p_ambient && p_ch->typ == CHUNK_AMBIENT) { file_read(p_ambient,sizeof(*p_ambient),1,f); return(TRUE); } else return(FALSE); } *********************************************************************** Loading ambientu int lo_chunk_load_levelconfig(FHANDLE f, DATA_CHUNK *p_ch) { if(p_ch->typ == CHUNK_LEVEL_KONFIG_EXT) { file_read(&p_lc->barva_pozadi,sizeof(p_lc->barva_pozadi),1,f); file_read(&p_lc->barva_pozadi_aktivni,sizeof(p_lc->barva_pozadi_aktivni),1,f); file_read(&p_lc->zm.aktivni,sizeof(p_lc->zm.aktivni),1,f); file_read(&p_lc->zm.v_start,sizeof(p_lc->zm.v_start),1,f); file_read(&p_lc->zm.v_stop,sizeof(p_lc->zm.v_stop),1,f); file_read(&p_lc->zm.h_start,sizeof(p_lc->zm.h_start),1,f); file_read(&p_lc->zm.h_stop,sizeof(p_lc->zm.h_stop),1,f); file_read(&p_lc->zm.barva,sizeof(p_lc->zm.barva),1,f); return(TRUE); } else return(FALSE); } *********************************************************************** Loading zrcadla int lo_chunk_load_zrcadlo(FHANDLE f, DATA_CHUNK *p_ch) { if(p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO) { *p_zrcadloload = TRUE; file_read(&p_zrcadlolist->zrcadlo_k,sizeof(p_zrcadlolist->zrcadlo_k),1,f); file_read(&p_zrcadlolist->zrcadlo_o,sizeof(p_zrcadlolist->zrcadlo_o),1,f); file_read(&p_zrcadlolist->poly,sizeof(p_zrcadlolist->poly),1,f); file_read(&p_zrcadlolist->ref,sizeof(p_zrcadlolist->ref),1,f); file_read(p_zrcadlolist->p,sizeof(p_zrcadlolist->p[0]),4,f); file_read(p_zrcadlolist->r,sizeof(p_zrcadlolist->r[0]),5,f); return(TRUE); } else return(FALSE); } int lo_chunk_load_zrcadlo_2(FHANDLE f, DATA_CHUNK *p_ch) { if(p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO_2) { *p_zrcadloload = TRUE; file_read(p_zrcadlolist,sizeof(ZDRCADLO_DESC),1,f); return(TRUE); } else return(FALSE); } int lo_chunk_load_zrcadlo_3_sub(FHANDLE f, DATA_CHUNK *p_ch) { ZDRCADLO_DESC_POLY *p_poly; if(p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO_3_POLOZKA) { p_poly = (ZDRCADLO_DESC_POLY *)mmalloc(sizeof(p_poly[0])); file_read(p_poly,sizeof(p_poly[0]),1,f); p_poly->p_next = p_zrcadlolist->p_poly; p_zrcadlolist->p_poly = p_poly; return(TRUE); } else return(FALSE); } int lo_chunk_load_zrcadlo_3(FHANDLE f, DATA_CHUNK *p_ch) { if(p_zrcadlolist && p_ch->typ == CHUNK_ZRCADLO_3) { *p_zrcadloload = TRUE; file_read(p_zrcadlolist,sizeof(ZDRCADLO_DESC),1,f); p_zrcadlolist->p_poly = NULL; return(TRUE); } else return(FALSE); } *********************************************************************** Loading statickych svetel int lo_chunk_load_static_light(FHANDLE f, DATA_CHUNK *p_ch) { STATIC_LIGHT light; if(p_lightlist && p_ch->typ == CHUNK_STATIC_LIGHT) { memset(&light,0,sizeof(light)); file_read(&light.akt,sizeof(light.akt),1,f); str_read(light.name,f); file_read(&light.index,sizeof(light.index),1,f); file_read(&light.p,sizeof(light.p),1,f); file_read(&light.r,sizeof(float),1,f); file_read(&light.g,sizeof(float),1,f); file_read(&light.b,sizeof(float),1,f); file_read(&light.k1,sizeof(float),4,f); file_read(&light.uhel,sizeof(light.uhel),1,f); file_read(&light.utlum,sizeof(light.utlum),1,f); file_read(&light.flag,sizeof(light.flag),1,f); file_read(&light.flag2,sizeof(light.flag2),1,f); if(p_lightlist[light.index].akt) { light.index = lo_najdi_volne_stat_svetlo(p_lightlist,lightlistnum); if(light.index != K_CHYBA) { p_lightlist[light.index] = light; } } else p_lightlist[light.index] = light; p_lightakt = p_lightlist+light.index; return(TRUE); } else return(FALSE); } int lo_chunk_load_static_light_mesh(FHANDLE f, DATA_CHUNK *p_ch) { STATIC_LIGHT *p_light; if(p_kont && p_ch->typ == CHUNK_STATIC_LIGHT_MESH) { p_light = (STATIC_LIGHT *)mmalloc(sizeof(p_light[0])); file_read(&p_light->akt,sizeof(p_light->akt),1,f); str_read(p_light->name,f); file_read(&p_light->index,sizeof(p_light->index),1,f); file_read(&p_light->p,sizeof(p_light->p),1,f); file_read(&p_light->r,sizeof(float),1,f); file_read(&p_light->g,sizeof(float),1,f); file_read(&p_light->b,sizeof(float),1,f); file_read(&p_light->k1,sizeof(float),4,f); file_read(&p_light->uhel,sizeof(p_light->uhel),1,f); file_read(&p_light->utlum,sizeof(p_light->utlum),1,f); file_read(&p_light->flag,sizeof(p_light->flag),1,f); file_read(&p_light->flag2,sizeof(p_light->flag2),1,f); p_light->flag2 |= SL2_MESH; p_light->p_mesh_data = p_kont; p_light->p_next = p_kont->p_slight; p_light->p_prev = NULL; p_kont->p_slight = p_light; if(p_light->p_next) { p_light->p_next->p_prev = p_light; } p_light_mesh = p_light; return(TRUE); } else return(FALSE); } ***************************************************************************** Load sim animaci inline int lo_najdi_volny_sim(HIERARCHY_SIM *p_sim, int max) { int i; for(i = 0; i < max; i++) { if(!p_sim[i].keynum) return(i); } return(K_CHYBA); } int lo_chunk_load_sim_node(FHANDLE f, SIMPLE_TRACK_INFO *p_sim) { DATA_CHUNK ch; int klicu,i; file_read(&ch,sizeof(ch),1,f); if(p_sim && (ch.typ == CHUNK_SIM_NODE || ch.typ == CHUNK_SIM_NODE_EXT || ch.typ == CHUNK_SIM_NODE_EXT2)) { memset(p_sim,0,sizeof(p_sim[0])); file_read(&p_sim->Objekt_ID,sizeof(p_sim->Objekt_ID),1,f); file_read(&p_sim->flag,sizeof(p_sim->flag),1,f); file_read(&p_sim->keynum,sizeof(p_sim->keynum),1,f); file_read(&p_sim->pivot,sizeof(p_sim->pivot),1,f); file_read(&p_sim->pivot3ds,sizeof(p_sim->pivot3ds),1,f); file_read(&p_sim->childnum,sizeof(p_sim->childnum),1,f); file_read(&klicu,sizeof(klicu),1,f); if(klicu) { p_sim->p_pos = (BOD *)mmalloc(sizeof(p_sim->p_pos[0])*p_sim->keynum); file_read(p_sim->p_pos,sizeof(p_sim->p_pos[0]),p_sim->keynum,f); } else { p_sim->p_pos = NULL; } file_read(&klicu,sizeof(klicu),1,f); if(klicu) { p_sim->p_scale = (BOD *)mmalloc(sizeof(p_sim->p_scale[0])*p_sim->keynum); file_read(p_sim->p_scale,sizeof(p_sim->p_scale[0]),p_sim->keynum,f); } else { p_sim->p_scale = NULL; } file_read(&klicu,sizeof(klicu),1,f); if(klicu) { p_sim->p_at = (QUAT *)mmalloc(sizeof(p_sim->p_at[0])*p_sim->keynum); file_read(p_sim->p_at,sizeof(p_sim->p_at[0]),p_sim->keynum,f); } else { p_sim->p_at = NULL; } if(ch.typ == CHUNK_SIM_NODE_EXT || ch.typ == CHUNK_SIM_NODE_EXT2) { file_read(&klicu,sizeof(klicu),1,f); if(klicu) { p_sim->p_norm = (float *)mmalloc(sizeof(p_sim->p_norm[0])*p_sim->keynum); file_read(p_sim->p_norm,sizeof(p_sim->p_norm[0]),p_sim->keynum,f); } else { p_sim->p_norm = NULL; } } if(ch.typ == CHUNK_SIM_NODE_EXT2) { p_sim->p_all_matrix = (GLMATRIX *)mmalloc(sizeof(p_sim->p_all_matrix[0])); file_read(p_sim->p_all_matrix,sizeof(p_sim->p_all_matrix[0]),1,f); } if(p_sim->childnum) { p_sim->p_child = (SIMPLE_TRACK_INFO *)mmalloc(sizeof(p_sim->p_child[0])*p_sim->childnum); for(i = 0; i < p_sim->childnum; i++) lo_chunk_load_sim_node(f, p_sim->p_child+i); } return(TRUE); } else return(FALSE); } int lo_chunk_load_sim_root(FHANDLE f, DATA_CHUNK *p_ch) { int i; if(p_kont && p_ch->typ == CHUNK_SIM_ROOT) { if((i = lo_najdi_volny_sim(p_kont->sim, KONT_MAX_ANIM)) == K_CHYBA) chyba("Fuck-off"); p_sim = p_kont->sim+i; memset(p_sim,0,sizeof(p_sim[0])); file_read(&p_sim->flag,sizeof(p_sim->flag),1,f); file_read(&p_sim->keynum,sizeof(p_sim->keynum),1,f); file_read(&p_sim->name,sizeof(p_sim->name[0]),MAX_JMENO,f); file_read(&p_sim->childnum,sizeof(p_sim->childnum),1,f); // udelej misto pro decka if(p_sim->childnum) { p_sim->p_child = (SIMPLE_TRACK_INFO *)malloc(sizeof(p_sim->p_child[0])*p_sim->childnum); for(i = 0; i < p_sim->childnum; i++) lo_chunk_load_sim_node(f, p_sim->p_child+i); } key_sim_dopln_matrix_kont(p_kont,p_sim); return(TRUE); } else { p_sim = NULL; return(FALSE); } } int lo_chunk_load_neznamy(FHANDLE f, DATA_CHUNK *p_ch) { int delka = p_ch->velikost-sizeof(*p_ch); //if(p_ch->typ < 0 && p_ch->typ > CHUNK_KONT_JMENO) //kprintfl(TRUE,"-load neznamy chunk typ %d velikost %d",p_ch->typ,p_ch->velikost); ffseek(f,delka,SEEK_CUR); return(TRUE); } int lo_load_chunky(FHANDLE f) { DATA_CHUNK ch; int load, i, j = 0, ret; while((ret = file_read(&ch,sizeof(ch),1,f)) && ret > 0) { spracuj_spravy(TRUE); load = 0; for(i = 0; i < (sizeof(chload)/sizeof(chload[0])); i++) { if(chload[i].chunk == ch.typ) { load = chload[i].p_fce(f,&ch); break; } } if(!load) { lo_chunk_load_neznamy(f, &ch); } j++; } if(ret < 0) { if(ret == -1) { //kprintf(TRUE,"Chyba loadu projektu '%s'",strerror(errno)); } } return(j); } Nahraje vsechny materialy + prvni kontejner */ /* EDIT_KONTEJNER * lo_nahraj_kontejner_chunk(EDIT_MATERIAL **p_mat, int max_mat, EDIT_TEXT *p_text, int max_text, char *p_name, int mat, int normal) { */ /* FHANDLE f; if((f = ffopen(p_name,"rb")) == NULL) { //kprintf(1,"Fail loading kont %s error '%s'",p_name,strerror(errno)); return(NULL); } p_ambient = NULL; p_matlist = p_mat; matlistnum = max_mat; p_textlist = p_text; textlistnum = max_text; p_lightlist = NULL; lightlistnum = 0; p_zrcadlolist = NULL; p_zrcadloload = NULL; p_flarelist = NULL; p_flare = NULL; p_top_mlha = NULL; flarelistnum = 0; kont_load = 0; kontlistnum = 0; p_kontlist = NULL; p_kont_old = p_kont = vyrob_kontejner(); p_mat = NULL; p_obj = NULL; p_dlist = NULL; dlistnum = 0; p_elist = NULL; elistnum = 0; p_lenv = NULL; p_kamset = NULL; p_light_mesh = NULL; p_joint = NULL; p_joint_animace = NULL; lo_load_chunky(f); ffclose(f); p_kont->k2flag &= ~KONT2_LOADED; p_kont = p_kont_old; lo_chunk_stage_load_korekce(p_matlist, max_mat); p_kont->k2flag&=~KONT2_LOADED; updatuj_kontejner_flag(p_kont,p_matlist); updatuj_kontejner_statistika(p_kont,FALSE); key_kontejner_sim_reanimuj(p_kont); if(normal) kont_norm_vect(p_kont); key_kosti_reanimuj_kont(p_kont); return(p_kont); */ /* return(NULL); } */ /* CHUNK_LOADER chunk_load[] = { {lo_chunk_load_ambient, CHUNK_AMBIENT}, {lo_chunk_load_levelconfig, CHUNK_LEVEL_KONFIG_EXT}, {lo_chunk_load_sim_root, CHUNK_SIM_ROOT}, {lo_chunk_load_static_light, CHUNK_STATIC_LIGHT}, {lo_chunk_load_static_light_mesh, CHUNK_STATIC_LIGHT_MESH}, {lo_chunk_load_dyn_light, CHUNK_DYNAMIC_LIGHT}, {lo_chunk_load_dyn_light_mesh, CHUNK_DYNAMIC_LIGHT_MESH}, {lo_chunk_load_extra_light, CHUNK_EXTRA_LIGHT}, {lo_chunk_load_extra_light_mesh, CHUNK_EXTRA_LIGHT_MESH}, {lo_chunk_load_zrcadlo_3, CHUNK_ZRCADLO_3}, {lo_chunk_load_zrcadlo_3_sub, CHUNK_ZRCADLO_3_POLOZKA}, {lo_chunk_load_flare, CHUNK_FLARE}, {lo_chunk_load_flare_mesh, CHUNK_FLARE_MESH}, {lo_chunk_load_flare_slozeny, CHUNK_FLARE_SLOZENY}, {lo_chunk_load_flare_light, CHUNK_FLARE_LIGHT}, {lo_chunk_load_flare_ext, CHUNK_FLARE_EXT}, {lo_chunk_load_flare_mesh_ext, CHUNK_FLARE_MESH_EXT}, {lo_chunk_load_flare_light_ext, CHUNK_FLARE_LIGHT_EXT}, {lo_chunk_load_mlho_kostek, CHUNK_MLHOKOSTKA}, {lo_chunk_load_mlho_kostek_2, CHUNK_MLHOKOSTKA_2}, {lo_chunk_load_environment, CHUNK_ENVIRONMENT}, {lo_chunk_load_kamset, CHUNK_KAMSET}, {lo_chunk_load_kamset_2, CHUNK_KAMSET_2}, }; */ /* int lo_nahraj_projekt(EDIT_MATERIAL **p_mat, int max_mat, EDIT_KONTEJNER **p_kontls, int kontnum, EDIT_TEXT *p_text, int max_text, char *p_name, STATIC_LIGHT *p_light, int lightnum, ZDRCADLO_DESC *p_zrcadlo, int *p_zrcadlo_aktivni, LENS_FLARE *p_flarr, int flaremax, dword *p_amb, MLZNA_KOSTKA **p_mlha, DYN_LIGHT *p_ddlight, int ddlightnum, EXTRA_DYN_LIGHT *p_eelight, int eelightnum, LEVEL_ENVIRONMENT *p_env, //NASTAVENI_KAMER *p_kam, LEVEL_KONFIG *p_lev_konfig, int flag, int normal) { FHANDLE f; int i; if((f = ffopen(p_name,"rb")) == NULL) { //kprintf(1,"Fail loading kont %s error '%s'",p_name,strerror(errno)); return(FALSE); } p_kontlist = (flag&LOAD_GEOM) ? p_kontls : NULL; kontlistnum = (flag&LOAD_GEOM) ? kontnum : 0; p_matlist = (flag&LOAD_MATERIALY) ? p_mat : NULL; matlistnum = (flag&LOAD_MATERIALY) ? max_mat : 0; p_textlist = (flag&LOAD_TEXTURY) ? p_text : NULL; textlistnum = (flag&LOAD_TEXTURY) ? max_text : 0; p_ambient = (flag&LOAD_AMBIENT) ? p_amb : NULL; p_zrcadlolist = (flag&LOAD_ZRCADLO) ? p_zrcadlo : NULL; p_zrcadloload = (flag&LOAD_ZRCADLO) ? p_zrcadlo_aktivni : NULL; p_lightlist = (flag&LOAD_STAT_LIGHT) ? p_light : NULL; lightlistnum = (flag&LOAD_STAT_LIGHT) ? lightnum : 0; p_dlist = (flag&LOAD_DYN_LIGHT) ? p_ddlight : NULL; dlistnum = (flag&LOAD_DYN_LIGHT) ? ddlightnum : 0; p_elist = (flag&LOAD_EXTRA_DYN_LIGHT) ? p_eelight : NULL; elistnum = (flag&LOAD_EXTRA_DYN_LIGHT) ? eelightnum : 0; p_top_mlha = (flag&LOAD_MLHA) ? *p_mlha : NULL; p_flarelist = (flag&LOAD_FLARE) ? p_flarr : NULL; flarelistnum = (flag&LOAD_FLARE) ? flaremax : 0; p_flare = NULL; p_lenv = (flag&LOAD_LEVEL_ENV) ? p_env : NULL; p_lc = (flag&LOAD_LEVEL_CONF) ? p_lev_konfig : NULL; p_kamset = (flag&LOAD_KAMERY) ? p_kam : NULL; p_kont = NULL; p_mat = NULL; p_obj = NULL; p_light_mesh = NULL; p_joint = NULL; p_joint_animace = NULL; lo_load_chunky(f); ffclose(f); lo_chunk_stage_load_korekce(p_matlist, max_mat); for(i = 0; i < kontnum; i++) { if(p_kontls[i] && p_kontls[i]->k2flag&KONT2_LOADED) { p_kontls[i]->k2flag&=~KONT2_LOADED; updatuj_kontejner_flag(p_kontls[i],p_matlist); updatuj_kontejner_statistika(p_kontls[i],FALSE); lo_preved_flare_do_sceny(p_kontls[i]->p_slight, p_flarr, flaremax); lo_preved_svetla_do_sceny(p_kontls[i],p_light,lightnum,p_ddlight,ddlightnum,p_eelight,eelightnum); key_kontejner_sim_reanimuj(p_kontls[i]); if(normal) kont_norm_vect(p_kontls[i]); key_kosti_reanimuj_kont(p_kontls[i]); } } *p_mlha = p_top_mlha; return(TRUE); } */ berusky2-0.12/src/age/graph/scene_import_b2m.cpp0000644000175000017500000023415413674426075016531 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" class import_b2m; /* * This structure is stored in data-file, * before every data-block (chunk) */ typedef struct _DATA_CHUNK { int type; // type of stored data int size; // size of stored data (in bytes) } DATA_CHUNK; /* * A function for loading chunks from file */ typedef int (import_b2m::*CHUNK_LOAD_FUNC)(FHANDLE *f, DATA_CHUNK *p_chunk); /* * Chunk loader structure */ typedef struct _CHUNK_LOADER { CHUNK_LOAD_FUNC p_func; int chunk; } CHUNK_LOADER; /* * Group of chunk with the same meaning (i.e. meshes / materials / ...) */ typedef struct chunk_group { CHUNK_LOADER *p_chunks; int chunk_num; int chunk_range_min; int chunk_range_max; bool check(DATA_CHUNK *p_chunk); } CHUNK_GROUP; /* * Main import/export class */ typedef class import_b2m { private: SCENE *p_scene; private: int chunk_skip(FHANDLE *f, DATA_CHUNK *p_ch) { f->seek(p_ch->size - sizeof(*p_ch), SEEK_CUR); return(TRUE); } // ************************************************************************* // Load/Save routines - Meshes // ************************************************************************* private: GAME_MESH *p_mesh; private: GAME_MESH * mesh_new(const char *p_name = NULL, const char *p_parent_name = NULL) { p_mesh = p_scene->mesh_create(p_name,p_parent_name); return(p_mesh); } private: char kont_name[MAX_NAME]; int kont_name_ID; int kont_flag; int kont_flag2; int kont_material_flag; int kont_material_flag2; private: // Containers -> a logical group of mesh #define CHUNK_KONT_NAME 100 // zacatek kontejneru - jeho jmeno #define CHUNK_KONT_FLAG 101 // flag kontejneru #define CHUNK_KONT_WMATRIX 102 // matice kontejneru #define CHUNK_KONT_FLAG_EXT 103 // flag kontejneru #define CHUNK_KONT_MPMATRIX 104 // m-p matice kontejneru #define CHUNK_KONT_LOW_NAME 105 // zacatek low kontejneru #define CHUNK_KONT_LOW_ID 106 // identifikator low-kontejneru #define CHUNK_KONT_ID 107 // identifikator kontejneru #define CHUNK_KONT_FLAG_EXT_2 108 // ext-flagy #define CHUNK_KONT_OBB 110 // OBB kontejneru // Objects -> a single meshes #define CHUNK_OBJ_NAME 1001 // jmeno objektu #define CHUNK_OBJ_MATERIAL 1002 // material objektu #define CHUNK_OBJ_VERTEXES 1003 // pole vertexu #define CHUNK_OBJ_MAPS_1 1004 // pole mapu #define CHUNK_OBJ_MAPS_2 1005 // pole mapu #define CHUNK_OBJ_FACES 1006 // pole facu #define CHUNK_OBJ_COLOR 1007 // pole barev #define CHUNK_OBJ_COLOR_EXT 1008 // pole rozsirenych barev #define CHUNK_OBJ_MATRIX 1009 // local-matrix kontejneru (pro keyframe-kontejnery) #define CHUNK_OBJ_ID 1010 // ID objektu #define CHUNK_OBJ_MATRIX_KEY 1011 // keyframe matice #define CHUNK_OBJ_MAPS_3 1012 // pole mapu 3 #define CHUNK_OBJ_MAPS_4 1013 // pole mapu 4 #define CHUNK_OBJ_PIVOT 1014 // pivot-point objektu #define CHUNK_OBJ_OBB 1016 // obb obalka #define CHUNK_OBJ_FACES_OPT 1017 // pole facu #define CHUNK_OBJ_NORMAL 1018 // pole normalu #define CHUNK_OBJ_NAME_PARENT 1019 // name of object and name of it's parent #define CHUNK_OBJ_JA 1500 #define CHUNK_OBJ_JA_NAME 1501 #define CHUNK_OBJ_JA_FRAME_NUM 1502 #define CHUNK_OBJ_JNT_ID 1600 #define CHUNK_OBJ_JNT_PIVOT 1601 #define CHUNK_OBJ_JNT_VERT 1602 #define CHUNK_OBJ_JNT_FLAG 1603 #define CHUNK_OBJ_JNT_POS 1604 #define CHUNK_OBJ_JNT_ROT 1605 #define CHUNK_OBJ_JNT_SCS 1606 #define CHUNK_OBJ_JNT_KEYPOS 1607 #define CHUNK_OBJ_JNT_KEYROT 1608 #define CHUNK_OBJ_JNT_KEYSCS 1609 /* * Save routines */ int game_mesh_save_mesh_name(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh) { ch.type = CHUNK_OBJ_NAME; ch.size = sizeof(ch)+strlen(p_mesh->name_get())+1; f->write(&ch,sizeof(ch)); f->write_string(p_mesh->name_get()); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_ID(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh) { ch.type = CHUNK_OBJ_ID; ch.size = sizeof(ch)+sizeof(int); int id = p_mesh->name_ID_get(); f->write(&ch,sizeof(ch)); f->write(&id,sizeof(int)); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_pivot(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh && p_mesh->geometry_active()) { ch.type = CHUNK_OBJ_PIVOT; ch.size = sizeof(ch)+sizeof(VECT); f->write(&ch,sizeof(ch)); MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); f->write(p_geom->pivot_get(),sizeof(VECT)); p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_obb(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh && p_mesh->object_box_type_get() == BOX_OBB) { OBB *p_obb = (OBB *)p_mesh->object_box_get(); if(p_obb) { ch.type = CHUNK_OBJ_OBB; ch.size = sizeof(ch)+ sizeof(VECT)*3+ sizeof(VECT)+ sizeof(VECT)+ sizeof(VECT)*8+ sizeof(VECT)*2; f->write(&ch,sizeof(ch)); f->write(p_obb->dir,sizeof(p_obb->dir)); f->write(&p_obb->center,sizeof(p_obb->center)); f->write(&p_obb->len,sizeof(p_obb->len)); f->write(p_obb->border,sizeof(p_obb->border)); f->seek(sizeof(VECT)*2,SEEK_CUR); return(TRUE); } } return(FALSE); } int game_mesh_save_mesh_material(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh && p_mesh->material_get()) { MESH_MATERIAL *p_mat = p_mesh->material_get(); ch.type = CHUNK_OBJ_MATERIAL; ch.size = sizeof(ch)+strlen(p_mat->name_get())+1; f->write(&ch,sizeof(ch)); f->write_string(p_mat->name_get()); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_matrix(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh) { ch.type = CHUNK_OBJ_MATRIX_KEY; ch.size = sizeof(ch)+sizeof(GLMATRIX); f->write(&ch,sizeof(ch)); f->write(p_mesh->world_get(),sizeof(GLMATRIX)); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_vertex(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); DATA_CHUNK ch; ch.type = CHUNK_OBJ_VERTEXES; ch.size = sizeof(ch)+ sizeof(dword)+ sizeof(float)*3*p_geom->vertexnum_get(); f->write(&ch,sizeof(ch)); int num = p_geom->vertexnum_get(); f->write(&num,sizeof(num)); VECT *p_pos = p_geom->position_get(); int i; for(i = 0; i < num; i++) { f->write(p_pos+i,sizeof(VECT)); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_face(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int facenum = p_geom->facenum_get(); DATA_CHUNK ch; ch.type = CHUNK_OBJ_FACES; ch.size = sizeof(ch)+sizeof(dword)+sizeof(word)*facenum; f->write(&ch,sizeof(ch)); f->write(&facenum,sizeof(int)); int i; for(i = 0; i < facenum; i++) { word face = p_geom->face_get(i); f->write(&face,sizeof(word)); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } /* int game_mesh_save_mesh_face_ext(FHANDLE *f, GAME_MESH *p_mesh) { DATA_CHUNK ch; if(p_mesh && p_mesh->geometry_active()) { ch.type = CHUNK_OBJ_FACES_OPT; ch.size = sizeof(ch)+sizeof(p_mesh->optnum)+ sizeof(p_mesh->p_opt[0])*p_mesh->optnum; f->write(&ch,sizeof(ch)); f->write(&p_mesh->optnum,sizeof(p_mesh->optnum)); f->write(p_mesh->p_opt,sizeof(p_mesh->p_opt[0]),p_mesh->optnum,f); return(TRUE); } else return(FALSE); } */ int game_mesh_save_mesh_maps(FHANDLE *f, GAME_MESH *p_mesh, int text_index) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); DATA_CHUNK ch; int map_table[] = { CHUNK_OBJ_MAPS_1, CHUNK_OBJ_MAPS_2, CHUNK_OBJ_MAPS_3, CHUNK_OBJ_MAPS_4 }; int vertex_num = p_geom->vertexnum_get(); ch.type = map_table[text_index]; ch.size = sizeof(ch)+ sizeof(int)+ sizeof(float)*2*vertex_num; f->write(&ch,sizeof(ch)); f->write(&vertex_num,sizeof(int)); VECTUV *p_map = p_geom->uv_get(vertex_num); int i; for(i = 0; i < vertex_num; i++) { f->write(p_map+i,sizeof(VECTUV)); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_normal(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int num = p_geom->vertexnum_get(); DATA_CHUNK ch; ch.type = CHUNK_OBJ_NORMAL; ch.size = sizeof(ch)+sizeof(int)+sizeof(float)*3*num; f->write(&ch,sizeof(ch)); f->write(&num,sizeof(int)); VECT *p_norm = p_geom->normal_get(); int i; for(i = 0; i < num; i++) { f->write(p_norm+i,sizeof(VECT)); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } /* * Save colors */ int game_mesh_save_mesh_colors(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int num = p_geom->vertexnum_get(); DATA_CHUNK ch; ch.type = CHUNK_OBJ_COLOR_EXT; ch.size = sizeof(ch)+ sizeof(dword)+ sizeof(float)*4*num*2+ sizeof(float)*4*num*2; f->write(&ch,sizeof(ch)); f->write(&num,sizeof(int)); RGBAF *p_diff = p_geom->diffuse_get(); RGBF *p_spec = p_geom->specular_get(); int i; for(i = 0; i < num; i++) { f->write(p_diff+i,sizeof(RGBAF)); f->write(p_diff+i,sizeof(RGBAF)); RGBAF tmp(p_spec[i]); f->write(&tmp,sizeof(RGBAF)); f->write(&tmp,sizeof(RGBAF)); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } /* int game_mesh_save_mesh_joint_spline(FHANDLE *f, JOINT_KEYS *p_keys) { DATA_CHUNK ch; if(!p_keys) return(FALSE); if(p_keys->p_pos) { ch.type = CHUNK_OBJ_JNT_KEYPOS; ch.size = sizeof(ch)+sizeof(p_keys->pos_keys)+p_keys->pos_keys*sizeof(p_keys->p_pos[0])+p_keys->pos_keys*sizeof(p_keys->p_pkeys[0]); f->write(&ch,sizeof(ch)); f->write(&p_keys->pos_keys,sizeof(p_keys->pos_keys)); f->write(p_keys->p_pos,sizeof(p_keys->p_pos[0]),p_keys->pos_keys,f); f->write(p_keys->p_pkeys,sizeof(p_keys->p_pkeys[0]),p_keys->pos_keys,f); } if(p_keys->p_rot) { ch.type = CHUNK_OBJ_JNT_KEYROT; ch.size = sizeof(ch)+sizeof(p_keys->rot_keys)+p_keys->rot_keys*sizeof(p_keys->p_rot[0])+p_keys->rot_keys*sizeof(p_keys->p_rkeys[0]); file_write(&ch,sizeof(ch),1,f); file_write(&p_keys->rot_keys,sizeof(p_keys->rot_keys),1,f); file_write(p_keys->p_rot,sizeof(p_keys->p_rot[0]),p_keys->rot_keys,f); file_write(p_keys->p_rkeys,sizeof(p_keys->p_rkeys[0]),p_keys->rot_keys,f); } if(p_keys->p_scale) { ch.type = CHUNK_OBJ_JNT_KEYSCS; ch.size = sizeof(ch)+sizeof(p_keys->scs_keys)+p_keys->scs_keys*sizeof(p_keys->p_scale[0])+p_keys->scs_keys*sizeof(p_keys->p_skeys[0]); file_write(&ch,sizeof(ch),1,f); file_write(&p_keys->scs_keys,sizeof(p_keys->scs_keys),1,f); file_write(p_keys->p_scale,sizeof(p_keys->p_scale[0]),p_keys->scs_keys,f); file_write(p_keys->p_skeys,sizeof(p_keys->p_skeys[0]),p_keys->scs_keys,f); } return(TRUE); } #define ROOT_ID 0 int game_mesh_save_mesh_joint(FHANDLE *f, JOINT *p_joint, int id_prev) { DATA_CHUNK ch; if(!p_joint) return(FALSE); ch.type = CHUNK_OBJ_JNT_ID; ch.size = sizeof(ch)+2*sizeof(p_joint->joint_ID); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->joint_ID,sizeof(p_joint->joint_ID),1,f); file_write(&id_prev,sizeof(id_prev),1,f); ch.type = CHUNK_OBJ_JNT_PIVOT; ch.size = sizeof(ch)+sizeof(p_joint->pivot); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->pivot,sizeof(p_joint->pivot),1,f); if(p_joint->p_vertexlist) { ch.type = CHUNK_OBJ_JNT_VERT; ch.size = sizeof(ch)+sizeof(p_joint->vertexnum)+p_joint->vertexnum*sizeof(p_joint->p_vertexlist[0]); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->vertexnum,sizeof(p_joint->vertexnum),1,f); file_write(p_joint->p_vertexlist,sizeof(p_joint->p_vertexlist[0]),p_joint->vertexnum,f); } ch.type = CHUNK_OBJ_JNT_FLAG; ch.size = sizeof(ch)+sizeof(p_joint->flag); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->flag,sizeof(p_joint->flag),1,f); if(p_joint->p_pos) { ch.type = CHUNK_OBJ_JNT_POS; ch.size = sizeof(ch)+sizeof(p_joint->pos_keys)+p_joint->pos_keys*sizeof(p_joint->p_pos[0]); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->pos_keys,sizeof(p_joint->pos_keys),1,f); file_write(p_joint->p_pos,sizeof(p_joint->p_pos[0]),p_joint->pos_keys,f); } if(p_joint->p_rot) { ch.type = CHUNK_OBJ_JNT_ROT; ch.size = sizeof(ch)+sizeof(p_joint->rot_keys)+p_joint->rot_keys*sizeof(p_joint->p_rot[0]); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->rot_keys,sizeof(p_joint->rot_keys),1,f); file_write(p_joint->p_rot,sizeof(p_joint->p_rot[0]),p_joint->rot_keys,f); } if(p_joint->p_scs) { ch.type = CHUNK_OBJ_JNT_SCS; ch.size = sizeof(ch)+sizeof(p_joint->scs_keys)+p_joint->scs_keys*sizeof(p_joint->p_scs[0]); file_write(&ch,sizeof(ch),1,f); file_write(&p_joint->scs_keys,sizeof(p_joint->scs_keys),1,f); file_write(p_joint->p_scs,sizeof(p_joint->p_scs[0]),p_joint->scs_keys,f); } if(p_joint->p_keys) game_mesh_save_mesh_joint_spline(f, p_joint->p_keys); game_mesh_save_mesh_joint(f, p_joint->p_next, p_joint->joint_ID); game_mesh_save_mesh_joint(f, p_joint->p_child, p_joint->joint_ID); return(TRUE); } int game_mesh_save_mesh_joint_animaci(FHANDLE *f, JOINT_ANIMACE *p_jani) { DATA_CHUNK ch; ch.type = CHUNK_OBJ_JA; ch.size = sizeof(ch)+strlen(p_jani->name)+1; file_write(&ch,sizeof(ch),1,f); file_write(p_jani->name,sizeof(byte),strlen(p_jani->name)+1,f); ch.type = CHUNK_OBJ_JA_FRAME_NUM; ch.size = sizeof(ch)+sizeof(p_jani->framenum); file_write(&ch,sizeof(ch),1,f); file_write(&p_jani->framenum,sizeof(p_jani->framenum),1,f); game_mesh_save_mesh_joint(f, p_jani->p_child, ROOT_ID); return(TRUE); } void lo_kost_ocisluj_rec(JOINT *p_joint, int *p_cislo) { if(p_joint->p_child) lo_kost_ocisluj_rec(p_joint->p_child,p_cislo); if(p_joint->p_next) lo_kost_ocisluj_rec(p_joint->p_next,p_cislo); p_joint->joint_ID = (*p_cislo)++; } int game_mesh_save_mesh_joint_animace(FHANDLE *f, GAME_MESH *p_mesh) { JOINT_ANIMACE *p_akt = p_mesh->p_joit_animace; int ID; while(p_akt) { ID = 1; lo_kost_ocisluj_rec(p_akt->p_child, &ID); game_mesh_save_mesh_joint_animaci(f, p_akt); p_akt = p_akt->p_next; } return(TRUE); } */ /* * Save mesh to file */ bool game_mesh_save(FHANDLE *f, GAME_MESH *p_mesh) { // Save general info game_mesh_save_mesh_name(f, p_mesh); game_mesh_save_mesh_ID(f, p_mesh); game_mesh_save_mesh_pivot(f, p_mesh); game_mesh_save_mesh_obb(f, p_mesh); // Save material game_mesh_save_mesh_material(f,p_mesh); // Save vertexes game_mesh_save_mesh_vertex(f, p_mesh); // Save normals game_mesh_save_mesh_normal(f, p_mesh); // Save faces game_mesh_save_mesh_face(f, p_mesh); // Save maps game_mesh_save_mesh_maps(f,p_mesh,0); game_mesh_save_mesh_maps(f,p_mesh,1); game_mesh_save_mesh_maps(f,p_mesh,2); game_mesh_save_mesh_maps(f,p_mesh,3); // Save colors game_mesh_save_mesh_colors(f,p_mesh); // Save matrixes game_mesh_save_mesh_matrix(f,p_mesh); // Save mesh animations //if(p_mesh->p_obj[i]->p_joit_animace) { // game_mesh_save_mesh_joint_animace((FILE *)f,p_mesh->p_obj[i]); return(TRUE); } /* int game_mesh_save(FHANDLE *f, GAME_MESH *p_mesh, EDIT_MATERIAL **p_mat, int max_mat, int low, int kont, int kont_id, int transf_stat) { int i; Oflagovani podle materialu updatuj_kontejner_flag(p_mesh, p_mat); Optimalizace jmen objektu lo_kontejner_jedinecne_jmena(p_mesh,FALSE); p_mesh->kontejner_ID = kont_id; if(low) { game_mesh_save_kont_low_name(f,p_mesh); } else { game_mesh_save_kont_name(f,p_mesh,kont); } game_mesh_save_kont_low_id(f, p_mesh); game_mesh_save_kont_id(f,p_mesh->kontejner_ID); game_mesh_save_kont_flag(f,p_mesh); game_mesh_save_kont_flag_ext(f,p_mesh); game_mesh_save_kont_flag_ext_2(f,p_mesh); game_mesh_save_kont_obb(f, p_mesh); Podle transformacniho flagu transf_stat transf_stat = (p_mesh->kflag&KONT_STATIC && transf_stat); if(!transf_stat) { game_mesh_save_kont_wmatrix(f, p_mesh, &p_mesh->world); game_mesh_save_kont_mpmatrix(f, p_mesh, &p_mesh->mpmatrix); } else { GLMATRIX m; init_matrix(&m); game_mesh_save_kont_wmatrix(f,p_mesh,&m); game_mesh_save_kont_mpmatrix(f,p_mesh,&m); } i = game_mesh_save_kont_mesh(f,p_mesh,p_mat,max_mat, transf_stat ? kont_world_matrix(p_mesh) : NULL); // Uloz key-framy if(p_mesh->kflag&KONT_KEYFRAME) { for(i = 0; i < KONT_MAX_ANIM; i++) { if(p_mesh->sim[i].keynum) { key_sim_root_vloz_pivoty_do_animace(p_mesh, p_mesh->sim+i); game_mesh_save_sim(f, p_mesh->sim+i); } } } Uloz svetla tohoto kontejneru game_mesh_save_static_light_mesh(f,p_mesh->p_slight,p_mat); game_mesh_save_dyn_light_mesh(f, p_mesh->p_dlight); game_mesh_save_extra_light_mesh(f, p_mesh->p_edlight); Uloz mlho-kostky game_mesh_save_mlhokostku(f, p_mesh->p_mlha, TRUE); return(i); } */ /* int lo_uloz_kontejner_chunk(FHANDLE *f, EDIT_MATERIAL **p_mat, int max_mat, GAME_MESH *p_mesh, int low) { Uloz materialy lo_uloz_materialy_chunk_kont(f, p_mat, max_mat, p_mesh, FALSE); Uloz kontejner game_mesh_save_kontejner(f, p_mesh, p_mat, max_mat, low, K_CHYBA, K_CHYBA, FALSE); Uloz mlho-kostky game_mesh_save_mlhokostku(f, p_kont->p_mlha, TRUE); return(TRUE); } */ /* * Loading routines */ int game_mesh_load_kont_name(FHANDLE *f, DATA_CHUNK *p_ch) { int i; if(p_ch->type == CHUNK_KONT_NAME) { f->read(&i,sizeof(i)); f->read_string(kont_name,MAX_NAME); } else if(p_ch->type == CHUNK_KONT_LOW_NAME) { f->read_string(kont_name,MAX_NAME); } else { return(FALSE); } pprintf("Kont name %s",kont_name); mesh_new(kont_name); return(TRUE); } int game_mesh_load_kont_id(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_KONT_ID) { f->read(&kont_name_ID,sizeof(kont_name_ID),TRUE); p_mesh->name_ID_set(kont_name_ID); return(TRUE); } else if(p_ch->type == CHUNK_KONT_LOW_ID) { f->read(&kont_name_ID,sizeof(kont_name_ID)); p_mesh->name_ID_set(kont_name_ID); return(TRUE); } else { return(FALSE); } } int game_mesh_load_kont_flag(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_KONT_FLAG) { f->read(&kont_flag,sizeof(kont_flag)); return(TRUE); } else if(p_ch->type == CHUNK_KONT_FLAG_EXT_2) { f->read(&kont_flag2,sizeof(kont_flag2)); return(TRUE); } else if(p_ch->type == CHUNK_KONT_FLAG_EXT) { f->read(&kont_material_flag,sizeof(kont_material_flag)); f->read(&kont_material_flag2,sizeof(kont_material_flag2)); return(TRUE); } else return(FALSE); } int game_mesh_load_kont_obb(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_KONT_OBB) { OBB tmp; f->read(&tmp.dir,sizeof(tmp.dir),TRUE); f->read(&tmp.center,sizeof(tmp.center),TRUE); f->read(&tmp.len,sizeof(tmp.len),TRUE); f->read(&tmp.border,sizeof(tmp.border),TRUE); f->seek(sizeof(VECT)*2,SEEK_CUR); p_mesh->object_box_set(&tmp); return(TRUE); } else return(FALSE); } int game_mesh_load_kont_matrix(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_KONT_WMATRIX) { GLMATRIX m; if(f->read(&m,sizeof(m)) == sizeof(m)) { p_mesh->world_set(&m); } return(TRUE); } else { return(FALSE); } /* if(p_ch->type == CHUNK_KONT_MPMATRIX) { GLMATRIX m; if(f->read(&m,sizeof(m)) == sizeof(m)) { } //p_kont->kflag |= KONT_MPMATRIX; //file_read(&p_kont->mpmatrix,sizeof(p_kont->mpmatrix),1,f); return(TRUE); } else return(FALSE); */ } int game_mesh_load_mesh_name(FHANDLE *f, DATA_CHUNK *p_ch) { char name[MAX_NAME] = ""; char name_parent[MAX_NAME] = ""; if(p_ch->type == CHUNK_OBJ_NAME) { f->read_string(name,MAX_NAME); strncpy(name_parent,kont_name,MAX_NAME); } else if(p_ch->type == CHUNK_OBJ_NAME_PARENT) { f->read_string(name,MAX_NAME); f->read_string(name_parent,MAX_NAME); } else { return(FALSE); } mesh_new(name,name_parent); return(TRUE); } int game_mesh_load_mesh_ID(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_ID) { int name_ID; f->read(&name_ID,sizeof(name_ID),TRUE); p_mesh->name_ID_set(name_ID); return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_pivot(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_PIVOT) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); f->read(p_geom->pivot_get(),sizeof(VECT),TRUE); p_mesh->unlock(LOCK_UNCHANGED); return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_obb(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_OBB) { OBB tmp; f->read(&tmp.dir,sizeof(tmp.dir),TRUE); f->read(&tmp.center,sizeof(tmp.center),TRUE); f->read(&tmp.len,sizeof(tmp.len),TRUE); f->read(&tmp.border,sizeof(tmp.border),TRUE); f->seek(sizeof(VECT)*2,SEEK_CUR); p_mesh->object_box_set(&tmp); return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_material(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_MATERIAL) { char material_name[MAX_FILENAME]; f->read_string(material_name,MAX_FILENAME); //pdebug("%s: material name '%s'",__FUNCTION__,material_name); p_mat = p_scene->material_get(material_name); if(!p_mat) { pprintf("Can't find material %s",material_name); } return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_matrix(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_MATRIX_KEY) { GLMATRIX m; if(f->read(&m,sizeof(m)) == sizeof(m)) { p_mesh->world_set(&m); } return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_vertex(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_VERTEXES) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); int vertexes; f->read(&vertexes,sizeof(dword),TRUE); p_geom->vertex_new(vertexes); VECT *p_vert = p_geom->position_get(); int i; float v[3]; for(i = 0; i < vertexes; i++) { f->read(&v,sizeof(v),TRUE); p_vert[i].x = v[0]; p_vert[i].y = v[1]; p_vert[i].z = v[2]; } p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_normal(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_NORMAL) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); int vertexes; f->read(&vertexes,sizeof(dword),TRUE); VECT *p_vert = p_geom->normal_get(); int i; float v[3]; for(i = 0; i < vertexes; i++) { f->read(&v,sizeof(v),TRUE); p_vert[i].x = v[0]; p_vert[i].y = v[1]; p_vert[i].z = v[2]; } p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_face(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_FACES) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); int faces; f->read(&faces,sizeof(faces),TRUE); word *p_tmp = (word *)mmalloc(sizeof(word)*faces); f->read(p_tmp,sizeof(p_tmp[0])*faces,TRUE); p_geom->face_new(faces); int i; for(i = 0; i < faces; i++) p_geom->face_set(i,p_tmp[i]); p_mesh->unlock(); return(TRUE); } else if(p_ch->type == CHUNK_OBJ_FACES_OPT) { /* if(!file_read(&p_obj->optnum,sizeof(p_obj->optnum),1,f)) chyba("Cteni"); p_obj->p_opt = (int *)mmalloc(sizeof(p_obj->p_opt[0])*p_obj->optnum); if(!file_read(p_obj->p_opt,sizeof(p_obj->p_opt[0]),p_obj->optnum,f)) chyba("Cteni"); */ return(TRUE); } else return(FALSE); } int game_mesh_load_mesh_maps(FHANDLE *f, DATA_CHUNK *p_ch) { int num; switch(p_ch->type) { case CHUNK_OBJ_MAPS_1: num = 0; break; case CHUNK_OBJ_MAPS_2: num = 1; break; case CHUNK_OBJ_MAPS_3: num = 2; break; case CHUNK_OBJ_MAPS_4: num = 3; break; default: return(FALSE); } MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); int vertexes; f->read(&vertexes,sizeof(dword),TRUE); VECTUV *p_vert = p_geom->uv_get(num); float m[2]; int i; for(i = 0; i < vertexes; i++) { f->read(&m,sizeof(m),TRUE); p_vert[i].u = m[0]; p_vert[i].v = m[1]; } p_mesh->unlock(); return(TRUE); } int game_mesh_load_mesh_color(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_OBJ_COLOR) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); int vertexes; f->read(&vertexes,sizeof(dword),TRUE); RGBAF *p_vert = p_geom->diffuse_get(); int i; float v[4]; for(i = 0; i < vertexes; i++) { f->read(&v,sizeof(v),TRUE); p_vert[i].r = v[0]; p_vert[i].g = v[1]; p_vert[i].b = v[2]; } p_mesh->unlock(); return(TRUE); } if(p_ch->type == CHUNK_OBJ_COLOR_EXT) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); int vertexes; f->read(&vertexes,sizeof(dword),TRUE); RGBF *p_spec = p_geom->specular_get(1); RGBF *p_spec_base = p_geom->specular_get(); RGBAF *p_diff = p_geom->diffuse_get(1); RGBAF *p_diff_base = p_geom->diffuse_get(0); int i; float v[4]; for(i = 0; i < vertexes; i++) { f->read(&v,sizeof(v),TRUE); p_diff[i].r = v[0]; p_diff[i].g = v[1]; p_diff[i].b = v[2]; p_diff[i].a = v[3]; f->read(&v,sizeof(v),TRUE); p_diff_base[i].r = v[0]; p_diff_base[i].g = v[1]; p_diff_base[i].b = v[2]; p_diff_base[i].a = v[3]; f->read(&v,sizeof(v),TRUE); p_spec[i].r = v[0]; p_spec[i].g = v[1]; p_spec[i].b = v[2]; f->read(&v,sizeof(v),TRUE); p_spec_base[i].r = v[0]; p_spec_base[i].g = v[1]; p_spec_base[i].b = v[2]; } p_mesh->unlock(); return(TRUE); } else { return(FALSE); } } /* JOINT * lo_najdi_joint(JOINT *p_joint, int ID) { JOINT *t1; if(!p_joint) return(NULL); if(p_joint->joint_ID == ID) { return(p_joint); } else { if((t1 = lo_najdi_joint(p_joint->p_child,ID))) return(t1); if((t1 = lo_najdi_joint(p_joint->p_next,ID))) return(t1); return(NULL); } } */ int game_mesh_load_mesh_joint_ID(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint_animace && p_ch->type == CHUNK_OBJ_JNT_ID) { JOINT *p_jnt = key_joint_vyrob(); int ID; int prev_ID; // oflaguj kontejner p_kont->k2flag |= KONT2_JOINT_ANIM; p_kont->kflag |= KONT_VERTEX_LIGHT; p_kont->kflag &= ~KONT_STATIC; file_read(&ID,sizeof(ID),1,f); file_read(&prev_ID,sizeof(prev_ID),1,f); p_joint = p_jnt; if(prev_ID == ROOT_ID) { if(!p_joint_animace->p_child) { p_joint_animace->p_child = p_joint; } else { p_joint->p_next = p_joint_animace->p_child->p_next; p_joint_animace->p_child->p_next = p_joint; } } else { JOINT *p_prev = lo_najdi_joint(p_joint_animace->p_child,prev_ID); if(p_prev->p_child) { p_joint->p_next = p_prev->p_next; p_prev->p_next = p_joint; } else { p_prev->p_child = p_joint; } } p_joint->joint_ID = ID; } */ return(TRUE); } int game_mesh_load_mesh_joint_pivot(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint && p_ch->type == CHUNK_OBJ_JNT_PIVOT) { file_read(&p_joint->pivot,sizeof(p_joint->pivot),1,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_flag(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint && p_ch->type == CHUNK_OBJ_JNT_FLAG) { file_read(&p_joint->flag,sizeof(p_joint->flag),1,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_vertex(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint && p_ch->type == CHUNK_OBJ_JNT_VERT) { file_read(&p_joint->vertexnum,sizeof(p_joint->vertexnum),1,f); p_joint->p_vertexlist = (int *)mmalloc(sizeof(p_joint->p_vertexlist[0])*p_joint->vertexnum); file_read(p_joint->p_vertexlist,sizeof(p_joint->p_vertexlist[0]),p_joint->vertexnum,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_pos(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint && p_ch->type == CHUNK_OBJ_JNT_POS) { file_read(&p_joint->pos_keys,sizeof(p_joint->pos_keys),1,f); p_joint->p_pos = (BOD *)mmalloc(sizeof(p_joint->p_pos[0])*p_joint->pos_keys); file_read(p_joint->p_pos,sizeof(p_joint->p_pos[0]),p_joint->pos_keys,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_rot(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint && p_ch->type == CHUNK_OBJ_JNT_ROT) { file_read(&p_joint->rot_keys,sizeof(p_joint->rot_keys),1,f); p_joint->p_rot = (QUAT *)mmalloc(sizeof(p_joint->p_rot[0])*p_joint->rot_keys); file_read(p_joint->p_rot,sizeof(p_joint->p_rot[0]),p_joint->rot_keys,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_scs(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint && p_ch->type == CHUNK_OBJ_JNT_SCS) { file_read(&p_joint->scs_keys,sizeof(p_joint->scs_keys),1,f); p_joint->p_scs = (BOD *)mmalloc(sizeof(p_joint->p_scs[0])*p_joint->scs_keys); file_read(p_joint->p_scs,sizeof(p_joint->p_scs[0]),p_joint->scs_keys,f); } */ return(TRUE); } // Spline klice int game_mesh_load_mesh_joint_pos_spline(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* JOINT_KEYS *p_key; if(p_joint && p_ch->type == CHUNK_OBJ_JNT_KEYPOS) { if(!p_joint->p_keys) { p_key = p_joint->p_keys = (JOINT_KEYS *)mmalloc(sizeof(p_joint->p_keys[0])); } p_key = p_joint->p_keys; file_read(&p_key->pos_keys,sizeof(p_key->pos_keys),1,f); p_key->p_pos = (BOD *)mmalloc(sizeof(p_key->p_pos[0])*p_key->pos_keys); file_read(p_key->p_pos,sizeof(p_key->p_pos[0]),p_key->pos_keys,f); p_key->p_pkeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_key->p_pkeys[0])*p_key->pos_keys); file_read(p_key->p_pkeys,sizeof(p_key->p_pkeys[0]),p_key->pos_keys,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_rot_spline(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* JOINT_KEYS *p_key; if(p_joint && p_ch->type == CHUNK_OBJ_JNT_KEYROT) { if(!p_joint->p_keys) { p_key = p_joint->p_keys = (JOINT_KEYS *)mmalloc(sizeof(p_joint->p_keys[0])); } p_key = p_joint->p_keys; file_read(&p_key->rot_keys,sizeof(p_key->rot_keys),1,f); p_key->p_rot = (QUAT *)mmalloc(sizeof(p_key->p_rot[0])*p_key->rot_keys); file_read(p_key->p_rot,sizeof(p_key->p_rot[0]),p_key->rot_keys,f); p_key->p_rkeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_key->p_rkeys[0])*p_key->rot_keys); file_read(p_key->p_rkeys,sizeof(p_key->p_rkeys[0]),p_key->rot_keys,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_scs_spline(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* JOINT_KEYS *p_key; if(p_joint && p_ch->type == CHUNK_OBJ_JNT_KEYSCS) { if(!p_joint->p_keys) { p_key = p_joint->p_keys = (JOINT_KEYS *)mmalloc(sizeof(p_joint->p_keys[0])); } p_key = p_joint->p_keys; file_read(&p_key->scs_keys,sizeof(p_key->scs_keys),1,f); p_key->p_scale = (BOD *)mmalloc(sizeof(p_key->p_scale[0])*p_key->scs_keys); file_read(p_key->p_scale,sizeof(p_key->p_scale[0]),p_key->scs_keys,f); p_key->p_skeys = (KEY_POINT_BRS *)mmalloc(sizeof(p_key->p_skeys[0])*p_key->scs_keys); file_read(p_key->p_skeys,sizeof(p_key->p_skeys[0]),p_key->scs_keys,f); } */ return(TRUE); } int game_mesh_load_mesh_joint_anim(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_ch->type == CHUNK_OBJ_JA) { JOINT_ANIMACE *p_anim = (JOINT_ANIMACE *)mmalloc(sizeof(p_anim[0])); str_read(p_anim->name,f); p_anim->p_next = p_joint_animace; p_joint_animace = p_anim; p_joint_animace->p_next = p_obj->p_joit_animace; p_obj->p_joit_animace = p_joint_animace; } */ return(TRUE); } int game_mesh_load_mesh_joint_frames(FHANDLE *f, DATA_CHUNK *p_ch) { return(FALSE); /* if(p_joint_animace && p_ch->type == CHUNK_OBJ_JA_FRAME_NUM) { file_read(&p_joint_animace->framenum,sizeof(p_joint_animace->framenum),1,f); } */ return(TRUE); } static CHUNK_LOADER game_mesh_loaders[]; // ************************************************************************* // Load/Save routines - Materials // ************************************************************************* private: MESH_MATERIAL *p_mat; private: MESH_MATERIAL * material_new(void) { p_mat = p_scene->material_create(); //p_mat->mark_set(MARK_LOADED); return(p_mat); } private: /* * Material Load/save Chunks */ #define CHUNK_MATERIAL 10 // Material name #define CHUNK_COLOR 11 // Colors #define CHUNK_MATANIM 12 // Material animations #define CHUNK_STAG_TAG 13 // stage tagy (cislo stagu + jejich cisla) #define CHUNK_COLOR_EXT 20 // extended colors #define CHUNK_SHINE 21 // sila odlesku #define CHUNK_FLAGS 22 // flagy materialu #define CHUNK_ENVSPEC 26 // spec-env udaje #define CHUNK_ALFA_STAGE 27 // alfa nastavenni materialu (pruhledny,pouzity,src,dest) #define CHUNK_TEXT_STAGE_1 28 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_2 29 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_3 30 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_4 31 // multi tag, pred texturou #define CHUNK_TEXT_1 16 // textura, k multi tagu #define CHUNK_TEXT_2 18 // textura, k multi tagu #define CHUNK_TEXT_3 32 // textura, k multi tagu #define CHUNK_TEXT_4 33 // textura, k multi tagu #define CHUNK_MATANIM_T1 34 // animace textur 1 #define CHUNK_MATANIM_T2 35 // animace textur 2 #define CHUNK_MATANIM_T3 36 // animace textur 3 #define CHUNK_MATANIM_T4 37 // animace textur 4 #define CHUNK_MATMATRIX_EXT 50 // animacni matice textury 1 #define CHUNK_TEXT_STAGE_AD_1 51 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_AD_2 52 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_AD_3 53 // multi tag, pred texturou #define CHUNK_TEXT_STAGE_AD_4 54 // multi tag, pred texturou #define CHUNK_TEXT_FLAG_1 55 // textura, k multi tagu #define CHUNK_TEXT_FLAG_2 56 // textura, k multi tagu #define CHUNK_TEXT_FLAG_3 57 // textura, k multi tagu #define CHUNK_TEXT_FLAG_4 58 // textura, k multi tagu #define CHUNK_MATANIM_EXT 60 // animace materialu #define CHUNK_MATANIM_FRAME 61 // frame materialu #define CHUNK_MAT_SMAT_POS 62 // pozice s-materialu #define CHUNK_MAT_TEXGEN 63 // pozice s-materialu #define CHUNK_MATANIM_EFRAME 64 // frame materialu /* * Material save routines */ int mesh_material_save_name(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; ch.type = CHUNK_MATERIAL; ch.size = sizeof(ch)+sizeof(char)*(strlen(p_mat->name_get())+1); f->write(&ch,sizeof(ch)); f->write_string(p_mat->name_get()); return(TRUE); } int mesh_material_save_flags(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; int flag = 0, flag2 = 0; ch.type = CHUNK_FLAGS; ch.size = sizeof(ch)+sizeof(flag)+sizeof(flag2); f->write(&ch,sizeof(ch)); f->write(&flag,sizeof(flag)); f->write(&flag2,sizeof(flag2)); return(TRUE); } /* TODO int mesh_material_save_smat_pos(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; if(flag&MAT_SCENE) { ch.type = CHUNK_MAT_SMAT_POS; ch.size = sizeof(ch)+sizeof(smaterial_pozice); f->write(&ch,sizeof(ch)); f->write(&smaterial_pozice,sizeof(smaterial_pozice)); } } */ int mesh_material_save_color(FHANDLE *f, MESH_MATERIAL *p_mat) { char string[16]; DATA_CHUNK ch; ch.type = CHUNK_COLOR_EXT; ch.size = sizeof(ch)+16; memset(string,0,sizeof(string)); RGBAB diff(p_mat->diffuse_get()); string[4] = diff.r; string[5] = diff.g; string[6] = diff.b; string[7] = diff.a; RGBB spec(p_mat->specular_get()); string[8] = spec.r; string[9] = spec.g; string[10] = spec.b; string[11] = MAX_BYTE; f->write(&ch,sizeof(ch)); f->write(string,sizeof(char)*16); return(TRUE); } /* TODO int mesh_material_save_matanim_frame(FHANDLE *f, ANIM_FRAME *p_fram, int frame) { EDIT_TEXT *p_text; DATA_CHUNK ch; int flag; if(p_fram) { p_text = p_fram->p_text; ch.type = CHUNK_MATANIM_EFRAME; ch.size = sizeof(ch)+strlen(p_text->name)+1+sizeof(p_text->flag) +sizeof(p_fram->time)+sizeof(p_fram->alfa)+sizeof(p_fram->u) +sizeof(p_fram->v)+sizeof(p_fram->flag)+sizeof(frame); f->write(&ch,sizeof(ch)); f->write(&frame,sizeof(frame)); f->write(&p_fram->time,sizeof(p_fram->time)); f->write(&p_fram->alfa,sizeof(p_fram->alfa)); f->write(&p_fram->u,sizeof(p_fram->u)); f->write(&p_fram->v,sizeof(p_fram->v)); f->write(&p_fram->flag,sizeof(p_fram->flag)); //Prdy z vody - ulozim rovnou texturu p_text = p_fram->p_text; flag = p_text->flag; f->write(&p_text->name,sizeof(char),strlen(p_text->name)+1,f); f->write(&flag,sizeof(flag)); return(TRUE); } else return(FALSE); } int mesh_material_save_matanim(FHANDLE *f, MESH_MATERIAL *p_mat) { ANIM_MATERIAL *p_anim = &anim; DATA_CHUNK ch; int i; if(flag&MAT_ANIM_FRAME) { ch.type = CHUNK_MATANIM_EXT; ch.size = sizeof(ch)+strlen(anim.name)+1+sizeof(p_anim->framenum); f->write(&ch,sizeof(ch)); f->write(p_anim->name,sizeof(char),strlen(p_anim->name)+1,f); f->write(&p_anim->framenum,sizeof(p_anim->framenum)); for(i = 0; i < p_anim->framenum; i++) { save_mat_matanim_frame(f, p_anim->p_frame+i, i); } return(TRUE); } else return(FALSE); } int mesh_material_save_matanim_text_dal(FHANDLE *f, ANIM_TEXT *p_track, int typ) { DATA_CHUNK ch; int velikost = 0; if(p_track->pos_keys && p_track->p_pos) { velikost += sizeof(p_track->p_pos[0])*p_track->pos_keys+ sizeof(p_track->p_pkeys[0])*p_track->pos_keys; } if(p_track->piv_keys && p_track->p_piv) { velikost += sizeof(p_track->p_piv[0])*p_track->piv_keys+ sizeof(p_track->p_vkeys[0])*p_track->piv_keys; } if(p_track->rot_keys && p_track->p_rot) { velikost += sizeof(p_track->p_rot[0])*p_track->rot_keys+ sizeof(p_track->p_rkeys[0])*p_track->rot_keys; } if(p_track->scs_keys && p_track->p_scale) { velikost += sizeof(p_track->p_scale[0])*p_track->scs_keys+ sizeof(p_track->p_skeys[0])*p_track->scs_keys; } ch.type = typ; ch.size = sizeof(ch)+sizeof(p_track[0])+velikost; f->write(&ch,sizeof(ch)); f->write(p_track,sizeof(p_track[0])); if(p_track->pos_keys && p_track->p_pos) { f->write(p_track->p_pos,sizeof(p_track->p_pos[0]),p_track->pos_keys,f); f->write(p_track->p_pkeys,sizeof(p_track->p_pkeys[0]),p_track->pos_keys,f); } if(p_track->piv_keys && p_track->p_piv) { f->write(p_track->p_piv,sizeof(p_track->p_piv[0]),p_track->piv_keys,f); f->write(p_track->p_vkeys,sizeof(p_track->p_vkeys[0]),p_track->piv_keys,f); } if(p_track->rot_keys && p_track->p_rot) { f->write(p_track->p_rot,sizeof(p_track->p_rot[0]),p_track->rot_keys,f); f->write(p_track->p_rkeys,sizeof(p_track->p_rkeys[0]),p_track->rot_keys,f); } if(p_track->scs_keys && p_track->p_scale) { f->write(p_track->p_scale,sizeof(p_track->p_scale[0]),p_track->scs_keys,f); f->write(p_track->p_skeys,sizeof(p_track->p_skeys[0]),p_track->scs_keys,f); } return(TRUE); } int mesh_material_save_matanim_text(FHANDLE *f, MESH_MATERIAL *p_mat) { int i,j; for(j = 0; j < MAT_TEXTUR; j++) { if(flag&glstav_posun_flagy2[j]) { for(i = 0; i < MAX_TEXT_ANIM; i++) { if(p_atext[j][i]) { save_mat_matanim_text_dal(f, p_atext[j][i],CHUNK_MATANIM_T1+j); } } } } return(TRUE); } */ int mesh_material_save_textmatrix(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; ch.type = CHUNK_MATMATRIX_EXT; ch.size = sizeof(ch)+4*sizeof(GLMATRIX); f->write(&ch,sizeof(ch)); f->write(p_mat->text_coordinates_get(0)->text_matrix_get(),sizeof(GLMATRIX)); f->write(p_mat->text_coordinates_get(1)->text_matrix_get(),sizeof(GLMATRIX)); f->write(p_mat->text_coordinates_get(2)->text_matrix_get(),sizeof(GLMATRIX)); f->write(p_mat->text_coordinates_get(3)->text_matrix_get(),sizeof(GLMATRIX)); return(TRUE); } int mesh_material_save_texgen_param(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; ch.type = CHUNK_MAT_TEXGEN; ch.size = sizeof(ch)+4*(sizeof(float)*4); f->write(&ch,sizeof(ch)); /* TODO f->write(texgen_koord_t,sizeof(texgen_koord_t)); f->write(texgen_koord_s,sizeof(texgen_koord_s)); f->write(texgen_koord_r,sizeof(texgen_koord_r)); f->write(texgen_koord_q,sizeof(texgen_koord_q)); */ float t[4]; f->write(&t,sizeof(t)); f->write(&t,sizeof(t)); f->write(&t,sizeof(t)); f->write(&t,sizeof(t)); return(TRUE); } int mesh_material_save_blend(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; ch.type = CHUNK_ALFA_STAGE; ch.size = sizeof(ch)+sizeof(int); int state = p_mat->alpha_func_get(); f->write(&ch,sizeof(ch)); f->write(&state,sizeof(int)); return(TRUE); } /* TODO int mesh_material_save_env_spec(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; ch.type = CHUNK_ENVSPEC; ch.size = sizeof(ch)+ sizeof(env_add1)+ sizeof(env_add2)+ sizeof(env_scale)+ sizeof(env_r)+ sizeof(env_g)+ sizeof(env_b); f->write(&ch,sizeof(ch)); f->write(&env_add1,sizeof(env_add1)); f->write(&env_add2,sizeof(env_add2)); f->write(&env_scale,sizeof(env_scale)); f->write(&env_r,sizeof(env_r)); f->write(&env_g,sizeof(env_g)); f->write(&env_b,sizeof(env_b)); return(TRUE); } */ int mesh_material_save_text_blend_ext(FHANDLE *f, MESH_MATERIAL *p_mat, int num) { DATA_CHUNK ch; ch.type = CHUNK_TEXT_STAGE_AD_1+num; ch.size = sizeof(ch)+ sizeof(int)*1+ sizeof(int)*4+ sizeof(int)*4+ sizeof(int)*4+ sizeof(float)*4; f->write(&ch,sizeof(ch)); MATERIAL_TEXT_CONFIG *p_conf = p_mat->text_config_get(num); f->write(&p_conf->text_operator,sizeof(int)); int tmp[4] = {0,0,0,0}; tmp[0] = p_conf->text_index; f->write(&tmp,sizeof(int)*4,f); tmp[0] = p_conf->text_coordinates; f->write(&tmp,sizeof(int)*4,f); tmp[0] = 0; f->write(&tmp,sizeof(int)*4,f); float t[4] = {0,0,0,0}; f->write(&t,sizeof(float)*4,f); return(TRUE); } int mesh_material_save_text(FHANDLE *f, MESH_MATERIAL *p_mat, int num, int type) { DATA_CHUNK ch; MATERIAL_TEXT *p_text = p_mat->texture_get(num); if(p_text) { ch.type = type; ch.size = sizeof(ch)+strlen(p_text->name_get())+1; f->write(&ch,sizeof(ch)); f->write_string(p_text->name_get()); return(TRUE); } else return(FALSE); } int mesh_material_save_text_flag(FHANDLE *f, MESH_MATERIAL *p_mat, int num, int type) { DATA_CHUNK ch; if(p_mat) { ch.type = type; ch.size = sizeof(ch)+sizeof(int); int tmp = 0; f->write(&ch,sizeof(ch)); f->write(&tmp,sizeof(tmp)); return(TRUE); } else return(FALSE); } int mesh_material_save_shine(FHANDLE *f, MESH_MATERIAL *p_mat) { DATA_CHUNK ch; ch.type = CHUNK_SHINE; ch.size = sizeof(ch)+sizeof(float); f->write(&ch,sizeof(ch)); float shine = p_mat->shine_get(); f->write(&shine,sizeof(float)); return(TRUE); } // ************************************************************************* // Saves complete material to file // ************************************************************************* bool mesh_material_save(FHANDLE *f, MESH_MATERIAL *p_mat) { pdebug(DEBUG_LOAD_CHUNK,"Saving material %s",p_mat->name_get()); mesh_material_save_name(f,p_mat); mesh_material_save_flags(f,p_mat); mesh_material_save_color(f,p_mat); //mesh_material_save_matanim(f); //mesh_material_save_matanim_text(f); //mesh_material_save_textmatrix(f); //mesh_material_save_texgen_param(f); //mesh_material_save_blend(f); //mesh_material_save_env_spec(f); //mesh_material_save_smat_pos(f,p_mat); int i; int text_flags[] = { CHUNK_TEXT_FLAG_1, CHUNK_TEXT_FLAG_2, CHUNK_TEXT_FLAG_3, CHUNK_TEXT_FLAG_4 }; int text_nums[] = { CHUNK_TEXT_1, CHUNK_TEXT_2, CHUNK_TEXT_3, CHUNK_TEXT_4 }; for(i = 0; i < 4; i++) { mesh_material_save_text_blend_ext(f, p_mat, i); mesh_material_save_text_flag(f, p_mat, i, text_flags[i]); mesh_material_save_text(f, p_mat, i, text_nums[i]); } return(TRUE); } // ************************************************************************* // Material loading // ************************************************************************* int mesh_material_load_mat(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_MATERIAL) { char name[MAX_NAME]; f->read_string(name,MAX_NAME); material_new(); p_mat->name_set(name); pprintf("Material name %s",name); return(TRUE); } else return(FALSE); } int mesh_material_load_mat_flags(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_FLAGS) { int flag, flag2; f->read(&flag,sizeof(flag)); f->read(&flag2,sizeof(flag2)); return(TRUE); } else return(FALSE); } int mesh_material_load_mat_smat_pos(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* if(p_ch->type == CHUNK_MAT_SMAT_POS) { f->read(&smaterial_pozice,sizeof(smaterial_pozice)); return(TRUE); } else */ return(FALSE); } int mesh_material_load_color(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_COLOR) { char string[16]; f->read(string,sizeof(char)*16); RGBAF diff(string[3],string[4],string[5],(byte)MAX_BYTE); RGBF spec(string[6],string[7],string[8]); p_mat->diffuse_set(&diff); p_mat->specular_set(&spec); return(TRUE); } else if (p_ch->type == CHUNK_COLOR_EXT) { char string[16]; f->read(string,sizeof(byte)*16); /* p_dxmat->ambient_r = (float)string[0]/MAX_BYTE; p_dxmat->ambient_g = (float)string[1]/MAX_BYTE; p_dxmat->ambient_b = (float)string[2]/MAX_BYTE; p_dxmat->ambient_a = (float)string[3]/MAX_BYTE; */ RGBAF diff(string[3],string[4],string[5],(byte)MAX_BYTE); RGBF spec(string[6],string[7],string[8]); p_mat->diffuse_set(&diff); p_mat->specular_set(&spec); /* p_dxmat->faktor_r = (float)string[12]/MAX_BYTE; p_dxmat->faktor_g = (float)string[13]/MAX_BYTE; p_dxmat->faktor_b = (float)string[14]/MAX_BYTE; p_dxmat->faktor_a = (float)string[15]/MAX_BYTE; */ return(TRUE); } else { return(FALSE); } } int mesh_material_load_matanim_frame(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* ANIM_FRAME *p_fram; int frame,t; int flag = 0; if(p_fanim && p_ch->type == CHUNK_MATANIM_FRAME) { file_read(&frame,sizeof(frame)); assert(frame < p_fanim->framenum); p_fram = p_fanim->p_frame+frame; str_read(p_fram->file,f); file_read(&p_fram->time,sizeof(p_fram->time)); file_read(&p_fram->alfa,sizeof(p_fram->alfa)); file_read(&p_fram->u,sizeof(p_fram->u)); file_read(&p_fram->v,sizeof(p_fram->v)); file_read(&p_fram->flag,sizeof(p_fram->flag)); if((t = lo_najdi_texturu(p_textlist,textlistnum,p_fram->file,flag)) == ERROR) { if((t = lo_najdi_volnou_texturu(p_textlist,textlistnum)) == ERROR) chyba("Neni volna textura !"); strcpy(p_textlist[t].name, p_fram->file); p_textlist[t].flag = flag; } p_fram->p_text = p_textlist+t; return(TRUE); } else */ return(FALSE); } int mesh_material_load_matanim_frame_ext(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* ANIM_FRAME *p_fram; int frame,t; int flag = 0; if(p_fanim && p_ch->type == CHUNK_MATANIM_EFRAME) { file_read(&frame,sizeof(frame)); assert(frame < p_fanim->framenum); p_fram = p_fanim->p_frame+frame; file_read(&p_fram->time,sizeof(p_fram->time)); file_read(&p_fram->alfa,sizeof(p_fram->alfa)); file_read(&p_fram->u,sizeof(p_fram->u)); file_read(&p_fram->v,sizeof(p_fram->v)); file_read(&p_fram->flag,sizeof(p_fram->flag)); // Load name a flag textury str_read(p_fram->file,f); file_read(&flag,sizeof(flag)); if((t = lo_najdi_texturu(p_textlist,textlistnum,p_fram->file,flag))==ERROR) { if((t = lo_najdi_volnou_texturu(p_textlist,textlistnum)) == ERROR) chyba("Neni volna textura !"); strcpy(p_textlist[t].name, p_fram->file); p_textlist[t].flag = flag; } p_fram->p_text = p_textlist+t; return(TRUE); } else */ return(FALSE); } int mesh_material_load_matanim(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* if(p_ch->type == CHUNK_MATANIM_EXT) { p_fanim = &anim; flag |= MAT_ANIM_FRAME; str_read(p_fanim->name,f); file_read(&p_fanim->framenum,sizeof(p_fanim->framenum)); p_fanim->p_frame = (ANIM_FRAME *)mmalloc(sizeof(p_fanim->p_frame[0])*p_fanim->framenum); return(TRUE); } else */ return(FALSE); } int mesh_material_load_textmatrix(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_MATMATRIX_EXT) { MATERIAL_TEXT_COORDINATES *p_coord; p_coord = p_mat->text_coordinates_get(0); f->read(p_coord->text_matrix_get(),sizeof(GLMATRIX)); p_coord = p_mat->text_coordinates_get(1); f->read(p_coord->text_matrix_get(),sizeof(GLMATRIX)); p_coord = p_mat->text_coordinates_get(2); f->read(p_coord->text_matrix_get(),sizeof(GLMATRIX)); p_coord = p_mat->text_coordinates_get(3); f->read(p_coord->text_matrix_get(),sizeof(GLMATRIX)); return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_texgen_param(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* if(p_ch->type == CHUNK_MAT_TEXGEN) { f->read(texgen_koord_t,sizeof(texgen_koord_t)); f->read(texgen_koord_s,sizeof(texgen_koord_s)); f->read(texgen_koord_r,sizeof(texgen_koord_r)); f->read(texgen_koord_q,sizeof(texgen_koord_q)); return(TRUE); } else */ return(FALSE); } int mesh_material_load_matanim_text_1(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* ANIM_TEXT tmp,*p_track; int i; if(p_ch->type == CHUNK_MATANIM_T1) { flag |= MAT2_T1_MATRIX; for(i = 0; i < MAX_TEXT_ANIM; i++) { if(!p_atext[0][i]) break; } assert(i < MAX_TEXT_ANIM); atextnum[0] = i+1; f->read(&tmp,sizeof(tmp)); p_track = p_atext[0][i] = key_vyrob_material_animace(tmp.pos_keys,tmp.rot_keys,tmp.scs_keys,tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if(p_track->pos_keys) { f->read(p_track->p_pos,sizeof(p_track->p_pos[0]),p_track->pos_keys,f); f->read(p_track->p_pkeys,sizeof(p_track->p_pkeys[0]),p_track->pos_keys,f); } if(p_track->piv_keys) { f->read(p_track->p_piv,sizeof(p_track->p_piv[0]),p_track->piv_keys,f); f->read(p_track->p_vkeys,sizeof(p_track->p_vkeys[0]),p_track->piv_keys,f); } if(p_track->rot_keys) { f->read(p_track->p_rot,sizeof(p_track->p_rot[0]),p_track->rot_keys,f); f->read(p_track->p_rkeys,sizeof(p_track->p_rkeys[0]),p_track->rot_keys,f); } if(p_track->scs_keys) { f->read(p_track->p_scale,sizeof(p_track->p_scale[0]),p_track->scs_keys,f); f->read(p_track->p_skeys,sizeof(p_track->p_skeys[0]),p_track->scs_keys,f); } return(TRUE); } else */ return(FALSE); } int mesh_material_load_matanim_text_2(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* ANIM_TEXT tmp,*p_track; int i; if(p_ch->type == CHUNK_MATANIM_T2) { flag |= MAT2_T2_MATRIX; for(i = 0; i < MAX_TEXT_ANIM; i++) { if(!p_atext[1][i]) break; } assert(i < MAX_TEXT_ANIM); atextnum[1] = i+1; f->read(&tmp,sizeof(tmp)); p_track = p_atext[1][i] = key_vyrob_material_animace(tmp.pos_keys,tmp.rot_keys,tmp.scs_keys,tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if(p_track->pos_keys) { f->read(p_track->p_pos,sizeof(p_track->p_pos[0]),p_track->pos_keys,f); f->read(p_track->p_pkeys,sizeof(p_track->p_pkeys[0]),p_track->pos_keys,f); } if(p_track->piv_keys) { f->read(p_track->p_piv,sizeof(p_track->p_piv[0]),p_track->piv_keys,f); f->read(p_track->p_vkeys,sizeof(p_track->p_vkeys[0]),p_track->piv_keys,f); } if(p_track->rot_keys) { f->read(p_track->p_rot,sizeof(p_track->p_rot[0]),p_track->rot_keys,f); f->read(p_track->p_rkeys,sizeof(p_track->p_rkeys[0]),p_track->rot_keys,f); } if(p_track->scs_keys) { f->read(p_track->p_scale,sizeof(p_track->p_scale[0]),p_track->scs_keys,f); f->read(p_track->p_skeys,sizeof(p_track->p_skeys[0]),p_track->scs_keys,f); } return(TRUE); } else */ return(FALSE); } int mesh_material_load_matanim_text_3(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* ANIM_TEXT tmp,*p_track; int i; if(p_ch->type == CHUNK_MATANIM_T3) { flag |= MAT2_T3_MATRIX; for(i = 0; i < MAX_TEXT_ANIM; i++) { if(!p_atext[2][i]) break; } assert(i < MAX_TEXT_ANIM); atextnum[2] = i+1; f->read(&tmp,sizeof(tmp)); p_track = p_atext[2][i] = key_vyrob_material_animace(tmp.pos_keys,tmp.rot_keys,tmp.scs_keys,tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if(p_track->pos_keys) { f->read(p_track->p_pos,sizeof(p_track->p_pos[0]),p_track->pos_keys,f); f->read(p_track->p_pkeys,sizeof(p_track->p_pkeys[0]),p_track->pos_keys,f); } if(p_track->piv_keys) { f->read(p_track->p_piv,sizeof(p_track->p_piv[0]),p_track->piv_keys,f); f->read(p_track->p_vkeys,sizeof(p_track->p_vkeys[0]),p_track->piv_keys,f); } if(p_track->rot_keys) { f->read(p_track->p_rot,sizeof(p_track->p_rot[0]),p_track->rot_keys,f); f->read(p_track->p_rkeys,sizeof(p_track->p_rkeys[0]),p_track->rot_keys,f); } if(p_track->scs_keys) { f->read(p_track->p_scale,sizeof(p_track->p_scale[0]),p_track->scs_keys,f); f->read(p_track->p_skeys,sizeof(p_track->p_skeys[0]),p_track->scs_keys,f); } return(TRUE); } else */ return(FALSE); } int mesh_material_load_matanim_text_4(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* ANIM_TEXT tmp,*p_track; int i; if(p_ch->type == CHUNK_MATANIM_T4) { flag |= MAT2_T4_MATRIX; for(i = 0; i < MAX_TEXT_ANIM; i++) { if(!p_atext[3][i]) break; } assert(i < MAX_TEXT_ANIM); atextnum[3] = i+1; f->read(&tmp,sizeof(tmp)); p_track = p_atext[3][i] = key_vyrob_material_animace(tmp.pos_keys,tmp.rot_keys,tmp.scs_keys,tmp.piv_keys); p_track->flag = tmp.flag; // flagy animace (loop a pod) p_track->endtime = tmp.endtime; // framenum = 0 - volna animace if(p_track->pos_keys) { f->read(p_track->p_pos,sizeof(p_track->p_pos[0]),p_track->pos_keys,f); f->read(p_track->p_pkeys,sizeof(p_track->p_pkeys[0]),p_track->pos_keys,f); } if(p_track->piv_keys) { f->read(p_track->p_piv,sizeof(p_track->p_piv[0]),p_track->piv_keys,f); f->read(p_track->p_vkeys,sizeof(p_track->p_vkeys[0]),p_track->piv_keys,f); } if(p_track->rot_keys) { f->read(p_track->p_rot,sizeof(p_track->p_rot[0]),p_track->rot_keys,f); f->read(p_track->p_rkeys,sizeof(p_track->p_rkeys[0]),p_track->rot_keys,f); } if(p_track->scs_keys) { f->read(p_track->p_scale,sizeof(p_track->p_scale[0]),p_track->scs_keys,f); f->read(p_track->p_skeys,sizeof(p_track->p_skeys[0]),p_track->scs_keys,f); } return(TRUE); } else */ return(FALSE); } int mesh_material_load_mat_shine(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_SHINE) { float shine; f->read(&shine,sizeof(float)); p_mat->shine_set(shine); return(TRUE); } else { return(FALSE); } } int mesh_material_load_stage(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_STAG_TAG) { int alpha; int text_stage_1; int text_stage_2; f->read(&alpha,sizeof(int)); f->read(&text_stage_1,sizeof(int)); f->read(&text_stage_2,sizeof(int)); MATERIAL_TEXT_CONFIG *p_config = p_mat->text_config_get(0); p_config->active = TRUE; p_config->text_index = 0; p_config->text_operator = text_stage_1; p_config->text_coordinates = 0; p_config = p_mat->text_config_get(1); p_config->active = FALSE; p_config->text_index = 1; p_config->text_operator = text_stage_2; p_config->text_coordinates = 1; return(TRUE); } else return(FALSE); } int mesh_material_load_mat_alfa_stage(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_ALFA_STAGE) { int alpha; f->read(&alpha,sizeof(int)); return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_text_stage_1(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_TEXT_STAGE_1) { int text_stage_1; f->read(&text_stage_1,sizeof(int)); MATERIAL_TEXT_CONFIG *p_config = p_mat->text_config_get(0); p_config->active = TRUE; p_config->text_index = 0; p_config->text_operator = text_stage_1; p_config->text_coordinates = 0; return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_text_stage_2(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_TEXT_STAGE_2) { int text_stage_2; f->read(&text_stage_2,sizeof(int)); MATERIAL_TEXT_CONFIG *p_config = p_mat->text_config_get(1); p_config->active = FALSE; p_config->text_index = 0; p_config->text_operator = text_stage_2; p_config->text_coordinates = 0; return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_text_stage_3(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_TEXT_STAGE_3) { int text_stage_3; f->read(&text_stage_3,sizeof(int)); MATERIAL_TEXT_CONFIG *p_config = p_mat->text_config_get(2); p_config->active = FALSE; p_config->text_index = 0; p_config->text_operator = text_stage_3; p_config->text_coordinates = 0; return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_text_stage_4(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type == CHUNK_TEXT_STAGE_4) { int text_stage_4; f->read(&text_stage_4,sizeof(int)); MATERIAL_TEXT_CONFIG *p_config = p_mat->text_config_get(3); p_config->active = FALSE; p_config->text_index = 0; p_config->text_operator = text_stage_4; p_config->text_coordinates = 0; return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_text_stage_advaced(FHANDLE *f, DATA_CHUNK *p_ch) { if(p_ch->type >= CHUNK_TEXT_STAGE_AD_1 && p_ch->type <= CHUNK_TEXT_STAGE_AD_4) { int stage; int par[4]; int num = p_ch->type-CHUNK_TEXT_STAGE_AD_1; MATERIAL_TEXT_CONFIG *p_config = p_mat->text_config_get(num); p_config->active = !num; f->read(&stage,sizeof(int)); p_config->text_operator = stage; f->read(par,sizeof(par)); p_config->text_index = par[0]; f->read(par,sizeof(par)); p_config->text_coordinates = par[0]; f->read(par,sizeof(par)); //text_config[num].text_func[0] = par[0]; // Texture modification function float tmp[4]; f->read(tmp, sizeof(tmp)); return(TRUE); } else { return(FALSE); } } int mesh_material_load_mat_env_spec(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* if(p_ch->type == CHUNK_ENVSPEC) { f->read(&env_add1,sizeof(env_add1)); f->read(&env_add2,sizeof(env_add2)); f->read(&env_scale,sizeof(env_scale)); f->read(&env_r,sizeof(env_r)); f->read(&env_g,sizeof(env_g)); f->read(&env_b,sizeof(env_b)); return(TRUE); } else */ return(FALSE); } int mesh_material_load_mat_text_flag(FHANDLE *f, DATA_CHUNK *p_ch) { return(chunk_skip(f,p_ch)); /* if(p_mat) { int num = p_ch->typ-CHUNK_TEXT_FLAG_1; f->read(textflag+num,sizeof(textflag[num])); return(TRUE); } else */ return(FALSE); } int mesh_material_load_text(FHANDLE *f, DATA_CHUNK *p_ch) { int num; switch(p_ch->type) { case CHUNK_TEXT_1: num = 0; break; case CHUNK_TEXT_2: num = 1; break; case CHUNK_TEXT_3: num = 2; break; case CHUNK_TEXT_4: num = 3; break; default: return(FALSE); } char filename[MAX_FILENAME]; f->read_string(filename,sizeof(filename)); MATERIAL_TEXT *p_txt = p_scene->texture_get(filename); if(!p_txt) { p_txt = p_scene->texture_create(NULL,filename,NULL); } p_mat->texture_set(num, p_txt); return(TRUE); } private: static CHUNK_LOADER material_loaders[]; private: static CHUNK_GROUP loaders[]; private: bool load(DATA_CHUNK *p_chunk, FHANDLE *f); public: bool load(FHANDLE *f); bool save(FHANDLE *f); public: import_b2m(SCENE *p_scene_ref) { kont_name[0] = '\0'; kont_name_ID = 0; kont_flag = 0; kont_flag2 = 0; kont_material_flag = 0; kont_material_flag2 = 0; p_mesh = NULL; p_mat = NULL; p_scene = p_scene_ref; } ~import_b2m(void) { } } IMPORT_B2M; CHUNK_LOADER import_b2m::game_mesh_loaders[] = { {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_name), CHUNK_KONT_NAME}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_name), CHUNK_KONT_LOW_NAME}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_id), CHUNK_KONT_LOW_ID}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_id), CHUNK_KONT_ID}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_flag), CHUNK_KONT_FLAG}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_flag), CHUNK_KONT_FLAG_EXT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_flag), CHUNK_KONT_FLAG_EXT_2}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_matrix), CHUNK_KONT_WMATRIX}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_matrix), CHUNK_KONT_MPMATRIX}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_kont_obb), CHUNK_KONT_OBB}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_name), CHUNK_OBJ_NAME}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_name), CHUNK_OBJ_NAME_PARENT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_ID), CHUNK_OBJ_ID}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_pivot), CHUNK_OBJ_PIVOT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_material), CHUNK_OBJ_MATERIAL}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_vertex), CHUNK_OBJ_VERTEXES}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_normal), CHUNK_OBJ_NORMAL}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_maps), CHUNK_OBJ_MAPS_1}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_maps), CHUNK_OBJ_MAPS_2}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_maps), CHUNK_OBJ_MAPS_3}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_maps), CHUNK_OBJ_MAPS_4}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_face), CHUNK_OBJ_FACES}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_face), CHUNK_OBJ_FACES_OPT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_color), CHUNK_OBJ_COLOR}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_color), CHUNK_OBJ_COLOR_EXT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_matrix), CHUNK_OBJ_MATRIX_KEY}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_obb), CHUNK_OBJ_OBB}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_anim), CHUNK_OBJ_JA}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_ID), CHUNK_OBJ_JNT_ID}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_frames), CHUNK_OBJ_JA_FRAME_NUM}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_pivot), CHUNK_OBJ_JNT_PIVOT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_flag), CHUNK_OBJ_JNT_FLAG}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_vertex), CHUNK_OBJ_JNT_VERT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_pos), CHUNK_OBJ_JNT_POS}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_rot), CHUNK_OBJ_JNT_ROT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_scs), CHUNK_OBJ_JNT_SCS}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_pos_spline), CHUNK_OBJ_JNT_KEYPOS}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_rot_spline), CHUNK_OBJ_JNT_KEYROT}, {(CHUNK_LOAD_FUNC)(&import_b2m::game_mesh_load_mesh_joint_scs_spline), CHUNK_OBJ_JNT_KEYSCS}, }; CHUNK_LOADER import_b2m::material_loaders[] = { {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat), CHUNK_MATERIAL}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_color), CHUNK_COLOR}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_color), CHUNK_COLOR_EXT}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim), CHUNK_MATANIM_EXT}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim_frame), CHUNK_MATANIM_FRAME}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim_frame_ext), CHUNK_MATANIM_EFRAME}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim_text_1), CHUNK_MATANIM_T1}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim_text_2), CHUNK_MATANIM_T2}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim_text_3), CHUNK_MATANIM_T3}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_matanim_text_4), CHUNK_MATANIM_T4}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_textmatrix), CHUNK_MATMATRIX_EXT}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_stage), CHUNK_STAG_TAG}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_text), CHUNK_TEXT_1}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_text), CHUNK_TEXT_2}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_text), CHUNK_TEXT_3}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_text), CHUNK_TEXT_4}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_shine), CHUNK_SHINE}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_flags), CHUNK_FLAGS}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_smat_pos), CHUNK_MAT_SMAT_POS}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_env_spec), CHUNK_ENVSPEC}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_alfa_stage), CHUNK_ALFA_STAGE}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_1), CHUNK_TEXT_STAGE_1}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_2), CHUNK_TEXT_STAGE_2}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_3), CHUNK_TEXT_STAGE_3}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_4), CHUNK_TEXT_STAGE_4}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_advaced), CHUNK_TEXT_STAGE_AD_1}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_advaced), CHUNK_TEXT_STAGE_AD_2}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_advaced), CHUNK_TEXT_STAGE_AD_3}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_stage_advaced), CHUNK_TEXT_STAGE_AD_4}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_flag), CHUNK_TEXT_FLAG_1}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_flag), CHUNK_TEXT_FLAG_2}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_flag), CHUNK_TEXT_FLAG_3}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_text_flag), CHUNK_TEXT_FLAG_4}, {(CHUNK_LOAD_FUNC)(&import_b2m::mesh_material_load_mat_texgen_param), CHUNK_MAT_TEXGEN} }; CHUNK_GROUP import_b2m::loaders[] = { { import_b2m::game_mesh_loaders, sizeof(import_b2m::game_mesh_loaders) / sizeof(import_b2m::game_mesh_loaders[0]), CHUNK_KONT_NAME, CHUNK_OBJ_JNT_KEYSCS}, { import_b2m::material_loaders, sizeof(import_b2m::material_loaders) / sizeof(import_b2m::material_loaders[0]), CHUNK_MATERIAL, CHUNK_MATANIM_EFRAME}, }; bool chunk_group::check(DATA_CHUNK *p_chunk) { return(p_chunk->type >= chunk_range_min && p_chunk->type <= chunk_range_max); } bool import_b2m::load(DATA_CHUNK *p_chunk, FHANDLE *f) { CHUNK_GROUP *p_loader = NULL; int i; for(i = 0; i < (int)(sizeof(loaders)/sizeof(loaders[0])); i++) { if(loaders[i].check(p_chunk)) { p_loader = loaders+i; break; } } if(p_loader == NULL) return(FALSE); for(i = 0; i < p_loader->chunk_num; i++) { if(p_loader->p_chunks[i].chunk == p_chunk->type) { //pdebug(DEBUG_LOAD_CHUNK,"Chunk %d",p_chunk->type); return((this->*p_loader->p_chunks[i].p_func)(f,p_chunk)); } } return(FALSE); } /* * Loads objects from data file */ bool import_b2m::load(FHANDLE *f) { DATA_CHUNK ch; int loaded_chunks = 0; while(f->read(&ch,sizeof(ch)) == sizeof(ch)) { /* * Set current position for recovery */ t_length data_start = f->tell(); bool loaded = FALSE; loaded = load(&ch,f); if(loaded) loaded_chunks++; if(!loaded) f->seek(data_start+ch.size-sizeof(ch), SEEK_SET); } return(loaded_chunks); } /* * Save objects to data file */ bool import_b2m::save(FHANDLE *f) { // go through all materials and save them MESH_MATERIAL *p_mat = p_scene->material_get_first(); while(p_mat) { pdebug(DEBUG_LOAD_CHUNK,"Saving material %s",p_mat->name_get()); mesh_material_save(f, p_mat); p_mat = p_mat->material_next(); } // go through all meshes and save them GAME_MESH *p_mesh = p_scene->mesh_get_first(); while(p_mesh) { pdebug(DEBUG_LOAD_CHUNK,"Saving mesh %s",p_mesh->name_get()); game_mesh_save(f, p_mesh); p_mesh = p_mesh->mesh_next(); } return(TRUE); } /* * Save objects to data file */ bool scene_import_b2m(SCENE *p_scene, FHANDLE *f) { if(p_scene) { IMPORT_B2M import(p_scene); return(import.load(f)); } else { return(FALSE); } } bool scene_import_b2m(SCENE *p_scene, char *p_dir, char *p_file) { MMHANDLE f; bool ret = FALSE; if(f.open(p_dir, p_file, "rb", FALSE)) { ret = scene_import_b2m(p_scene, &f); f.close(); } return(ret); } bool scene_export_b2m(SCENE *p_scene, FHANDLE *f) { if(p_scene) { IMPORT_B2M import(p_scene); return(import.save(f)); } else { return(FALSE); } } bool scene_export_b2m(SCENE *p_scene, char *p_dir, char *p_file) { GZHANDLE f; bool ret = FALSE; if(f.open(p_dir, p_file, "wb", FALSE)) { ret = scene_export_b2m(p_scene, &f); f.close(); } return(ret); } berusky2-0.12/src/age/graph/camera.cpp0000644000175000017500000000604713674426075014530 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" void camera_object::projection_adjust(void) { SCENE *p_scene = scene_get(); if(!p_scene) return; float max; p_scene->scene_box_depth_get(NULL,NULL,&max); if(max < DEFAULT_PROJECTION_FAR_PLANE) max = DEFAULT_PROJECTION_FAR_PLANE; assert(max < DEFAULT_PROJECTION_FAR_PLANE_MAX); projection_far_plane_set(max*2.0f); } void camera_object::set(void) { SCENE *p_scene = scene_get(); if(!p_scene) { PWARNING("Camera %s isn't connected to scene!",name_get()); return; } GPIPE *p_gpipe = p_scene->gpipe_get(); if(!p_gpipe) { PWARNING("Scene doesn't have any active GPIPE!"); return; } if(plane_auto_adjust_get()) { projection_adjust(); } p_gpipe->set(this); } void camera_3ds::update(void) { if(camera_changes.flag_get(CHANGED_CAMERA_3DS)) { camera_3ds_update(); camera_changes.flag_clear(CHANGED_CAMERA_3DS); } } void camera_polar::update(void) { if(camera_changes.flag_get(CHANGED_CAMERA_POLAR|CHANGED_CAMERA_3DS)) { camera_polar_update(); camera_changes.flag_clear(CHANGED_CAMERA_POLAR|CHANGED_CAMERA_3DS); camera_interface::camera_invert_get()->translation_get(&pos); } } CAMERA_OBJECT * camera_list::create_basic_object(CAMERA_TYPE type) { CAMERA_OBJECT *p_camera = NULL; switch(type) { case CAMERA_TYPE_BASE: p_camera = new CAMERA_OBJECT(scene_get()); break; case CAMERA_TYPE_3DS: p_camera = new CAMERA_3DS(scene_get()); break; case CAMERA_TYPE_POLAR: p_camera = new CAMERA_POLAR(scene_get()); break; } // Copy viewport from scene SCENE *p_scene = scene_get(); if(p_scene) { GPIPE *p_pipe = p_scene->gpipe_get(); p_camera->view_set(p_pipe); } return(p_camera); } berusky2-0.12/src/age/graph/animation_time.cpp0000644000175000017500000000250713674426075016272 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" berusky2-0.12/src/age/graph/bitmap.cpp0000644000175000017500000001433413674426075014552 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* A bitmaps routines */ #include "bitmap.h" /***************************************************************** RGBA Bitmaps ***************************************************************** */ /* Filtrace bmp pomoci floyd-stemberga -> prevod na 16K do 8,8,8 -> 5,5,5 */ /* #define MASKA 0x7 #define PRAH (MASKA>>1) void bmp_pix_to_16b(byte *p_baze, int *p_er, int *p_eg, int *p_eb) { *p_er = (p_baze[0]&MASKA)-PRAH; *p_eg = (p_baze[1]&MASKA)-PRAH; *p_eb = (p_baze[2]&MASKA)-PRAH; p_baze[0]&=~MASKA; p_baze[1]&=~MASKA; p_baze[2]&=~MASKA; } void add_posun_rgba(byte *p_baze, int r, int g, int b, int posun) { r = (r < 0) ? p_baze[0]-((-r)>>posun) : p_baze[0]+(r>>posun); g = (g < 0) ? p_baze[1]-((-g)>>posun) : p_baze[1]+(g>>posun); b = (b < 0) ? p_baze[2]-((-b)>>posun) : p_baze[2]+(b>>posun); if(r > MAX_BYTE) r = MAX_BYTE; if(g > MAX_BYTE) g = MAX_BYTE; if(b > MAX_BYTE) b = MAX_BYTE; if(r < 0) r = 0; if(g < 0) g = 0; if(b < 0) b = 0; p_baze[0] = r; p_baze[1] = g; p_baze[2] = b; } */ /* 255, 0, 255 0, 0, 0 54, 47, 45 237, 77, 0 238, 77, 0 */ /* #define BARVA1 (RGB(255,0,255)) #define BARVA2 (RGB(238,77,0)) #define BARVA3 (RGB(237,77,0)) #define BARVA4 (RGB(0,0,0)) #define BARVA5 (RGB(54,47,45)) #define pruhledna_barva(pruhl, barva) (barva = barva&0xffffff, (pruhl && (barva == BARVA1 || barva == BARVA2 || barva == BARVA3 || barva == BARVA4 ||barva == BARVA5))) void bitmap::to_16bit(byte maska, int pruhl) { dword *p_pix; dword barva; int r,g,b; int tx,ty, dx = x, dy = y; for(ty = 0; ty < dy; ty++) { p_pix = data+(ty*dx); for(tx = 0; tx < dx; tx++, p_pix++) { barva = *p_pix; if(pruhledna_barva(pruhl,barva)) continue; bmp_pix_to_16b((byte *)p_pix, &r, &g, &b); if(tx+1 < dx) { barva = p_pix[1]; if(!pruhledna_barva(pruhl,barva)) add_posun_rgba((byte *)(p_pix+1),r,g,b,1); } if(ty+1 < dy) { p_pix += dx; barva = *p_pix; if(!pruhledna_barva(pruhl,barva)) add_posun_rgba((byte *)(p_pix),r,g,b,2); if(tx+1 < dx) { barva = p_pix[1]; if(!pruhledna_barva(pruhl,barva)) add_posun_rgba((byte *)(p_pix+1),r,g,b,4); } if(tx > 0) { barva = p_pix[-1]; if(!pruhledna_barva(pruhl,barva)) add_posun_rgba((byte *)(p_pix-1),r,g,b,3); } p_pix -= dx; } } } } void bitmap::alfa2bmp(AUX_RGBImageRec *p_alfa) { float a; int i,n,j; n = x*y*3; assert(x == p_alfa->sizeX && y == p_alfa->sizeY); for(i = 0,j = 0; i < n; i += 3, j++) { a = (float)p_alfa->data[i]+(float)p_alfa->data[i+1]+(float)p_alfa->data[i+2]; a /= 3.0f; data[j] = byte_a(data[j],(int)a); } } */ /* Prevede standartni bitmapu na dot3 bitmapu */ /* void bitmap::to_dot3(void) { BITMAPA *p_dot = new BITMAPA(*this); BITMAPA_PIXEL pix; dword *p_tmp; float dX, dY, nX, nY, nZ, oolen; int tx, ty; for(ty = 0; ty < y; ty++) { for(tx = 0; tx < x; tx++) { // Do Y Sobel filter pix = getpixel_pix((tx-1+x) % x, (ty+1) % y); dY = ((float) pix.r) / 255.0f * -1.0f; pix = getpixel_pix(tx % x, (ty+1) % y); dY += ((float) pix.r) / 255.0f * -2.0f; pix = getpixel_pix((tx+1) % x, (ty+1) % y); dY += ((float) pix.r) / 255.0f * -1.0f; pix = getpixel_pix((tx-1+x) % x, (ty-1+y) % y); dY += ((float) pix.r) / 255.0f * 1.0f; pix = getpixel_pix(tx % x, (ty-1+y) % y); dY += ((float) pix.r) / 255.0f * 2.0f; pix = getpixel_pix((tx+1) % x, (ty-1+y) % y); dY += ((float) pix.r) / 255.0f * 1.0f; // Do X Sobel filter pix = getpixel_pix((tx-1+x) % x, (ty-1+y) % y); dX = ((float) pix.r) / 255.0f * -1.0f; pix = getpixel_pix((tx-1+x) % x, ty % y); dX += ((float) pix.r) / 255.0f * -2.0f; pix = getpixel_pix((tx-1+x) % x, (ty+1) % y); dX += ((float) pix.r) / 255.0f * -1.0f; pix = getpixel_pix((tx+1) % x, (ty-1+y) % y); dX += ((float) pix.r) / 255.0f * 1.0f; pix = getpixel_pix((tx+1) % x, ty % y); dX += ((float) pix.r) / 255.0f * 2.0f; pix = getpixel_pix((tx+1) % x, (ty+1) % y); dX += ((float) pix.r) / 255.0f * 1.0f; // Cross Product of components of gradient reduces to nX = -dX; nY = -dY; nZ = 1; // Normalize oolen = 1.0f/((float) sqrt(nX*nX + nY*nY + nZ*nZ)); nX *= oolen; nY *= oolen; nZ *= oolen; pix.r = (BYTE) PackFloatInByte(nX); pix.g = (BYTE) PackFloatInByte(nY); pix.b = (BYTE) PackFloatInByte(nZ); add_color_rgb_byte((byte *)&pix,60,60,60); p_dot->putpixel_pix(tx, ty, pix); } } p_tmp = p_dot->data; p_dot->data = data; data = p_tmp; delete p_dot; } */ berusky2-0.12/src/age/graph/camera_interface.h0000644000175000017500000003503413674426075016213 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Camera interface update model -> TODO ->camera->projection matrix - metoda - matrix changed -> dam najevo ze sem editoval matici */ #ifndef __CAMERA_INTERFACE_H__ #define __CAMERA_INTERFACE_H__ #define DEFAULT_VIEWPORT_WIDTH 640 #define DEFAULT_VIEWPORT_HEIGHT 480 #define DEFAULT_PROJECTION_ANGLE 30.0f #define DEFAULT_PROJECTION_NEAR_PLANE 1.0f #define DEFAULT_PROJECTION_FAR_PLANE 100.0f #define DEFAULT_PROJECTION_FAR_PLANE_MAX FLT_MAX // Global camera functions void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, VECT *p_position, VECT *p_target, float roll); void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, VECT *p_target, QUAT *p_rotation, float distance); void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_rotation_matrix, float elevation, float distance); void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, VECT *p_target, float rotation, float elevation, float distance); void camera_calc_rotation(GLMATRIX *p_camera, GLMATRIX *p_rotation_matrix, float elevation, float distance); // Viewport configuration typedef class camera_interface { /* * Projection matrix has to be recomputed */ protected: bool projection_needs_update; /* * Camera-projection matrix has to be recomputed */ protected: bool camera_projection_needs_update; /* * Camera matrix has been changed */ private: bool camera_change; /* * Camera viewport */ private: bool view_relative; union { int view_ax; float view_rx; }; union { int view_ay; float view_ry; }; union { int view_adx; float view_rdx; }; union { int view_ady; float view_rdy; }; public: void view_absolute_set(int x, int y, int widht, int height) { view_relative = FALSE; view_ax = x; view_ay = y; view_adx = widht; view_ady = height; projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } void view_relative_set(float x, float y, float widht, float height) { view_relative = TRUE; view_rx = x; view_ry = y; view_rdx = widht; view_rdy = height; projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } void view_set(class camera_interface *p_src) { view_relative = p_src->view_relative; if(p_src->view_relative) { view_rx = p_src->view_rx; view_ry = p_src->view_ry; view_rdx = p_src->view_rdx; view_rdy = p_src->view_rdy; } else { view_ax = p_src->view_ax; view_ay = p_src->view_ay; view_adx = p_src->view_adx; view_ady = p_src->view_ady; } projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } int view_x_get(void) { return(view_relative ? view_ax*camera_screen_width : view_ax); } int view_y_get(void) { return(view_relative ? view_ay*camera_screen_height : view_ay); } int view_width_get(void) { return(view_relative ? ftoi(view_rdx*camera_screen_width) : view_adx); } int view_height_get(void) { return(view_relative ? ftoi(view_rdy*camera_screen_height) : view_ady); } void view_get(int *p_x, int *p_y, int *p_width, int *p_height) { if(p_x) *p_x = view_x_get(); if(p_y) *p_y = view_y_get(); if(p_width) *p_width = view_width_get(); if(p_height) *p_height = view_height_get(); } float view_aspect_get(void) { if(view_relative) { if(view_rdx == 0.0f || view_rdy == 0.0f) { return(0); } else { return(view_rdx/view_rdy); } } else { if(view_adx == 0 || view_ady == 0) { return(0); } else { return((float)view_adx/(float)view_ady); } } } /* * Camera screen size */ public: static int global_screen_width; static int global_screen_height; public: static void screen_size_set(int width, int height) { global_screen_width = width; global_screen_height = height; } private: int camera_screen_width; int camera_screen_height; public: int camera_screen_width_get(void) { return(camera_screen_width); } int camera_screen_height_get(void) { return(camera_screen_height); } private: bool screen_size_changed(void) { return(camera_screen_width != global_screen_width || camera_screen_height != global_screen_height); } void screen_size_update(void) { camera_screen_width = global_screen_width; camera_screen_height = global_screen_height; } private: float fov; // camera's field-of-view float plane_far; // far/near clipping planes float plane_near; private: bool plane_auto_adjust; // Auto adjust a far clipping plane public: bool plane_auto_adjust_get(void) { return(plane_auto_adjust); } void plane_auto_adjust_set(bool adjust) { plane_auto_adjust = adjust; } private: GLMATRIX project; // a projection matrix GLMATRIX project_inverted; // a inverted projection matrix private: void projection_update(void) { if(screen_size_changed()) { screen_size_update(); projection_needs_update = TRUE; } if(projection_needs_update) { project.projection(fov, view_aspect_get(), plane_near, plane_far); glu_invert_matrix(&project, &project_inverted); projection_needs_update = FALSE; camera_projection_needs_update = TRUE; } } public: GLMATRIX * projection_get(GLMATRIX *p_projection) { projection_update(); *p_projection = project; return(p_projection); } GLMATRIX * projection_inverted_get(GLMATRIX *p_projection_inverted) { projection_update(); *p_projection_inverted = project_inverted; return(p_projection_inverted); } public: GLMATRIX * projection_get(void) { projection_update(); return(&project); } GLMATRIX * projection_inverted_get(void) { projection_update(); return(&project_inverted); } public: void projection_set(class camera_interface *p_src) { project = p_src->project; project_inverted = p_src->project_inverted; fov = p_src->fov; plane_far = p_src->plane_far; plane_near = p_src->plane_near; projection_needs_update = FALSE; camera_projection_needs_update = TRUE; } void projection_set(GLMATRIX *p_projection) { project = *p_projection; glu_invert_matrix(&project, &project_inverted); projection_needs_update = FALSE; camera_projection_needs_update = TRUE; } void projection_set(float fovy, float zNear, float zFar) { fov = fovy; plane_near = zNear; plane_far = zFar; projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } float projection_fov_get(void) { return(fov); } void projection_fov_set(float fovy) { fov = fovy; projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } void projection_planes_set(float zNear, float zFar) { plane_near = zNear; plane_far = zFar; projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } void projection_far_plane_set(float zFar) { plane_far = zFar; projection_needs_update = TRUE; camera_projection_needs_update = TRUE; } void projection_planes_get(float *p_zNear, float *p_zFar) { *p_zNear = plane_near; *p_zFar = plane_far; } private: // Current camera configuration GLMATRIX camera; GLMATRIX camera_invert; public: // Return camera matrix virtual GLMATRIX * camera_get(GLMATRIX *p_camera) { *p_camera = camera; return(p_camera); } virtual GLMATRIX * camera_invert_get(GLMATRIX *p_camera_invert) { *p_camera_invert = camera_invert; return(p_camera_invert); } protected: // Return camera matrix virtual GLMATRIX * camera_get(void) { return(&camera); } virtual GLMATRIX * camera_invert_get(void) { return(&camera_invert); } public: void camera_set(GLMATRIX *p_camera) { camera = *p_camera; matrix_invert(&camera,&camera_invert); camera_projection_needs_update = TRUE; } void camera_set(class camera_interface *p_src) { camera = p_src->camera; camera_invert = p_src->camera_invert; camera_projection_needs_update = TRUE; } void camera_set(GLMATRIX *p_camera, GLMATRIX *p_camera_invert) { camera = *p_camera; camera_invert = *p_camera_invert; camera_projection_needs_update = TRUE; } void camera_set(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, GLMATRIX *p_projection) { camera = *p_camera; camera_invert = *p_camera_invert; project = *p_projection; glu_invert_matrix(&project,&project_inverted); camera_projection_needs_update = TRUE; } public: void camera_invert_set(GLMATRIX *p_camera_invert) { camera_invert = *p_camera_invert; matrix_invert(&camera_invert,&camera); camera_projection_needs_update = TRUE; } public: void camera_update(void) { matrix_invert(&camera_invert,&camera); camera_projection_needs_update = TRUE; } public: VECT * position_get(VECT *p_position) { GLMATRIX *p_camera = camera_invert_get(); p_position->x = p_camera->_41; p_position->y = p_camera->_42; p_position->z = p_camera->_43; return(p_position); } VECT * direction_get(VECT *p_direction) { GLMATRIX *p_camera = camera_invert_get(); p_direction->x = p_camera->_13; p_direction->y = p_camera->_23; p_direction->z = p_camera->_33; return(p_direction); } private: // Those two are computed only on request GLMATRIX camera_project; GLMATRIX camera_project_invert; public: // Projection->camera matrix is computed only on demand void camera_projection_update(void) { if(camera_projection_needs_update) { matrix_mult_dir(camera_get(),projection_get(),&camera_project); glu_invert_matrix(&camera_project,&camera_project_invert); camera_projection_needs_update = FALSE; } } public: GLMATRIX * camera_project_get(void) { camera_projection_update(); return(&camera_project); } GLMATRIX * camera_project_inverted_get(void) { camera_projection_update(); return(&camera_project_invert); } public: void set(class camera_interface *p_src) { p_src->update(); *this = *p_src; } /* Transformation from world space <=> screen space: Geometry pipeline: World space <=> Camera space <=> Screen nomalized <=> Screen */ /* * Camera space <=> Screen nomalized */ public: bool camera_to_screen_normal(VECT *p_vect); void camera_to_screen_normal(VECT *p_vect, int num); void screen_normal_to_camera(VECT *p_vect); void screen_normal_to_camera(VECT *p_vect, int num); /* * Screen nomalized <=> Screen */ public: void screen_to_screen_normal(VECT *p_vect); void screen_to_screen_normal(VECT *p_vect, int num); void screen_normal_to_screen(VECT *p_vect); void screen_normal_to_screen(VECT *p_vect, int num); /* * World space <=> Camera space */ public: void world_to_camera(VECT *p_vect) { matrix_transformate(p_vect,camera_get()); } void world_to_camera(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { world_to_camera(p_vect); } } void camera_to_world(VECT *p_vect) { matrix_transformate(p_vect,camera_invert_get()); } void camera_to_world(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { camera_to_world(p_vect); } } /* * World space <=> Camera space <=> Screen nomalized */ public: bool world_to_screen_normal_clip(VECT *p_vect); void world_to_screen_normal_clip(VECT *p_vect, int num); bool world_to_screen_normal(VECT *p_vect); void world_to_screen_normal(VECT *p_vect, int num); void screen_normal_to_world(VECT *p_vect); void screen_normal_to_world(VECT *p_vect, int num); /* * World space <=> Camera space <=> Screen nomalized <=> Screen */ public: bool world_to_screen(VECT *p_vect); bool world_to_screen(VECT *p_vect, VECT2DI *p_vect_out); void world_to_screen(VECT *p_vect, int num); void world_to_screen(VECT *p_vect, int num, VECT2DI *p_vect_out); void screen_to_world(VECT *p_vect); void screen_to_world(VECT *p_vect, int num); /* * Camera space <=> Screen nomalized <=> Screen */ public: void screen_to_camera(VECT *p_vect); void screen_to_camera(VECT *p_vect, int num); void camera_to_screen(VECT *p_vect); void camera_to_screen(VECT *p_vect, int num); public: bool camera_changed(void) { return(camera_change); } void camera_change_set(void) { camera_change = TRUE; } void camera_change_clear(void) { camera_change = FALSE; } public: virtual void update(void) { } public: camera_interface(void); virtual ~camera_interface(void) {}; } CAMERA_INTERFACE; #define NORMALIZED_IN_RANGE(value) (value >= -1 && value < 1) #endif // __CAMERA_INTERFACE_H__ berusky2-0.12/src/age/graph/intersect.cpp0000644000175000017500000003614513674426075015302 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" #define EPSILON 0.000001f /* * Line/Ray and point p intersection */ bool intersect_ray_point(VECT *p_a, VECT *p_b, VECT *p_p, VECT *p_I, float *p_ti) { float t_i,vz; t_i = (p_b->x - p_a->x)*(p_p->x-p_a->x)+(p_b->y - p_a->y)*(p_p->y-p_a->y)+(p_b->z - p_a->z)*(p_p->z-p_a->z); vz = point_dist(*p_a,*p_b); t_i /= (vz*vz); if(p_I) { p_I->x = p_a->x + (p_b->x - p_a->x)*t_i; p_I->y = p_a->y + (p_b->y - p_a->y)*t_i; p_I->z = p_a->z + (p_b->z - p_a->z)*t_i; } if(p_ti) *p_ti = t_i; return(t_i >= 0.0); } bool intersect_ray_point(VECT2DI *p_a, VECT2DI *p_b, VECT2DI *p_p, VECT2DI *p_I, float *p_ti) { float t_i,vz; t_i = (p_b->x - p_a->x)*(p_p->x-p_a->x)+(p_b->y - p_a->y)*(p_p->y-p_a->y); vz = point_dist(*p_a,*p_b); t_i /= (vz*vz); if(p_I) { p_I->x = (tpos)(p_a->x + (p_b->x - p_a->x)*t_i); p_I->y = (tpos)(p_a->y + (p_b->y - p_a->y)*t_i); } if(p_ti) *p_ti = t_i; return(t_i >= 0.0); } bool intersect_line_point(VECT *p_a, VECT *p_b, VECT *p_p, VECT *p_I, float *p_ti) { float t_i,vz; t_i = (p_b->x - p_a->x)*(p_p->x-p_a->x)+(p_b->y - p_a->y)*(p_p->y-p_a->y)+(p_b->z - p_a->z)*(p_p->z-p_a->z); vz = point_dist(*p_a,*p_b); t_i /= (vz*vz); if(p_I) { p_I->x = p_a->x + (p_b->x - p_a->x)*t_i; p_I->y = p_a->y + (p_b->y - p_a->y)*t_i; p_I->z = p_a->z + (p_b->z - p_a->z)*t_i; } if(p_ti) *p_ti = t_i; return(t_i >= 0.0 && t_i <= 1.0); } bool intersect_line_point(VECT2DI *p_a, VECT2DI *p_b, VECT2DI *p_p, VECT2DI *p_I, float *p_ti) { float t_i,vz; t_i = (p_b->x - p_a->x)*(p_p->x-p_a->x)+(p_b->y - p_a->y)*(p_p->y-p_a->y); vz = point_dist(*p_a,*p_b); t_i /= (vz*vz); if(p_I) { p_I->x = (tpos)(p_a->x + (p_b->x - p_a->x)*t_i); p_I->y = (tpos)(p_a->y + (p_b->y - p_a->y)*t_i); } if(p_ti) *p_ti = t_i; return(t_i >= 0.0 && t_i <= 1.0); } /* * Line/Ray and Line/Ray intersection */ // Ray/Ray intersection bool intersect_ray_ray(VECT2DI *p_a1, VECT2DI *p_b1, VECT2DI *p_a2, VECT2DI *p_b2, VECT2DI *p_p, float *p_t1, float *p_t2) { VECT2DI Q1,Q2; Q1 = static_cast(*p_b1) - static_cast(*p_a1); Q2 = static_cast(*p_b2) - static_cast(*p_a2); if(vect_mult(Q1,Q2) == 0) return(FALSE); float t1,t2; if(abs(Q1.x) < abs(Q1.y)) { float tmp = (float)Q1.x/(float)Q1.y; t2 = (p_a1->x + tmp*p_a2->y - tmp*p_a1->y - p_a2->x) / (-tmp*Q2.y + Q2.x); if(t2 < 0.0f) return(FALSE); t1 = (p_a2->y + Q2.y*t2 + p_a1->y) / (Q1.y); if(t1 < 0.0f) return(FALSE); } else { float tmp = (float)Q1.y/(float)Q1.x; t2 = (p_a1->y + tmp*p_a2->x - tmp*p_a1->x - p_a2->y) / (-tmp*Q2.x + Q2.y); if(t2 < 0.0f) return(FALSE); t1 = (p_a2->x + Q2.x*t2 + p_a1->x) / (Q1.x); if(t1 < 0.0f) return(FALSE); } if(p_p) { p_p->x = (tpos)(p_a2->x + Q2.x*t2); p_p->y = (tpos)(p_a2->y + Q2.y*t2); } if(p_t1) { *p_t1 = t1; } if(p_t2) { *p_t2 = t2; } return(TRUE); } // Ray/line intersection // a1,b1 -> ray // a2,b2 -> line // returns p_p -> intersection point // p_t -> intersection param bool intersect_ray_line(VECT2DI *p_a1, VECT2DI *p_b1, VECT2DI *p_a2, VECT2DI *p_b2, VECT2DI *p_p, float *p_t) { float t1,t2; if(intersect_ray_ray(p_a1, p_b1, p_a2, p_b2, p_p, &t1, &t2)) { if(t2 > 1.0f) return(FALSE); if(p_t) { *p_t = t1; } return(TRUE); } return(FALSE); } bool intersect_line_line(VECT2DI *p_a1, VECT2DI *p_b1, VECT2DI *p_a2, VECT2DI *p_b2, VECT2DI *p_p) { float t1,t2; if(intersect_ray_ray(p_a1, p_b1, p_a2, p_b2, p_p, &t1, &t2)) { return(t2 <= 1.0f && t1 <= 1.0f); } return(FALSE); } /* * Triangle intersection */ // p = a*p0 + b*p1 + g*p2 // 2 linear equations (x,y) // 1 = a + b + g; // a > 0 // b > 0 // g > 0 // TODO -> Two ways -> if v2.y or v2.x are 0 bool intersect_triangle_point(VECT2DI *p_p0, VECT2DI *p_p1, VECT2DI *p_p2, VECT2DI *p_p) { VECT2DI v1,v2; v1 = *p_p1 - *p_p0; v2 = *p_p2 - *p_p0; // Y is bigger than X if(abs(v2.y) < abs(v2.x)) { float tmp = (float)v2.y/(float)v2.x; float b = (p_p0->y - p_p->y + tmp*p_p->x - tmp*p_p0->x) / (v1.x*tmp - v1.y); if(b < 0.0f || b > 1.0f) return(FALSE); float g = (p_p->x - p_p0->x - b*v1.x) / (float)(v2.x); return(g > 0.0f && b+g < 1.0f); } else { float tmp = ((float)v2.x/(float)v2.y); float b = (p_p0->x - p_p->x + tmp*p_p->y - tmp*p_p0->y) / (v1.y*tmp - v1.x); if(b < 0.0f || b > 1.0f) return(FALSE); float g = (p_p->y - p_p0->y - b*v1.y) / (float)(v2.y); return(g > 0.0f && b+g < 1.0f); } } bool intersect_triangle_ray(VECT2DI *p_p0, VECT2DI *p_p1, VECT2DI *p_p2, VECT2DI *p_a, VECT2DI *p_b, float *p_tn) { if(intersect_triangle_point(p_p0, p_p1, p_p2, p_a)) { if(p_tn) *p_tn = 0.0f; return(TRUE); } if(p_tn) { float t,tn = FLT_MAX; if(intersect_ray_line(p_a, p_b, p_p0, p_p1, NULL, &t)) { if(t > 0.0f && t < tn) { tn = t; } } if(intersect_ray_line(p_a, p_b, p_p0, p_p2, NULL, &t)) { if(t > 0.0f && t < tn) { tn = t; } } if(intersect_ray_line(p_a, p_b, p_p1, p_p2, NULL, &t)) { if(t > 0.0f && t < tn) { tn = t; } } return(tn < FLT_MAX); } else { return( intersect_ray_line(p_a, p_b, p_p0, p_p1, NULL, NULL) || intersect_ray_line(p_a, p_b, p_p0, p_p2, NULL, NULL) || intersect_ray_line(p_a, p_b, p_p1, p_p2, NULL, NULL)); } } bool intersect_triangle_line(VECT2DI *p_p0, VECT2DI *p_p1, VECT2DI *p_p2, VECT2DI *p_a, VECT2DI *p_b) { float tn; if(intersect_triangle_ray(p_p0,p_p1,p_p2,p_a,p_b,&tn)) { return(tn <= 1.0f); } return(FALSE); } bool intersect_triangle_ray_cull(VECT *p_v0, VECT *p_v1, VECT *p_v2, // Triangle VECT *p_orig, VECT *p_dir, // Line float *p_t, float *p_u, float *p_v) // Results { VECT edge1,edge2,tvec,pvec,qvec; float det, inv_det; float t,u,v; // spocitam ramena trojuhelnika edge1.x = p_v1->x - p_v0->x; edge1.y = p_v1->y - p_v0->y; edge1.z = p_v1->z - p_v0->z; edge2.x = p_v2->x - p_v0->x; edge2.y = p_v2->y - p_v0->y; edge2.z = p_v2->z - p_v0->z; // determinant - uhel mezi plochou dir&edge2 a vektorem edge1 // spocitam rovinu mezi dir&edge2 pvec.x = p_dir->y*edge2.z - p_dir->z*edge2.y; pvec.y = p_dir->z*edge2.x - p_dir->x*edge2.z; pvec.z = p_dir->x*edge2.y - p_dir->y*edge2.x; // uhel mezi normalovym vektorem plochy dir&edge2 a edge1 det = edge1.x*pvec.x + edge1.y*pvec.y + edge1.z*pvec.z; // lezi paprsek v rovine plosky (je rovnobezny s ploskou ?) // uhel mezi paprskem a ploskou je det // culling off if(det > -EPSILON && det < EPSILON) return(FALSE); // t = 0->orig tvec.x = p_orig->x - p_v0->x; tvec.y = p_orig->y - p_v0->y; tvec.z = p_orig->z - p_v0->z; // uhel mezi t a p u = tvec.x*pvec.x + tvec.y*pvec.y + tvec.z*pvec.z; if( u < 0.0f || u > det) return(FALSE); // plocha mezi tvec a edge1 qvec.x = tvec.y*edge1.z - tvec.z*edge1.y; qvec.y = tvec.z*edge1.x - tvec.x*edge1.z; qvec.z = tvec.x*edge1.y - tvec.y*edge1.x; // uhel mezi p_dir a qvec v = (p_dir->x*qvec.x + p_dir->y*qvec.y + p_dir->z*qvec.z); // test hranic s = u, t = v if(v < 0.0f || u + v > det) return(FALSE); // spocitani t parametru if(p_t || p_u || p_v) { t = (edge2.x*qvec.x + edge2.y*qvec.y + edge2.z*qvec.z); inv_det = 1.0f / det; if(p_u) *p_u = u*inv_det; if(p_v) *p_v = v*inv_det; if(p_t) *p_t = t*inv_det; } return(TRUE); } bool intersect_triangle_ray_ncull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t, float *p_u, float *p_v) { VECT edge1,edge2,tvec,pvec,qvec; float det, inv_det; float t,u,v; // spocitam ramena trojuhelnika edge1.x = p_v1->x - p_v0->x; edge1.y = p_v1->y - p_v0->y; edge1.z = p_v1->z - p_v0->z; edge2.x = p_v2->x - p_v0->x; edge2.y = p_v2->y - p_v0->y; edge2.z = p_v2->z - p_v0->z; // determinant - uhel mezi plochou dir&edge2 a vektorem edge1 // spocitam rovinu mezi dir&edge2 pvec.x = p_dir->y*edge2.z - p_dir->z*edge2.y; pvec.y = p_dir->z*edge2.x - p_dir->x*edge2.z; pvec.z = p_dir->x*edge2.y - p_dir->y*edge2.x; // uhel mezi normalovym vektorem plochy dir&edge2 a edge1 det = edge1.x*pvec.x + edge1.y*pvec.y + edge1.z*pvec.z; // lezi paprsek v rovine plosky (je rovnobezny s ploskou ?) // uhel mezi paprskem a ploskou je det // culling off if(det > -EPSILON && det < EPSILON) return(FALSE); inv_det = 1.0f / det; // t = 0->orig tvec.x = p_orig->x - p_v0->x; tvec.y = p_orig->y - p_v0->y; tvec.z = p_orig->z - p_v0->z; // uhel mezi t a p u = (tvec.x*pvec.x + tvec.y*pvec.y + tvec.z*pvec.z)*inv_det; if( u < 0.0f || u > 1.0f) return(FALSE); // plocha mezi tvec a edge1 qvec.x = tvec.y*edge1.z - tvec.z*edge1.y; qvec.y = tvec.z*edge1.x - tvec.x*edge1.z; qvec.z = tvec.x*edge1.y - tvec.y*edge1.x; // uhel mezi p_dir a qvec v = (p_dir->x*qvec.x + p_dir->y*qvec.y + p_dir->z*qvec.z)*inv_det; // test hranic s = u, t = v if(v < 0.0f || u + v > 1.0f) return(FALSE); // spocitani t parametru t = (edge2.x*qvec.x + edge2.y*qvec.y + edge2.z*qvec.z)*inv_det; // spocitani t parametru if(p_u) *p_u = u; if(p_v) *p_v = v; if(p_t) *p_t = t; return(TRUE); } bool intersect_triangle_line_cull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t, float *p_u, float *p_v) { float t; if(intersect_triangle_ray_cull(p_v0,p_v1,p_v2,p_orig,p_dir,&t,p_u,p_v)) { if(t <= 1.0f) { if(p_t) *p_t = t; return(TRUE); } } return(FALSE); } bool intersect_triangle_line_ncull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t, float *p_u, float *p_v) { float t; if(intersect_triangle_ray_ncull(p_v0,p_v1,p_v2,p_orig,p_dir,&t,p_u,p_v)) { if(t <= 1.0f) { if(p_t) *p_t = t; return(TRUE); } } return(FALSE); } /* * Rect and Point/Line/Ray intersection */ INTERSECTION_TYPE intersect_rect_ray(RECT2DI *p_r, VECT2DI *p_a, VECT2DI *p_b, float *p_tn, float *p_tf) { if(intersect_rect_point(p_r, p_a) || intersect_rect_point(p_r, p_b)) { return(INTERSECT_INSIDE); } // line a->b float tn = 0.0f,tf = FLT_MAX; float t1,t2,t; VECT2DI Q; // Q is vector p_a->p_b Q = *p_b - *p_a; // X-plane t1 = p_r->x+p_r->dx-p_a->x; // Tf t2 = p_r->x-p_a->x; // Tn if(Q.x < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/((float)Q.x),tn); tf = MIN(t1/((float)Q.x),tf); if(tn > tf || tf < 0.0f) return(INTERSECT_NONE); // Y-Souradnice t1 = p_r->y+p_r->dy-p_a->y; // defaultne Tf t2 = p_r->y-p_a->y; // defaultne Tn if(Q.y < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/((float)Q.y),tn); tf = MIN(t1/((float)Q.y),tf); if(tn > tf || tf < 0.0f) return(INTERSECT_NONE); if(p_tn && p_tf) { *p_tn = tn; *p_tf = tf; } return(INTERSECT_CROSS); } INTERSECTION_TYPE intersect_rect_line(RECT2DI *p_r, VECT2DI *p_a, VECT2DI *p_b, float *p_tn, float *p_tf) { if(intersect_rect_point(p_r, p_a) || intersect_rect_point(p_r, p_b)) { return(INTERSECT_INSIDE); } // line a->b float tn = 0.0f,tf = FLT_MAX; float t1,t2,t; VECT2DI Q; // Q is vector p_a->p_b Q = (*p_b) - (*p_a); // X-plane t1 = p_r->x+p_r->dx-p_a->x; // Tf t2 = p_r->x-p_a->x; // Tn if(Q.x < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/((float)Q.x),tn); tf = MIN(t1/((float)Q.x),tf); if(tn > tf || tf < 0.0f) return(INTERSECT_NONE); // Y-Souradnice t1 = p_r->y+p_r->dy-p_a->y; // defaultne Tf t2 = p_r->y-p_a->y; // defaultne Tn if(Q.y < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/((float)Q.y),tn); tf = MIN(t1/((float)Q.y),tf); if(tn > tf || tf < 0.0f) return(INTERSECT_NONE); if(tn > 1.0f) return(INTERSECT_NONE); if(p_tn && p_tf) { *p_tn = tn; *p_tf = tf; } return(INTERSECT_CROSS); } INTERSECTION_TYPE intersect_rect_triangle(RECT2DI *p_r, VECT2DI *p_v0, VECT2DI *p_v1, VECT2DI *p_v2) { int ret = intersect_rect_point(p_r, p_v0)+intersect_rect_point(p_r, p_v1)+ intersect_rect_point(p_r, p_v2); if(ret) { return(ret == 3 ? INTERSECT_INSIDE : INTERSECT_CROSS); } VECT2DI tmp[4]; p_r->get(tmp); // Is the rectangle inside? if(intersect_triangle_point(p_v0,p_v1,p_v2,tmp) || intersect_triangle_point(p_v0,p_v1,p_v2,tmp+1) || intersect_triangle_point(p_v0,p_v1,p_v2,tmp+2) || intersect_triangle_point(p_v0,p_v1,p_v2,tmp+3)) { return(INTERSECT_CROSS); } if(intersect_rect_line(p_r, p_v0, p_v1) || intersect_rect_line(p_r, p_v1, p_v2) || intersect_rect_line(p_r, p_v2, p_v1)) { return(INTERSECT_CROSS ); } else { return(INTERSECT_NONE); } } INTERSECTION_TYPE intersect_rect_rect(RECT2DI *p_r, RECT2DI *p_r2) { VECT2DI tmp[4]; p_r2->get(tmp); int ret = intersect_rect_point(p_r, tmp)+ intersect_rect_point(p_r, tmp+1)+ intersect_rect_point(p_r, tmp+2)+ intersect_rect_point(p_r, tmp+3); if(ret) { return(ret == 4 ? INTERSECT_INSIDE : INTERSECT_CROSS); } p_r->get(tmp); if(intersect_rect_point(p_r2, tmp) || intersect_rect_point(p_r2, tmp+1) || intersect_rect_point(p_r2, tmp+2) || intersect_rect_point(p_r2, tmp+3)) { return(INTERSECT_CROSS); } else { return(INTERSECT_NONE); } } berusky2-0.12/src/age/graph/surface_height.h0000644000175000017500000002757213674426075015733 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SURFACE_HEIGHT_H__ #define __SURFACE_HEIGHT_H__ // Kernel function for hightmap filters typedef float FILTER_KERNEL_FUNC(int dist_max, int *p_list_dist, float *p_list_height, int dist_num); // Kernel filter prototypes float surface_height_filter_interpolate(int dist_max, int *p_list_dist, float *p_list_height); float surface_height_filter_blur(int dist_max, int *p_list_dist, float *p_list_height); // Kernel filter defines #define KERNEL_INTERPOLATE surface_height_filter_interpolate #define KERNEL_BLUR surface_height_filter_blur // Square types for mid-point interpolation typedef enum { SQUARE_TYPE_1 = 0, SQUARE_TYPE_2 } SQUARE_TYPE; typedef enum { INTERPOLATION_MID_POINT, INTERPOLATION_LINE_MIN, INTERPOLATION_LINE_MAX, INTERPOLATION_LINE_CENTER, INTERPOLATION_LINE_PRIORITY_HIGH, INTERPOLATION_LINE_PRIORITY_LOW, INTERPOLATION_LINE_RANGE_HIGH, INTERPOLATION_LINE_RANGE_LOW, INTERPOLATION_LINE_RANDOM } SQUARE_INTERPOLATION_TYPE; // Configuration for mid-point generator typedef struct mid_point_config { // Hurst coeficient for fractal generator float generator_hurst; // Basic generator ranges float generator_delta; float generator_center; // Fixed values for border/center float correction_border; float correction_center; // Fixed starting corner points float border_start_height; // Perturpabion applied during interpolation float perturbation; // Stop generator at this distance // between pixels int pixel_distance; // Filter back bool pixel_filter_back; // Fill missing bool pixel_fill; // Heightmap filter bool pixel_filter; int pixel_filter_num; // Run-time values used by generator bool height_overwrite; int iteration_target; // interpolation methods & ranges SQUARE_INTERPOLATION_TYPE ifirst; SQUARE_INTERPOLATION_TYPE isecond; int iborder; SQUARE_INTERPOLATION_TYPE interpolation_get(tpos size) { if(size >= iborder) { return(ifirst); } return(isecond); } // generation methods & ranges int gborder; // TRUE - point is interpolated & generated // FALSE - point is interpolated only bool generation_get(tpos size) { return(size >= gborder); } mid_point_config(void); } MID_POINT_CONFIG; // Configuration for perlin-noise generator // Some code comes from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm typedef struct perlin_config { public: float persistence; int octaves; int octaves_start; private: tpos width, height; float *p_array; private: int point_norm(int p) { if(p < 0) { p = width-(abs(p)%width)-1; } else if(p > width-1) { p = p%width; } return(p); } float point_get(tpos x, tpos y) { x = point_norm(x); y = point_norm(y); return(p_array[y*width + x]); } float square_get(tpos x, tpos y) { float corners = (point_get(x-1, y-1)+ point_get(x+1, y-1)+ point_get(x-1, y+1)+ point_get(x+1, y+1))/16; float sides = (point_get(x-1, y)+ point_get(x+1, y)+ point_get(x, y-1)+ point_get(x, y+1))/8; float center = point_get(x, y)/4; return corners + sides + center; /* return point_get(x,y); */ } /* Square interpolation: *---o---* | # | *---o---* */ float noise_get(float x, float y) { int integer_x = (int)floorf(x); float fractional_x = x - integer_x; int integer_y = (int)floorf(y); float fractional_y = y - integer_y; float v1 = square_get(integer_x, integer_y); float v2 = square_get(integer_x + 1, integer_y); float v3 = square_get(integer_x, integer_y + 1); float v4 = square_get(integer_x + 1, integer_y + 1); float i1 = interpolate_cos(v1, v2, fractional_x); float i2 = interpolate_cos(v3, v4, fractional_x); return(interpolate_cos(i1, i2, fractional_y)); } public: float perlin_get(tpos x, tpos y) { float result = 0; int i; for(i = octaves_start; i < octaves_start+octaves; i++) { float frequency = powf(2,i); float amplitude = powf(persistence, i); // Behind texture resolution if(frequency > width && frequency > height) break; result = result + noise_get(x*(frequency/width), y*(frequency/height)) * amplitude; } return result; } public: void rand(tpos width, tpos height); void release(void); public: perlin_config(void); } PERLIN_CONFIG; class surface_height; typedef class surface_height SURFACE_HEIGHT; typedef void (surface_height::*HEIGHT_WRITE_FUNC)(MID_POINT_CONFIG *p_config, int x, int y, float h0, float h1, float h2, float h3, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, float iteration, bool generate); typedef class surface_height : public surface_sw { float pixel_height_range; // pixel ranges public: tpos width_get(void) { return(surface_sw::width_get()); } tpos height_get(void) { return(surface_sw::height_get()); } public: bool load(const char *p_file, SURFACE_FORMAT format = SURFACE_TEXTURE); public: void copy(class surface_height *p_src); void move(class surface_height *p_src); public: void create(tpos width, tpos height, SURFACE_FORMAT format = SURFACE_TEXTURE); void create(SURFACE *p_surf, SURFACE_FORMAT format = SURFACE_TEXTURE); public: void fill(float height); void fill(tpos x, tpos y, tpos dx, tpos dy, float height); void blit(class surface_height *p_dst); void blit(class surface_height *p_dst, tpos tx, tpos ty); void blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_height *p_dst, tpos tx, tpos ty, tpos tdx, tpos tdy); public: void scale(int nx, int ny); SURFACE_HEIGHT scale_new(int nx, int ny); public: float color_to_height(Uint8 r, Uint8 g, Uint8 b) { return((r+g+b)/(255*3.0f)); } float color_to_height(tcolor color) { return(rgb_intensity(color)); } tcolor height_to_color(float height) { return(float_rgb(height, height, height)); } /* * Heightmaps */ float height_get(int x, int y) { float h = 0; if(pixel_valid(x,y)) { float *p_pixels = (float *)pixels_get(); h = (*(p_pixels+y*width+x)); } return(h); } float height_get(int x, int y, float default_value) { float h = default_value; if(pixel_valid(x,y)) { float *p_pixels = (float *)pixels_get(); h = (*(p_pixels+y*width+x)); } return(h); } void height_set(int x, int y, float height) { if(pixel_valid(x,y)) { if(op.op == OPERATION_SET && !op.blend) { height_set_simple(x,y,height); } else { height_set_complex(x,y,height); } } } private: void height_set_simple(int x, int y, float height) { float *p_pixels = (float *)pixels_get(); *(p_pixels+y*width+x) = height; } void height_set_complex(int x, int y, float height); public: VECT height_normal_get(int x, int y, MASK_INTERFACE *p_mask = NULL, int mask_x = 0, int mask_y = 0); float height_range_get(void); void height_range_set(float range); void height_range_default(void); /* * Heightmaps - filters */ int height_get(int cx, int cy, int width, int height, int *p_list_dist, float *p_list_height, bool center = TRUE); int height_get_cross(int cx, int cy, int *p_list_dist, float *p_list_height, bool center = TRUE); // Filter all values, HEIGHT_UNSET filter too void height_filter(tpos x, tpos y, FILTER_KERNEL_FUNC *p_kernel, bool center = TRUE); void height_filter(tpos x, tpos y, tpos width, tpos height, FILTER_KERNEL_FUNC *p_kernel, bool center = TRUE); // Fill unset values only (HEIGHT_UNSET) void height_fill(tpos x, tpos y, tpos width, tpos height, FILTER_KERNEL_FUNC *p_kernel); void height_normalize(void); void height_normalize(tpos sx, tpos sy, tpos width, tpos height, float value_min = 0.0f, float value_max = 1.0f); void height_blit(class surface_height *p_dst, tpos tx, tpos ty, BLIT_OPERATION op); /* * Heightmaps - mid-point generator */ private: int height_iteration_get(MID_POINT_CONFIG *p_config, int iteration); float height_correction(int x, int y, float current_height, float border, float center); float height_generate(MID_POINT_CONFIG *p_config, tpos x, tpos y, float height, int iteration); int height_interate_cross(MID_POINT_CONFIG *p_config, int x, int y, int distance, int iteration, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, bool generate, HEIGHT_WRITE_FUNC func); int height_rectangle_emit(MID_POINT_CONFIG *p_config, int x, int y, int width, int height, int iteration_act, SQUARE_TYPE type, HEIGHT_WRITE_FUNC func); private: void height_write(MID_POINT_CONFIG *p_config, int x, int y, float h0, float h1, float h2, float h3, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, float iteration, bool generate); void height_filter(MID_POINT_CONFIG *p_config, int x, int y, float h0, float h1, float h2, float h3, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, float iteration, bool generate); public: void generate_mid_point(MID_POINT_CONFIG *p_config); void generate_mid_point(MID_POINT_CONFIG *p_config, int x, int y, int width, int height); /* * Heightmaps - perlin noise generator */ public: void generate_perlin(PERLIN_CONFIG *p_config); void generate_perlin(PERLIN_CONFIG *p_config, int x, int y, int width, int height); public: surface_height(void); surface_height(char *p_file, SURFACE_FORMAT format_ = SURFACE_TEXTURE); surface_height(tpos width, tpos height, SURFACE_FORMAT format_ = SURFACE_TEXTURE); surface_height(SURFACE_HEIGHT *p_src); } SURFACE_HEIGHT; #endif // __SURFACE_HEIGHT_H__ berusky2-0.12/src/age/graph/mesh.h0000644000175000017500000005435513674426075013706 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Game-Mesh */ #ifndef __MESH_H__ #define __MESH_H__ #include class scene; typedef class scene SCENE; class game_mesh; typedef class game_mesh GAME_MESH; /* A structure like in 3D studio Animacni Gizmo -> Mesh -> Spojeni vice objektu do jednoho objektu (v realnem case?) Pozadavky na Meshe: - Mesh changes - Mesh connections Animation_gizmo? GAME_MESH (flagy a podobne - konstantni) MESH_GEOMETRY (muze se menit nebo jich byt vice) MESH_ANIMACE (muze se menit) MESH_LIGHT (muze se menit) -> animatory -> neco co meni geometrii toho meshe?? GAME_MESH - moznost spojit vice meshu do jednoho meshe */ /* Vertexes in mesh Usage: lock() *_get() modify data unlock() */ typedef class mesh_vertex : public lock_interface { bool videoram; private: int vertexnum; int position_num; VECT **p_pos; // positions int normal_num; VECT **p_norm; // normals int diffuse_num; RGBAF **p_diffuse; // diffuse colors int specular_num; RGBF **p_specular; // specular colors int text_num; VECTUV **p_uv; // textute coordinates private: void vertex_allocate(void); void vertex_delete(void); public: void array_position_add(int num = 1); void array_normal_add(int num = 1); void array_diff_add(int num = 1); void array_spec_add(int num = 1); void array_text_add(int num = 1); void array_set(int positions = 1, int normals = 0, int diff = 0, int spec = 0, int texts = 0); void array_delete(void); public: int vertexnum_get(void) { return(vertexnum); } VECT * position_get(int num = 0); VECT * normal_get(int num = 0); RGBAF * diffuse_get(int num = 0); RGBF * specular_get(int num = 0); VECTUV * uv_get(int num = 0); private: void upload(void); void move_to_vram(void); public: // submit one indice for rendering (direct-mode) void set(int indice); // set whole object for rendering (a.k.a. bind buffer) void set(void); public: mesh_vertex(int vertexes, bool in_videoram = FALSE) { videoram = in_videoram; vertexnum = vertexes; position_num = 0; p_pos = NULL; normal_num = 0; p_norm = NULL; diffuse_num = 0; p_diffuse = NULL; specular_num = 0; p_specular = NULL; text_num = 0; p_uv = NULL; } mesh_vertex(class mesh_vertex &src) { assert(0); // isn't allowed } ~mesh_vertex(void) { vertex_delete(); array_delete(); } } MESH_VERTEX; /* * Basic rendering method -> from face array */ //#define FC_TRIANGLE_LIST 0x10 // render as triangle list typedef class mesh_face : public lock_interface { protected: bool videoram; protected: MESH_VERTEX *p_vertex; public: void vertex_set(MESH_VERTEX *p_vrt) { p_vertex = p_vrt; } public: virtual void draw(void) = 0; public: mesh_face(MESH_VERTEX *p_vert, bool in_videoram = FALSE) { vertex_set(p_vert); videoram = in_videoram; } mesh_face(class mesh_face &src) { assert(0); } virtual ~mesh_face(void) { } } MESH_FACE; // Base rendering class -> just array of faces /* Usage: 1) lock() *_get() modify data unlock() 2) set(...) */ typedef class mesh_face_list : public mesh_face { private: tface *p_face; int facenum; private: void destroy(void) { facenum = 0; ffree(p_face); } void create(int face_num) { destroy(); facenum = face_num; p_face = (tface *)mmalloc(sizeof(p_face[0])*facenum); } public: void set(tface *p_faces, int start, int num) { assert(start+num < facenum); lock(LOCK_READ_WRITE); memcpy(p_face+start*sizeof(p_face[0]),p_faces,sizeof(p_face[0])*num); unlock(); } void set(int index, int indice) { assert(index < facenum); lock(LOCK_READ_WRITE); p_face[index] = indice; unlock(); } tface get(int index) { assert(p_face && index < facenum); return(p_face[index]); } public: int facenum_get(void) { return(facenum); } tface * faces_get(void) { return(locked() ? p_face : NULL); } private: void draw_direct(void); void draw_array(void); public: void draw(void) { if(videoram) draw_array(); else draw_direct(); } public: mesh_face_list(MESH_VERTEX *p_vert, int faces = 0, bool in_videoram = FALSE) : mesh_face(p_vert, in_videoram) { p_face = NULL; if(faces) create(faces); } mesh_face_list(class mesh_face_list &src) : mesh_face(NULL) { assert(0); // it isn't allowed } ~mesh_face_list(void) { destroy(); } } MESH_FACE_LIST; // Various geometry flags #define GEOMETRY_BOX_DIRTY (1<<0) #define GEOMETRY_NORMALS_DIRTY (1<<1) // Base geometry class - only vertex data typedef class mesh_geometry : public flag_interface { friend class game_mesh; /* * Box change interface */ FRAME_CHANGE_INTERFACE box_changes; public: bool box_changed(void) { return(box_changes.changed() || flag_get(GEOMETRY_BOX_DIRTY)); } void box_change_set(void) { box_changes.change_set(); } /* * Mesh vertexes */ private: MESH_VERTEX *p_vertex; public: void vertex_delete(void) { if(p_vertex) { delete p_vertex; p_vertex = NULL; } } void vertex_new(int vertexes, int flags = 0) { if(p_vertex) vertex_delete(); p_vertex = new MESH_VERTEX(vertexes); p_vertex->lock_set(&lck); } public: int vertexnum_get(void) { return(p_vertex ? p_vertex->vertexnum_get() : 0); } VECT * position_get(int num = 0) { return(p_vertex ? p_vertex->position_get(num) : NULL); } VECT * normal_get(int num = 0) { return(p_vertex ? p_vertex->normal_get(num) : NULL); } RGBAF * diffuse_get(int num = 0) { return(p_vertex ? p_vertex->diffuse_get(num) : NULL); } RGBF * specular_get(int num = 0) { return(p_vertex ? p_vertex->specular_get(num) : NULL); } VECTUV * uv_get(int num = 0) { return(p_vertex ? p_vertex->uv_get(num) : NULL); } /* * Mesh transformation */ public: void transformate(GLMATRIX *p_mt); /* * Mesh faces */ private: MESH_FACE *p_face; public: void face_delete(void) { if(p_face) { delete p_face; p_face = NULL; } } void face_new(int faces, bool videoram = FALSE) { if(p_face) face_delete(); p_face = new MESH_FACE_LIST(p_vertex, faces, videoram); p_face->lock_set(&lck); } public: void face_set(tface *p_faces, int start, int num) { assert(p_face); ((MESH_FACE_LIST *)p_face)->set(p_faces, start, num); } void face_set(int index, int indice) { assert(p_face); ((MESH_FACE_LIST *)p_face)->set(index, indice); } // face is index/3 void face_set(int face, int i1, int i2, int i3) { assert(p_face); face *= 3; ((MESH_FACE_LIST *)p_face)->set(face, i1); ((MESH_FACE_LIST *)p_face)->set(face+1,i2); ((MESH_FACE_LIST *)p_face)->set(face+2,i3); } tface face_get(int index) { return(((MESH_FACE_LIST *)p_face)->get(index)); } tface * faces_get(void) { return(p_face ? ((MESH_FACE_LIST *)p_face)->faces_get() : NULL); } int facenum_get(void) { return(p_face ? ((MESH_FACE_LIST *)p_face)->facenum_get() : 0); } /* * Change face orientation (CW, CCW) */ void face_invert(void); /* * Geometry pivot point */ private: VECT pivot; public: VECT * pivot_get(void) { return(&pivot); } VECT * pivot_get(VECT *p_pivot) { *p_pivot = pivot; return(p_pivot); } void pivot_set(VECT *p_pivot) { pivot = *p_pivot; } void pivot_set_center(void) { center_get(&pivot); } /* * Helpers */ public: VECT * center_get(VECT *p_center); VECT * size_get(VECT *p_size); /* * Geometry bouding box */ private: BOX_TYPE box_type; public: BOX_TYPE box_type_get(void) { return(box_type); } void box_type_set(BOX_TYPE type) { if(box_type != type) { box_remove(); box_type = type; } } private: BOX *p_box; public: void box_remove(void) { if(p_box) { ::box_remove(&p_box); flag_set(GEOMETRY_BOX_DIRTY); } } void box_update(bool force = FALSE); BOX * box_get(void) { box_update(); return(p_box); } void box_set(BOX *p_box_new) { box_type_set(p_box_new->box_type_get()); if(!p_box) { p_box = box_create(box_type_get()); } p_box->set(p_box_new); flag_clear(GEOMETRY_BOX_DIRTY); } /* * Geometry normal vectors calculator */ private: void normals_update(bool force = FALSE); /* * Update all geometry changes * (bouding boxes, normal vectors) */ public: void update(bool force = FALSE) { box_update(force); normals_update(force); } /* * Geometry lock intergace */ private: LOCK_INTERFACE lck; private: // Lock data void lock(LOCK_TYPE type = LOCK_READ) { if(p_vertex) p_vertex->lock(type); if(p_face) p_face->lock(type); lck.lock(type); } // Update all modified data bool unlock(LOCK_CHANGE_TYPE changed = LOCK_DEFAULT) { /* * Unlock all parts (if they're present) */ if(p_vertex) { if(p_vertex->unlock(changed)) { flag_set(GEOMETRY_BOX_DIRTY); } } if(p_face) { p_face->unlock(changed); } /* * Unlock a general lock */ /* * If geometry is unlocked now and geometry has been changed, * update all geometry parts */ if(lck.unlock(changed)) { // Check all subsystems if(p_vertex) { assert(!p_vertex->locked()); } if(p_face) { assert(!p_face->locked()); } // Update all parts update(); return(TRUE); } return(FALSE); } bool locked(void) { return(lck.locked()); } private: void draw_normals(void); /* * Mesh draw */ public: void draw(void) { if(p_vertex && p_face) p_face->draw(); } public: void set(BOX_TYPE geometry_box_type) { p_vertex = NULL; p_face = NULL; p_box = NULL; pivot.set(); box_type_set(geometry_box_type); } public: mesh_geometry(BOX_TYPE geometry_box_type, int vertexnum, int facenum, int flags = 0) { set(geometry_box_type); vertex_new(vertexnum); face_new(facenum); } mesh_geometry(BOX_TYPE geometry_box_type) { set(geometry_box_type); } mesh_geometry(class mesh_geometry &src) { assert(0); } ~mesh_geometry(void) { } } MESH_GEOMETRY; /* * Class for meshes and other game objects */ typedef class game_mesh : public scene_object_geometry { friend class mesh_params; /* * Mesh flags */ public: FLAG_INTERFACE mflags; FLAG_INTERFACE m2flags; /* * Mesh material flags */ public: FLAG_INTERFACE material_flag_get(void) { return(p_mat ? p_mat->mflags : FLAG_INTERFACE()); } FLAG_INTERFACE material_flag_2_get(void) { return(p_mat ? p_mat->m2flags : FLAG_INTERFACE()); } /* * Material section */ private: MESH_MATERIAL *p_mat; // used material (can be NULL) public: MESH_MATERIAL * material_get(void) { return(p_mat); } void material_clear(void) { if(p_mat) { p_mat->reference_dec(); p_mat = NULL; } } void material_set(MESH_MATERIAL *p_material) { material_clear(); if(p_material) { p_mat = p_material; p_mat->reference_add(); } } /* * Geometry section */ private: MESH_GEOMETRY *p_geom; // mesh geometry data (can be NULL) public: MESH_GEOMETRY * geometry_new(int vertexnum, int facenum, int flags = 0) { if(p_geom) return(NULL); p_geom = new MESH_GEOMETRY(object_box_type_get(), vertexnum, facenum, flags); return(p_geom); } void geometry_delete(void) { if(p_geom) { delete p_geom; p_geom = NULL; } } bool geometry_active(void) { return(p_geom != NULL); } /* * Object box interface - derived from object_box */ public: virtual bool object_box_changed(void) { return(p_geom ? p_geom->box_changed() : FALSE); } virtual BOX * object_box_get(void) { return(p_geom ? p_geom->box_get() : NULL); } virtual void object_box_set(BOX *p_box) { if(p_geom) p_geom->box_set(p_box); } /* * Object Boxes - Interface * Type of box for geometry */ private: BOX_TYPE box_type; public: /* * Geometry box types */ BOX_TYPE object_box_type_get(void) { return(box_type); } void object_box_type_set(BOX_TYPE type) { if(p_geom) { p_geom->box_type_set(type); } box_type = type; } /* * Lock interface */ public: MESH_GEOMETRY * lock(LOCK_TYPE type = LOCK_READ) { if(!p_geom && type == LOCK_READ_WRITE) { p_geom = new MESH_GEOMETRY(object_box_type_get()); } if(p_geom) p_geom->lock(type); return(p_geom); } bool unlock(LOCK_CHANGE_TYPE changed = LOCK_DEFAULT) { if(p_geom) { return(p_geom->unlock(changed)); } return(FALSE); } /* * Set mesh world matrix */ private: void draw_world_set(void); private: void draw_box(void); void draw_pivot(void); void draw_selection(void); /* * Vertex / faces manipulation */ public: VECT * vertex_position_object_space_get(int *p_vertexnum); VECT * vertex_position_world_space_get(int *p_vertexnum); VECT * vertex_position_camera_space_get(int *p_vertexnum); VECT2DI * vertex_position_screen_space_get(int *p_vertexnum); tface * faces_get(int *p_facenum); public: void draw(void); public: GAME_MESH * mesh_next(void) { return((GAME_MESH *)object_list_next()); } void mesh_remove(void); /* * Misc. functions */ public: void print(int ident = 0); /* * Constructors & so on */ public: game_mesh(class scene *p_scene = NULL); game_mesh(class game_mesh &src); ~game_mesh(void); } GAME_MESH; /* * List of all meshes in scene */ typedef class game_mesh_list : public scene_object_list { public: GAME_MESH * create(void) { GAME_MESH *p_mesh = new GAME_MESH(scene_get()); object_list_insert(p_mesh); return(p_mesh); } void remove(GAME_MESH *p_mesh) { object_list_remove(p_mesh); delete (GAME_MESH *)p_mesh; } public: GAME_MESH * get_first(void) { return((GAME_MESH *)object_list_get_first()); } public: void print(void); public: game_mesh_list(class scene *p_scene) : scene_object_list(p_scene) { } ~game_mesh_list(void) { } } GAME_MESH_LIST; /* #define LANI_FRONTA 6 typedef struct _GAME_MESH_ANIMACE { int update; // update animacniho stromu int akt[LANI_FRONTA]; // cislo aktivni animace, -1 pro zadnou int odkaz; // odkaz do tabulky int flag[LANI_FRONTA]; // flag animace SIMPLE_TRACK_INFO *p_sim[LANI_FRONTA]; // vrchni animace animacniho stromu dword time; // cas animace (0-1) dword time_stop; dword time_start; // start-time animace dword time_delka; int *p_flag[LANI_FRONTA]; // kofoluv flag dword start[LANI_FRONTA]; // frame start dword stop[LANI_FRONTA]; // frame konec } GAME_MESH_ANIMACE; #define GAME_MESH_RANI 0x1 //Game-mesh se animuje v sim_animaci typedef struct _EXTRA_FACE { int typ; word facenum; word *p_face; } EXTRA_FACE; typedef struct _GAME_MESH_DATA { void *p_mesh; // tatik-mesh dword m1flag; // flag materialu 1 dword m2flag; // flag materialu 2 dword kflag; // flag kontejneru dword k2flag; // druhy flag kontejneru int mesh_handle; // handle meshe int mesh_ID; // Svetla meshe void **p_light; // pole svetel meshu int slightnum; int lightmax; // velikost pole na svetla int lightakt; // aktualni velikost // Extra-dynamicke svetla meshe int top_edlight; // top_dynamicke svetlo //EXTRA_DYN_LIGHT **p_edlight; int edlightnum; // aktualni pocet svetel int edlightmax; // maximalni pocet svetel // Loadovaci svetla meshe -> kopie z kontejneru //struct _STATIC_LIGHT *p_lslight; // seznam statickych svetel //struct _DYN_LIGHT *p_ldlight; // seznam dynamickych svetel //struct _EXTRA_DYN_LIGHT *p_lelight; // seznam extra svetel } GAME_MESH_DATA; // GAME-MESH // Zakladni objekt enginu // Ma pouze jeden material // - Provazani kostnich animaci a mesh (objektovych) animaci typedef struct _GAME_MESH { //celej kontejner char jmeno[MAX_JMENO]; dword vertexnum; // pocet vsech vertexu VECT *p_vertex_pos; // pozice bodu (po trojicich) VECT *p_vertex_pos_kosti; // pozice bodu (po trojicich) pro kostni transformaci VECT *p_vertex_norm; // normalove vektory VECT *p_vertex_norm_kosti; // normalove vektory pro kosti RGBAF *p_vertex_diff_material;// materialove difusni barvy RGBAF *p_vertex_diff; // vysledne difusni barvy RGBAF *p_vertex_diff_voda; // vysledne difusni barvy vody BODRGB *p_vertex_spec_material;// materialove spekularni barvy BODRGB *p_vertex_spec; // vysledne spekularni barvy BODRGB *p_vertex_spec_voda; // vysledne spekularni barvy BODUV *p_vertex_uv1_material; // materialove text-koordinaty 1 BODUV *p_vertex_uv2_material; // materialove text-koordinaty 2 BODUV *p_vertex_uv3_material; // materialove text-koordinaty 3 BODUV *p_vertex_uv4_material; // materialove text-koordinaty 4 int objektu; // pocet objektu v meshi - pocet pointeru v extra face int *facenum; // pocty facu v extra-facich - polich int *facestart; // starty facu jednotlivych objektu int *p_face; int facevel; // velikost bloku plosek word *objektnum; // pocty vertextu v objektech word *objektstart; // starty vertextu objektu OBB *p_obb_local; // lokalni obalky objektu OBB *p_obb_world; // obalky transformovane do world-space OBB obb_local; // lokalni obalka kontejneru OBB obb_world; // world-space obalka kontejneru //EDIT_MATERIAL **p_mat; // pole pointeru na materialy na jednotlive objekty int *p_mat; // odkaz na meshe MLZNA_KOSTKA *p_mlha; // mlzna kostka meshe GLMATRIX *p_key; // klicove animacni matice pro kazdy objekt int *p_Objekt_ID; // ID objektu GLMATRIX m; // top-level matice GLMATRIX world; // world-transformace GAME_MESH_ANIMACE siminfo; // informace o aktualni animaci SIMPLE_TRACK_INFO *p_sim; // seznam vsech top-level animaci int simnum; // pocet simu dword *p_kflag; // kont-flagy pro urcite kontaky // Aktualni (vybrana) animace meshe a jeji cas SIMPLE_TRACK_INFO *p_sim_aktivni; // aktivni animace dword sim_aktivni_time;// jeji aktualni cas dword sim_flag; // flag meshe int low_id; // low-id meshe struct _GAME_MESH *p_next; // pointer na dalsi mesh v poradi GAME_MESH_DATA *p_data; // stejne data pro vsechny meshe v multimeshu VERTEX_ARRAYS varray; // vertex-arrays // kazdy objekt ma svoji joint-animaci (pokud to je joint-anim kontejner) JOINT_ANIMACE **p_joint_anim; // seznam joint animaci VECT kofola_pivot; // kofolovy pivoty int mail; int nekreslit; } GAME_MESH; */ #endif berusky2-0.12/src/age/graph/material.cpp0000644000175000017500000001555413674426075015101 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Material class */ #include "age.h" MESH_MATERIAL * mesh_material::p_mat_last = NULL; MESH_MATERIAL * mesh_material::p_mat_scene = NULL; void mesh_material::clear(void) { // Texture pointers initialization memset(p_text,0,sizeof(p_text)); diff.set(1); spec.set(0); factor.set(1); shine = 1.0f; m2flags.flag_set(MATERIAL2_DIFFUSE); mflags.flag_set(MATERIAL_ZMASK); mflags.flag_set(MATERIAL_ZTEST); mflags.flag_set(MATERIAL_CULL); //env_scale = 1.0f; } /* void mesh_material::free(void) { //int i,j; //if(flag&MAT_ANIM_FRAME) //lo_zrus_animaci(&anim); for(j = 0; j < MAT_TEXTUR; j++) { for(i = 0; i < MAX_TEXT_ANIM; i++) { if(p_atext[j][i]) key_zrus_material_animace(p_atext[j]+i); } } if(p_sub) zrus_material(&p_sub); } */ // Set the default values for material mesh_material::mesh_material(class scene *p_scene) : object_list(p_scene) { clear(); } mesh_material::~mesh_material(void) { } void mesh_material::alpha_set(void) { alpha.set(); } int mesh_material::texture_on(int unit, int config, int reserved) { MATERIAL_TEXT_CONFIG *p_config = text_config+config; MATERIAL_TEXT *p_txt; if(p_config->active) { int ret = unit+1; gl_texture::multitext_units -= reserved; if(gl_texture::set_num(unit)) { p_txt = p_text[p_config->text_index]; if(p_txt) { gl_texture::on(p_txt->gl_text_type_get()); gl_texture::set(p_txt->gl_text_get(), p_txt->gl_text_type_get()); gl_texture_operators::set(unit,p_config->text_operator); text_coord[p_config->text_coordinates].set(unit); } else { ret = unit; } } else { ret = FALSE; } gl_texture::multitext_units += reserved; return(ret); } return(FALSE); } void mesh_material::texture_off(int unit) { gl_texture::set_num_off(unit); } void mesh_material::texture_set(void) { int texture, i; for(texture = 0, i = 0; i < MAT_TEXTURES; i++) { if(!(texture = texture_on(texture,i,0))) { texture_off(i); break; } } } void mesh_material::texture_off(void) { int i; for(i = 0; i < MAT_TEXTURES; i++) { texture_off(i); } } // Sets material int mesh_material::set(bool forced) { //int i,t; /* // Nastaveni spekularni barvy if(flag2&(MAT2_SPECULAR|MAT2_ENV_SPEC) || kflag&KONT_DRAW_SPEC) spec.on(); else spec.off(); // Nastaveni pruhlednosti if(kflag&(KONT_DRAW_PRUHL|KONT_DRAW_CAMERA)) { alfa.set(STATE_BLOK_PRUHL); } else { //... nahod aktualni alfa-stage // Alfa-blending alfa.set(); } */ alpha_set(); // Dont set already used active material if(!forced && p_mat_last == this) return(FALSE); p_mat_last = this; texture_set(); // Nahozeni matrose-plazivce //if(!p_smat || flag&MAT_NO_SCMT || !p_smat->text[0].is_loaded()) { /* } else { STAGE_FUNC_PARAM *p_stg = stage_param; STAGE_FUNC_PARAM *p_stg_smat = p_smat->stage_param; int smat_pozice = p_smat->smaterial_pozice; int smat_rezerva; int mat_rezerva; if(p_smat->flag&MAT_SCENE_NUTNY) { smat_rezerva = p_smat->textur; mat_rezerva = 0; } else { smat_rezerva = 0; mat_rezerva = textur; } t = 0; for(i = 0; i < MAT_TEXTUR; i++) { if(i == smat_pozice) { if((t = p_stg_smat->set(p_smat->text,p_smat->text_koord,t,mat_rezerva,p_smat->flag,p_smat->flag2)) == ERROR) break; smat_rezerva = 0; } if((t = p_stg->set(text,text_koord,t,smat_rezerva,flag,flag2)) == ERROR) { break; } p_stg++; } if(i < smat_pozice) { t = p_stg_smat->set(p_smat->text,p_smat->text_koord,t,mat_rezerva,p_smat->flag,p_smat->flag2); } p_stg->el_set_nic(t); } */ if(m2flags.flag_get(MATERIAL2_DIFFUSE)) { gl_diffuse::on(); gl_diffuse::set(&diff); } else { gl_diffuse::off(); } gl_z_buffer::test(mflags.flag_get(MATERIAL_ZTEST)); gl_z_buffer::mask_set(mflags.flag_get(MATERIAL_ZMASK)); gl_cull_mod::set(mflags.flag_get(MATERIAL_CULL)); return(TRUE); } #define MATERIAL_DEFAULT ((MESH_MATERIAL *)0) #define MATERIAL_SELECTION ((MESH_MATERIAL *)-1) void mesh_material::set_default(bool forced) { if(!forced && p_mat_last == MATERIAL_DEFAULT) return; p_mat_last = MATERIAL_DEFAULT; mesh_material::texture_off(); gl_specular::off(TRUE); material_alpha::alpha_functions.set(ALPHA_OFF); gl_diffuse::on(TRUE); gl_diffuse::set(1.0f,1.0f,1.0f,0.0f); gl_z_buffer::on(TRUE); gl_z_buffer::mask_on(TRUE); gl_cull_mod::off(TRUE); } void mesh_material::set_selection(bool forced) { if(!forced && p_mat_last == MATERIAL_SELECTION) return; p_mat_last = MATERIAL_SELECTION; mesh_material::texture_off(); gl_specular::off(); material_alpha::alpha_functions.set(ALPHA_OFF); gl_diffuse::on(); gl_diffuse::set(0.0f,0.0f,1.0f,0.0f); gl_z_buffer::on(); gl_z_buffer::mask_on(); //gl_cull_mod::on(); gl_cull_mod::off(); } void mesh_material::print(void) { pprintf("Material name '%s'",name_get()); int i; for(i = 0; i < MAT_TEXTURES; i++) { pprintf(" Texture [%d]'%s'",i,p_text[i] ? p_text[i]->name_get() : "NULL"); } } void mesh_material::material_remove(void) { SCENE *p_scene = scene_get(); assert(p_scene != NULL); p_scene->material_remove(this); } void material_list::print(void) { MESH_MATERIAL *p_tmp = (MESH_MATERIAL *)get_first(); while(p_tmp) { p_tmp->print(); p_tmp = (MESH_MATERIAL *)p_tmp->object_list_next(); } } berusky2-0.12/src/age/graph/graph3d.cpp0000644000175000017500000004017713674426075014632 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ ** * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* 3D Graphics library */ #include #include #include #include "age.h" // ------------------------------------------------------- // Graphics config // ------------------------------------------------------- GRF_CONFIG graph3d::config; // ------------------------------------------------------- // Error handling // ------------------------------------------------------- void gl_error(void) { dword error = glGetError(); switch(error) { case 0: break; case GL_INVALID_ENUM: PERROR(true, "GL_INVALID_ENUM"); break; case GL_INVALID_VALUE: PERROR(true, "GL_INVALID_VALUE"); break; case GL_INVALID_OPERATION: PERROR(true, "GL_INVALID_OPERATION"); break; case GL_STACK_OVERFLOW: PERROR(true, "GL_STACK_OVERFLOW"); break; case GL_STACK_UNDERFLOW: PERROR(true, "GL_STACK_UNDERFLOW"); break; case GL_OUT_OF_MEMORY: PERROR(true, "GL_OUT_OF_MEMORY"); break; default: PERROR(true, "Error %d",error); break; } } void sdl_start(void) { pprintf("SDL Init..."); if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER)) { pprintf("SDL initialization failed: %s\n", SDL_GetError()); } // Some default SDL config SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableUNICODE(TRUE); } // ------------------------------------------------------- // Graphics configuration // ------------------------------------------------------- void graph3d::config_draw_grid(bool state) { config.draw_grid = state; } void graph3d::config_draw_boxes(bool state) { config.draw_bouding_boxes = state; } void graph3d::config_draw_console(bool state) { config.draw_console = state; } void graph3d::config_draw_mouse_cursor(bool state) { config.draw_mouse_cursor = state; SDL_ShowCursor(!state); } void graph3d::config_draw_pivots(bool state) { config.draw_pivots = state; } void graph3d::config_draw_fps(bool state) { config.draw_debug_fps = state; } void graph3d::config_draw_wired(bool state) { config.draw_debug_wired = state; config.draw_debug_points = FALSE; if(state) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } else { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } } void graph3d::config_draw_points(bool state) { config.draw_debug_points = state; config.draw_debug_wired = FALSE; if(state) { glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); } else { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } } void graph3d::config_draw_normals(bool state) { config.draw_debug_normals = state; } void graph3d::config_draw_materials(bool state) { config.draw_debug_materials = state; } void graph3d::config_opengl_lighting(bool state) { config.opengl_lighting = state; } void graph3d::config_draw_all_objects(bool state) { config.draw_debug_all_objects = state; } void graph3d::config_draw_selection(bool state) { config.draw_selection = state; } /* * Sets a simple render-mode */ void graph3d::config_render_mode_set(RENDER_MODE mode) { switch(mode) { case RENDER_POINTS: config_draw_points(TRUE); config_draw_materials(FALSE); break; case RENDER_WIRED: config_draw_wired(TRUE); config_draw_materials(FALSE); break; case RENDER_SOLID: config_draw_wired(FALSE); config_draw_materials(FALSE); break; case RENDER_TEXTURED: config_draw_wired(FALSE); config_draw_materials(TRUE); break; } } /* * Selection rectangle */ void graph3d::selection_rectangle_draw(void) { if(selection_rectangle_active) { mesh_material::set_default(); draw_rect_line_2d(selection_rectangle_start.x, selection_rectangle_start.y, selection_rectangle_stop.x, selection_rectangle_stop.y, selection_rectangle_color); } } void graph3d::selection_rectangle_clear(void) { selection_rectangle_active = FALSE; } void graph3d::selection_rectangle_set_start(void) { selection_rectangle_active = TRUE; SDL_GetMouseState(&selection_rectangle_start.x,&selection_rectangle_start.y); selection_rectangle_stop = selection_rectangle_start; } void graph3d::selection_rectangle_set(void) { SDL_GetMouseState(&selection_rectangle_stop.x,&selection_rectangle_stop.y); } bool graph3d::selection_rectangle_get(RECT2DI *p_r) { if(selection_rectangle_active) { VECT2DI min,max; MIN_MAX_SORT(min.x,max.x,selection_rectangle_start.x,selection_rectangle_stop.x); MIN_MAX_SORT(min.y,max.y,selection_rectangle_start.y,selection_rectangle_stop.y); p_r->set(&min, &max); return(TRUE); } return(FALSE); } /* * Drawing start */ void graph3d::clear(void) { if(graphics) { /* * Clear all buffers */ glClear(GL_DEPTH_BUFFER_BIT); if(screen_clear) { glClear(GL_COLOR_BUFFER_BIT); } /* * Set a default material */ mesh_material::set_default(TRUE); } } void graph3d::grid_draw(void) { mesh_material::set_default(); VECT vn(0.0f,0.0f,-1.0f); VECT vf(0.0f,0.0f, 1.0f); GPIPE *p_gpipe = gpipe_get(); p_gpipe->screen_normal_to_world(&vn); p_gpipe->screen_normal_to_world(&vf); // v1->v2 VECT dir; dir = vf-vn; dir *= 0.5f; vn += dir; vn.y = 0.0f; VECT vl(-1.0f,0.0f,1.0f); VECT vr( 1.0f,0.0f,1.0f); p_gpipe->screen_normal_to_world(&vl); p_gpipe->screen_normal_to_world(&vr); VECT width; width = vr-vl; draw_floor_line(&vn,width.size(),2,40); } void graph3d::mouse_cursor_draw(void) { GPIPE *p_gpipe = gpipe_get(); int sx, sy, max_x, max_y; p_gpipe->view_get(&sx, &sy, &max_x, &max_y); int mx, my; SDL_GetMouseState(&mx,&my); mesh_material::set_default(); switch(mouse_cursor_type) { case MOUSE_CURSOR_NORMAL: draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y); break; case MOUSE_CURSOR_RECTANGLE_SELECT: draw_cursor_rect_select(mx-sx, my-sx, RGBB(255,0,0)); break; case MOUSE_CURSOR_RECTANGLE_SELECTING: draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y, RGBB(255,0,0)); break; case MOUSE_CURSOR_SCENE_MOVE: draw_cursor_rect_select(mx-sx, my-sx, RGBB(0,255,0)); break; case MOUSE_CURSOR_SCENE_MOVING: //draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y, RGBB(0,255,0)); draw_cursor_rect_select(mx-sx, my-sx, RGBB(0,255,0)); break; case MOUSE_CURSOR_SCENE_ROTATE: draw_cursor_rect_select(mx-sx, my-sx, RGBB(255,255,0)); break; case MOUSE_CURSOR_SCENE_ROTATING: //draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y, RGBB(255,255,0)); draw_cursor_rect_select(mx-sx, my-sx, RGBB(255,255,0)); break; default: draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y); break; } } void graph3d::fps_draw(void) { mesh_material::set_default(); console_print(0,0,"fps %f",current_fps); } // Start scene drawing void graph3d::draw_start(void) { if(p_scene_active) { p_scene_active->draw_start(current_frame); } } // Draw whole scene void graph3d::draw_end(void) { if(graphics) { clear(); if(config.opengl_lighting) { gl_light::on(); } if(p_scene_active) { p_scene_active->draw_end(config.draw_debug_all_objects); } if(config.opengl_lighting) { gl_light::off(); } // Reset world matrix GPIPE *p_pipe = gpipe_get(); if(p_pipe) p_pipe->world_init(); if(config.draw_grid) grid_draw(); if(p_pipe) p_pipe->matrix_2d_mode_set(); if(config.draw_debug_fps) fps_draw(); if(config.draw_console) console_draw(); if(config.draw_mouse_cursor) mouse_cursor_draw(); if(config.draw_selection) selection_rectangle_draw(); if(p_pipe) p_pipe->matrix_3d_mode_set(); flip(); } } void graph3d::set(void) { graphics = FALSE; graphics_width = 0; graphics_height = 0; graphics_bpp = 0; graphics_bpp_zbuffer = 0; graphics_opengl = FALSE; graphics_fullscreen = 0; color_zbuffer = 1.0f; // GL/3D settings //p_scene = NULL; screen_clear = TRUE; screen_clear_color.set(0.4f); current_frame = -1; selection_rectangle_active = FALSE; selection_rectangle_color.set(255,0,0); p_screen_resize_callback = NULL; } void graph3d::set(tpos width, tpos height, int screen_depth, bool full_screen) { // reset all values set(); // Set the default values for graphics graphics_width = width; graphics_height = height; graphics_bpp = screen_depth; graphics_fullscreen = full_screen; } void graph3d::get(tpos *p_width, tpos *p_height, int *p_screen_depth) { if(p_width) *p_width = graphics_width; if(p_height) *p_height = graphics_height; if(p_screen_depth) *p_screen_depth = graphics_bpp; } void graph3d::resize_callback_set(SCREEN_RESIZE_CALLBACK p_callback) { p_screen_resize_callback = p_callback; if(p_callback) p_callback(graphics_width, graphics_height); } bool graph3d::create_GL(void) { // Are we already created? assert(graphics == FALSE); // Create new screen pprintf("Screen resolution %dx%d\nColor depth %d bits\nFullscreen = %d\nOpenGL = %d\n", graphics_width, graphics_height, graphics_bpp, graphics_fullscreen, graphics_opengl); pprintf("Creating screen..."); screen_clear_color_set(screen_clear_color); pprintf("Loading extensions..."); glext.init_extension(); gl_texture::init(gl_ext::ext_multitext_units); pprintf("Creating fonts..."); console_font_create(); pprintf("Done."); graphics = TRUE; gl_active = TRUE; return(graphics); } void graph3d::destroy_GL(void) { if(graphics) { console_font_destroy(); } gl_active = FALSE; } void graph3d::destroy(void) { destroy_GL(); screen_destroy(); SDL_Quit(); } graph3d::graph3d(GRAPH_TYPE type) : graph_type(type) { set(); sdl_start(); } graph3d::graph3d(GRAPH_TYPE type, tpos width, tpos height, int screen_depth, bool full_screen) : graph_type(type) { set(width, height, screen_depth, full_screen); sdl_start(); } graph3d::~graph3d(void) { } #ifdef ENABLE_GTK_BACKEND bool graph3d_gtk::screen_create(void) { /* Attribute list for gtkglarea widget. Specifies a list of Boolean attributes and enum/integer attribute/value pairs. The last attribute must be GDK_GL_NONE. See glXChooseVisual manpage for further explanation. */ int attrlist[] = { GDK_GL_RGBA, GDK_GL_RED_SIZE,1, GDK_GL_GREEN_SIZE,1, GDK_GL_BLUE_SIZE,1, GDK_GL_DOUBLEBUFFER, GDK_GL_NONE }; /* Check if OpenGL is supported. */ if(gdk_gl_query() == FALSE) { PERROR(FALSE, "OpenGL is not supported!"); return(FALSE); } assert(p_area == NULL); /* Create new OpenGL widget. */ p_area = GTK_WIDGET(gtk_gl_area_new(attrlist)); if(!p_area) { PERROR(true, "gtk_gl_area_new failed!"); } gtk_widget_set_size_request(GTK_WIDGET(p_area), graphics_width, graphics_height); screen_resize(graphics_width, graphics_height); return(TRUE); } void graph3d_gtk::screen_destroy(void) { } void graph3d_gtk::screen_resize(tpos width, tpos height) { graphics_width = width; graphics_height = height; camera_interface::screen_size_set(width, height); if(p_screen_resize_callback) p_screen_resize_callback(width, height); } // flip GL buffers void graph3d_gtk::flip(void) { /* Swap backbuffer to front */ if(graphics && p_area && gtk_gl_rendering(p_area)) { gtk_gl_area_swapbuffers(GTK_GL_AREA(p_area)); } } graph3d_gtk::graph3d_gtk(void) : graph3d(GRAPH_GTK) { p_area = NULL; } graph3d_gtk::graph3d_gtk(tpos width, tpos height) : graph3d(GRAPH_GTK, width, height) { p_area = NULL; } graph3d_gtk::~graph3d_gtk(void) { destroy(); } #endif // ENABLE_GTK_BACKEND #ifdef ENABLE_SDL_BACKEND // Obtain the screen from SDL // If we have any screen/surface, release them first bool graph3d_sdl::screen_regenerate(void) { screen_destroy(); pprintf("Init video surface...\n"); SDL_Surface *p_hwscreen = SDL_SetVideoMode(graphics_width, graphics_height, graphics_bpp, sdl_video_flags); if(!p_hwscreen) { fprintf(stderr, "Unable to set the video mode: %s", SDL_GetError()); exit(-1); } p_screen_surface = new SURFACE_SDL(p_hwscreen); return(TRUE); } bool graph3d_sdl::screen_create(void) { assert(graphics == FALSE); // Fetch the video info... const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); if(!videoInfo) { pprintf("Video query failed: %s\n",SDL_GetError()); return(FALSE); } /* the flags to pass to SDL_SetVideoMode */ sdl_video_flags = SDL_OPENGL; /* Enable OpenGL in SDL */ sdl_video_flags |= SDL_GL_DOUBLEBUFFER; /* Enable double buffering */ sdl_video_flags |= SDL_DOUBLEBUF; /* Enable double buffering */ sdl_video_flags |= SDL_HWPALETTE; /* Store the palette in hardware */ sdl_video_flags |= SDL_RESIZABLE; /* Enable window resizing */ /* This checks to see if surfaces can be stored in memory */ if(videoInfo->hw_available) sdl_video_flags |= SDL_HWSURFACE; else sdl_video_flags |= SDL_SWSURFACE; /* This checks if hardware blits can be done */ if(videoInfo->blit_hw) sdl_video_flags |= SDL_HWACCEL; if(graphics_fullscreen) sdl_video_flags |= SDL_FULLSCREEN; /* Sets up OpenGL double buffering */ SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); /* Get resolution from screen */ if(!graphics_width || !graphics_height) { graphics_width = videoInfo->current_w; graphics_height = videoInfo->current_h; } if(!graphics_bpp) { graphics_bpp = videoInfo->vfmt->BitsPerPixel; } screen_resize(graphics_width, graphics_height); #ifdef ENABLE_GL create_GL(); #endif return(TRUE); } void graph3d_sdl::screen_destroy(void) { if(p_screen_surface) { delete p_screen_surface; p_screen_surface = NULL; } } void graph3d_sdl::screen_resize(tpos width, tpos height) { graphics_width = width; graphics_height = height; camera_interface::screen_size_set(width, height); screen_regenerate(); if(p_screen_resize_callback) p_screen_resize_callback(width, height); } void graph3d_sdl::fullscreen_toggle(void) { if(!SDL_WM_ToggleFullScreen(((SURFACE_SDL*)p_screen_surface)->surf_get())) { fprintf(stderr, "SDL_WM_ToggleFullScreen() failed!"); } else { graphics_fullscreen = !graphics_fullscreen; } } // flip GL buffers void graph3d_sdl::flip(void) { if(graphics) { SDL_GL_SwapBuffers(); } } graph3d_sdl::graph3d_sdl(void) : graph3d(GRAPH_SDL) { } graph3d_sdl::graph3d_sdl(tpos width, tpos height, int screen_depth, bool full_screen) : graph3d(GRAPH_SDL, width, height, screen_depth, full_screen), p_screen_surface(NULL), sdl_video_flags(0) { } graph3d_sdl::~graph3d_sdl(void) { destroy(); } #endif // ENABLE_SDL_BACKEND berusky2-0.12/src/age/graph/color_hsv.h0000644000175000017500000000310413674426075014732 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* color classes */ #ifndef __COLOR_HSV_H__ #define __COLOR_HSV_H__ void rgb_to_hsv(float red, float green, float blue, float &h, float &s, float &v); void hsv_to_rgb(float hue, float saturation, float value, float &r, float &g, float &b); #endif //__COLOR_HSV_H__ berusky2-0.12/src/age/graph/object_list.h0000644000175000017500000000457113674426075015246 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OBJECT_LIST_H__ #define __OBJECT_LIST_H__ class object_list_head; /* * Basic object what can be stored in a list */ typedef class object_list : public object_select, public scene_reference { MEMBER_LIST_ITEM(object, object_list, object_list_head); MEMBER_LIST_ITEM_MARK(object, object_list, object_list_head); MEMBER_LIST_ITEM_NAME(object, object_list, object_list_head); public: object_list(SCENE *p_scene) : scene_reference(p_scene) { object_list_item_init(); } virtual ~object_list(void) { } } OBJECT_LIST; /* * Mark iterators */ typedef class object_list_head : public scene_reference { MEMBER_LIST_HEAD(object, object_list, object_list_head); MEMBER_LIST_HEAD_NAME(object, object_list, object_list_head); MEMBER_LIST_HEAD_MARK(object, object_list, object_list_head); public: object_list_head(SCENE *p_scene) : scene_reference(p_scene) { object_list_head_init(); } virtual ~object_list_head(void) { object_list_clear(); } } OBJECT_LIST_HEAD; #endif // __OBJECT_LIST_H__ berusky2-0.12/src/age/graph/matrix_animated.cpp0000644000175000017500000000246513674426075016446 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/matrix.h0000644000175000017500000007717513674454613014262 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Matrix module TODO -> rewrite to some reasonable function format (matrix_*) matrix.methods only for simple methods!! - optimalization -> pointers (->x) to local values (x) */ #ifndef __MATRIX_H__ #define __MATRIX_H__ #include #include // Matrix definition typedef class glmatrix { /* * Data definitions */ public: float _11,_12,_13,_14; float _21,_22,_23,_24; float _31,_32,_33,_34; float _41,_42,_43,_44; /* * Initialization */ public: glmatrix * zero(void) { _11 = _22 = _33 = _44 = 0; _12 = _13 = _14 = _41 = 0; _21 = _23 = _24 = _42 = 0; _31 = _32 = _34 = _43 = 0; return(this); } glmatrix * init(void) { _11 = _22 = _33 = _44 = 1; _12 = _13 = _14 = _41 = 0; _21 = _23 = _24 = _42 = 0; _31 = _32 = _34 = _43 = 0; return(this); } /* * Algebra */ public: glmatrix * invert(void) { float det; float t11 = _22*_33-_23*_32; float t12 = -_12*_33+_13*_32; float t13 = _12*_23-_13*_22; det = t11*_11+t12*_21+t13*_31; if(det != 0.0f) { float t21 = - _21 * _33 + _23 * _31; float t22 = _11 * _33 - _13 * _31; float t23 = - _11 * _23 + _13 * _21; float t31 = _21 * _32 - _22 * _31; float t32 = - _11 * _32 + _12 * _31; float t33 = _11 * _22 - _12 * _21; _11 = t11 / det; _12 = t12 / det; _13 = t13 / det; _21 = t21 / det; _22 = t22 / det; _23 = t23 / det; _31 = t31 / det; _32 = t32 / det; _33 = t33 / det; float t41 = - _41*_11 - _42*_21 - _43*_31; float t42 = - _41*_12 - _42*_22 - _43*_32; float t43 = - _41*_13 - _42*_23 - _43*_33; _41 = t41; _42 = t42; _43 = t43; _14 = 0; _24 = 0; _34 = 0; _44 = 1; } return(this); } class glmatrix * reflexion(VECT *p_a, VECT *p_b, VECT *p_c) { float e; QUAT q; q.x = (p_b->y - p_a->y)*(p_c->z - p_a->z)-(p_c->y - p_a->y)*(p_b->z - p_a->z); q.y = (p_b->z - p_a->z)*(p_c->x - p_a->x)-(p_c->z - p_a->z)*(p_b->x - p_a->x); q.z = (p_b->x - p_a->x)*(p_c->y - p_a->y)-(p_c->x - p_a->x)*(p_b->y - p_a->y); ((VECT)q).norm(); q.w = 0.0f; e = 2*(q.x*p_a->x + q.y*p_a->y + q.z*p_a->z); /* Natoceni souradnic dle vektoru q */ rotation_set(&q); _14 = _24 = _34 = 0.0f; _44 = 1.0f; /* Posun souradnic do pozadovane roviny */ translate(q.x*e,q.y*e,q.z*e); /* Reflexivituj souradnice */ scale(-1.0f,-1.0f,-1.0f); return(this); } glmatrix * mult(float scale) { _11 *= scale; _12 *= scale; _13 *= scale; _14 *= scale; _21 *= scale; _22 *= scale; _23 *= scale; _24 *= scale; _31 *= scale; _32 *= scale; _33 *= scale; _34 *= scale; _41 *= scale; _42 *= scale; _43 *= scale; _44 *= scale; return(this); } float determinant(void) { float m1 = _22 * _33 - _23 * _32; float m2 = - _12 * _33 + _13 * _32; float m3 = _12 * _23 - _13 * _22; return((m1 * _11 + m2 * _21 + m3 * _31)); } bool regular(void) { return(determinant() != 0); } public: /* * Translations */ glmatrix * translate(float px, float py, float pz) { _41 += px*_11 + py*_21 + pz*_31; _42 += px*_12 + py*_22 + pz*_32; _43 += px*_13 + py*_23 + pz*_33; _44 += px*_14 + py*_24 + pz*_34; return(this); } glmatrix * translate(VECT *p_pos) { return(translate(p_pos->x, p_pos->y, p_pos->z)); } glmatrix * translation_set(VECT *p_pos) { _41 = p_pos->x; _42 = p_pos->y; _43 = p_pos->z; return(this); } glmatrix * translation_set(float px, float py, float pz) { _41 = px; _42 = py; _43 = pz; return(this); } glmatrix * translation_get(VECT *p_trans) { p_trans->x = _41; p_trans->y = _42; p_trans->z = _43; return(this); } glmatrix * translation_add(VECT *p_pos) { _41 += p_pos->x; _42 += p_pos->y; _43 += p_pos->z; return(this); } glmatrix * translation_add(float px, float py, float pz) { _41 += px; _42 += py; _43 += pz; return(this); } public: /* * Rotations */ glmatrix * rotation_set(PLANE *p_r, float scale) { float x = p_r->x; float y = p_r->y; float z = p_r->z; float e = p_r->e; _11 = x*x*scale; _21 = x*y*scale; _31 = x*z*scale; _41 = x*e*scale; _12 = y*x*scale; _22 = y*y*scale; _32 = y*z*scale; _42 = y*e*scale; _13 = z*x*scale; _23 = z*y*scale; _33 = z*z*scale; _43 = z*e*scale; _14 = e*x*scale; _24 = e*y*scale; _34 = e*z*scale; _44 = e*e*scale; return(this); } glmatrix * rotation_set(VECT *p_vx, VECT *p_vy, VECT *p_vz) { _11 = p_vx->x; _21 = p_vx->y; _31 = p_vx->z; _12 = p_vy->x; _22 = p_vy->y; _32 = p_vy->z; _13 = p_vz->x; _23 = p_vz->y; _33 = p_vz->z; _14 = _24 = _34 = 0.0f; _41 = _42 = _43 = 0.0f; _44 = 1.0f; return(this); } glmatrix * rotation_set(VECT *p_vx, VECT *p_vy, VECT *p_vz, VECT *p_pos) { _11 = p_vx->x; _21 = p_vx->y; _31 = p_vx->z; _12 = p_vy->x; _22 = p_vy->y; _32 = p_vy->z; _13 = p_vz->x; _23 = p_vz->y; _33 = p_vz->z; _14 = _24 = _34 = 0.0f; _41 = p_pos->x; _42 = p_pos->y; _43 = p_pos->z; _44 = 1.0f; return(this); } /* ( 1-2yy-2zz 2xy+2wz 2xz-2wy ) M = ( 2xy-2wz 1-2xx-2zz 2yz+2wx ) ( 2xz+2wy 2yz-2wx 1-2xx-2yy ) */ glmatrix * rotation_set(QUAT *p_q) { float xx2 = 2*p_q->x*p_q->x; float yy2 = 2*p_q->y*p_q->y; float zz2 = 2*p_q->z*p_q->z; // vektor X _11 = 1.0f-yy2-zz2; _21 = 2*p_q->x*p_q->y - 2*p_q->w*p_q->z; _31 = 2*p_q->x*p_q->z + 2*p_q->w*p_q->y; // vektor Y _12 = 2*p_q->x*p_q->y + 2*p_q->w*p_q->z; _22 = 1.0f-xx2-zz2; _32 = 2*p_q->y*p_q->z - 2*p_q->w*p_q->x; // vektor Z _13 = 2*p_q->x*p_q->z - 2*p_q->w*p_q->y; _23 = 2*p_q->y*p_q->z + 2*p_q->w*p_q->x; _33 = 1.0f-xx2-yy2; return(this); } QUAT * rotation_get(QUAT *p_q) { // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes // article "Quaternion Calculus and Fast Animation". float diagonala = _11+_22+_33; float root; if(diagonala > 0.0f) { // |w| > 1/2, may as well choose w > 1/2 root = sqrtf(diagonala + 1.0f); // 2w p_q->w = 0.5f*root; root = 0.5f/root; // root = 1/(4w) p_q->x = (_23-_32)*root; p_q->y = (_31-_13)*root; p_q->z = (_12-_21)*root; return(p_q); } else { // |w| <= 1/2 float t; int i; if(_22 > _11) { t = _22; i = 2; } else { t = _11; i = 1; } if(_33 > t) { i = 3; } // i je nejvetsi a pak j a k sou ty 2 zbyvajici // fRoot = sqrtf(kRot[i][i]-kRot[j][j]-kRot[k][k] + 1.0f); switch(i) { case 1: // x je nejvetsi -> 4*x^2 j = 2 k = 3 root = sqrtf(_11 - _22 - _33 + 1.0f); p_q->x = 0.5f*root; root = 0.5f/root; // 1/(4*x) p_q->w = (_23-_32)*root; //kRot[k][j]-kRot[j][k]; p_q->y = (_12+_21)*root; //kRot[j][i]+kRot[i][j]; p_q->z = (_13+_31)*root; //kRot[k][i]+kRot[i][k]; break; case 2: // y je nejvetsi -> 4*y^2 j = 3 k = 1 root = sqrtf(_22 - _33 - _11 + 1.0f); p_q->y = 0.5f*root; root = 0.5f/root; // 1/(4*y) p_q->w = (_31-_13)*root; //(kRot[k][j]-kRot[j][k]; p_q->z = (_23+_32)*root; //(kRot[j][i]+kRot[i][j]; p_q->x = (_21+_12)*root; //(kRot[k][i]+kRot[i][k]; break; case 3: // z je nejvetsi -> 4*z^2 i = 3 j = 1 k = 2 root = sqrtf(_33 - _11 - _22 + 1.0f); p_q->z = 0.5f*root; root = 0.5f/root; // 1/(4*z) p_q->w = (_12-_21)*root; //(kRot[k][j]-kRot[j][k]; p_q->x = (_31+_13)*root; //(kRot[j][i]+kRot[i][j]; p_q->y = (_32+_23)*root; //(kRot[k][i]+kRot[i][k]; break; } return(p_q); } } glmatrix * rotation_set(VECT *p_axis, float angle) { QUAT q(p_axis,angle); return(rotation_set(&q)); } glmatrix * rotate_x(float angle) { float ssin = (float)sinf(angle); float ccos = (float)cosf(angle); float t21 = _21; float t22 = _22; float t23 = _23; float t24 = _24; _21 = ccos*t21 + ssin*_31; _31 =-ssin*t21 + ccos*_31; _22 = ccos*t22 + ssin*_32; _32 =-ssin*t22 + ccos*_32; _23 = ccos*t23 + ssin*_33; _33 =-ssin*t23 + ccos*_33; _24 = ccos*t24 + ssin*_34; _34 =-ssin*t24 + ccos*_34; return(this); } glmatrix * rotate_y(float angle) { float ssin = (float)sinf(angle); float ccos = (float)cosf(angle); float t11 = _11; float t12 = _12; float t13 = _13; float t14 = _14; _11 = ccos*t11 + ssin*_31; _31 =-ssin*t11 + ccos*_31; _12 = ccos*t12 + ssin*_32; _32 =-ssin*t12 + ccos*_32; _13 = ccos*t13 + ssin*_33; _33 =-ssin*t13 + ccos*_33; _14 = ccos*t14 + ssin*_34; _34 =-ssin*t14 + ccos*_34; return(this); } glmatrix * rotate_z(float angle) { float ssin = (float)sinf(angle); float ccos = (float)cosf(angle); float t11 = _11; float t12 = _12; float t13 = _13; float t14 = _14; _11 = ccos*t11 + ssin*_21; _21 =-ssin*t11 + ccos*_21; _12 = ccos*t12 + ssin*_22; _22 =-ssin*t12 + ccos*_22; _13 = ccos*t13 + ssin*_23; _23 =-ssin*t13 + ccos*_23; _14 = ccos*t14 + ssin*_24; _24 =-ssin*t14 + ccos*_24; return(this); } glmatrix * rotation_set_z(float angle) { _33 = _44 = 1; _13 = _14 = _41 = 0; _23 = _24 = _42 = 0; _31 = _32 = _34 = _43 = 0; float sinus = (float)sinf(angle); float cosinus = (float)cosf(angle); _11 = cosinus; _12 = sinus; _22 = cosinus; _21 = -sinus; return(this); } glmatrix * rotation_set_inverse(VECT *p_vx, VECT *p_vy, VECT *p_vz) { rotation_set(p_vx,p_vy,p_vz); return(invert()); } glmatrix * rotation_set_inverse(VECT *p_vx, VECT *p_vy, VECT *p_vz, VECT *p_pos) { rotation_set(p_vx,p_vy,p_vz,p_pos); return(invert()); } // 2D rotace glmatrix * rotate_2D(VECT *p_pivot, float angle) { glmatrix m2; float cosa = (float)cosf(angle); float sina = (float)sinf(angle); float px,py; if(!p_pivot) { _11 = cosa; _22 = cosa; _21 = sina; _12 = -sina; } else { px = -p_pivot->x; py = -p_pivot->y; /* posun matice a*b -> tmp a = pos matrix b = rot matrix */ m2._11 = cosa; m2._21 = sina; m2._41 = px*cosa + py*sina + _41; m2._12 = -sina; m2._22 = cosa; m2._42 = px*(-sina) + py*cosa + _42; /* a = rot b = pos - 1 */ _11 = m2._11; _21 = m2._21; _41 = m2._41 + _44*(-px); _12 = m2._12; _22 = m2._22; _42 = m2._42 + _44*(-py); } return(this); } /* * Scaling */ public: glmatrix * scale(float x, float y, float z) { _11 *= x; _21 *= x; _31 *= x; _12 *= y; _22 *= y; _32 *= y; _13 *= z; _23 *= z; _33 *= z; return(this); } glmatrix * scale_set(float x, float y, float z) { _11 = x; _22 = y; _33 = z; return(this); } glmatrix * scale(VECT *p_scale) { return(scale(p_scale->x,p_scale->y,p_scale->z)); } glmatrix * scale_set(VECT *p_scale) { return(scale_set(p_scale->x,p_scale->y,p_scale->z)); } glmatrix * scale_get(VECT *p_scale) { p_scale->x = vect_norm(&_11,&_21,&_31); p_scale->y = vect_norm(&_12,&_22,&_32); p_scale->z = vect_norm(&_13,&_23,&_33); return(this); } glmatrix * scale_get(float *p_x, float *p_y, float *p_z) { *p_x = vect_norm(&_11,&_21,&_31); *p_y = vect_norm(&_12,&_22,&_32); *p_z = vect_norm(&_13,&_23,&_33); return(this); } /* * Projection matrixes */ private: glmatrix * buildFrustumMatrix(float l, float r, float b, float t, float n, float f) { _11 = (2.0f*n)/(r-l); _12 = 0.0f; _13 = 0.0f; _14 = 0.0f; _21 = 0.0f; _22 = (2.0f*n)/(t-b); _23 = 0.0f; _24 = 0.0f; _31 = (r+l)/(r-l); _32 = (t+b)/(t-b); _33 = (f+n)/(f-n); _34 = 1.0f; _41 = 0.0f; _42 = 0.0f; _43 = -(2.0f*f*n)/(f-n); _44 = 0.0f; return(this); } /* Common values #define DEF_FOVY 30.0f #define MAX_DIST_Z 50.0f #define MIN_DIST_Z 1.0f Build a transformation matrix It transformates world space coordinated to perspective All coordinates are from -1 to 1 Z coordinates are transfromated from (z_near,z_far) -> (-1,1) (distribution is logarithmical) X2d = (2n/(r-l))*X3d + 0*Y3d + ((r+l)/(r-l))*Z3d + 0 Y2d = 0*X3d + (2n/(t-b))*Y3d + ((t+b)/(t-b))*Z3d + 0 Z2d = 0*X3d + 0*Y3d + ((f+n)/(f-n))*Z3d - (2fn/(f-n))*W3d W2d = 0*X3d + 0*Y3d + Z3d + 0 */ public: glmatrix * projection(float fovy, float aspect, float zNear, float zFar) { float xmin, xmax, ymin, ymax; ymax = zNear * (float)tan(fovy); ymin = -ymax; xmin = ymin * aspect; xmax = ymax * aspect; return(buildFrustumMatrix(xmin, xmax, ymin, ymax, zNear, zFar)); } public: PLANE * plane_get(PLANE *p_r) { p_r->x = (float)sqrt(_11); p_r->y = (float)sqrt(_22); p_r->z = (float)sqrt(_33); p_r->e = (float)sqrt(_44); return(p_r); } /* * Pivot transformations */ public: glmatrix * pivot(VECT *p_pivot) { float px = -p_pivot->x, py = -p_pivot->y, pz = -p_pivot->z; float m14, m24, m34, m41, m42, m43, m44; if(px == 0.0f && py == 0.0f && pz == 0.0f) return(this); // a = translate // b = p_mat m41 = px*_11 + py*_21 + pz*_31 + _41; m42 = px*_12 + py*_22 + pz*_32 + _42; m43 = px*_13 + py*_23 + pz*_33 + _43; m44 = px*_14 + py*_24 + pz*_34 + _44; m14 = _14; m24 = _24; m34 = _34; // posun zpet // a = mat // b = translate - px = -px; py = -py; pz = -pz; _11 += m14*(px); _21 += m24*(px); _31 += m34*(px); _41 = m41 + m44*(px); _12 += m14*(py); _22 += m24*(py); _32 += m34*(py); _42 = m42 + m44*(py); _13 += m14*(pz); _23 += m24*(pz); _33 += m34*(pz); _43 = m43 + m44*(pz); _44 = m44; return(this); } glmatrix * pivot_forward(VECT *p_pivot) { float px = -p_pivot->x, py = -p_pivot->y, pz = -p_pivot->z; if(px == 0.0f && py == 0.0f && pz == 0.0f) return(this); else { // a = translate // b = p_mat _41 += px*_11 + py*_21 + pz*_31; _42 += px*_12 + py*_22 + pz*_32; _43 += px*_13 + py*_23 + pz*_33; _44 += px*_14 + py*_24 + pz*_34; return(this); } } public: VECT * transformate(VECT *p_p, int num = 1) { VECT *p_ret = p_p; float x,y,z; int i; for(i = 0; i < num; i++, p_p++) { x = p_p->x; y = p_p->y; z = p_p->z; p_p->x = _11*x + _21*y + _31*z + _41; p_p->y = _12*x + _22*y + _32*z + _42; p_p->z = _13*x + _23*y + _33*z + _43; } return(p_ret); } public: void print(const char *p_name = NULL, int ident = 0); /* * Constructors */ public: glmatrix(void) {}; glmatrix(PLANE *p_r, float scale) { rotation_set(p_r,scale); } glmatrix(VECT *p_axis, float angle) { rotation_set(p_axis, angle); } glmatrix(VECT *p_pos, QUAT *p_rot, VECT *p_scs) { _14 = _24 = _34 = 0.0f; _44 = 1.0f; if(p_pos) { _41 = p_pos->x; _42 = p_pos->y; _43 = p_pos->z; } else { _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; } if(p_rot) { rotation_set(p_rot); } else { _12 = _13 = _23 = _21 = _31 = _32 = 0.0f; _22 = _33 = _11 = 1.0f; } if(p_scs) { scale(p_scs); } } glmatrix(VECT *p_position) { _11 = _22 = _33 = _44 = 1; _12 = _13 = _14 = 0; _21 = _23 = _24 = 0; _31 = _32 = _34 = 0; translation_set(p_position); } } GLMATRIX; inline GLMATRIX * matrix_zero(GLMATRIX * m) { memset((void *)m,0,sizeof(*m)); return(m); } inline GLMATRIX * matrix_init (GLMATRIX *m) { m->_11 = m->_22 = m->_33 = m->_44 = 1; m->_12 = m->_13 = m->_14 = m->_41 = 0; m->_21 = m->_23 = m->_24 = m->_42 = 0; m->_31 = m->_32 = m->_34 = m->_43 = 0; return(m); } inline GLMATRIX * matrix_translation(GLMATRIX *m, VECT *p_pos) { m->_11 = m->_22 = m->_33 = m->_44 = 1; m->_12 = m->_13 = m->_14 = 0; m->_21 = m->_23 = m->_24 = 0; m->_31 = m->_32 = m->_34 = 0; m->translation_set(p_pos); return(m); } // Nasobeni matic 'a' a 'b' do matice 'r' // Alespon doufam po me konverzi :-) inline GLMATRIX * matrix_mult(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) { GLMATRIX tmp; tmp._11 = a->_11*b->_11 + a->_12*b->_21 + a->_13*b->_31 + a->_14*b->_41; tmp._21 = a->_21*b->_11 + a->_22*b->_21 + a->_23*b->_31 + a->_24*b->_41; tmp._31 = a->_31*b->_11 + a->_32*b->_21 + a->_33*b->_31 + a->_34*b->_41; tmp._41 = a->_41*b->_11 + a->_42*b->_21 + a->_43*b->_31 + a->_44*b->_41; tmp._12 = a->_11*b->_12 + a->_12*b->_22 + a->_13*b->_32 + a->_14*b->_42; tmp._22 = a->_21*b->_12 + a->_22*b->_22 + a->_23*b->_32 + a->_24*b->_42; tmp._32 = a->_31*b->_12 + a->_32*b->_22 + a->_33*b->_32 + a->_34*b->_42; tmp._42 = a->_41*b->_12 + a->_42*b->_22 + a->_43*b->_32 + a->_44*b->_42; tmp._13 = a->_11*b->_13 + a->_12*b->_23 + a->_13*b->_33 + a->_14*b->_43; tmp._23 = a->_21*b->_13 + a->_22*b->_23 + a->_23*b->_33 + a->_24*b->_43; tmp._33 = a->_31*b->_13 + a->_32*b->_23 + a->_33*b->_33 + a->_34*b->_43; tmp._43 = a->_41*b->_13 + a->_42*b->_23 + a->_43*b->_33 + a->_44*b->_43; tmp._14 = a->_11*b->_14 + a->_12*b->_24 + a->_13*b->_34 + a->_14*b->_44; tmp._24 = a->_21*b->_14 + a->_22*b->_24 + a->_23*b->_34 + a->_24*b->_44; tmp._34 = a->_31*b->_14 + a->_32*b->_24 + a->_33*b->_34 + a->_34*b->_44; tmp._44 = a->_41*b->_14 + a->_42*b->_24 + a->_43*b->_34 + a->_44*b->_44; memcpy(r,&tmp,sizeof(GLMATRIX)); return(r); } inline GLMATRIX * matrix_mult_dir(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) { r->_11 = a->_11*b->_11 + a->_12*b->_21 + a->_13*b->_31 + a->_14*b->_41; r->_21 = a->_21*b->_11 + a->_22*b->_21 + a->_23*b->_31 + a->_24*b->_41; r->_31 = a->_31*b->_11 + a->_32*b->_21 + a->_33*b->_31 + a->_34*b->_41; r->_41 = a->_41*b->_11 + a->_42*b->_21 + a->_43*b->_31 + a->_44*b->_41; r->_12 = a->_11*b->_12 + a->_12*b->_22 + a->_13*b->_32 + a->_14*b->_42; r->_22 = a->_21*b->_12 + a->_22*b->_22 + a->_23*b->_32 + a->_24*b->_42; r->_32 = a->_31*b->_12 + a->_32*b->_22 + a->_33*b->_32 + a->_34*b->_42; r->_42 = a->_41*b->_12 + a->_42*b->_22 + a->_43*b->_32 + a->_44*b->_42; r->_13 = a->_11*b->_13 + a->_12*b->_23 + a->_13*b->_33 + a->_14*b->_43; r->_23 = a->_21*b->_13 + a->_22*b->_23 + a->_23*b->_33 + a->_24*b->_43; r->_33 = a->_31*b->_13 + a->_32*b->_23 + a->_33*b->_33 + a->_34*b->_43; r->_43 = a->_41*b->_13 + a->_42*b->_23 + a->_43*b->_33 + a->_44*b->_43; r->_14 = a->_11*b->_14 + a->_12*b->_24 + a->_13*b->_34 + a->_14*b->_44; r->_24 = a->_21*b->_14 + a->_22*b->_24 + a->_23*b->_34 + a->_24*b->_44; r->_34 = a->_31*b->_14 + a->_32*b->_24 + a->_33*b->_34 + a->_34*b->_44; r->_44 = a->_41*b->_14 + a->_42*b->_24 + a->_43*b->_34 + a->_44*b->_44; return(r); } inline GLMATRIX * matrix_mult(GLMATRIX * r, float scale) { r->_11 *= scale; r->_12 *= scale; r->_13 *= scale; r->_14 *= scale; r->_21 *= scale; r->_22 *= scale; r->_23 *= scale; r->_24 *= scale; r->_31 *= scale; r->_32 *= scale; r->_33 *= scale; r->_34 *= scale; r->_41 *= scale; r->_42 *= scale; r->_43 *= scale; r->_44 *= scale; return(r); } inline GLMATRIX * matrix_add(GLMATRIX * a, GLMATRIX * b, GLMATRIX * r) { r->_11 = a->_11 + b->_11; r->_12 = a->_12 + b->_12; r->_13 = a->_13 + b->_13; r->_14 = a->_14 + b->_14; r->_21 = a->_21 + b->_21; r->_22 = a->_22 + b->_22; r->_23 = a->_23 + b->_23; r->_24 = a->_24 + b->_24; r->_31 = a->_31 + b->_31; r->_32 = a->_32 + b->_32; r->_33 = a->_33 + b->_33; r->_34 = a->_34 + b->_34; r->_41 = a->_41 + b->_41; r->_42 = a->_42 + b->_42; r->_43 = a->_43 + b->_43; r->_44 = a->_44 + b->_44; return(r); } inline GLMATRIX * matrix_rotate_x(GLMATRIX * m, float angle) { GLMATRIX r; float ssin = (float)sinf(angle); float ccos = (float)cosf(angle); // a = rotate matrix // b = m r._11 = m->_11; r._21 = ccos*m->_21 + ssin*m->_31; r._31 =-ssin*m->_21 + ccos*m->_31; r._41 = m->_41; r._12 = m->_12; r._22 = ccos*m->_22 + ssin*m->_32; r._32 =-ssin*m->_22 + ccos*m->_32; r._42 = m->_42; r._13 = m->_13; r._23 = ccos*m->_23 + ssin*m->_33; r._33 =-ssin*m->_23 + ccos*m->_33; r._43 = m->_43; r._14 = m->_14; r._24 = ccos*m->_24 + ssin*m->_34; r._34 =-ssin*m->_24 + ccos*m->_34; r._44 = m->_44; *m = r; return(m); } inline GLMATRIX * matrix_rotate_y(GLMATRIX * m, float angle) { GLMATRIX r; float ssin = (float)sinf(angle); float ccos = (float)cosf(angle); // a = temp // b = m r._11 = ccos*m->_11 + ssin*m->_31; r._21 = m->_21; r._31 =-ssin*m->_11 + ccos*m->_31; r._41 = m->_41; r._12 = ccos*m->_12 + ssin*m->_32; r._22 = m->_22; r._32 =-ssin*m->_12 + ccos*m->_32; r._42 = m->_42; r._13 = ccos*m->_13 + ssin*m->_33; r._23 = m->_23; r._33 =-ssin*m->_13 + ccos*m->_33; r._43 = m->_43; r._14 = ccos*m->_14 + ssin*m->_34; r._24 = m->_24; r._34 =-ssin*m->_14 + ccos*m->_34; r._44 = m->_44; *m = r; return(m); } inline GLMATRIX * matrix_rotate_z(GLMATRIX * m, float angle) { GLMATRIX r; float ssin = (float)sinf(angle); float ccos = (float)cosf(angle); r._11 = ccos*m->_11 + ssin*m->_21; r._21 =-ssin*m->_11 + ccos*m->_21; r._31 = m->_31; r._41 = m->_41; r._12 = ccos*m->_12 + ssin*m->_22; r._22 =-ssin*m->_12 + ccos*m->_22; r._32 = m->_32; r._42 = m->_42; r._13 = ccos*m->_13 + ssin*m->_23; r._23 =-ssin*m->_13 + ccos*m->_23; r._33 = m->_33; r._43 = m->_43; r._14 = ccos*m->_14 + ssin*m->_24; r._24 =-ssin*m->_14 + ccos*m->_24; r._34 = m->_34; r._44 = m->_44; *m = r; return(m); } // Create the rotation matrix (Z axis) inline GLMATRIX * matrix_rotation_z(GLMATRIX * m, float angle) { float sinus = (float)sinf(angle); float cosinus = (float)cosf(angle); m->init(); m->_11 = cosinus; m->_12 = sinus; m->_22 = cosinus; m->_21 = -sinus; return(m); } inline GLMATRIX * matrix_rotation_set(GLMATRIX *m, QUAT *p_q) { return(m->rotation_set(p_q)); } inline QUAT * matrix_rotation_get(GLMATRIX *m, QUAT *p_q) { return(m->rotation_get(p_q)); } inline GLMATRIX * matrix_translate(GLMATRIX * m, float px, float py, float pz) { m->_41 += px*m->_11 + py*m->_21 + pz*m->_31; m->_42 += px*m->_12 + py*m->_22 + pz*m->_32; m->_43 += px*m->_13 + py*m->_23 + pz*m->_33; m->_44 += px*m->_14 + py*m->_24 + pz*m->_34; return(m); } inline GLMATRIX * matrix_translate(GLMATRIX * m, VECT *p_pos) { float px = p_pos->x; float py = p_pos->y; float pz = p_pos->z; m->_41 += px*m->_11 + py*m->_21 + pz*m->_31; m->_42 += px*m->_12 + py*m->_22 + pz*m->_32; m->_43 += px*m->_13 + py*m->_23 + pz*m->_33; m->_44 += px*m->_14 + py*m->_24 + pz*m->_34; return(m); } inline GLMATRIX * matrix_translatation_set(GLMATRIX * m, VECT *p_pos) { m->_41 = p_pos->x; m->_42 = p_pos->y; m->_43 = p_pos->z; return(m); } // scale matice m o dx,dy,dz inline GLMATRIX * matrix_scale(GLMATRIX * m, float x, float y, float z) { m->_11 *= x; m->_21 *= x; m->_31 *= x; m->_12 *= y; m->_22 *= y; m->_32 *= y; m->_13 *= z; m->_23 *= z; m->_33 *= z; return(m); } // vypocet inverzni matice k src // Spocita inverzni matici k *src a ulozi ji do *inv inline GLMATRIX * matrix_invert(GLMATRIX * src, GLMATRIX * inv) { float det; inv->_11 = src->_22 * src->_33 - src->_23 * src->_32; inv->_12 = - src->_12 * src->_33 + src->_13 * src->_32; inv->_13 = src->_12 * src->_23 - src->_13 * src->_22; det = inv->_11 * src->_11 + inv->_12 * src->_21 + inv->_13 * src->_31; if(det == 0.0f) { assert(0); return(NULL); } inv->_21 = - src->_21 * src->_33 + src->_23 * src->_31; inv->_22 = src->_11 * src->_33 - src->_13 * src->_31; inv->_23 = - src->_11 * src->_23 + src->_13 * src->_21; inv->_31 = src->_21 * src->_32 - src->_22 * src->_31; inv->_32 = - src->_11 * src->_32 + src->_12 * src->_31; inv->_33 = src->_11 * src->_22 - src->_12 * src->_21; inv->_11 /= det; inv->_12 /= det; inv->_13 /= det; inv->_21 /= det; inv->_22 /= det; inv->_23 /= det; inv->_31 /= det; inv->_32 /= det; inv->_33 /= det; inv->_41 = - src->_41*inv->_11 - src->_42*inv->_21 - src->_43*inv->_31; inv->_42 = - src->_41*inv->_12 - src->_42*inv->_22 - src->_43*inv->_32; inv->_43 = - src->_41*inv->_13 - src->_42*inv->_23 - src->_43*inv->_33; inv->_14 = 0; inv->_24 = 0; inv->_34 = 0; inv->_44 = 1; return(inv); } inline void matrix_transformate(float *p_x, float *p_y, float *p_z, GLMATRIX *m) { float x,y,z; x = *p_x; y = *p_y; z = *p_z; *p_x = m->_11*x + m->_21*y + m->_31*z + m->_41; *p_y = m->_12*x + m->_22*y + m->_32*z + m->_42; *p_z = m->_13*x + m->_23*y + m->_33*z + m->_43; // wp = matSet._14*x + matSet._24*y + matSet._34*z + matSet._44; } inline VECT * matrix_transformate(VECT *p_p, GLMATRIX *m) { float x,y,z; x = p_p->x; y = p_p->y; z = p_p->z; p_p->x = m->_11*x + m->_21*y + m->_31*z + m->_41; p_p->y = m->_12*x + m->_22*y + m->_32*z + m->_42; p_p->z = m->_13*x + m->_23*y + m->_33*z + m->_43; return(p_p); } inline void matrix_transformate(float *p_x, float *p_y, float *p_z, float *p_w, GLMATRIX *m) { float x,y,z,w; x = *p_x; y = *p_y; z = *p_z, w = *p_w;; *p_x = m->_11*x + m->_21*y + m->_31*z + m->_41*w; *p_y = m->_12*x + m->_22*y + m->_32*z + m->_42*w; *p_z = m->_13*x + m->_23*y + m->_33*z + m->_43*w; *p_w = m->_14*x + m->_24*y + m->_34*z + m->_44*w; } inline void matrix_transformate(WVECT *p_source, GLMATRIX *m, WVECT *p_target) { float x,y,z,w; x = p_source->x; y = p_source->y; z = p_source->z; w = p_source->w; p_target->x = m->_11*x + m->_21*y + m->_31*z + m->_41*w; p_target->y = m->_12*x + m->_22*y + m->_32*z + m->_42*w; p_target->z = m->_13*x + m->_23*y + m->_33*z + m->_43*w; p_target->w = m->_14*x + m->_24*y + m->_34*z + m->_44*w; } inline VECT * matrix_transformate(VECT *p_source, GLMATRIX *m, VECT *p_target) { float x,y,z; x = p_source->x; y = p_source->y; z = p_source->z; p_target->x = m->_11*x + m->_21*y + m->_31*z + m->_41; p_target->y = m->_12*x + m->_22*y + m->_32*z + m->_42; p_target->z = m->_13*x + m->_23*y + m->_33*z + m->_43; return(p_target); } inline void matrix_transformate_vector(VECT *p_vect, GLMATRIX *m) { float x,y,z; x = p_vect->x; y = p_vect->y; z = p_vect->z; p_vect->x = m->_11*x + m->_21*y + m->_31*z; p_vect->y = m->_12*x + m->_22*y + m->_32*z; p_vect->z = m->_13*x + m->_23*y + m->_33*z; } inline void matrix_transformate_vector(VECT *p_vect, GLMATRIX *m, VECT *p_target) { float x,y,z; x = p_vect->x; y = p_vect->y; z = p_vect->z; p_target->x = m->_11*x + m->_21*y + m->_31*z; p_target->y = m->_12*x + m->_22*y + m->_32*z; p_target->z = m->_13*x + m->_23*y + m->_33*z; } inline void __gluMakeIdentityf(float m[16]) { memset(m,16,sizeof(m[0])); m[0+4*0] = 1; m[1+4*1] = 1; m[2+4*2] = 1; m[3+4*3] = 1; } /* SGI-GLU implementace ** inverse = invert(src) */ inline int __gluInvertMatrixf(const float src[16], float inverse[16]) { int i, j, k, swap; float t; float temp[4][4]; for (i=0; i<4; i++) { for (j=0; j<4; j++) { temp[i][j] = src[i*4+j]; } } __gluMakeIdentityf(inverse); for (i = 0; i < 4; i++) { /* ** Look for largest element in column */ swap = i; for (j = i + 1; j < 4; j++) { if (fabs(temp[j][i]) > fabs(temp[i][i])) { swap = j; } } if (swap != i) { /* ** Swap rows. */ for (k = 0; k < 4; k++) { t = temp[i][k]; temp[i][k] = temp[swap][k]; temp[swap][k] = t; t = inverse[i*4+k]; inverse[i*4+k] = inverse[swap*4+k]; inverse[swap*4+k] = t; } } if (temp[i][i] == 0) { /* ** No non-zero pivot. The matrix is singular, which shouldn't ** happen. This means the user gave us a bad matrix. */ return FALSE; } t = temp[i][i]; for (k = 0; k < 4; k++) { temp[i][k] /= t; inverse[i*4+k] /= t; } for (j = 0; j < 4; j++) { if (j != i) { t = temp[j][i]; for (k = 0; k < 4; k++) { temp[j][k] -= temp[i][k]*t; inverse[j*4+k] -= inverse[i*4+k]*t; } } } } return TRUE; } GLMATRIX * glu_invert_matrix(GLMATRIX *p_in, GLMATRIX *p_out); typedef struct _GLDMATRIX { double _11,_12,_13,_14; double _21,_22,_23,_24; double _31,_32,_33,_34; double _41,_42,_43,_44; } GLDMATRIX; inline GLDMATRIX * gl2gld_matrix(glmatrix * mf, GLDMATRIX * md) { md->_11 = (double)mf->_11; md->_12 = (double)mf->_12; md->_13 = (double)mf->_13; md->_14 = (double)mf->_14; md->_21 = (double)mf->_21; md->_22 = (double)mf->_22; md->_23 = (double)mf->_23; md->_24 = (double)mf->_24; md->_31 = (double)mf->_31; md->_32 = (double)mf->_32; md->_33 = (double)mf->_33; md->_34 = (double)mf->_34; md->_41 = (double)mf->_41; md->_42 = (double)mf->_42; md->_43 = (double)mf->_43; md->_44 = (double)mf->_44; return(md); } inline GLMATRIX * gld2gl_matrix(GLDMATRIX * mf, glmatrix * md) { md->_11 = (float)mf->_11; md->_12 = (float)mf->_12; md->_13 = (float)mf->_13; md->_14 = (float)mf->_14; md->_21 = (float)mf->_21; md->_22 = (float)mf->_22; md->_23 = (float)mf->_23; md->_24 = (float)mf->_24; md->_31 = (float)mf->_31; md->_32 = (float)mf->_32; md->_33 = (float)mf->_33; md->_34 = (float)mf->_34; md->_41 = (float)mf->_41; md->_42 = (float)mf->_42; md->_43 = (float)mf->_43; md->_44 = (float)mf->_44; return(md); } #endif //__MATRIX_H__ berusky2-0.12/src/age/graph/scene_import_b2m.h0000644000175000017500000000320213674426075016162 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SCENE_IMPORT_B2M_H__ #define __SCENE_IMPORT_B2M_H__ bool scene_import_b2m(SCENE *p_scene, char *p_dir, char *p_file); bool scene_import_b2m(SCENE *p_scene, FHANDLE *f); bool scene_export_b2m(SCENE *p_scene, char *p_dir, char *p_file); bool scene_export_b2m(SCENE *p_scene, FHANDLE *f); #endif // __SCENE_IMPORT_B2M_H__ berusky2-0.12/src/age/graph/glwrapper.cpp0000644000175000017500000001766413674426075015312 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* A wrapper for some OpenGL functions */ // Constants and types #include "age.h" bool gl_active = FALSE; int gl_diffuse::diffuse_state = 0; int gl_specular::specular_state = 0; int gl_fog::fog_state = 0; int gl_fog::fog_state_temporary = 0; int gl_light::lighting_state = 0; int gl_z_buffer::depth_test_state = 0; int gl_z_buffer::zmask_state = 0; void gl_z_buffer::on(bool force) { if(!depth_test_state || force) { depth_test_state = TRUE; glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); } } void gl_z_buffer::off(bool force) { if(depth_test_state || force) { depth_test_state = FALSE; glDisable(GL_DEPTH_TEST); } } int gl_cull_mod::cull_state = 0; int gl_cull_mod::cull_side = 0; int gl_texture::multitext_units = 0; int gl_texture::text_akt = ERROR; int gl_texture::textures_2d[MAX_GL_TEXT_UNITS] = {0,0,0,0,0,0}; int gl_texture::textures_1d[MAX_GL_TEXT_UNITS] = {0,0,0,0,0,0}; GLint gl_texture::last_text_2d[MAX_GL_TEXT_UNITS] = {-1,-1,-1,-1,-1,-1}; GLint gl_texture::last_text_1d[MAX_GL_TEXT_UNITS] = {-1,-1,-1,-1,-1,-1}; GLenum gl_texture::arb_translation_table[MAX_GL_TEXT_UNITS] = { GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB, GL_TEXTURE4_ARB, GL_TEXTURE5_ARB }; /* int gl_texture_coordinates::texgen_s[MAX_GL_TEXT_UNITS]; int gl_texture_coordinates::texgen_t[MAX_GL_TEXT_UNITS]; int gl_texture_coordinates::texgen_r[MAX_GL_TEXT_UNITS]; int gl_texture_coordinates::texgen_q[MAX_GL_TEXT_UNITS]; GLMATRIX gl_texture_coordinates::texgen[MAX_GL_TEXT_UNITS]; */ int gl_texture_operators::op_last[MAX_GL_TEXT_UNITS] = { -1, -1, -1, -1, -1, -1}; void (*gl_texture_operators::op_func[MAX_TEXTURE_OPERATORS])(void) = { op_modulation_comb, op_modulation_comb, op_modulation_2x_comb, op_add, op_add_comb, op_decal, op_blend, op_replace, op_dot3_bump }; void gl_texture_operators::op_modulation(void) { glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); } void gl_texture_operators::op_modulation_comb(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } void gl_texture_operators::op_modulation_2x_comb(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f); } void gl_texture_operators::op_add(void) { glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_ADD); } void gl_texture_operators::op_add_comb(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } void gl_texture_operators::op_decal(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); } void gl_texture_operators::op_blend(void) { glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_BLEND); } void gl_texture_operators::op_replace(void) { glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); } void gl_texture_operators::op_dot3_bump(void) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } GLMATRIX gl_texture_coordinates::text_matrix[MAX_GL_TEXT_UNITS]; bool gl_texture_coordinates::text_matrix_state[MAX_GL_TEXT_UNITS]; // format -> name /* static char * texture_format_get(int format, char *p_name) { static int formats_num[] = {GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5, GL_RGB8, GL_RGBA8, GL_RGBA8, GL_LUMINANCE8, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE8_ALPHA8, GL_ALPHA8, GL_RGB8, GL_COMPRESSED_RGB_ARB, GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_LUMINANCE_ARB, GL_COMPRESSED_LUMINANCE_ALPHA_ARB, GL_COMPRESSED_LUMINANCE_ALPHA_ARB, GL_COMPRESSED_ALPHA_ARB, GL_RGB5}; static char formats_names[][50] = {"GL_RGB5", "GL_RGB5_A1", "GL_RGBA4", "GL_LUMINANCE8", "GL_LUMINANCE6_ALPHA2", "GL_LUMINANCE4_ALPHA4", "GL_ALPHA8", "GL_RGB5", "GL_RGB8", "GL_RGBA8", "GL_RGBA8", "GL_LUMINANCE8", "GL_LUMINANCE8_ALPHA8", "GL_LUMINANCE8_ALPHA8", "GL_ALPHA8", "GL_RGB8", "GL_COMPRESSED_RGB_ARB", "GL_COMPRESSED_RGBA_ARB", "GL_COMPRESSED_RGBA_ARB", "GL_COMPRESSED_LUMINANCE_ARB", "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", "GL_COMPRESSED_ALPHA_ARB", "GL_RGB5"}; assert((sizeof(formats_num)/sizeof(formats_num[0])) == (sizeof(formats_names)/sizeof(formats_names[0]))); #define FORMAT_NUM ((int)(sizeof(formats_num)/sizeof(formats_num[0]))) int i; for(i = 0; i < FORMAT_NUM; i++) { if(formats_num[i] == format) { strcpy(p_name,(const char *)formats_names[i]); return(p_name); } } return(NULL); } */ berusky2-0.12/src/age/graph/animation.h0000644000175000017500000001015513674426075014717 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Animation engine */ #ifndef __ANIMATION_H__ #define __ANIMATION_H__ /* Structure of animation: ----------------------- ------------------- | animation_track | ------------------- || \/ ------------------- | animation | --> GLMATRIX ------------------- /\ || ------------------- | animation_time | ------------------- Animation sequence: - update(time) - get or - update(time) - loop over all tracks */ /* * Animation templates - generic animations */ typedef class animation_template : public object_list { int lenght; public: int length_get(void) { return(lenght); } /* * Attached tracks */ private: ANIM_TRACK_HEAD tracks; public: ANIM_TRACK * track_new(ANIM_TYPE type); public: ANIM_TRACK * track_first_get(void); public: void update(int time); public: GLMATRIX * get(GLMATRIX *p_result); public: animation_template(int time_lenght) : object_list(NULL) { } ~animation_template(void) { } } ANIMATION_TEMPLATE; typedef class animation_template_head : public object_list_head { public: animation_template_head(void) : object_list_head(NULL) { } } ANIMATION_TEMPLATE_HEAD; /* * ANIMATION_TEMPLATE - handle to animation template */ typedef ANIMATION_TEMPLATE * ANIMATION_TEMPLATE_HANDLE; /* * Animated object - reference to object/matrix what will be animated */ typedef class animated_object : public llist_item { /* * Matrix what will be animated */ MATRIX_NOTIFIED *p_mat; public: animated_object(void) : p_mat(NULL) { } } ANIMATED_OBJECT; typedef struct animated_object_head : public llist_head { } ANIMATED_OBJECT_HEAD; /* Animation flags Animation features: - - autoremove after end - callback after end - run next animation after end */ #define ANIMATION_AUTOREMOVE (1<<0) #define ANIMATION_CHAIN (1<<0) /* * Runtime animation object */ typedef class animation_runtime : public flag_interface, public object_list { /* * Template what defines the animation */ ANIMATION_TEMPLATE *p_template; /* * Time in animation (and it's current state) */ ANIMATION_TRACK_TIME atime; /* * List of affected objects */ ANIMATED_OBJECT_HEAD objects; public: animation_runtime(ANIMATION_TEMPLATE *p_template); ~animation_runtime(void); } ANIMATION_RUNTIME; typedef class animation_runtime_head : public object_list_head { public: animation_runtime_head(void) : object_list_head(NULL) { } } ANIMATION_RUNTIME_HEAD; /* * ANIMATION_RUNTIME_HANDLE - handle to runtime animation */ typedef ANIMATION_RUNTIME * ANIMATION_RUNTIME_HANDLE; #endif // __ANIMATION_H__ berusky2-0.12/src/age/graph/vertex_arrays.h0000644000175000017500000002343013674426075015636 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Vertex arrays support routines * A wrapper for ARB_vertex_buffer_object */ /* TODO - rewrite this for closer interaction with meshes - strides */ #ifndef __VERTEX_ARRAYS_H__ #define __VERTEX_ARRAYS_H__ #include /**************************************************************************** Arrays settings configuration *************************************************************************** */ typedef class varray_vertex_configuration { #define MAX_ARRAY_TEXT 8 public: // ************************************************** // Vertex buffers // ************************************************** // currently attached vertex array static GLuint glstate_handle; // state of items static bool glstate_vertex; static bool glstate_diffuse; static bool glstate_specular; static bool glstate_normal; static bool glstate_text_act; static bool glstate_text[MAX_ARRAY_TEXT]; public: static void init(void) { glstate_handle = ERROR; glstate_vertex = FALSE; glstate_diffuse = FALSE; glstate_specular = FALSE; glstate_normal = FALSE; glstate_text_act = FALSE; int i; for(i = 0; i < MAX_ARRAY_TEXT; i++) glstate_text[i] = FALSE; } // Bind vertex buffer static bool bind(GLuint buffer_handle) { assert(buffer_handle > 0); if(glstate_handle != buffer_handle) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer_handle); glstate_handle = buffer_handle; } // TODO -> test? return(TRUE); } static void vertex_on(void) { if(!glstate_vertex) { glEnableClientState(GL_VERTEX_ARRAY); glstate_vertex = TRUE; } } static void vertex_off(void) { if(glstate_vertex) { glDisableClientState(GL_VERTEX_ARRAY); glstate_vertex = FALSE; } } static void vertex_set(bool state) { if(state) { vertex_on(); } else { vertex_off(); } } // Specular colors static void specular_on(void) { if(!glstate_specular) { glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); glstate_specular = TRUE; } } static void specular_off(void) { if(glstate_specular) { glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); glstate_specular = FALSE; } } static void specular_set(bool state) { if(state) { specular_on(); } else { specular_off(); } } // Diffuse colors static void diffuse_on(void) { if(!glstate_diffuse) { glEnableClientState(GL_COLOR_ARRAY); glstate_diffuse = TRUE; } } static void diffuse_off(void) { if(glstate_diffuse) { glDisableClientState(GL_COLOR_ARRAY); glstate_diffuse = FALSE; } } static void diffuse_set(bool state) { if(state) { diffuse_on(); } else { diffuse_off(); } } // Normals static void normal_on(void) { if(!glstate_normal) { glEnableClientState(GL_NORMAL_ARRAY); glstate_normal = TRUE; } } static void normal_off(void) { if(glstate_normal) { glDisableClientState(GL_NORMAL_ARRAY); glstate_normal = FALSE; } } static void normal_set(bool state) { if(state) { normal_on(); } else { normal_off(); } } // Active texture coordinates array static bool text_set_act(int num) { if(num < MAX_ARRAY_TEXT) { if(num != glstate_text_act) { glstate_text_act = num; //glClientActiveTextureARB(arb_prevodni_tabulka[num]); } return(TRUE); } else return(FALSE); } // Texture coordinates static void text_on(void) { if(!glstate_text[glstate_text_act]) { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glstate_text[glstate_text_act] = TRUE; } } static void text_off(void) { if(glstate_text[glstate_text_act]) { glDisableClientState(GL_TEXTURE_COORD_ARRAY); glstate_text[glstate_text_act] = FALSE; } } static void text_set(bool state) { if(state) { text_on(); } else { text_off(); } } static void text_on(int num) { text_set_act(num); if(!glstate_text[num]) { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glstate_text[num] = TRUE; } } static void text_off(int num) { if(glstate_text[num]) { text_set_act(num); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glstate_text[num] = FALSE; } } static void enable(void) { vertex_on(); text_on(0); } static void disable(void) { vertex_off(); diffuse_off(); specular_off(); normal_off(); int i; for(i = 0; i < MAX_ARRAY_TEXT; i++) { text_off(i); } } } VARRAY_VERTEX_CONFIGURATION; /**************************************************************************** Vertex array support routines *************************************************************************** */ #define SIZEOF_VERTEX (sizeof(VECT)) #define SIZEOF_NORMAL (sizeof(VECT)) #define SIZEOF_DIFFUSE (sizeof(RGBAF)) #define SIZEOF_SPECULAR (sizeof(RGBF)) #define SIZEOF_TEXT (sizeof(VECTUV)) #define RENDER_VERTEX 0x1 #define RENDER_NORMALS 0x2 #define RENDER_DIFFUSE 0x4 #define RENDER_SPECULAR 0x8 #define RENDER_TEXT(n) (0x10 << n) typedef class varray_vertex : public varray_vertex_configuration { int flag; // Handle of this vertex array and it's whole size GLuint handle; int size; // Indexes of data in vertex arrays int vertexnum; // Indexes of data in vertex arrays // ERROR (-1) if it isn't active int ivertexes; int inormals; int idiffuse; int ispecular; int itext[MAX_ARRAY_TEXT]; public: // Creates/destroy requested vertex array bool create(int vertex_num, bool normals, bool diff, bool spec, int text_num); void free(void); varray_vertex(void) { handle = ERROR; size = 0; vertexnum = 0; flag = 0; } ~varray_vertex(void) { free(); } // Uploads data to vertex array void upload_vertexes(void *p_data) { bind(handle); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, ivertexes, SIZEOF_VERTEX*vertexnum, p_data); flag |= RENDER_VERTEX; } void upload_normals(void *p_data) { bind(handle); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, inormals, SIZEOF_NORMAL*vertexnum, p_data); flag |= RENDER_NORMALS; } void upload_diffuse(void *p_data) { bind(handle); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, idiffuse, SIZEOF_DIFFUSE*vertexnum, p_data); flag |= RENDER_DIFFUSE; } void upload_specular(void *p_data) { bind(handle); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, ispecular, SIZEOF_SPECULAR*vertexnum, p_data); flag |= RENDER_SPECULAR; } void upload_text(int num, void *p_data) { bind(handle); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, itext[num], SIZEOF_TEXT*vertexnum, p_data); flag |= RENDER_TEXT(num); } // Sets arrays for rendering void set(void); } VARRAY_VERTEX; // ************************************************************* // Index array_configure // ************************************************************* typedef class varray_index_configuration { public: // ************************************************** // Index buffers // ************************************************** // currently attached index array static GLuint glstate_handle; // state of items static bool glstate_index; public: static void init(void) { glstate_index = FALSE; } // Bind index buffer static bool bind(GLuint buffer_handle) { assert(buffer_handle > 0); if(glstate_handle != buffer_handle) { glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffer_handle); glstate_handle = buffer_handle; } // TODO -> test? return(TRUE); } static void enable(void) { } static void disable(void) { } } VARRAY_INDEX_CONFIGURATION; typedef class varray_index : public varray_index_configuration { int flag; // Handle of this vertex array and it's whole size GLuint handle; int size; public: // Creates/destroy requested vertex array bool create(void); void free(void); varray_index(void) { handle = (GLuint)ERROR; size = 0; flag = 0; } ~varray_index(void) { free(); } // Uploads data to vertex array void upload_indexes(void *p_data) { bind(handle); } // Sets arrays for rendering void set(void); } VARRAY_INDEX; #define BUFFER_OFFSET(i) ((char *)NULL + (i)) #endif // __VERTEX_ARRAYS_H__ berusky2-0.12/src/age/graph/polar.h0000644000175000017500000000636613674426075014066 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __POLAR_H__ #define __POLAR_H__ // return rotation of this vector, +- PI inline float rotation_get(float x, float y) { VECT2DF tmp(x,y); tmp.norm(); float angle = acosf(tmp.x); if(tmp.y < 0) angle *= -1.0f; return(angle); } inline float lenght_get(float x, float y) { return(vect_size(x,y)); } inline float lenght_get(float x, float y, float z) { return(vect_size(x,y,z)); } inline void scalar2polar(float x, float y, float *p_rotation, float *p_lenght) { *p_rotation = rotation_get(x,y); *p_lenght = lenght_get(x,y); } inline void scalar2polar(float x, float y, float z, float *p_rotation, float *p_elevation, float *p_lenght) { *p_lenght = lenght_get(x,y,z); *p_rotation = rotation_get(x,z); *p_elevation = rotation_get(x,y); } inline void polar2scalar(float rotation, float lenght, float *p_x, float *p_y) { *p_x = cosf(rotation)*lenght; *p_y = sinf(rotation)*lenght; } inline void polar2scalar(float rotation, float elevation, float lenght, float *p_x, float *p_y, float *p_z) { *p_x = cosf(rotation)*lenght; *p_y = sinf(elevation)*lenght; *p_z = sinf(rotation)*lenght; } inline float angle_norm(float angle) { float mult = angle / (2*PI); if(mult > 1) { angle -= floorf(mult)*(2*PI); } if(angle < 0) { angle += 2*PI; } return(angle); } // ah*i + al*(1.0f-i) inline float angle_interpolate_sorted(float ah, float al, float i) { float i1 = 1.0f - i; float v1 = ah - al; float v2 = al + (2*PI-ah); if(v1 > v2) { // normal one return(ah*i + al*i1); } else { // move al al += 2*PI; return(angle_norm(ah*i + al*i1)); } } // Dist between two normalized angles <0,2PI> // a1*i + a2*(1.0f-i) inline float angle_interpolate(float a1, float a2, float i) { // A1 is bigger return((a1 < a2) ? angle_interpolate_sorted(a2,a1,1.0f-i) : angle_interpolate_sorted(a1,a2,i)); } #endif // __POLAR_H__ berusky2-0.12/src/age/graph/scene_import_txt.cpp0000644000175000017500000002432013674426075016660 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" class import_txt; /* * This structure is stored in data-file, * before every data-block (chunk) */ typedef struct _data_chunk_txt { int type; // type of stored data int size; // size of stored data (in bytes) } DATA_CHUNK_TXT; /* * A function for loading chunks from file */ typedef int (import_txt::*CHUNK_LOAD_TXT_FUNC)(FHANDLE *f, DATA_CHUNK_TXT *p_chunk); /* * Chunk loader structure */ typedef struct _chunk_loader_txt { CHUNK_LOAD_TXT_FUNC p_func; int chunk; } CHUNK_LOADER_TXT; /* * Group of chunk with the same meaning (i.e. meshes / materials / ...) */ typedef struct chunk_group_txt { CHUNK_LOADER_TXT *p_chunks; int chunk_num; int chunk_range_min; int chunk_range_max; bool check(DATA_CHUNK_TXT *p_chunk); } CHUNK_GROUP_TXT; /* * Main import/export class */ typedef class import_txt { SCENE *p_scene; // ************************************************************************* // Save routines - Meshes // ************************************************************************* /* * Save routines */ int game_mesh_save_mesh_name(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh) { fprintf(*f, "mesh: '%s'\n", p_mesh->name_get()); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_material(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->material_get()) { MESH_MATERIAL *p_mat = p_mesh->material_get(); fprintf(*f, "mesh material: '%s'\n", p_mat->name_get()); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_vertex(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int num = p_geom->vertexnum_get(); fprintf(*f, "mesh vertex num: %d\n", num); fprintf(*f, "mesh vertex list:\n"); VECT *p_pos = p_geom->position_get(); int i; for(i = 0; i < num; i++) { fprintf(*f, "%d: %f %f %f\n",i,p_pos[i].x,p_pos[i].y,p_pos[i].z); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_face(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int facenum = p_geom->facenum_get(); fprintf(*f, "mesh face num: %d\n", facenum/3); fprintf(*f, "mesh face list:\n"); int i; for(i = 0; i < facenum; i += 3) { fprintf(*f, "%d: %d %d %d\n",i/3, p_geom->face_get(i), p_geom->face_get(i+1), p_geom->face_get(i+2)); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } int game_mesh_save_mesh_maps(FHANDLE *f, GAME_MESH *p_mesh, int text_index) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int vertex_num = p_geom->vertexnum_get(); fprintf(*f, "mesh vertex map num: %d\n", vertex_num); fprintf(*f, "mesh vertex map index: %d\n", text_index); fprintf(*f, "mesh vertex map list:\n"); VECTUV *p_map = p_geom->uv_get(text_index); int i; for(i = 0; i < vertex_num; i++) { fprintf(*f, "%d: %f %f\n",i,p_map[i].u,p_map[i].v); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } /* * Save colors */ int game_mesh_save_mesh_colors(FHANDLE *f, GAME_MESH *p_mesh) { if(p_mesh && p_mesh->geometry_active()) { MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ); int num = p_geom->vertexnum_get(); fprintf(*f, "mesh vertex color diffuse num: %d\n", num); fprintf(*f, "mesh vertex color diffuse list:\n"); RGBAF *p_diff = p_geom->diffuse_get(); int i; for(i = 0; i < num; i++) { fprintf(*f, "%d: %f %f %f %f\n",i,p_diff[i].r, p_diff[i].g, p_diff[i].b, p_diff[i].a); } fprintf(*f, "mesh vertex color specular num: %d\n", num); fprintf(*f, "mesh vertex color specular list:\n"); RGBF *p_spec = p_geom->specular_get(); for(i = 0; i < num; i++) { fprintf(*f, "%d: %f %f %f %f\n",i,p_spec[i].r, p_spec[i].g, p_spec[i].b, 1.0f); } p_mesh->unlock(); return(TRUE); } else return(FALSE); } /* * Save mesh to file */ bool game_mesh_save(FHANDLE *f, GAME_MESH *p_mesh) { // Save general info game_mesh_save_mesh_name(f, p_mesh); // Save material game_mesh_save_mesh_material(f,p_mesh); // Save vertexes game_mesh_save_mesh_vertex(f, p_mesh); // Save faces game_mesh_save_mesh_face(f, p_mesh); // Save maps game_mesh_save_mesh_maps(f,p_mesh,0); game_mesh_save_mesh_maps(f,p_mesh,1); game_mesh_save_mesh_maps(f,p_mesh,2); game_mesh_save_mesh_maps(f,p_mesh,3); // Save colors game_mesh_save_mesh_colors(f,p_mesh); return(TRUE); } // ************************************************************************* // Save routines - Materials // ************************************************************************* /* * Material save routines */ int mesh_material_save_name(FHANDLE *f, MESH_MATERIAL *p_mat) { fprintf(*f, "material: '%s'\n", p_mat->name_get()); return(TRUE); } int mesh_material_save_color(FHANDLE *f, MESH_MATERIAL *p_mat) { fprintf(*f, "material diffuse:\n"); RGBAF *p_diff = p_mat->diffuse_get(); fprintf(*f, "%f %f %f %f\n",p_diff->r, p_diff->g, p_diff->b, p_diff->a); fprintf(*f, "material specular:\n"); RGBF *p_spec = p_mat->specular_get(); fprintf(*f, "%f %f %f %f\n",p_spec->r, p_spec->g, p_spec->b, 1.0f); return(TRUE); } int mesh_material_save_text(FHANDLE *f, MESH_MATERIAL *p_mat, int num) { MATERIAL_TEXT *p_text = p_mat->texture_get(num); if(p_text) { fprintf(*f, "material texture: '%s'\n",p_text->name_get()); return(TRUE); } else return(FALSE); } bool mesh_texture_save(FHANDLE *f, MATERIAL_TEXT *p_text, char *p_dir) { if(file_exists(p_dir, p_text->name_get())) return(TRUE); return(p_text->save(p_dir)); } // ************************************************************************* // Saves complete material to file // ************************************************************************* bool mesh_material_save(FHANDLE *f, MESH_MATERIAL *p_mat, char *p_dir) { pdebug(DEBUG_LOAD_CHUNK,"Saving material %s",p_mat->name_get()); mesh_material_save_name(f,p_mat); mesh_material_save_color(f,p_mat); int i; for(i = 0; i < 4; i++) { mesh_material_save_text(f, p_mat, i); MATERIAL_TEXT *p_text = p_mat->texture_get(); if(p_text) mesh_texture_save(f, p_text, p_dir); } return(TRUE); } public: /* * Save objects to data file */ bool save(char *p_dir, char *p_file) { FFILE f; // Open the file if(!f.open(p_dir, p_file, "wt", FALSE)) { return(FALSE); } // go through all materials and save them MESH_MATERIAL *p_mat = p_scene->material_get_first(); while(p_mat) { pdebug(DEBUG_LOAD_CHUNK,"Saving material %s",p_mat->name_get()); mesh_material_save(&f, p_mat, p_dir); p_mat = p_mat->material_next(); } // go through all meshes and save them GAME_MESH *p_mesh = p_scene->mesh_get_first(); while(p_mesh) { pdebug(DEBUG_LOAD_CHUNK,"Saving mesh %s",p_mesh->name_get()); game_mesh_save(&f, p_mesh); p_mesh = p_mesh->mesh_next(); } f.close(); return(TRUE); } public: import_txt(SCENE *p_scene_ref) { p_scene = p_scene_ref; } ~import_txt(void) { } } IMPORT_TXT; /* * Save objects to data file */ static bool scene_import_txt(SCENE *p_scene, FHANDLE *f) { return(FALSE); } bool scene_import_txt(SCENE *p_scene, char *p_dir, char *p_file) { MMHANDLE f; bool ret = FALSE; if(f.open(p_dir, p_file, "rb", FALSE)) { ret = scene_import_txt(p_scene, &f); f.close(); } return(ret); } bool scene_export_txt(SCENE *p_scene, char *p_dir, char *p_file) { IMPORT_TXT import(p_scene); return(import.save(p_dir, p_file)); } berusky2-0.12/src/age/graph/box.h0000644000175000017500000001075013674426075013531 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Bounding boxes basic class */ #ifndef __BOX_H__ #define __BOX_H__ typedef enum { PLANE_X, PLANE_Y, PLANE_Z } PLANE_TYPE; typedef enum box_type { BOX_NONE, BOX_AABB, BOX_OBB, BOX_CIRCLE } BOX_TYPE; class aabb; typedef class aabb AABB; class obb; typedef class obb OBB; typedef class box { protected: BOX_TYPE type; public: BOX_TYPE box_type_get(void) { return(type); } public: virtual box * copy(void) { return(new box); } public: virtual void set(void) {}; virtual void set(VECT *p_min, VECT *p_max) {}; virtual void set(float x, float y, float z, float dx, float dy, float dz) {}; virtual void set_len(VECT *p_center, VECT *p_len) {}; virtual void set_len(VECT *p_len) {}; virtual void set(VECT *p_list, int num, tface *p_face, int facenum) {}; virtual void set(GLMATRIX *p_mat, VECT *p_list, int num, tface *p_face, int facenum) {}; virtual void set(box *p_box) {}; public: virtual void adjust(VECT *p_vec) {}; void adjust(VECT *p_vec, int num) { int i; for(i = 0; i < num; i++, p_vec++) adjust(p_vec); } virtual void adjust(VECT *p_center, float radius) {}; public: virtual VECT * center_get(VECT *p_vec) { return(NULL); }; virtual VECT * center_get(GLMATRIX *p_mat, VECT *p_vec) { return(NULL); }; virtual VECT * length_get(VECT *p_len) { return(NULL); }; public: virtual bool visible(GLMATRIX *p_m) { return(FALSE); }; virtual bool visible_full(GLMATRIX *p_m) { return(FALSE); }; public: virtual bool inside(VECT *p_vec) { return(FALSE); }; virtual bool inside(GLMATRIX *p_m, VECT *p_vec) { return(FALSE); }; public: virtual int intersect_vector(VECT *p_a, VECT *p_b, VECT *p_intersect = NULL, float *p_t = NULL) { return(FALSE); }; virtual int intersect_vector(GLMATRIX *p_m, VECT *p_a, VECT *p_b, VECT *p_intersect = NULL, float *p_t = NULL) { return(FALSE); }; virtual int intersect(VECT *p_orig, VECT *p_dir, VECT *p_intersect = NULL, float *p_t = NULL) { return(FALSE); }; virtual int intersect(GLMATRIX *p_m, VECT *p_orig, VECT *p_dir, VECT *p_intersect = NULL, float *p_t = NULL) { return(FALSE); }; public: virtual bool intersect(box *p_box) { return(FALSE); } virtual float intersect_plane(VECT *p_a, PLANE_TYPE type) { return(0.0f); }; virtual void intersect_point(VECT *p_vec) {}; public: virtual float dist(VECT *p_vec) { return(0.0f); }; virtual void draw(GLMATRIX *p_m, RGBB color) {}; virtual void print(char *p_name = NULL) {}; public: virtual int border_vertexnum_get(void) { return(0); }; virtual VECT *border_get(VECT *p_border) { return(NULL); }; public: virtual box * transformate(GLMATRIX *p_m) { return(this); }; public: virtual float volume_get(void) { return(0.0f); }; public: virtual AABB * to_aabb(AABB *p_dest) { return(NULL); }; virtual OBB * to_obb(OBB *p_dest) { return(NULL); }; public: box(BOX_TYPE btype = BOX_NONE) { type = btype; } virtual ~box(void) { } } BOX; BOX * box_create(BOX_TYPE type); BOX * box_create(BOX * p_list, int num); BOX * box_copy(BOX *p_src); void box_remove(BOX **p_box); #endif // __BOX_H__ berusky2-0.12/src/age/graph/vertex_arrays.cpp0000644000175000017500000000673613674426075016203 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Vertex arrays support routines * A wrapper for ARB_vertex_buffer_object */ // Constants and types #include "age.h" // Static configuration of vertex arrays GLuint varray_vertex_configuration::glstate_handle = 0; bool varray_vertex_configuration::glstate_vertex = FALSE; bool varray_vertex_configuration::glstate_diffuse = FALSE; bool varray_vertex_configuration::glstate_specular = FALSE; bool varray_vertex_configuration::glstate_normal = FALSE; bool varray_vertex_configuration::glstate_text_act = FALSE; bool varray_vertex_configuration::glstate_text[MAX_ARRAY_TEXT] = { FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE }; // Creates requested vertex array bool varray_vertex::create(int vertex_num, bool normals, bool diff, bool spec, int text_num) { vertexnum = vertex_num; size = SIZEOF_VERTEX*vertexnum; if(normals) size += SIZEOF_NORMAL*vertexnum; if(diff) size += SIZEOF_DIFFUSE*vertexnum; if(spec) size += SIZEOF_SPECULAR*vertexnum; if(text_num > 0) size += SIZEOF_TEXT*vertexnum*text_num; glGenBuffersARB(1, &handle); glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); return(TRUE); } // Destroy requested vertex array void varray_vertex::free(void) { if(handle > 0 && glIsBufferARB(handle)) { glDeleteBuffersARB(1,&handle); handle = ERROR; } } // Sets arrays for rendering void varray_vertex::set(void) { bind(handle); assert(flag&RENDER_VERTEX); vertex_on(); glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(ivertexes)); if(flag&RENDER_NORMALS) { normal_on(); glNormalPointer(GL_FLOAT, 0, BUFFER_OFFSET(inormals)); } else { normal_off(); } if(flag&RENDER_NORMALS) { diffuse_on(); glColorPointer(4, GL_FLOAT, 0, BUFFER_OFFSET(idiffuse)); } else { diffuse_off(); } if(flag&RENDER_SPECULAR) { specular_on(); glSecondaryColorPointerEXT(3, GL_FLOAT, 0, BUFFER_OFFSET(ispecular)); } else { specular_off(); } int i; for(i = 0; i < MAX_ARRAY_TEXT; i++) { if(flag&RENDER_TEXT(i)) { text_on(i); glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(itext[i])); } else { text_off(i); } } } berusky2-0.12/src/age/graph/bitmap.h0000644000175000017500000000377313674426075014224 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* A bitmaps routines A life of bitmap(s): (load) -> RGB -> BITMAP -> load_to_vram -> clear_from_ram -> clear_from_vram ^ | (load) -> A ------ - SW/HW surfaces */ #ifndef __BITMAP_H__ #define __BITMAP_H__ /* // returns color with alpha color PIXEL_RGBA pixel_add_alpha(PIXEL_RGBA color, PIXEL_RGBA alpha_color) { } */ /* byte PackFloatInByte(float in) { return(byte)((in+1.0f) / 2.0f * 255.0f); } */ /* dword barva_to_bmp(dword barva) { return((barva << 8)|(barva >> 24)); } */ /* void alfa2bmp(bitmap *p_alfa); void to_dot3(void); void to_16bit(byte maska, int pruhl); */ #endif // __BITMAP_H__ berusky2-0.12/src/age/graph/intersect.h0000644000175000017500000001041113674426075014733 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __INTERSECT_H__ #define __INTERSECT_H__ /* * Basic intersection routines * * Functions names: * * intersect_(object)_(object) * * objects are ordered by number of their points * * objects: * * - ray - two points (origin+direction) * - line - two points * - triangle * - rectangle */ /* * Line/Ray and point p intersection */ bool intersect_ray_point(VECT *p_a, VECT *p_b, VECT *p_p, VECT *p_I, float *p_ti = NULL); bool intersect_ray_point(VECT2DI *p_a, VECT2DI *p_b, VECT2DI *p_p, VECT2DI *p_I, float *p_ti = NULL); bool intersect_line_point(VECT *p_a, VECT *p_b, VECT *p_p, VECT *p_I, float *p_ti = NULL); bool intersect_line_point(VECT2DI *p_a, VECT2DI *p_b, VECT2DI *p_p, VECT2DI *p_I, float *p_ti = NULL); /* * Line/Ray and Line/Ray intersection */ bool intersect_ray_ray(VECT2DI *p_a1, VECT2DI *p_b1, VECT2DI *p_a2, VECT2DI *p_b2, VECT2DI *p_p = NULL, float *p_t1 = NULL, float *p_t2 = NULL); bool intersect_ray_line(VECT2DI *p_a1, VECT2DI *p_b1, VECT2DI *p_a2, VECT2DI *p_b2, VECT2DI *p_p = NULL, float *p_t = NULL); bool intersect_line_line(VECT2DI *p_a1, VECT2DI *p_b1, VECT2DI *p_a2, VECT2DI *p_b2, VECT2DI *p_p = NULL); /* * Triangle intersection */ bool intersect_triangle_point(VECT2DI *p_v0, VECT2DI *p_v1, VECT2DI *p_v2, VECT2DI *p_p); bool intersect_triangle_ray(VECT2DI *p_p0, VECT2DI *p_p1, VECT2DI *p_p2, VECT2DI *p_a, VECT2DI *p_b, float *p_tn = NULL); bool intersect_triangle_line(VECT2DI *p_v0, VECT2DI *p_v1, VECT2DI *p_v2, VECT2DI *p_a, VECT2DI *p_b, float *p_t1 = NULL, float *p_t2 = NULL); bool intersect_triangle_ray_cull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t = NULL, float *p_u = NULL, float *p_v = NULL); bool intersect_triangle_ray_ncull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t = NULL, float *p_u = NULL, float *p_v = NULL); bool intersect_triangle_line_cull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t = NULL, float *p_u = NULL, float *p_v = NULL); bool intersect_triangle_line_ncull(VECT *p_v0, VECT *p_v1, VECT *p_v2, VECT *p_orig, VECT *p_dir, float *p_t = NULL, float *p_u = NULL, float *p_v = NULL); #define intersect_triangle_line intersect_triangle_line_cull /* * Rect and Point/Line/Ray intersection */ typedef enum { INTERSECT_NONE = 0, INTERSECT_CROSS, INTERSECT_INSIDE } INTERSECTION_TYPE; inline int intersect_rect_point(RECT2DI *p_r, VECT2DI *p_p) { return((p_p->x >= p_r->x && p_p->x <= p_r->x+p_r->dx && p_p->y >= p_r->y && p_p->y <= p_r->y+p_r->dy) ? 1 : 0); } INTERSECTION_TYPE intersect_rect_ray(RECT2DI *p_r, VECT2DI *p_a, VECT2DI *p_b, float *p_tn = NULL, float *p_tf = NULL); INTERSECTION_TYPE intersect_rect_line(RECT2DI *p_r, VECT2DI *p_a, VECT2DI *p_b, float *p_tn = NULL, float *p_tf = NULL); INTERSECTION_TYPE intersect_rect_triangle(RECT2DI *p_r, VECT2DI *p_v0, VECT2DI *p_v1, VECT2DI *p_v2); INTERSECTION_TYPE intersect_rect_rect(RECT2DI *p_r, RECT2DI *p_r2); #endif // __INTERSECT_H__ berusky2-0.12/src/age/graph/scene_import_3ds.cpp0000644000175000017500000022643613674426075016546 00000000000000/* * . . . .. * . . . . . . * . . * . . . . * . . . . . . * . . . . .. * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* ************************************************************************ 3DS file format reader v1.4 Written by Lukas Pokorny, a.k.a.Shakul/MovSD. Based on 3DSRDR v1.2 by Javier Arevalo, a.k.a. Jare/Iguana. ************************************************************************* - DISCLAIMER - I hope I have not broken any patents or trade secrets by releasing this info. This is purely a mind exercise to break into a file format that is quite useful to know. As far as I have been told a file format is not subject to anything such as copyright or patent, so I have done this because I believe I'm allowed to. I PLACE THIS FILE IN THE PUBLIC DOMAIN, SO EVERYTHING CONTAINED HERE IS TOTALLY FREE FOR YOU TO EXPLORE AND USE. I DISCLAIM ANY AND ALL EVENTS COMING OUT OF ANY POSSIBLE USE (OR LACK OF USE) OR EXISTANCE OF THIS FILE. I WON'T BE LIABLE FOR ANYTHING RELATED TO THIS FILE, OR ANY PRIOR OR FUTURE VERSION OF IT. All trademarks mentioned are property of their respective holders. ************************************************************************* This 3DS reader is based on 3DSRDR v1.2 by Javier Arevalo, AKA Jare/Iguana. I needed good 3DS reader and 3DSRDR v1.2 was best one around. So I rewrote it and added lot of new chunks readers (nearly 40 of them.) Actually I changed the structure of the original source i lot, so that's why I don't call this 3DSRDR. Sources of chunk info were: The Unofficial 3DS File Format v1.0 by Jeff Lewis (werewolf@worldgate.com) and 3D Studio File Format Autodesk Ltd. Document Revision 0.91 - June 1996 Rewritten by Martin van Velsen (email: vvelsen@ronix.ptf.hro.nl ) and Robin Fercoq ( 3ds-bin + mli )(email: robin@msrwww.fc-net.fr) Based on Original document by Jim Pitts ( email: jp5@ukc.ac.uk ) (It's quite strange that this Autodesk text is still missing many importand chunks) Some undocumented chunks (e.g. BoxMap) digged by me (Lukas Pokorny.) Original info from 3DSRDR v1.2 follows: Heavily based on info on the file 3DS_08.TXT by Jim Pitts (jp5@ukc.ac.uk) Basic material-related stuff digged up by Jare. Track info stuff too. Thanks to the Egerter brothers of WGT fame and to Walken/Impact studios for extra info, Rex Deathstar for support. And definitely to Xanthome/Darkzone for you know why. And of course, respect to Avatar/Legend Design for being here before all of us. For a cool example of actual reading of 3DS files, look no further than 3DSCO20.ZIP by Mats Byggmastar aka. MRI. I personally prefer using a table-driven modification of this code, but both approaches are quite ok and his is much faster to write and follow. Now only lack is someone to explain how to make use of all this stuff i.e. how exactly is data stored, how spline interpolations are performed, what are those things called quaternions, etc. And also, maybe, dig the rest of the chunks until we are actually able to write 3DS files instead of just being bored reading. There's lots to do. If you decide to work on this further, please make your findings public like we have already done, ok? Upload it to x2ftp.oulu.fi, THE place for programming info, and/or to ftp.cdrom.com. But please PUBLISH it! ************************************************************************* Change log: 3DSREAD v1.4: (Lukas Pokorny) - Added file version and mesh version readers. - Added more material attributes readers (shiness, transparency, map flags, shading type, and more! - Added box mapping reader. - Added dummy name reader. - Info about track flags on keyframes. - Added color, morph, hide, fov, roll tracks. - Error checking on file reading improved. - Chunk reading routines now take only one file handle, other parametrs are global variables. I like it more this way. - Code structure changed, I like it more this way :-) 3DSRDR v1.2: (Javier Arevalo) - Added change log to have some idea what's going on. - Added pivot point reading inside tracks stuff. - Info about spline flags on keyframes. - Added face edge visibility info. - Finally!! Those flags that mark when the texture is wrapping around inside a face. This happens when you apply spherical or cylindrical coordinates, the faces along the 0 axis don't get proper mapping coords. Someone describe how to fix this? - Added -quiet parm, only displays minimal chunk info. - Object parent number is stored in CHUNK_TRACKOBJNAME. This makes reference to the node number in CHUNK_OBJNUMBER. - Object number changed to unsigned. Parent 65535 means none. - Added CHUNK_PRJ and CHUNK_MLI to allow inspecting .PRJ and .MLI files (they're basically the same chunks as .3DS). - Added banner to identify myself, and disclaimer for "just in case" possibilities. - Corrected possible bug when chunklen == 0 (it was not a chunk). - Added several name descriptions of chunks. *********************************************************************** */ /* import 3ds-meshes */ #include "age.h" typedef struct __attribute__ ((__packed__)) { word id; dword len; } TChunkHeader, *PChunkHeader; enum { CHUNK_VER = 0x0002, CHUNK_RGBF = 0x0010, CHUNK_RGBB = 0x0011, CHUNK_RGBB2 = 0x0012, CHUNK_AMOUNTOF = 0x0030, // added CHUNK_AMOUNTOFF = 0x0031, // tbc (float) CHUNK_MASTERSCALE=0x0100, // added CHUNK_PRJ = 0xC23D, CHUNK_MLI = 0x3DAA, CHUNK_MESHVER = 0x3D3E, CHUNK_MAIN = 0x4D4D, CHUNK_OBJMESH = 0x3D3D, CHUNK_BKGCOLOR = 0x1200, CHUNK_AMBCOLOR = 0x2100, CHUNK_OBJBLOCK = 0x4000, CHUNK_TRIMESH = 0x4100, CHUNK_VERTLIST = 0x4110, CHUNK_VERTFLAGS = 0x4111, // added CHUNK_FACELIST = 0x4120, CHUNK_FACEMAT = 0x4130, CHUNK_MAPLIST = 0x4140, CHUNK_SMOOLIST = 0x4150, CHUNK_TRMATRIX = 0x4160, CHUNK_MESHCOLOR = 0x4165, // added CHUNK_TXTINFO = 0x4170, // added CHUNK_BOXMAP = 0x4190, // added CHUNK_LIGHT = 0x4600, CHUNK_SPOTLIGHT = 0x4610, CHUNK_CAMERA = 0x4700, CHUNK_HIERARCHY = 0x4F00, CHUNK_VIEWPORT = 0x7001, CHUNK_MATERIAL = 0xAFFF, CHUNK_MATNAME = 0xA000, CHUNK_AMBIENT = 0xA010, CHUNK_DIFFUSE = 0xA020, CHUNK_SPECULAR = 0xA030, CHUNK_SHININESS = 0xA040, // added CHUNK_SHINSTRENGTH = 0xA041, // added CHUNK_TRANSPARENCY = 0xA050, // added CHUNK_TRANSFALLOFF = 0xA052, // added CHUNK_REFBLUR = 0xA053, // added CHUNK_SELFILLUM = 0xA084, // added CHUNK_TWOSIDED = 0xA081, // added CHUNK_TRANSADD = 0xA083, // added CHUNK_WIREON = 0xA085, // added CHUNK_WIRESIZE = 0xA087, // added CHUNK_SOFTEN = 0xA08C, // added CHUNK_SHADING = 0xA100, // added CHUNK_TEXTURE = 0xA200, CHUNK_REFLECT = 0xA220, // added CHUNK_BUMPMAP = 0xA230, CHUNK_BUMPAMOUNT= 0xA252, // added CHUNK_MAPFILE = 0xA300, CHUNK_MAPFLAGS = 0xA351, // added CHUNK_MAPBLUR = 0xA353, // added CHUNK_MAPUSCALE = 0xA354, // added CHUNK_MAPVSCALE = 0xA356, // added CHUNK_MAPUOFFSET= 0xA358, // added CHUNK_MAPVOFFSET= 0xA35A, // added CHUNK_MAPROTANGLE=0xA35C, // added CHUNK_MATXPFALLIN=0xA08A, CHUNK_KEYFRAMER = 0xB000, CHUNK_AMBIENTKEY = 0xB001, CHUNK_TRACKINFO = 0xB002, CHUNK_TRACKCAMERA = 0xB003, CHUNK_TRACKCAMTGT = 0xB004, CHUNK_TRACKLIGHT = 0xB005, CHUNK_TRACKLIGTGT = 0xB006, CHUNK_TRACKSPOTL = 0xB007, CHUNK_FRAMES = 0xB008, CHUNK_KFCURTIME = 0xB009, // added CHUNK_KFHDR = 0xB00A, // added CHUNK_TRACKOBJNAME = 0xB010, CHUNK_DUMMYNAME = 0xB011, // added CHUNK_PRESCALE = 0xB012, // added CHUNK_TRACKPIVOT = 0xB013, CHUNK_BOUNDBOX = 0xB014, // added CHUNK_MORPH_SMOOTH = 0xB015, // added CHUNK_TRACKPOS = 0xB020, CHUNK_TRACKROTATE = 0xB021, CHUNK_TRACKSCALE = 0xB022, // added? CHUNK_TRACKFOV = 0xB023, CHUNK_TRACKROLL = 0xB024, CHUNK_TRACKCOLOR = 0xB025, // added CHUNK_TRACKMORPH = 0xB026, // added CHUNK_TRACKHOTSPOT = 0xB027, // added CHUNK_TRACKFALLOFF = 0xB028, // added CHUNK_TRACKHIDE = 0xB029, // added CHUNK_OBJNUMBER = 0xB030, }; #define Read_NULL NULL #define OK 1 #define ERROR_READER (-1) static SCENE *p_scene; static GAME_MESH *p_mesh; static MESH_MATERIAL *p_mat; static MATERIAL_TEXT *p_text; static CAMERA_BASE *p_camera; static char readed_object_name[MAX_NAME]; static int readed_object_facenum; static int load_texture_map; typedef enum { COLOR_NONE = 0, COLOR_AMBIENT, COLOR_DIFFUSE } COLOR_TYPE; static COLOR_TYPE color_type; /* static int track_mod; // 0 = objekt, // 1 = camera track, // 2 = target track static int texture_map; static KEYFRAMER_DATA keyframe; static TRACK_INFO *p_track; // pointer na aktualni track static int dummy_objektu; static byte readed_object_name[200]; static KAMERA kamery[MAX_EDIT_KAMER]; */ static int Read_Skip(FHANDLE *f) {if (f) {}; return OK; } /* void key_3ds_to_ber(KEY_POINT_3DS *p_3ds, KEY_POINT_BRS *p_brs) { p_brs->bias = p_3ds->bias; p_brs->continuity = p_3ds->continuity; p_brs->easefrom = p_3ds->easefrom; p_brs->easeto = p_3ds->easeto; p_brs->tension = p_3ds->tension; p_brs->time = p_3ds->frame*SIM_KONSTI; } static int check_track(KEY_POINT_BRS *p_key, int num, int *p_klic) { int i; for(i = 1; i < num; i++) { if(p_key[i-1].time == p_key[i].time) { *p_klic = i-1; return(FALSE); } } return(TRUE); } */ // 3DS version reader static int Read_Ver(FHANDLE *f) { short v; if(f->read(&v, sizeof(v)) < 1) return ERROR_READER; v++; pdebug(DEBUG_LOAD_3DS,"Version of 3ds file: %d",v); return OK; } // Mesh version reader static int Read_MeshVer(FHANDLE *f) { short v; if (f->read(&v, sizeof(v)) < 1) return ERROR_READER; v++; pdebug(DEBUG_LOAD_3DS,"Mesh version: %d",v); return OK; } // RGB (float) reader static int Read_RGBF(FHANDLE *f) { float c[3]; if (f->read(c, sizeof(c)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Red: %f, Green: %f, Blue: %f", c[0], c[1], c[2]); return OK; } // RGB (byte) reader static int Read_RGBB(FHANDLE *f) { byte c[3]; if (f->read(c, sizeof(c)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Red: %d, Green: %d, Blue: %d", c[0], c[1], c[2]); switch(color_type) { case COLOR_AMBIENT: { RGBAF *p_amb = p_mat->ambient_get(); p_amb->r = (float)c[0]/MAX_BYTE_F; p_amb->g = (float)c[1]/MAX_BYTE_F; p_amb->b = (float)c[2]/MAX_BYTE_F; break; } case COLOR_DIFFUSE: { RGBAF *p_diff = p_mat->diffuse_get(); p_diff->r = (float)c[0]/MAX_BYTE_F; p_diff->g = (float)c[1]/MAX_BYTE_F; p_diff->b = (float)c[2]/MAX_BYTE_F; p_diff->a = 1.0f; break; } default: break; } color_type = COLOR_NONE; return OK; } // Amount reader static int Read_AmountOf(FHANDLE *f) { word a; if (f->read(&a, sizeof (a)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Amount: %d", a); return OK; } // Master scale reader static int Read_MasterScale(FHANDLE *f) { float s; if (f->read(&s, sizeof (s)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Master scale: %f\n", s); return OK; } // Object block reader // Nacteni jmena objektu + zacatek objektu static int Read_ObjBlock(FHANDLE *f) { if(f->read_string(readed_object_name,MAX_NAME) < 1) return ERROR_READER; return OK; } static int Read_TriMesh(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS, "Mesh %s",readed_object_name); p_mesh = p_scene->mesh_create(readed_object_name); readed_object_name[0] = '\0'; return OK; } // Vertex list reader static int Read_VertList(FHANDLE *f) { word nv; float c[3]; if(!p_mesh) { return ERROR_READER; } if(f->read(&nv, sizeof(nv)) < 1) return(ERROR_READER); MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); p_geom->vertex_new(nv); VECT *p_vert = p_geom->position_get(); int i; for(i = 0; i < nv; i++) { f->read(&c,sizeof(c),TRUE); p_vert[i].x = c[0]; p_vert[i].y = c[2]; p_vert[i].z = c[1]; } p_mesh->unlock(); return OK; } // Vertex flags reader static int Read_VertFlags(FHANDLE *f) { word nv; word fl; if (f->read(&nv, sizeof(nv)) < 1) return ERROR_READER; // spaces(ind); // printf("Vertices flags: %d\n", nv); while (nv-- > 0) { if (f->read(&fl, sizeof(fl)) < 1) return ERROR_READER; // spaces(ind+4); // printf("Flags: %d\n", fl); } return OK; } // Face list reader static int Read_FaceList(FHANDLE *f) { word nv,i; word c[3]; word flags; if(!p_mesh) { return(ERROR_READER); } if(f->read(&nv, sizeof(nv)) < 1) return(ERROR_READER); MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); readed_object_facenum = nv; nv *= 3; p_geom->face_new(nv); for(i = 0; i < nv; i += 3) { if(f->read(c, sizeof(c)) < 1) return(ERROR_READER); if(f->read(&flags, sizeof(flags)) < 1) return(ERROR_READER); p_geom->face_set(i, c[0]); p_geom->face_set(i+1,c[1]); p_geom->face_set(i+2,c[2]); // spaces(ind+2); // printf("A %d, B %d, C %d, 0x%X:", c[0], c[1], c[2], flags); // printf(" AB %d BC %d CA %d UWrap %d VWrap %d\n", // (flags & 0x04) != 0, (flags & 0x02) != 0, (flags & 0x01) != 0, // (flags & 0x08) != 0, (flags & 0x10) != 0); } return OK; } // Face material reader static int Read_FaceMat(FHANDLE *f) { word n, nf; char mtname[50]; // printf("Material name for faces: "); if(f->read_string(mtname,49) < 1) return(ERROR_READER); if (f->read(&n, sizeof(n)) < 1) return ERROR_READER; while (n-- > 0) { if (f->read(&nf, sizeof(nf)) < 1) return ERROR_READER; } // We don't support multi-material meshes now MESH_MATERIAL *p_mat = p_scene->material_get(mtname); if(p_mat) { p_mesh->material_set(p_mat); } return OK; } // Maping list reader static int Read_MapList(FHANDLE *f) { word nv,i; float c[2]; if(!p_mesh) { return(ERROR_READER); } if(f->read(&nv, sizeof(nv)) < 1) return(ERROR_READER); MESH_GEOMETRY *p_geom = p_mesh->lock(LOCK_READ_WRITE); if(p_geom->vertexnum_get() != nv) return(ERROR_READER); VECTUV *p_vert = p_geom->uv_get(); for(i = 0; i < nv; i++) { if(f->read(c, sizeof(c)) < 1) return(ERROR_READER); if ((c[0] < 1024*1024) && (c[1] < 1024*1024) && (c[0] > -1024*1024) && (c[1] > -1024*1024)) { p_vert[i].u = c[0]; p_vert[i].v = c[1]; } } p_mesh->unlock(); return OK; } // Smoothing list reader static int Read_SmooList(FHANDLE *f) { dword s; word nv; nv = readed_object_facenum; while (nv-- > 0) { if (f->read(&s, sizeof(s)) < 1) return ERROR_READER; // spaces(ind+4); // for (i = 0; i < 32; i++) if (s & (1 << i)) printf("%d, ", i + 1); // printf("\n"); } return OK; } // Transformation matrix reader static int Read_TrMatrix(FHANDLE *f) { GLMATRIX mat; float m[4][3]; int i,j; for(i=0;i<4;i++) { for(j=0;j<3;j++) { f->read(&m[i][j],sizeof(float)); } } mat.init(); mat._11 = m[0][0]; mat._21 = m[2][0]; mat._31 = m[1][0]; mat._12 = m[0][2]; mat._22 = m[2][2]; mat._32 = m[1][2]; mat._13 = m[0][1]; mat._23 = m[2][1]; mat._33 = m[1][1]; mat._41 = m[3][0]; mat._42 = m[3][2]; mat._43 = m[3][1]; p_mesh->world_set(&mat); return OK; } // Box mapping reader static int Read_BoxMap(FHANDLE *f) { char tmp[200]; if (f->read_string(tmp,200) < 1) return ERROR_READER; if (f->read_string(tmp,200) < 1) return ERROR_READER; if (f->read_string(tmp,200) < 1) return ERROR_READER; if (f->read_string(tmp,200) < 1) return ERROR_READER; if (f->read_string(tmp,200) < 1) return ERROR_READER; if (f->read_string(tmp,200) < 1) return ERROR_READER; return OK; } // Light position reader static int Read_Light(FHANDLE *f) { float c[3]; if (f->read(c, sizeof(c)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Pozice svetla - X: %f, Y: %f, Z: %f", c[0], c[1], c[2]); return OK; } // Spotlight target reader static int Read_SpotLight(FHANDLE *f) { float c[5]; if (f->read(c, sizeof(c)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Spotlight - Target X: %f, Y: %f, Z: %f; Hotspot %f, Falloff %f", c[0], c[1], c[2], c[3], c[4]); return OK; } // Camera reader static int Read_Camera(FHANDLE *f) { float c[8]; VECT p(0,0,0); if(f->read(c, sizeof(c)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Camera %s",readed_object_name); pdebug(DEBUG_LOAD_3DS,"Position: X: %f, Y: %f, Z: %f", c[0], c[1], c[2]); pdebug(DEBUG_LOAD_3DS,"Target: X: %f, Y: %f, Z: %f", c[3], c[4], c[5]); pdebug(DEBUG_LOAD_3DS,"Bank: %f, Lens: %f", c[6], c[7]); /* strcpy(kamery[akt_kamera].jmeno,readed_object_name); // pozice kamery[akt_kamera].p.x = c[0]; kamery[akt_kamera].p.z = c[1]; kamery[akt_kamera].p.y = c[2]; // target kamery[akt_kamera].t.x = c[3]; kamery[akt_kamera].t.y = c[5]; kamery[akt_kamera].t.z = c[4]; // roll kamery[akt_kamera].roll = DEG2RAD(c[6]); // ratace kamery podle osy pohledu // fov kamery[akt_kamera].fov = DEG2RAD((fabs(c[7]) < EPSILON) ? 45.0f : 2400.0f/c[7]); // pyramida kamery[akt_kamera].p_objekt = kameru_dratovou_vyrob(&kamery[akt_kamera].p, &kamery[akt_kamera].t, kamery[akt_kamera].fov, c[6]); // position-body kamery[akt_kamera].p_pos = vyrob_krychli_dratovou(&p,0.2f,0.2f,0.2f,0xffffffff); // target-body p.z = vzdal_bodu_bod(&kamery[akt_kamera].p,&kamery[akt_kamera].t); kamery[akt_kamera].p_target=vyrob_krychli_dratovou(&p,0.2f,0.2f,0.2f,0xffffffff); akt_kamera++; */ return OK; } // Material name reader static int Read_MatName(FHANDLE *f) { char material_name[200]; if(f->read_string(material_name,200) < 1) return(ERROR_READER); p_mat = p_scene->material_create(material_name); pdebug(DEBUG_LOAD_3DS,"Material '%s'",material_name); return OK; } static int Read_Transparent(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Transparency"); return OK; } // Two sided material reader static int Read_TwoSided(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Two-sided"); return OK; } // Trans add material static int Read_TransAdd(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Trans-add"); return OK; } // Wireframe material static int Read_WireOn(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Wireframe\n"); return OK; } // Wire size reader static int Read_WireSize(FHANDLE *f) { float w; if(f->read(&w, sizeof(w)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Wire size: %f\n", w); return OK; } // Soften material static int Read_Soften(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Soften\n"); return OK; } // Shading type reader static int Read_Shading(FHANDLE *f) { word w; if (f->read(&w, sizeof(w)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Shading: %d\n", w); return OK; } // Map file name reader static int Read_MapFile(FHANDLE *f) { char file[200]; if(f->read_string(file,200) < 1) return(ERROR_READER); if(load_texture_map) { p_text = p_scene->texture_get(file); //strcpy(p_cnf->p_mat[akt_matros]->textfile[0],p_cnf->p_text[t].jmeno); //p_cnf->p_mat[akt_matros]->p_text[0] = p_cnf->p_text+t; } load_texture_map = 0; return OK; } // Map flags reader static int Read_MapFlags(FHANDLE *f) { word flags; if(f->read(&flags, sizeof (flags)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map flags: %i", flags); return OK; } // Map blurring reader static int Read_MapBlur(FHANDLE *f) { float blur; if(f->read(&blur, sizeof (blur)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map blurring: %f", blur); return OK; } // Map U scale reader static int Read_MapUScale(FHANDLE *f) { float u; if(f->read(&u, sizeof (u)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map U scale: %f", u); /* p_cnf->p_mat[akt_matros]->tds.u_scale = u; p_cnf->p_mat[akt_matros]->flag |= MAT_3DS_FLAGS; */ return OK; } // Map V scale reader static int Read_MapVScale(FHANDLE *f) { float v; if(f->read(&v, sizeof (v)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map V scale: %f", v); /* p_cnf->p_mat[akt_matros]->tds.v_scale = v; p_cnf->p_mat[akt_matros]->flag |= MAT_3DS_FLAGS; */ return OK; } // Map U offset reader static int Read_MapUOffset(FHANDLE *f) { float u; if(f->read(&u, sizeof (u)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map U offset: %f", u); /* p_cnf->p_mat[akt_matros]->tds.u_offset = u; p_cnf->p_mat[akt_matros]->flag |= MAT_3DS_FLAGS; */ return OK; } // Map V scale reader static int Read_MapVOffset(FHANDLE *f) { float v; if(f->read(&v, sizeof (v)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map V offset: %f", v); /* p_cnf->p_mat[akt_matros]->tds.v_offset = v; p_cnf->p_mat[akt_matros]->flag |= MAT_3DS_FLAGS; */ return OK; } // Map rotation angle reader static int Read_MapRotAngle(FHANDLE *f) { float a; if (f->read(&a, sizeof (a)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Map rotation angle: %f", a); /* p_cnf->p_mat[akt_matros]->tds.rot_angle = DEG2RAD(-a); p_cnf->p_mat[akt_matros]->flag |= MAT_3DS_FLAGS; */ return(OK); } // ********** Keyframer reading routines: ********** // novy track-info static int Read_TrackInfo(FHANDLE *f) { /* if(!keyframe.p_track) { // insert-first if(!(keyframe.p_track = malloc(sizeof(TRACK_INFO)))) chyba("Pamet!"); memset(keyframe.p_track,0,sizeof(TRACK_INFO)); p_track = keyframe.p_track; } else { // insert TRACK_INFO *p_tmp; p_tmp = keyframe.p_track; while(p_tmp->p_next) // posun v lin. seznamu p_tmp = p_tmp->p_next; if(!(p_tmp->p_next = malloc(sizeof(TRACK_INFO)))) chyba("Pamet!"); memset(p_tmp->p_next,0,sizeof(TRACK_INFO)); p_track = p_tmp->p_next; } track_mod = 0; */ return OK; } // Frame interval reader static int Read_Frames(FHANDLE *f) { dword c[2]; if (f->read(c, sizeof(c)) < 1) return ERROR_READER; /* pdebug(DEBUG_LOAD_3DS,"Keyframe informace..."); pdebug(DEBUG_LOAD_3DS,"Start: %ld, End: %ld", c[0], c[1]); keyframe.frame_start = c[0]; keyframe.frame_stop = c[1]; // Prekopiruj informace o kamerach p_cnf->kamakt = 0; p_cnf->kamnum = akt_kamera; akt_kamera = -1; //pri cteni tracku se udela +1 */ return OK; } // Track object name reader static int Read_TrackObjName(FHANDLE *f) { char pom[50]; word w[2]; word parent; if(f->read_string(pom,50) < 1) return ERROR_READER; if(f->read(w, sizeof(w)) < 1) return ERROR_READER; if(f->read(&parent, sizeof(parent)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Track object name %s",pom); pdebug(DEBUG_LOAD_3DS,"Object name data: Flags 0x%X, 0x%X, Parent %d", w[0], w[1], parent); /* switch(track_mod) { case 0: assert(p_track); strcpy(p_track->jmeno,pom); p_track->parent = parent; p_track->flags[0] = w[0]; p_track->flags[1] = w[1]; break; case 1: strcpy(kamery[akt_kamera].tracky[0].jmeno,pom); kamery[akt_kamera].tracky[0].parent = parent; // kamery[akt_kamera].tracky[0].flags[0] = w[0]; // kamery[akt_kamera].tracky[0].flags[1] = w[1]; break; default: break; } */ return OK; } // Dummy object name reader static int Read_DummyName(FHANDLE *f) { char jmeno[500]; if (f->read_string(jmeno,500) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Dummy objekt %s",jmeno); /* assert(p_track); dummy_objektu++; */ return OK; } // Pivot point position reader static int Read_PivotPoint(FHANDLE *f) { float pos[3]; if (f->read(pos, sizeof(pos)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Pivot X: %f, Y: %f, Z: %f", pos[0], pos[2], pos[1]); /* assert(p_track); p_track->pivot.x = pos[0]; p_track->pivot.y = pos[2]; p_track->pivot.z = pos[1]; */ return OK; } // Key info flags for position, rotation and scaling: // Until I know the meaning of each bit in flags I assume all mean // a following float data. // Spline flags reader // NOTE THIS IS NOT A CHUNK, but A PART OF SEVERAL CHUNKS /* static int SplineFlagsReader(FHANDLE *f, int ind, word * nf, KEY_POINT_3DS *p_key) { unsigned int i; float dat; word unknown; word flags; if (f->read(nf, sizeof(word)) < 1) return ERROR_READER; if (f->read(&unknown, sizeof(unknown)) < 1) return ERROR_READER; if (f->read(&flags, sizeof(flags)) < 1) return ERROR_READER; // spaces(ind+2); // printf("Frame %3d: Flags 0x%X\n", *nf, flags); pdebug(DEBUG_LOAD_3DS,"Frame %3d: Flags 0x%X", *nf, flags); memset(p_key,0,sizeof(*p_key)); p_key->frame = *nf; p_key->flags = flags; for (i = 0; i < 16; i++) { static const char *flagnames[] = {"Tension", "Continuity", "Bias", "Ease To", "Ease From",}; if (flags & (1 << i)) { if (f->read(&dat, sizeof(dat)) < 1) return ERROR_READER; if (i < (sizeof(flagnames)/sizeof(*flagnames))) { //i = 0 -> Tension //i = 1 -> Continuity //i = 2 -> Bias //i = 3 -> Erase To //i = 4 -> Erase From switch(i) { case 0: p_key->tension = dat; break; case 1: p_key->continuity = dat; break; case 2: p_key->bias = dat; break; case 3: p_key->easeto = dat; break; case 4: p_key->easefrom = dat; break; } } else { // spaces(ind+13); // printf("%-15s = %f\n", "Unknown", dat); } } } return OK; } */ // Track flags reader // NOTE THIS IS NOT A CHUNK, but A PART OF SEVERAL CHUNKS /* static int TrackFlagsReader(FHANDLE *f, word *n, word *p_flags) { if(f->read(p_flags, sizeof(word)*7) < 1) return ERROR_READER; if ((p_flags[0] & 0x02) == 0x02) pdebug(DEBUG_LOAD_3DS,"repeat"); if ((p_flags[0] & 0x03) == 0x03) pdebug(DEBUG_LOAD_3DS,"loop"); *n = p_flags[5]; return OK; } */ // Position track reader static int Read_TrackPos(FHANDLE *f) { /* KEY_POINT_3DS key; KEY_POINT_BRS *p_key; BOD *p_pos; word i,n,nf; word flags[7]; float v[3]; int klic; if(TrackFlagsReader(f,&n,flags) != OK) return(ERROR_READER); if(n) { if(!(p_key = malloc(sizeof(p_key[0])*n))) chyba("Pamet"); if(!(p_pos = (BOD *)malloc(sizeof(BOD)*n))) chyba("Pamet"); // rozdeleni podle druhu nacitanych tracku switch(track_mod) { case 0: // Objekt-track assert(p_track); p_track->p_pkeys = p_key; p_track->p_pos = p_pos; p_track->pos_keys = n; break; case 1: // Camera track kamery[akt_kamera].tracky[0].p_pkeys = p_key; kamery[akt_kamera].tracky[0].p_pos = p_pos; kamery[akt_kamera].tracky[0].pos_keys = n; break; case 2: // Camera - Target Track kamery[akt_kamera].tracky[0].p_tkeys = p_key; kamery[akt_kamera].tracky[0].p_trg = p_pos; kamery[akt_kamera].tracky[0].trg_keys = n; break; } // pozicnich klicu pdebug(DEBUG_LOAD_3DS,"Pozicnich klicu %d",n); for(i = 0; i < n; i++) { if(SplineFlagsReader(f,ind,&nf,&key) !=OK) return(ERROR_READER); key_3ds_to_ber(&key,p_key+i); if(f->read(v, sizeof(v)) < 1) return(ERROR_READER); p_pos[i].x = v[0]; p_pos[i].y = v[2]; p_pos[i].z = v[1]; pdebug(DEBUG_LOAD_3DS,"Key %d X = %f Y = %f Z = %f",i,v[0],v[2],v[1]); } if(!check_track(p_key,n,&klic)) { pdebug(DEBUG_LOAD_3DS,"**** Vicenasobny frame na klici cislo %d frame %d",klic,p_key[klic]); //assert(0); } } */ return OK; } // Color track reader static int Read_TrackColor(FHANDLE *f) { /* word n, nf, flags[7]; float pos[3]; KEY_POINT_3DS key; if (TrackFlagsReader(f,&n, flags) !=OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Color keys: %d", n); while (n-- > 0) { if (SplineFlagsReader(f,ind,&nf,&key) !=OK) return ERROR_READER; if (f->read(pos, sizeof (pos), 1, f) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"R: %f, G: %f, B: %f", pos[0], pos[1], pos[2]); } */ return OK; } // Rotation track reader static int Read_TrackRot(FHANDLE *f) { /* KEY_POINT_3DS key; word i,n,nf; float v[4]; int klic; QUAT q; BOD osa; float uhel; assert(p_track); if (TrackFlagsReader(f,&n,p_track->rot_flag) !=OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Rotacnich klicu: %d", n); p_track->rot_keys = n; if(n) { if(!(p_track->p_rkeys = malloc(sizeof(p_track->p_rkeys[0])*n))) chyba("Pamet"); if(!(p_track->p_rot = (ROTKEY *)malloc(sizeof(ROTKEY)*n))) chyba("Pamet"); for(i = 0; i < n; i++) { if(SplineFlagsReader(f, ind, &nf, &key) !=OK) return ERROR_READER; key_3ds_to_ber(&key,p_track->p_rkeys+i); if(f->read(v, sizeof(v)) < 1) return ERROR_READER; p_track->p_rot[i].angle = v[0]; p_track->p_rot[i].x = v[1]; p_track->p_rot[i].y = v[3]; p_track->p_rot[i].z = v[2]; pdebug(DEBUG_LOAD_3DS,"Angle: %f, X: %f, Y: %f, Z: %f", v[0]*180.0/PI, v[1], v[3], v[2]); key_rotkey_to_quat(p_track->p_rot+i, &q); pdebug(DEBUG_LOAD_3DS,"Prevod - Quat: X: %f, Y: %f, Z: %f W: %f", q.x, q.y, q.z, q.w); quat_to_angle(&q,&osa,&uhel); pdebug(DEBUG_LOAD_3DS,"Prevod - Angle: %f (%f), X: %f, Y: %f, Z: %f", uhel*180.0/PI,uhel, osa.x, osa.y, osa.z); } if(!check_track(p_track->p_rkeys,n,&klic)) { pdebug(DEBUG_LOAD_3DS,"**** Vicenasobny frame na klici cislo %d frame %d",klic,p_track->p_rkeys[klic]); } } */ return OK; } static int Read_CameraTrack(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Camera Track"); /* track_mod = 1; akt_kamera++; //kamery[akt_kamera].tracky[0].framestart = keyframe.frame_start; kamery[akt_kamera].tracky[0].endtime = calc_endtime(keyframe.frame_stop-keyframe.frame_start); */ return OK; } static int Read_CameraTargetTrack(FHANDLE *f) { pdebug(DEBUG_LOAD_3DS,"Camera Target Track"); //track_mod = 2; // cte uplne stejny track jako camera track ale je to ten target return OK; } // FOV track reader static int Read_TrackFOV(FHANDLE *f) { /* KEY_POINT_3DS key; float fov; word i,n,nf,flags[7]; if(TrackFlagsReader(f,&n,flags) !=OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"FOV keys: %d", n); kamery[akt_kamera].tracky[0].fov_keys = n; // alokace if(n) { if(!(kamery[akt_kamera].tracky[0].p_fkeys = malloc(sizeof(kamery[akt_kamera].tracky[0].p_fkeys[0])*n))) chyba("Pamet"); if(!(kamery[akt_kamera].tracky[0].p_fov = malloc(sizeof(kamery[akt_kamera].tracky[0].p_fov[0])*n))) chyba("Pamet"); for(i = 0; i < n; i++) { if(SplineFlagsReader(f,ind,&nf,&key)!=OK) return ERROR_READER; key_3ds_to_ber(&key, kamery[akt_kamera].tracky[0].p_fkeys+i); if(f->read(&fov, sizeof(kamery[akt_kamera].tracky[0].p_fov[0]), 1, f) < 1) return ERROR_READER; kamery[akt_kamera].tracky[0].p_fov[i] = DEG2RAD(fov); } } */ return OK; } // Roll track reader -> vkladam to do rotacniho klice static int Read_TrackRoll(FHANDLE *f) { /* KEY_POINT_3DS key; float roll; word i,n,nf,flags[7]; if(TrackFlagsReader(f, &n, flags) != OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Roll track - Rotation keys: %d", n); kamery[akt_kamera].tracky[0].roll_keys = n; if(n) { if(!(kamery[akt_kamera].tracky[0].p_rlkeys = malloc(sizeof(kamery[akt_kamera].tracky[0].p_rlkeys[0])*n))) chyba("Pamet"); if(!(kamery[akt_kamera].tracky[0].p_roll = malloc(sizeof(kamery[akt_kamera].tracky[0].p_roll[0])*n))) chyba("Pamet"); for(i = 0; i < n; i++) { if(SplineFlagsReader(f,ind,&nf,&key) !=OK) return ERROR_READER; key_3ds_to_ber(&key, kamery[akt_kamera].tracky[0].p_rlkeys+i); if(f->read(&roll, sizeof(kamery[akt_kamera].tracky[0].p_roll[0])) < 1) return ERROR_READER; kamery[akt_kamera].tracky[0].p_roll[i] = DEG2RAD(roll); } } */ return OK; } // Scale track reader static int Read_TrackScale(FHANDLE *f) { /* KEY_POINT_3DS key; word i,n,nf; int klic; float v[3]; assert(p_track); if(TrackFlagsReader (f, &n, p_track->scs_flag) !=OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Scale keys: %d", n); p_track->scs_keys = n; if(n) { if(!(p_track->p_skeys = malloc(sizeof(p_track->p_skeys[0])*n))) chyba("Pamet"); if(!(p_track->p_scale = (BOD *)malloc(sizeof(BOD)*n))) chyba("Pamet"); for(i = 0; i < n; i++) { if(SplineFlagsReader(f, ind, &nf, &key) !=OK) return ERROR_READER; key_3ds_to_ber(&key,p_track->p_skeys+i); if(f->read(v, sizeof(v)) < 1) return ERROR_READER; p_track->p_scale[i].x = v[0]; p_track->p_scale[i].y = v[2]; p_track->p_scale[i].z = v[1]; //p_track->p_scale[i].y = v[1]; //p_track->p_scale[i].z = v[2]; pdebug(DEBUG_LOAD_3DS,"X: %f, Y: %f, Z: %f", v[0], v[2], v[1]); } if(!check_track(p_track->p_skeys,n,&klic)) { pdebug(DEBUG_LOAD_3DS,"**** Vicenasobny frame na klici cislo %d frame %d",klic,p_track->p_skeys[klic]); //assert(0); } } */ return OK; } //Morph track reader static int Read_TrackMorph(FHANDLE *f) { /* KEY_POINT_3DS key; word flag[7]; word n, nf; byte jmeno[500]; if (TrackFlagsReader (f, &n, flag) !=OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Morph keys: %d", n); while (n-- > 0) { if (SplineFlagsReader(f, ind, &nf, &key) !=OK) return ERROR_READER; if (f->read_string(jmeno,500) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"%s",jmeno); } */ return OK; } // Hide track reader static int Read_TrackHide(FHANDLE *f) { /* word unknown[2]; word n, nf; int hide = 0; int i; word flag[7]; if (TrackFlagsReader (f, &n, flag) !=OK) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"Hide keys: %d", n); while (n-- > 0) { if (f->read(&nf, sizeof (nf), 1, f) < 1) return ERROR_READER; if (f->read(unknown, sizeof (unknown), 1, f) < 1) return ERROR_READER; i = (hide ^= 1); pdebug(DEBUG_LOAD_3DS,"Hide: %i", i); } */ return OK; } // Object number reader static int Read_ObjNumber(FHANDLE *f) { /* word n; if (f->read(&n, sizeof(n)) < 1) return ERROR_READER; pdebug(DEBUG_LOAD_3DS,"\nObject number: %d", n); switch(track_mod) { case 0: assert(p_track); p_track->objekt = n; break; case 1: kamery[akt_kamera].tracky[0].objekt = n; break; default: break; } */ return OK; } // ********** End of keyframer reading ********** static int Read_Ambient(FHANDLE *f) { color_type = COLOR_AMBIENT; return(OK); } static int Read_Diffuse(FHANDLE *f) { color_type = COLOR_DIFFUSE; return(OK); } static int Read_TextureMap(FHANDLE *f) { load_texture_map = 1; return(OK); } static struct { word id; const char *name; int sub; int (*func)(FHANDLE *f); } ChunkNames[] = { // Chunk ID, Chunk Description, 1=Sub-chunks, Chunk Reader {CHUNK_VER, "Version", 0, Read_Ver}, // added {CHUNK_RGBF, "RGB float", 0, Read_RGBF}, {CHUNK_RGBB, "RGB byte", 0, Read_RGBB}, {CHUNK_RGBB2, "RGB byte 2", 0, Read_RGBB}, {CHUNK_AMOUNTOF, "Amount", 0, Read_AmountOf}, // added {CHUNK_MASTERSCALE, "Master scale", 0, Read_MasterScale},// added {CHUNK_PRJ, "Project", 1, Read_NULL}, {CHUNK_MLI, "Material Library", 1, Read_NULL}, {CHUNK_MESHVER, "Mesh version", 0, Read_MeshVer}, // added {CHUNK_MAIN, "Main", 1, Read_NULL}, {CHUNK_OBJMESH, "Object Mesh", 1, Read_NULL}, {CHUNK_BKGCOLOR, "Background color", 1, Read_NULL}, {CHUNK_AMBCOLOR, "Ambient color", 1, Read_NULL}, {CHUNK_OBJBLOCK, "Object Block", 1, Read_ObjBlock}, {CHUNK_TRIMESH, "Tri-Mesh", 1, Read_TriMesh}, {CHUNK_VERTLIST, "Vertex list", 0, Read_VertList}, {CHUNK_VERTFLAGS, "Vertex flags", 0, Read_VertFlags}, {CHUNK_FACELIST, "Face list", 1, Read_FaceList}, {CHUNK_FACEMAT, "Face material", 0, Read_FaceMat}, {CHUNK_MAPLIST, "Mappings list", 0, Read_MapList}, {CHUNK_SMOOLIST, "Smoothings", 0, Read_SmooList}, {CHUNK_TRMATRIX, "Matrix", 0, Read_TrMatrix}, {CHUNK_MESHCOLOR, "Mesh Color", 0, Read_Skip}, // added {CHUNK_TXTINFO, "TxtInfo", 0, Read_Skip}, // added {CHUNK_BOXMAP, "BoxMap", 0, Read_BoxMap}, // added {CHUNK_LIGHT, "Light", 1, Read_Light}, // !! {CHUNK_SPOTLIGHT, "Spotlight", 0, Read_SpotLight}, // !! {CHUNK_CAMERA, "Camera", 0, Read_Camera}, // !! {CHUNK_HIERARCHY, "Hierarchy", 1, Read_NULL}, {CHUNK_VIEWPORT, "Viewport info", 0, Read_Skip}, {CHUNK_MATERIAL, "Material", 1, Read_NULL}, {CHUNK_MATNAME, "Material name", 0, Read_MatName}, {CHUNK_AMBIENT, "Ambient color", 1, Read_Ambient}, {CHUNK_DIFFUSE, "Diffuse color", 1, Read_Diffuse}, {CHUNK_SPECULAR, "Specular color", 1, Read_NULL}, {CHUNK_SHININESS, "Shiness", 1, Read_NULL}, // added {CHUNK_SHINSTRENGTH,"Shiness strength", 1, Read_NULL}, // added {CHUNK_TRANSPARENCY,"Transparency", 1, Read_Transparent},// added {CHUNK_TRANSFALLOFF,"Falloff", 1, Read_NULL}, // added {CHUNK_REFBLUR, "Reflection blur", 1, Read_NULL}, // added {CHUNK_SELFILLUM, "Self illumination", 1, Read_NULL}, // added {CHUNK_TWOSIDED, "Twosided", 0, Read_TwoSided}, // added {CHUNK_TRANSADD, "TransAdd", 0, Read_TransAdd}, // added {CHUNK_WIREON, "Wire On", 0, Read_WireOn}, // added {CHUNK_WIRESIZE, "Wire Size", 0, Read_WireSize}, // added {CHUNK_SOFTEN, "Soften", 0, Read_Soften}, // added {CHUNK_SHADING, "Shading", 0, Read_Shading}, // added {CHUNK_MATXPFALLIN, "XPFALLIN", 0, Read_NULL}, {CHUNK_TEXTURE, "Texture map", 1, Read_TextureMap}, {CHUNK_REFLECT, "Reflection map", 1, Read_NULL}, // added {CHUNK_BUMPMAP, "Bump map", 1, Read_NULL}, {CHUNK_BUMPAMOUNT, "Bump amount", 0, Read_AmountOf}, // added {CHUNK_MAPFILE, "Map filename", 0, Read_MapFile}, {CHUNK_MAPFLAGS, "Map flags", 0, Read_MapFlags}, // added {CHUNK_MAPBLUR, "Map blurring", 0, Read_MapBlur}, // added {CHUNK_MAPUSCALE, "Map U scale", 0, Read_MapUScale}, // added {CHUNK_MAPVSCALE, "Map V scale", 0, Read_MapVScale}, // added {CHUNK_MAPUOFFSET, "Map U offset", 0, Read_MapUOffset}, // added {CHUNK_MAPVOFFSET, "Map V offset", 0, Read_MapVOffset}, // added {CHUNK_MAPROTANGLE, "Map rot angle", 0, Read_MapRotAngle},// added {CHUNK_KEYFRAMER, "Keyframer data", 1, Read_NULL}, {CHUNK_AMBIENTKEY, "Ambient key", 1, Read_NULL}, {CHUNK_TRACKINFO, "Track info", 1, Read_TrackInfo}, {CHUNK_FRAMES, "Frames", 0, Read_Frames}, {CHUNK_TRACKOBJNAME,"Track obj. name", 0, Read_TrackObjName}, {CHUNK_DUMMYNAME, "Dummy name", 0, Read_DummyName}, // added {CHUNK_TRACKPIVOT, "Pivot point", 0, Read_PivotPoint}, {CHUNK_TRACKPOS, "Position keys", 0, Read_TrackPos}, {CHUNK_TRACKCOLOR, "Color track", 0, Read_TrackColor}, // added {CHUNK_TRACKROTATE, "Rotation keys", 0, Read_TrackRot}, {CHUNK_TRACKSCALE, "Scale keys", 0, Read_TrackScale}, {CHUNK_TRACKMORPH, "Morph track", 0, Read_TrackMorph}, // added {CHUNK_TRACKHIDE, "Hide track", 0, Read_TrackHide}, // added {CHUNK_OBJNUMBER, "Object number", 0, Read_ObjNumber}, {CHUNK_TRACKCAMERA, "Camera track", 1, Read_CameraTrack}, {CHUNK_TRACKCAMTGT, "Camera target track", 1, Read_CameraTargetTrack}, {CHUNK_TRACKLIGHT, "Pointlight track", 1, Read_NULL}, {CHUNK_TRACKLIGTGT, "Pointlight target track",1, Read_NULL}, {CHUNK_TRACKSPOTL, "Spotlight track", 1, Read_NULL}, {CHUNK_TRACKFOV, "FOV track", 0, Read_TrackFOV}, // added {CHUNK_TRACKROLL, "Roll track", 0, Read_TrackRoll}, // added }; int FindChunk (word id) { unsigned int i; for (i = 0; i < (sizeof(ChunkNames)/sizeof(ChunkNames[0])); i++) { if (id == ChunkNames[i].id) return i; } return -1; } // ------------------------------------ int Verbose = 0; int Quiet = 0; int ChunkReader(FHANDLE *f, int p) { TChunkHeader h; int n; long pc; int res; while (f->tell() < (unsigned)p) { pc = f->tell(); if (f->read(&h, sizeof(h)) != sizeof(h)) return ERROR_READER; if (h.len == 0) return ERROR_READER; n = FindChunk(h.id); if (n < 0) { f->seek(pc + h.len, SEEK_SET); } else { pc = pc + h.len; if (ChunkNames[n].func != NULL) { res = ChunkNames[n].func(f); if(res != OK) return(res); } if (ChunkNames[n].sub) { res = ChunkReader(f, pc); if(res != OK) return(res); } f->seek(pc, SEEK_SET); } } return OK; } int ds_read(FHANDLE *f) { long p; // Find file size. f->seek(0, SEEK_END); p = f->tell(); f->seek(0, SEEK_SET); // Go! return(ChunkReader(f, p)); } void scene_import_3ds_reset(SCENE *p_scn) { p_scene = p_scn; p_mesh = NULL; p_mat = NULL; p_text = NULL; p_camera = NULL; readed_object_name[0] = '\0'; readed_object_facenum = 0; load_texture_map = 0; color_type = COLOR_NONE; } bool scene_import_3ds(SCENE *p_scene, FHANDLE *f) { scene_import_3ds_reset(p_scene); return(ds_read(f) != ERROR_READER); } bool scene_import_3ds(SCENE *p_scene, char *p_dir, char *p_file) { bool ret = FALSE; MMHANDLE f(p_dir,p_file,"rb",FALSE); if(f) { ret = scene_import_3ds(p_scene, &f); f.close(); } return(ret); } /* EDIT_KONTEJNER * ds_import_kontejner(byte *p_file, int mat, byte key, byte text, byte staticky, byte kamery_import) { HWND hwnd; FHANDLE *f; int i; if((f = fopen(p_file, "rb")) == NULL) return(NULL); p_kont = vyrob_kontejner(); color_type = 0; texture_map = 0; dummy_objektu = 0; p_obj = NULL; memset(&keyframe,0,sizeof(keyframe)); // Import 3ds souboru do kontejneru if(ds_read(f) == ERROR_READER) { //pprintf("Chyba cteni 3ds souboru (offset 0x%x - %d)!",i,i = ftell(f)); } // Aplikuje mapovaci flagy ds_aplikuj_3ds_text_mapping(p_cnf->p_mat, p_kont); // Pokud jsou povoleny animace -> prilep keyframy if(key) { HIERARCHY_ROOT root; memset(&root,0,sizeof(root)); p_kont->akt_animace = 0; // prikopiruju tracky k jednotlivym objektum ds_vloz_keyframy(p_kont, &keyframe); // Prevede do animacniho stromu if(key_root_vyrob_indir(p_kont,&root)) { // pokud jsou key-framy key_root_to_zero(&root); key_kontejner_reanimuj(p_kont,&root); strcpy(root.jmeno,p_file); } // prevod do sim-animaci if(!staticky) { key_root_to_sim_indir(p_kont, p_kont->sim, &root, FALSE); } // Prevod do sim-animaci + smazani key-frame if(root.framenum) key_root_zrus(&root); } // jinak to je staticky kontejner else { p_kont->kflag |= KONT_STATIC; } // pokud je to pozadovano smaz dummy objekty if(p_cnf->cnf.mazat_dummy) { for(i = 0; i < MAX_KONT_OBJEKTU; i++) { if(p_kont->p_obj[i] && !strcmp(p_kont->p_obj[i]->jmeno,DUMMY_OBJEKT)) { //pprintf(1,"Mazu dummy objekt %d...",i); zrus_objekt(p_kont->p_obj+i); } } } // Pokud je pozadavek na staticky kontejner -> vymaz keyframy if(staticky) { ds_kontejner_preved_na_staticky(p_kont); } // Kopie kamer, pokud jsou ve scene if(kamery_import && p_cnf->kamnum) { memcpy(p_cnf->kamery,kamery,sizeof(kamery[0])*p_cnf->kamnum); } // Reload textur 3ds souboru strcpy(p_cnf->tdir.scene_texture_dir,work_dir); if(text) { oe_reload_textur(p_cnf); } // Konecna faze updatuj_kontejner_statistika(p_kont,TRUE); nastav_barvu_bodu_kont_dword(p_kont,0xffffffff,COLOR_SET); fclose(f); return(p_kont); } */ /* // upravi texture koordinaty podle flagu u mappingu void ds_aplikuj_3ds_text_mapping(EDIT_MATERIAL **p_mat, EDIT_KONTEJNER *p_kont) { TDS_MAT_FLAGS tds; int o,v; float tu,tv,uhel; for(o = 0; o < p_kont->max_objektu; o++) { if(p_kont->p_obj[o] && p_mat[p_kont->p_obj[o]->material] && p_mat[p_kont->p_obj[o]->material]->flag&MAT_3DS_FLAGS) { tds = p_mat[p_kont->p_obj[o]->material]->tds; for(v = 0; v < p_kont->p_obj[o]->vertexnum; v++) { if(tds.rot_angle != 0.0f) { uhel = tds.rot_angle; // uhel -> radiany tu = p_kont->p_obj[o]->p_vertex[v].tu1; tv = p_kont->p_obj[o]->p_vertex[v].tv1; p_kont->p_obj[o]->p_vertex[v].tu1 = (float)(tu*cos(uhel) - tv*sin(uhel)); p_kont->p_obj[o]->p_vertex[v].tv1 = (float)(tu*sin(uhel) + tv*cos(uhel)); } if(tds.u_scale != 0.0f) { tu = p_kont->p_obj[o]->p_vertex[v].tu1 - 0.5f; tu *= tds.u_scale; p_kont->p_obj[o]->p_vertex[v].tu1 = 0.5f + tu; } if(tds.v_scale != 0.0f) { tv = p_kont->p_obj[o]->p_vertex[v].tv1 - 0.5f; tv *= tds.v_scale; p_kont->p_obj[o]->p_vertex[v].tv1 = 0.5f + tv; } p_kont->p_obj[o]->p_vertex[v].tu1 += tds.u_offset; p_kont->p_obj[o]->p_vertex[v].tv1 += tds.v_offset; } } } } // Presklada kontejner tak, aby cisla objektu odpovidali keyframu void ds_vloz_keyframy(EDIT_KONTEJNER *p_kont, KEYFRAMER_DATA *p_key) { TRACK_INFO *p_track = p_key->p_track; QUAT q = {0,0,0,1}; EDIT_KONTEJNER k; int o,num = (p_key->frame_stop+1)-p_key->frame_start, start = p_key->frame_start; if(p_track) { p_kont->kflag |= KONT_KEYFRAME; k = *p_kont; memset(p_kont->p_obj,0,sizeof(EDIT_OBJEKT *)*p_kont->max_objektu); while(p_track) { p_track->framenum = num; p_track->framestart = start; key_tri_calc_absolutne(p_track, &q); if(!strcmp(p_track->jmeno,DUMMY_OBJEKT)) { //pprintf("Importovany soubor obsahuje DUMMY objekt (cislo %d) !!\n Objekty se muzou spatne importovat a animovat !!",o); //pprintf(1,"Dummy objekt !!! Objekt cislo %d",o); o = p_track->objekt; p_kont->p_obj[o] = vyrob_objekt(); strcpy(p_kont->p_obj[o]->jmeno,DUMMY_OBJEKT); p_kont->p_obj[o]->kreslit = FALSE; p_kont->p_obj[o]->p_track = p_track; key_tri_calc_absolutne(p_track, &q); } else { // najiti pripadneho objektu if((o = lo_najdi_objekt_kont(&k, p_track->jmeno)) != K_CHYBA) { if(p_track->objekt == o) { pdebug(DEBUG_LOAD_3DS,"Umistuji objekt '%s' na %d ",p_track->jmeno,o); p_kont->p_obj[o] = k.p_obj[o]; p_kont->p_obj[o]->p_track = p_track; } else { // je to kopie pdebug(DEBUG_LOAD_3DS,"Kopiruji objekt '%s' z %d na %d",p_track->jmeno,o,p_track->objekt); p_kont->p_obj[p_track->objekt] = kopiruj_objekt(k.p_obj[o]); p_kont->p_obj[p_track->objekt]->p_track = p_track; } } else { pdebug(DEBUG_LOAD_3DS,"Neznamy track objektu %s...",p_track->jmeno); } } p_track = p_track->p_next; } } } void ds_kontejner_preved_na_staticky(EDIT_KONTEJNER *p_kont) { int i; for(i = 0; i < p_kont->max_objektu; i++) { if(p_kont->p_obj[i]) { transformuj_objekt_matici(p_kont->p_obj[i],&p_kont->p_obj[i]->m); init_matrix(&p_kont->p_obj[i]->m); } } p_kont->kflag |= KONT_STATIC; p_kont->kflag &= ~KONT_KEYFRAME; } __inline static EDIT_KONTEJNER * ds_objekt_to_kontejner(EDIT_KONTEJNER *p_kont, int o) { EDIT_KONTEJNER *p_new = vyrob_kontejner(); p_new->kflag = p_kont->kflag; // skopiruj flagy bez material flagu p_new->k2flag = p_kont->k2flag; // skopiruj flagy bez material flagu p_new->m1flag = p_kont->p_obj[o]->m1flag; p_new->m2flag = p_kont->p_obj[o]->m2flag; if(strlen(p_kont->jmeno)+strlen(p_kont->p_obj[o]->jmeno)+1 < MAX_NAME) { sprintf(p_new->jmeno,"%s_%s",p_kont->jmeno,p_kont->p_obj[o]->jmeno); } else { strcpy(p_new->jmeno,p_kont->p_obj[o]->jmeno); } assert(strlen(p_new->jmeno) < MAX_NAME); p_new->p_obj[0] = p_kont->p_obj[o]; p_new->world = p_kont->world; if(p_kont->p_mlha) { p_new->p_mlha = kopiruj_mlhokostku(p_kont->p_mlha,p_new->jmeno); p_new->p_mlha->p_kont = p_new; } p_kont->p_obj[o] = NULL; updatuj_kontejner_statistika(p_new,TRUE); return(p_new); } // rozlozi kontejner -> kazdy objekt bude samostatny kontejner int ds_kontejner_rozloz(K_EDITOR *p_cnf, EDIT_KONTEJNER *p_kont, int m1flag) { int i; int o; if(p_kont->kflag&KONT_STATIC && p_kont->objektu > 1) { for(i = 0; i < p_kont->max_objektu; i++) { if(p_kont->p_obj[i] && (m1flag == ROZLOZ_MAX || p_kont->p_obj[i]->m1flag&m1flag)) { o = lo_najdi_volny_kontejner(p_cnf->p_kont,p_cnf->max_kont); if(o == K_CHYBA) { //pprintf("Neni volny kontejner !"); assert(0); } else { p_cnf->p_kont[o] = ds_objekt_to_kontejner(p_kont, i); updatuj_kontejner_flag(p_cnf->p_kont[o], p_cnf->p_mat); } } } return(TRUE); } else return(FALSE); } */ /******************************************************************* Export 3DS souboru *******************************************************************/ /* // Pridej Mesh #define GRANULARITA 1000 typedef struct _PRIDAVAC { byte **p_pol; // polozky pridavace int *p_vel; // pole polozek int akt; // poktualni posledni int max; // max pocet } PRIDAVAC; void prid_init(PRIDAVAC *p_prd) { memset(p_prd,0,sizeof(*p_prd)); p_prd->max = GRANULARITA; p_prd->akt = 0; p_prd->p_pol = malloc(sizeof(p_prd->p_pol[0])*p_prd->max); mtest(p_prd->p_pol); memset(p_prd->p_pol,0,sizeof(p_prd->p_pol[0])*p_prd->max); p_prd->p_vel = malloc(sizeof(p_prd->p_vel[0])*p_prd->max); mtest(p_prd->p_vel); memset(p_prd->p_vel,0,sizeof(p_prd->p_vel[0])*p_prd->max); } void prid_zrus(PRIDAVAC *p_prd) { int i; for(i = 0; i < p_prd->akt; i++) { if(p_prd->p_pol[i]) free(p_prd->p_pol[i]); } free(p_prd->p_pol); free(p_prd->p_vel); } void prid_add_granularita(PRIDAVAC *p_prd) { int max = p_prd->max+GRANULARITA; byte **p_pol = malloc(sizeof(p_pol[0])*max); int *p_vel = malloc(sizeof(p_vel[0])*max); mtest(p_pol); mtest(p_vel); memset(p_pol,0,sizeof(p_pol[0])*max); memset(p_vel,0,sizeof(p_vel[0])*max); memcpy(p_pol,p_prd->p_pol,sizeof(p_pol[0])*p_prd->max); memcpy(p_vel,p_prd->p_vel,sizeof(p_vel[0])*p_prd->max); free(p_prd->p_pol); free(p_prd->p_vel); p_prd->p_pol = p_pol; p_prd->p_vel = p_vel; p_prd->max = max; } void prid_add(PRIDAVAC *p_prd, int vel, byte *p_pol) { int akt = p_prd->akt; if(akt >= p_prd->max) { prid_add_granularita(p_prd); } assert(akt < p_prd->max); p_prd->p_pol[akt] = p_pol; p_prd->p_vel[akt] = vel; p_prd->akt++; } void * prid_add_create(PRIDAVAC *p_prd, int vel) { int akt = p_prd->akt; if(akt >= p_prd->max) { prid_add_granularita(p_prd); } assert(akt < p_prd->max); p_prd->p_pol[akt] = malloc(vel); mtest(p_prd->p_pol[akt]); p_prd->p_vel[akt] = vel; p_prd->akt++; return(p_prd->p_pol[akt]); } void prid_add_copy(PRIDAVAC *p_prd, int vel, void *p_pol) { int akt = p_prd->akt; if(akt >= p_prd->max) { prid_add_granularita(p_prd); } assert(akt < p_prd->max); p_prd->p_pol[akt] = malloc(vel); mtest(p_prd->p_pol[akt]); memcpy(p_prd->p_pol[akt],p_pol,vel); p_prd->p_vel[akt] = vel; p_prd->akt++; } byte * prid_get_rec(PRIDAVAC *p_prd, int rec) { return(rec < p_prd->akt ? p_prd->p_pol[rec] : NULL); } int prid_get_size(PRIDAVAC *p_prd) { int vel; int i; for(i = 0, vel = 0; i < p_prd->akt; i++) { if(p_prd->p_pol[i]) { vel += p_prd->p_vel[i]; } } return(vel); } // Nacte velikos a zapise ji do hlavicky v prvnim zaznamu int prid_get_size_head(PRIDAVAC *p_prd) { TChunkHeader *p_head = (TChunkHeader *)p_prd->p_pol[0]; p_head->len = prid_get_size(p_prd); return(p_head->len); } byte * prid_slep(PRIDAVAC *p_prd, int *p_vel) { byte *p_vys; byte *p_tmp; int vel = prid_get_size(p_prd); int i; p_tmp = p_vys = malloc(sizeof(byte)*vel); mtest(p_vys); for(i = 0; i < p_prd->akt; i++) { if(p_prd->p_pol[i]) { memcpy(p_tmp,p_prd->p_pol[i],sizeof(byte)*p_prd->p_vel[i]); p_tmp += p_prd->p_vel[i]; } } *p_vel = vel; return(p_vys); } byte * prid_slep_a_zrus(PRIDAVAC *p_prd, int *p_vel) { byte *p_vys = prid_slep(p_prd,p_vel); prid_zrus(p_prd); return(p_vys); } // Exporty meshe void *ds_vyrob_chunk_trimesh(EDIT_OBJEKT *p_obj, int *p_velikost) { TChunkHeader head; BOD *p_bod; BODUV *p_map; FACE *p_face; word *p_word; int *p_smooth; int i,vel; word facu; PRIDAVAC prd; PRIDAVAC prd_flist; prid_init(&prd); head.id = CHUNK_TRIMESH; prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_VERTLIST; head.len = p_obj->vertexnum*3*sizeof(float)+sizeof(word)+sizeof(TChunkHeader); prid_add_copy(&prd,sizeof(head),&head); p_word = prid_add_create(&prd,p_obj->vertexnum*3*sizeof(float)+sizeof(word)); *p_word = p_obj->vertexnum; p_bod = (BOD *)(p_word+1); for(i = 0; i < p_obj->vertexnum; i++) { p_bod->x = p_obj->p_vertex[i].x; p_bod->y = p_obj->p_vertex[i].z; p_bod->z = p_obj->p_vertex[i].y; p_bod++; } head.id = CHUNK_MAPLIST; head.len = p_obj->vertexnum*2*sizeof(float)+sizeof(word)+sizeof(TChunkHeader); prid_add_copy(&prd,sizeof(head),&head); p_word = prid_add_create(&prd,p_obj->vertexnum*2*sizeof(float)+sizeof(word)); *p_word = p_obj->vertexnum; p_map = (BODUV *)(p_word+1); for(i = 0; i < p_obj->vertexnum; i++) { p_map->u = p_obj->p_vertex[i].tu1; p_map->v = p_obj->p_vertex[i].tv1; p_map++; } facu = p_obj->facenum/3; prid_init(&prd_flist); head.id = CHUNK_FACELIST; prid_add_copy(&prd_flist,sizeof(head),&head); prid_add_copy(&prd_flist,sizeof(facu),&facu); p_face = prid_add_create(&prd_flist,facu*4*sizeof(word)); for(i = 0; i < p_obj->facenum; i+=3) { p_face[0] = p_obj->p_face[i]; p_face[1] = p_obj->p_face[i+1]; p_face[2] = p_obj->p_face[i+2]; p_face[3] = 7; p_face += 4; } i = strlen(p_cnf->p_mat[p_obj->material]->jmeno)+1; head.id = CHUNK_FACEMAT; head.len = i+facu*sizeof(word)+sizeof(word)+sizeof(TChunkHeader); prid_add_copy(&prd_flist,sizeof(head),&head); prid_add_copy(&prd_flist,i,p_cnf->p_mat[p_obj->material]->jmeno); p_word = prid_add_create(&prd_flist,facu*sizeof(word)+sizeof(word)); *p_word = facu; p_face = (FACE *)(p_word+1); for(i = 0; i < facu; i++) { *p_face++ = i; } head.id = CHUNK_SMOOLIST; head.len = facu*sizeof(dword)+sizeof(TChunkHeader); prid_add_copy(&prd_flist,sizeof(head),&head); p_smooth = prid_add_create(&prd_flist,facu*sizeof(dword)); for(i = 0; i < facu; i++) { *p_smooth = 1; p_smooth++; } prid_get_size_head(&prd_flist); prid_add(&prd,vel,prid_slep_a_zrus(&prd_flist,&vel)); prid_get_size_head(&prd); return(prid_slep_a_zrus(&prd,p_velikost)); } void *ds_vyrob_chunk_objblock(EDIT_OBJEKT *p_obj, int *p_velikost) { TChunkHeader head; int vel; PRIDAVAC prd; prid_init(&prd); head.id = CHUNK_OBJBLOCK; prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,strlen(p_obj->jmeno)+1,p_obj->jmeno); prid_add(&prd,vel,ds_vyrob_chunk_trimesh(p_obj, &vel)); prid_get_size_head(&prd); return(prid_slep_a_zrus(&prd,p_velikost)); } void *ds_vyrob_chunk_material_name(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_MATNAME; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,strlen(p_mat->jmeno)+1,p_mat->jmeno); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_ambient(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp, c[3] = {150,150,150}; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_AMBIENT; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_RGBB; head.len = sizeof(head)+sizeof(byte)*3; prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_diffuse(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp, c[3] = {150,150,150}; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_DIFFUSE; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_RGBB; head.len = sizeof(head)+sizeof(byte)*3; prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_specular(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp, c[3] = {229,229,229}; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_SPECULAR; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_RGBB; head.len = sizeof(head)+sizeof(byte)*3; prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_shiness(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 10; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_SHININESS; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_shiness_strength(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 0; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_SHINSTRENGTH; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_transparency(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 0; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_TRANSPARENCY; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_fall_off(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 0; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_TRANSFALLOFF; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_reflection_blur(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 0; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_REFBLUR; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_shading(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 3; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_SHADING; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_self_illum(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 0; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_SELFILLUM; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_wire_size(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; float c = 1.0f; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_WIRESIZE; head.len = sizeof(head)+sizeof(float); prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material_texture(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; word c = 100; float f; TChunkHeader head; PRIDAVAC prd; head.id = CHUNK_TEXTURE; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); head.id = CHUNK_AMOUNTOF; head.len = sizeof(head)+sizeof(c); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); head.id = CHUNK_MAPFILE; head.len = sizeof(head)+strlen(p_mat->textfile[0])+1; strupr(p_mat->textfile[0]); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,strlen(p_mat->textfile[0])+1,p_mat->textfile[0]); c = 0; head.id = CHUNK_MAPFLAGS; head.len = sizeof(head)+sizeof(word); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(c),&c); f = 0.0f; head.id = CHUNK_MAPBLUR; head.len = sizeof(head)+sizeof(f); prid_add_copy(&prd,sizeof(head),&head); prid_add_copy(&prd,sizeof(f),&f); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void *ds_vyrob_chunk_material(EDIT_MATERIAL *p_mat, int *p_velikost) { byte *p_tmp; TChunkHeader head; PRIDAVAC prd; int vel; prid_init(&prd); head.id = CHUNK_MATERIAL; prid_add_copy(&prd,sizeof(head),&head); prid_add(&prd,vel,ds_vyrob_chunk_material_name(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_ambient(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_diffuse(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_specular(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_shiness(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_shiness_strength(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_transparency(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_fall_off(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_reflection_blur(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_shading(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_self_illum(p_mat, &vel)); head.id = CHUNK_MATXPFALLIN; head.len = sizeof(head); prid_add_copy(&prd,sizeof(head),&head); prid_add(&prd,vel,ds_vyrob_chunk_material_wire_size(p_mat, &vel)); prid_add(&prd,vel,ds_vyrob_chunk_material_texture(p_mat, &vel)); prid_get_size_head(&prd); p_tmp = prid_slep(&prd,p_velikost); prid_zrus(&prd); return(p_tmp); } void * ds_vyrob_chunk_mesh_version(int *p_vel) { TChunkHeader *p_head; byte *p_mem; word *p_ver; p_mem = malloc(sizeof(p_head[0])+sizeof(dword)); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_MESHVER; *p_vel = p_head->len = sizeof(p_head[0])+sizeof(p_ver); p_ver = (word *)(p_head+1); *p_ver = 3; return(p_mem); } void * ds_vyrob_chunk_mesh_master_scale(int *p_vel) { TChunkHeader *p_head; byte *p_mem; float *p_scale; p_mem = malloc(sizeof(p_head[0])+sizeof(dword)); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_MASTERSCALE; *p_vel = p_head->len = sizeof(p_head[0])+sizeof(p_scale); p_scale = (float *)(p_head+1); *p_scale = 1.0f; return(p_mem); } // Vyrobi list objektu void *ds_vyrob_chunk_obj_mesh(EDIT_KONTEJNER *p_kont, int *p_velikost) { TChunkHeader head; int vel; int i,m; PRIDAVAC prd; prid_init(&prd); head.id = CHUNK_OBJMESH; prid_add_copy(&prd,sizeof(head),&head); prid_add(&prd,vel,ds_vyrob_chunk_mesh_version(&vel)); for(m = 0; m < MAX_CELKEM_MATERIALU; m++) { if(p_cnf->p_mat[m] && p_cnf->p_mat[m]->flag&MAT_POUZITY) { prid_add(&prd,vel,ds_vyrob_chunk_material(p_cnf->p_mat[m],&vel)); } } prid_add(&prd,vel,ds_vyrob_chunk_mesh_master_scale(&vel)); for(i = 0; i < MAX_KONT_OBJEKTU; i++) { if(p_kont->p_obj[i]) { prid_add(&prd,vel,ds_vyrob_chunk_objblock(p_kont->p_obj[i],&vel)); } } prid_get_size_head(&prd); return(prid_slep_a_zrus(&prd,p_velikost)); } void * ds_vyrob_chunk_verze(int *p_vel) { TChunkHeader *p_head; byte *p_mem; word *p_ver; p_mem = malloc(sizeof(p_head[0])+sizeof(word)); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_VER; *p_vel = p_head->len = sizeof(p_head[0])+sizeof(float); p_ver = (word *)(p_head+1); *p_ver = 3; return(p_mem); } void * ds_vyrob_chunk_keyframer_frames(int *p_vel) { TChunkHeader *p_head; byte *p_mem; dword *p_frames; int delka; delka = sizeof(p_head[0])+2*sizeof(dword); p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_FRAMES; p_head->len = delka; p_head++; p_frames = (dword *)(p_head); *p_frames++ = 0; *p_frames++ = 100; *p_vel = delka; return(p_mem); } void * ds_vyrob_chunk_keyframer_trackinfo_objnum(EDIT_OBJEKT *p_obj, word n, int *p_vel) { TChunkHeader *p_head; byte *p_mem; word *p_num; int delka; delka = sizeof(p_head[0])+sizeof(p_num[0]); p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_OBJNUMBER; p_head->len = delka; p_head++; p_num = (word *)(p_head); *p_num = n; *p_vel = delka; return(p_mem); } void * ds_vyrob_chunk_keyframer_trackinfo_objname(EDIT_OBJEKT *p_obj, int *p_vel) { TChunkHeader *p_head; byte *p_mem; word *p_num; int delka; delka = sizeof(p_head[0])+3*sizeof(word)+strlen(p_obj->jmeno)+1; p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_TRACKOBJNAME; p_head->len = delka; p_head++; strcpy((char *)p_head,p_obj->jmeno); p_num = (word *)(p_mem+sizeof(TChunkHeader)+strlen(p_obj->jmeno)+1); *p_num++ = 0x4000; *p_num++ = 0x0; *p_num++ = 0xffff; *p_vel = delka; return(p_mem); } // Pivot point position reader void * ds_vyrob_chunk_keyframer_trackinfo_pivot(EDIT_OBJEKT *p_obj, int *p_vel) { TChunkHeader *p_head; byte *p_mem; int delka; BOD *p_pivot; delka = sizeof(p_head[0])+sizeof(BOD); p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_TRACKPIVOT; p_head->len = delka; p_head++; p_pivot = (BOD *)p_head; p_pivot->x = p_pivot->y = p_pivot->z = 0; *p_vel = delka; return(p_mem); } int ds_zapis_chunk_keyframer_trackinfo_flags(byte *p_flags, int num) { word *p_flag = (word *)p_flags; memset(p_flag,0,sizeof(word)*7); p_flag[0] = 0; p_flag[5] = num; return(sizeof(word)*7); } int ds_zapis_chunk_keyframer_trackinfo_spline_flags(byte *p_flags, int frame) { word *p_word = (word *)p_flags; p_word[0] = frame; // frame p_word[1] = 0; // nezname p_word[2] = 0; // flag // na parametry animace prdim return(sizeof(word)*3); } void * ds_vyrob_chunk_keyframer_trackinfo_position_keys(EDIT_OBJEKT *p_obj, int *p_vel) { TChunkHeader *p_head; byte *p_mem; byte *p_tmp; int delka; BOD *p_p; delka = sizeof(p_head[0]) // hlavicka +sizeof(word)*7 // flagy +sizeof(word)*3 // 1 spline flag +sizeof(BOD); // 1 pozice p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_TRACKPOS; p_head->len = delka; p_tmp = (byte *)(p_head+1); p_tmp += ds_zapis_chunk_keyframer_trackinfo_flags(p_tmp,1); p_tmp += ds_zapis_chunk_keyframer_trackinfo_spline_flags(p_tmp, 0); p_p = (BOD *)p_tmp; p_p->x = p_p->y = p_p->z = 0.0f; *p_vel = delka; return(p_mem); } void * ds_vyrob_chunk_keyframer_trackinfo_scale_keys(EDIT_OBJEKT *p_obj, int *p_vel) { TChunkHeader *p_head; byte *p_mem; byte *p_tmp; int delka; BOD *p_p; delka = sizeof(p_head[0]) // hlavicka +sizeof(word)*7 // flagy +sizeof(word)*3 // 1 spline flag +sizeof(BOD); // 1 pozice p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_TRACKSCALE; p_head->len = delka; p_tmp = (byte *)(p_head+1); p_tmp += ds_zapis_chunk_keyframer_trackinfo_flags(p_tmp,1); p_tmp += ds_zapis_chunk_keyframer_trackinfo_spline_flags(p_tmp, 0); p_p = (BOD *)p_tmp; p_p->x = p_p->y = p_p->z = 1.0f; *p_vel = delka; return(p_mem); } void * ds_vyrob_chunk_keyframer_trackinfo_rotation_keys(EDIT_OBJEKT *p_obj, int *p_vel) { TChunkHeader *p_head; byte *p_mem; byte *p_tmp; int delka; float *p_v; delka = sizeof(p_head[0]) // hlavicka +sizeof(word)*7 // flagy +sizeof(word)*3 // 1 spline flag +sizeof(float)*4; // 1 rotace p_mem = malloc(delka); mtest(p_mem); p_head = (TChunkHeader *)p_mem; p_head->id = CHUNK_TRACKROTATE; p_head->len = delka; p_tmp = (byte *)(p_head+1); p_tmp += ds_zapis_chunk_keyframer_trackinfo_flags(p_tmp,1); p_tmp += ds_zapis_chunk_keyframer_trackinfo_spline_flags(p_tmp, 0); p_v = (float *)p_tmp; p_v[0] = p_v[1] = p_v[2] = p_v[3] = 0.0f; *p_vel = delka; return(p_mem); } // zapis celeho trackinfa void * ds_vyrob_chunk_keyframer_trackinfo(EDIT_OBJEKT *p_obj, int n, int *p_vel) { TChunkHeader head; int vel; PRIDAVAC prd; head.id = CHUNK_TRACKINFO; prid_init(&prd); prid_add_copy(&prd,sizeof(head),&head); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo_objnum(p_obj,(word)n,&vel)); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo_objname(p_obj,&vel)); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo_pivot(p_obj,&vel)); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo_position_keys(p_obj,&vel)); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo_rotation_keys(p_obj,&vel)); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo_scale_keys(p_obj,&vel)); prid_get_size_head(&prd); return(prid_slep_a_zrus(&prd,p_vel)); } // key-frame void * ds_vyrob_chunk_keyframer(EDIT_KONTEJNER *p_kont, int *p_vel) { TChunkHeader head; int i,j; int vel; PRIDAVAC prd; prid_init(&prd); head.id = CHUNK_KEYFRAMER; prid_add_copy(&prd,sizeof(head),&head); prid_add(&prd,vel,ds_vyrob_chunk_keyframer_frames(&vel)); for(i = 0, j = 0; i < MAX_KONT_OBJEKTU; i++) { if(p_kont->p_obj[i]) { prid_add(&prd,vel,ds_vyrob_chunk_keyframer_trackinfo(p_kont->p_obj[i],j,&vel)); j++; } } prid_get_size_head(&prd); return(prid_slep_a_zrus(&prd,p_vel)); } void *ds_vyrob_chunk_main(EDIT_KONTEJNER *p_kont, int *p_velikost) { TChunkHeader head; int vel; PRIDAVAC prd; prid_init(&prd); head.id = CHUNK_MAIN; prid_add_copy(&prd,sizeof(head),&head); prid_add(&prd,vel,ds_vyrob_chunk_verze(&vel)); prid_add(&prd,vel,ds_vyrob_chunk_obj_mesh(p_kont,&vel)); prid_add(&prd,vel,ds_vyrob_chunk_keyframer(p_kont,&vel)); prid_get_size_head(&prd); return(prid_slep_a_zrus(&prd,p_velikost)); } // Exportuju 3DS soubor int ds_export_kontejner(byte *p_file, EDIT_KONTEJNER *p_kont) { void *p_data; int velikost; FILE *f; oe_oznac_pouzite_materialy_kont(p_cnf, p_kont); if(oe_oznac_dlouhe_materialy_kont(p_cnf, p_kont)) { //pprintf("Nemuzu exportovat dlouhe jmena textur"); pdebug(DEBUG_LOAD_3DS,"Nemuzu exportovat dlouhe jmena textur"); return(FALSE); } lo_kontejner_jedinecne_jmena(p_kont,TRUE); f = fopen(p_file,"wb"); if(!f) { return(FALSE); } p_data = ds_vyrob_chunk_main(p_kont, &velikost); fwrite(p_data,sizeof(byte),velikost,f); free(p_data); fclose(f); return(TRUE); } int ds_export_sceny(byte *p_file) { EDIT_KONTEJNER *p_kont = oe_slep_kontejnery_vsechny(p_cnf); if(p_kont) { int ret = ds_export_kontejner(p_file,p_kont); zrus_kontejner_rec(&p_kont,NULL); } return(TRUE); } */ bool scene_export_3ds(SCENE *p_scene, FHANDLE *f) { //scene_import_3ds_reset(p_scene); //return(ds_read(f) != ERROR_READER); return(FALSE); } bool scene_export_3ds(SCENE *p_scene, char *p_dir, char *p_file) { bool ret = FALSE; MMHANDLE f(p_dir,p_file,"rb",FALSE); if(f) { ret = scene_export_3ds(p_scene, &f); f.close(); } return(ret); } berusky2-0.12/src/age/graph/surface_sw.cpp0000644000175000017500000001620613674426075015437 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Constants and types #include "age.h" void surface_sw::create(tpos width, tpos height, SURFACE_FORMAT format) { clear(); p_pixels = (tcolor *)mmalloc(sizeof(tcolor)*width*height); this->width = width; this->height = height; } void surface_sw::create(SURFACE *p_surf, SURFACE_FORMAT format) { if(p_surf->pixel_format_get() != PIXEL_TCOLOR) return; if(width != p_surf->width_get() || height != p_surf->height_get()) { clear(); width = p_surf->width_get(); height = p_surf->height_get(); p_pixels = (tcolor *)mmalloc(sizeof(tcolor)*width*height); } int y; for(y = 0; y < height; y++) { tcolor *p_src = (tcolor *)p_surf->pixels_get(0,y); tcolor *p_dest = (tcolor *)pixels_get(0,y); memcpy(p_dest,p_src,sizeof(tcolor)*width); } } bool surface_sw::load(const char *p_file, SURFACE_FORMAT format) { SURFACE_SDL surf; if(!surf.load(p_file,SURFACE_TEXTURE)) return(FALSE); create(surf.width_get(), surf.height_get()); tcolor *p_src = (tcolor *)surf.pixels_get(); tcolor *p_dest = p_pixels; assert(p_src && p_dest); int y; for(y = 0; y < height; y++) { memcpy(p_dest,p_src,sizeof(tcolor)*width); p_dest += width; p_src += surf.pitch_get(); } return(TRUE); } bool surface_sw::load_alpha(const char *p_file) { return(FALSE); } bool surface_sw::save(const char *p_file, IMAGE_FORMAT format) { SURFACE_SDL tmp(width,height); if(tmp.pixels_set(p_pixels,width,height)) { return(tmp.save(p_file)); } return(FALSE); } void surface_sw::copy(class surface_sw *p_src) { clear(); // Source surface_sw is valid - copy pixels if(p_src->p_pixels) { create(p_src->width_get(), p_src->height_get()); assert(p_pixels); memcpy(p_pixels, p_src->pixels_get(), sizeof(tcolor)*width*height); } else { *this = *p_src; } } void surface_sw::move(class surface_sw *p_src) { clear(); *this = *p_src; p_src->p_pixels = NULL; } void surface_sw::clear(void) { assert(ref_get() == 0); ffree(p_pixels); width = 0; height = 0; } surface_sw::surface_sw(PIXEL_FORMAT format) : surface(SW_SURFACE, format), p_pixels(NULL), width(0), height(0) { } surface_sw::surface_sw(char *p_file, PIXEL_FORMAT format) : surface(SW_SURFACE, format), p_pixels(NULL), width(0), height(0) { load(p_file); } surface_sw::surface_sw(tpos width, tpos height, PIXEL_FORMAT format) : surface(SW_SURFACE, format), p_pixels(NULL), width(0), height(0) { create(width,height); } surface_sw::~surface_sw(void) { clear(); } void surface_sw::fill(tcolor color) { if(loaded()) { memset(p_pixels, color, sizeof(color)*width*height); } } void surface_sw::fill(tpos sx, tpos sy, tpos dx, tpos dy, tcolor color) { if(loaded()) { int y; for(y = 0; y < dy; y++) { void *p_pixels = pixels_get(sx,sy+y); memset(p_pixels, color, sizeof(color)*dx); } } } // blit whole source surtace to destination surface_sw void surface_sw::blit(class surface_sw *p_dst, tpos tx, tpos ty) { blit(0, 0, width, height, p_dst, tx, ty); } // blit part of source surface_sw to destination surface_sw void surface_sw::blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_sw *p_dst, tpos tx, tpos ty) { if(!loaded() || !p_dst->loaded()) return; int y; for(y = 0; y < dy; y++) { void *p_pixels_src = pixels_get(sx,sy+y); void *p_pixels_dst = p_dst->pixels_get(tx,ty+y); memcpy(p_pixels_dst, p_pixels_src, sizeof(tcolor)*dx); } } void surface_sw::scale(int nx, int ny) { // unimplemented assert(0); } void surface_sw::pixel_set_complex(int x, int y, RGBB color) { RGBB target = pixel_get(x,y); target = blend(op,(RGBF)target,(RGBF)color); pixel_set_simple(x,y,color); } #define TEST_AND_SET(x,y,cx,cy) \ { \ if(pixel_valid(x,y)) { \ pixels++; \ if(pixel_get(x,y) == color) { \ VECT2DI tmp = VECT2DI(x,y)-VECT2DI(cx,cy); \ float act = tmp.size(); \ if(act < distance_best) { \ distance_best = act; \ px = x; py = y; \ } \ } \ } \ } // distance = current distance from given point // returns if any pixel has been hit (so we can continue to search) bool surface_sw::pixel_search_square(int x, int y, tcolor color, int distance, int &px, int &py, float &distance_best) { int pixels = 0; if(distance == 0) { if(pixel_valid(x,y)) { pixels++; if(pixel_get(x,y) == color) { distance_best = 0; px = x; py = y; } } } else { int tx, ty; // search rows for(tx = x-distance; tx <= x+distance; tx++) { ty = y-distance; TEST_AND_SET(tx,ty,x,y); ty = y+distance; TEST_AND_SET(tx,ty,x,y); } // search columns for(ty = y-distance-1; ty <= y+distance-1; ty++) { tx = x-distance; TEST_AND_SET(tx,ty,x,y); tx = x+distance; TEST_AND_SET(tx,ty,x,y); } } return(pixels); } // max_dist is maximal pixel distance bool surface_sw::pixel_search(int x, int y, tcolor color, int range, int &px, int &py, float &distance_best) { distance_best = FLT_MAX; for(int distance = 0; distance <= range; distance++) { if(!pixel_search_square(x, y, color, distance, px, py, distance_best)) break; // optimalization - sqrt(8) < 3 if(distance < 3 && distance_best != FLT_MAX) { break; } } if(distance_best != FLT_MAX && distance_best <= range) { distance_best = distance_best / range; return(TRUE); } return(FALSE); } berusky2-0.12/src/age/graph/world_interface.cpp0000644000175000017500000000246513674426075016447 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/obb.cpp0000644000175000017500000006175413674426075014050 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * OBB and it's trees */ // Constants and types #include "age.h" #define same_point(a,b) (a->x == b->x && a->y == b->y && a->z == b->z) /* By Miguel Gomez,Gamasutra,October 18, 1999 */ bool obb::intersect(OBB *p_obb1, OBB *p_obb2) { VECT *p_a = &p_obb1->len; VECT *p_A = p_obb1->dir; VECT *p_Pa = &p_obb1->center; VECT *p_b = &p_obb2->len; VECT *p_B = p_obb2->dir; VECT *p_Pb = &p_obb2->center; VECT a; // lengths VECT Ax,Ay,Az;// normal vectors VECT Pa; // position VECT b; // lengths VECT Bx,By,Bz;// normal vectors VECT Pb; // position //ALGORITHM: Use the separating axis test for all 15 potential //separating axes. If a separating axis could not be found, the two //boxes overlap. VECT v,T,Rx,Ry,Rz; float ra,rb,t; v = *p_Pb - *p_Pa; T.x = vect_dot_product(v,p_A[0]); Rx.x = vect_dot_product(p_A[0],p_B[0]); Rx.y = vect_dot_product(p_A[0],p_B[1]); Rx.z = vect_dot_product(p_A[0],p_B[2]); ra = p_a->x; rb = p_b->x*fabsf(Rx.x) + p_b->y*fabsf(Rx.y) + p_b->z*fabsf(Rx.z); t = fabsf(T.x); if( t > ra + rb ) return(FALSE); T.y = vect_dot_product(v,p_A[1]); Ry.x = vect_dot_product(p_A[1],p_B[0]); Ry.y = vect_dot_product(p_A[1],p_B[1]); Ry.z = vect_dot_product(p_A[1],p_B[2]); ra = p_a->y; rb = p_b->x*fabsf(Ry.x) + p_b->y*fabsf(Ry.y) + p_b->z*fabsf(Ry.z); t = fabsf(T.y); if( t > ra + rb ) return(FALSE); T.z = vect_dot_product(v,p_A[2]); Rz.x = vect_dot_product(p_A[2],p_B[0]); Rz.y = vect_dot_product(p_A[2],p_B[1]); Rz.z = vect_dot_product(p_A[2],p_B[2]); ra = p_a->z; rb = p_b->x*fabsf(Rz.x) + p_b->y*fabsf(Rz.y) + p_b->z*fabsf(Rz.z); t = fabsf(T.z); if( t > ra + rb ) return(FALSE); //B->A v(x) ra = p_a->x*fabsf(Rx.x) + p_a->y*fabsf(Ry.x) + p_a->z*fabsf(Rz.x); rb = p_b->x; t = fabsf(T.x*Rx.x + T.y*Ry.x + T.z*Rz.x); if( t > ra + rb ) return(FALSE); //B->A v(y) ra = p_a->x*fabsf(Rx.y) + p_a->y*fabsf(Ry.y) + p_a->z*fabsf(Rz.y); rb = p_b->y; t = fabsf(T.y*Rx.y + T.y*Ry.y + T.z*Rz.y); if( t > ra + rb ) return(FALSE); //B->A v(z) ra = p_a->x*fabsf(Rx.z) + p_a->y*fabsf(Ry.z) + p_a->z*fabsf(Rz.z); rb = p_b->z; t = fabsf(T.z*Rx.z + T.y*Ry.z + T.z*Rz.z); if( t > ra + rb ) return(FALSE); //9 cross products //L = A0 x B0 ra = p_a->y*fabsf(Rz.x) + p_a->z*fabsf(Ry.z); rb = p_b->y*fabsf(Rx.z) + p_b->z*fabsf(Rx.y); t = fabsf(T.z*Ry.x - T.y*Rz.x); if( t > ra + rb ) return(FALSE); //L = A0 x B1 ra = p_a->y*fabsf(Rz.y) + p_a->z*fabsf(Ry.y); rb = p_b->x*fabsf(Rx.z) + p_b->z*fabsf(Rx.x); t = fabsf(T.z*Ry.y - T.y*Rz.y); if( t > ra + rb ) return(FALSE); //L = A0 x B2 ra = p_a->y*fabsf(Rz.z) + p_a->z*fabsf(Ry.z); rb = p_b->x*fabsf(Rx.y) + p_b->y*fabsf(Rx.x); t = fabsf(T.z*Ry.z - T.y*Rz.z); if( t > ra + rb ) return(FALSE); //L = A1 x B0 ra = p_a->x*fabsf(Rz.x) + p_a->z*fabsf(Rx.x); rb = p_b->y*fabsf(Ry.z) + p_b->z*fabsf(Ry.y); t = fabsf(T.x*Rz.x - T.z*Rx.x); if( t > ra + rb ) return(FALSE); //L = A1 x B1 ra = p_a->x*fabsf(Rz.y) + p_a->z*fabsf(Rx.y); rb = p_b->x*fabsf(Ry.z) + p_b->z*fabsf(Ry.x); t = fabsf(T.x*Rz.y - T.z*Rx.y); if( t > ra + rb ) return(FALSE); //L = A1 x B2 ra = p_a->x*fabsf(Rz.z) + p_a->z*fabsf(Rx.z); rb = p_b->x*fabsf(Ry.y) + p_b->y*fabsf(Ry.x); t = fabsf(T.x*Rz.z - T.z*Rx.z); if( t > ra + rb ) return(FALSE); //L = A2 x B0 ra = p_a->x*fabsf(Ry.x) + p_a->y*fabsf(Rx.x); rb = p_b->y*fabsf(Rz.z) + p_b->z*fabsf(Rz.y); t = fabsf(T.y*Rx.x - T.x*Ry.x); if( t > ra + rb ) return(FALSE); //L = A2 x B1 ra = p_a->x*fabsf(Ry.y) + p_a->y*fabsf(Rx.y); rb = p_b->x*fabsf(Rz.z) + p_b->z*fabsf(Rz.x); t = fabsf(T.y*Rx.y - T.x*Ry.y); if( t > ra + rb ) return(FALSE); //L = A2 x B2 ra = p_a->x*fabsf(Ry.z) + p_a->y*fabsf(Rx.z); rb = p_b->x*fabsf(Rz.y) + p_b->y*fabsf(Rz.x); t = fabsf(T.y*Rx.z - T.x*Ry.z); if( t > ra + rb ) return(FALSE); return(TRUE); } int obb::intersect(VECT *p_orig, VECT *p_dir, VECT *p_intersect, float *p_t) { VECT *p_A = dir; VECT *p_Pa = ¢er; VECT t,o,dir,min; t = *p_orig - *p_Pa; o.x = vect_dot_product(p_A[0],t); o.y = vect_dot_product(p_A[1],t); o.z = vect_dot_product(p_A[2],t); dir.x = vect_dot_product(p_A[0],*p_dir); dir.y = vect_dot_product(p_A[1],*p_dir); dir.z = vect_dot_product(p_A[2],*p_dir); min = len * -1.0f; AABB tmp(&min,&len); return(tmp.intersect(&o,&dir,p_intersect,p_t)); } int obb::intersect_vector(VECT *p_a, VECT *p_b, VECT *p_intersect, float *p_t) { VECT *p_A = dir; VECT *p_Pa = ¢er; VECT p,target; VECT t,o,dir,min; int ret; t = *p_a - *p_Pa; o.x = vect_dot_product(p_A[0],t); o.y = vect_dot_product(p_A[1],t); o.z = vect_dot_product(p_A[2],t); target = *p_b - *p_a; dir.x = vect_dot_product(p_A[0],target); dir.y = vect_dot_product(p_A[1],target); dir.z = vect_dot_product(p_A[2],target); min = len * -1.0f; AABB tmp(&min,&len); ret = tmp.intersect(&o,&dir,p_intersect,p_t); return((*p_t < 1.0f) ? ret : FALSE); } VECT * obb::border_get(VECT *p_border) { VECT a1,a2,a3; VECT a12,a22,a32; a1 = dir[0] * len.x; a2 = dir[1] * len.y; a3 = dir[2] * len.z; a12 = a1 * 2.0f; a22 = a2 * 2.0f; a32 = a3 * 2.0f; p_border[0] = center - a1; p_border[0] -= a2; p_border[0] -= a3; p_border[1] = *p_border + a12; p_border[2] = p_border[0] + a32; p_border[3] = p_border[1] + a32; p_border[4] = p_border[0] + a22; p_border[5] = p_border[1] + a22; p_border[6] = p_border[2] + a22; p_border[7] = p_border[3] + a22; return(p_border); } bool obb::intersect(BOX *p_box) { switch(p_box->box_type_get()) { case BOX_AABB: { // OBB x AABB intersection OBB tmp((AABB *)p_box); return(intersect(&tmp, (OBB *)p_box)); } case BOX_OBB: { // OBB x OBB intersection return(intersect(this, (OBB *)p_box)); } default: return(FALSE); } } void obb::transformate(OBB *p_src, GLMATRIX *p_m, OBB *p_dest) { GLMATRIX m; VECT a1; float lx,ly,lz; matrix_transformate(&p_src->center,p_m,&p_dest->center); lx = p_src->len.x; ly = p_src->len.y; lz = p_src->len.z; m = *p_m; m._41 = m._42 = m._43 = 0.0f; if(lx != 0.0f) { a1 = p_src->dir[0] * lx; matrix_transformate(&a1, &m, p_dest->dir); p_dest->len.x = p_dest->dir[0].norm(); } else { matrix_transformate(p_src->dir, &m, p_dest->dir); p_dest->len.x = 0.0f; } if(ly != 0.0f) { a1 = p_src->dir[1] * ly; matrix_transformate(&a1, &m, p_dest->dir+1); p_dest->len.y = p_dest->dir[1].norm(); } else { matrix_transformate(p_src->dir+1, &m, p_dest->dir+1); p_dest->len.y = 0.0f; } if(lz != 0.0f) { a1 = p_src->dir[2] * lz; matrix_transformate(&a1, &m, p_dest->dir+2); p_dest->len.z = p_dest->dir[2].norm(); } else { matrix_transformate(p_src->dir+2, &m, p_dest->dir+2); p_dest->len.z = 0.0f; } } BOX * obb::transformate(GLMATRIX *p_m) { obb tmp; tmp = *this; transformate(&tmp, p_m, this); return(this); } /* * Is at least one point of this cube visible? */ bool obb::visible(GLMATRIX *p_m) { int i,j,xplane,yplane,xa,ya,m; float x,y,z,xt,yt,zt,w,fx,fy,fw; VECT *p_vert = border; // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for(i = 0, j = 0; i < 8; i++) { xt = p_vert->x; yt = p_vert->y; zt = p_vert->z; x = p_m->_11*xt + p_m->_21*yt + p_m->_31*zt + p_m->_41; y = p_m->_12*xt + p_m->_22*yt + p_m->_32*zt + p_m->_42; z = p_m->_13*xt + p_m->_23*yt + p_m->_33*zt + p_m->_43; w = p_m->_14*xt + p_m->_24*yt + p_m->_34*zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if(m) j++; // bod lezi v obrazovce -> automaticky uspech if(m && -w <= x && x <= w && -w <= y && y <= w) { return(TRUE); } fx = (float)fabs(x); fy = (float)fabs(y); fw = (float)fabs(w); if(fx/fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if(fy/fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; p_vert++; } return((j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } /* * Are all 8 points of the cube visible? */ bool obb::visible_full(GLMATRIX *p_m) { int i,j,xplane,yplane,xa,ya,m; float x,y,z,xt,yt,zt,w,fx,fy,fw; int hits = 0; VECT *p_vert = border; // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for(i = 0, j = 0; i < 8; i++) { xt = p_vert->x; yt = p_vert->y; zt = p_vert->z; x = p_m->_11*xt + p_m->_21*yt + p_m->_31*zt + p_m->_41; y = p_m->_12*xt + p_m->_22*yt + p_m->_32*zt + p_m->_42; z = p_m->_13*xt + p_m->_23*yt + p_m->_33*zt + p_m->_43; w = p_m->_14*xt + p_m->_24*yt + p_m->_34*zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if(m) j++; // bod lezi v obrazovce -> automaticky uspech if(m && -w <= x && x <= w && -w <= y && y <= w) { hits++; continue; } fx = (float)fabs(x); fy = (float)fabs(y); fw = (float)fabs(w); if(fx/fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if(fy/fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; p_vert++; } return((hits == 8) ? hits : (j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } void obb::adjust(VECT *p_center, float radius) { assert(0); } void obb::adjust_len(VECT *p_vec) { VECT tmp; float v; float ln; // Adjust X axis v = fabsf(p_vec->x); ln = fabsf(len.x); if(v > ln) { float adj = (v-ln)*0.5f; tmp = dir[0] * adj; center += tmp; len.x += adj; } // Adjust Y axis v = fabsf(p_vec->y); ln = fabsf(len.y); if(v > ln) { float adj = (v-ln)*0.5f; tmp = dir[0] * adj; center += tmp; len.y += adj; } // Adjust Z axis v = fabsf(p_vec->z); ln = fabsf(len.z); if(v > ln) { float adj = (v-ln)*0.5f; tmp = dir[0] * adj; center += tmp; len.z += adj; } } void obb::adjust(VECT *p_vec) { GLMATRIX m; VECT tmp; matrix_to_obb_get(&m); matrix_transformate(p_vec,&m,&tmp); adjust_len(&tmp); } void obb::adjust(class obb *p_obb) { GLMATRIX m; VECT tmp; int i; matrix_to_obb_get(&m); for(i = 0; i < OBB_BORDER_VERTEXNUM; i++) { matrix_transformate(p_obb->border+i,&m,&tmp); adjust_len(&tmp); } } /* // Converts border points to AABB AABB * obb::aabb_get(GLMATRIX *p_m, AABB *p_out) { VECT a; int i; if(p_m) { matrix_transformate(border,p_m,&a); } else { a = border[0]; } p_out->set(&a,&a); for(i = 1; i < 8; i++) { if(p_m) { matrix_transformate(border+i,p_m,&a); } else { a = border[i]; } p_out->adjust(&a); } return(p_out); } */ void obb::set(OBB *p_list, int num) { OBB best; int i,j; float volume, bvolume = FLT_MAX; if(num == 1) { *this = p_list[0]; return; } for(i = 0; i < num; i++) { OBB tmp(p_list+i); for(j = 0; j < num; j++) { if(i != j) tmp.adjust(p_list+j); } volume = tmp.volume_get(); if(volume < bvolume) { bvolume = volume; best = tmp; } } *this = best; } void obb::set_most_precise(VECT *p_vertex, int vertexnum, tface *p_face, int facenum) { VECT bnorm(0,1,0),bv1(1,0,0),bv2(0,0,1); // best values VECT norm,v1,v2; // current computed values VECT bcenter(0,0,0); VECT blength(1,1,1); int f0,f1,f2,f; float volume, bvolume; bvolume = FLT_MAX; for(f = 0; f < facenum; f += 3) { f0 = p_face[f]; f1 = p_face[f+1]; f2 = p_face[f+2]; face_normal(p_vertex+f0, p_vertex+f1, p_vertex+f2, &norm); if(norm.zero()) continue; // f0->f1 { v1 = p_vertex[f1] - p_vertex[f0]; v2 = vect_mult(v1,norm); v1.norm(); v2.norm(); norm.norm(); GLMATRIX m; m.rotation_set(&v1,&norm,&v2); AABB tmp(&m,p_vertex, vertexnum, p_face, facenum); volume = tmp.volume_get(); if(volume < bvolume) { bvolume = volume; // save the best values bv1 = v1; bv2 = v2; bnorm = norm; tmp.center_get(&bcenter); tmp.length_get(&blength); m.invert(); m.transformate(&bcenter); } } // f0->f2 { v1 = p_vertex[f2] - p_vertex[f0]; v2 = vect_mult(v1,norm); v1.norm(); v2.norm(); norm.norm(); GLMATRIX m; m.rotation_set(&v1,&norm,&v2); AABB tmp(&m,p_vertex, vertexnum, p_face, facenum); volume = tmp.volume_get(); if(volume < bvolume) { bvolume = volume; // save the best values bv1 = v1; bv2 = v2; bnorm = norm; tmp.center_get(&bcenter); tmp.length_get(&blength); m.invert(); m.transformate(&bcenter); } } // f1->f2 { v1 = p_vertex[f2] - p_vertex[f1]; v2 = vect_mult(v1,norm); v1.norm(); v2.norm(); norm.norm(); GLMATRIX m; m.rotation_set(&v1,&norm,&v2); AABB tmp(&m,p_vertex, vertexnum, p_face, facenum); volume = tmp.volume_get(); if(volume < bvolume) { bvolume = volume; // save the best values bv1 = v1; bv2 = v2; bnorm = norm; tmp.center_get(&bcenter); tmp.length_get(&blength); m.invert(); m.transformate(&bcenter); } } } dir[0] = bv1; dir[1] = bnorm; dir[2] = bv2; center = bcenter; len = blength; border_update(); } void obb::set_precise(VECT *p_vertex, int vertexnum, tface *p_face, int facenum) { VECT bnorm(0,1,0),bv1(1,0,0),bv2(0,0,1); // best values VECT norm,v1,v2; // current computed values VECT bcenter(0,0,0); VECT blength(1,1,1); int f0,f1,f2,f; float volume, bvolume; bvolume = FLT_MAX; for(f = 0; f < facenum; f += 3) { f0 = p_face[f]; f1 = p_face[f+1]; f2 = p_face[f+2]; face_normal(p_vertex+f0, p_vertex+f1, p_vertex+f2, &norm); if(norm.zero()) continue; // f0->f1 { v1 = p_vertex[f1] - p_vertex[f0]; v2 = vect_mult(v1,norm); v1.norm(); v2.norm(); norm.norm(); GLMATRIX m; m.rotation_set(&v1,&norm,&v2); AABB tmp(&m,p_vertex, vertexnum, p_face, facenum); volume = tmp.volume_get(); if(volume < bvolume) { bvolume = volume; // save the best values bv1 = v1; bv2 = v2; bnorm = norm; tmp.center_get(&bcenter); tmp.length_get(&blength); m.invert(); m.transformate(&bcenter); } } } dir[0] = bv1; dir[1] = bnorm; dir[2] = bv2; center = bcenter; len = blength; border_update(); } void obb::set_fast(VECT *p_vertex, int vertexnum, tface *p_face, int facenum) { AABB tmp(p_vertex, vertexnum, p_face, facenum); set(&tmp.min,&tmp.max); } /* TODO: - create some metrixes how to determine envelope creation method */ #define OBB_MOST_PRECISE 200 #define OBB_PRECISE 1000 void obb::set(VECT *p_vertex, int vertexnum, tface *p_face, int facenum) { if(facenum < OBB_MOST_PRECISE) { set_most_precise(p_vertex, vertexnum, p_face, facenum); } else if(facenum < OBB_MOST_PRECISE) { set_precise(p_vertex, vertexnum, p_face, facenum); } else { set_fast(p_vertex, vertexnum, p_face, facenum); } } void obb::set(GLMATRIX *p_mat, VECT *p_vertex, int vertexnum, tface *p_face, int facenum) { VECT *p_tvert = (VECT *)malloc(sizeof(p_vertex[0])*vertexnum); int i; for(i = 0; i < vertexnum; i++) matrix_transformate(p_vertex+i,p_mat,p_tvert+i); set(p_tvert, vertexnum, p_face, facenum); free(p_tvert); } void obb::draw(GLMATRIX *p_m, RGBB color) { AABB tmp; GLMATRIX m; // Transform World Space->OBB m.rotation_set(dir,dir+1,dir+2); if(m.determinant()) { // OBB->World Space m.invert(); m.translation_set(¢er); if(p_m) matrix_mult(p_m,&m,&m); tmp.set_len(&len); tmp.draw(&m,color); } } void obb::print(char *p_name) { if(p_name) { pprintf("Box %s",p_name); } pprintf("OBB dir[0] = [%f,%f,%f]",dir[0].x,dir[0].y,dir[0].z); pprintf("OBB dir[1] = [%f,%f,%f]",dir[1].x,dir[1].y,dir[1].z); pprintf("OBB dir[2] = [%f,%f,%f]",dir[2].x,dir[2].y,dir[2].z); pprintf("OBB center = [%f,%f,%f]",center.x,center.y,center.z); pprintf("OBB length = [%f,%f,%f]",center.x,center.y,center.z); } OBB * obb::to_obb(OBB *p_dest) { *p_dest = *this; return(p_dest); } // Convert OBB to AABB AABB * obb::to_aabb(AABB *p_dest) { VECT border[8]; p_dest->set(border_get(border),8,NULL,0); return(p_dest); } void obb::set(class box *p_src) { p_src->to_obb(this); } obb::obb(class box *p_src) { set(p_src); } /* OBB Tree */ /* void obb_tree::kresli(dword color) { if(this) { obb.draw(color, NULL); for(int i = 0; i < nextnum; i++) p_next[i].kresli(color); } } */ /* void obb_calc_item(OBB *p_vys, OBB_TREE_ITEM *p_item, int itemnum) { OBB *p_list = (OBB *)mmalloc(sizeof(OBB)*itemnum); int i; for(i = 0; i < itemnum; i++) { p_list[i] = *(p_item[i].p_obb); } p_vys->slep_aabb(p_list,itemnum); free(p_list); } void obbtree_calc_obalky(OBB_TREE *p_prvni) { OBB_TREE_ITEM *p_itn; OBB *p_list; int p,i; p_list = (OBB *)mmalloc(sizeof(p_list[0])*(p_prvni->nextnum+p_prvni->itnum)); for(i = 0; i < p_prvni->nextnum; i++) { obbtree_calc_obalky(p_prvni->p_next+i); p_list[i] = p_prvni->p_next[i].obb; } p_itn = p_prvni->p_item; for(p = 0; p < p_prvni->itnum; p++, p_itn++) { if(p_itn->p_mesh) { p_list[i+p] = p_itn->p_mesh->obb_world; } else { p_list[i+p] = p_itn->p_poly->obb; } } obb_slep(&p_prvni->obb,p_list,i+p); free(p_list); } #define MAX_VZDAL_OBALEK 20.0f #define MIN_PODOBALEK_OBJ 10 #define MIN_PODOBALEK_OBJ_ZBYTEK 10 */ /* Kazdy polygon ma uz implicitne obalku */ /* static EDIT_MATERIAL **p_mat; void obbtree_vyrob(OBB_TREE *p_prvni, EDIT_MESH_POLY *p_poly, int polynum, GAME_MESH **p_mesh, int meshnum, int *p_ind, EDIT_MATERIAL **p_matlist) { int i,j,itnum = polynum+meshnum; p_mat = p_matlist; memset(p_prvni,0,sizeof(p_prvni[0])); p_prvni->p_item = (OBB_TREE_ITEM *)mmalloc(sizeof(p_prvni->p_item[0])*itnum); p_prvni->itnum = itnum; for(i = 0; i < polynum; i++) { p_prvni->p_item[i].p_poly = p_poly+i; p_prvni->p_item[i].p_obb = &p_poly[i].obb; } for(j = 0; j < meshnum; j++) { if(p_ind) p_prvni->p_item[i+j].mesh = p_ind[j]; p_prvni->p_item[i+j].p_mesh = p_mesh[j]; p_prvni->p_item[i+j].p_obb = &p_mesh[j]->obb_world; } // obbtree_vyrob_rec(p_prvni, MAX_VZDAL_OBALEK); obbtree_calc_obalky(p_prvni); } static int obbtree_vyrob_rec_comp(const void *p_1, const void *p_2) { OBB_TREE_ITEM *p_it1 = (OBB_TREE_ITEM *)p_1; OBB_TREE_ITEM *p_it2 = (OBB_TREE_ITEM *)p_2; EDIT_MESH_POLY *p_poly1,*p_poly2; if(p_it1->p_mesh && p_it2->p_poly) return(-1); else if(p_it2->p_mesh && p_it1->p_poly) return(1); if(p_it1->p_mesh && p_it2->p_mesh) return(0); p_poly1 = p_it1->p_poly; p_poly2 = p_it2->p_poly; if(p_mat[p_poly1->material]->p_text[0] && p_mat[p_poly2->material]->p_text[0]) return(p_mat[p_poly1->material]->p_text[0]->text - p_mat[p_poly2->material]->p_text[0]->text); else return(p_mat[p_poly1->material]->p_text[0] - p_mat[p_poly2->material]->p_text[0]); } */ /* Ze seznamu polylistu vybere ty co se daji do obalky a zbytek se soupne do te hlavni */ /* p_prvni -> pointer na prvni obalku, do ktere se strci vsechny globalni poly a ty podobalky se strci do pod_obalek */ /* void obbtree_vyrob_rec(OBB_TREE *p_prvni, float max_vzdal) { OBB_TREE_ITEM *p_item = p_prvni->p_item; int itemnum = p_prvni->itnum; int itemzbyva = p_prvni->itnum; OBB_TREE_ITEM *p_tmp_item = (OBB_TREE_ITEM *)_alloca(sizeof(p_tmp_item[0])*itemnum); int tmp_itemnum; OBB_TREE *p_obalky = (OBB_TREE *)_alloca(sizeof(p_obalky[0])*itemnum); int obalnum = 0; int *p_hits = (int *)_alloca(sizeof(p_hits[0])*itemnum); // globalni hity int *p_lhits = (int *)_alloca(sizeof(p_lhits[0])*itemnum); // lokalni hity OBB obb; int p,i,itemzustava; if(p_prvni->itnum <= MIN_PODOBALEK_OBJ) return; memset(p_tmp_item,0,sizeof(p_tmp_item[0])*itemnum); memset(p_obalky,0,sizeof(p_obalky[0])*itemnum); memset(p_hits,0,sizeof(p_hits[0])*itemnum); memset(p_lhits,0,sizeof(p_lhits[0])*itemnum); // Cyklus pres vsechny poly, ktere nejsou jesne vyrazeny ze seznamu volnych // - hit-list for(p = 0; p < itemnum; p++) { if(p_hits[p]) continue; // seznam tmp poly -> zacatek seznamu potencialni obalky // momentalne to je pouze ten 1 prvek p_tmp_item[0] = p_item[p]; tmp_itemnum = 1; p_lhits[p] = TRUE; // rozmery minimalni obalky o 1 poly obb = *p_item[p].p_obb; // Pridani vsech blizskych poly do 1 obalky for(i = 0; i < itemnum; i++) { if(i == p || p_hits[i]) continue; p_lhits[i] = (vzdal_bodu_bod(&obb.obb_center,&p_item[i].p_obb->obb_center) <= max_vzdal); if(p_lhits[i]) { p_tmp_item[tmp_itemnum++] = p_item[i]; obb_calc_item(&obb,p_tmp_item,tmp_itemnum); } } // Pokud je blizko sebe vice objektu nez co je minimum jedne obalky -> // - udelej tuto samostanou pod-obalku se shluku objektu -> vyber je // - a to pouze pokud jeste neco zbyde v puvodni obalce if(tmp_itemnum >= MIN_PODOBALEK_OBJ && itemzbyva-tmp_itemnum >= MIN_PODOBALEK_OBJ_ZBYTEK) { itemzbyva -= tmp_itemnum; p_obalky[obalnum].obb = obb; p_obalky[obalnum].p_item = (OBB_TREE_ITEM *)kopiruj_pole(p_tmp_item,sizeof(p_tmp_item[0])*tmp_itemnum); p_obalky[obalnum].itnum = tmp_itemnum; p_obalky[obalnum].p_up = p_prvni; obalnum++; for(i = 0; i < itemnum; i++) // Prekopiruje hit-list p_hits[i] |= p_lhits[i]; } } // Spocitam pocet neumistenych polozek memcpy(p_tmp_item,p_item,sizeof(p_item[0])*itemnum); itemzustava = 0; for(i = 0; i < itemnum; i++) { if(!p_hits[i]) itemzustava++; } free(p_prvni->p_item); p_prvni->p_item = (OBB_TREE_ITEM *)mmalloc(sizeof(p_prvni->p_item[0])*itemzustava); p_prvni->itnum = itemzustava; // Skopiruju neumistene polozky for(i = 0, itemzustava = 0; i < itemnum; i++) { if(!p_hits[i]) p_prvni->p_item[itemzustava++] = p_tmp_item[i]; } // Setridim polozky podle pouzitych textur qsort(p_prvni->p_item,p_prvni->itnum,sizeof(p_prvni->p_item[0]),obbtree_vyrob_rec_comp); // Skopiruji se obalky p_prvni->nextnum = obalnum; if(obalnum) { p_prvni->p_next = (OBB_TREE *)kopiruj_pole(p_obalky,sizeof(p_prvni->p_next[0])*obalnum); // Pro kazdou pod-obalku zavolej delicku... max_vzdal /= 2.0f; for(i = 0; i < obalnum; i++) { obbtree_vyrob_rec(p_prvni->p_next+i,max_vzdal); } } } void obbtree_zrus(OBB_TREE *p_ob) { int i; if(p_ob->p_item) { free(p_ob->p_item); p_ob->p_item = NULL; } if(p_ob->p_next) { for(i = 0; i < p_ob->nextnum; i++) { obbtree_zrus(p_ob->p_next+i); } free(p_ob->p_next); } } */ berusky2-0.12/src/age/graph/object_geometry.cpp0000644000175000017500000000441513674426075016456 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* * Scene Object routines */ scene_object_geometry::scene_object_geometry(class scene *p_scene) : object_box(p_scene) { } bool scene_object_geometry::visible(void) { BOX *p_box = object_box_get(); if(p_box) { SCENE *p_scene = scene_get(); if(p_scene) { GPIPE *p_gpipe = p_scene->gpipe_get(); return(p_box->visible(p_gpipe->camera_project_get())); } } return(FALSE); } void scene_object_geometry::print(int ident) { pprintf("%*cObject '%s'",ident,' ',name_get()); if(render_hierarchy_parent_get()) pprintf("%*cObject parent '%s'",ident,' ',render_hierarchy_parent_get()->name_get()); if(render_hierarchy_child_get()) { ((SCENE_OBJECT_GEOMETRY *)render_hierarchy_child_get())->print(ident+2); } if(render_hierarchy_sibling_get()) { ((SCENE_OBJECT_GEOMETRY *)render_hierarchy_sibling_get())->print(ident); } } void scene_object_tree::print(const char *p_title) { root.print(0); } berusky2-0.12/src/age/graph/object_hierarchy.h0000644000175000017500000001174513674426075016252 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OBJECT_HIERARCHY_H__ #define __OBJECT_HIERARCHY_H__ typedef enum { SCENE_OBJECT_NONE = 0, SCENE_OBJECT_MESH, SCENE_OBJECT_CAMERA } HIERARCHY_OBJECT_TYPE; /* * Scene geometry object types */ typedef class object_hierarchy_type { /* * Object types */ private: HIERARCHY_OBJECT_TYPE obj_type; public: HIERARCHY_OBJECT_TYPE object_type_get(void) { return(obj_type); } void object_type_set(HIERARCHY_OBJECT_TYPE type) { obj_type = type; } public: // Check type bool object_is_type(HIERARCHY_OBJECT_TYPE type) { return(obj_type == type); } // Is it a geometry object? bool object_is_geometry(void) { return(obj_type == SCENE_OBJECT_MESH); } // Can be rendered? bool object_is_rendered(void) { return(obj_type == SCENE_OBJECT_MESH); } public: object_hierarchy_type(void) { obj_type = SCENE_OBJECT_NONE; } } OBJECT_HIERARCHY_TYPE; /* * Object located in scene hierarchy */ CLASS_TREE_LEAF_ITERATOR(hierarchy, object_hierarchy); typedef class hierarchy_leaf_iterator OBJECT_HIERARCHY_ITERATOR; typedef class object_hierarchy : public object_hierarchy_type, public object_list { /* * Basic scene tree hierarchy */ MEMBER_TREE_LEAF(hierarchy, object_hierarchy); public: bool is_root; public: class object_hierarchy * hierarchy_sibling_get(void) { return(hierarchy_leaf_sibling_get()); } class object_hierarchy * hierarchy_sibling_last_get(void) { return(hierarchy_leaf_sibling_last_get()); } class object_hierarchy * hierarchy_child_get(void) { return(hierarchy_leaf_child_get()); } class object_hierarchy * hierarchy_child_last_get(void) { return(hierarchy_leaf_child_last_get()); } public: // Addach a new sibling pass this node void hierarchy_sibling_add(class object_hierarchy *p_sib) { hierarchy_leaf_sibling_add(p_sib); } // add child to this node void hierarchy_child_add(class object_hierarchy *p_child) { hierarchy_leaf_child_add(p_child); } public: // Remove this leaf from tree void hierarchy_remove(void) { hierarchy_leaf_remove(); } public: class object_hierarchy * hierarchy_parent_get(void) { return(hierarchy_leaf_parent_get()); } public: // TODO -> sync with tree structure? void hierarchy_parent_set(class object_hierarchy *p_parent) { if(p_parent != hierarchy_leaf_parent_get()) { hierarchy_leaf_remove(); hierarchy_leaf_parent_set(p_parent); } } // Tree traversal public: class object_hierarchy * hierarchy_next(class hierarchy_leaf_iterator *p_it) { return(hierarchy_leaf_next(p_it)); } // Special root node handling public: bool is_hierarchy_root(void) { return(is_root); } void hierarchy_root_set(void) { hierarchy_remove(); is_root = TRUE; } void hierarchy_root_clear(void) { is_root = FALSE; } public: /* * List used for rendering */ MEMBER_LIST_ITEM(render, object_hierarchy, object_render_list); MEMBER_LIST_ITEM_MARK(render, object_hierarchy, object_render_list); public: object_hierarchy(SCENE *p_scene) : object_list(p_scene) { hierarchy_root_clear(); hierarchy_leaf_init(); render_list_item_init(); } } OBJECT_HIERARCHY; /* * Render-list of scene objects */ typedef class object_render_list : public scene_reference { MEMBER_LIST_HEAD(render, object_hierarchy, object_render_list); public: object_render_list(SCENE *p_scene) : scene_reference(p_scene) { render_list_head_init(); } } OBJECT_RENDER_LIST; #endif // __OBJECT_HIERARCHY_H__ berusky2-0.12/src/age/graph/color.h0000644000175000017500000001733113674454606014062 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* color classes */ #ifndef __COLOR_H__ #define __COLOR_H__ #include "color_operators.h" class rgbf; class rgbb; class rgbaf; class rgbab; typedef class rgbf RGBF; typedef class rgbb RGBB; typedef class rgbaf RGBAF; typedef class rgbab RGBAB; #define COLOR_TO_FLOAT(color) ((color)/MAX_BYTE_F) #define COLOR_TO_BYTE(color) ((byte)((color)*MAX_BYTE_F)) // Simple clases for parser #ifdef __cplusplus typedef struct rgbaf_simple { float r,g,b,a; } RGBAF_SIMPLE; #endif typedef class rgbf { public: float r,g,b; public: OP_UNARY_RGB(class rgbf, float); public: float alpha_get(void) { return(0.0f); } public: rgbf(void) {}; public: rgbf(byte color) { r = g = b = color/MAX_BYTE_F; } rgbf(int color) { r = g = b = (byte)(color/MAX_BYTE_F); } rgbf(float color) { r = g = b = color; } rgbf(tcolor color) { rgb_float(color,&r,&g,&b); } public: /* rgbf(byte r_, byte g_, byte b_) { r = r_/MAX_BYTE_F; g = g_/MAX_BYTE_F; b = b_/MAX_BYTE_F; } rgbf(int r_, int g_, int b_) { r = r_/MAX_BYTE_F; g = g_/MAX_BYTE_F; b = b_/MAX_BYTE_F; } */ rgbf(float r_,float g_,float b_) { r = r_, g = g_, b = b_; } public: rgbf(RGBB src); rgbf(RGBB *src); public: operator tcolor(void) { norm_color(); return(float_rgb(r,g,b)); } public: void norm_up(void) { #define MAX_UP 1.0f if(r > MAX_UP) r = MAX_UP; if(g > MAX_UP) g = MAX_UP; if(b > MAX_UP) b = MAX_UP; } void norm_down(void) { #define MAX_DOWN 0.0f if(r < MAX_DOWN) r = MAX_DOWN; if(g < MAX_DOWN) g = MAX_DOWN; if(b < MAX_DOWN) b = MAX_DOWN; } void norm_color(void) { norm_up(); norm_down(); } } RGBF; OP_OPERATION(RGBF, float); typedef class rgbb { public: byte r,g,b; public: OP_UNARY_RGB(class rgbb, byte); public: float alpha_get(void) { return(0.0f); } public: rgbb(void) {}; public: rgbb(byte color) { r = g = b = color; } rgbb(int color) { r = g = b = (byte)color; } rgbb(float color) { r = g = b = (byte)(color*MAX_BYTE_F); } rgbb(tcolor color) { rgb_byte(color,&r,&g,&b); } public: /* rgbb(byte r_, byte g_, byte b_) { r = r_; g = g_; b = b_; } rgbb(int r_, int g_, int b_) { r = (byte)r_; g = (byte)g_; b = (byte)b_; } */ rgbb(float r_, float g_, float b_) { r = (byte)(r_*MAX_BYTE_F); g = (byte)(g_*MAX_BYTE_F); b = (byte)(b_*MAX_BYTE_F); } public: rgbb(RGBF src) { r = (byte)(src.r*MAX_BYTE_F); g = (byte)(src.g*MAX_BYTE_F); b = (byte)(src.b*MAX_BYTE_F); } rgbb(RGBF *src) { r = (byte)(src->r*MAX_BYTE_F); g = (byte)(src->g*MAX_BYTE_F); b = (byte)(src->b*MAX_BYTE_F); } public: operator tcolor(void) { return(byte_rgb(r,g,b)); } void norm_color(void) { } } RGBB; typedef class rgbaf { public: float r,g,b,a; public: OP_UNARY_RGBA(class rgbaf, float); public: float alpha_get(void) { return(a); } public: rgbaf(void) {}; public: rgbaf(byte color) { r = g = b = a = color/MAX_BYTE_F; } rgbaf(int color) { r = g = b = a = (byte)(color/MAX_BYTE_F); } rgbaf(float color) { r = g = b = a = color; } rgbaf(tcolor color) { rgba_float(color,&r,&g,&b,&a); } rgbaf(RGBAF_SIMPLE color) { r = color.r; g = color.g; b = color.b; a = color.a; } operator RGBAF_SIMPLE(void) { RGBAF_SIMPLE tmp; tmp.r = r; tmp.g = g; tmp.b = b; tmp.a = a; return(tmp); } public: /* rgbaf(byte r_, byte g_, byte b_, byte a_) { r = r_/MAX_BYTE_F; g = g_/MAX_BYTE_F; b = b_/MAX_BYTE_F; a = a_/MAX_BYTE_F; } rgbaf(int r_, int g_, int b_, int a_) { r = r_/MAX_BYTE_F; g = g_/MAX_BYTE_F; b = b_/MAX_BYTE_F; a = a_/MAX_BYTE_F; } */ rgbaf(float r_,float g_,float b_,float a_) { r = r_, g = g_, b = b_, a = a_; } public: rgbaf(RGBAB src); rgbaf(RGBAB *src); public: operator tcolor(void) { norm_color(); return(float_rgba(r,g,b,a)); } public: float intensity(void) { return((r+g+b)/3.0f); } public: void norm_up(void) { #define MAX_UP 1.0f if(r > MAX_UP) r = MAX_UP; if(g > MAX_UP) g = MAX_UP; if(b > MAX_UP) b = MAX_UP; if(a > MAX_UP) a = MAX_UP; } void norm_down(void) { #define MAX_DOWN 0.0f if(r < MAX_DOWN) r = MAX_DOWN; if(g < MAX_DOWN) g = MAX_DOWN; if(b < MAX_DOWN) b = MAX_DOWN; if(a < MAX_DOWN) a = MAX_DOWN; } void norm_color(void) { norm_up(); norm_down(); } } RGBAF; OP_OPERATION(RGBAF, float); typedef class rgbab { public: byte r,g,b,a; public: OP_UNARY_RGBA(class rgbab, byte); public: float alpha_get(void) { return(COLOR_TO_FLOAT(a)); } public: rgbab(void) {}; public: rgbab(byte color) { r = g = b = a = color; } rgbab(int color) { r = g = b = a = (byte)color; } rgbab(float color) { r = g = b = a = (byte)(color*MAX_BYTE_F); } rgbab(tcolor color) { rgba_byte(color,&r,&g,&b,&a); } public: rgbab(byte r_, byte g_, byte b_, byte a_) { r = r_; g = g_; b = b_; a = a_; } rgbab(int r_, int g_, int b_, int a_) { r = (byte)r_; g = (byte)g_; b = (byte)b_; a = (byte)a_; } rgbab(float r_, float g_, float b_, float a_) { r = (byte)(r_*MAX_BYTE_F); g = (byte)(g_*MAX_BYTE_F); b = (byte)(b_*MAX_BYTE_F); a = (byte)(a_*MAX_BYTE_F); } public: rgbab(RGBAF src) { r = (byte)(src.r*MAX_BYTE_F); g = (byte)(src.g*MAX_BYTE_F); b = (byte)(src.b*MAX_BYTE_F); a = (byte)(src.a*MAX_BYTE_F); } rgbab(RGBAF *src) { r = (byte)(src->r*MAX_BYTE_F); g = (byte)(src->g*MAX_BYTE_F); b = (byte)(src->b*MAX_BYTE_F); a = (byte)(src->a*MAX_BYTE_F); } public: operator tcolor(void) { return(byte_rgba(r,g,b,a)); } void norm_color(void) { } } RGBAB; /* * HSVF color model */ typedef class hsvf { public: float h, // <0,1> - color s, // <0,1> - saturation v; // <0,1> - value public: OP_UNARY_HSV(class hsvf, float); public: void norm_color(void) { // TODO } public: hsvf(void) {}; } HSVF; #endif //__COLOR_H__ berusky2-0.12/src/age/graph/gext.cpp0000644000175000017500000007466113674426075014256 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ ** * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include // Constants and types #include "defs.h" #include "typ.h" #include "typ_graph.h" #include "floats.h" // Extended types #include "color_helpers.h" #include "color.h" #include "vector.h" #include "quat.h" #include "matrix.h" // OpenGL includes #include "opengl.h" #include "gext.h" // Disk and some minor utilities #include "utils.h" #include "ini.h" #include "log.h" #include "mem_alloc.h" // ------------------------------------------------------- // Extensions // ------------------------------------------------------- bool gl_ext::extlist_blend_color; bool gl_ext::extlist_blend_minmax; bool gl_ext::extlist_fog_coord; bool gl_ext::extlist_fence; bool gl_ext::extlist_register_combiners; bool gl_ext::extlist_text_compresion; bool gl_ext::extlist_text_sharp; bool gl_ext::extlist_text_edge_clamp; bool gl_ext::extlist_vertex_array_range; bool gl_ext::extlist_vertex_array; bool gl_ext::extlist_indicie_array; bool gl_ext::extlist_vertex_array_packed; bool gl_ext::extlist_text_env_combine; bool gl_ext::extlist_text_env_dot3; bool gl_ext::extlist_text_filter_anisotropic; bool gl_ext::extlist_clip_volume_hit; bool gl_ext::extlist_ati_env_bump; bool gl_ext::extlist_ati_env_bump_unit[6]; bool gl_ext::extlist_ati_vertex_array_object; bool gl_ext::extlist_ati_element_array; bool gl_ext::extlist_ati_pn_triangles; bool gl_ext::extlist_arb_vertex_buffer; bool gl_ext::extlist_ati_draw_buffers; int gl_ext::ext_multitext_units = 0; /* PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL; PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL; PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB = NULL; PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB = NULL; PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB = NULL; PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB = NULL; PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB = NULL; PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB = NULL; PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB = NULL; PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB = NULL; PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB = NULL; PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB = NULL; PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL; PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB = NULL; PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB = NULL; PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB = NULL; PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB = NULL; PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB = NULL; PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB = NULL; PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB = NULL; PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB = NULL; PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB = NULL; PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB = NULL; PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB = NULL; PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB = NULL; PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB = NULL; PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB = NULL; PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB = NULL; PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB = NULL; PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB = NULL; PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB = NULL; PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB = NULL; PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB = NULL; PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB = NULL; */ GLint gl_ext::ext_multitexture_text_index[] = { GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB, GL_TEXTURE4_ARB, GL_TEXTURE5_ARB, GL_TEXTURE6_ARB, GL_TEXTURE7_ARB }; /* * Extensions */ bool gl_ext::gl_init_multitexture(void) { if(is_extension("GL_ARB_multitexture")) { glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ext_multitext_units); pprintf("ARB Texture units %d",ext_multitext_units); /* int level = 0; if(!(glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)SDL_GL_GetProcAddress("glActiveTextureARB"))) return(level); if(!(glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)SDL_GL_GetProcAddress("glClientActiveTextureARB"))) return(level); if(!(glMultiTexCoord1dARB = (PFNGLMULTITEXCOORD1DARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1dARB"))) return(level); if(!(glMultiTexCoord1dvARB = (PFNGLMULTITEXCOORD1DVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1dvARB"))) return(level); if(!(glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1fARB"))) return(level); if(!(glMultiTexCoord1fvARB = (PFNGLMULTITEXCOORD1FVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1fvARB"))) return(level); if(!(glMultiTexCoord1iARB = (PFNGLMULTITEXCOORD1IARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1iARB"))) return(level); if(!(glMultiTexCoord1ivARB = (PFNGLMULTITEXCOORD1IVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1ivARB"))) return(level); if(!(glMultiTexCoord1sARB = (PFNGLMULTITEXCOORD1SARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1sARB"))) return(level); if(!(glMultiTexCoord1svARB = (PFNGLMULTITEXCOORD1SVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord1svARB"))) return(level); level = 1; if(!(glMultiTexCoord2dARB = (PFNGLMULTITEXCOORD2DARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2dARB"))) return(level); if(!(glMultiTexCoord2dvARB = (PFNGLMULTITEXCOORD2DVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2dvARB"))) return(level); if(!(glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2fARB"))) return(level); if(!(glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2fvARB"))) return(level); if(!(glMultiTexCoord2iARB = (PFNGLMULTITEXCOORD2IARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2iARB"))) return(level); if(!(glMultiTexCoord2ivARB = (PFNGLMULTITEXCOORD2IVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2ivARB"))) return(level); if(!(glMultiTexCoord2sARB = (PFNGLMULTITEXCOORD2SARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2sARB"))) return(level); if(!(glMultiTexCoord2svARB = (PFNGLMULTITEXCOORD2SVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord2svARB"))) return(level); level = 2; if(!(glMultiTexCoord3dARB = (PFNGLMULTITEXCOORD3DARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3dARB"))) return(level); if(!(glMultiTexCoord3dvARB = (PFNGLMULTITEXCOORD3DVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3dvARB"))) return(level); if(!(glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3fARB"))) return(level); if(!(glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3fvARB"))) return(level); if(!(glMultiTexCoord3iARB = (PFNGLMULTITEXCOORD3IARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3iARB"))) return(level); if(!(glMultiTexCoord3ivARB = (PFNGLMULTITEXCOORD3IVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3ivARB"))) return(level); if(!(glMultiTexCoord3sARB = (PFNGLMULTITEXCOORD3SARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3sARB"))) return(level); if(!(glMultiTexCoord3svARB = (PFNGLMULTITEXCOORD3SVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord3svARB"))) return(level); level = 3; if(!(glMultiTexCoord4dARB = (PFNGLMULTITEXCOORD4DARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4dARB"))) return(level); if(!(glMultiTexCoord4dvARB = (PFNGLMULTITEXCOORD4DVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4dvARB"))) return(level); if(!(glMultiTexCoord4fARB = (PFNGLMULTITEXCOORD4FARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4fARB"))) return(level); if(!(glMultiTexCoord4fvARB = (PFNGLMULTITEXCOORD4FVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4fvARB"))) return(level); if(!(glMultiTexCoord4iARB = (PFNGLMULTITEXCOORD4IARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4iARB"))) return(level); if(!(glMultiTexCoord4ivARB = (PFNGLMULTITEXCOORD4IVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4ivARB"))) return(level); if(!(glMultiTexCoord4sARB = (PFNGLMULTITEXCOORD4SARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4sARB"))) return(level); if(!(glMultiTexCoord4svARB = (PFNGLMULTITEXCOORD4SVARBPROC)SDL_GL_GetProcAddress("glMultiTexCoord4svARB"))) return(level); level = 4; */ return(TRUE); } else { return(FALSE); } } PFNGLBLENDCOLOREXTPROC glBlendColorEXT = NULL; bool gl_ext::gl_init_blend_color(void) { if(is_extension("GL_EXT_blend_color")) { if(!(glBlendColorEXT = (PFNGLBLENDCOLOREXTPROC)SDL_GL_GetProcAddress("glBlendColorEXT"))) return(FALSE); else return(TRUE); } else { return(FALSE); } } PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT = NULL; bool gl_ext::gl_init_blend_minmax(void) { if(is_extension("GL_EXT_blend_minmax")) { if(!(glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)SDL_GL_GetProcAddress("glBlendEquationEXT"))) return(FALSE); return(TRUE); } else { return(FALSE); } } PFNGLFOGCOORDDEXTPROC glFogCoorddEXT = NULL; PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = NULL; PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL; PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT = NULL; PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = NULL; bool gl_ext::gl_init_fog_coord(void) { if(is_extension("GL_EXT_fog_coord")) { if(!(glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)SDL_GL_GetProcAddress("glFogCoorddEXT"))) return(FALSE); if(!(glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)SDL_GL_GetProcAddress("glFogCoorddvEXT"))) return(FALSE); if(!(glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)SDL_GL_GetProcAddress("glFogCoordfEXT"))) return(FALSE); if(!(glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)SDL_GL_GetProcAddress("glFogCoordfvEXT"))) return(FALSE); if(!(glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)SDL_GL_GetProcAddress("glFogCoordPointerEXT"))) return(FALSE); glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); glDisableClientState(GL_FOG_COORDINATE_ARRAY_EXT); return(TRUE); } else { return(FALSE); } } PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3bEXT = NULL; PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bvEXT = NULL; PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3dEXT = NULL; PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dvEXT = NULL; PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3fEXT = NULL; PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT = NULL; PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3iEXT = NULL; PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3ivEXT = NULL; PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3sEXT = NULL; PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3svEXT = NULL; PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ubEXT = NULL; PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXT = NULL; PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3uiEXT = NULL; PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uivEXT = NULL; PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3usEXT = NULL; PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usvEXT = NULL; PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT = NULL; bool gl_ext::gl_init_secondary_color(void) { if(is_extension("GL_EXT_secondary_color")) { if(!(glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3bEXT"))) return(FALSE); if(!(glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3bvEXT"))) return(FALSE); if(!(glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3dEXT"))) return(FALSE); if(!(glSecondaryColor3dvEXT = (PFNGLSECONDARYCOLOR3DVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3dvEXT"))) return(FALSE); if(!(glSecondaryColor3fEXT = (PFNGLSECONDARYCOLOR3FEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3fEXT"))) return(FALSE); if(!(glSecondaryColor3fvEXT = (PFNGLSECONDARYCOLOR3FVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3fvEXT"))) return(FALSE); if(!(glSecondaryColor3iEXT = (PFNGLSECONDARYCOLOR3IEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3iEXT"))) return(FALSE); if(!(glSecondaryColor3ivEXT = (PFNGLSECONDARYCOLOR3IVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3ivEXT"))) return(FALSE); if(!(glSecondaryColor3sEXT = (PFNGLSECONDARYCOLOR3SEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3sEXT"))) return(FALSE); if(!(glSecondaryColor3svEXT = (PFNGLSECONDARYCOLOR3SVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3svEXT"))) return(FALSE); if(!(glSecondaryColor3ubEXT = (PFNGLSECONDARYCOLOR3UBEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3ubEXT"))) return(FALSE); if(!(glSecondaryColor3ubvEXT = (PFNGLSECONDARYCOLOR3UBVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3ubvEXT"))) return(FALSE); if(!(glSecondaryColor3uiEXT = (PFNGLSECONDARYCOLOR3UIEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3uiEXT"))) return(FALSE); if(!(glSecondaryColor3uivEXT = (PFNGLSECONDARYCOLOR3UIVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3uivEXT"))) return(FALSE); if(!(glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3usEXT"))) return(FALSE); if(!(glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3usvEXT"))) return(FALSE); if(!(glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)SDL_GL_GetProcAddress("glSecondaryColorPointerEXT"))) return(FALSE); return(TRUE); } else { return(FALSE); } } PFNGLGENFENCESNVPROC glGenFencesNV = NULL; PFNGLDELETEFENCESNVPROC glDeleteFencesNV = NULL; PFNGLSETFENCENVPROC glSetFenceNV = NULL; PFNGLTESTFENCENVPROC glTestFenceNV = NULL; PFNGLFINISHFENCENVPROC glFinishFenceNV = NULL; PFNGLISFENCENVPROC glIsFenceNV = NULL; PFNGLGETFENCEIVNVPROC glGetFenceivNV = NULL; bool gl_ext::gl_init_fence(void) { if(is_extension("GL_NV_fence")) { if(!(glGenFencesNV = (PFNGLGENFENCESNVPROC)SDL_GL_GetProcAddress("glGenFencesNV"))) return(FALSE); if(!(glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)SDL_GL_GetProcAddress("glDeleteFencesNV"))) return(FALSE); if(!(glSetFenceNV = (PFNGLSETFENCENVPROC)SDL_GL_GetProcAddress("glSetFenceNV"))) return(FALSE); if(!(glTestFenceNV = (PFNGLTESTFENCENVPROC)SDL_GL_GetProcAddress("glTestFenceNV"))) return(FALSE); if(!(glFinishFenceNV = (PFNGLFINISHFENCENVPROC)SDL_GL_GetProcAddress("glFinishFenceNV"))) return(FALSE); if(!(glIsFenceNV = (PFNGLISFENCENVPROC)SDL_GL_GetProcAddress("glIsFenceNV"))) return(FALSE); if(!(glGetFenceivNV = (PFNGLGETFENCEIVNVPROC)SDL_GL_GetProcAddress("glGetFenceivNV"))) return(FALSE); return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_texture_compression(void) { if(is_extension("GL_ARB_texture_compression")) { return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_texture_lod(void) { if(is_extension("GL_EXT_texture_lod_bias")) { return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_clip_volume_hit(void) { if(is_extension("GL_EXT_clip_volume_hint")) { return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_text_edge_clamp(void) { if(is_extension("GL_EXT_texture_edge_clamp")) { return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_text_env_combine(void) { if(is_extension("GL_EXT_texture_env_combine")) { return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_text_env_dot3(void) { if(is_extension("GL_EXT_texture_env_dot3")) { return(TRUE); } else { return(FALSE); } } PFNGLTEXBUMPPARAMETERIVATIPROC glTexBumpParameterivATI = NULL; PFNGLTEXBUMPPARAMETERFVATIPROC glTexBumpParameterfvATI = NULL; PFNGLGETTEXBUMPPARAMETERIVATIPROC glGetTexBumpParameterivATI = NULL; PFNGLGETTEXBUMPPARAMETERFVATIPROC glGetTexBumpParameterfvATI = NULL; bool gl_ext::gl_init_ati_env_bump(void) { /* int *p_units,units; int i,u; if(is_extension("GL_ATI_envmap_bumpmap")) { glTexBumpParameterivATI = (PFNGLTEXBUMPPARAMETERIVATIPROC) SDL_GL_GetProcAddress("glTexBumpParameterivATI"); glTexBumpParameterfvATI = (PFNGLTEXBUMPPARAMETERFVATIPROC) SDL_GL_GetProcAddress("glTexBumpParameterfvATI"); glGetTexBumpParameterivATI = (PFNGLGETTEXBUMPPARAMETERIVATIPROC) SDL_GL_GetProcAddress("glGetTexBumpParameterivATI"); glGetTexBumpParameterfvATI = (PFNGLGETTEXBUMPPARAMETERFVATIPROC) SDL_GL_GetProcAddress("glGetTexBumpParameterfvATI"); glGetTexBumpParameterivATI(GL_BUMP_NUM_TEX_UNITS_ATI,&units); //kprintf(1,"ATI Bump-units %d",units); //p_units = _alloca(sizeof(p_units[0])*units); //glGetTexBumpParameterivATI(GL_BUMP_TEX_UNITS_ATI,p_units); for(i = 0; i < units; i++) { u = p_units[i]-GL_TEXTURE0_ARB; extlist_ati_env_bump_unit[u] = TRUE; kprintf(1,"Bump unit %d",u); } return(TRUE); } else { return(FALSE); } */ return(FALSE); } PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI= NULL; PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI= NULL; PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI= NULL; PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI= NULL; PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI= NULL; PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI= NULL; PFNGLARRAYOBJECTATIPROC glArrayObjectATI= NULL; PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI= NULL; PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI= NULL; PFNGLVARIANTARRAYOBJECTATIPROC glVariantArrayObjectATI= NULL; PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI= NULL; PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI= NULL; bool gl_ext::gl_init_vertex_array_object(void) { if(is_extension("GL_ATI_vertex_array_object")) { glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC) SDL_GL_GetProcAddress("glNewObjectBufferATI"); glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC) SDL_GL_GetProcAddress("glIsObjectBufferATI"); glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC) SDL_GL_GetProcAddress("glUpdateObjectBufferATI"); glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC) SDL_GL_GetProcAddress("glGetObjectBufferfvATI"); glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC) SDL_GL_GetProcAddress("glGetObjectBufferivATI"); glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC) SDL_GL_GetProcAddress("glFreeObjectBufferATI"); glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC) SDL_GL_GetProcAddress("glArrayObjectATI"); glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC) SDL_GL_GetProcAddress("glGetArrayObjectfvATI"); glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC) SDL_GL_GetProcAddress("glGetArrayObjectivATI"); glVariantArrayObjectATI = (PFNGLVARIANTARRAYOBJECTATIPROC) SDL_GL_GetProcAddress("glVariantArrayObjectATI"); glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC) SDL_GL_GetProcAddress("glGetVariantArrayObjectfvATI"); glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC) SDL_GL_GetProcAddress("glGetVariantArrayObjectivATI"); return(TRUE); } else { return(FALSE); } } PFNGLELEMENTPOINTERATIPROC glElementPointerATI = NULL; PFNGLDRAWELEMENTARRAYATIPROC glDrawElementArrayATI = NULL; PFNGLDRAWRANGEELEMENTARRAYATIPROC glDrawRangeElementArrayATI = NULL; bool gl_ext::gl_init_element_array(void) { if(is_extension("GL_ATI_element_array")) { glElementPointerATI = (PFNGLELEMENTPOINTERATIPROC) SDL_GL_GetProcAddress("glElementPointerATI"); glDrawElementArrayATI = (PFNGLDRAWELEMENTARRAYATIPROC) SDL_GL_GetProcAddress("glDrawElementArrayATI"); glDrawRangeElementArrayATI = (PFNGLDRAWRANGEELEMENTARRAYATIPROC) SDL_GL_GetProcAddress("glDrawRangeElementArrayATI"); return(TRUE); } else { return(FALSE); } } PFNGLCOMBINERPARAMETERFVNVPROC glCombinerParameterfvNV = NULL; PFNGLCOMBINERPARAMETERFNVPROC glCombinerParameterfNV = NULL; PFNGLCOMBINERPARAMETERIVNVPROC glCombinerParameterivNV = NULL; PFNGLCOMBINERPARAMETERINVPROC glCombinerParameteriNV = NULL; PFNGLCOMBINERINPUTNVPROC glCombinerInputNV = NULL; PFNGLCOMBINEROUTPUTNVPROC glCombinerOutputNV = NULL; PFNGLFINALCOMBINERINPUTNVPROC glFinalCombinerInputNV = NULL; PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC glGetCombinerInputParameterfvNV = NULL; PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC glGetCombinerInputParameterivNV = NULL; PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC glGetCombinerOutputParameterfvNV = NULL; PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC glGetCombinerOutputParameterivNV = NULL; PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC glGetFinalCombinerInputParameterfvNV = NULL; PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC glGetFinalCombinerInputParameterivNV = NULL; bool gl_ext::gl_init_register_combiners(void) { if(is_extension("GL_NV_register_combiners")) { if(!(glCombinerParameterfvNV = (PFNGLCOMBINERPARAMETERFVNVPROC)SDL_GL_GetProcAddress("glCombinerParameterfvNV"))) return(FALSE); if(!(glCombinerParameterfNV = (PFNGLCOMBINERPARAMETERFNVPROC)SDL_GL_GetProcAddress("glCombinerParameterfNV"))) return(FALSE); if(!(glCombinerParameterivNV = (PFNGLCOMBINERPARAMETERIVNVPROC)SDL_GL_GetProcAddress("glCombinerParameterivNV"))) return(FALSE); if(!(glCombinerParameteriNV = (PFNGLCOMBINERPARAMETERINVPROC)SDL_GL_GetProcAddress("glCombinerParameteriNV"))) return(FALSE); if(!(glCombinerInputNV = (PFNGLCOMBINERINPUTNVPROC)SDL_GL_GetProcAddress("glCombinerInputNV"))) return(FALSE); if(!(glCombinerOutputNV = (PFNGLCOMBINEROUTPUTNVPROC)SDL_GL_GetProcAddress("glCombinerOutputNV"))) return(FALSE); if(!(glFinalCombinerInputNV = (PFNGLFINALCOMBINERINPUTNVPROC)SDL_GL_GetProcAddress("glFinalCombinerInputNV"))) return(FALSE); if(!(glGetCombinerInputParameterfvNV = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)SDL_GL_GetProcAddress("glGetCombinerInputParameterfvNV"))) return(FALSE); if(!(glGetCombinerInputParameterivNV = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)SDL_GL_GetProcAddress("glGetCombinerInputParameterivNV"))) return(FALSE); if(!(glGetCombinerOutputParameterfvNV = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)SDL_GL_GetProcAddress("glGetCombinerOutputParameterfvNV"))) return(FALSE); if(!(glGetCombinerOutputParameterivNV = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)SDL_GL_GetProcAddress("glGetCombinerOutputParameterivNV"))) return(FALSE); if(!(glGetFinalCombinerInputParameterfvNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)SDL_GL_GetProcAddress("glGetFinalCombinerInputParameterfvNV"))) return(FALSE); if(!(glGetFinalCombinerInputParameterivNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)SDL_GL_GetProcAddress("glGetFinalCombinerInputParameterivNV"))) return(FALSE); return(TRUE); } else { return(FALSE); } } PFNGLFLUSHVERTEXARRAYRANGENVPROC glFlushVertexArrayRangeNV = NULL; PFNGLVERTEXARRAYRANGENVPROC glVertexArrayRangeNV = NULL; bool gl_ext::gl_init_vertex_array_range(void) { if(is_extension("GL_NV_vertex_array_range")) { if(!(glFlushVertexArrayRangeNV = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)SDL_GL_GetProcAddress("glFlushVertexArrayRangeNV"))) return(FALSE); if(!(glVertexArrayRangeNV = (PFNGLVERTEXARRAYRANGENVPROC)SDL_GL_GetProcAddress("glVertexArrayRangeNV"))) return(FALSE); return(TRUE); } else { return(FALSE); } } PFNGLLOCKARRAYSEXTPROC glLockArraysEXT = NULL; PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT = NULL; bool gl_ext::gl_init_vertex_array_packed(void) { if(is_extension("GL_EXT_compiled_vertex_array")) { if(!(glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC)SDL_GL_GetProcAddress("glLockArraysEXT"))) return(FALSE); if(!(glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC)SDL_GL_GetProcAddress("glUnlockArraysEXT"))) return(FALSE); return(TRUE); } else { return(FALSE); } } PFNGLPNTRIANGLESIATIPROC glPNTrianglesiATI = NULL; PFNGLPNTRIANGLESFATIPROC glPNTrianglesfATI = NULL; bool gl_ext::gl_init_ati_pn_triangles(void) { if(is_extension("GL_ATI_pn_triangles")) { glPNTrianglesiATI = (PFNGLPNTRIANGLESIATIPROC) SDL_GL_GetProcAddress("glPNTrianglesiATI"); glPNTrianglesfATI = (PFNGLPNTRIANGLESFATIPROC) SDL_GL_GetProcAddress("glPNTrianglesfATI"); return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_text_filter_anisotropic(void) { if(is_extension("GL_EXT_texture_filter_anisotropic")) { return(TRUE); } else { return(FALSE); } } bool gl_ext::gl_init_ati_draw_buffers(void) { if(is_extension("GL_ATI_draw_buffers")) { return(TRUE); } else { return(FALSE); } } PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL; PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = NULL; PFNGLGENBUFFERSARBPROC glGenBuffersARB = NULL; PFNGLISBUFFERARBPROC glIsBufferARB = NULL; PFNGLBUFFERDATAARBPROC glBufferDataARB = NULL; PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB = NULL; PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB = NULL; PFNGLMAPBUFFERARBPROC glMapBufferARB = NULL; PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL; PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL; PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL; bool gl_ext::gl_init_arb_vertex_buffer(void) { if(is_extension("GL_ARB_vertex_buffer_object")) { if(!(glBindBufferARB = (PFNGLBINDBUFFERARBPROC)SDL_GL_GetProcAddress("glBindBufferARB"))) return(FALSE); if(!(glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)SDL_GL_GetProcAddress("glDeleteBuffersARB"))) return(FALSE); if(!(glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)SDL_GL_GetProcAddress("glGenBuffersARB"))) return(FALSE); if(!(glIsBufferARB = (PFNGLISBUFFERARBPROC)SDL_GL_GetProcAddress("glIsBufferARB"))) return(FALSE); if(!(glBufferDataARB = (PFNGLBUFFERDATAARBPROC)SDL_GL_GetProcAddress("glBufferDataARB"))) return(FALSE); if(!(glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)SDL_GL_GetProcAddress("glBufferSubDataARB"))) return(FALSE); if(!(glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)SDL_GL_GetProcAddress("glGetBufferSubDataARB"))) return(FALSE); if(!(glMapBufferARB = (PFNGLMAPBUFFERARBPROC)SDL_GL_GetProcAddress("glMapBufferARB"))) return(FALSE); if(!(glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)SDL_GL_GetProcAddress("glUnmapBufferARB"))) return(FALSE); if(!(glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)SDL_GL_GetProcAddress("glGetBufferParameterivARB"))) return(FALSE); if(!(glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)SDL_GL_GetProcAddress("glGetBufferPointervARB"))) return(FALSE); return(TRUE); } else { return(FALSE); } } void gl_ext::init_extension(void) { // Load all extensions load_extension(); // Mandatory extensions gl_init_secondary_color(); gl_init_multitexture(); // The optional ones extlist_blend_color = gl_init_blend_color(); extlist_blend_minmax = gl_init_blend_minmax(); extlist_fog_coord = gl_init_fog_coord(); extlist_fence = gl_init_fence(); extlist_register_combiners = gl_init_register_combiners(); extlist_text_compresion = gl_init_texture_compression(); extlist_text_sharp = gl_init_texture_lod(); extlist_text_edge_clamp = gl_init_text_edge_clamp(); extlist_text_env_combine = gl_init_text_env_combine(); extlist_text_filter_anisotropic = gl_init_text_filter_anisotropic(); extlist_clip_volume_hit = gl_init_clip_volume_hit(); extlist_vertex_array_range = gl_init_vertex_array_range(); extlist_vertex_array_packed = gl_init_vertex_array_packed(); extlist_ati_pn_triangles = gl_init_ati_pn_triangles(); extlist_ati_draw_buffers = gl_init_ati_draw_buffers(); extlist_arb_vertex_buffer = gl_init_arb_vertex_buffer(); if(!extlist_arb_vertex_buffer) { extlist_ati_vertex_array_object = gl_init_vertex_array_object(); extlist_ati_element_array = gl_init_element_array(); } extlist_text_env_dot3 = gl_init_text_env_dot3(); extlist_ati_env_bump = gl_init_ati_env_bump(); } /* * Load Extensions */ void gl_ext::load_extension(void) { const char *p_et; const char *p_start; char *_p_ext; char *p_pom; int i,j; p_vend = (char *)glGetString(GL_VENDOR); p_rend = (char *)glGetString(GL_RENDERER); p_ver = (char *)glGetString(GL_VERSION); p_et = (char *)glGetString(GL_EXTENSIONS); pprintf("OpenGL Vendor: %s",p_vend); pprintf("OpenGL Renderer: %s",p_rend); pprintf("OpenGL Version: %s",p_ver); _p_ext = (char *)mmalloc(sizeof(char)*(strlen(p_et)+1)); strcpy(_p_ext,p_et); j = strlen(_p_ext); extnum = 0; for(i = 0; i < j; i++) { if(_p_ext[i] == ' ') extnum++; } p_ext = (char **)mmalloc(sizeof(char *)*extnum); pprintf("\nAvailabile extensions:"); i = 0; p_start = _p_ext; while((p_pom = (char *)strchr(p_start,' '))) { *p_pom = 0; assert(i < extnum); p_ext[i] = (char *)mmalloc(sizeof(char)*(strlen(p_start)+5)); strcpy(p_ext[i],p_start); pprintf(p_ext[i]); i++; p_start = p_pom+1; } free(_p_ext); } /* Release extensions */ void gl_ext::free_extension(void) { int i; for(i = 0; i < extnum; i++) { if(p_ext[i]) { free(p_ext[i]); p_ext[i] = NULL; } } free(p_ext); } /* Test the extension */ bool gl_ext::is_extension(const char *p_text) { int i; for(i = 0; i < extnum; i++) { if(!strcmp(p_text,p_ext[i])) { return(TRUE); } } return(FALSE); } GL_EXT glext; berusky2-0.12/src/age/graph/object_world.h0000644000175000017500000000402713674426075015416 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Object world transformation */ #ifndef __OBJECT_WORLD_H__ #define __OBJECT_WORLD_H__ /* Object location in space */ typedef class object_world : public scene_object, public matrix_notified { GLMATRIX world_global; // Global (computed) world matrix public: GLMATRIX * world_global_get(void) { return(&world_global); } public: void world_set(GLMATRIX *p_world) { set(p_world); } GLMATRIX * world_get(void) { return(get()); } public: void object_world_hierarchy_update(bool forced = FALSE); public: object_world(class scene *p_scene) : scene_object(p_scene) { init(); world_global.init(); } } OBJECT_WORLD; #endif // __OBJECT_WORLD_H__ berusky2-0.12/src/age/graph/world_interface.h0000644000175000017500000000326713674426075016115 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* World matrix interface */ typedef class world_interface : public glmatrix { public: GLMATRIX * world_get(void) { return((GLMATRIX *)this); } void world_set(GLMATRIX *p_world) { *(GLMATRIX *)this = *p_world; } void world_init(void) { init(); } public: world_interface(void) { init(); } } WORLD_INTERFACE; berusky2-0.12/src/age/graph/aabb.cpp0000644000175000017500000002476013674426075014167 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* * Check visibility of this cube. */ /* * Is at least one point of this cube visible? */ bool aabb::visible(GLMATRIX *p_m) { int i,j,xplane,yplane,xa,ya,m; float x,y,z,xt,yt,zt,w,fx,fy,fw; // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for(i = 0, j = 0; i < AABB_BORDER_VERTEXNUM; i++) { xt = (i & 0x1) ? max.x : min.x; yt = (i & 0x2) ? max.y : min.y; zt = (i & 0x4) ? max.z : min.z; x = p_m->_11*xt + p_m->_21*yt + p_m->_31*zt + p_m->_41; y = p_m->_12*xt + p_m->_22*yt + p_m->_32*zt + p_m->_42; z = p_m->_13*xt + p_m->_23*yt + p_m->_33*zt + p_m->_43; w = p_m->_14*xt + p_m->_24*yt + p_m->_34*zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if(m) j++; // bod lezi v obrazovce -> automaticky uspech if(m && -w <= x && x <= w && -w <= y && y <= w) { return(TRUE); } fx = (float)fabs(x); fy = (float)fabs(y); fw = (float)fabs(w); if(fx/fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if(fy/fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; } // if(!j) // dbgprintf("j = 0"); return((j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } /* * Are all 8 points of the cube visible? */ bool aabb::visible_full(GLMATRIX *p_m) { int i,j,xplane,yplane,xa,ya,m; int hits = 0; float x,y,z,xt,yt,zt,w,fx,fy,fw; // ... // -> vyrobeni 8 hranicnich bodu krychle xplane = 0; // -2, -1, 1, 2 yplane = 0; // -2, -1, 1, 2 for(i = 0, j = 0; i < AABB_BORDER_VERTEXNUM; i++) { xt = (i & 0x1) ? max.x : min.x; yt = (i & 0x2) ? max.y : min.y; zt = (i & 0x4) ? max.z : min.z; x = p_m->_11*xt + p_m->_21*yt + p_m->_31*zt + p_m->_41; y = p_m->_12*xt + p_m->_22*yt + p_m->_32*zt + p_m->_42; z = p_m->_13*xt + p_m->_23*yt + p_m->_33*zt + p_m->_43; w = p_m->_14*xt + p_m->_24*yt + p_m->_34*zt + p_m->_44; // bod je pred kamerou m = (-w <= z && z <= w); if(m) j++; // bod lezi v obrazovce -> automaticky uspech if(m && -w <= x && x <= w && -w <= y && y <= w) { hits++; continue; } fx = (float)fabs(x); fy = (float)fabs(y); fw = (float)fabs(w); if(fx/fw > 1.0f) { xa = (x < 0.0f) ? -2 : 2; } else { xa = (x < 0.0f) ? -1 : 1; } if(fy/fw > 1.0f) { ya = (y < 0.0f) ? -2 : 2; } else { ya = (y < 0.0f) ? -1 : 1; } xplane += xa; yplane += ya; } // if(!j) // dbgprintf("j = 0"); return((hits == AABB_BORDER_VERTEXNUM) ? hits : (j > 0) ? ((abs(xplane) != 16) && (abs(yplane) != 16)) : FALSE); } void aabb::draw(GLMATRIX *p_m, RGBB color) { VECT3DF center,points[AABB_BORDER_VERTEXNUM*6]; float dx, dy, dz; int i; center = max - min; center *= 0.05f; min -= center; max -= center; dx = max.x - min.x, dy = max.y - min.y, dz = max.z - min.z; dx *= 0.3f; dy *= 0.3f; dz *= 0.3f; points[(0*6)].set(min.x ,min.y ,min.z); points[(0*6+1)].set(min.x+dx,min.y ,min.z); points[(0*6+2)].set(min.x ,min.y ,min.z); points[(0*6+3)].set(min.x ,min.y+dy,min.z); points[(0*6+4)].set(min.x ,min.y ,min.z); points[(0*6+5)].set(min.x ,min.y ,min.z+dz); points[(1*6)].set(max.x ,min.y ,min.z); points[(1*6+1)].set(max.x-dx,min.y ,min.z); points[(1*6+2)].set(max.x ,min.y ,min.z); points[(1*6+3)].set(max.x ,min.y+dy,min.z); points[(1*6+4)].set(max.x ,min.y ,min.z); points[(1*6+5)].set(max.x ,min.y ,min.z+dz); points[(2*6)].set(min.x ,min.y ,max.z); points[(2*6+1)].set(min.x+dx,min.y ,max.z); points[(2*6+2)].set(min.x ,min.y ,max.z); points[(2*6+3)].set(min.x ,min.y+dy,max.z); points[(2*6+4)].set(min.x ,min.y ,max.z); points[(2*6+5)].set(min.x ,min.y ,max.z-dz); points[(3*6)].set( max.x ,min.y ,max.z); points[(3*6+1)].set(max.x-dx,min.y ,max.z); points[(3*6+2)].set(max.x ,min.y ,max.z); points[(3*6+3)].set(max.x ,min.y+dy,max.z); points[(3*6+4)].set(max.x ,min.y ,max.z); points[(3*6+5)].set(max.x ,min.y ,max.z-dz); points[(4*6)].set(min.x ,max.y ,min.z); points[(4*6+1)].set(min.x+dx,max.y ,min.z); points[(4*6+2)].set(min.x ,max.y ,min.z); points[(4*6+3)].set(min.x ,max.y-dy,min.z); points[(4*6+4)].set(min.x ,max.y ,min.z); points[(4*6+5)].set(min.x ,max.y ,min.z+dz); points[(5*6)].set( max.x ,max.y ,min.z); points[(5*6+1)].set(max.x-dx,max.y ,min.z); points[(5*6+2)].set(max.x ,max.y ,min.z); points[(5*6+3)].set(max.x ,max.y-dy,min.z); points[(5*6+4)].set(max.x ,max.y ,min.z); points[(5*6+5)].set(max.x ,max.y ,min.z+dz); points[(6*6)].set( min.x ,max.y ,max.z); points[(6*6+1)].set(min.x+dx,max.y ,max.z); points[(6*6+2)].set(min.x ,max.y ,max.z); points[(6*6+3)].set(min.x ,max.y-dy,max.z); points[(6*6+4)].set(min.x ,max.y ,max.z); points[(6*6+5)].set(min.x ,max.y ,max.z-dz); points[(7*6)].set(max.x ,max.y ,max.z); points[(7*6+1)].set(max.x-dx,max.y ,max.z); points[(7*6+2)].set(max.x ,max.y ,max.z); points[(7*6+3)].set(max.x ,max.y-dy,max.z); points[(7*6+4)].set(max.x ,max.y ,max.z); points[(7*6+5)].set(max.x ,max.y ,max.z-dz); if(p_m) { for(i = 0; i < AABB_BORDER_VERTEXNUM*6; i++) { matrix_transformate(points+i,p_m); } } glColor3ub(color.r,color.g,color.b); glBegin(GL_LINES); for(i = 0; i < AABB_BORDER_VERTEXNUM*6; i++) glVertex3fv((const float *)(points+i)); glEnd(); } VECT * aabb::border_get(VECT *p_border) { int i; for(i = 0; i < AABB_BORDER_VERTEXNUM; i++) { p_border[i].x = (i & 0x1) ? max.x : min.x; p_border[i].y = (i & 0x2) ? max.y : min.y; p_border[i].z = (i & 0x4) ? max.z : min.z; } return(p_border); } //Intersection with line a->b int aabb::intersect_vector(VECT *p_a, VECT *p_b, VECT *p_intersect, float *p_t) { // line a->b float tn = 0.0f,tf = FLT_MAX; float t1,t2,t; VECT Q; if(inside(p_a)) { *p_intersect = *p_a; *p_t = 0.0f; return(inside(p_b) ? 2 : 1); } // p_a->p_b Q = *p_b - *p_a; // X t1 = max.x-p_a->x; // default Tf t2 = min.x-p_a->x; // default Tn if(Q.x < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/Q.x,tn); tf = MIN(t1/Q.x,tf); if(tn > tf || tf < 0.0f) return(FALSE); // Y t1 = max.y-p_a->y; // default Tf t2 = min.y-p_a->y; // default Tn if(Q.y < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/Q.y,tn); tf = MIN(t1/Q.y,tf); if(tn > tf || tf < 0.0f) return(FALSE); // Z t1 = max.z-p_a->z; // default Tf t2 = min.z-p_a->z; // default Tn if(Q.z < 0.0f) { t = t1; t1 = t2; t2 = t; } tn = MAX(t2/Q.z,tn); tf = MIN(t1/Q.z,tf); if(tn > tf || tf < 0.0f) return(FALSE); if(p_t) { *p_t = tn; } if(p_intersect) { p_intersect->x = p_a->x+Q.x*tn; p_intersect->y = p_a->y+Q.y*tn; p_intersect->z = p_a->z+Q.z*tn; } return(3); } bool aabb::intersect(aabb *p_box) { return(min.x < p_box->max.x && max.x > p_box->min.x && min.y < p_box->max.y && max.y > p_box->min.y && min.z < p_box->max.z && max.z > p_box->min.z); } bool aabb::intersect(BOX *p_box) { switch(p_box->box_type_get()) { case BOX_AABB: { // AABB x AABB intersection return(intersect((AABB *)p_box)); } case BOX_OBB: { // AABB x OBB intersection OBB tmp((AABB *)this); return(obb::intersect(&tmp, (OBB *)p_box)); } break; default: return(FALSE); } } // diffrence between point and plane float aabb::intersect_plane(VECT *p_a, PLANE_TYPE type) { float v1,v2; if(type == PLANE_X) { if(p_a->x >= min.x && p_a->x <= max.x) { return(0.0f); } else { v1 = (float)fabs(p_a->x-min.x); v2 = (float)fabs(p_a->x-max.x); return(v1 < v2 ? v1 : v2); } } else if(type == PLANE_Y) { if(p_a->y >= min.y && p_a->y <= max.y) { return(0.0f); } else { v1 = (float)fabs(p_a->y-min.y); v2 = (float)fabs(p_a->y-max.y); return(v1 < v2 ? v1 : v2); } } else if(type == PLANE_Z) { if(p_a->z >= min.z && p_a->z <= max.z) { return(0.0f); } else { v1 = (float)fabs(p_a->z-min.z); v2 = (float)fabs(p_a->z-max.z); return(v1 < v2 ? v1 : v2); } } return(FLT_MAX); } // diffrence between point and the cube void aabb::intersect_point(VECT *p_vec) { if(min.x > p_vec->x) p_vec->x = min.x; else { if(max.x < p_vec->x) p_vec->x = max.x; } if(min.y > p_vec->y) p_vec->y = min.y; else { if(max.y < p_vec->y) p_vec->y = max.y; } if(min.z > p_vec->z) p_vec->z = min.z; else { if(max.z < p_vec->z) p_vec->z = max.z; } } // Convert AABB to OBB AABB * aabb::to_aabb(AABB *p_dest) { *p_dest = *this; return(p_dest); } OBB * aabb::to_obb(OBB *p_dest) { center_get(&p_dest->center); length_get(&p_dest->len); p_dest->dir[0].set(1,0,0); p_dest->dir[1].set(0,1,0); p_dest->dir[2].set(0,0,1); return(p_dest); } void aabb::set(class box *p_src) { p_src->to_aabb(this); } aabb::aabb(class box *p_src) { set(p_src); } berusky2-0.12/src/age/graph/matrix_notified.cpp0000644000175000017500000000246513674426075016465 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/texture_func.h0000644000175000017500000000571313674426075015457 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* State-bloky pro textury */ #ifndef __TEXTURE_FUNC_H__ #define __TEXTURE_FUNC_H__ /* *************************************************************************** Popis editacni funkce *************************************************************************** */ /* typedef struct _GAME_TEXT_BLOK { char name[MAX_NAME]; // jmeno bloku int funkce; // michaci funkce int edit_funkce; // editacni funkce (-1 pro default) int textur; // pocet porebnych textur 1 (2,3,4 po trebuji extra dialog) int delka; // delka bloku (pocet textur) int textury_typ[MAX_GL_TEXT_UNITS]; // pozadovany typ textur pro dany efekt int text_funkce[MAX_GL_TEXT_UNITS]; // pozadovany typ textur pro dany efekt } GAME_TEXT_BLOK; */ //#define MAX_STAGE_TEXT_FUNC 9 //#define MAX_STAGE_TEXT_BLOK 9 //static GAME_TEXT_BLOK st_blok[MAX_STAGE_TEXT_BLOK]; // Tabulka funkci pro editor /* *************************************************************************** Textury + Parametry + Funkce v materialu *************************************************************************** */ /* Define pro stage_funkce */ /* #define DOT3_BUMP 0 #define DOT3_TEXT 1 #define DOT3_ENV 2 #define DUDV_BUMP 0 // normalova mapa #define DUDV_ENV 1 // Environment-mapa #define DUDV_TEXT 2 // zakladni textura */ /* Automaticky nahrazovani */ /* #define AUTO_BUMP_DOT3 5 // dot3 color blok #define AUTO_BUMP_DOT3ENV 6 // dot3 env blok */ #endif // __TEXTURE_FUNC_H__ berusky2-0.12/src/age/graph/vector_operators.h0000644000175000017500000007740213674426075016350 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __VECTOR_OPERATORS_H__ #define __VECTOR_OPERATORS_H__ /*-------------------------------------------------------------------------- Vector operators -------------------------------------------------------------------------- */ #define OPERATORS3D(type,type_scalar) \ \ void set(type_scalar value = 0) \ { \ x = value; \ y = value; \ z = value; \ } \ void set(type_scalar vx, type_scalar vy, type_scalar vz) \ { \ x = vx; \ y = vy; \ z = vz; \ } \ void set(type & src) \ { \ *this = src; \ } \ void set(type *p_src) \ { \ *this = *p_src; \ } \ void operator+=(type & src) \ { \ x += src.x; \ y += src.y; \ z += src.z; \ } \ void operator+=(type_scalar src) \ { \ x += src; \ y += src; \ z += src; \ } \ void operator-=(type & src) \ { \ x -= src.x; \ y -= src.y; \ z -= src.z; \ } \ void operator-=(type_scalar src) \ { \ x -= src; \ y -= src; \ z -= src; \ } \ void operator*=(type & src) \ { \ x *= src.x; \ y *= src.y; \ z *= src.z; \ } \ void operator*=(type_scalar src) \ { \ x *= src; \ y *= src; \ z *= src; \ } \ void operator/=(type & src) \ { \ x /= src.x; \ y /= src.y; \ z /= src.z; \ } \ type operator/(type & src) \ { \ type tmp; \ tmp.x = x/src.x; \ tmp.y = y/src.y; \ tmp.z = z/src.z; \ return(tmp); \ } \ void operator/=(type_scalar src) \ { \ x /= src; \ y /= src; \ z /= src; \ } \ type operator/(type_scalar src) \ { \ type tmp; \ tmp.x = x/src; \ tmp.y = y/src; \ tmp.z = z/src; \ return(tmp); \ } \ bool operator==(type & src) \ { \ return(x == src.x && y == src.y && z == src.z); \ } \ type_scalar dot_product(type & src) \ { \ return(x*src.x+y*src.y+z*src.z); \ } \ float size(void) \ { \ float dis = x*x+y*y+z*z; \ if(dis > 0) \ return(sqrtf(dis)); \ else \ return(0); \ } \ float norm(type_scalar new_size = 1) \ { \ float vel2,vel = size(); \ if(vel == 0) \ return(0); \ else { \ vel2 = new_size/vel; \ x = (type_scalar)(x * vel2); \ y = (type_scalar)(y * vel2); \ z = (type_scalar)(z * vel2); \ return(vel); \ } \ } \ void invert(void) \ { \ x = -x; \ y = -y; \ z = -z; \ } \ void vect_mult(type & v) \ { \ type c; \ c.x = y*v.z - z*v.y; \ c.y = z*v.x - x*v.z; \ c.z = x*v.y - y*v.x; \ *this = c; \ } \ void vect_mult(float s) \ { \ x *= s; \ y *= s; \ z *= s; \ } \ bool zero(void) \ { \ return(x*x+y*y+z*z == 0); \ } \ void rotate_x(float angle) \ { \ float tz = (float)z; \ float ty = (float)y; \ \ float cosa = cosf(angle); \ float sina = sinf(angle); \ \ z = (type_scalar)(tz*cosa - ty*sina); \ y = (type_scalar)(tz*sina + ty*cosa); \ } \ void rotate_y(float angle) \ { \ float tx = (float)x; \ float tz = (float)z; \ \ float cosa = cosf(angle); \ float sina = sinf(angle); \ \ x = (type_scalar)(tx*cosa - tz*sina); \ z = (type_scalar)(tx*sina + tz*cosa); \ } \ void rotate_z(float angle) \ { \ float tx = (float)x; \ float ty = (float)y; \ \ float cosa = cosf(angle); \ float sina = sinf(angle); \ \ x = (type_scalar)(tx*cosa - ty*sina); \ y = (type_scalar)(tx*sina + ty*cosa); \ } \ #define METHODS3D(type,type_scalar) \ \ inline type_scalar vect_dot_product(type & src1, type & src2) \ { \ return(src1.x*src2.x+src1.y*src2.y+src1.z*src2.z); \ } \ inline type_scalar vect_dot_product(type *src1, type *src2) \ { \ return(src1->x*src2->x+src1->y*src2->y+src1->z*src2->z); \ } \ inline float vect_size(type_scalar x, type_scalar y, type_scalar z) \ { \ float dis = (x)*(x)+(y)*(y)+(z)*(z); \ if(dis > 0) \ return(sqrtf(dis)); \ else \ return(0); \ } \ inline float vect_norm(type_scalar *p_x, type_scalar *p_y, type_scalar *p_z) \ { \ float vel2,vel = vect_size(*p_x,*p_y,*p_z); \ if(vel == 0) \ return(0.0f); \ else { \ vel2 = 1.0f/vel; \ *p_x = (type_scalar)((*p_x)*vel2); \ *p_y = (type_scalar)((*p_y)*vel2); \ *p_z = (type_scalar)((*p_z)*vel2); \ return(vel); \ } \ } \ inline type vect_mult(type &u, type &v) \ { \ type c; \ c.x = u.y*v.z - u.z*v.y; \ c.y = u.z*v.x - u.x*v.z; \ c.z = u.x*v.y - u.y*v.x; \ return(c); \ } \ inline type * vect_mult(type *u, type *v, type *c) \ { \ c->x = u->y*v->z - u->z*v->y; \ c->y = u->z*v->x - u->x*v->z; \ c->z = u->x*v->y - u->y*v->x; \ return(c); \ } \ inline float point_dist(type a, type b) \ { \ float v = (b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y)+(b.z-a.z)*(b.z-a.z); \ return((v > 0.0f) ? (float)sqrtf(v) : v); \ } \ inline float point_dist(type *a, type *b) \ { \ float v = (b->x-a->x)*(b->x-a->x)+(b->y-a->y)*(b->y-a->y)+(b->z-a->z)*(b->z-a->z); \ return((v > 0.0f) ? (float)sqrtf(v) : v); \ } \ inline type interpolate(type src1, type src2, float i) \ { \ type tmp; \ float i2 = 1.0f-i; \ tmp.x = (type_scalar)(src1.x*i+src2.x*i2); \ tmp.y = (type_scalar)(src1.y*i+src2.y*i2); \ tmp.z = (type_scalar)(src1.z*i+src2.z*i2); \ return(tmp); \ } \ inline type operator+(type & src1, type & src2) \ { \ type tmp; \ tmp.x = src1.x+src2.x; \ tmp.y = src1.y+src2.y; \ tmp.z = src1.z+src2.z; \ return(tmp); \ } \ inline type operator+(type & src1, type_scalar src2)\ { \ type tmp; \ tmp.x = src1.x+src2; \ tmp.y = src1.y+src2; \ tmp.z = src1.z+src2; \ return(tmp); \ } \ inline type operator-(type & src1, type & src2) \ { \ type tmp; \ tmp.x = src1.x-src2.x; \ tmp.y = src1.y-src2.y; \ tmp.z = src1.z-src2.z; \ return(tmp); \ } \ inline type operator-(type & src1, type_scalar src2)\ { \ type tmp; \ tmp.x = src1.x-src2; \ tmp.y = src1.y-src2; \ tmp.z = src1.z-src2; \ return(tmp); \ } \ inline type operator*(type & src1, type & src2) \ { \ type tmp; \ tmp.x = src1.x*src2.x; \ tmp.y = src1.y*src2.y; \ tmp.z = src1.z*src2.z; \ return(tmp); \ } \ inline type operator*(type & src1, type_scalar src2)\ { \ type tmp; \ tmp.x = src1.x*src2; \ tmp.y = src1.y*src2; \ tmp.z = src1.z*src2; \ return(tmp); \ } \ #define OPERATORS2D(type,type_scalar) \ \ void set(type_scalar value = 0) \ { \ x = value; \ y = value; \ } \ void set(type_scalar vx, type_scalar vy) \ { \ x = vx; \ y = vy; \ } \ void set(type & src) \ { \ *this = src; \ } \ void set(type *p_src) \ { \ *this = *p_src; \ } \ void operator+=(type & src) \ { \ x += src.x; \ y += src.y; \ } \ void operator+=(type_scalar src) \ { \ x += src; \ y += src; \ } \ void operator-=(type & src) \ { \ x -= src.x; \ y -= src.y; \ } \ void operator-=(type_scalar src) \ { \ x -= src; \ y -= src; \ } \ type operator-(void) \ { \ type tmp; \ tmp.x = -x; \ tmp.y = -y; \ return(tmp); \ } \ void operator*=(type & src) \ { \ x *= src.x; \ y *= src.y; \ } \ void operator*=(type_scalar src) \ { \ x *= src; \ y *= src; \ } \ void operator/=(type & src) \ { \ x /= src.x; \ y /= src.y; \ } \ type operator/(type & src) \ { \ type tmp; \ tmp.x = x/src.x; \ tmp.y = y/src.y; \ return(tmp); \ } \ void operator/=(type_scalar src) \ { \ x /= src; \ y /= src; \ } \ type operator/(type_scalar src) \ { \ type tmp; \ tmp.x = x/src; \ tmp.y = y/src; \ return(tmp); \ } \ bool operator==(type & src) \ { \ return(x == src.x && y == src.y); \ } \ type_scalar dot_product(type & src) \ { \ return(x*src.x+y*src.y); \ } \ float size(void) \ { \ float dis = x*x+y*y; \ if(dis > 0.0f) \ return(sqrtf(dis)); \ else \ return(0.0f); \ } \ float norm(type_scalar new_size = 1) \ { \ float vel2, vel = size(); \ if(vel == 0.0f) \ return(0.0f); \ else { \ vel2 = (float)new_size/vel; \ x = (type_scalar)(x * vel2); \ y = (type_scalar)(y * vel2); \ return(vel); \ } \ } \ void invert(void) \ { \ x = -x; \ y = -y; \ } \ void swap(void) \ { \ type_scalar t = x; \ x = y; \ y = t; \ } \ type_scalar vect_mult(type & v) \ { \ return(x*v.y - v.x*y); \ } \ void rotate(float angle) \ { \ float tx = (float)x; \ float ty = (float)y; \ \ float cosa = cosf(angle); \ float sina = sinf(angle); \ \ x = (type_scalar)(tx*cosa - ty*sina); \ y = (type_scalar)(tx*sina + ty*cosa); \ } \ bool zero(void) \ { \ return(x*x+y*y == 0); \ } \ #define METHODS2D(type,type_scalar) \ \ inline type_scalar vect_dot_product(type & src1, type & src2) \ { \ return(src1.x*src2.x+src1.y*src2.y); \ } \ inline type_scalar vect_dot_product(type *src1, type *src2) \ { \ return(src1->x*src2->x+src1->y*src2->y); \ } \ inline float vect_size(type_scalar x, type_scalar y) \ { \ float dis = (x)*(x)+(y)*(y); \ if(dis > 0) \ return(sqrtf(dis)); \ else \ return(0); \ } \ inline float vect_norm(type_scalar *p_x, type_scalar *p_y) \ { \ float vel2,vel = vect_size(*p_x,*p_y); \ if(vel == 0) \ return(0.0f); \ else { \ vel2 = 1.0f/vel; \ *p_x = (type_scalar)((*p_x)*vel2); \ *p_y = (type_scalar)((*p_y)*vel2); \ return(vel); \ } \ } \ inline type_scalar vect_mult(type &u, type &v) \ { \ return(u.x*v.y - v.x*u.y); \ } \ inline type_scalar vect_mult(type *u, type *v) \ { \ return(u->x*v->y - v->x*u->y); \ } \ inline float point_dist(type a, type b) \ { \ float v = (b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y); \ return((v > 0.0f) ? (float)sqrtf(v) : v); \ } \ inline float point_dist(type *a, type *b) \ { \ float v = (b->x-a->x)*(b->x-a->x)+(b->y-a->y)*(b->y-a->y); \ return((v > 0.0f) ? (float)sqrtf(v) : v); \ } \ inline type operator+(type src1, type src2) \ { \ type tmp; \ tmp.x = src1.x+src2.x; \ tmp.y = src1.y+src2.y; \ return(tmp); \ } \ inline type operator+(type src1, type_scalar src2) \ { \ type tmp; \ tmp.x = src1.x+src2; \ tmp.y = src1.y+src2; \ return(tmp); \ } \ inline type operator-(type src1, type src2) \ { \ type tmp; \ tmp.x = src1.x-src2.x; \ tmp.y = src1.y-src2.y; \ return(tmp); \ } \ inline type operator*(type src1, type src2) \ { \ type tmp; \ tmp.x = src1.x*src2.x; \ tmp.y = src1.y*src2.y; \ return(tmp); \ } \ inline type operator*(type src1, type_scalar src2) \ { \ type tmp; \ tmp.x = src1.x*src2; \ tmp.y = src1.y*src2; \ return(tmp); \ } \ inline type interpolate(type src1, type src2, float i) \ { \ type tmp; \ float i2 = 1.0f-i; \ tmp.x = (type_scalar)(src1.x*i+src2.x*i2); \ tmp.y = (type_scalar)(src1.y*i+src2.y*i2); \ return(tmp); \ } \ inline type interpolate(type src1, type src2, float i1, float i2) \ { \ type tmp; \ float i11 = 1.0f-i1; \ float i22 = 1.0f-i2; \ tmp.x = (type_scalar)(src1.x*i1+src2.x*i11); \ tmp.y = (type_scalar)(src1.y*i2+src2.y*i22); \ return(tmp); \ } \ inline float line_dist(type a, type b, type p) \ { \ float lenght = point_dist(a,b); \ float t = ((b.x - a.x)*(p.x-a.x)+(b.y - a.y)*(p.y-a.y))/(lenght*lenght); \ return(t); \ } \ inline bool line_dist(type a, type b, type p, float &t, float &dist) \ { \ float lenght = point_dist(a,b); \ t = ((b.x - a.x)*(p.x - a.x)+(b.y - a.y)*(p.y - a.y))/(lenght*lenght); \ dist = fabs((b.x - a.x)*(p.y-a.y)-(b.y - a.y)*(p.x-a.x))/lenght; \ return(t >= 0 || t <= 1.0f); \ } \ inline bool line_dist(type a, type b, type p, type &in, float &t, float &dist) \ { \ float lenght = point_dist(a,b); \ t = ((b.x - a.x)*(p.x - a.x)+(b.y - a.y)*(p.y - a.y))/(lenght*lenght); \ dist = fabs((b.x - a.x)*(p.y-a.y)-(b.y - a.y)*(p.x-a.x))/lenght; \ in.x = (b.x - a.x)*t; \ in.y = (b.y - a.y)*t; \ return(t >= 0 || t <= 1.0f); \ } /*-------------------------------------------------------------------------- Other functions -------------------------------------------------------------------------- */ #define MATH_HELPERS(type_scalar) \ \ inline type_scalar interpolate(type_scalar v1, type_scalar v2, float t) \ { \ return(v1*(1-t) + v2*t); \ } \ inline type_scalar interpolate_cos(type_scalar v1, type_scalar v2, float t) \ { \ float f = (1.0f - cosf(t*PI))*0.5f; \ return(v1*(1-f) + v2*f); \ } #endif //__VECTOR_OPERATORS_H__ berusky2-0.12/src/age/graph/quat.h0000644000175000017500000002216313674426075013714 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Quaternions class */ #ifndef __QUAT_H__ #define __QUAT_H__ #define DELTA 0.0001f #define ZERO_QUAT {0.0f,0.0f,0.0f,1.0f} typedef class quat : public vect3df { public: float w; public: void zero(void) { x = 0; y = 0; z = 0; w = 0; } void init(void) { x = 0; y = 0; z = 0; w = 1; } float size(void) { return((float)sqrt(x*x + y*y + z*z + w*w)); } quat * norm(void) { float dl = 1.0f / size(); if(dl > 0.0001) { x *= dl; y *= dl; z *= dl; w *= dl; } return(this); } quat * inverse(void) { x = -x; y = -y; z = -z; return(this); } quat * negative(void) { x = -x; y = -y; z = -z; w = -w; return(this); } void get_angle(VECT *p_o, float *p_angle) { *p_angle = (float)(2.0f*acos(w)); if(*p_angle < DELTA) { p_o->x = p_o->y = p_o->z = 0.0f; } else { *p_o = *this * (float)(1.0f/sin(*p_angle/2.0f)); } } void get_angle(quat *p_v) { float c; p_v->w = (float)(2.0f*acos(w)); c = sinf(p_v->w/2.0f); c = (c > DELTA) ? 1.0f/c : 0.0f; *(VECT *)p_v = *this * c; p_v->inverse(); } quat * mult(float scalar) { x = x*scalar; y = y*scalar; z = z*scalar; w = w*scalar; return(this); } quat * add(quat *p_q1) { x += p_q1->x; y += p_q1->y; z += p_q1->z; w += p_q1->w; return(this); } void to_euler(float *p_r, float *p_fi) { float p1 = 2*y*z - 2*w*x, p2 = 2*x*z - 2*w*y, p3; p3 = -asinf((fabsf(p1) > 1.0f) ? copysignf(1,p1) : p1); *p_fi = (fabsf(w) < fabsf(x)) ? copysignf(DEG2RAD(180.0f)-fabsf(p3),p3) : p3; p3 = asinf((fabsf(p2) > 1.0f) ? copysignf(1,p2) : p2); *p_r = (fabsf(w) < fabsf(y)) ? copysignf(DEG2RAD(180.0f)-fabsf(p3),p3) : p3; } static float dot_product(quat *p_q1, quat *p_q2) { return(p_q1->x*p_q2->x + p_q1->y*p_q2->y + p_q1->z*p_q2->z + p_q1->w*p_q2->w); } static quat * add(quat *p_q1, quat *p_q2, quat *p_qv) { p_qv->x = p_q1->x+p_q2->x; p_qv->y = p_q1->y+p_q2->y; p_qv->z = p_q1->z+p_q2->z; p_qv->w = p_q1->w+p_q2->w; return(p_qv); } static quat * sub(quat *p_q1, quat *p_q2, quat *p_qv) { p_qv->x = p_q1->x-p_q2->x; p_qv->y = p_q1->y-p_q2->y; p_qv->z = p_q1->z-p_q2->z; p_qv->w = p_q1->w-p_q2->w; return(p_qv); } /* q1 x q2 = [s1,v1] x [s2,v2] = [(s1*s2 - v1*v2),(s1*v2 + s2*v1 + v1xv2)]. */ static quat * mult(quat *p_q1, quat *p_q2, quat *p_qv) { p_qv->w = p_q1->w*p_q2->w - vect_dot_product(*p_q1,*p_q2); quat q1 = *p_q2; quat q2 = *p_q1; q1.vect_mult(p_q1->w); q2.vect_mult(p_q2->w); ::vect_mult(p_q1,p_q2,p_qv); *(VECT *)p_qv += q1; *(VECT *)p_qv += q2; return(p_qv); } quat * mult(quat *p_q1, quat *p_q2) { return(mult(p_q1, p_q2, this)); } static quat * mult(quat *p_q1, float scalar, quat *p_qv) { p_qv->x = p_q1->x*scalar; p_qv->y = p_q1->y*scalar; p_qv->z = p_q1->z*scalar; p_qv->w = p_q1->w*scalar; return(p_qv); } // Spherical Linear intERPolation // by Carmack & spol. static quat * slerp(quat *p_q1, quat *p_q2, float t, quat *p_qv) { float cosin; float a; float sina; float u1; float u2; quat qp,qm; if(t == 0.0f) return(*p_qv = *p_q1,p_qv); if(t == 1.0f) return(*p_qv = *p_q2,p_qv); sub(p_q1,p_q2,&qm); add(p_q1,p_q2,&qp); //(q1-q2)*(q1-q2)>(q1+q2)*(q1+q2) -> false -> prehodit to if(quat::dot_product(&qm,&qm) >= quat::dot_product(&qp,&qp)) { p_q2->negative(); } cosin = quat::dot_product(p_q1,p_q2); if((1.0f+cosin) > DELTA) { // angle je mensi nez 90 stupnu if ((1.0f-cosin) > DELTA) { // angle je vetsi nez delta a = acosf(cosin); sina = sinf(a); u1 = sinf((1.0f - t)*a)/sina; u2 = sinf(t*a)/sina; } else { // angle je mensi u1 = 1.0f - t; u2 = t; } quat::mult(p_q1, u1, p_qv); quat::mult(p_q2, u2, &qp); return(p_qv->add(&qp)); } else { // vetsi nez 90 stupnu qp.x =-p_q1->y; qp.y = p_q1->x; qp.z =-p_q1->w; qp.w = p_q1->z; u1 = sinf((1.0f - t)*0.5f*PI); u2 = sinf(t*0.5f*PI); quat::mult(p_q1,u1, p_qv); quat::mult(&qp, u2, &qm); return(p_qv->add(&qm)); } } public: quat(void) {}; quat(VECT *p_o, float angle) { float size = sqrtf(p_o->x*p_o->x + p_o->y*p_o->y + p_o->z*p_o->z); if(size > DELTA) { size = 1.0f/size; x = p_o->x*size; y = p_o->y*size; z = p_o->z*size; } angle *= 0.5f; w = (float)cos(angle); *this *= sinf(angle); norm(); } quat(float x, float y, float z, float angle) { VECT v(x,y,z); quat(&v,angle); } quat(float r, float fi) { VECT o1,o2; if(r > 0.0f) o1.y = -1.0f; else { r = -r; o1.y = 1.0f; } o1.z = 0.0f; o1.x = 0.0f; if(fi > 0.0f) o2.x = 1.0f; else { fi = -fi; o2.x = -1.0f; } o2.y = 0.0f; o2.z = 0.0f; quat q1(&o1,r),q2(&o2,fi); mult(&q1,&q2); } } QUAT; /*-------------------------------------------------------------------------- Quaternion functions -------------------------------------------------------------------------- */ inline float quat_dot_product(QUAT *p_q1, QUAT *p_q2) { return(p_q1->x*p_q2->x + p_q1->y*p_q2->y + p_q1->z*p_q2->z + p_q1->w*p_q2->w); } inline float quat_length(QUAT *p_v) { return((float)sqrt(p_v->x*p_v->x + p_v->y*p_v->y + p_v->z*p_v->z + p_v->w*p_v->w)); } inline QUAT * quat_norm(QUAT *p_v) { return(p_v->norm()); } inline QUAT * quat_inverse(QUAT *p_v) { p_v->x = -p_v->x; p_v->y = -p_v->y; p_v->z = -p_v->z; return(p_v); } inline QUAT * quat_add(QUAT *p_q1, QUAT *p_q2, QUAT *p_qv) { p_qv->x = p_q1->x+p_q2->x; p_qv->y = p_q1->y+p_q2->y; p_qv->z = p_q1->z+p_q2->z; p_qv->w = p_q1->w+p_q2->w; return(p_qv); } inline QUAT * quat_sub(QUAT *p_q1, QUAT *p_q2, QUAT *p_qv) { p_qv->x = p_q1->x-p_q2->x; p_qv->y = p_q1->y-p_q2->y; p_qv->z = p_q1->z-p_q2->z; p_qv->w = p_q1->w-p_q2->w; return(p_qv); } inline QUAT * quat_negative(QUAT *p_q) { p_q->x = -p_q->x; p_q->y = -p_q->y; p_q->z = -p_q->z; p_q->w = -p_q->w; return(p_q); } inline void quat_to_euler(QUAT *p_q, float *p_r, float *p_fi) { p_q->to_euler(p_r,p_fi); } /* q1 x q2 = [s1,v1] x [s2,v2] = [(s1*s2 - v1*v2),(s1*v2 + s2*v1 + v1xv2)]. */ inline QUAT * quat_mult(QUAT *p_q1, QUAT *p_q2, QUAT *p_qv) { return(p_qv->mult(p_q1,p_q2)); } /* Scale quaternion by a scalar */ inline QUAT * quat_mult_scalar(QUAT *p_q1, float scalar, QUAT *p_qv) { p_qv->x = p_q1->x*scalar; p_qv->y = p_q1->y*scalar; p_qv->z = p_q1->z*scalar; p_qv->w = p_q1->w*scalar; return(p_qv); } /* Spherical Linear intERPolation by Carmack & spol. */ inline QUAT * slerp(QUAT *p_q1, QUAT *p_q2, float t, QUAT *p_qv) { return(quat::slerp(p_q1,p_q2,t,p_qv)); } // quat -> angle inline QUAT * quat_to_angle(QUAT *p_q, VECT *p_o, float *p_angle) { *p_angle = (float)(2.0f*acos(p_q->w)); if(*p_angle < DELTA) { p_o->x = p_o->y = p_o->z = 0.0f; } else { *p_o = *p_q; *p_o *= (float)(1.0f/sin(*p_angle/2.0f)); } return(p_q); } // quat -> angle inline QUAT * quat_to_quat_angle(QUAT *p_q, QUAT *p_v) { float c; p_v->w = (float)(2.0f*acos(p_q->w)); c = sinf(p_v->w/2.0f); c = (c > DELTA) ? 1.0f/c : 0.0f; *(VECT *)p_v = *(VECT *)p_q * c; return(quat_inverse(p_v)); } /* Slepi 2 uhly do jednoho kvaternionu */ /* QUAT * kam_angle_to_quat(float r, float fi, QUAT *p_q) { p_q->quat(r,fi); return(p_q); } */ /* quat * key_rotkey_to_quat(ROTKEY *p_rot, quat *p_q) { return(angle_to_quat(p_q,(VECT *)&p_rot->x,p_rot->angle)); } */ #endif //__QUAT_H__ berusky2-0.12/src/age/graph/vector.h0000644000175000017500000003525313674454621014246 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __VECTOR_H__ #define __VECTOR_H__ #include #include #include // Basic vector operators #include "vector_operators.h" // All vector classes struct vect2di; typedef struct vect2di VECT2DI; struct vect2df; typedef struct vect2df VECT2DF; struct vect3df; typedef struct vect3df VECT3DF; struct vect3di; typedef struct vect3di VECT3DI; struct polar2di; typedef struct polar2di POLAR2DI; struct polar2df; typedef struct polar2df POLAR2DF; struct polar3di; typedef struct polar3di POLAR3DI; struct polar3df; typedef struct polar3df POLAR3DF; struct rect2di; typedef struct rect2di RECT2DI; /*-------------------------------------------------------------------------- Vector class -------------------------------------------------------------------------- */ // Simple clases for parser #ifdef __cplusplus typedef struct vect3df_simple { float x,y,z; } VECT3DF_SIMPLE; typedef struct rect2di_simple { float x,y; float dx,dy; } RECT2DI_SIMPLE; #endif typedef struct vect2di { tpos x,y; vect2di(void) { } vect2di(tpos val) { x = val; y = val; } vect2di(tpos x_, tpos y_) { x = x_; y = y_; } vect2di(VECT2DF src); vect2di(POLAR2DI src); vect2di(RECT2DI src); void min(void) { x = -INT_MAX; y = -INT_MAX; } void max(void) { x = INT_MAX; y = INT_MAX; } OPERATORS2D(VECT2DI,tpos); } VECT2DI; METHODS2D(VECT2DI,tpos); typedef struct vect2df { union { float x; float u; }; union { float y; float v; }; vect2df(void) { } vect2df(float val) { x = val; y = val; } vect2df(float x_, float y_) { x = x_; y = y_; } vect2df(VECT2DI src); vect2df(POLAR2DF src); void min(void) { x = -FLT_MAX; y = -FLT_MAX; } void max(void) { x = FLT_MAX; y = FLT_MAX; } OPERATORS2D(VECT2DF,float); } VECT2DF, VECTUV; METHODS2D(VECT2DF,float); typedef struct vect3di { tpos x,y,z; vect3di(void) { x = y = z = 0; } vect3di(tpos val) { x = y = z = val; } vect3di(tpos x_, tpos y_, tpos z_) { x = x_; y = y_; z = z_; } vect3di(RGBB src) { x = src.r; y = src.g; z = src.b; } vect3di(VECT3DF src); vect3di(POLAR3DI src); void min(void) { x = -INT_MAX; y = -INT_MAX; z = -INT_MAX; } void max(void) { x = INT_MAX; y = INT_MAX; z = INT_MAX; } OPERATORS3D(VECT3DI,tpos); } VECT3DI; METHODS3D(VECT3DI,tpos); typedef struct vect3df { float x,y,z; vect3df(void) { x = y = z = 0; } vect3df(float val) { x = y = z = val; } vect3df(float x_, float y_, float z_) { x = x_; y = y_; z = z_; } vect3df(VECT3DI src); vect3df(POLAR3DF src); vect3df(VECT3DF_SIMPLE src) { x = src.x; y = src.y; z = src.z; } operator VECT3DF_SIMPLE(void) { VECT3DF_SIMPLE tmp; tmp.x = x; tmp.y = y; tmp.z = z; return(tmp); } void min(void) { x = -FLT_MAX; y = -FLT_MAX; z = -FLT_MAX; } void max(void) { x = FLT_MAX; y = FLT_MAX; z = FLT_MAX; } OPERATORS3D(VECT3DF,float); } VECT3DF, VECT; METHODS3D(VECT3DF,float); inline float dist_2D(VECT *a, VECT *b) { float v = (b->x-a->x)*(b->x-a->x)+(b->z-a->z)*(b->z-a->z); return((v > 0.0f) ? (float)sqrtf(v) : v); } inline void calc_line_2D(VECT *a, VECT *b, float *p_k, float *p_q) { *p_k = (a->y - b->y)/(a->x - b->x); *p_q = a->y - (*p_k)*a->x; } inline void calc_line_3D(VECT *a, VECT *b, VECT *q) // t je parametr od 0 do 1 { q->x = b->x - a->x; q->y = b->y - a->y; q->z = b->z - a->z; } inline float vect_norm_vect_2D(float *p_x, float *p_y) { float vel = (float)sqrtf((*p_x)*(*p_x) + (*p_y)*(*p_y)); *p_x /= vel; *p_y /= vel; return(vel); } /*-------------------------------------------------------------------------- 4D vector -------------------------------------------------------------------------- */ typedef struct vect4df : public vect3df { float w; vect4df(void) { } vect4df(RGBAF &src) { x = src.r; y = src.g; z = src.b; w = src.a; } operator RGBAF(void) { return(RGBAF(x,y,z,w)); } static vect4df * sub(vect4df *v, vect4df *u, vect4df *c) { c->x = v->x - u->x; c->y = v->y - u->y; c->z = v->z - u->z; c->w = v->w - u->w; return(c); } } VECT4DF, WVECT; inline vect4df * wvect_sub(vect4df *v, vect4df *u, vect4df *c) { c->x = v->x - u->x; c->y = v->y - u->y; c->z = v->z - u->z; c->w = v->w - u->w; return(c); } /*-------------------------------------------------------------------------- 2D Polar vectors / coordinates -------------------------------------------------------------------------- */ typedef struct polar2di { tpos length; float rotation; polar2di(void) { } polar2di(POLAR2DF src); polar2di(VECT2DI src); polar2di(tpos length, float rotation) { this->length = length; this->rotation = rotation; } void min(void) { length = 0; rotation = 0; } void max(void) { length = INT_MAX; rotation = 0; } // Normalize angle to <0,2PI> radius void norm(void); } POLAR2DI; POLAR2DI interpolate(POLAR2DI p1, POLAR2DI p2, float i); POLAR2DI interpolate(POLAR2DI p1, POLAR2DI p2, float i1, float i2); typedef struct polar2df { float length; float rotation; polar2df(void) { } polar2df(POLAR2DI src); polar2df(VECT2DF src); polar2df(float length, float rotation) { this->length = length; this->rotation = rotation; } void min(void) { length = 0; rotation = 0; } void max(void) { length = FLT_MAX; rotation = 0; } } POLAR2DF; /*-------------------------------------------------------------------------- 3D Polar vectors / coordinates -------------------------------------------------------------------------- */ typedef struct polar3di { tpos length; float rotation; float elevation; polar3di(void) { } polar3di(tpos length, float rotation, float elevation) { this->length = length; this->rotation = rotation; this->rotation = elevation; } polar3di(POLAR3DF src); polar3di(VECT3DI src); void min(void) { length = 0; rotation = 0; elevation = 0; } void max(void) { length = INT_MAX; rotation = 0; elevation = 0; } } POLAR3DI; typedef struct polar3df { float length; float rotation; float elevation; polar3df(void) { } polar3df(float length, float rotation, float elevation) { this->length = length; this->rotation = rotation; this->rotation = elevation; } polar3df(POLAR3DI src); polar3df(VECT3DF src); void min(void) { length = 0; rotation = 0; elevation = 0; } void max(void) { length = FLT_MAX; rotation = 0; elevation = 0; } } POLAR3DF; /*-------------------------------------------------------------------------- Rectangle classes -------------------------------------------------------------------------- */ typedef struct rect2di { tpos x,y; tpos dx,dy; rect2di(void) { } rect2di(int val) { set(val); } rect2di(tpos x, tpos y, tpos dx = 1, tpos dy = 1) { this->x = x; this->y = y; this->dx = dx; this->dy = dy; } rect2di(VECT2DI v1) { x = v1.x; y = v1.y; dx = 1; dy = 1; } rect2di(VECT2DI v1, VECT2DI v2) { set(&v1,&v2); } rect2di(RECT2DI_SIMPLE src) { x = src.x; y = src.y; dx = src.dx; dy = src.dy; } operator RECT2DI_SIMPLE(void) { RECT2DI_SIMPLE tmp; tmp.x = x; tmp.y = y; tmp.dx = dx; tmp.dy = dy; return(tmp); } void set(tpos val = 0) { x = y = val; dx = dy = val; } void set(VECT2DI *p_min, VECT2DI *p_max) { x = p_min->x; y = p_min->y; dx = p_max->x-p_min->x; dy = p_max->y-p_min->y; } void set(VECT2DI *p_vect, int num); void get(VECT2DI *p_min, VECT2DI *p_max) { p_min->x = x; p_min->y = y; p_max->x = dx + p_min->x; p_max->y = dy + p_min->y; } void get(VECT2DI *p_vect) { p_vect[0].set(x ,y); p_vect[1].set(x+dx,y); p_vect[2].set(x ,y+dy); p_vect[3].set(x+dx,y+dy); } VECT2DI center_get(void) { return(VECT2DI(x+dx/2,y+dy/2)); } VECT2DI center_size_get(void) { return(VECT2DI(dx/2,dy/2)); } VECT2DI start_get(void) { return(VECT2DI(x,y)); } VECT2DI end_get(void) { return(VECT2DI(x+dx,y+dy)); } VECT2DI size_get(void) { return(VECT2DI(dx,dy)); } void size_set(VECT2DI size) { dx = size.x; dy = size.y; } void extend(tpos ex, tpos ey) { if(ex < x) { dx += x-ex; x = ex; } if(ey < y) { dy += y-ey; y = ey; } if(ex > x+dx) { dx = ex-x+1; } if(ey > y+dy) { dy = ey-y+1; } } void extend(tpos size) { x -= size; y -= size; size *= 2; dx += size; dy += size; } } RECT2DI; typedef struct rect3di { tpos x,y,z; tpos dx,dy,dz; rect3di(void) { } rect3di(tpos val) { set(val); } rect3di(VECT3DI v1) { x = v1.x; y = v1.y; z = v1.z; dx = 1; dy = 1; dz = 1; } rect3di(VECT3DI v1, VECT3DI v2) { x = v1.x; y = v1.y; z = v1.z; dx = v2.x; dy = v2.y; dz = v2.z; } rect3di(tpos x_, tpos y_, tpos z_, tpos dx_ = 1, tpos dy_ = 1, tpos dz_ = 1) { x = x_; y = y_; z = z_; dx = dx_; dy = dy_; dz = dz_; } void set(tpos val = 0) { x = y = z = val; dx = dy = dz = val; } void set(VECT3DI *p_min, VECT3DI *p_max) { x = p_min->x; y = p_min->y; z = p_min->z; dx = p_max->x-p_min->x; dy = p_max->y-p_min->y; dz = p_max->z-p_min->z; } void get(VECT3DI *p_min, VECT3DI *p_max) { p_min->x = x; p_min->y = y; p_min->z = z; p_max->x = dx + p_min->x; p_max->y = dy + p_min->y; p_max->z = dz + p_min->z; } VECT3DI center_get(void) { return(VECT3DI(x+dx/2, y+dy/2, z+dz/2)); } VECT3DI center_size_get(void) { return(VECT3DI(dx/2, dy/2, dz/2)); } } RECT3DI; typedef struct rect3df { float x,y,z; float dx,dy,dz; rect3df(void) { } rect3df(tpos val) { set(val); } rect3df(VECT3DF v1); rect3df(VECT3DF v1, VECT3DF v2); rect3df(float x_, float y_, float z_, float dx_ = 1, float dy_ = 1, float dz_ = 1) { x = x_; y = y_; z = z_; dx = dx_; dy = dy_; dz = dz_; } void set(float val = 0) { x = y = z = val; dx = dy = dz = val; } VECT3DF center_get(void) { return(VECT3DF(x+dx/2, y+dy/2, z+dz/2)); } VECT3DF center_size_get(void) { return(VECT3DF(dx/2, dy/2, dz/2)); } } RECT3DF; /*-------------------------------------------------------------------------- Plane -------------------------------------------------------------------------- */ typedef class plane : public vect3df { public: float e; public: float norm(void) { float vel = (float)sqrtf(x*x + y*y + z*z); if(vel == 0.0f) return(0.0f);//vel = 1; vel = 1.0f/vel; x *= vel; y *= vel; z *= vel; e *= vel; return(vel); } float dist_to_point(VECT3DF *p) { return((float)fabs(x*p->x+y*p->y+z*p->z+e)); } float dist_to_point_nabs(VECT3DF *p) { return(x*p->x+y*p->y+z*p->z+e); } bool intersection(VECT3DF *a, VECT3DF *b, VECT3DF *p_p, float *p_t) { #define TOL 0.001 float t; float c,j; float qx,qy,qz; // q = B-A qx = b->x - a->x; qy = b->y - a->y; qz = b->z - a->z; c = -(x*a->x + y*a->y + z*a->z + e); j = x*qx + y*qy + z*qz; // is line parallel with the plane? if((j < TOL)&&(j > -TOL)) { return(FALSE); } t = c/j; // P = A - qt if(p_p) { p_p->x = a->x + qx*t; p_p->y = a->y + qy*t; p_p->z = a->z + qz*t; } if(p_t) { *p_t = t; } return(TRUE); } public: plane(void) {} plane(float x_, float y_, float z_, float e_) { x = x_; y = y_; z = z_; e = e_; } plane(VECT3DF a, VECT3DF b, VECT3DF c) { x = (b.y - a.y)*(c.z - a.z)-(c.y - a.y)*(b.z - a.z); y = (b.z - a.z)*(c.x - a.x)-(c.z - a.z)*(b.x - a.x); z = (b.x - a.x)*(c.y - a.y)-(c.x - a.x)*(b.y - a.y); vect3df::norm(); e = -(x*a.x + y*a.y + z*a.z); } plane(VECT3DF position, VECT3DF normal) { x = normal.x; y = normal.y; z = normal.z; e = - x*position.x - y*position.y - z*position.z; } } PLANE; /* * Face helpers */ inline VECT * face_normal(VECT *a, VECT *b, VECT *c, VECT *normal) { normal->x = (b->y - a->y)*(c->z - a->z)-(c->y - a->y)*(b->z - a->z); normal->y = (b->z - a->z)*(c->x - a->x)-(c->z - a->z)*(b->x - a->x); normal->z = (b->x - a->x)*(c->y - a->y)-(c->x - a->x)*(b->y - a->y); normal->norm(); return(normal); } inline VECT * face_center(VECT *a, VECT *b, VECT *c, VECT *center) { center->x = (a->x + b->x + c->x)/3.0f; center->y = (a->y + b->y + c->y)/3.0f; center->z = (a->z + b->z + c->z)/3.0f; return(center); } inline tpos square_dist(tpos x1, tpos y1, tpos x2, tpos y2) { tpos d1 = abs(x2-x1); tpos d2 = abs(y2-y1); return(d1 > d2 ? d1 : d2); } /* * Math helpers */ MATH_HELPERS(float); #endif //__VECTOR_H__ berusky2-0.12/src/age/graph/object_render_list.h0000644000175000017500000000462413674426075016604 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OBJECT_RENDER_LIST_H__ #define __OBJECT_RENDER_LIST_H__ /* typedef class object_render_list_item { public: object_render_list_item * render_append(object_render_list_item *p_new) { return((object_render_list_item *)(llist_item::list_append(p_new))); } void render_remove(void) { llist_item::list_remove(); } object_render_list_item * render_next(void) { return((object_render_list_item *)llist_item::list_next()); } } OBJECT_RENDER_LIST_ITEM; typedef class object_render_list_head : private llist_head { public: OBJECT_RENDER_LIST_ITEM * render_get_first(void) { return((OBJECT_RENDER_LIST_ITEM *)llist_head::list_get_first()); } OBJECT_RENDER_LIST_ITEM * render_insert(OBJECT_RENDER_LIST_ITEM *p_pol) { return((OBJECT_RENDER_LIST_ITEM *)llist_head::list_insert((llist_item *)p_pol)); } void render_remove(OBJECT_RENDER_LIST_ITEM *p_pol) { llist_head::list_insert((llist_item *)p_pol); } void render_clear(void) { llist_head::list_clear(); } } OBJECT_RENDER_LIST_HEAD; */ #endif // __OBJECT_RENDER_LIST_H__ berusky2-0.12/src/age/graph/material.h0000644000175000017500000002241313674426075014536 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Material class */ #ifndef __MATERIAL_H__ #define __MATERIAL_H__ class mesh_material; typedef class mesh_material MESH_MATERIAL; /* * System / Runtime flags */ /* * Texture configuration for each texture layer */ typedef class material_text_config { public: bool active; public: int text_index; int text_operator; int text_coordinates; public: material_text_config(void) { active = FALSE; text_index = 0; text_operator = 0; text_coordinates = 0; } } MATERIAL_TEXT_CONFIG; /* * Material flags */ #define MATERIAL_USED (1<<0) #define MATERIAL_TRANSPARENT (1<<1) #define MATERIAL_ZMASK (1<<2) #define MATERIAL_ZTEST (1<<3) #define MATERIAL_CULL (1<<4) #define MATERIAL_ANIM_FRAME (1<<5) // material is animated #define MATERIAL_2D_MOVE (1<<6) // texture animation - coordinate movement #define MATERIAL_SYSTEM (1<<7) // system material #define MATERIAL_LIB (1<<8) // it's a part of material library #define MATERIAL_SCENE (1<<9) // material sceny #define MATERIAL_SCENE_NUTNY (1<<10) // material sceny nutny #define MATERIAL_NO_SCMT (1<<11) // material bez causticu #define MATERIAL_T1_EYE_LIN (1<<12) #define MATERIAL_T2_EYE_LIN (1<<13) #define MATERIAL_T3_EYE_LIN (1<<14) #define MATERIAL_T4_EYE_LIN (1<<15) #define MATERIAL_T1_SPHERE (1<<16) #define MATERIAL_T2_SPHERE (1<<17) #define MATERIAL_T3_SPHERE (1<<18) #define MATERIAL_T4_SPHERE (1<<19) /* Secondary material flags */ #define MATERIAL2_DIFFUSE (1<<0) #define MATERIAL2_SPECULAR (1<<1) #define MATERIAL2_DIFFUSE_RAY (1<<2) // material se pouzije pro raytracing #define MATERIAL2_SPECULAR_RAY (1<<3) // spocitaji se odlesky #define MATERIAL2_MAP1 (1<<4) // koordinates 1 are akctive #define MATERIAL2_MAP2 (1<<5) // koordinates 2 are akctive #define MATERIAL2_MAP3 (1<<6) // koordinates 3 are akctive #define MATERIAL2_MAP4 (1<<7) // koordinates 4 are akctive #define MATERIAL2_CALC_MAP1 (1<<8) // koordinates 1 are calculated #define MATERIAL2_CALC_MAP2 (1<<9) // koordinates 2 are calculated #define MATERIAL2_CALC_MAP3 (1<<10) // koordinates 3 are calculated #define MATERIAL2_CALC_MAP4 (1<<11) // koordinates 4 are calculated #define MATERIAL2_DEF_TEXTANIM (1<<12) // run firts animation by default #define MATERIAL2_ENV_SPEC (1<<13) // specular env mapping #define MATERIAL2_ENV_SPEC_OBE (1<<14) // specular double sided env mapping #define MATERIAL2_T1_MATRIX (1<<15) // pouzivat transformacni matici c.1 #define MATERIAL2_T2_MATRIX (1<<16) // pouzivat transformacni matici c.2 #define MATERIAL2_T3_MATRIX (1<<17) // pouzivat transformacni matici c.3 #define MATERIAL2_T4_MATRIX (1<<18) // pouzivat transformacni matici c.4 #define MATERIAL2_MASK (1<<19) #define MATERIAL2_BUMP (1<<20) /* * Mesh material */ typedef class mesh_material: public object_list { /* * Material flags */ public: FLAG_INTERFACE mflags; FLAG_INTERFACE m2flags; /* * Material aplha blending */ private: MATERIAL_ALPHA alpha; private: void alpha_set(void); public: void alpha_func_set(ALPHA_TYPE function) { alpha.alpha_func_set(function); } ALPHA_TYPE alpha_func_get(void) { return(alpha.alpha_func_get()); } /* * Texture set & configuration */ private: MATERIAL_TEXT_COORDINATES text_coord[MAT_TEXTURES]; MATERIAL_TEXT_CONFIG text_config[MAT_TEXTURES]; MATERIAL_TEXT *p_text[MAT_TEXTURES]; public: MATERIAL_TEXT_COORDINATES * text_coordinates_get(int texture) { assert(texture >= 0 && texture <= MAT_TEXTURES); return(text_coord+texture); } MATERIAL_TEXT_CONFIG * text_config_get(int texture) { assert(texture >= 0 && texture <= MAT_TEXTURES); return(text_config+texture); } void texture_clear(int texture_num) { if(p_text[texture_num]) { p_text[texture_num]->reference_dec(); p_text[texture_num] = NULL; } } void texture_set(int texture_num, MATERIAL_TEXT *p_txt) { texture_clear(texture_num); if(p_txt) { p_text[texture_num] = p_txt; p_txt->reference_add(); } } MATERIAL_TEXT * texture_get(int texture_num = 0) { return(p_text[texture_num]); } void texture_enable(int config_num, int text_index, int text_operator, int text_coordinates) { MATERIAL_TEXT_CONFIG *p_config = text_config+config_num; p_config->active = TRUE; p_config->text_index = text_index; p_config->text_operator = text_operator; p_config->text_coordinates = text_coordinates; } void texture_disable(int config_num) { MATERIAL_TEXT_CONFIG *p_config = text_config+config_num; p_config->active = FALSE; } private: void texture_set(void); int texture_on(int unit, int config, int reserved = 0); static void texture_off(int unit); static void texture_off(void); private: /* Surface color parameters */ float shine; public: float shine_get(void) { return(shine); } void shine_set(float mat_shine) { shine = mat_shine; } /* * Material color parameters */ private: RGBAF ambient; // ambient RGBAF diff; // diffuse color RGBF spec; // specular color public: RGBAF * ambient_get(void) { return(&ambient); } void ambient_set(RGBAF *p_ambient) { ambient = *p_ambient; } RGBAF * diffuse_get(void) { return(&diff); } void diffuse_set(RGBAF *p_diff) { diff = *p_diff; } RGBF * specular_get(void) { return(&spec); } void specular_set(RGBF *p_spec) { spec = *p_spec; } public: RGBAF factor; // factor public: /* * Material high level configuration */ void transparent_set(bool transparent) { if(transparent) { mflags.flag_set(MATERIAL_TRANSPARENT); mflags.flag_clear(MATERIAL_ZMASK); alpha_func_set(ALPHA_TRANSPARENT); } else { mflags.flag_clear(MATERIAL_TRANSPARENT); mflags.flag_set(MATERIAL_ZMASK); alpha_func_set(ALPHA_OFF); } } bool transparent_get(void) { return(mflags.flag_get(MATERIAL_TRANSPARENT)); } void double_side_set(bool double_side) { mflags.flag_set(MATERIAL_CULL, !double_side); } bool double_side_get(void) { return(mflags.flag_get(MATERIAL_CULL)); } public: /* Last used material */ static class mesh_material *p_mat_last; /* Global (top scene) material */ static class mesh_material *p_mat_scene; public: void clear(void); public: int set(bool forced = FALSE); /* Predefined materials */ public: static void set_default(bool forced = FALSE); static void set_selection(bool forced = FALSE); public: void print(void); public: MESH_MATERIAL * material_next(void) { return((MESH_MATERIAL *)object_list_next()); } void material_remove(void); public: mesh_material(SCENE *p_scene); ~mesh_material(void); private: class mesh_material operator=(class mesh_material &src) { assert(0); } mesh_material(class mesh_material &src) : object_list(NULL) { assert(0); } } MESH_MATERIAL; // List of all materials used in the scene typedef class material_list : public object_list_head { public: MESH_MATERIAL * create(void) { MESH_MATERIAL *p_new = new MESH_MATERIAL(scene_get()); object_list_insert(p_new); return(p_new); } void destroy(MESH_MATERIAL *p_mat) { object_list_remove(p_mat); delete (MESH_MATERIAL *)p_mat; } public: MESH_MATERIAL * get_first(void) { return((MESH_MATERIAL *)object_list_get_first()); } public: void print(void); public: material_list(class scene *p_scene) : object_list_head(p_scene) { } // TODO - remove all materials? virtual ~material_list(void) {}; } MATERIAL_LIST; #endif // __MATERIAL_H__ berusky2-0.12/src/age/graph/draw.h0000644000175000017500000000305713674426075013700 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*-------------------------------------------------------------------------- Drawing of basic primitives -------------------------------------------------------------------------- */ #ifndef __DRAW_H__ #define __DRAW_H__ #endif // __DRAW_H__ berusky2-0.12/src/age/graph/normals.cpp0000644000175000017500000000633013674426075014746 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Calculator for normal vectors */ #include "age.h" static VECT * calc_face_normals(VECT *p_vertexes, int vertexnum, tface *p_face, int facenum) { VECT *p_face_normals = (VECT *)mmalloc(sizeof(p_face_normals[0])*(facenum/3)); int i,face; for(i = 0, face = 0; i < facenum; i+=3, face++) { face_normal(p_vertexes+p_face[i], p_vertexes+p_face[i+1], p_vertexes+p_face[i+2], p_face_normals+face); } return(p_face_normals); } #define MAX_FACES_PER_VERTEX 50 typedef struct face_references { int facenum; tface faces[MAX_FACES_PER_VERTEX]; public: void reference_add(int face) { assert(facenum < MAX_FACES_PER_VERTEX); if(facenum < MAX_FACES_PER_VERTEX) { faces[facenum] = face; facenum++; } } } FACE_REFERENCES; static FACE_REFERENCES * calc_face_references(VECT *p_vertexes, int vertexnum, tface *p_face, int facenum) { FACE_REFERENCES *p_face_references = (FACE_REFERENCES *)mmalloc(sizeof(p_face_references[0])*vertexnum); int i,face; for(i = 0, face = 0; i < facenum; i+=3, face++) { p_face_references[p_face[i]].reference_add(face); p_face_references[p_face[i+1]].reference_add(face); p_face_references[p_face[i+2]].reference_add(face); } return(p_face_references); } void normals_calc(VECT *p_vertexes, int vertexnum, tface *p_face, int facenum, VECT *p_normals) { VECT *p_face_normals = calc_face_normals(p_vertexes, vertexnum, p_face, facenum); FACE_REFERENCES *p_face_references = calc_face_references(p_vertexes, vertexnum, p_face, facenum); int i; for(i = 0; i < vertexnum; i++) { FACE_REFERENCES *p_ref = p_face_references+i; VECT norm(0.0f); int f; for(f = 0; f < p_ref->facenum; f++) { norm += p_face_normals[p_ref->faces[f]]; } norm.norm(); p_normals[i] = norm; } ffree(p_face_references); ffree(p_face_normals); } berusky2-0.12/src/age/graph/draw.cpp0000644000175000017500000002663113674426075014236 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" void graph3d::draw_rect_line_2d(int x1, int y1, int x2, int y2, RGBB color) { glColor3f(color.r,color.g,color.b); glBegin(GL_LINE_STRIP); glVertex2d(x1,y1); glVertex2d(x2,y1); glVertex2d(x2,y2); glVertex2d(x1,y2); glVertex2d(x1,y1); glEnd(); } void graph3d::draw_rect_solid_2d(int x1, int y1, int x2, int y2, RGBB color) { glColor3f(color.r,color.g,color.b); glBegin(GL_QUADS); glVertex2d(x1,y1); glVertex2d(x1,y2); glVertex2d(x2,y2); glVertex2d(x2,y1); glEnd(); } void graph3d::draw_line_3d(VECT *p_s, VECT *p_k, RGBB color) { glColor3ub(color.r,color.g,color.b); glBegin(GL_LINES); glVertex3f(p_s->x,p_s->y,p_s->z); glVertex3f(p_k->x,p_k->y,p_k->z); glEnd(); } void graph3d::draw_line_3d(float sx, float sy, float sz, float ex, float ey, float ez, RGBB color) { glColor3ub(color.r,color.g,color.b); glBegin(GL_LINES); glVertex3f(sx,sy,sz); glVertex3f(ex,ey,ez); glEnd(); } void graph3d::draw_cursor_normal(int mx, int my, int sx, int sy, int xres, int yres, RGBB color) { glColor3f(color.r,color.g,color.b); glBegin(GL_LINES); glVertex2i(sx+mx,sy); glVertex2i(sx+mx,sy+yres); glVertex2i(sx,sy+my); glVertex2i(sx+xres,sy+my); glEnd(); } #define MOUSE_CURSOR_RECT_SELECT_SIZE 20 void graph3d::draw_cursor_rect_select(int mx, int my, RGBB color) { glColor3f(color.r,color.g,color.b); glBegin(GL_LINES); glVertex2i(mx-MOUSE_CURSOR_RECT_SELECT_SIZE,my); glVertex2i(mx+MOUSE_CURSOR_RECT_SELECT_SIZE,my); glVertex2i(mx,my-MOUSE_CURSOR_RECT_SELECT_SIZE); glVertex2i(mx,my+MOUSE_CURSOR_RECT_SELECT_SIZE); glEnd(); } void graph3d::draw_cube_line(float sx, float sy, float sz, float dx, float dy, float dz, RGBB color) { glColor3ub(color.r,color.g,color.b); glBegin(GL_LINE_STRIP); glVertex3f(sx-dx,sy-dy,sz-dz); glVertex3f(sx+dx,sy-dy,sz-dz); glVertex3f(sx+dx,sy-dy,sz+dz); glVertex3f(sx-dx,sy-dy,sz+dz); glVertex3f(sx-dx,sy-dy,sz-dz); glEnd(); glBegin(GL_LINE_STRIP); glVertex3f(sx-dx,sy+dy,sz-dz); glVertex3f(sx+dx,sy+dy,sz-dz); glVertex3f(sx+dx,sy+dy,sz+dz); glVertex3f(sx-dx,sy+dy,sz+dz); glVertex3f(sx-dx,sy+dy,sz-dz); glEnd(); glBegin(GL_LINES); glVertex3f(sx-dx,sy-dy,sz-dz); glVertex3f(sx-dx,sy+dy,sz-dz); glVertex3f(sx+dx,sy-dy,sz-dz); glVertex3f(sx+dx,sy+dy,sz-dz); glVertex3f(sx+dx,sy-dy,sz+dz); glVertex3f(sx+dx,sy+dy,sz+dz); glVertex3f(sx-dx,sy-dy,sz+dz); glVertex3f(sx-dx,sy+dy,sz+dz); glEnd(); } void graph3d::draw_cube_line(VECT *p_center, VECT *p_size, RGBB color) { draw_cube_line(p_center->x, p_center->y, p_center->z, p_size->x, p_size->y, p_size->z, color); } void graph3d::draw_cube_solid(float sx, float sy, float sz, float dx, float dy, float dz, RGBB color) { VECT vertex[8]; vertex[0].x =-dx; vertex[0].y =-dy; vertex[0].z =-dz; vertex[1].x = dx; vertex[1].y =-dy; vertex[1].z =-dz; vertex[2].x = dx; vertex[2].y = dy; vertex[2].z =-dz; vertex[3].x =-dx; vertex[3].y = dy; vertex[3].z =-dz; vertex[4].x =-dx; vertex[4].y =-dy; vertex[4].z = dz; vertex[5].x = dx; vertex[5].y =-dy; vertex[5].z = dz; vertex[6].x = dx; vertex[6].y = dy; vertex[6].z = dz; vertex[7].x =-dx; vertex[7].y = dy; vertex[7].z = dz; int i; for(i = 0; i < 8; i++) { vertex[i].x += sx; vertex[i].y += sy; vertex[i].z += sz; } glColor3ub(color.r,color.g,color.b); glBegin(GL_TRIANGLES); //front side glVertex3fv((float *)(vertex+0)); glVertex3fv((float *)(vertex+1)); glVertex3fv((float *)(vertex+2)); glVertex3fv((float *)(vertex+2)); glVertex3fv((float *)(vertex+3)); glVertex3fv((float *)(vertex+0)); //back side glVertex3fv((float *)(vertex+5)); glVertex3fv((float *)(vertex+6)); glVertex3fv((float *)(vertex+7)); glVertex3fv((float *)(vertex+7)); glVertex3fv((float *)(vertex+4)); glVertex3fv((float *)(vertex+5)); // right side glVertex3fv((float *)(vertex+1)); glVertex3fv((float *)(vertex+5)); glVertex3fv((float *)(vertex+6)); glVertex3fv((float *)(vertex+6)); glVertex3fv((float *)(vertex+2)); glVertex3fv((float *)(vertex+1)); // left side glVertex3fv((float *)(vertex+4)); glVertex3fv((float *)(vertex+0)); glVertex3fv((float *)(vertex+3)); glVertex3fv((float *)(vertex+3)); glVertex3fv((float *)(vertex+7)); glVertex3fv((float *)(vertex+4)); // top glVertex3fv((float *)(vertex+3)); glVertex3fv((float *)(vertex+2)); glVertex3fv((float *)(vertex+6)); glVertex3fv((float *)(vertex+6)); glVertex3fv((float *)(vertex+7)); glVertex3fv((float *)(vertex+3)); // bottom glVertex3fv((float *)(vertex+4)); glVertex3fv((float *)(vertex+0)); glVertex3fv((float *)(vertex+1)); glVertex3fv((float *)(vertex+1)); glVertex3fv((float *)(vertex+5)); glVertex3fv((float *)(vertex+4)); glEnd(); } void graph3d::draw_cube_solid(VECT *p_center, VECT *p_size, RGBB color) { draw_cube_solid(p_center->x, p_center->y, p_center->z, p_size->x, p_size->y, p_size->z, color); } void graph3d::draw_label(VECT *p_position, const char *p_label, RGBB color) { GPIPE *p_pipe = gpipe_get(); VECT tmp = *p_position; VECT2DI tmp2d; if(p_pipe->world_to_screen(&tmp,&tmp2d)) { p_pipe->matrix_2d_mode_set(); console_print(color,tmp2d.x,tmp2d.y,p_label); } } void graph3d::draw_label(float x, float y, float z, const char *p_label, RGBB color) { VECT tmp(x,y,z); draw_label(&tmp,p_label,color); } void graph3d::draw_cross(VECT *p_position, float size, tflag flags) { VECT p = *p_position; RGBB color; GPIPE *p_pipe = gpipe_get(); p_pipe->world_to_screen(&p); size *= p.z*0.1f; mesh_material::set_default(); glBegin(GL_LINES); color = (flags&CROSS_COLOR_AXIS_X) ? RGBB(255,0,0) : RGBB(0,0,0); glColor3ubv((byte *)&color); glVertex3fv((float *)p_position); glVertex3f(p_position->x+size,p_position->y,p_position->z); color = (flags&CROSS_COLOR_AXIS_Y) ? RGBB(0,0,255) : RGBB(0,0,0); glColor3ubv((byte *)&color); glVertex3fv((float *)p_position); glVertex3f(p_position->x,p_position->y+size,p_position->z); color = (flags&CROSS_COLOR_AXIS_Z) ? RGBB(0,255,0) : RGBB(0,0,0); glColor3ubv((byte *)&color); glVertex3fv((float *)p_position); glVertex3f(p_position->x,p_position->y,p_position->z+size); glEnd(); if(flags&CROSS_AXIS_NAMES) { p_pipe->matrix_2d_mode_set(); draw_label(p_position->x+size,p_position->y,p_position->z,"X"); draw_label(p_position->x,p_position->y+size,p_position->z,"Y"); draw_label(p_position->x,p_position->y,p_position->z+size,"Z"); p_pipe->matrix_3d_mode_set(); } } /* void oe_kresli_editacni_stred(K_EDITOR *p_cnf, BOD *p_stred, int flag) { text_off(GL_TEXTURE_1D); text_off(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); oe_test_kriz_stred(p_cnf,VELIKOST_STREDU,p_stred->x,p_stred->y,p_stred->z, POPIS_OS_ON,STRED_ON,flag); glEnable(GL_DEPTH_TEST); } */ // Draws grid /* Calc differences */ void graph3d::draw_floor_line(VECT *p_center, float size, int lines_min, int lines_max) { float half_size = size/2; float step = 1.0f; while(1) { int lines = ftoi(size/step); if(lines > lines_max) { step *= 2.0f; } else if(lines < lines_min) { step *= 0.2f; } else { break; } } // step is a distance between lines float sx = ceilf((p_center->x-half_size)/step)*step; float sy = p_center->y; float sz = ceilf((p_center->z-half_size)/step)*step; int nx = (int)ceilf(fabs(size)/step); int nz = (int)ceilf(fabs(size)/step); float dx = step; float dz = step; int x,xm,z,zm; #define MINOR_LINES 5 RGBB color_major(200,200,200); RGBB color_minor(140,140,140); // X axis for(x = 0; x <= nx; x++) { draw_line_3d(sx+dx*x,sy,sz, sx+dx*x,sy,sz+dz*nz, color_major); for(xm = 1; xm < MINOR_LINES; xm++) { float mdx = (dx/((float)MINOR_LINES))*xm; draw_line_3d(sx+dx*x+mdx,sy,sz, sx+dx*x+mdx,sy,sz+dz*nz, color_minor); } } // Z axis for(z = 0; z <= nz; z++) { draw_line_3d(sx,sy,sz+dz*z, sx+dx*nx,sy,sz+dz*z, color_major); for(zm = 1; zm < MINOR_LINES; zm++) { float mdz = (dz/((float)MINOR_LINES))*zm; draw_line_3d(sx,sy,sz+dz*z+mdz, sx+dx*nx,sy,sz+dz*z+mdz, color_minor); } } // Center cross #define CENTER_SIZE 20 draw_line_3d(0,0,-CENTER_SIZE, 0,0, CENTER_SIZE, RGBB(255,0,0)); draw_line_3d(-CENTER_SIZE,0,0, CENTER_SIZE,0,0, RGBB(0,255,0)); } void graph3d::draw_camera(VECT *p_position, VECT *p_target, float fov, RGBB color) { VECT p = *p_target - *p_position; float z = p.size(); float s = (float)tan(fov)*z/2; VECT v[5]; v[0].x = 0.0f; v[0].y = 0.0f; v[0].z = 0.0f; v[1].x = s; v[1].y =-s; v[1].z = z; v[2].x = s; v[2].y = s; v[2].z = z; v[3].x =-s; v[3].y = s; v[3].z = z; v[4].x =-s; v[4].y =-s; v[4].z = z; glColor3ub(color.r,color.g,color.b); glBegin(GL_LINES); glVertex3fv((float *)(v+0)); glVertex3fv((float *)(v+1)); glVertex3fv((float *)(v+0)); glVertex3fv((float *)(v+2)); glVertex3fv((float *)(v+0)); glVertex3fv((float *)(v+3)); glVertex3fv((float *)(v+0)); glVertex3fv((float *)(v+4)); glVertex3fv((float *)(v+4)); glVertex3fv((float *)(v+1)); glVertex3fv((float *)(v+1)); glVertex3fv((float *)(v+2)); glVertex3fv((float *)(v+2)); glVertex3fv((float *)(v+3)); glVertex3fv((float *)(v+3)); glVertex3fv((float *)(v+4)); glEnd(); } void graph3d::draw_camera(CAMERA_INTERFACE *p_camera, float size, RGBB color) { VECT position; VECT direction; p_camera->position_get(&position); p_camera->direction_get(&direction); direction.norm(size); VECT target(position); target += direction; draw_camera(&position, &target, p_camera->projection_fov_get(), color); } berusky2-0.12/src/age/graph/scene.cpp0000644000175000017500000003524613674426075014400 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* * Current scene frame */ int scene::current_frame = -1; /* * Mesh methods */ GAME_MESH * scene::mesh_create(const char *p_name, const char *p_mesh_parent) { GAME_MESH *p_mesh = meshes.create(); // Set scene reference p_mesh->scene_set(this); if(p_name) p_mesh->name_set(p_name); // Insert to render hierarchy render_hierarchy_insert(p_mesh, p_mesh_parent); return(p_mesh); } void scene::mesh_remove(GAME_MESH *p_mesh) { // Remove this mesh // Check the reference count assert(p_mesh->reference_get() == 0); // Remove this mesh from render hierrachy render_hierarchy_remove(p_mesh); // Remove this mesh meshes.remove(p_mesh); } GAME_MESH * scene::mesh_get(const char *p_name) { return((GAME_MESH *)meshes.object_list_find(p_name)); } GAME_MESH * scene::mesh_get(int name_ID) { //return(meshes.find(name_ID)); return(NULL); } GAME_MESH * scene::mesh_get_first(void) { return(meshes.get_first()); } GAME_MESH * scene::mesh_mark_first(int mark) { return((GAME_MESH *)meshes.object_list_first_mark(mark)); } /* * Texture methods */ MATERIAL_TEXT * scene::texture_create(const char *p_name) { MATERIAL_TEXT *p_text = textures.create(); p_text->name_set(p_name); return(p_text); } MATERIAL_TEXT * scene::texture_create(const char *p_dir, const char *p_file, const char *p_name) { MATERIAL_TEXT *p_text = textures.create_and_load(p_dir, p_file, p_name); return(p_text); } void scene::texture_remove(MATERIAL_TEXT *p_text) { } MATERIAL_TEXT * scene::texture_get(char *p_name) { return((MATERIAL_TEXT *)textures.object_list_find(p_name)); } MATERIAL_TEXT * scene::texture_get(int name_ID) { return(NULL); } MATERIAL_TEXT * scene::texture_get_first(void) { return(textures.get_first()); } void scene::texture_reload(void) { textures.reload(); } void scene::texture_dir_reset(void) { textures.dir_reset(); } bool scene::texture_dir_add(char *p_dir) { return(textures.dir_add(p_dir)); } /* * Material methods */ MESH_MATERIAL * scene::material_create(const char *p_name) { MESH_MATERIAL *p_mat = materials.create(); p_mat->scene_set(this); if(p_name) p_mat->name_set(p_name); return(p_mat); } void scene::material_remove(MESH_MATERIAL *p_mat) { } MESH_MATERIAL * scene::material_get(const char *p_name) { return((MESH_MATERIAL *)materials.object_list_find(p_name)); } MESH_MATERIAL * scene::material_get(int name_ID) { //return(materials.find(name_ID)); return(NULL); } MESH_MATERIAL * scene::material_get_first(void) { return((MESH_MATERIAL *)materials.object_list_get_first()); } /* * Camera system */ CAMERA_OBJECT * scene::camera_create(const char *p_name) { CAMERA_OBJECT *p_cam = cameras.create(CAMERA_TYPE_BASE); if(p_cam) p_cam->name_set(p_name); return(p_cam); } CAMERA_3DS * scene::camera_3ds_create(const char *p_name) { CAMERA_3DS *p_cam = (CAMERA_3DS *)cameras.create(CAMERA_TYPE_3DS); if(p_cam) p_cam->name_set(p_name); return(p_cam); } CAMERA_POLAR * scene::camera_polar_create(const char *p_name) { CAMERA_POLAR *p_cam = (CAMERA_POLAR *)cameras.create(CAMERA_TYPE_POLAR); if(p_cam) p_cam->name_set(p_name); return(p_cam); } CAMERA_OBJECT * scene::camera_get(const char *p_name) { return((CAMERA_OBJECT *)cameras.object_list_find(p_name)); } void scene::camera_active_set(CAMERA_OBJECT *p_camera) { cameras.active_set(p_camera); } CAMERA_OBJECT * scene::camera_active_get(void) { return(cameras.active_get()); } /* * Scene hierarchy */ /* * Scene methods */ void scene::create(void) { } void scene::clear(void) { } void scene::remove(void) { } scene::scene(void) : textures(this), materials(this), meshes(this), cameras(this), render_hierarchy(this), render_list(this) { ::gpipe_set(&gpipeline); scene_box_update(); } scene::~scene(void) { } void scene::render_viewport_absolute_set(tpos sx, tpos sy, tpos dx, tpos dy) { gpipe_get()->view_absolute_set(sx,sy,dx,dy); } void scene::render_viewport_relative_set(float sx, float sy, float dx, float dy) { gpipe_get()->view_relative_set(sx,sy,dx,dy); } void scene::render_viewport_get(tpos *p_sx, tpos *p_sy, tpos *p_dx, tpos *p_dy) { gpipe_get()->view_get(p_sx, p_sy, p_dx, p_dy); } bool scene::render_state_set(bool state) { return(gpipe_get()->render_state_set(state)); } bool scene::render_state_get(void) { return(gpipe_get()->render_state_get()); } /* * Load / Save */ void scene::load_insert(void) { // Add all loaded meshes into scene hierrachy GAME_MESH *p_tmp = mesh_mark_first(MARK_CREATED); while(p_tmp) { p_tmp->mark_clear(MARK_CREATED); MESH_GEOMETRY *p_geom = p_tmp->lock(LOCK_READ); if(p_geom) { p_geom->update(TRUE); } p_tmp->unlock(); p_tmp = (GAME_MESH *)p_tmp->object_list_next_mark(MARK_CREATED); } // Recalculate complete hierarchy update_hierarchy(TRUE); } /* * Load whole scene from file */ int scene::load_b2m(char *p_dir, char *p_file) { return(scene_import_b2m(this, p_dir, p_file)); } int scene::save_b2m(char *p_dir, char *p_file) { return(scene_export_b2m(this, p_dir, p_file)); } int scene::load_3ds(char *p_dir, char *p_file) { return(scene_import_3ds(this, p_dir, p_file)); } int scene::save_3ds(char *p_dir, char *p_file) { return(scene_export_3ds(this, p_dir, p_file)); } int scene::load_txt(char *p_dir, char *p_file) { return(scene_import_txt(this, p_dir, p_file)); } int scene::save_txt(char *p_dir, char *p_file) { return(scene_export_txt(this, p_dir, p_file)); } int scene::load(char *p_dir, char *p_file, SCENE_TYPE type) { int ret = 0; switch(type) { case SCENE_B2M: ret = load_b2m(p_dir,p_file); break; case SCENE_3DS: ret = load_3ds(p_dir,p_file); break; case SCENE_TXT: ret = load_txt(p_dir,p_file); break; } load_insert(); return(ret); } /* * Save scene to file */ int scene::save(char *p_dir, char *p_file, SCENE_TYPE type) { int ret = 0; switch(type) { case SCENE_B2M: ret = save_b2m(p_dir,p_file); break; case SCENE_3DS: ret = save_3ds(p_dir,p_file); break; case SCENE_TXT: ret = save_txt(p_dir,p_file); break; } return(ret); } /* SCENE_OBJECT_HIERARCHY_ITERATOR it = hierarchy_next_new(); SCENE_OBJECT *p_obj; while((p_obj = hierarchy_next(&it))) { p_obj->geometry_update_reset(); } */ void scene::update_animations(bool forced) { if(!forced && !flag_get(FRAME_NEEDS_UPDATE_ANIMATIONS)) return; flag_clear(FRAME_NEEDS_UPDATE_ANIMATIONS); } void scene::update_hierarchy(bool forced) { if(!forced && !flag_get(FRAME_NEEDS_UPDATE_HIERARCHY)) return; SCENE_OBJECT *p_obj; // Update all positions of local objects OBJECT_HIERARCHY_ITERATOR it = render_hierarchy_next_new(); while((p_obj = render_hierarchy_next(&it))) { if(p_obj->object_is_geometry()) { ((SCENE_OBJECT_GEOMETRY *)p_obj)->object_world_hierarchy_update(forced); } } // Update complete hierarchy int changed = 0; it = render_hierarchy_next_new(); while((p_obj = render_hierarchy_next(&it))) { if(p_obj->object_is_geometry()) { changed += ((SCENE_OBJECT_GEOMETRY *)p_obj)->object_box_hierarchy_update(forced); } } flag_clear(FRAME_NEEDS_UPDATE_HIERARCHY); if(changed) { flag_set(SCENE_NEEDS_UPDATE_BOX); } } void scene::update_renderlist(bool forced) { if(!forced && !flag_get(FRAME_NEEDS_UPDATE_RENDERLIST)) return; int rendered = 0; render_list.render_list_head_init(); OBJECT_HIERARCHY_ITERATOR it = render_hierarchy_next_new(); SCENE_OBJECT *p_obj; while((p_obj = render_hierarchy_next(&it))) { if(p_obj->object_is_rendered()) { if(((SCENE_OBJECT_GEOMETRY *)p_obj)->visible()) { render_list.render_list_insert(p_obj); rendered++; } } } flag_clear(FRAME_NEEDS_UPDATE_RENDERLIST); } void scene::update_box(bool forced) { if(!forced && !flag_get(SCENE_NEEDS_UPDATE_BOX)) return; scene_box_update(); flag_clear(SCENE_NEEDS_UPDATE_BOX); } /* * Update all scene animations, calc positions and so on */ void scene::update(void) { update_animations(); update_hierarchy(); update_renderlist(); update_box(); } #define DEFAULT_SCENE_BOX_SIZE 10 void scene::scene_box_update(void) { scene_box.set(); OBJECT_HIERARCHY_ITERATOR it = render_hierarchy_next_new(); SCENE_OBJECT_GEOMETRY *p_obj; int objnum = 0; while((p_obj = (SCENE_OBJECT_GEOMETRY *)render_hierarchy_next(&it))) { if(p_obj->object_is_geometry()) { BOX *p_box = p_obj->object_box_global_get(); if(p_box) { AABB tmp(p_box); scene_box.adjust(&tmp); objnum++; } } } if(!objnum) { scene_box.adjust(VECT(-DEFAULT_SCENE_BOX_SIZE, -DEFAULT_SCENE_BOX_SIZE, -DEFAULT_SCENE_BOX_SIZE)); scene_box.adjust(VECT(DEFAULT_SCENE_BOX_SIZE, DEFAULT_SCENE_BOX_SIZE, DEFAULT_SCENE_BOX_SIZE)); } } // Return center of the scene VECT * scene::scene_box_center_get(VECT *p_center) { return(scene_box.center_get(p_center)); } // Return size of the scene VECT * scene::scene_box_length_get(VECT *p_size) { return(scene_box.length_get(p_size)); } // Return current depth of the scene void scene::scene_box_depth_get(float *p_averange, float *p_min, float *p_max) { // Project scene box to 2D and calculate the averange distance int border_vertexnum = scene_box.border_vertexnum_get(); assert(border_vertexnum == AABB_BORDER_VERTEXNUM); VECT border[AABB_BORDER_VERTEXNUM]; scene_box.border_get(border); GPIPE *p_gpipe = gpipe_get(); int i; int num = 0; float dist_averange = 0; float dist_min = FLT_MAX; float dist_max = FLT_MIN; for(i = 0; i < AABB_BORDER_VERTEXNUM; i++) { p_gpipe->world_to_camera(border+i); if(border[i].z > 0) { dist_min = MIN(border[i].z, dist_min); dist_max = MAX(border[i].z, dist_max); dist_averange += border[i].z; num++; } } if(num == 0) { dist_averange = 10; dist_min = -5; dist_max = 5; } else { dist_averange /= (float)num; } if(p_averange) *p_averange = dist_averange; if(p_min) *p_min = dist_min; if(p_max) *p_max = dist_max; } float scene::scene_box_depth_get(void) { float dist; scene_box_depth_get(&dist,NULL,NULL); return(dist); } void scene::draw_start(int current_frame) { current_frame_set(current_frame); update_flags_clear(); } /* * Drawing */ void scene::draw_end(bool all) { /* * Update all scene objects */ update(); /* * Set the current camera as the active one */ CAMERA_OBJECT *p_camera = camera_active_get(); if(p_camera) p_camera->set(); /* * Draw all objects in the scene */ if(all) { OBJECT_HIERARCHY_ITERATOR it = render_hierarchy_next_new(); SCENE_OBJECT *p_obj; while((p_obj = render_hierarchy_next(&it))) { if(p_obj->object_type_get() == SCENE_OBJECT_MESH) { GAME_MESH *p_mesh = (GAME_MESH *)p_obj; p_mesh->draw(); } } } /* * Draw only visible objects */ else { SCENE_OBJECT *p_obj = render_list_first(); while(p_obj) { if(p_obj->object_is_type(SCENE_OBJECT_MESH)) { GAME_MESH *p_mesh = (GAME_MESH *)p_obj; p_mesh->draw(); } p_obj = render_list_next(p_obj); } } /* * Reset scene geometry */ } /* * Lighting interface */ void scene::lighting_on(void) { } void scene::lighting_off(void) { } void scene::lighting_set(bool state) { } /* * Selection interface */ void scene::selection_clear(void) { selection.clear(); } void scene::selection_remove(OBJECT_SELECT *p_object) { selection.remove(p_object); } bool scene::selection_add(OBJECT_SELECT * p_object) { if(selection.insert(p_object)) { return(TRUE); } return(FALSE); } SELECTED_OBJECT_ITEM * scene::selection_get(void) { return(selection.get_first()); } /* * Transform all objects to 2D and intersect them */ int scene::selection_add(RECT2DI *p_r) { return(selection_add_meshes(p_r)); } int scene::selection_add_meshes(RECT2DI *p_r) { // Select meshes int inserted = 0; GAME_MESH *p_mesh = mesh_get_first(); while(p_mesh) { int vertexnum; VECT2DI *p_vertexes = p_mesh->vertex_position_screen_space_get(&vertexnum); if(p_vertexes) { RECT2DI mesh_rectangle; mesh_rectangle.set(p_vertexes,vertexnum); int ret = intersect_rect_rect(p_r, &mesh_rectangle); if(ret == INTERSECT_INSIDE) { selection_add(p_mesh); } else if(ret == INTERSECT_CROSS) { int facenum; tface *p_faces = p_mesh->faces_get(&facenum); assert(p_faces); int i; for(i = 0; i < facenum; i += 3) { VECT2DI *p_v1 = p_vertexes+(*p_faces)++; VECT2DI *p_v2 = p_vertexes+(*p_faces)++; VECT2DI *p_v3 = p_vertexes+(*p_faces)++; if(p_v1->x == INT_MAX || p_v2->x == INT_MAX || p_v3->x == INT_MAX) { continue; } if(intersect_rect_triangle(p_r,p_v1,p_v2,p_v3)) { if(selection_add(p_mesh)) inserted++; break; } } free(p_faces); } free(p_vertexes); } p_mesh = (GAME_MESH *)p_mesh->object_list_next(); } return(inserted); } berusky2-0.12/src/age/graph/polar.cpp0000644000175000017500000000246513674426075014415 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/object_select.h0000644000175000017500000000334713674426075015552 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OBJECT_SELECT_H__ #define __OBJECT_SELECT_H__ /* Basic scene object what can be selected */ typedef class object_select : public object_mark { public: bool is_selected(void) { return(mark_get(MARK_SELECTED)); } virtual void select(void) { mark_set(MARK_SELECTED); } virtual void unselect(void) { mark_clear(MARK_SELECTED); } } OBJECT_SELECT; #endif // __OBJECT_SELECT_H__ berusky2-0.12/src/age/graph/object_scene.cpp0000644000175000017500000000000013674426075015702 00000000000000berusky2-0.12/src/age/graph/surface_height.cpp0000644000175000017500000010423613674426075016257 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // ------------------------------------------------------- // the surface class // ------------------------------------------------------- // Constants and types #include "age.h" #include "generator_random.h" #define DEBUG_HEIGHT 0 float surface_height_filter_interpolate(int dist_max, int *p_list_dist, float *p_list_height, int dist_num); float surface_height_filter_interpolate2(int dist_max, int *p_list_dist, float *p_list_height, int dist_num); void perlin_config::rand(tpos width, tpos height) { if(!p_array || this->width != width || this->height != height) { release(); this->width = width; this->height = height; p_array = (float *)mmalloc(sizeof(float)*width*height); } // Fill with random numbers from -1 to 1 int i; for(i = 0; i < width*height; i++) { p_array[i] = random_generator::generator_rand_0(); } } void perlin_config::release(void) { ffree(p_array); width = 0; height = 0; } perlin_config::perlin_config(void) { p_array = NULL; // Some perlin config octaves_start = 0; octaves = 30; persistence = 0.8f; } void surface_height::create(tpos width, tpos height, SURFACE_FORMAT format) { surface_sw::create(width, height, format); height_range_default(); } void surface_height::create(SURFACE *p_surf, SURFACE_FORMAT format) { surface_sw::create(p_surf, format); height_range_default(); } bool surface_height::load(const char *p_file, SURFACE_FORMAT format) { if(surface_sw::load(p_file,format)) { tpos width = width_get(); tpos height = height_get(); tpos x,y; for(y = 0; y < height; y++) { for(x = 0; x < width; x++) { tcolor *p_src = (tcolor *)pixels_get(x,y); float *p_dst = (float *)p_src; *p_dst = color_to_height(*p_src); } } height_range_default(); return(TRUE); } return(FALSE); } void surface_height::copy(class surface_height *p_src) { surface_sw::copy(p_src); pixel_height_range = p_src->pixel_height_range; } void surface_height::move(class surface_height *p_src) { surface_sw::move(p_src); pixel_height_range = p_src->pixel_height_range; } surface_height::surface_height(void) : surface_sw(PIXEL_FLOAT) { pixel_height_range = 1.0f; } surface_height::surface_height(char *p_file, SURFACE_FORMAT format_) : surface_sw(PIXEL_FLOAT) { load(p_file, format_); } surface_height::surface_height(tpos width, tpos height, SURFACE_FORMAT format_) : surface_sw(PIXEL_FLOAT) { create(width,height); } surface_height::surface_height(SURFACE_HEIGHT *p_src) : surface_sw(PIXEL_FLOAT) { copy(p_src); } // blit whole source surtace to destination surface void surface_height::blit(class surface_height *p_dst) { tpos sdx = width_get(); tpos sdy = height_get(); tpos tdx = p_dst->width_get(); tpos tdy = p_dst->height_get(); if(sdx == tdx && sdy == tdy) { p_dst->copy(this); } else { blit(0, 0, sdx, sdy, p_dst, 0, 0, tdx, tdy); } } // blit whole source surtace to destination surface_height void surface_height::blit(class surface_height *p_dst, tpos tx, tpos ty) { tpos dx = width_get(); tpos dy = height_get(); blit(0, 0, dx, dy, p_dst, tx, ty, dx, dy); } // HEIGHT_UNSET -> ignore them // blit part of source surface_height to destination surface_height void surface_height::blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_height *p_dst, tpos tx, tpos ty, tpos tdx, tpos tdy) { if(dx == tdx && dy == tdy) { int x,y; for(y = 0; y < tdy; y++) { for(x = 0; x < tdx; x++) { float height = height_get(sx+x, sy+y); p_dst->height_set(tx+x, ty+y, height); } } } else { // Scale down if(dx >= tdx && dy >= tdy) { float scale_x = (float)dx / (float)tdx; float scale_y = (float)dy / (float)tdy; tpos kernel_size_x = ceilf(scale_x); tpos kernel_size_y = ceilf(scale_y); // We want odd kernel size if(!(kernel_size_x&0x1)) { kernel_size_x++; } if(!(kernel_size_y&0x1)) { kernel_size_y++; } int *p_distances = (int *)mmalloc(sizeof(int)*kernel_size_x*kernel_size_y); float *p_heights = (float *)mmalloc(sizeof(float)*kernel_size_x*kernel_size_y); FILTER_KERNEL_FUNC *p_kernel = surface_height_filter_interpolate2; int x,y; for(y = ty; y < ty+tdy; y++) { for(x = tx; x < tx+tdx; x++) { int src_x = roundf(scale_x*x); int src_y = roundf(scale_y*y); int dist_values = height_get(src_x+kernel_size_x, src_y+kernel_size_y, kernel_size_x, kernel_size_y, p_distances, p_heights, TRUE); p_dst->height_set(x, y, p_kernel(0, p_distances, p_heights, dist_values)); } } ffree(p_distances); ffree(p_heights); } else if(dx < tdx && dy < tdy) { // Scale up float scale_x = (float)tdx/(float)dx; float scale_y = (float)tdy/(float)dy; tpos rect_dx = ceilf(scale_x); tpos rect_dy = ceilf(scale_y); int x,y; for(y = sy; y < sy+dy; y++) { for(x = sx; x < sx+dx; x++) { float hg = height_get(x,y); p_dst->fill(x*scale_x, y*scale_y, rect_dx, rect_dy, hg); } } } else { // Hm? assert(0); } } } SURFACE_HEIGHT surface_height::scale_new(int nx, int ny) { assert(nx > 0 && ny > 0); SURFACE_HEIGHT tmp(nx,ny); tpos width = width_get(); tpos height = height_get(); float fx = ((float)nx)/width, fy = ((float)ny)/height; tpos x,y; for(y = 0; y < ny; y++) { for(x = 0; x < nx; x++) { tmp.height_set(x,y,height_get(x*fx,y*fy)); } } tmp.height_range_default(); return(tmp); } void surface_height::scale(int nx, int ny) { SURFACE_HEIGHT tmp = scale_new(nx, ny); clear(); *this = tmp; } void surface_height::height_set_complex(int x, int y, float height) { float target = height_get(x,y); height_set_simple(x,y,blend(op,target,height)); } VECT surface_height::height_normal_get(int x, int y, MASK_INTERFACE *p_mask, int mask_x, int mask_y) { VECT2DI list[] = { VECT2DI( 0, 1), VECT2DI( 1, 1), VECT2DI( 1, 0), VECT2DI( 1,-1), VECT2DI( 0,-1), VECT2DI(-1,-1), VECT2DI(-1, 0), VECT2DI(-1, 1), VECT2DI( 0, 1) }; VECT vects[] = { VECT3DF( 0, 0, 1), VECT3DF( 1, 0, 1), VECT3DF( 1, 0, 0), VECT3DF( 1, 0,-1), VECT3DF( 0, 0,-1), VECT3DF(-1, 0,-1), VECT3DF(-1, 0, 0), VECT3DF(-1, 0, 1), VECT3DF( 0, 0, 1) }; int points = (int)(sizeof(list)/sizeof(list[0])); float height_current = height_get(x, y); int i; for(i = 0; i < points; i++) { tpos ax = x+list[i].x; tpos ay = y+list[i].y; if(pixel_valid(ax, ay) && (!p_mask || p_mask->mask_get(mask_x+ax,mask_y+ay))) { float height = height_get(ax, ay); vects[i].y = (height - height_current)*pixel_height_range; vects[i].norm(); } else { vects[i].set(FLOAT_UNDEFINED); } } VECT last(0); for(i = 0; i < points; i++) { if(vects[i].x != FLOAT_UNDEFINED) { last = vects[i]; break; } } if(i == points) { // return some default normal return(VECT3DF(0,-1,0)); } VECT normal(0); for(i = i+1; i < points; i++) { if(vects[i].x != FLOAT_UNDEFINED) { VECT3DF tmp = vect_mult(last, vects[i]); tmp.norm(); normal += tmp; last = vects[i]; } } normal.norm(); return(normal); } float surface_height::height_range_get(void) { return(pixel_height_range); } void surface_height::height_range_set(float range) { pixel_height_range = range; } void surface_height::height_range_default(void) { tpos width = width_get(); tpos height = height_get(); pixel_height_range = width > height ? width : height; } void surface_height::fill(float height) { tpos dx = width_get(); tpos dy = height_get(); fill(0,0,dx,dy,height); } void surface_height::fill(tpos x, tpos y, tpos dx, tpos dy, float height) { if(!pixels_get()) return; if(rect_trim(x, y, dx, dy)) { int cx, cy; for(cy = y; cy < y+dy; cy++) { float *p_pixels = (float *)pixels_get(x,cy); for(cx = x; cx < x+dx; cx++, p_pixels++) *p_pixels = height; } } } /* Height filters width and height should be odd numbers (3,5,7...) */ int surface_height::height_get(int cx, int cy, int width, int height, int *p_list_dist, float *p_list_height, bool center) { tpos x,y; tpos dx = width/2, dy = height/2; int values = 0; for(y = cy-dy; y <= cy+dy; y++) { for(x = cx-dx; x <= cx+dx; x++) { if(!pixel_valid(x, y)) { continue; } if(!center && x == cx && y == dy) { continue; } float height_current = height_get(x, y); if(height_current == HEIGHT_UNSET) { continue; } p_list_height[values] = height_current; p_list_dist[values] = square_dist(x, y, cx, cy); values++; } } return(values); } VECT2DI cross_list[] = { VECT2DI( 0, 0), VECT2DI( 0, 1), VECT2DI( 0,-1), VECT2DI( 1, 0), VECT2DI(-1, 0) }; int surface_height::height_get_cross(int cx, int cy, int *p_list_dist, float *p_list_height, bool center) { int i; int values = 0; for(i = center ? 0 : 1; i < (int)(sizeof(cross_list)/sizeof(cross_list[0])); i++) { int x = cx+cross_list[i].x, y = cy+cross_list[i].y; if(!pixel_valid(x, y)) { continue; } float height_current = height_get(x, y); if(height_current == HEIGHT_UNSET) { continue; } p_list_height[values] = height_current; p_list_dist[values] = square_dist(x, y, cx, cy); values++; } return(values); } #define MAX_DISTANCES 5 float surface_height_filter_interpolate(int dist_max, int *p_list_dist, float *p_list_height, int dist_num) { float height_current = 0; float heights[MAX_DISTANCES] = {0,0,0,0,0}; int heights_num[MAX_DISTANCES] = {0,0,0,0,0}; assert(dist_max < MAX_DISTANCES); // Save all values int i; for(i = 0; i < dist_num; i++) { int dist = p_list_dist[i]; heights[dist] += p_list_height[i]; heights_num[dist]++; } // Interpolate them int h_num = 0; for(i = 0; i < MAX_DISTANCES; i++) { if(heights_num[i] > 0) { height_current += (heights[i] / heights_num[i]); h_num++; } } height_current /= h_num; return(height_current); } float surface_height_filter_interpolate2(int dist_max, int *p_list_dist, float *p_list_height, int dist_num) { float height_current = 0; // Interpolate them int i, num = 0; for(i = 0; i < dist_num; i++) { height_current += p_list_height[i]; num++; } height_current /= num; return(height_current); } float surface_height_filter_blur(int dist_max, int *p_list_dist, float *p_list_height, int dist_num) { float height_current = 0; /* int i,pixels = 0; float diff_min = 1; float diff_max = 0; for(i = 0; i < FILTER_VECTORS-1; i++) { if(p_list_dist[i] != 0) { if(diff_min > fabs(p_list_height[i])) diff_min = fabs(p_list_height[i]); if(diff_max < fabs(p_list_height[i])) diff_max = fabs(p_list_height[i]); height_current += p_list_height[i]; pixels++; } } height_current /= pixels; //height_current += random_generator::generator_rand_0()*(diff_max-diff_min); //height_current += random_generator::generator_rand_0(); */ return(height_current); } /* height min/max - values which are replaced in the heighmap valid min/max - values which are valid (considered as ok) */ void surface_height::height_filter(tpos x, tpos y, FILTER_KERNEL_FUNC *p_kernel, bool center) { #define KERNEL_WIDTH 3 int distances[KERNEL_WIDTH*KERNEL_WIDTH]; float heights[KERNEL_WIDTH*KERNEL_WIDTH]; int dist_values = height_get(x, y, KERNEL_WIDTH, KERNEL_WIDTH, distances, heights, center); height_set(x, y, p_kernel(KERNEL_WIDTH/2, distances, heights, dist_values)); } void surface_height::height_filter(tpos x, tpos y, tpos width, tpos height, FILTER_KERNEL_FUNC *p_kernel, bool center) { if(rect_trim(x, y, width, height)) { int sx,sy; for(sy = 0; sy < height; sy++) { for(sx = 0; sx < width; sx++) { height_filter(sx+x,sy+y,p_kernel,center); } } } } void surface_height::height_fill(tpos x, tpos y, tpos width, tpos height, FILTER_KERNEL_FUNC *p_kernel) { if(rect_trim(x, y, width, height)) { int sx,sy; for(sy = 0; sy < height; sy++) { for(sx = 0; sx < width; sx++) { tpos cx = sx + x; tpos cy = sy + y; if(height_get(cx,cy) == HEIGHT_UNSET) { height_filter(cx,cy,p_kernel); } } } } } /* * Normalize the height-map to 0...1 range */ void surface_height::height_normalize(tpos sx, tpos sy, tpos width, tpos height, float value_min, float value_max) { float min = FLT_MIN; float max =-FLT_MAX; if(!rect_trim(sx, sy, width, height)) return; int x,y; for(y = sy; y < height; y++) { for(x = sx; x < width; x++) { float height = height_get(x,y); if(height == HEIGHT_UNSET) { pdebug(DEBUG_HEIGHT,"surface_height::height_normalize(), height == HEIGHT_UNSET, x = %d, y = %d", height,x,y); continue; } min = MIN(height,min); max = MAX(height,max); } } pdebug(DEBUG_HEIGHT,"heightmap_normalize: min = %f, max = %f",min,max); float range = max - min; float new_range = value_max - value_min; for(y = sy; y < height; y++) { for(x = sx; x < width; x++) { float height = height_get(x,y); if(height == HEIGHT_UNSET) { continue; } // <0,1> range height = (height - min) / range; // range height = value_min + height*new_range; pdebug(DEBUG_HEIGHT,"N: [%d, %d] -> %f",x,y,height); height_set(x,y,height); } } } void surface_height::height_normalize(void) { int width = width_get(); int height = height_get(); height_normalize(0,0,width,height); } /* * Height operations */ // blit whole source surtace to destination surface_height void surface_height::height_blit(class surface_height *p_dst, tpos tx, tpos ty, BLIT_OPERATION op) { tpos source_width = width_get(); tpos source_height = height_get(); tpos target_width = p_dst->width_get(); tpos target_height = p_dst->height_get(); if(tx+source_width > target_width) source_width = target_width-tx; if(ty+source_height <= target_height) source_height = target_height-ty; tpos x,y; for(y = 0; y < source_height; y++) { float *p_source_line = (float *)pixels_get(0,y); float *p_dest_line = (float *)p_dst->pixels_get(tx,ty+y); for(x = 0; x < source_width; x++) { *p_dest_line = *p_source_line; // TODO assert(0); p_dest_line++; p_source_line++; } } } /* * Fractal generator */ mid_point_config::mid_point_config(void) { generator_hurst = 0.6; generator_delta = 1; generator_center = 0; correction_border = FLOAT_UNDEFINED; correction_center = FLOAT_UNDEFINED; border_start_height = 0; perturbation = FLOAT_UNDEFINED; pixel_fill = TRUE; pixel_distance = 1; pixel_filter = FALSE; pixel_filter_num = 1; pixel_filter_back = FALSE; height_overwrite = FALSE; ifirst = INTERPOLATION_MID_POINT; isecond = INTERPOLATION_MID_POINT; iborder = 3; gborder = 0; } inline static float interpolate_float(float v1, float v2, float v3, float v4) { float result = 0; int num = 0; if(v1 != HEIGHT_UNSET) { result += v1; num++; } if(v2 != HEIGHT_UNSET) { result += v2; num++; } if(v3 != HEIGHT_UNSET) { result += v3; num++; } if(v4 != HEIGHT_UNSET) { result += v4; num++; } return(result / num); } inline static void range_float(float v1, float v2, float v3, float v4, float &min, float &max) { min = FLT_MAX; max = -FLT_MAX; if(v1 != HEIGHT_UNSET) { min = MIN(min,v1); max = MAX(max,v1); } if(v2 != HEIGHT_UNSET) { min = MIN(min,v2); max = MAX(max,v2); } if(v3 != HEIGHT_UNSET) { min = MIN(min,v3); max = MAX(max,v3); } if(v4 != HEIGHT_UNSET) { min = MIN(min,v4); max = MAX(max,v4); } } inline static bool interpolate_axe(float v1, float v2, float &min, float &max, float &result) { result = 0; int num = 0; if(v1 != HEIGHT_UNSET) { min = MIN(v1,min); max = MAX(v1,max); result += v1; num++; } if(v2 != HEIGHT_UNSET) { min = MIN(v2,min); max = MAX(v2,max); result += v2; num++; } if(num == 2) { result /= num; return(TRUE); } return(FALSE); } inline static bool choose_one(float v1, float v2, float v3, float v4, float &result) { if(v1 != HEIGHT_UNSET) { result = v1; return(TRUE); } if(v2 != HEIGHT_UNSET) { result = v2; return(TRUE); } if(v3 != HEIGHT_UNSET) { result = v3; return(TRUE); } if(v4 != HEIGHT_UNSET) { result = v4; return(TRUE); } return(FALSE); } /* Interpolate in two axes: v11 -> v12 v21 -> v22 */ // v11 -> v12 is more important inline static float interpolate_square(MID_POINT_CONFIG *p_config, float v11, float v12, float v21, float v22, SQUARE_INTERPOLATION_TYPE interpolation) { float result = 0; switch(interpolation) { case INTERPOLATION_MID_POINT: result = interpolate_float(v11, v12, v21, v22); break; case INTERPOLATION_LINE_MIN: case INTERPOLATION_LINE_MAX: case INTERPOLATION_LINE_CENTER: case INTERPOLATION_LINE_RANGE_HIGH: case INTERPOLATION_LINE_RANGE_LOW: case INTERPOLATION_LINE_PRIORITY_HIGH: case INTERPOLATION_LINE_PRIORITY_LOW: case INTERPOLATION_LINE_RANDOM: { float min1 = FLT_MAX; float max1 = -FLT_MAX; float min2 = FLT_MAX; float max2 = -FLT_MAX; float a1_height; bool a1 = interpolate_axe(v11, v12, min1, max1, a1_height); float a2_height; bool a2 = interpolate_axe(v21, v22, min2, max2, a2_height); if(!a1 && !a2) { bool a = choose_one(v11, v12, v21, v22, result); assert(a); } else if(a1 && a2) { switch(interpolation) { case INTERPOLATION_LINE_MIN: result = MIN(a1_height, a2_height); break; case INTERPOLATION_LINE_MAX: result = MAX(a1_height, a2_height); break; case INTERPOLATION_LINE_CENTER: { float center = interpolate_float(v11, v12, v21, v22); if(abs(center-a1_height) <= abs(center-a2_height)) { result = a1_height; } else { result = a2_height; } break; } case INTERPOLATION_LINE_PRIORITY_HIGH: result = a1_height; break; case INTERPOLATION_LINE_PRIORITY_LOW: result = a2_height; break; case INTERPOLATION_LINE_RANGE_HIGH: result = (abs(max1-min1) > abs(max2-min2)) ? a1_height : a2_height; break; case INTERPOLATION_LINE_RANGE_LOW: result = (abs(max1-min1) < abs(max2-min2)) ? a1_height : a2_height; break; case INTERPOLATION_LINE_RANDOM: result = (random_generator::generator_rand_0() > 0) ? a1_height : a2_height; break; default: break; } pdebug(DEBUG_HEIGHT,"interpolation = %d, a1_height = %f, a2_height = %f, result = %f", interpolation,a1_height,a2_height,result); } else if(a1) { result = a1_height; } else if(a2) { result = a2_height; } break; } } if(p_config->perturbation != FLOAT_UNDEFINED) { float min; float max; range_float(v11, v12, v21, v22, min, max); float range = (max - min); result += random_generator::generator_rand_0()*range*p_config->perturbation; } pdebug(DEBUG_HEIGHT,"[%f, %f, %f, %f] -> %f", v11, v12, v21, v22, result); return(result); } float surface_height::height_correction(int x, int y, float current_height, float border, float center) { int width = width_get(); int height = height_get(); if(center != FLOAT_UNDEFINED) { tpos sx = (width-1)/2, sy = (height-1)/2; if(x == sx && y == sy) return(center); } if(border != FLOAT_UNDEFINED) { tpos ex = width-1, ey = height-1; if(x == 0 || x == ex || y == 0 || y == ey) { return(border); } } return(current_height); } float surface_height::height_generate(MID_POINT_CONFIG *p_config, tpos x, tpos y, float height, int iteration) { height += random_generator_fractal::generate_height(iteration, p_config->generator_hurst, p_config->generator_center, p_config->generator_delta); height = height_correction(x, y, height, p_config->correction_border, p_config->correction_center); return(height); } /* pdebug(DEBUG_HEIGHT,"R1: [%d, %d] [%d, %d] [%d, %d] [%d, %d]", x, y-distance, x, y+distance, x-distance, y, x+distance, y); */ void surface_height::height_write(MID_POINT_CONFIG *p_config, int x, int y, float h0, float h1, float h2, float h3, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, float iteration, bool generate) { float height_center = 0; if(type == SQUARE_TYPE_1) { height_center = interpolate_square(p_config,h0,h1,h2,h3,itype); } else { height_center = interpolate_square(p_config,h2,h3,h0,h1,itype); } pdebug(DEBUG_HEIGHT,"R1: [%d, %d] -> %f", x, y, height_center); if(generate) height_center = height_generate(p_config, x, y, height_center, iteration); pdebug(DEBUG_HEIGHT,"R2: [%d, %d] -> %f", x, y, height_center); height_set(x,y,height_center); } void surface_height::height_filter(MID_POINT_CONFIG *p_config, int x, int y, float h0, float h1, float h2, float h3, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, float iteration, bool generate) { height_filter(x,y,surface_height_filter_interpolate2,FALSE); } /* SQUARE_TYPE (cross) Generate: *---1---* | | | 2---*---2 | | | *---1---* */ // Iterate height with given distance int surface_height::height_interate_cross(MID_POINT_CONFIG *p_config, int x, int y, int distance, int iteration, SQUARE_TYPE type, SQUARE_INTERPOLATION_TYPE itype, bool generate, HEIGHT_WRITE_FUNC func) { float height_center = height_get(x,y); if(p_config->height_overwrite || height_center == HEIGHT_UNSET) { int distance2 = distance+1; float y0 = height_get(x, y-distance, HEIGHT_UNSET); if(y0 == HEIGHT_UNSET) y0 = height_get(x, y-distance2, HEIGHT_UNSET); float y1 = height_get(x, y+distance, HEIGHT_UNSET); if(y1 == HEIGHT_UNSET) y1 = height_get(x, y+distance2, HEIGHT_UNSET); float x0 = height_get(x-distance, y, HEIGHT_UNSET); if(x0 == HEIGHT_UNSET) x0 = height_get(x-distance2, y, HEIGHT_UNSET); float x1 = height_get(x+distance, y, HEIGHT_UNSET); if(x1 == HEIGHT_UNSET) x1 = height_get(x+distance2, y, HEIGHT_UNSET); pdebug(DEBUG_HEIGHT,"R1: [%d, %d] [%d, %d] [%d, %d] [%d, %d]", x, y-distance, x, y+distance, x-distance, y, x+distance, y); (this->*func)(p_config, x, y, x0, x1, y0, y1, type, itype, iteration, generate); return(1); } return(0); } /* SQUARE_TYPE: *-------* | 1 | 2 | |---o---| | 2 | 1 | *-------* */ // Emit rectangle, width and height are inclusive int surface_height::height_rectangle_emit(MID_POINT_CONFIG *p_config, int x, int y, int width, int height, int iteration, SQUARE_TYPE type, HEIGHT_WRITE_FUNC func) { int iteration_target = p_config->iteration_target; int pixels = 0; int max_distance = p_config->pixel_distance; if(max_distance < 0) { max_distance = 0; } // 3x3 and bigger if(width >= max_distance && height >= max_distance) { tpos mdx = width/2, mdy = height/2; int mdx_correction = (width&0x1) ? mdx+1 : mdx; int mdy_correction = (height&0x1) ? mdy+1 : mdy; tpos mx = x + mdx, my = y + mdy; tpos dist = MIN(mdx,mdy); /* Generate corner points *-------* | | | | | | *-------* */ // Generate only when those points are undefined if(!p_config->height_overwrite && iteration == 0 && iteration_target == iteration) { float height_current = p_config->border_start_height; float height_base = p_config->border_start_height; if(p_config->border_start_height == FLOAT_UNDEFINED) { height_current = height_generate(p_config, x, y, height_base, iteration); } height_set(x,y, height_current); pixels++; if(p_config->border_start_height == FLOAT_UNDEFINED) { height_current = height_generate(p_config, x+width, y, height_base, iteration); } height_set(x+width,y, height_current); pixels++; if(p_config->border_start_height == FLOAT_UNDEFINED) { height_current = height_generate(p_config, x, y+height, height_base, iteration); } height_set(x,y+height, height_current); pixels++; if(p_config->border_start_height == FLOAT_UNDEFINED) { height_current = height_generate(p_config, x+width, y+height, height_base, iteration); } height_set(x+width,y+height, height_current); pixels++; } /* Generate center of the rectangle *-------* | | | |---o---| | | | *-------* */ if(iteration == iteration_target) { // Always overwrite this one -> it clears artifacts generated by // cross-interpolator if(1) { // Interpolate midle of the given rectangle float h0 = height_get(x,y); float h1 = height_get(x+width,y+height); float h2 = height_get(x+width,y); float h3 = height_get(x,y+height); pdebug(DEBUG_HEIGHT,"C1: [%d, %d], [%d, %d], [%d, %d], [%d, %d]", x,y, x+width,y+height, x+width,y, x,y+height); SQUARE_INTERPOLATION_TYPE itype = p_config->interpolation_get(MIN(width,height)); bool generate = p_config->generation_get(MIN(width,height)); (this->*func)(p_config, mx, my, h0, h1, h2, h3, type, itype, iteration, generate); pixels++; } return(pixels); } iteration++; /* Generate *---2---* | | | 1---*---3 | | | *---4---* Types: *---1---* | | | 2---*---2 | | | *---1---* */ if(iteration == iteration_target) { SQUARE_INTERPOLATION_TYPE itype = p_config->interpolation_get(MIN(width,height)); bool generate = p_config->generation_get(MIN(width,height)); // 1 pixels += height_interate_cross(p_config, x, my, dist, iteration, SQUARE_TYPE_2, itype, generate, func); // 2 pixels += height_interate_cross(p_config, mx, y, dist, iteration, SQUARE_TYPE_1, itype, generate, func); // 3 pixels += height_interate_cross(p_config, x+width, my, dist, iteration, SQUARE_TYPE_2, itype, generate, func); // 4 pixels += height_interate_cross(p_config, mx, y+height, dist, iteration, SQUARE_TYPE_1, itype, generate, func); return(pixels); } iteration++; /* Target areas: *-------* | 1 | 2 | |---*---| | 3 | 4 | *-------* Types: *-------* | 1 | 2 | |---*---| | 2 | 1 | *-------* */ if(iteration <= iteration_target && mdx > 0 && mdy > 0) { // 1 pixels += height_rectangle_emit(p_config, x, y, mdx, mdy, iteration, SQUARE_TYPE_1, func); // 2 pixels += height_rectangle_emit(p_config, mx, y, mdx_correction, mdy, iteration, SQUARE_TYPE_2, func); // 3 pixels += height_rectangle_emit(p_config, x, my, mdx, mdy_correction, iteration, SQUARE_TYPE_2, func); // 4 pixels += height_rectangle_emit(p_config, mx, my, mdx_correction, mdy_correction, iteration, SQUARE_TYPE_1, func); } } return(pixels); } void surface_height::generate_mid_point(MID_POINT_CONFIG *p_config, int x, int y, int width, int height) { fill(x, y, width, height, HEIGHT_UNSET); // Generate the heightmap p_config->height_overwrite = FALSE; int j; for(j = 0; ; j++) { p_config->iteration_target = j; if(!height_rectangle_emit(p_config, x, y, width-1, height-1, 0, SQUARE_TYPE_1, &surface_height::height_write)) break; } // Filter back some patterns, if required if(p_config->pixel_filter_back) { p_config->height_overwrite = TRUE; for(j = 0; ; j++) { p_config->iteration_target = j; if(!height_rectangle_emit(p_config, x, y, width-1, height-1, 0, SQUARE_TYPE_1, &surface_height::height_filter)) break; } } // Fill missing pixels if(p_config->pixel_fill) { height_fill(x, y, width, height, surface_height_filter_interpolate2); } // Filter if(p_config->pixel_filter) { int i; for(i = 0; i < p_config->pixel_filter_num; i++) { height_filter(x, y, width, height, surface_height_filter_interpolate2); } } // Normalize the result height_normalize(x, y, width, height); } void surface_height::generate_mid_point(MID_POINT_CONFIG *p_config) { int width = width_get(); int height = height_get(); generate_mid_point(p_config, 0, 0, width, height); } void surface_height::generate_perlin(PERLIN_CONFIG *p_config, int sx, int sy, int width, int height) { int x,y; for(y = sy; y < height; y++) { for(x = sx; x < width; x++) { height_set(x,y,p_config->perlin_get(x, y)); } } // Normalize the result height_normalize(sx, sy, width, height); } void surface_height::generate_perlin(PERLIN_CONFIG *p_config) { int width = width_get(); int height = height_get(); generate_perlin(p_config, 0, 0, width, height); } berusky2-0.12/src/age/graph/object_scene.h0000644000175000017500000001220113674426075015355 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Basic scene geometry object */ class scene_object; typedef class scene_object SCENE_OBJECT; typedef class scene_object : public object_hierarchy { public: void print(int ident = 0); /* * Selection helpers */ public: virtual void select(void); virtual void unselect(void); /* * Scene hierarchy for position/rendering */ public: /* * Is the mesh in render hierrachy? */ bool is_render_hierarchy(void); /* * Insert/Reparent mesh to scene render hierarchy * mesh will be rendered after it. * It's base on the mesh parrent name. */ bool render_hierarchy_insert(const char *p_parent_name); bool render_hierarchy_insert(SCENE_OBJECT *p_parent); /* * Remove mesh from render hierarchy, * it will not be rendered any more. */ bool render_hierarchy_remove(void); /* * Searches for object it sub-tree of this object */ SCENE_OBJECT * render_hierarchy_find(const char *p_name); /* * Get siblings (objects on the same level) */ SCENE_OBJECT * render_hierarchy_sibling_get(void); SCENE_OBJECT * render_hierarchy_sibling_last_get(void); /* * Get first and last chold of this object * Seek between childs with render_hierarchy_sibling_get() */ SCENE_OBJECT * render_hierarchy_child_get(void); SCENE_OBJECT * render_hierarchy_child_last_get(void); /* * Get parent of this object */ SCENE_OBJECT * render_hierarchy_parent_get(void); /* * Next-in-flow object */ OBJECT_HIERARCHY_ITERATOR render_hierarchy_next_new(void); SCENE_OBJECT * render_hierarchy_next(OBJECT_HIERARCHY_ITERATOR *p_it); public: bool is_render_hierarchy_root(void); private: void render_hierarchy_root_set(void); void render_hierarchy_root_clear(void); public: scene_object(SCENE *p_scene) : object_hierarchy(p_scene) { } } SCENE_OBJECT; /* * Basic list of scene objects */ typedef class scene_object_list : public object_list_head { public: scene_object_list(SCENE *p_scene) : object_list_head(p_scene) { } } SCENE_OBJECT_LIST; /* * Hierarchy tree of scene objects */ #define ROOT_NAME "###ROOT###" typedef class scene_object_tree : public scene_reference { /* Special "root" scene object - root of all objects i.e.: super-root :) */ SCENE_OBJECT root; public: SCENE_OBJECT * get_root(void) { return(&root); } bool hierarchy_insert(SCENE_OBJECT *p_obj, SCENE_OBJECT *p_parent); bool hierarchy_insert(SCENE_OBJECT *p_obj, const char *p_parent_name = NULL); bool hierarchy_remove(SCENE_OBJECT *p_obj); public: SCENE_OBJECT * hierarchy_find(const char *p_name) { return(root.render_hierarchy_find(p_name)); } SCENE_OBJECT * hierarchy_find_child(const char *p_name) { SCENE_OBJECT *p_obj = root.render_hierarchy_find(p_name); if(p_obj) { return((SCENE_OBJECT *)p_obj->render_hierarchy_child_get()); } return(NULL); } SCENE_OBJECT * hierarchy_find_parent(const char *p_name) { SCENE_OBJECT *p_obj = root.render_hierarchy_find(p_name); if(p_obj) { return((SCENE_OBJECT *)p_obj->render_hierarchy_parent_get()); } return(NULL); } public: SCENE_OBJECT * hierarchy_next(OBJECT_HIERARCHY_ITERATOR *p_it) { return((SCENE_OBJECT *)root.render_hierarchy_next(p_it)); } OBJECT_HIERARCHY_ITERATOR hierarchy_next_new(SCENE_OBJECT *p_start = NULL) { if(!p_start) { p_start = root.render_hierarchy_child_get(); if(!p_start) { return(OBJECT_HIERARCHY_ITERATOR(NULL)); } } return(p_start->render_hierarchy_next_new()); } public: void print(const char *p_title = NULL); public: scene_object_tree(SCENE *p_scene) : scene_reference(p_scene), root(p_scene) { root.name_set(ROOT_NAME); root.hierarchy_root_set(); } } SCENE_OBJECT_TREE; berusky2-0.12/src/age/graph/age.cpp0000644000175000017500000000272513674426075014033 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" // ------------------------------------------------------- // Global interfaces // ------------------------------------------------------- berusky2-0.12/src/age/graph/surface_mask.cpp0000644000175000017500000000253613674426075015742 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Constants and types #include "age.h" berusky2-0.12/src/age/graph/object_mark.h0000644000175000017500000000524413674426075015223 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Object marking */ #ifndef __OBJECT_MARK_H__ #define __OBJECT_MARK_H__ /* * Global object marks */ /* * MARK_CREATED has all recently created objects. */ #define MARK_CREATED (1<<0) /* * MARK_RENDERER_HIERARCHY has objects which are placed in scene rendering tree * (and rendered if they don't have MARK_RENDERER_DISABLED mark set) */ #define MARK_RENDERER_HIERARCHY (1<<1) /* * Object with MARK_RENDERER_DISABLED mark are not rendered */ #define MARK_RENDERER_DISABLED (1<<2) /* * MARK_SELECTED has all objects which are selected by scene selection */ #define MARK_SELECTED (1<<3) /* * MARK_CREATED_BY_GENERATOR has all objects which have been created * by editor generator. Those objects are removed during the clean-up phase */ #define MARK_CREATED_BY_GENERATOR (1<<4) typedef class object_mark : public object_name { int iflag; public: bool mark_get(int mark) { return(iflag&mark); } void mark_set(int mark) { iflag |= mark; } void mark_clear(int mark) { iflag &= ~mark; } private: void mark_set_all(void) { iflag = 0; iflag = ~iflag; } void mark_clear_all(void) { iflag = 0; } public: object_mark(void) { mark_clear_all(); mark_set(MARK_CREATED); } } OBJECT_MARK; #endif // __OBJECT_MARK_H__ berusky2-0.12/src/age/graph/object_render_list.cpp0000644000175000017500000000262013674426075017131 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "defs.h" #include "typ.h" #include "llist.h" #include "object_render_list.h" berusky2-0.12/src/age/graph/age.h0000644000175000017500000000732013674426075013474 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Main include file */ #ifndef __AGE_H__ #define __AGE_H__ #include #include #include #include #include // Defines for linux/windows #include "compatibility.h" // Constants and types #include "defs.h" #include "defs_config.h" #include "typ.h" #include "typ_graph.h" #include "floats.h" #include "ferguson.h" // Service routines #include "log.h" #include "utils.h" #include "mem_alloc.h" #include "ini.h" #include "flag.h" #include "lock.h" #include "change.h" #include "array.h" #include "barray.h" // Extended types #include "color_helpers.h" #include "color.h" #include "color_hsv.h" #include "vector.h" #include "polar.h" #include "quat.h" #include "matrix.h" #include "matrix_notified.h" #include "matrix_animated.h" #include "intersect.h" // OpenGL includes #include "opengl.h" #include "gext.h" #include "vertex_arrays.h" #include "glwrapper.h" #include "texture_unit.h" // Helper types #include "mtree.h" #include "mtree_named.h" #include "btree.h" #include "llist.h" #include "llist_named.h" #include "stack.h" // Basic graphics #include "camera_interface.h" #include "world_interface.h" #include "gpipe.h" #include "surface.h" #include "surface_sdl.h" #include "surface_sw.h" #include "surface_mask.h" #include "surface_height.h" #include "alpha.h" // Bounding boxes #include "box.h" #include "aabb.h" #include "obb.h" // Normals #include "normals.h" // Lighting #include "lighting.h" #include "scene_reference.h" // Basic scene classes #include "object_base.h" #include "object_name.h" #include "object_mark.h" #include "object_select.h" #include "object_list.h" #include "object_hierarchy.h" #include "object_scene.h" // Extended object classes #include "object_world.h" #include "object_box.h" #include "object_transformation.h" #include "object_geometry.h" // Animations #include "animation_track.h" #include "animation_track_linear.h" #include "animation_track_bezier.h" #include "animation_time.h" #include "animation.h" // Main scene classes #include "camera.h" #include "material_texture.h" #include "material.h" #include "mesh.h" #include "draw.h" // Scene class #include "selection.h" #include "scene.h" #include "scene_import_b2m.h" #include "scene_import_3ds.h" #include "scene_import_txt.h" #include "print.h" // Main engine class #include "graph3d.h" // Loop/events #include "timer.h" #include "input.h" #include "age_main.h" #endif //__AGE_H__ berusky2-0.12/src/age/graph/camera_interface.cpp0000644000175000017500000003034313674426075016544 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" int camera_interface::global_screen_width = 0; int camera_interface::global_screen_height = 0; void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, VECT *p_position, VECT *p_target, float roll) { VECT x,y,z; z = *p_target - *p_position; z.norm(); y.x = y.z = 0.0f; y.y = 1.0f; x = vect_mult(y,z); x.norm(); y = vect_mult(z,x); y.norm(); p_camera->_14 = p_camera->_24 = p_camera->_34 = 0.0f; p_camera->_44 = 1.0f; p_camera->_41 = p_camera->_42 = p_camera->_43 = 0.0f; p_camera->_11 = x.x; p_camera->_21 = x.y; p_camera->_31 = x.z; p_camera->_12 = y.x; p_camera->_22 = y.y; p_camera->_32 = y.z; p_camera->_13 = z.x; p_camera->_23 = z.y; p_camera->_33 = z.z; matrix_translate(p_camera,-p_position->x,-p_position->y,-p_position->z); if(roll != 0.0f) { GLMATRIX m; matrix_rotation_z(&m, roll); matrix_mult(p_camera,&m,p_camera); } matrix_invert(p_camera, p_camera_invert); } void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, VECT *p_target, QUAT *p_rotation, float distance) { matrix_translation(p_camera_invert,p_target); matrix_rotation_set(p_camera_invert,p_rotation); matrix_translate(p_camera_invert,0,0,-distance); matrix_invert(p_camera_invert,p_camera); } void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_rotation_matrix, float elevation, float distance) { GLMATRIX m; m = *p_rotation_matrix; matrix_rotate_x(&m,elevation); matrix_translate(&m,0,0,-distance); matrix_invert(&m,p_camera); } void camera_calc(GLMATRIX *p_camera, GLMATRIX *p_camera_invert, VECT *p_target, float rotation, float elevation, float distance) { matrix_translation(p_camera_invert,p_target); matrix_rotate_y(p_camera_invert,rotation); matrix_rotate_x(p_camera_invert,elevation); matrix_translate(p_camera_invert,0,0,-distance); matrix_invert(p_camera_invert,p_camera); } void camera_calc_rotation(GLMATRIX *p_camera, GLMATRIX *p_rotation_matrix, float elevation, float distance) { *p_rotation_matrix = *p_camera; matrix_translate(p_rotation_matrix,0,0,distance); matrix_rotate_x(p_rotation_matrix,-elevation); } camera_interface::camera_interface(void) { // Init screen sizes camera_screen_width = 0; camera_screen_height = 0; // Init viewport view_relative_set(0,0,1,1); // Init projection interface projection_set(DEG2RAD(DEFAULT_PROJECTION_ANGLE), DEFAULT_PROJECTION_NEAR_PLANE, DEFAULT_PROJECTION_FAR_PLANE); projection_update(); // Init camera interface camera.init(); camera_invert.init(); projection_needs_update = FALSE; camera_projection_needs_update = FALSE; camera_change_clear(); //plane_auto_adjust = TRUE; plane_auto_adjust = FALSE; } bool camera_interface::camera_to_screen_normal(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; /* * Transform from camera space to normalized coordinates [-1, 1]: */ matrix_transformate(&x,&y,&z,&w,projection_get()); if(w == 0.0f) return(FALSE); p_vect->x = x/w; p_vect->y = y/w; p_vect->z = z/w; return(TRUE); } void camera_interface::camera_to_screen_normal(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { if(!camera_to_screen_normal(p_vect)) { p_vect->set(FLT_MAX); } } } void camera_interface::screen_normal_to_camera(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; /* * Transform normalized coordinates [-1, 1] to camera space: */ matrix_transformate(&x,&y,&z,&w,projection_inverted_get()); p_vect->x = x/w; p_vect->y = y/w; p_vect->z = z/w; } void camera_interface::screen_normal_to_camera(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { screen_normal_to_camera(p_vect); } } // Convert vectors from/to normalized form void camera_interface::screen_to_screen_normal(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; /* Shrink x/y screen coordinates to normalized range [-1, 1]: [view_x, view_dx] => x[-1, 1] [view_y, view_dy] => y[-1, 1] */ tpos vx = view_x_get(); tpos vy = view_y_get(); tpos vdx = view_width_get(); tpos vdy = view_height_get(); p_vect->x = (x-vx)/(vdx>>1) - 1; p_vect->y = 1 - (y-vy)/(vdy>>1); /* Shrink z screen coordinates to normalized range [-1, 1]: [plane_near, plane_far] => z[-1, 1] */ float z_range = (plane_far-plane_near)*0.5f; p_vect->z = (z-plane_near)/z_range - 1; } void camera_interface::screen_to_screen_normal(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { screen_to_screen_normal(p_vect); } } void camera_interface::screen_normal_to_screen(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; /* [x,y,z] are normalized to [-1, 1] */ tpos vx = view_x_get(); tpos vy = view_y_get(); tpos vdx = view_width_get(); tpos vdy = view_height_get(); int x_c = vdx >> 1; int y_c = vdy >> 1; float y_z = (plane_far-plane_near)*0.5f; /* Extend x/y screen coordinates: x[-1, 1] => [view_x, view_dx] y[-1, 1] => [view_y, view_dy] */ p_vect->x = ftoi(x_c*(x+1))+vx; p_vect->y = ftoi(y_c*(1-y))+vy; /* Extend z screen coordinates: z[-1, 1] => [plane_near, plane_far] */ p_vect->z = y_z*(z+1)+plane_near; } void camera_interface::screen_normal_to_screen(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { screen_normal_to_screen(p_vect); } } // Convert vectors bool camera_interface::world_to_screen_normal_clip(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; matrix_transformate(&x,&y,&z,&w,camera_project_get()); if(w == 0.0f) { p_vect->x = p_vect->y = p_vect->z = FLT_MAX; return(FALSE); } bool ret = (-w <= z && z <= w && -w <= x && x <= w && -w < y && y <= w); p_vect->x = x/w; p_vect->y = y/w; p_vect->z = z/w; return(ret); } void camera_interface::world_to_screen_normal_clip(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { if(!world_to_screen_normal_clip(p_vect)) { p_vect->set(FLT_MAX); } } } // Convert vectors from/to screen bool camera_interface::world_to_screen_normal(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; matrix_transformate(&x,&y,&z,&w,camera_project_get()); if(w == 0.0f) return(FALSE); p_vect->x = x/w; p_vect->y = y/w; p_vect->z = z/w; return(TRUE); } void camera_interface::world_to_screen_normal(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { if(!world_to_screen_normal(p_vect)) { p_vect->set(FLT_MAX); } } } // 2D -> 3D transformation void camera_interface::screen_normal_to_world(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; /* Transform normalized coordinates [-1, 1] to world space: */ matrix_transformate(&x,&y,&z,&w,camera_project_inverted_get()); p_vect->x = x/w; p_vect->y = y/w; p_vect->z = z/w; } void camera_interface::screen_normal_to_world(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { screen_normal_to_world(p_vect); } } bool camera_interface::world_to_screen(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; /* Calculate Z coordinate -> we want to know real (not transformed) Z depth */ GLMATRIX *p_cam = camera_get(); p_vect->z = p_cam->_13*x + p_cam->_23*y + p_cam->_33*z + p_cam->_43; /* Calculate X/Y coordinates */ matrix_transformate(&x,&y,&z,&w,camera_project_get()); if(w == 0.0f) { p_vect->x = p_vect->y = p_vect->z = FLT_MAX; return(FALSE); } bool ret = (-w <= z && z <= w && -w <= x && x <= w && -w < y && y <= w); x = x/w; y = y/w; z = z/w; /* [x,y,z] are transformed and normalized to [-1, 1] */ /* Extend x/y screen coordinates: x[-1, 1] => [view_x, view_dx] y[-1, 1] => [view_y, view_dy] */ tpos vx = view_x_get(); tpos vy = view_y_get(); tpos vdx = view_width_get(); tpos vdy = view_height_get(); int x_c = vdx >> 1; int y_c = vdy >> 1; p_vect->x = ftoi(x_c*(x+1))+vx; p_vect->y = ftoi(y_c*(1-y))+vy; return(ret); } void camera_interface::world_to_screen(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { if(!world_to_screen(p_vect)) { p_vect->set(FLT_MAX); } } } bool camera_interface::world_to_screen(VECT *p_vect, VECT2DI *p_vect_out) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; /* Calculate X/Y coordinates */ matrix_transformate(&x,&y,&z,&w,camera_project_get()); if(w == 0.0f) { p_vect->set(FLT_MAX); return(FALSE); } bool ret = (-w <= z && z <= w && -w <= x && x <= w && -w < y && y <= w); x = x/w; y = y/w; z = z/w; /* [x,y,z] are transformed and normalized to [-1, 1] */ /* Extend x/y screen coordinates: x[-1, 1] => [view_x, view_dx] y[-1, 1] => [view_y, view_dy] */ tpos vx = view_x_get(); tpos vy = view_y_get(); tpos vdx = view_width_get(); tpos vdy = view_height_get(); int x_c = vdx >> 1; int y_c = vdy >> 1; p_vect_out->x = (tpos)(x_c*(x+1))+vx; p_vect_out->y = (tpos)(y_c*(1-y))+vy; return(ret); } void camera_interface::world_to_screen(VECT *p_vect, int num, VECT2DI *p_vect_out) { int i; for(i = 0; i < num; i++, p_vect++, p_vect_out++) { if(!world_to_screen(p_vect,p_vect_out)) { p_vect_out->set(INT_MAX); } } } // 2D -> 3D transformation void camera_interface::screen_to_world(VECT *p_vect) { float x = p_vect->x; float y = p_vect->y; float z = p_vect->z; float w = 1; /* Shrink x/y screen coordinates to normalized range [-1, 1]: [view_x, view_dx] => x[-1, 1] [view_y, view_dy] => y[-1, 1] */ tpos vx = view_x_get(); tpos vy = view_y_get(); tpos vdx = view_width_get(); tpos vdy = view_height_get(); x = (x-vx)/(vdx>>1) - 1; y = 1 - (y-vy)/(vdy>>1); /* Shrink z screen coordinates to normalized range [-1, 1]: [plane_near, plane_far] => z[-1, 1] We want to preserve original Z value from 3D space so we transform Z from 3D to 2D: Z2d = Z3d*_33+W3d*_43 W2d = Z3d*_34+W3d*_44 Z = Z2d / W2d; And then this 2D Z coordinate to back to 3D space: */ GLMATRIX *p_cp = projection_get(); z = p_cp->_33+p_cp->_43/z; /* Transform normalized coordinates [-1, 1] to world space: */ matrix_transformate(&x,&y,&z,&w,camera_project_inverted_get()); p_vect->x = x/w; p_vect->y = y/w; p_vect->z = z/w; } void camera_interface::screen_to_world(VECT *p_vect, int num) { int i; for(i = 0; i < num; i++, p_vect++) { screen_to_world(p_vect); } } berusky2-0.12/src/age/graph/print.h0000644000175000017500000001362013674426075014074 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Derived from: */ /* * This code was created by Jeff Molofee '99 * (ported to Linux/SDL by Ti Leggett '01) * * If you've found this code useful, please let me know. * * Visit Jeff at http://nehe.gamedev.net/ * * or for port-specific comments, questions, bugreports etc. * email to leggett@eecs.tulane.edu */ #ifndef __GRF_PRINT_H__ #define __GRF_PRINT_H__ #define FONT_WIDTH 12 #define FONT_HEIGHT 18 typedef class grf_print { GLuint base; /* Base Display List For The Font Set */ RGBB color_text; RGBB color_back; public: void font_color_set(RGBB color) { color_text = color; } public: void font_create(void); void font_destroy(void); public: int font_width_get(void) { return(FONT_WIDTH); } int font_height_get(void) { return(FONT_HEIGHT); } int string_width_get(char *p_string) { return(strlen(p_string)*font_width_get()); } int string_height_get(char *p_string) { return(font_height_get()); } public: void print_line(RGBB color, int x, int y, const char *p_text); void print_line(int x, int y, const char *fmt); void print(int x, int y, const char *fmt,...); public: grf_print(void) { base = 0; color_text.set(0xff,0xff,0xff); } ~grf_print(void) { } } GRF_PRINT; /* * Graphics console */ typedef class grf_console : public grf_print { /* * Console origin */ VECT2DI origin; /* * Console cursor */ VECT2DI cursor; private: void cursor_reset(void) { cursor.set(); } void cursor_new_line(void) { cursor.x = 0; cursor.y += font_height_get(); } /* * Console text buffer */ private: char **p_buffer; int buffer_line_num; int buffer_line_width; private: int buffer_line_first; int buffer_line_last; private: int line_next(int line) { return((line+1) % buffer_line_num); } public: void clear(void) { buffer_line_first = buffer_line_last = 0; } bool empty(void) { return(buffer_line_first == buffer_line_last); } bool full(void) { return(line_next(buffer_line_last) == buffer_line_first); } void scroll(void) { if(!empty()) { buffer_line_first = line_next(buffer_line_first); } } void scroll_if_full(void) { if(full()) { buffer_line_first = line_next(buffer_line_first); } } private: void print_to_buffer(char *fmt); public: void print_line(char *fmt); void print(const char *fmt,...); public: void draw(void); public: void origin_set(VECT2DI *p_origin) { if(p_origin) { origin.x = p_origin->x*font_width_get(); origin.y = p_origin->y*font_height_get(); } else origin.set(); } void origin_set(int x, int y) { origin.x = x*font_width_get(); origin.y = y*font_height_get(); } public: grf_console(int text_width = 20, int text_lines = 10, VECT2DI *p_origin = NULL) { // set up position origin_set(p_origin); cursor.set(); // Set up buffer assert(text_lines > 0); buffer_line_num = text_lines; buffer_line_width = text_width; buffer_line_last = 0; buffer_line_first = 0; p_buffer = (char **)mmalloc(sizeof(p_buffer[0])*buffer_line_num); int i; for(i = 0; i < buffer_line_num; i++) p_buffer[i] = (char *)mmalloc(sizeof(p_buffer[0][0])*(buffer_line_width+1)); } ~grf_console(void) { int i; for(i = 0; i < buffer_line_num; i++) ffree(p_buffer[i]); ffree(p_buffer); } } GRF_CONSOLE; typedef class grf_console_interface { GRF_CONSOLE console; public: void console_font_color_set(RGBB color) { console.font_color_set(color); } public: void console_clear(void) { console.clear(); } public: void console_print(const char *fmt,...); void console_print(int x, int y, const char *fmt,...); void console_print(RGBB color, int x, int y, const char *fmt,...); public: void console_draw(void) { console.draw(); } public: void console_origin_set(VECT2DI *p_origin) { console.origin_set(p_origin); } void console_origin_set(int x, int y) { console.origin_set(x, y); } public: void console_font_create(void) { console.font_create(); } void console_font_destroy(void) { console.font_destroy(); } public: grf_console_interface(int text_width = 20, int text_lines = 10, VECT2DI *p_origin = NULL) : console(text_width,text_lines, p_origin) { } } GRF_CONSOLE_INTERFACE; #endif // __GRF_PRINT_H__ berusky2-0.12/src/age/graph/ferguson.h0000644000175000017500000000523413674426075014572 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Basic Ferguson splines implementation */ #ifndef __FERGUSON_H__ #define __FERGUSON_H__ typedef enum { CLASS_IN = 1, // a: incoming case CLASS_OUT = -1 // b: outgoing case } FERGUSON_KEY_CLASS, BEZIER_KEY_CLASS; template vect ferguson_tangent(vect p0, vect p1, vect p2) { vect g1 = p1 - p0; vect g2 = p2 - p1; vect g3 = g2 - g1; return(g1 + g3*0.5f); } template vect ferguson_tangent(vect p0, vect p1, vect p2, FERGUSON_KEY_CLASS key_class, float bias, float continuity, float tension) { vect g1 = (p1 - p0)*(1.0f+bias); vect g2 = (p2 - p1)*(1.0f-bias); vect g3 = g2 - g1; return(g1 + g3*(0.5f + key_class*0.5f*continuity))*(1.0f-tension); } template vect ferguson_interpolate(vect v0, vect p0, vect v1, vect p1, float t) { if(t < 0) { return(p0); } else if(t > 1) { return(p1); } else { float t2 = t*t, t3 = t2*t; float F1 = 2*t3-3*t2+1; float F2 = t3-2*t2+t; float F3 = -2*t3+3*t2; float F4 = t3-t2; return(p0*F1 + v0*F2 + p1*F3 + v1*F4); } } #endif // __FERGUSON_H__ berusky2-0.12/src/age/graph/scene_import_txt.h0000644000175000017500000000303313674426075016323 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SCENE_IMPORT_TXT_H__ #define __SCENE_IMPORT_TXT_H__ bool scene_import_txt(SCENE *p_scene, char *p_dir, char *p_file); bool scene_export_txt(SCENE *p_scene, char *p_dir, char *p_file); #endif // __SCENE_IMPORT_TXT_H__ berusky2-0.12/src/age/graph/animation.cpp0000644000175000017500000000254213674426075015253 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Animation interface */ #include "age.h" berusky2-0.12/src/age/graph/gext.h0000644000175000017500000002016413674426075013710 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ ** * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __GEXT_H__ #define __GEXT_H__ typedef class gl_ext { /* * Extensions */ public: static bool extlist_blend_color; static bool extlist_blend_minmax; static bool extlist_fog_coord; static bool extlist_fence; static bool extlist_register_combiners; static bool extlist_text_compresion; static bool extlist_text_sharp; static bool extlist_text_edge_clamp; static bool extlist_text_env_combine; static bool extlist_text_env_dot3; static bool extlist_text_filter_anisotropic; static bool extlist_vertex_array_range; static bool extlist_vertex_array; static bool extlist_indicie_array; static bool extlist_vertex_array_packed; static bool extlist_clip_volume_hit; static bool extlist_ati_env_bump; static bool extlist_ati_env_bump_unit[6]; static bool extlist_ati_vertex_array_object; static bool extlist_ati_element_array; static bool extlist_ati_pn_triangles; static bool extlist_arb_vertex_buffer; static bool extlist_ati_draw_buffers; private: bool gl_init_multitexture(void); bool gl_init_blend_color(void); bool gl_init_blend_minmax(void); bool gl_init_fog_coord(void); bool gl_init_secondary_color(void); bool gl_init_fence(void); bool gl_init_texture_compression(void); bool gl_init_texture_lod(void); bool gl_init_clip_volume_hit(void); bool gl_init_text_edge_clamp(void); bool gl_init_text_env_combine(void); bool gl_init_text_env_dot3(void); bool gl_init_ati_env_bump(void); bool gl_init_vertex_array_object(void); bool gl_init_element_array(void); bool gl_init_register_combiners(void); bool gl_init_vertex_array_range(void); bool gl_init_vertex_array_packed(void); bool gl_init_ati_pn_triangles(void); bool gl_init_text_filter_anisotropic(void); bool gl_init_ati_draw_buffers(void); bool gl_init_arb_vertex_buffer(void); public: static int ext_multitext_units; static GLint ext_multitexture_text_index[]; public: void init_extension(void); private: char *p_vend; char *p_rend; char *p_ver; char **p_ext; int extnum; public: void load_extension(void); void free_extension(void); bool is_extension(const char *p_text); } GL_EXT; extern GL_EXT glext; extern PFNGLBLENDCOLOREXTPROC glBlendColorEXT; extern PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT; extern PFNGLFOGCOORDDEXTPROC glFogCoorddEXT; extern PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT; extern PFNGLFOGCOORDFEXTPROC glFogCoordfEXT; extern PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT; extern PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT; extern PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3bEXT; extern PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bvEXT; extern PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3dEXT; extern PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dvEXT; extern PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3fEXT; extern PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT; extern PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3iEXT; extern PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3ivEXT; extern PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3sEXT; extern PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3svEXT; extern PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ubEXT; extern PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXT; extern PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3uiEXT; extern PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uivEXT; extern PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3usEXT; extern PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usvEXT; extern PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT; extern PFNGLGENFENCESNVPROC glGenFencesNV; extern PFNGLDELETEFENCESNVPROC glDeleteFencesNV; extern PFNGLSETFENCENVPROC glSetFenceNV; extern PFNGLTESTFENCENVPROC glTestFenceNV; extern PFNGLFINISHFENCENVPROC glFinishFenceNV; extern PFNGLISFENCENVPROC glIsFenceNV; extern PFNGLGETFENCEIVNVPROC glGetFenceivNV; extern PFNGLTEXBUMPPARAMETERIVATIPROC glTexBumpParameterivATI; extern PFNGLTEXBUMPPARAMETERFVATIPROC glTexBumpParameterfvATI; extern PFNGLGETTEXBUMPPARAMETERIVATIPROC glGetTexBumpParameterivATI; extern PFNGLGETTEXBUMPPARAMETERFVATIPROC glGetTexBumpParameterfvATI; extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; extern PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI; extern PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI; extern PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI; extern PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI; extern PFNGLARRAYOBJECTATIPROC glArrayObjectATI; extern PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI; extern PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI; extern PFNGLVARIANTARRAYOBJECTATIPROC glVariantArrayObjectATI; extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI; extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI; extern PFNGLELEMENTPOINTERATIPROC glElementPointerATI; extern PFNGLDRAWELEMENTARRAYATIPROC glDrawElementArrayATI; extern PFNGLDRAWRANGEELEMENTARRAYATIPROC glDrawRangeElementArrayATI; extern PFNGLCOMBINERPARAMETERFVNVPROC glCombinerParameterfvNV; extern PFNGLCOMBINERPARAMETERFNVPROC glCombinerParameterfNV; extern PFNGLCOMBINERPARAMETERIVNVPROC glCombinerParameterivNV; extern PFNGLCOMBINERPARAMETERINVPROC glCombinerParameteriNV; extern PFNGLCOMBINERINPUTNVPROC glCombinerInputNV; extern PFNGLCOMBINEROUTPUTNVPROC glCombinerOutputNV; extern PFNGLFINALCOMBINERINPUTNVPROC glFinalCombinerInputNV; extern PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC glGetCombinerInputParameterfvNV; extern PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC glGetCombinerInputParameterivNV; extern PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC glGetCombinerOutputParameterfvNV; extern PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC glGetCombinerOutputParameterivNV; extern PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC glGetFinalCombinerInputParameterfvNV; extern PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC glGetFinalCombinerInputParameterivNV; extern PFNGLFLUSHVERTEXARRAYRANGENVPROC glFlushVertexArrayRangeNV; extern PFNGLVERTEXARRAYRANGENVPROC glVertexArrayRangeNV; extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT; extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT; extern PFNGLPNTRIANGLESIATIPROC glPNTrianglesiATI; extern PFNGLPNTRIANGLESFATIPROC glPNTrianglesfATI; extern PFNGLBINDBUFFERARBPROC glBindBufferARB; extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; extern PFNGLISBUFFERARBPROC glIsBufferARB; extern PFNGLBUFFERDATAARBPROC glBufferDataARB; extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; extern PFNGLMAPBUFFERARBPROC glMapBufferARB; extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; #endif // __GEXT_H__ berusky2-0.12/src/age/graph/animation_track_bezier.cpp0000644000175000017500000004152413674426075020002 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" int anim_track_bezier::key_get_internal(int time) { ANIM_KEY *p_tmp; int l,p,s; l = 0; p = keynum_get(); while(l != p) { s = l+((p-l)>>1); p_tmp = key_get(s); if(p_tmp->time == time) return(s); else { if(time > p_tmp->time) { p_tmp = key_get(s+1); if(time < p_tmp->time) return(s); else l = s; } else p = s; } } return(NO_KEY); } int anim_track_bezier::key_get_time(int time) { assert(track_get()); int keynum = keynum_get(); if(keynum == 0) { return(NO_KEY); } else if(keynum < 6) { int i; for(i = 0; i < keynum; i++) if(time == key_get(i)->time) return(i); return(NO_KEY); } else { if(time < key_get(0)->time || time > key_get(keynum-1)->time) return(NO_KEY); return(key_get_internal(time)); } } KEY_TYPE anim_track_bezier::key_get_time(int time, int *p_kn, int *p_kn1, float *p_time) { int keynum = keynum_get(); int start,stop,k1; int dop,intrv; int t1,t2; k1 = keynum-1; start = key_get(0)->time; stop = key_get(k1)->time; int endtime = length_get(); if(flag_get(FLAG_TRACK_LOOP) && time > 2*endtime) { time = endtime + time%endtime; } if(time < start) { if(flag_get(FLAG_TRACK_LOOP)) { *p_kn = k1; *p_kn1 = 0; dop = endtime-stop; intrv = dop+start; *p_time = (intrv > DELTA_INTERVAL) ? (float)(time+dop)/(float)intrv : 0.0f; return(KEYS_ALL); } else { *p_kn = 0; return(KEYS_ONE); } } else if(time >= stop) { if(flag_get(FLAG_TRACK_LOOP)) { *p_kn = k1; *p_kn1 = 0; intrv = (endtime-stop)+start; *p_time = (intrv > DELTA_INTERVAL) ? (float)(time-stop)/(float)intrv : 0.0f; return(KEYS_ALL); } else { *p_kn = k1; return(KEYS_ONE); } } else { if(keynum == 2) { *p_kn = 0; *p_kn1 = 1; t1 = key_get(0)->time; t2 = key_get(1)->time; } else { *p_kn = key_get_internal(time); *p_kn1 = (*p_kn)+1; t1 = key_get(*p_kn)->time; t2 = key_get(*p_kn1)->time; } *p_time = (float)(time-t1)/(float)(t2-t1); return(KEYS_ALL); } } VECT * anim_track_bez_vect::tangent(int kn, BEZIER_KEY_CLASS key_class, VECT *p_tn) { int kn_1 = kn-1, // key k(n-1) kn1 = kn+1; // key k(n+1) float bias,continuity,tension,tmp,tmp2; VECT *p_p0,*p_p1,*p_p2, t1, g1,g2,g3; bias = p_track[kn].bias; continuity = p_track[kn].continuity; tension = p_track[kn].tension; if(!kn) { //kn = 0, zacatek - mam p(n), p(n+1) p_p1 = p_track[kn].value_get(); p_p2 = p_track[kn1].value_get(); if(keynum == 2) { //track ma jen 2 klice //b0 = (p1-p0)*(1-T) tmp = 1.0f - tension; p_tn->x = (p_p2->x - p_p1->x)*tmp; p_tn->y = (p_p2->y - p_p1->y)*tmp; p_tn->z = (p_p2->z - p_p1->z)*tmp; return(p_tn); } else { // zacatecni tangenta if(flag_get(FLAG_TRACK_LOOP)) { p_p0 = p_track[keynum-1].value_get(); } else { // trak ma vice klicu tangent(1, CLASS_IN, &t1); // b0 = ((p1 - p0)*1.5 - a1*0.5)*(1-T) tmp = 1.0f - tension; p_tn->x = ((p_p2->x - p_p1->x)*1.5f - t1.x*0.5f)*tmp; p_tn->y = ((p_p2->y - p_p1->y)*1.5f - t1.y*0.5f)*tmp; p_tn->z = ((p_p2->z - p_p1->z)*1.5f - t1.z*0.5f)*tmp; return(p_tn); } } } else if(kn == (keynum-1)) {// konec - p(n-1), p(n) p_p0 = p_track[kn_1].value_get(); p_p1 = p_track[kn].value_get(); if(keynum == 2) { //track ma jen 2 klice //a1 = (p1-p0)*(1-T) tmp = 1.0f - tension; p_tn->x = (p_p1->x - p_p0->x)*tmp; p_tn->y = (p_p1->y - p_p0->y)*tmp; p_tn->z = (p_p1->z - p_p0->z)*tmp; return(p_tn); } else { if(flag_get(FLAG_TRACK_LOOP)) { // koncova tangenta p_p2 = p_track->value_get(); } else { // bez opakovani tangent(kn_1, CLASS_OUT, &t1); // an = ((pn - p(n-1))*1.5 - b(n-1)*0.5)*(1-T) tmp = 1.0f - tension; p_tn->x = ((p_p1->x - p_p0->x)*1.5f - t1.x*0.5f)*tmp; p_tn->y = ((p_p1->y - p_p0->y)*1.5f - t1.y*0.5f)*tmp; p_tn->z = ((p_p1->z - p_p0->z)*1.5f - t1.z*0.5f)*tmp; return(p_tn); } } } else { // stredni bod - mam p(n-1), p(n), p(n+1) p_p0 = p_track[kn_1].value_get(); p_p1 = p_track[kn].value_get(); p_p2 = p_track[kn1].value_get(); } // g1 = (pn - p(n-1))*(1+B) tmp = 1.0f+bias; g1.x = (p_p1->x - p_p0->x)*tmp; g1.y = (p_p1->y - p_p0->y)*tmp; g1.z = (p_p1->z - p_p0->z)*tmp; // g2 = (p(n+1) - pn)*(1-B) tmp = 1.0f-bias; g2.x = (p_p2->x - p_p1->x)*tmp; g2.y = (p_p2->y - p_p1->y)*tmp; g2.z = (p_p2->z - p_p1->z)*tmp; // g3 = g2 - g1, g3 = g2 - g1; // tangent case a: an = (g1 + g3*(0.5 + 0.5*C))*(1-T), // tangent case b: bn = (g1 + g3*(0.5 - 0.5*C))*(1-T). tmp = 1.0f-tension; tmp2 = 0.5f + key_class*0.5f*continuity; p_tn->x = (g1.x + g3.x*tmp2)*tmp; p_tn->y = (g1.y + g3.y*tmp2)*tmp; p_tn->z = (g1.z + g3.z*tmp2)*tmp; return(p_tn); } VECT * anim_track_bez_vect::interpolate(VECT *p_result, int time) { VECT *p0,*p1,pt0,pt1; float F1,F2,F3,F4; float t,t2,t3; int kn,kn1; int ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { t2 = t*t; t3 = t2*t; tangent(kn, CLASS_OUT, &pt0); tangent(kn1, CLASS_IN, &pt1); p0 = p_track[kn].value_get(); p1 = p_track[kn1].value_get(); F1 = 2*t3-3*t2+1; F2 = t3-2*t2+t; F3 = -2*t3+3*t2; F4 = t3-t2; p_result->x = p0->x*F1 + pt0.x*F2 + p1->x*F3 + pt1.x*F4; p_result->y = p0->y*F1 + pt0.y*F2 + p1->y*F3 + pt1.y*F4; p_result->z = p0->z*F1 + pt0.z*F2 + p1->z*F3 + pt1.z*F4; } else { *p_result = p_track[kn].value; } } else { if(keynum) { *p_result = p_track->value; } } return(p_result); } QUAT * anim_track_bez_quat::tangent(int kn, BEZIER_KEY_CLASS key_class, QUAT *p_q) { int kn_1 = kn-1, // key k(n-1) kn1 = kn+1; // key k(n+1) float bias,continuity,tension; QUAT q0, q2, //q1 g1, g2, g3; bias = p_track[kn].bias; continuity = p_track[kn].continuity; tension = p_track[kn].tension; if(!kn) { //kn = 0, zacatek - mam p(n), p(n+1) if(keynum == 2) { //track ma jen 2 klice return(slerp(p_track[kn].value_get(),p_track[kn1].value_get(),(1.0f-tension)/3.0f,p_q)); } else { // prvni body (-1,0,1) if(flag_get(FLAG_TRACK_LOOP)) { return(slerp(p_track[kn].value_get(),slerp(slerp(p_track[kn].value_get(),p_track[keynum-1].value_get(),-(1+bias)/3.0f,&g1), slerp(p_track[kn].value_get(),p_track[kn1].value_get(), (1-bias)/3.0f,&g2),0.5f + key_class*0.5f*continuity,&g3), key_class*(tension-1.0f),p_q)); } else { tangent(kn1, CLASS_OUT, &q2); return(slerp(p_track[kn].value_get(),&q2,(1.0f-tension)*0.5f,p_q)); } } } else if(kn == (int)keynum-1) {// konec - p(n-1), p(n) if(keynum == 2) { //track ma jen 2 klice return(slerp(p_track[kn].value_get(),p_track[kn_1].value_get(),(1.0f-tension)/3.0f,p_q)); } else { // posledni body bez opakovani if(flag_get(FLAG_TRACK_LOOP)) { // posledni (-2,-1,0) return(slerp(p_track[kn].value_get(), slerp(slerp(p_track[kn].value_get(), p_track[kn_1].value_get(),-(1+bias)/3.0f,&g1), slerp(p_track[kn].value_get(),p_track->value_get(), (1-bias)/3.0f,&g2), 0.5f + key_class*0.5f*continuity,&g3), key_class*(tension-1.0f),p_q)); } else { tangent(kn_1, CLASS_IN, &q0); return(slerp(p_track[kn].value_get(),&q0,(1.0f-tension)*0.5f,p_q)); } } } else { // stredni bod - mam q(n-1), q(n), q(n+1) return(slerp(p_track[kn].value_get(),slerp(slerp(p_track[kn].value_get(),p_track[kn_1].value_get(),-(1+bias)/3.0f,&g1), slerp(p_track[kn].value_get(),p_track[kn1].value_get(), (1-bias)/3.0f,&g2), 0.5f + key_class*0.5f*continuity,&g3), key_class*(tension-1.0f),p_q)); } } QUAT * anim_track_bez_quat::interpolate(QUAT *p_result, int time) { QUAT q0,q1,q2; QUAT qn,qn1; QUAT bn,an; int kn,kn1; float t; int ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { assert(0.0f <= t && t <= 1.0f); tangent(kn, CLASS_OUT, &bn); tangent(kn1, CLASS_IN, &an); qn = p_track[kn].value; qn1= p_track[kn1].value; slerp(&qn,&bn, t,&q0); slerp(&bn,&an, t,&q1); slerp(&an,&qn1,t,&q2); slerp(&q0,&q1,t,&qn); slerp(&q1,&q2,t,&qn1); return(slerp(&qn,&qn1,t,p_result)); } else { *p_result = p_track[kn].value; return(p_result); } } else { if(keynum) { *p_result = p_track->value; return(p_result); } else return(NULL); } } float anim_track_bez_float::tangent(int kn, BEZIER_KEY_CLASS key_class, float *p_tn) { float bias,continuity,tension; float t1,g1,g3; assert(kn < keynum); bias = p_track[kn].bias; continuity = p_track[kn].continuity; tension = p_track[kn].tension; if(!kn) { if(keynum == 2) { *p_tn = (p_track[1].value - p_track[0].value)*(1.0f - tension); return(*p_tn); } else { if(flag_get(FLAG_TRACK_LOOP)) { // prvni klic g1 = (p_track[0].value - p_track[keynum-1].value)*(1.0f+bias); g3 = (p_track[1].value - p_track[0].value)*(1.0f-bias)-g1; *p_tn = (g1 + g3*(0.5f + key_class*0.5f*continuity))*(1.0f-tension); } else { tangent(1, CLASS_IN, &t1); *p_tn = ((p_track[kn+1].value - p_track[kn].value)*1.5f - t1*0.5f)*(1.0f - tension); } return(*p_tn); } } else if(kn == (keynum-1)) {// konec - p(n-1), p(n) if(keynum == 2) { *p_tn = (p_track[kn].value - p_track[kn-1].value)*(1.0f - tension); return(*p_tn); } else { if(flag_get(FLAG_TRACK_LOOP)) { // posledni klic g1 = (p_track[kn].value - p_track[kn-1].value)*(1.0f+bias); g3 = (p_track[0].value - p_track[kn].value)*(1.0f-bias)-g1; *p_tn = (g1 + g3*(0.5f + key_class*0.5f*continuity))*(1.0f-tension); } else { tangent(kn-1, CLASS_OUT, &t1); *p_tn = ((p_track[kn].value-p_track[kn-1].value)*1.5f - t1*0.5f)*(1.0f - tension); } return(*p_tn); } } else { // stredni bod - mam p(n-1), p(n), p(n+1) g1 = (p_track[kn].value - p_track[kn-1].value)*(1.0f+bias); g3 = (p_track[kn+1].value - p_track[kn].value)*(1.0f-bias)-g1; *p_tn = (g1 + g3*(0.5f + key_class*0.5f*continuity))*(1.0f-tension); return(*p_tn); } } float anim_track_bez_float::interpolate(float *p_result, int time) { float pt0,pt1; float t,t2,t3; int ret; int kn,kn1; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { t2 = t*t; t3 = t2*t; tangent(kn, CLASS_OUT, &pt0); tangent(kn1, CLASS_IN, &pt1); return((*p_result = p_track[kn].value*(2*t3-3*t2+1) + pt0*(t3-2*t2+t) + p_track[kn1].value*(-2*t3+3*t2) + pt1*(t3-t2))); } else { return(*p_result = p_track[kn].value); } } else { if(keynum) { return(*p_result = p_track->value); } else return(FLT_MAX); } } WVECT * anim_track_bez_wvect::tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn) { int kn_1 = kn-1, // key k(n-1) kn1 = kn+1; // key k(n+1) float bias,continuity,tension,tn1,bp1; WVECT *p_p0,*p_p1,*p_p2, t1, g1,g2,g3; bias = p_track[kn].bias; continuity = p_track[kn].continuity; tension = p_track[kn].tension; if(!kn) { //kn = 0, zacatek - mam p(n), p(n+1) p_p1 = p_track[kn].value_get(); p_p2 = p_track[kn1].value_get(); if(keynum == 2) { //track ma jen 2 klice //b0 = (p1-p0)*(1-T) tn1 = (1.0f - tension); p_tn->x = (p_p2->x - p_p1->x)*tn1; p_tn->y = (p_p2->y - p_p1->y)*tn1; p_tn->z = (p_p2->z - p_p1->z)*tn1; p_tn->w = (p_p2->w - p_p1->w)*tn1; return(p_tn); } else { if(flag_get(FLAG_TRACK_LOOP)) { p_p0 = p_track[keynum-1].value_get(); } else { // trak ma vice klicu tangent(1, CLASS_IN, &t1); tn1 = (1.0f - tension); // b0 = ((p1 - p0)*1.5 - a1*0.5)*(1-T) p_tn->x = ((p_p2->x - p_p1->x)*1.5f - t1.x*0.5f)*tn1; p_tn->y = ((p_p2->y - p_p1->y)*1.5f - t1.y*0.5f)*tn1; p_tn->z = ((p_p2->z - p_p1->z)*1.5f - t1.z*0.5f)*tn1; p_tn->w = ((p_p2->w - p_p1->w)*1.5f - t1.w*0.5f)*tn1; return(p_tn); } } } else if(kn == (keynum-1)) {// konec - p(n-1), p(n) p_p0 = p_track[kn_1].value_get(); p_p1 = p_track[kn].value_get(); if(keynum == 2) { //track ma jen 2 klice //a1 = (p1-p0)*(1-T) tn1 = (1.0f - tension); p_tn->x = (p_p1->x - p_p0->x)*tn1; p_tn->y = (p_p1->y - p_p0->y)*tn1; p_tn->z = (p_p1->z - p_p0->z)*tn1; p_tn->w = (p_p1->w - p_p0->w)*tn1; return(p_tn); } else { if(flag_get(FLAG_TRACK_LOOP)) { p_p2 = p_track->value_get(); } else { // bez opakovani tangent(kn_1, CLASS_OUT, &t1); // an = ((pn - p(n-1))*1.5 - b(n-1)*0.5)*(1-T) tn1 = (1.0f - tension); p_tn->x = ((p_p1->x - p_p0->x)*1.5f - t1.x*0.5f)*tn1; p_tn->y = ((p_p1->y - p_p0->y)*1.5f - t1.y*0.5f)*tn1; p_tn->z = ((p_p1->z - p_p0->z)*1.5f - t1.z*0.5f)*tn1; p_tn->w = ((p_p1->w - p_p0->w)*1.5f - t1.w*0.5f)*tn1; return(p_tn); } } } else { // stredni bod - mam p(n-1), p(n), p(n+1) p_p0 = p_track[kn_1].value_get(); p_p1 = p_track[kn].value_get(); p_p2 = p_track[kn1].value_get(); } bp1 = 1.0f+bias; // g1 = (pn - p(n-1))*(1+B) g1.x = (p_p1->x - p_p0->x)*bp1; g1.y = (p_p1->y - p_p0->y)*bp1; g1.z = (p_p1->z - p_p0->z)*bp1; g1.w = (p_p1->w - p_p0->w)*bp1; // g2 = (p(n+1) - pn)*(1-B) g2.x = (p_p2->x - p_p1->x)*bp1; g2.y = (p_p2->y - p_p1->y)*bp1; g2.z = (p_p2->z - p_p1->z)*bp1; g2.w = (p_p2->w - p_p1->w)*bp1; // g3 = g2 - g1, wvect_sub(&g2,&g1,&g3); // tangent case a: an = (g1 + g3*(0.5 + 0.5*C))*(1-T), // tangent case b: bn = (g1 + g3*(0.5 - 0.5*C))*(1-T). tn1 = (1.0f - tension); bp1 = (0.5f + key_class*0.5f*continuity); p_tn->x = (g1.x + g3.x*bp1)*tn1; p_tn->y = (g1.y + g3.y*bp1)*tn1; p_tn->z = (g1.z + g3.z*bp1)*tn1; p_tn->w = (g1.w + g3.w*bp1)*tn1; return(p_tn); } WVECT * anim_track_bez_wvect::interpolate(WVECT *p_result, int time) { WVECT *p0,*p1,pt0,pt1; float F1,F2,F3,F4; float t,t2,t3; int kn,kn1; int ret; if(keynum > 1) { ret = key_get_time(time, &kn, &kn1, &t); if(ret == KEYS_ALL) { t2 = t*t; t3 = t2*t; tangent(kn, CLASS_OUT, &pt0); tangent(kn1, CLASS_IN, &pt1); p0 = p_track[kn].value_get(); p1 = p_track[kn1].value_get(); F1 = 2*t3-3*t2+1; F2 = t3-2*t2+t; F3 = -2*t3+3*t2; F4 = t3-t2; p_result->x = p0->x*F1 + pt0.x*F2 + p1->x*F3 + pt1.x*F4; p_result->y = p0->y*F1 + pt0.y*F2 + p1->y*F3 + pt1.y*F4; p_result->z = p0->z*F1 + pt0.z*F2 + p1->z*F3 + pt1.z*F4; p_result->w = p0->w*F1 + pt0.w*F2 + p1->w*F3 + pt1.w*F4; } else { *p_result = p_track[kn].value; } } else { if(keynum) { *p_result = p_track->value; } } return(p_result); } berusky2-0.12/src/age/graph/scene_import_3ds.h0000644000175000017500000000320213674426075016173 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SCENE_IMPORT_3DS_H__ #define __SCENE_IMPORT_3DS_H__ bool scene_import_3ds(SCENE *p_scene, char *p_dir, char *p_file); bool scene_import_3ds(SCENE *p_scene, FHANDLE *f); bool scene_export_3ds(SCENE *p_scene, char *p_dir, char *p_file); bool scene_export_3ds(SCENE *p_scene, FHANDLE *f); #endif // __SCENE_IMPORT_3DS_H__ berusky2-0.12/src/age/graph/selection.h0000644000175000017500000000670013674426075014726 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Scene object selection */ #ifndef __SELECTION_H__ #define __SELECTION_H__ class selected_object_item; typedef class selected_object_item SELECTED_OBJECT_ITEM; class selected_object_head; typedef class selected_object_head SELECTED_OBJECT_HEAD; typedef class selected_object_item : public llist_item { friend class selected_object_head; private: OBJECT_SELECT * p_object; public: OBJECT_SELECT * object_get(void) { return(p_object); } public: SELECTED_OBJECT_ITEM * object_next(void) { return((SELECTED_OBJECT_ITEM *)list_next()); } } SELECTED_OBJECT_ITEM; bool selection_search(void *p_search_data, LLIST_ITEM *p_current); typedef class selected_object_head : public llist_head { public: SELECTED_OBJECT_ITEM * get_first(void) { return((SELECTED_OBJECT_ITEM *)list_get_first()); } private: void remove(SELECTED_OBJECT_ITEM * p_item) { p_item->p_object->mark_clear(MARK_SELECTED); list_remove(p_item); delete p_item; } public: bool insert(OBJECT_SELECT *p_object) { if(find(p_object, selection_search) == NULL) { SELECTED_OBJECT_ITEM *p_item = new SELECTED_OBJECT_ITEM; p_item->p_object = p_object; list_insert_last(p_item); p_object->mark_set(MARK_SELECTED); return(TRUE); } else { return(FALSE); } } bool remove(OBJECT_SELECT *p_object) { SELECTED_OBJECT_ITEM *p_item = (SELECTED_OBJECT_ITEM *)find(p_object, selection_search); if(p_item != NULL) { remove(p_item); return(TRUE); } else { return(FALSE); } } public: void clear(void) { SELECTED_OBJECT_ITEM *p_item = (SELECTED_OBJECT_ITEM *)list_get_first(); while(p_item) { SELECTED_OBJECT_ITEM *p_next = (SELECTED_OBJECT_ITEM *)p_item->list_next(); p_item->p_object->mark_clear(MARK_SELECTED); delete p_item; p_item = p_next; } list_clear(); } void destroy(void) { clear(); } public: selected_object_head(void) { } ~selected_object_head(void) { destroy(); } } SELECTED_OBJECT_HEAD; #endif // __SELECTION_H__ berusky2-0.12/src/age/graph/surface_sdl.h0000644000175000017500000001132513674454616015234 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SURFACE_SDL_H__ #define __SURFACE_SDL_H__ typedef class surface_sdl : public surface { SDL_Surface * p_surf; // surface pix-map public: SDL_Surface * surf_get(void) { return(p_surf); } tpos pitch_get(void) { return(p_surf->pitch>>2); } public: tpos width_get(void) { return(p_surf ? p_surf->w : 0); } tpos height_get(void) { return(p_surf ? p_surf->h : 0); } void size_get(tpos *p_dx, tpos *p_dy) { if(p_surf) { *p_dx = p_surf->w; *p_dy = p_surf->h; } else { *p_dx = 0; *p_dy = 0; } } private: int locks; public: static bool lock_required(SDL_Surface *p_surf) { return(p_surf ? SDL_MUSTLOCK(p_surf) : FALSE); } bool lock_required(void) { return(p_surf ? SDL_MUSTLOCK(p_surf) : FALSE); } bool locked(void) { return(locks > 0); } void lock(void) { if(!locked() && p_surf) { SDL_LockSurface(p_surf); } locks++; } void unlock(void) { if(locked()) { locks--; } if(!locked() && p_surf) { SDL_UnlockSurface(p_surf); } } public: bool loaded(void) { return(p_surf != NULL); } bool load(const char *p_file, SURFACE_FORMAT format = SURFACE_TEXTURE); bool load_alpha(const char *p_file); bool save(const char *p_file, IMAGE_FORMAT format = IMAGE_BMP); void copy(class surface_sdl *p_src); void move(class surface_sdl *p_src); public: void clear(void); void create(tpos width, tpos height, SURFACE_FORMAT format = SURFACE_TEXTURE); void remove(void); public: void ckey_set(trgbcomp r, trgbcomp g, trgbcomp b); void ckey_set(tcolor color); void fill(tcolor color); void fill(tpos x, tpos y, tpos dx, tpos dy, tcolor color); void blit(class surface_sdl *p_dst, tpos tx = 0, tpos ty = 0); void blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_sdl *p_dst, tpos tx = 0, tpos ty = 0); void scale(int nx, int ny); static SDL_Surface * convert_to_texture(SDL_Surface *p_surf); static SDL_Surface * convert_to_display_format(SDL_Surface *p_surf); static SDL_Surface * convert_to_alpha(SDL_Surface *p_surf); static SDL_Surface * merge(SDL_Surface *p_dest, SDL_Surface *p_src); void convert_to_texture(void); void convert_to_display_format(void); void convert_to_alpha(void); tcolor color_map(Uint8 r, Uint8 g, Uint8 b) { return(p_surf ? SDL_MapRGB(p_surf->format, r, g, b) : 0); } void * pixels_get(void) { if(lock_required() && !locked()) { assert(0); return(NULL); } return(p_surf ? p_surf->pixels : NULL); } void * pixels_get(tpos x, tpos y) { dword *p_pix = (dword *)pixels_get(); if(!p_pix) { return(NULL); } return(p_pix + y*(p_surf->pitch>>2) + x); } bool pixels_set(tcolor *p_pixels, tpos width, tpos height); // Pixel operations (need lock/unlock) tcolor pixel_get(int x, int y); void pixel_set(int x, int y, tcolor color); tcolor single_pixel_get(int x, int y); void single_pixel_set(int x, int y, tcolor color); public: surface_sdl(void); surface_sdl(char *p_file, SURFACE_FORMAT format_ = SURFACE_TEXTURE); surface_sdl(SDL_Surface *p_surf_, SURFACE_FORMAT format_ = SURFACE_TEXTURE, int convert = FALSE); surface_sdl(tpos width, tpos height, SURFACE_FORMAT format_ = SURFACE_TEXTURE); } SURFACE_SDL; #endif // __SURFACE_SDL_H__ berusky2-0.12/src/age/graph/object_transformation.cpp0000644000175000017500000000246513674426075017674 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/lighting.cpp0000644000175000017500000000373013674426075015101 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" phong_lighting_intensity::phong_lighting_intensity(void) { light_angle_min = 0.0f; light_angle_scale = 1.0f; light_bidirectional = FALSE; light_range_active = FALSE; light_range = 0.0f; light_fade_active = FALSE; light_fade_constant = 0.0f; light_fade_linear = 0.0f; light_fade_cubic = 0.0f; } phong_lighting_color::phong_lighting_color(void) { phong_light_color_ambient.set(0,0,0,0); phong_light_diffuse = TRUE; phong_light_color_diffuse.set(1,1,1,1); phong_light_specular = FALSE; phong_light_color_specular.set(1,1,1,1); phong_light_color_specular_shine = 1.0f; } phong_lighting::phong_lighting(void) { } berusky2-0.12/src/age/graph/print.cpp0000644000175000017500000001256213674426075014433 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" #define TEXT_BUFFER_LEN 1000 #ifdef LINUX void grf_print::font_create(void) { return; Display *dpy; /* Our current X display */ XFontStruct *fontInfo = NULL; /* Our font info */ /* Sotrage for 96 characters */ base = glGenLists( 96 ); /* Get our current display long enough to get the fonts */ dpy = XOpenDisplay( NULL ); /* Get the font information */ // TODO -> Seznam fontu + vybrat fontInfo = XLoadQueryFont( dpy, "-adobe-helvetica-medium-r-normal--18-*-*-*-p-*-iso8859-1" ); /* If the above font didn't exist try one that should */ if ( fontInfo == NULL ) { fontInfo = XLoadQueryFont( dpy, "fixed" ); /* If that font doesn't exist, something is wrong */ if ( fontInfo == NULL ) { fprintf( stderr, "no X font available?\n" ); return; } } /* generate the list */ glXUseXFont( fontInfo->fid, 32, 96, base ); /* Recover some memory */ XFreeFont( dpy, fontInfo ); /* close the display now that we're done with it */ XCloseDisplay( dpy ); } #endif void grf_print::font_destroy(void) { if(base != 0) { glDeleteLists( base, 96 ); base = 0; } } /* Print our GL text to the screen */ void grf_print::print_line(RGBB color, int x, int y, const char *p_text) { /* If there's no text, do nothing */ if(p_text == NULL || base == 0) return; /* Set color */ gl_diffuse::on(); gl_diffuse::set(&color); /* Set position */ glRasterPos2i(x,y+font_height_get()); /* Pushes the Display List Bits */ glPushAttrib( GL_LIST_BIT ); /* Sets base character to 32 */ glListBase( base - 32 ); /* Draws the text */ glCallLists( strlen( p_text ), GL_UNSIGNED_BYTE, p_text ); /* Pops the Display List Bits */ glPopAttrib( ); } /* Print our GL text to the screen */ void grf_print::print_line(int x, int y, const char *p_text) { print_line(color_text,x,y,p_text); } void grf_print::print(int x, int y, const char *fmt,...) { char text[TEXT_BUFFER_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(text, TEXT_BUFFER_LEN, fmt, ap); va_end(ap); print_line(x,y,text); } /* Text console */ void grf_console::print_to_buffer(char *fmt) { int len; do { len = strlen(fmt); if(len > buffer_line_width) { len = buffer_line_width; } scroll_if_full(); strncpy(p_buffer[buffer_line_last],fmt,len); buffer_line_last = line_next(buffer_line_last); fmt += len; } while(len == buffer_line_width); } void grf_console::print_line(char *fmt) { char newlines[] = "\n\r"; char *p_line; p_line = strtok(fmt, newlines); do { print_to_buffer(p_line); } while((p_line = strtok(NULL, newlines)) != NULL); } void grf_console::print(const char *fmt,...) { char text[TEXT_BUFFER_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(text, TEXT_BUFFER_LEN, fmt, ap); va_end(ap); grf_console::print_line(text); } void grf_console::draw(void) { if(empty()) return; mesh_material::set_default(); cursor_reset(); for(int i = buffer_line_first; i != buffer_line_last; i = line_next(i)) { grf_print::print_line(origin.x+cursor.x, origin.y+cursor.y, p_buffer[i]); cursor_new_line(); } } void grf_console_interface::console_print(const char *fmt,...) { char text[TEXT_BUFFER_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(text, TEXT_BUFFER_LEN, fmt, ap); va_end(ap); console.print_line(text); } void grf_console_interface::console_print(int x, int y, const char *fmt,...) { char text[TEXT_BUFFER_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(text, TEXT_BUFFER_LEN, fmt, ap); va_end(ap); GRF_PRINT *p_print = &console; p_print->print_line(x,y,text); } void grf_console_interface::console_print(RGBB color, int x, int y, const char *fmt,...) { char text[TEXT_BUFFER_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(text, TEXT_BUFFER_LEN, fmt, ap); va_end(ap); GRF_PRINT *p_print = &console; p_print->print_line(color,x,y,text); } berusky2-0.12/src/age/graph/animation_track_bezier.h0000644000175000017500000002143213674426075017443 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Animation track - abstraction and implementation */ /* Written according to: Splines & Quaternions (splines.txt) ----------------------------------- by Jochen Wilhelmy a.k.a. digisnap digisnap@cs.tu-berlin.de 06.08.1997 */ #ifndef __ANIMATION_TRACK_BEZIER_H__ #define __ANIMATION_TRACK_BEZIER_H__ /* * Class for bezier animation keys */ typedef struct anim_key_bez : public anim_key { float tension; float continuity; float bias; } ANIM_KEY_BEZ; typedef class anim_track_bezier : public anim_track { /* * Find k[n] for a given time and return the n */ private: int key_get_internal(int time); /* * Find k[n] for a given time */ public: int key_get_time(int time); /* * Get key for frame */ public: int key_get_frame(int frame) { return(key_get_time(frame*LINEAR_FRAMES_DELAYI)); } /* * Find k[n], k[n+1], time for a given time and return the type of an interval */ public: KEY_TYPE key_get_time(int time, int *p_kn, int *p_kn1, float *p_time); } ANIM_TRACK_BEZIER; /* --------------------------------------------------------------------- */ /* * Class for besier animation keys - vectors */ typedef struct anim_key_bez_vect : public anim_key_bez { public: VECT value; public: VECT * value_get(void) { return(&value); } } ANIM_KEY_BEZ_VECT; /* * Besier animation tracks - vectors */ typedef class anim_track_bez_vect : public anim_track_bezier { ANIM_KEY_BEZ_VECT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_BEZ_VECT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_BEZ_VECT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_BEZ_VECT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } private: VECT * tangent(int kn, BEZIER_KEY_CLASS key_class, VECT *p_tn); public: VECT * interpolate(VECT *p_result, int time); public: anim_track_bez_vect(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_bez_vect(void) { destroy(); } } ANIM_TRACK_BEZ_VECT; /* --------------------------------------------------------------------- */ typedef class anim_key_bez_quat : public anim_key_bez { public: QUAT value; public: QUAT * value_get(void) { return(&value); } } ANIM_KEY_BEZ_QUAT; /* * Besier animation tracks - vectors */ typedef class anim_track_bez_quat : public anim_track_bezier { ANIM_KEY_BEZ_QUAT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_BEZ_QUAT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_BEZ_QUAT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_BEZ_QUAT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } private: QUAT * tangent(int kn, BEZIER_KEY_CLASS key_class, QUAT *p_tn); public: QUAT * interpolate(QUAT *p_result, int time); public: anim_track_bez_quat(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_bez_quat(void) { destroy(); } } ANIM_TRACK_BEZ_QUAT; /* --------------------------------------------------------------------- */ typedef class anim_key_bez_float : public anim_key_bez { public: float value; public: float * value_get(void) { return(&value); } } ANIM_KEY_BEZ_FLOAT; /* * Besier animation tracks - floats */ typedef class anim_track_bez_float : public anim_track_bezier { ANIM_KEY_BEZ_FLOAT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_BEZ_FLOAT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_BEZ_FLOAT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_BEZ_FLOAT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } private: float tangent(int kn, BEZIER_KEY_CLASS key_class, float *p_tn); public: float interpolate(float *p_result, int time); public: anim_track_bez_float(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_bez_float(void) { destroy(); } } ANIM_TRACK_BEZ_FLOAT; /* --------------------------------------------------------------------- */ typedef class anim_key_bez_wvect : public anim_key_bez { public: WVECT value; public: WVECT * value_get(void) { return(&value); } } ANIM_KEY_BEZ_WVECT; /* * Besier animation tracks - WVECT */ typedef class anim_track_bez_wvect : public anim_track_bezier { ANIM_KEY_BEZ_WVECT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_BEZ_WVECT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_BEZ_WVECT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_BEZ_WVECT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } private: WVECT * tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn); public: WVECT * interpolate(WVECT *p_result, int time); public: anim_track_bez_wvect(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_bez_wvect(void) { destroy(); } } ANIM_TRACK_BEZ_WVECT; #endif // __ANIMATION_TRACK_BEZIER_H__ berusky2-0.12/src/age/graph/box.cpp0000644000175000017500000000563513674426075014072 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" BOX * box_create(BOX_TYPE type) { switch(type) { case BOX_AABB: return((BOX *)(new AABB)); case BOX_OBB: return((BOX *)(new OBB)); case BOX_CIRCLE: return(NULL); default: return(NULL); } } BOX * box_copy(BOX *p_src) { switch(p_src->box_type_get()) { case BOX_AABB: return((BOX *)(new AABB(p_src))); case BOX_OBB: return((BOX *)(new OBB(p_src))); case BOX_CIRCLE: return(NULL); default: return(NULL); } } BOX * box_create(BOX_TYPE type, BOX * p_list, int num) { BOX *p_ret = NULL; bool translate = FALSE; int i; for(i = 0; i < num; i++) { if(p_list[i].box_type_get() != type) { translate = TRUE; break; } } switch(type) { case BOX_AABB: { if(translate) { AABB *p_nlist = (AABB *)mmalloc(sizeof(AABB)*num); for(i = 0; i < num; i++) { p_list[i].to_aabb(p_nlist+i); } p_ret = new AABB(p_nlist,num); free(p_nlist); } else { p_ret = new AABB((AABB *)p_list,num); } break; } case BOX_OBB: { if(translate) { OBB *p_nlist = (OBB *)mmalloc(sizeof(OBB)*num); for(i = 0; i < num; i++) { p_list[i].to_obb(p_nlist+i); } p_ret = new OBB(p_nlist,num); free(p_nlist); } else { p_ret = new OBB((OBB *)p_list,num); } break; } case BOX_CIRCLE: break; default: break; } return(p_ret); } void box_remove(BOX **p_box) { if(*p_box) { delete *p_box; p_box = NULL; } } berusky2-0.12/src/age/graph/vector.cpp0000644000175000017500000000575613674426075014610 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" vect2di::vect2di(VECT2DF src) { x = (tpos)roundf(src.x); y = (tpos)roundf(src.y); } vect2di::vect2di(POLAR2DI src) { float tx,ty; polar2scalar(src.rotation, src.length, &tx, &ty); x = (int)roundf(tx); y = (int)roundf(ty); } vect2di::vect2di(RECT2DI src) { x = src.x; y = src.y; } vect2df::vect2df(VECT2DI src) { x = (float)src.x; y = (float)src.y; } vect3di::vect3di(VECT3DF src) { x = (tpos)roundf(src.x); y = (tpos)roundf(src.y); z = (tpos)roundf(src.z); } vect3df::vect3df(VECT3DI src) { x = (float)src.x; y = (float)src.y; z = (float)src.z; } void rect2di::set(VECT2DI *p_vect, int num) { VECT2DI min,max; ADJUST_PREP_INT(min.x,max.x); ADJUST_PREP_INT(min.y,max.y); int i; for(i = 0; i < num; i++) { ADJUST(min.x,max.x,p_vect[i].x); ADJUST(min.y,max.y,p_vect[i].y); } set(&min,&max); } POLAR2DI interpolate(POLAR2DI p1, POLAR2DI p2, float i) { POLAR2DI tmp; float i1 = 1.0f - i; p1.norm(); p2.norm(); tmp.length = (tpos)(p1.length*i + p2.length*i1); tmp.rotation = (float)(p1.rotation*i + p2.rotation*i1); return(tmp); } POLAR2DI interpolate(POLAR2DI p1, POLAR2DI p2, float i1, float i2) { POLAR2DI tmp; float i11 = 1.0f - i1; float i21 = 1.0f - i2; tmp.length = (tpos)(p1.length*i1 + p2.length*i11); tmp.rotation = (float)(p1.rotation*i2 + p2.rotation*i21); return(tmp); } void polar2di::norm(void) { rotation = angle_norm(rotation); } polar2di::polar2di(POLAR2DF src) { length = (int)roundf(src.length); rotation = src.rotation; } polar2di::polar2di(VECT2DI src) { float flenght; scalar2polar(src.x, src.y, &rotation, &flenght); length = ftoi(flenght); } berusky2-0.12/src/age/graph/ferguson.cpp0000644000175000017500000000313013674426075015116 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* template vect ferguson_interpolate(vect p0, vect p1, vect p2, vect p3, float t) { vect v0 = ferguson_tangent(p0, p1, p2, CLASS_B); vect v1 = ferguson_tangent(p1, p2, p3, CLASS_A); vect p = ferguson_interpolate(v0, p1, v1, p2, t); return(p); } */ berusky2-0.12/src/age/graph/alpha.h0000644000175000017500000001221113674426075014020 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Alpha-stage function */ #ifndef __ALPHA_STAGE_H__ #define __ALPHA_STAGE_H__ #define STATE_BLOCK_TRANSPARENT 50 #define STAGE_ALPHA_FUNC_NUM 5 #define STAGE_ALPHA_MASKA 4 typedef enum { ALPHA_OFF = 0, ALPHA_PATCH = 1, ALPHA_SMOKE = 2, ALPHA_TRANSPARENT = 3, ALPHA_TEST = 4 } ALPHA_TYPE; // blending settings typedef struct _STATE_ALPHA_BLOCK { char name[MAX_NAME]; int alpha_transparent; int func; } STATE_ALPHA_BLOCK; typedef class alpha_func { // Table of blending functions STATE_ALPHA_BLOCK state_block[STAGE_ALPHA_FUNC_NUM+STATE_BLOCK_TRANSPARENT+1]; // Table of alpha functions void (alpha_func::*p_func[STAGE_ALPHA_FUNC_NUM])(void); int alpha_block; // an active alpha block int alpha_test; // alpha-test on-off int blending; // blending on-off private: void blend_set_one_zero(void) { if(blending) { glBlendFunc(GL_ONE,GL_ZERO); } } void blend_get_default(GLenum *p_src, GLenum *p_dest) { *p_src = GL_ONE; *p_dest = GL_ZERO; } void blend_set(GLenum src, GLenum dest) { if(blending) { glBlendFunc(src,dest); } } void blend_off(bool force = FALSE) { if(blending || force) { blending = FALSE; glDisable(GL_BLEND); } } void blend_on(bool force = FALSE) { if(!blending || force) { blending = TRUE; glEnable(GL_BLEND); } } void blend_param(int stav, bool force = FALSE) { if(stav) { blend_on(force); } else { blend_off(force); } } void alpha_test_off(bool force = FALSE) { if(alpha_test || force) { alpha_test = FALSE; glDisable(GL_ALPHA_TEST); } } void alpha_test_on(bool force = FALSE) { if(!alpha_test || force) { alpha_test = TRUE; glEnable(GL_ALPHA_TEST); } } private: void off(void); void patch(void); void smoke(void); void transparent(void); void test(void); public: void set(ALPHA_TYPE alpha_function, bool force = FALSE) { if(alpha_block != alpha_function) { alpha_block = alpha_function; (this->*p_func[state_block[alpha_function].func])(); } } void reset(bool force = FALSE) { alpha_block = ERROR; off(); } alpha_func(void) { p_func[ALPHA_OFF] = &alpha_func::off; p_func[ALPHA_PATCH] = &alpha_func::patch; p_func[ALPHA_SMOKE] = &alpha_func::smoke; p_func[ALPHA_TRANSPARENT] = &alpha_func::transparent; p_func[ALPHA_TEST] = &alpha_func::test; strcpy(state_block[ALPHA_OFF].name, "Default"); state_block[ALPHA_OFF].alpha_transparent = FALSE; state_block[ALPHA_OFF].func = 0; strcpy(state_block[ALPHA_PATCH].name, "Patch"); state_block[ALPHA_PATCH].alpha_transparent = TRUE; state_block[ALPHA_PATCH].func = 1; strcpy(state_block[ALPHA_SMOKE].name, "Smoke"); state_block[ALPHA_SMOKE].alpha_transparent = TRUE; state_block[ALPHA_SMOKE].func = 2; strcpy(state_block[ALPHA_TRANSPARENT].name, "Transparent"); state_block[ALPHA_TRANSPARENT].alpha_transparent = TRUE; state_block[ALPHA_TRANSPARENT].func = 3; strcpy(state_block[ALPHA_TEST].name, "Mask"); state_block[ALPHA_TEST].alpha_transparent = FALSE; state_block[ALPHA_TEST].func = 4; alpha_block = 0; alpha_test = 0; blending = 0; } } ALPHA_FUNC; typedef class material_alpha { public: static ALPHA_FUNC alpha_functions; private: ALPHA_TYPE alpha_type; public: void set(void) { alpha_functions.set(alpha_type); } public: void alpha_func_set(ALPHA_TYPE function) { alpha_type = function; } ALPHA_TYPE alpha_func_get(void) { return(alpha_type); } public: material_alpha(void) { alpha_type = ALPHA_OFF; } } MATERIAL_ALPHA; #endif // __ALPHA_STAGE_H__ berusky2-0.12/src/age/graph/animation_track_linear.h0000644000175000017500000002063213674426075017436 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Animation track - abstraction and implementation */ #ifndef __ANIMATION_TRACK_LINEAR_H__ #define __ANIMATION_TRACK_LINEAR_H__ /* * Class for linear animation keys */ typedef struct anim_key_lin : public anim_key { } ANIM_KEY_LIN; /* * Class for linear animation tracks */ typedef class anim_track_linear : public anim_track { /* * Find k[n] for a given time and return the n */ private: int key_get_internal(int time) { int key = time / LINEAR_FRAMES_DELAYI; return(key >= 0 && key < keynum_get() ? key : NO_KEY); } /* * Find k[n] for a given time */ public: int key_get_time(int time) { assert(track_get()); return(key_get_internal(time)); } /* * Get key for frame */ public: int key_get_frame(int frame) { return(frame); } /* * Find k[n], k[n+1], time for a given time and return the type of an interval */ public: KEY_TYPE key_get_time(int time, int *p_kn, int *p_kn1, float *p_time); } ANIM_TRACK_LINEAR; /* --------------------------------------------------------------------- */ /* * Class for linear animation keys - vectors */ typedef struct anim_key_lin_vect : public anim_key_lin { public: VECT value; public: VECT * value_get(void) { return(&value); } } ANIM_KEY_LIN_VECT; /* * Besier animation tracks - vectors */ typedef class anim_track_lin_vect : public anim_track_linear { ANIM_KEY_LIN_VECT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_LIN_VECT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_LIN_VECT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_LIN_VECT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } public: VECT * interpolate(VECT *p_result, int time); public: anim_track_lin_vect(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_lin_vect(void) { destroy(); } } ANIM_TRACK_LIN_VECT; /* --------------------------------------------------------------------- */ typedef class anim_key_lin_quat : public anim_key_lin { public: QUAT value; public: QUAT * value_get(void) { return(&value); } } ANIM_KEY_LIN_QUAT; /* * Besier animation tracks - vectors */ typedef class anim_track_lin_quat : public anim_track_linear { ANIM_KEY_LIN_QUAT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_LIN_QUAT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_LIN_QUAT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_LIN_QUAT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } public: QUAT * interpolate(QUAT *p_result, int time); public: anim_track_lin_quat(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_lin_quat(void) { destroy(); } } ANIM_TRACK_LIN_QUAT; /* --------------------------------------------------------------------- */ typedef class anim_key_lin_float : public anim_key_lin { public: float value; public: float value_get(void) { return(value); } } ANIM_KEY_LIN_FLOAT; /* * Besier animation tracks - vectors */ typedef class anim_track_lin_float : public anim_track_linear { ANIM_KEY_LIN_FLOAT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_LIN_FLOAT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_LIN_FLOAT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_LIN_FLOAT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } public: float interpolate(float *p_result, int time); public: anim_track_lin_float(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_lin_float(void) { destroy(); } } ANIM_TRACK_LIN_FLOAT; /* --------------------------------------------------------------------- */ typedef class anim_key_lin_wvect : public anim_key_lin { public: WVECT value; public: WVECT * value_get(void) { return(&value); } } ANIM_KEY_LIN_WVECT; /* * Besier animation tracks - WVECT */ typedef class anim_track_lin_wvect : public anim_track_linear { ANIM_KEY_LIN_WVECT *p_track; int keynum; public: void destroy(void) { ffree(p_track); } void create(int key_num) { destroy(); if(key_num) p_track = (ANIM_KEY_LIN_WVECT *)mmalloc(sizeof(p_track[0])*key_num); keynum = key_num; } public: virtual ANIM_KEY_LIN_WVECT * key_get(int key_position) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { return(p_track+key_position); } else { return(NULL); } } bool key_set(int key_position, ANIM_KEY_LIN_WVECT *p_key) { if(p_track != NULL && key_position >= 0 && key_position < keynum) { p_track[key_position] = *p_key; return(TRUE); } else { return(FALSE); } } public: int keynum_get(void) { return(keynum); } ANIM_KEY * track_get(void) { return((ANIM_KEY *)p_track); } public: WVECT * interpolate(WVECT *p_result, int time); public: anim_track_lin_wvect(int key_num) : p_track(NULL), keynum(0) { if(key_num) create(key_num); } ~anim_track_lin_wvect(void) { destroy(); } } ANIM_TRACK_LIN_WVECT; #endif // __ANIMATION_TRACK_LINEAR_H__ berusky2-0.12/src/age/graph/gpipe.h0000644000175000017500000001551213674426075014046 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Geometric pipeline - propagates changes directly to OpenGL */ #ifndef __GEOMETRIC_PIPELINE_H__ #define __GEOMETRIC_PIPELINE_H__ #define MAX_WORD_MATRIX_STACK 32 // matmult top_matrix*wordl*camera*project // Geometric pipeline typedef class gpipe : public camera_interface { // World matrix WORLD_INTERFACE matrix_word; // World-matrix stack GLMATRIX top_matrix[MAX_WORD_MATRIX_STACK]; int top_matrix_act; // Final model-view matrix GLMATRIX modelview; // State variables private: bool online; bool matrix_2d_mode; private: void projection_upload(void) { if(online) { glMatrixMode(GL_PROJECTION); glLoadMatrixf((float *)(projection_get())); } } private: void modelview_upload(void) { if(top_matrix_act) { GLMATRIX tmp; matrix_mult_dir(matrix_word.world_get(),top_matrix+top_matrix_act-1,&tmp); matrix_mult_dir(&tmp,camera_get(),&modelview); } else { matrix_mult_dir(matrix_word.world_get(),camera_get(),&modelview); } if(online) { glMatrixMode(GL_MODELVIEW); glLoadMatrixf((float *)&modelview); } } public: void view_upload(void) { if(online) { int sx,sy,dx,dy; view_get(&sx,&sy,&dx,&dy); sy = camera_interface::global_screen_height - sy - dy; glViewport(sx,sy,dx,dy); } } void view_absolute_set(int x, int y, int width, int height) { camera_interface::view_absolute_set(x, y, width, height); view_upload(); projection_upload(); camera_change_set(); } void view_relative_set(float x, float y, float width, float height) { camera_interface::view_relative_set(x, y, width, height); view_upload(); projection_upload(); camera_change_set(); } void view_set(camera_interface *p_camera) { camera_interface::view_set(p_camera); view_upload(); projection_upload(); camera_change_set(); } public: void projection_set(GLMATRIX *p_projection) { camera_interface::projection_set(p_projection); projection_upload(); camera_change_set(); } void projection_set(float fovy, float zNear, float zFar) { camera_interface::projection_set(fovy,zNear,zFar); projection_upload(); camera_change_set(); } void projection_fov_set(float fovy) { camera_interface::projection_fov_set(fovy); projection_upload(); camera_change_set(); } void projection_planes_set(float zNear, float zFar) { camera_interface::projection_planes_set(zNear, zFar); projection_upload(); camera_change_set(); } public: void camera_set(GLMATRIX *p_camera) { camera_interface::camera_set(p_camera); modelview_upload(); camera_change_set(); } void camera_set(GLMATRIX *p_camera, GLMATRIX *p_camera_invert) { camera_interface::camera_set(p_camera,p_camera_invert); modelview_upload(); camera_change_set(); } void camera_invert_set(GLMATRIX *p_camera_invert) { camera_interface::camera_invert_set(p_camera_invert); modelview_upload(); camera_change_set(); } public: void world_set(GLMATRIX *p_world) { matrix_word.world_set(p_world); modelview_upload(); } void world_init(void) { matrix_word.world_init(); modelview_upload(); } public: void world_push(GLMATRIX *p_world) { assert(top_matrix_act+1 < MAX_WORD_MATRIX_STACK); if(!top_matrix_act) { top_matrix[0] = *p_world; } else { matrix_mult_dir(top_matrix+top_matrix_act-1,p_world,top_matrix+top_matrix_act); } top_matrix_act++; modelview_upload(); } void world_pop(void) { if(top_matrix_act > 0) { top_matrix_act--; modelview_upload(); } } public: GLMATRIX * modelview_get(void) { return(&modelview); } void modelview_set(GLMATRIX *p_camera, GLMATRIX *p_world) { camera_interface::camera_set(p_camera); matrix_word.world_set(p_world); modelview_upload(); camera_change_set(); } // Independent 2D mode public: void matrix_2d_mode_set(void) { if(!matrix_2d_mode) { matrix_2d_mode = TRUE; if(online) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0,view_width_get(),view_height_get(),0.0f,0.0f,1.0f); } } } void matrix_3d_mode_set(void) { if(matrix_2d_mode) { matrix_2d_mode = FALSE; if(online) { glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } } } public: void set(camera_interface *p_camera) { camera_interface::set(p_camera); view_upload(); projection_upload(); modelview_upload(); camera_change_set(); } public: bool render_state_get(void) { return(online); } bool render_state_set(bool render) { online = render; if(online && view_width_get() <= 0 && view_height_get() <= 0) { online = FALSE; } return(online == render); } public: gpipe(void) { online = FALSE; top_matrix_act = 0; view_upload(); projection_upload(); modelview_upload(); } } GEOMETRIC_PIPELINE, GPIPE; /* TODO -> 2D/3D transformations and so on */ extern GPIPE *p_gpipe; inline GPIPE * gpipe_get(void) { return(p_gpipe); } inline void gpipe_set(GPIPE *p_active) { p_gpipe = p_active; } #endif berusky2-0.12/src/age/graph/object_geometry.h0000644000175000017500000000352213674426075016121 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SCENE_OBJECT_GEOMETRY_H__ #define __SCENE_OBJECT_GEOMETRY_H__ /* Scene object base class All objects that inherit this class can be: located in the scene located in the scene hierarchy rendered loaded / saved */ /* Basic scene geometry object */ typedef class scene_object_geometry : public object_box { public: bool visible(void); public: void print(int ident = 0); public: scene_object_geometry(class scene *p_scene); } SCENE_OBJECT_GEOMETRY; #endif // __SCENE_OBJECT_GEOMETRY_H__ berusky2-0.12/src/age/graph/color.cpp0000644000175000017500000000344713674426075014417 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * color classes */ #include "age.h" rgbf::rgbf(RGBB src) { r = src.r/MAX_BYTE_F; g = src.g/MAX_BYTE_F; b = src.b/MAX_BYTE_F; } rgbf::rgbf(RGBB *src) { r = src->r/MAX_BYTE_F; g = src->g/MAX_BYTE_F; b = src->b/MAX_BYTE_F; } rgbaf::rgbaf(RGBAB src) { r = src.r/MAX_BYTE_F; g = src.g/MAX_BYTE_F; b = src.b/MAX_BYTE_F; a = src.a/MAX_BYTE_F; } rgbaf::rgbaf(RGBAB *src) { r = src->r/MAX_BYTE_F; g = src->g/MAX_BYTE_F; b = src->b/MAX_BYTE_F; a = src->a/MAX_BYTE_F; } berusky2-0.12/src/age/graph/animation_track.h0000644000175000017500000001025013674426075016077 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __ANIMATION_TRACK_H__ #define __ANIMATION_TRACK_H__ #include /* The default animation rate for linear animation is: 20 frames/keys per sec 1 frame = 1 key framenum = keynum delays between frames is 50ms */ #define LINEAR_FRAMES_DELAY 50.0f // Delay between frames (in ms) #define LINEAR_FRAMES_DELAYI 50 #define LINEAR_FRAMES_PER_SEC 20 #define LINEAR_LENGTH_SEC 1000 #define DELTA_INTERVAL 0.01f /* * Animation types */ typedef enum { LINEAR_VECT, LINEAR_QUAT, BEZIER_VECT, BEZIER_QUAT } ANIM_TYPE; /* * Basic class for all animation keys */ typedef struct anim_key { int time; public: int time_get(void) { return(time); } void time_set(int ktime) { time = ktime; } } ANIM_KEY; /* * A Class for all animation track */ typedef enum { KEYS_ALL = 0, // use 2 keys + time KEYS_ONE // use only one key } KEY_TYPE; #define NO_KEY (-1) /* * Flags of animation tracks */ #define FLAG_TRACK_LOOP (1<<0) /* * Basic class for all animation track */ typedef class anim_track : public flag_interface, public llist_item { ANIM_TYPE type; public: ANIM_TYPE type_get(void) { return(type); } public: bool looped(void) { return(flag_get(FLAG_TRACK_LOOP)); } void loop_set(bool loop_animation) { flag_set(FLAG_TRACK_LOOP,loop_animation); } /* * Total length of the animation */ private: int time_length; public: int length_get(void) { return(time_length); } void length_set(int time) { time_length = time; } int framenum_get(void) { return(time_length/LINEAR_FRAMES_DELAYI); } void framenum_set(int frames) { time_length = LINEAR_FRAMES_DELAYI*frames; } public: virtual void destroy(void) = 0; virtual void create(int key_num) = 0; /* * insert and get key to/from specified position * if p_key == NULL clear that key */ public: virtual ANIM_KEY * key_get(int key_position) = 0; bool key_set(int key_position, ANIM_KEY *p_key) { return(FALSE); }; public: virtual int keynum_get(void) = 0; virtual ANIM_KEY * track_get(void) = 0; public: virtual int key_get_internal(int time) { return(0); } virtual int key_get_time(int time) { return(0); } virtual int key_get_frame(int frame) { return(0); } virtual KEY_TYPE key_get_time(int time, int *p_kn, int *p_kn1, float *p_time) { return(KEYS_ALL); } public: virtual void update(int time) {} virtual GLMATRIX * get(GLMATRIX *p_result) { return(NULL); } public: anim_track(void) {}; virtual ~anim_track(void) {}; } ANIM_TRACK; typedef class anim_track_head : public llist_head {} ANIM_TRACK_HEAD; #endif // __ANIMATION_TRACK_H__ berusky2-0.12/src/age/graph/surface.cpp0000644000175000017500000003415513674426075014731 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Age #include "age.h" int histogram_sector_info::color_check(int r, int g, int b) { int r_min = COLOR_FROM_CUBE_DIMENSION(r); int g_min = COLOR_FROM_CUBE_DIMENSION(g); int b_min = COLOR_FROM_CUBE_DIMENSION(b); int r_max = r_min + COLOR_CUBE_SIZE; int g_max = g_min + COLOR_CUBE_SIZE; int b_max = b_min + COLOR_CUBE_SIZE; int i; for(i = 0; i < num; i++) { RGBB color = p_start[i].color; assert(INSIDE_RANGE(r_min, color.r, r_max)); assert(INSIDE_RANGE(g_min, color.g, g_max)); assert(INSIDE_RANGE(b_min, color.b, b_max)); } return(num); } bool histogram_sector_info::color_get(RGBB color, RGBB &color_best, float &dist_best) { if(!p_start || !num) return(FALSE); color_best = RGBB(0); dist_best = FLT_MAX; HISTOGRAM_COLOR *p_current = p_start; int i; for(i = 0, p_current = p_start; i < num; i++, p_current++) { if(p_current->color == color) { color_best = p_current->color; dist_best = 0; return(TRUE); } RGBB tmp = p_current->color - color; float size = VECT3DI(tmp).size(); if(size < dist_best) { color_best = p_current->color; dist_best = size; } } return(dist_best != FLT_MAX); } void histogram_sector_info::set(HISTOGRAM_COLOR *p_start, int num) { assert(this->p_start == NULL && this->num == 0); this->p_start = p_start; this->num = num; } int histogram_cube_index_get(RGBB color) { int r = COLOR_TO_CUBE_DIMENSION(color.r); int g = COLOR_TO_CUBE_DIMENSION(color.g); int b = COLOR_TO_CUBE_DIMENSION(color.b); return(r*(HISTOGRAM_CUBE_DIMENSION)*(HISTOGRAM_CUBE_DIMENSION) + g*(HISTOGRAM_CUBE_DIMENSION) + b); } int histogram_cube_index_sort(const void *s1, const void *s2) { HISTOGRAM_COLOR *p_s1 = (HISTOGRAM_COLOR *)s1; HISTOGRAM_COLOR *p_s2 = (HISTOGRAM_COLOR *)s2; int i1 = histogram_cube_index_get(p_s1->color); int i2 = histogram_cube_index_get(p_s2->color); return(i1 - i2); } bool histogram_cube::color_get(RGBB color, int size, RGBB &color_best) { int center_r = COLOR_TO_CUBE_DIMENSION(color.r); int center_g = COLOR_TO_CUBE_DIMENSION(color.g); int center_b = COLOR_TO_CUBE_DIMENSION(color.b); int r_min = center_r-size, r_max = center_r+size; int g_min = center_g-size, g_max = center_g+size; int b_min = center_b-size, b_max = center_b+size; int r,g,b; float dist_best = FLT_MAX; for(r = r_min; r <= r_max; r++) { for(g = g_min; g <= g_max; g++) { for(b = b_min; b <= b_max; b++) { if(color_valid(r_min, r_max, g_min, g_max, b_min, b_max, r, g, b)) { RGBB cl; float dist; if(cube[r][g][b].color_get(color, cl, dist)) { if(dist < dist_best) { dist_best = dist; color_best = cl; } } } } } } return(dist_best != FLT_MAX); } RGBB histogram_cube::color_get(RGBB color) { RGBB color_best(0); int i; for(i = 0; i < HISTOGRAM_CUBE_DIMENSION; i++) { if(color_get(color, i, color_best)) { return(color_best); } } pprintf("Cube hit failed for [%d, %d, %d]", color.r, color.g, color.g); // It should not happen... assert(0); return(color_best); } int histogram_cube::color_check(void) { int r,g,b,num = 0; for(r = 0; r < HISTOGRAM_CUBE_DIMENSION; r++) { for(g = 0; g < HISTOGRAM_CUBE_DIMENSION; g++) { for(b = 0; b < HISTOGRAM_CUBE_DIMENSION; b++) { num += cube[r][g][b].color_check(r,g,b); } } } return(num); } histogram_cube::histogram_cube(HISTOGRAM_COLOR *p_hist, int hist_num) { memset(cube,0,sizeof(cube)); // Sort out the histogram data regards to its position qsort(p_hist, hist_num, sizeof(p_hist[0]), histogram_cube_index_sort); // Fill in the cube int index_last = histogram_cube_index_get(p_hist[0].color);; int start = 0; int i, color_num; for(i = 1, color_num = 1; i < hist_num+1; i++, color_num++) { int index_current = histogram_cube_index_get(p_hist[i].color); if(index_current != index_last || i == hist_num) { index_last = index_current; RGBB color = p_hist[start].color; int r = COLOR_TO_CUBE_DIMENSION(color.r); int g = COLOR_TO_CUBE_DIMENSION(color.g); int b = COLOR_TO_CUBE_DIMENSION(color.b); HISTOGRAM_SECTOR_INFO *p_cell = &(cube[r][g][b]); p_cell->set(p_hist+start, color_num); p_cell->color_check(r,g,b); start = i; color_num = 0; } } int n = hist_num - color_check(); assert(n == 0); } void histogram_table::cube_create(void) { if(p_hist && hist_num > HISTOGRAM_CUBE_TRESHOLD) { cube_remove(); p_cube = new HISTOGRAM_CUBE(p_hist,hist_num); } } void histogram_table::cube_remove(void) { if(p_cube) { delete p_cube; p_cube = NULL; } } RGBB histogram_table::color_get(RGBB color) { RGBB best(0); if(p_cube) { best = p_cube->color_get(color); } else { float dist_min = FLT_MAX; HISTOGRAM_COLOR *p_current; int i; for(i = 0, p_current = p_hist; i < hist_num; i++, p_current++) { if(p_current->color == color) { return(color); } RGBB tmp = p_current->color - color; float size = VECT3DI(tmp).size(); if(size < dist_min) { best = p_current->color; dist_min = size; } } } return(best); } bool histogram_table::index_create(void) { index_num = (hist_num < HISTOGRAM_INDEX_TABLE_SIZE) ? HISTOGRAM_INDEX_TABLE_SIZE_SMALL : HISTOGRAM_INDEX_TABLE_SIZE; if(index_num < hist_num) { // histogram is too small for index table - don't use it index_num = 0; } if(!index_num) return(TRUE); assert(index_num < hist_num); float step = (1.0f)/index_num; float border_lower =-step; float border_upper = 0; float current; int hist_index, index_index; for(hist_index = 0, index_index = 0, current = 0.0f; hist_index < hist_num; current += p_hist[hist_index++].probability) { if(border_lower <= current && current < border_upper) { // in range -> continue continue; } // move to next range if(current >= border_upper) { if(index_index >= index_num) { break; } border_lower += step; border_upper += step; // Save first histogram in this range index[index_index].index = hist_index; index[index_index].current = current; index_index++; } } assert(index_index == index_num); return(TRUE); } RGBB histogram_table::color_get(float position) { if(position >= 1) { return(p_hist[hist_num-1].color); } if(position <= 0) { return(p_hist[0].color); } float current; int index_start; if(index_num == 0) { current = 0; index_start = 0; } else { int hash = floorf(position*index_num); assert(hash < index_num); current = index[hash].current; if(current > position) { hash--; current = index[hash].current; assert(current <= position); } index_start = index[hash].index; } int i; for(i = index_start; i < hist_num; i++) { if(current <= position && position < current+p_hist[i].probability) { return(p_hist[i].color); } current += p_hist[i].probability; } return(p_hist[hist_num-1].color); } histogram_table::histogram_table(void) { p_hist = NULL; hist_num = 0; index_num = 0; p_cube = NULL; } histogram_table::histogram_table(SURFACE *p_surf) { p_cube = NULL; p_hist = p_surf->histogram_get(&hist_num); cube_create(); } histogram_table::histogram_table(HISTOGRAM_COLOR *p_histogram, int histogram_num) { p_cube = NULL; p_hist = p_histogram; hist_num = histogram_num; cube_create(); } histogram_table::~histogram_table(void) { cube_remove(); } HISTOGRAM * histogram_new(SURFACE *p_surf) { int hist_num; HISTOGRAM_COLOR *p_table = p_surf->histogram_get(&hist_num); HISTOGRAM *p_hist = NULL; // Only table for now p_hist = new HISTOGRAM_TABLE(p_table, hist_num); return(p_hist); } int histogram_sort_intensity(const void *s1, const void *s2); int histogram_sort_color(const void *s1, const void *s2); int histogram_sort_color_delta(const void *s1, const void *s2); // R,G,B order int histogram_sort_color(const void *s1, const void *s2) { HISTOGRAM_COLOR *p_s1 = (HISTOGRAM_COLOR *)s1; HISTOGRAM_COLOR *p_s2 = (HISTOGRAM_COLOR *)s2; if(p_s1->color.r != p_s2->color.r) return((int)(p_s1->color.r) - (int)(p_s2->color.r)); if(p_s1->color.g != p_s2->color.g) return((int)(p_s1->color.g) - (int)(p_s2->color.g)); return((int)(p_s1->color.b) - (int)(p_s2->color.b)); } /* static int histogram_sort_num(const void *s1, const void *s2) { HISTOGRAM_COLOR *p_s1 = (HISTOGRAM_COLOR *)s1; HISTOGRAM_COLOR *p_s2 = (HISTOGRAM_COLOR *)s2; RGBF c1(p_s1->color); RGBF c2(p_s2->color); float I1 = 0.299f*c1.r + 0.587f*c1.g + 0.114f*c1.b; float I2 = 0.299f*c2.r + 0.587f*c2.g + 0.114f*c2.b; return(int((I1-I2)*100)); } */ /* Color mapping: - */ #define C_RANGE 0.30f #define R_MIN 0 #define G_MIN 0.30f #define B_MIN 0.60f #define O_MIN 0.90f // calculates the color index float color_index(int r, int g, int b) { if(r > g && r > b) { return(R_MIN + color_intensity(r,g,b)*C_RANGE); } if(g > r && g > b) { return(G_MIN + color_intensity(r,g,b)*C_RANGE); } if(b > r && b > g) { return(B_MIN + color_intensity(r,g,b)*C_RANGE); } return(O_MIN + color_intensity(r,g,b)*0.1f); } /* int r1_gain = MAX(p_s1->color.r-p_s1->color.g, p_s1->color.r-p_s1->color.b); int g1_gain = MAX(p_s1->color.g-p_s1->color.r, p_s1->color.g-p_s1->color.b); int b1_gain = MAX(p_s1->color.b-p_s1->color.r, p_s1->color.b-p_s1->color.g); int r2_gain = MAX(p_s2->color.r-p_s2->color.g, p_s2->color.r-p_s2->color.b); int g2_gain = MAX(p_s2->color.g-p_s2->color.r, p_s2->color.g-p_s2->color.b); int b2_gain = MAX(p_s2->color.b-p_s2->color.r, p_s2->color.b-p_s2->color.g); */ // --------------------------- // What is the dominant color? // --------------------------- // r - g - b order int histogram_sort_color_delta(const void *s1, const void *s2) { HISTOGRAM_COLOR *p_s1 = (HISTOGRAM_COLOR *)s1; HISTOGRAM_COLOR *p_s2 = (HISTOGRAM_COLOR *)s2; float i1 = color_index(p_s1->color.r, p_s1->color.g, p_s1->color.b); float i2 = color_index(p_s2->color.r, p_s2->color.g, p_s2->color.b); return((i1-i2)*INT_MAX); } int histogram_sort_intensity(const void *s1, const void *s2) { HISTOGRAM_COLOR *p_s1 = (HISTOGRAM_COLOR *)s1; HISTOGRAM_COLOR *p_s2 = (HISTOGRAM_COLOR *)s2; RGBF c1(p_s1->color); RGBF c2(p_s2->color); float I1 = color_intensity(c1.r,c1.g,c1.b); float I2 = color_intensity(c2.r,c2.g,c2.b); int intensity = (I1-I2)*1000; return(intensity); } int histogram_sort_hue(const void *sr1, const void *sr2) { HISTOGRAM_COLOR *p_s1 = (HISTOGRAM_COLOR *)sr1; HISTOGRAM_COLOR *p_s2 = (HISTOGRAM_COLOR *)sr2; RGBF c1(p_s1->color); RGBF c2(p_s2->color); float h1,s1,v1; float h2,s2,v2; rgb_to_hsv(c1.r, c1.g, c1.b, h1, s1, v1); rgb_to_hsv(c2.r, c2.g, c2.b, h2, s2, v2); int diff = (h1-h2)*INT_MAX; return(diff); } HISTOGRAM_COLOR * surface::histogram_get(int *p_num) { if(surface_format != SURFACE_TEXTURE) { *p_num = 0; return(NULL); } tpos width = width_get(); tpos height = height_get(); assert(width > 0 && height > 0); tpos pixel_num = width*height; HISTOGRAM_COLOR *p_list = (HISTOGRAM_COLOR *)mmalloc(sizeof(HISTOGRAM_COLOR)*pixel_num); tpos x,y; int i = 0; for(y = 0; y < height; y++) { for(x = 0; x < width; x++) { tcolor color = *(tcolor *)pixels_get(x, y); p_list[i].color = RGBB(color); i++; } } // Sort by color qsort(p_list, pixel_num, sizeof(HISTOGRAM_COLOR), histogram_sort_color); HISTOGRAM_COLOR *p_final = (HISTOGRAM_COLOR *)mmalloc(sizeof(HISTOGRAM_COLOR)*pixel_num); int index = 0; p_final[index] = p_list[0]; p_final[index].count = 1; for(i = 1; i < pixel_num; i++) { if(p_final[index].color != p_list[i].color) { // Move current index to another one index++; p_final[index].color = p_list[i].color; } p_final[index].count++; } ffree(p_list); // index+1 is number of unique colors int final_num = *p_num = index+1; pprintf("Histogram contains %d colors...", final_num); // Sort by count qsort(p_final, final_num, sizeof(HISTOGRAM_COLOR), histogram_sort_hue); for(i = 0; i < final_num; i++) { p_final[i].probability = (float)p_final[i].count / pixel_num; } return(p_final); } surface::surface(SURFACE_CLASS sclass, PIXEL_FORMAT format) : surface_class(sclass), pixel_format(format), surface_format(SURFACE_TEXTURE), used(0) { } surface::~surface(void) { clear(); } berusky2-0.12/src/age/graph/lighting.h0000644000175000017500000001237113674426075014547 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __LIGHTING_H__ #define __LIGHTING_H__ /* * Basic phong illumination model */ typedef class phong_lighting_intensity { public: // Light angle = (angle_min + I*angle_scale); float light_angle_min; float light_angle_scale; public: void light_intensity_set(float min, float scale) { light_angle_min = min; light_angle_scale = scale; } void light_intensity_range_set(float min, float max) { light_angle_min = min; light_angle_scale = max-min; } // Ignore back-faces public: bool light_bidirectional; private: bool light_range_active; float light_range; bool light_fade_active; float light_fade_constant; float light_fade_linear; float light_fade_cubic; public: // Calculate simple light intensity (w/o distance) float light_intensity_get(VECT *p_light_vector, VECT *p_normal) { float I = vect_dot_product(p_light_vector,p_normal); if(light_bidirectional) I = fabs(I); if(I < 0.0f) I = 0.0f; I = light_angle_min + I*light_angle_scale; if(I < 0) I = 0; if(I > 1) I = 1; return(I); } // Calculate simple light intensity (with distance) float light_intensity_get(VECT *p_light_vector, VECT *p_light_position, VECT *p_normal, VECT *p_normal_position) { float I = vect_dot_product(p_light_vector,p_normal); if(light_bidirectional) I = fabs(I); if(I < 0.0f) I = 0.0f; I = light_angle_min + I*light_angle_scale; if(I < 0) I = 0; if(I > 1) I = 1; if(light_range_active || light_fade_active) { float distance = point_dist(p_light_position,p_normal_position); if(light_range_active && distance > light_range) return(0.0f); if(light_fade_active) { I *= 1.0f/(light_fade_constant+ light_fade_linear*distance+ light_fade_cubic*distance*distance); } } return(I); } public: phong_lighting_intensity(void); } PHONG_LIGHTING_INTENSITY; typedef struct phong_lighting_color { RGBAF phong_light_color_ambient; bool phong_light_diffuse; RGBAF phong_light_color_diffuse; bool phong_light_specular; RGBAF phong_light_color_specular; float phong_light_color_specular_shine; public: RGBAF * phong_lighting_calc(RGBAF *p_material_color, RGBAF *p_final_color, float Intensity) { RGBAF tmp = *p_material_color; if(phong_light_diffuse) { tmp *= (phong_light_color_ambient + phong_light_color_diffuse*Intensity); } if(phong_light_specular) { // Shine parameters - which part of the range is exposed float specular_intensity = Intensity - (1.0f - phong_light_color_specular_shine); if(specular_intensity > 0) { specular_intensity *= (1.0f / phong_light_color_specular_shine); tmp += phong_light_color_specular*specular_intensity; } } *p_final_color = tmp; return(p_final_color); } public: phong_lighting_color(void); } PHONG_LIGHTING_COLOR; typedef class phong_lighting : public phong_lighting_intensity, public phong_lighting_color { public: RGBAF * phong_lighting_get(RGBAF *p_material_color, RGBAF *p_final_color, VECT *p_light_vector, VECT *p_normal) { float I = light_intensity_get(p_light_vector, p_normal); return(phong_lighting_calc(p_material_color, p_final_color, I)); } RGBAF * phong_lighting_get(RGBAF *p_material_color, RGBAF *p_final_color, VECT *p_light_vector, VECT *p_light_position, VECT *p_normal, VECT *p_normal_position) { float I = light_intensity_get(p_light_vector, p_light_position, p_normal, p_normal_position); return(phong_lighting_calc(p_material_color, p_final_color, I)); } public: phong_lighting(void); } PHONG_LIGHTING; #endif // __LIGHTING_H__ berusky2-0.12/src/age/graph/texture_unit.h0000644000175000017500000000275313674426075015504 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Texture unit(s) setup */ #ifndef __TEXTURE_UNIT_H__ #define __TEXTURE_UNIT_H__ typedef class gl_texture_unit { } GL_TEXTURE_UNIT; #endif // __TEXTURE_UNIT_H__ berusky2-0.12/src/age/graph/triangle.cpp0000644000175000017500000000246513674426075015105 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/texture_unit.cpp0000644000175000017500000000246513674426075016037 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/object_world.cpp0000644000175000017500000000341713674426075015753 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" void object_world::object_world_hierarchy_update(bool forced) { object_world *p_parent = (object_world *)render_hierarchy_parent_get(); if(p_parent && p_parent->object_is_geometry()) { if(forced || p_parent->matrix_notified_changed()) { matrix_mult(get(),p_parent->world_get(),&world_global); matrix_notified_change_set(); } } else { if(forced || matrix_notified_changed()) { world_global = *(get()); } } } berusky2-0.12/src/age/graph/surface.h0000644000175000017500000001761213674426075014375 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SURFACE_H__ #define __SURFACE_H__ #include // ------------------------------------------------------- // the surface class // ------------------------------------------------------- class surface; typedef class surface SURFACE; typedef enum { SDL_SURFACE, SW_SURFACE, MASK_SURFACE, HEIGT_SURFACE } SURFACE_CLASS; typedef enum { IMAGE_BMP = 0 } IMAGE_FORMAT; typedef enum { SURFACE_TEXTURE = 0, SURFACE_ALPHA, SURFACE_DISPLAY } SURFACE_FORMAT; typedef enum { PIXEL_TCOLOR, PIXEL_FLOAT, PIXEL_BOOL, } PIXEL_FORMAT; typedef enum { TARGET_SET = 0, TARGET_ADD, TARGET_SUB, TARGET_MULT } BLIT_OPERATION; /* * Base histogram class */ typedef class histogram { public: // Get the nearest color from the histogram virtual RGBB color_get(RGBB color) { return(RGBB(0)); } // Get the nearest color from the histogram virtual RGBB color_get(float position) { return(RGBB(0)); } public: histogram(void) {}; virtual ~histogram(void) {}; } HISTOGRAM; /* * Histogram implementation */ typedef struct histogram_color { RGBB color; union { float probability; int count; }; } HISTOGRAM_COLOR; typedef struct histogram_index { int index; float current; } HISTOGRAM_INDEX; typedef class histogram_sector_info { HISTOGRAM_COLOR *p_start; int num; public: int color_check(int r, int g, int b); bool color_get(RGBB color, RGBB &color_best, float &dist_best); void set(HISTOGRAM_COLOR *p_start, int num); } HISTOGRAM_SECTOR_INFO; #define HISTOGRAM_CUBE_DIMENSION_SHIFT 6 #define HISTOGRAM_CUBE_DIMENSION ((1)<<(HISTOGRAM_CUBE_DIMENSION_SHIFT)) #define COLOR_TO_CUBE_DIMENSION(c) ((c)>>(8-HISTOGRAM_CUBE_DIMENSION_SHIFT)) #define COLOR_FROM_CUBE_DIMENSION(c) ((c)<<(8-HISTOGRAM_CUBE_DIMENSION_SHIFT)) #define COLOR_CUBE_SIZE ((1)<<(8-HISTOGRAM_CUBE_DIMENSION_SHIFT)) typedef class histogram_cube { // RGB indexes HISTOGRAM_SECTOR_INFO cube[HISTOGRAM_CUBE_DIMENSION] [HISTOGRAM_CUBE_DIMENSION] [HISTOGRAM_CUBE_DIMENSION]; private: bool color_valid(int r_min, int r_max, int g_min, int g_max, int b_min, int b_max, int r, int g, int b) { if(r < 0 || r >= HISTOGRAM_CUBE_DIMENSION) return(FALSE); if(g < 0 || g >= HISTOGRAM_CUBE_DIMENSION) return(FALSE); if(b < 0 || b >= HISTOGRAM_CUBE_DIMENSION) return(FALSE); // at least one color has to be equal min or max return((r == r_min || r == r_max) || (g == g_min || g == g_max) || (b == b_min || b == b_max)); } bool color_get(RGBB color, int size, RGBB &color_best); public: int color_check(void); RGBB color_get(RGBB color); public: histogram_cube(HISTOGRAM_COLOR *p_hist, int hist_num); } HISTOGRAM_CUBE; /* * 'Flat' histogram model - 1D linear table */ #define HISTOGRAM_INDEX_TABLE_SIZE 100 #define HISTOGRAM_INDEX_TABLE_SIZE_SMALL 10 #define HISTOGRAM_CUBE_TRESHOLD 100 typedef struct histogram_table : public histogram { // Basic histogram table HISTOGRAM_COLOR *p_hist; int hist_num; // Indexes for probability look-up HISTOGRAM_INDEX index[HISTOGRAM_INDEX_TABLE_SIZE]; int index_num; // Index the histogram table private: bool index_create(void); private: HISTOGRAM_CUBE *p_cube; private: void cube_create(void); void cube_remove(void); public: // Get color based in the color position (probability) // position is from <0,1> RGBB color_get(float position); // Get the nearest color from the histogram RGBB color_get(RGBB color); public: histogram_table(void); histogram_table(SURFACE *p_surf); histogram_table(HISTOGRAM_COLOR *p_histogram, int histogram_num); ~histogram_table(void); } HISTOGRAM_TABLE; HISTOGRAM * histogram_new(SURFACE *p_surf); // Undefined height pixel #define HEIGHT_UNSET (FLOAT_UNDEFINED) typedef class surface { SURFACE_CLASS surface_class; public: SURFACE_CLASS surface_class_get(void) { return(surface_class); } private: PIXEL_FORMAT pixel_format; public: PIXEL_FORMAT pixel_format_get(void) { return(pixel_format); } public: virtual void * pixels_get(void) = 0; virtual void * pixels_get(tpos x, tpos y) = 0; protected: SURFACE_FORMAT surface_format; // High-level surface format public: virtual bool lock_required(void) { return(FALSE); } virtual bool locked(void) { return(TRUE); }; virtual void lock(void) {}; virtual void unlock(void) {}; private: tcount used; public: tcount ref_get(void) { return(used); } void ref_inc(void) { assert(used >= 0); used++; } void ref_dec(void) { used--; assert(used >= 0); } public: virtual bool loaded(void) = 0; virtual bool load(const char *p_file, SURFACE_FORMAT format = SURFACE_TEXTURE) = 0; virtual bool load_alpha(const char *p_file) = 0; virtual bool save(const char *p_file, IMAGE_FORMAT format = IMAGE_BMP) = 0; virtual void scale(tpos nx, tpos ny) = 0; public: virtual void clear(void) {}; virtual void create(tpos width, tpos height, SURFACE_FORMAT format = SURFACE_TEXTURE) = 0; public: virtual void convert_to_texture(void) {}; virtual void convert_to_display_format(void) {}; virtual void convert_to_alpha(void) {}; virtual void convert_to_heightmap(void) {}; public: virtual tpos width_get(void) = 0; virtual tpos height_get(void) = 0; virtual void size_get(tpos *p_dx, tpos *p_dy) = 0; RECT2DI rect_get(void) { tpos dx,dy; size_get(&dx, &dy); RECT2DI r(0, 0, dx, dy); return(r); } bool pixel_valid(tpos x, tpos y) { tpos dx,dy; size_get(&dx, &dy); return(x >= 0 && x < dx && y >= 0 && y < dy); } bool rect_trim(tpos &x, tpos &y, tpos &dx, tpos &dy) { tpos sdx,sdy; size_get(&sdx, &sdy); if(x >= sdx || y >= sdy) { return(FALSE); } else { if(x < 0) { dx += x; x = 0; } if(y < 0) { dy += y; y = 0; } } if(x+dx >= sdx) { dx = sdx-x; } if(y+dy >= sdy) { dy = sdy-y; } return(dx > 0 && dy > 0); } public: // Return histogram as flat table HISTOGRAM_COLOR * histogram_get(int *p_num); public: surface(SURFACE_CLASS sclass, PIXEL_FORMAT format); virtual ~surface(void); } SURFACE; #endif // __SURFACE_H__ berusky2-0.12/src/age/graph/surface_sw.h0000644000175000017500000000770013674426075015103 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SURFACE_SW_H__ #define __SURFACE_SW_H__ typedef class surface_sw : public surface { public: // Blending operation, used by pixel_set() BLEND_OPERATION op; protected: tcolor *p_pixels; public: bool loaded(void) { return(p_pixels != NULL); } void * pixels_get(void) { return(p_pixels); } void * pixels_get(tpos x, tpos y) { return(p_pixels ? p_pixels + width*y + x : NULL); } protected: tpos width; tpos height; public: tpos width_get(void) { return(width); } tpos height_get(void) { return(height); } void size_get(tpos *p_dx, tpos *p_dy) { *p_dx = width; *p_dy = height; } public: bool load(const char *p_file, SURFACE_FORMAT format = SURFACE_TEXTURE); bool load_alpha(const char *p_file); bool save(const char *p_file, IMAGE_FORMAT format = IMAGE_BMP); void copy(class surface_sw *p_src); void move(class surface_sw *p_src); public: void clear(void); void create(tpos width, tpos height, SURFACE_FORMAT format = SURFACE_TEXTURE); void create(SURFACE *p_surf, SURFACE_FORMAT format = SURFACE_TEXTURE); public: void fill(tcolor color); void fill(tpos sx, tpos sy, tpos dx, tpos dy, tcolor color); void blit(class surface_sw *p_dst, tpos tx = 0, tpos ty = 0); void blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_sw *p_dst, tpos tx = 0, tpos ty = 0); void scale(int nx, int ny); /* * Color bitmaps */ tcolor pixel_get(int x, int y) { tcolor color = 0; if(pixel_valid(x,y)) { tcolor *p_pixels = (tcolor *)pixels_get(); color = (*(p_pixels+y*width+x)); } return(color); } void pixel_set(int x, int y, tcolor color) { if(pixel_valid(x,y)) { if(op.op == OPERATION_SET && !op.blend) { pixel_set_simple(x,y,color); } else { pixel_set_complex(x,y,RGBB(color)); } } } private: void pixel_set_simple(int x, int y, tcolor color) { tcolor *p_pixels = (tcolor *)pixels_get(); *(p_pixels+y*width+x) = color; } void pixel_set_complex(int x, int y, RGBB color); public: // look for near color bool pixel_search(int x, int y, tcolor color, int range, int &px, int &py, float &distance_best); bool pixel_search_square(int x, int y, tcolor color, int distance, int &px, int &py, float &distance_best); public: surface_sw(PIXEL_FORMAT format = PIXEL_TCOLOR); surface_sw(char *p_file, PIXEL_FORMAT format = PIXEL_TCOLOR); surface_sw(tpos width, tpos height, PIXEL_FORMAT format = PIXEL_TCOLOR); ~surface_sw(void); } SURFACE_SW; #endif // __SURFACE_SW_H__ berusky2-0.12/src/age/graph/object_hierarchy.cpp0000644000175000017500000000251213674426075016575 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" berusky2-0.12/src/age/graph/camera.h0000644000175000017500000002541313674426075014173 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Settings/Animation for camera */ #ifndef __CAMERA_H__ #define __CAMERA_H__ // Camera flags #define CHANGED_CAMERA (1<<1) // Camera matrix was changed #define CHANGED_CAMERA_3DS (1<<2) // 3DS camera was changed #define CHANGED_CAMERA_POLAR (1<<3) // Polar camera was changed #define CAMERA_POLAR_QUAT (1<<4) // Polar camera uses QUAT/angles #define CAMERA_POLAR_ANGLES (1<<5) typedef enum { CAMERA_TYPE_BASE = 0, CAMERA_TYPE_3DS, CAMERA_TYPE_POLAR } CAMERA_TYPE; // Base camera object typedef class camera_object : public scene_object, public object_transformation, public camera_interface { protected: CAMERA_TYPE camera_type; FLAG_INTERFACE camera_changes; public: CAMERA_TYPE camera_type_get(void) { return(camera_type); } public: void projection_adjust(void); public: virtual GLMATRIX * camera_get(GLMATRIX *p_camera) { update(); return(camera_interface::camera_get(p_camera)); } virtual GLMATRIX * camera_invert_get(GLMATRIX *p_camera_invert) { update(); return(camera_interface::camera_invert_get(p_camera_invert)); } //protected: public: virtual GLMATRIX * camera_get(void) { update(); return(camera_interface::camera_get()); } virtual GLMATRIX * camera_invert_get(void) { update(); return(camera_interface::camera_invert_get()); } public: void camera_set(GLMATRIX *p_camera) { camera_interface::camera_set(p_camera); } void camera_set(GLMATRIX *p_camera, GLMATRIX *p_camera_invert) { camera_interface::camera_set(p_camera, p_camera_invert); } void camera_invert_set(GLMATRIX *p_camera_invert) { camera_interface::camera_invert_set(p_camera_invert); } protected: // Update all changed parts of camera virtual void update(void) {}; public: // Set this camera as active (i.e. copy it to scene graphics pipeline) void set(void); public: // load/save protected: void camera_transformed(void) { camera_update(); } public: camera_object(class scene *p_scene) : scene_object(p_scene) { object_transformation_setup(camera_interface::camera_invert_get(), (OBJECT_TRANSFORMATION_FUNC)(&camera_object::camera_transformed)); camera_type = CAMERA_TYPE_BASE; } } CAMERA_OBJECT, CAMERA_BASE; // 3DS (position/target/roll) camera interface typedef class camera_3ds : public camera_object { protected: VECT target; // target-point of camera VECT pos; // position of camera float roll; // roll private: void camera_3ds_update(void) { camera_calc(camera_interface::camera_get(), camera_interface::camera_invert_get(), &pos, &target, roll); camera_projection_needs_update = TRUE; } public: /* * Camera position settings */ void position_set(VECT *p_pos) { pos = *p_pos; camera_changes.flag_set(CHANGED_CAMERA_3DS); } void position_set(float x, float y, float z) { pos.x = x; pos.y = y; pos.z = z; camera_changes.flag_set(CHANGED_CAMERA_3DS); } void position_add(VECT *p_pos) { pos += *p_pos; camera_changes.flag_set(CHANGED_CAMERA_3DS); } void position_add(float x, float y, float z) { pos.x += x; pos.y += y; pos.z += z; camera_changes.flag_set(CHANGED_CAMERA_3DS); } VECT * position_get(void) { return(&pos); } /* * Camera target settings */ virtual void target_set(VECT *p_target) { target = *p_target; camera_changes.flag_set(CHANGED_CAMERA_3DS); } virtual void target_set(float x, float y, float z) { target.x = x; target.y = y; target.z = z; camera_changes.flag_set(CHANGED_CAMERA_3DS); } virtual void target_add(VECT *p_target) { target = *p_target; camera_changes.flag_set(CHANGED_CAMERA_3DS); } virtual void target_add(float x, float y, float z) { target.x += x; target.y += y; target.z += z; camera_changes.flag_set(CHANGED_CAMERA_3DS); } VECT * target_get(void) { return(&target); } /* * Angles */ void roll_set(float nroll) { roll = nroll; camera_changes.flag_set(CHANGED_CAMERA_3DS); } void roll_add(float nroll) { roll += nroll; camera_changes.flag_set(CHANGED_CAMERA_3DS); } float roll_get(void) { return(roll); } /* * Calculation */ void camera_3ds_set(VECT *p_position, VECT *p_target, float nroll) { pos = *p_position; target = *p_target; roll = nroll; camera_changes.flag_set(CHANGED_CAMERA_3DS); } protected: virtual void update(void); protected: void camera_transformed(void) { camera_object::camera_transformed(); VECT old_pos = pos, tmp; GLMATRIX *p_cam = camera_interface::camera_invert_get(); p_cam->translation_get(&pos); tmp = pos - old_pos; target += tmp; } public: camera_3ds(class scene *p_scene) : camera_object(p_scene), target(0,0,0), pos(0,0,-1), roll(0) { object_transformation_setup(camera_interface::camera_invert_get(), (OBJECT_TRANSFORMATION_FUNC)(&camera_3ds::camera_transformed)); camera_type = CAMERA_TYPE_3DS; } } CAMERA_3DS; #define MAX_ELEVATION (DEG2RAD(89)) // Spherical (point/angle/angle/distance) camera interface typedef class camera_polar : public camera_3ds { // Rotation is given by separate angles float fi; // evelation of camera float rfi; // rotation of camera float dist; // distance of camera // Rotation is given by quaternion QUAT qrotation; private: void camera_polar_update(void) { if(camera_changes.flag_get(CAMERA_POLAR_ANGLES)) { camera_calc(camera_interface::camera_get(), camera_interface::camera_invert_get(), &target,rfi,fi,dist); } else { camera_calc(camera_interface::camera_get(), camera_interface::camera_invert_get(), &target,&qrotation,dist); } camera_projection_needs_update = TRUE; } public: /* * Distances */ void distance_set(float distance) { dist = distance; if(dist < 0) dist = 0; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_ANGLES); } void distance_add(float distance) { dist += distance; if(dist < 0) dist = 0; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_ANGLES); } float distance_get(void) { return(dist); } /* * Camera elevation */ void elevation_set(float elevation) { fi = elevation; if(fi > MAX_ELEVATION) fi = MAX_ELEVATION; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_ANGLES); } void elevation_add(float elevation) { fi += elevation; if(fi > MAX_ELEVATION) fi = MAX_ELEVATION; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_ANGLES); } float elevation_get(void) { return(camera_changes.flag_get(CAMERA_POLAR_ANGLES) ? fi : 0.0f); } /* * Camera rotation */ void rotation_set(float rotation) { rfi = rotation; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_ANGLES); } void rotation_add(float rotation) { rfi += rotation; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_ANGLES); } float rotation_get(void) { return(camera_changes.flag_get(CAMERA_POLAR_ANGLES) ? rfi : 0.0f); } void rotation_quat_set(QUAT *p_quat) { qrotation = *p_quat; camera_changes.flag_set(CHANGED_CAMERA_POLAR); camera_changes.flag_set(CAMERA_POLAR_QUAT); } QUAT * rotation_quat_get(void) { return(camera_changes.flag_get(CAMERA_POLAR_QUAT) ? &qrotation : NULL); } public: virtual void update(void); protected: void camera_transformed(void) { camera_3ds::camera_transformed(); } public: camera_polar(class scene *p_scene) : camera_3ds(p_scene), fi(DEG2RAD(0)), rfi(DEG2RAD(0)), dist(1) { object_transformation_setup(camera_interface::camera_invert_get(), (OBJECT_TRANSFORMATION_FUNC)(&camera_polar::camera_transformed)); camera_type = CAMERA_TYPE_POLAR; } } CAMERA_POLAR; // Camera list typedef class camera_list : public scene_object_list { private: CAMERA_OBJECT * create_basic_object(CAMERA_TYPE type); public: CAMERA_OBJECT * create(CAMERA_TYPE type) { CAMERA_OBJECT *p_obj = create_basic_object(type); object_list_insert(p_obj); return(p_obj); } CAMERA_OBJECT * create(void) { return(create(CAMERA_TYPE_BASE)); } void destroy(SCENE_OBJECT *p_camera) { object_list_remove(p_camera); delete (CAMERA_OBJECT *)p_camera; } public: CAMERA_OBJECT * get_first(void) { return((CAMERA_OBJECT *)object_list_get_first()); } public: CAMERA_OBJECT * p_active; public: void active_set(CAMERA_OBJECT *p_camera) { p_active = p_camera; } CAMERA_OBJECT * active_get(void) { return(p_active); } public: camera_list(class scene *p_scene) : scene_object_list(p_scene) { p_active = NULL; } ~camera_list(void) { } } CAMERA_LIST; #endif //__CAMERA_H__ berusky2-0.12/src/age/graph/object_box.cpp0000644000175000017500000000601113674426075015405 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" BOX * object_box::box_child_create(void) { if(object_box_get() == NULL) return(NULL); BOX_TYPE type = object_box_type_get(); //bool translate = FALSE; int i,num = 1; object_box *p_child = (object_box *)render_hierarchy_child_get(); while(p_child) { /* if(p_child->object_box_type_get() != type) translate = TRUE; */ p_child = (object_box *)p_child->render_hierarchy_sibling_get(); num++; } BOX *p_ret = NULL; if(num == 1) { return(box_copy(object_box_get())); } else { switch(type) { case BOX_AABB: { AABB *p_nlist = (AABB *)mmalloc(sizeof(AABB)*num); object_box_get()->to_aabb(p_nlist); object_box *p_child = (object_box *)render_hierarchy_child_get(); i = 1; while(p_child) { BOX *p_box = p_child->object_box_get(); p_box->to_aabb(p_nlist+i++); p_child = (object_box *)p_child->render_hierarchy_sibling_get(); } p_ret = new AABB(p_nlist,num); free(p_nlist); break; } case BOX_OBB: { OBB *p_nlist = (OBB *)mmalloc(sizeof(OBB)*num); object_box_get()->to_obb(p_nlist); object_box *p_child = (object_box *)render_hierarchy_child_get(); i = 1; while(p_child) { BOX *p_box = p_child->object_box_get(); p_box->to_obb(p_nlist+i++); p_child = (object_box *)p_child->render_hierarchy_sibling_get(); } p_ret = new OBB(p_nlist,num); free(p_nlist); break; } case BOX_CIRCLE: break; default: break; } } return(p_ret); } berusky2-0.12/src/age/graph/matrix_animated.h0000644000175000017500000000540613674426075016111 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __MATRIX_ANIMATED_H__ #define __MATRIX_ANIMATED_H__ /* Animation (bezier / linear) || \/ position/rotation/scale || \/ final notified matrix */ #define CHANGED_POSITION (1<<1) #define CHANGED_ROTATION (1<<2) #define CHANGED_SCALE (1<<3) typedef class matrix_animated : public flag_interface { VECT aposition; QUAT arotation; VECT ascale; VECT pivot; public: MATRIX_NOTIFIED * update(MATRIX_NOTIFIED *p_result, MATRIX_NOTIFIED *p_top = NULL) { if(flag_get(CHANGED_POSITION|CHANGED_ROTATION|CHANGED_SCALE)) { if(flag_get(CHANGED_POSITION)) { p_result->translation_set(&aposition); flag_clear(CHANGED_POSITION); } if(flag_get(CHANGED_ROTATION)) { p_result->rotation_set(&arotation); flag_clear(CHANGED_ROTATION); } if(flag_get(CHANGED_SCALE)) { p_result->scale(&ascale); flag_clear(CHANGED_SCALE); } } if(p_top) { if(p_result->matrix_notified_changed() || p_top->matrix_notified_changed()) { if(pivot.x != 0.0f || pivot.y != 0.0f || pivot.z != 0.0f) { } else { matrix_mult(p_result,p_top,p_result); } } } return(p_result); } public: matrix_animated(void) : aposition(0,0,0), arotation(1,0,0,0), ascale(1,1,1), pivot(0,0,0) { } } MATRIX_ANIMATED; #endif // __MATRIX_ANIMATED_H__ berusky2-0.12/src/age/graph/surface_sdl.cpp0000644000175000017500000003063013674426075015565 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include // Constants and types #include "age.h" // ------------------------------------------------------- // the surface class // ------------------------------------------------------- SDL_Surface * surface_sdl::convert_to_texture(SDL_Surface *p_surf) { assert(p_surf); assert(!(p_surf->flags&SDL_SWSURFACE)); SDL_PixelFormat myformat; memset(&myformat,0,sizeof(myformat)); myformat.BitsPerPixel = 32; myformat.BytesPerPixel = 4; #if SDL_BYTEORDER == SDL_BIG_ENDIAN myformat.Rmask = 0xff000000; myformat.Gmask = 0x00ff0000; myformat.Bmask = 0x0000ff00; myformat.Amask = 0x000000ff; #else myformat.Rmask = 0x000000ff; myformat.Gmask = 0x0000ff00; myformat.Bmask = 0x00ff0000; myformat.Amask = 0xff000000; #endif myformat.Rshift = 0; myformat.Gshift = 8; myformat.Bshift = 16; myformat.Ashift = 24; // Create a new-one SDL_Surface *p_new = SDL_ConvertSurface(p_surf, &myformat, SDL_SWSURFACE); if(!p_new) { PERROR(TRUE, "Can't convert surface %p to texture format!",p_surf); } // Ensure there aren't any extra bytes in a end of scan line if(p_new->pitch != p_new->w*myformat.BytesPerPixel) { PERROR(TRUE, "Error in texture conversion!"); } return(p_new); } void surface_sdl::convert_to_texture(void) { SDL_Surface *p_tmp = convert_to_texture(p_surf); SDL_FreeSurface(p_surf); p_surf = p_tmp; surface_format = SURFACE_TEXTURE; } SDL_Surface * surface_sdl::convert_to_display_format(SDL_Surface *p_surf) { assert(p_surf); SDL_Surface *p_new = SDL_DisplayFormat(p_surf); if(!p_new) { PERROR(TRUE, "Can't convert surface %p to display format!",p_surf); } return(p_new); } void surface_sdl::convert_to_display_format(void) { SDL_Surface *p_tmp = convert_to_display_format(p_surf); SDL_FreeSurface(p_surf); p_surf = p_tmp; surface_format = SURFACE_DISPLAY; } SDL_Surface * surface_sdl::convert_to_alpha(SDL_Surface *p_surf) { assert(p_surf); SDL_Surface *p_tmp = convert_to_texture(p_surf); // Convert only valid surfaces in texture format assert(p_tmp && p_tmp->format->BytesPerPixel == 4); assert(!lock_required(p_tmp)); dword *p_pix = (dword *)p_tmp->pixels; assert(p_pix); int l, lenght = p_tmp->w*p_tmp->h; PIXELFORMAT *p_format = p_tmp->format; int Rmask = p_format->Rmask; int Gmask = p_format->Gmask; int Bmask = p_format->Bmask; int Amask = p_format->Amask; int Rshift = p_format->Rshift; int Gshift = p_format->Gshift; int Bshift = p_format->Bshift; int Ashift = p_format->Ashift; for(l = 0; l < lenght; l++, p_pix++) { tcolor pixel = *p_pix; int alpha = ((pixel&Rmask)>>Rshift) + ((pixel&Gmask)>>Gshift) + ((pixel&Bmask)>>Bshift); alpha /= 3; *p_pix = (alpha<format->BytesPerPixel == 4); assert(!lock_required(p_dest)); assert(p_src->format->BytesPerPixel == 4); assert(!lock_required(p_src)); dword *p_psrc = (dword *)p_src->pixels; dword *p_pdst = (dword *)p_dest->pixels; assert(p_psrc && p_pdst); int l, lenght = p_src->w*p_src->h; for(l = 0; l < lenght; l++, p_psrc++, p_pdst++) { *p_pdst |= *p_psrc; } return(p_dest); } void surface_sdl::create(tpos width, tpos height, SURFACE_FORMAT format) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN Uint32 Rmask = 0xff000000; Uint32 Gmask = 0x00ff0000; Uint32 Bmask = 0x0000ff00; Uint32 Amask = 0x000000ff; #else Uint32 Rmask = 0x000000ff; Uint32 Gmask = 0x0000ff00; Uint32 Bmask = 0x00ff0000; Uint32 Amask = 0xff000000; #endif p_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, Rmask, Gmask, Bmask, Amask); if(p_surf == NULL) { pprintf("SDL_CreateRGBSurface failed: %s\n", SDL_GetError()); assert(p_surf != NULL); } SDL_SetAlpha(p_surf,0,SDL_ALPHA_OPAQUE); locks = 0; surface_format = format; } bool surface_sdl::load(const char *p_file, SURFACE_FORMAT format) { assert(p_surf == NULL); p_surf = IMG_Load(p_file); if(p_surf) { if(format == SURFACE_TEXTURE) { convert_to_texture(); } else { convert_to_display_format(); } } return(p_surf != NULL); } bool surface_sdl::load_alpha(const char *p_file) { if(p_surf == NULL) return(FALSE); SDL_Surface *p_tmp = IMG_Load(p_file); if(p_tmp) { SDL_Surface *p_alpa = convert_to_alpha(p_tmp); merge(p_surf, p_alpa); SDL_FreeSurface(p_tmp); SDL_FreeSurface(p_alpa); } return(p_tmp != NULL); } bool surface_sdl::save(const char *p_file, IMAGE_FORMAT format) { if(pixels_get()) { SDL_SaveBMP(p_surf, p_file); } return(TRUE); } void surface_sdl::copy(class surface_sdl *p_src) { clear(); // Source surface is valid - copy pixels if(p_src->p_surf) { p_surf = SDL_ConvertSurface(p_src->p_surf, p_src->p_surf->format, p_src->p_surf->flags); assert(p_surf); } else { *this = *p_src; } surface_format = p_src->surface_format; locks = 0; } void surface_sdl::move(class surface_sdl *p_src) { clear(); *this = *p_src; p_src->p_surf = NULL; locks = 0; } void surface_sdl::clear(void) { assert(ref_get() == 0); if(p_surf) { SDL_FreeSurface(p_surf); p_surf = NULL; } locks = 0; } surface_sdl::surface_sdl(void) : surface(SDL_SURFACE, PIXEL_TCOLOR), p_surf(NULL), locks(0) { } surface_sdl::surface_sdl(char *p_file, SURFACE_FORMAT format_) : surface(SDL_SURFACE, PIXEL_TCOLOR), p_surf(NULL), locks(0) { load(p_file, format_); } surface_sdl::surface_sdl(SDL_Surface *p_surf_, SURFACE_FORMAT format_, int convert) : surface(SDL_SURFACE, PIXEL_TCOLOR), p_surf(p_surf_), locks(0) { if(convert && p_surf) { if(format_ == SURFACE_TEXTURE) { convert_to_texture(); } else { convert_to_display_format(); } } } surface_sdl::surface_sdl(tpos width, tpos height, SURFACE_FORMAT format_) : surface(SDL_SURFACE, PIXEL_TCOLOR), p_surf(NULL), locks(0) { create(width,height,format_); } // Color-key set void surface_sdl::ckey_set(trgbcomp r, trgbcomp g, trgbcomp b) { if(p_surf) { int ret = SDL_SetColorKey(p_surf, SDL_SRCCOLORKEY, SDL_MapRGB(p_surf->format, r, g, b)); assert(ret != -1); } } void surface_sdl::ckey_set(tcolor color) { if(p_surf) { int ret = SDL_SetColorKey(p_surf, SDL_SRCCOLORKEY, color); assert(ret != -1); } } void surface_sdl::fill(tcolor color) { if(p_surf) { SDL_FillRect(p_surf, NULL, color); } } void surface_sdl::fill(tpos x, tpos y, tpos dx, tpos dy, tcolor color) { if(p_surf) { SDL_Rect rec; /* Make sure no info will be lost in the conversion to a narrower type. */ assert(x < INT16_MAX); assert(y < INT16_MAX); assert(dx < UINT16_MAX); assert(dy < UINT16_MAX); rec = { (Sint16) x, (Sint16) y, (Uint16) dx, (Uint16) dy }; SDL_FillRect(p_surf, &rec, color); } } // blit whole source surtace to destination surface void surface_sdl::blit(class surface_sdl *p_dst, tpos tx, tpos ty) { if(p_surf) { SDL_Rect dst_rec; /* Make sure no info will be lost in the conversion to a narrower type. */ assert(tx < INT16_MAX); assert(ty < INT16_MAX); assert(p_surf->w < UINT16_MAX); assert(p_surf->h < UINT16_MAX); dst_rec = { (Sint16) tx, (Sint16) ty, (Uint16) p_surf->w, (Uint16) p_surf->h}; SDL_BlitSurface(p_surf, NULL, p_dst->p_surf, &dst_rec); } } // blit part of source surface to destination surface void surface_sdl::blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface_sdl *p_dst, tpos tx, tpos ty) { if(p_surf) { SDL_Rect src_rec; SDL_Rect dst_rec; /* Make sure no info will be lost in the conversion to a narrower type. */ assert(sx < INT16_MAX); assert(sy < INT16_MAX); assert(tx < INT16_MAX); assert(ty < INT16_MAX); assert(dx < UINT16_MAX); assert(dy < UINT16_MAX); src_rec = { (Sint16) sx, (Sint16) sy, (Uint16) dx, (Uint16) dy }; dst_rec = { (Sint16) tx, (Sint16) ty, (Uint16) dx, (Uint16) dy }; SDL_BlitSurface(p_surf, &src_rec, p_dst->p_surf, &dst_rec); } } void surface_sdl::scale(int nx, int ny) { if(p_surf) return; // Scale only valid surfaces in texture format assert(surface_format == SURFACE_TEXTURE && p_surf->format->BytesPerPixel == 4); assert(!lock_required()); if(nx != p_surf->w || ny != p_surf->h) { if(nx < 1) nx = 1; if(ny < 1) ny = 1; SDL_Surface *p_new = SDL_CreateRGBSurface(p_surf->flags, nx, ny, 4, p_surf->format->Rmask, p_surf->format->Gmask, p_surf->format->Bmask, p_surf->format->Amask); dword *p_src_mem = (dword *)p_surf->pixels; dword *p_dest_mem = (dword *)p_new->pixels; dword *p_dest = NULL; float px,py,dx,dy; int tx,ty,ys; dx = (float)p_surf->w/(float)nx; dy = (float)p_surf->h/(float)ny; py = 0; for(ty = 0; ty < ny; ty++) { ys = ftoi((py)*(p_surf->w)); px = 0; p_dest = p_dest_mem+ty*nx; for(tx = 0; tx < nx; tx++) { p_dest[tx] = p_src_mem[ys+ftoi(px)]; px += dx; } py += dy; } SDL_FreeSurface(p_surf); p_surf = p_new; } } tcolor surface_sdl::single_pixel_get(int x, int y) { tcolor color = 0; if(pixel_valid(x,y)) { assert(p_surf->format->BytesPerPixel == 4); lock(); dword *p_pixels = (dword *)pixels_get(); color = *(p_pixels+y*(p_surf->pitch>>2)+x); unlock(); } return(color); } void surface_sdl::single_pixel_set(int x, int y, tcolor color) { assert(x >= 0 && y >= 0 && x < width_get() && y < height_get()); if(pixel_valid(x,y)) { assert(p_surf->format->BytesPerPixel == 4); bool locked = FALSE; if(lock_required()) { lock(); locked = TRUE; } dword *p_pixels = (dword *)pixels_get(); *(p_pixels+y*(p_surf->pitch>>2)+x) = color; if(locked) unlock(); } } tcolor surface_sdl::pixel_get(int x, int y) { tcolor color = 0; if(pixel_valid(x,y)) { dword *p_pixels = (dword *)pixels_get(); color = (*(p_pixels+y*(p_surf->pitch>>2)+x)); } return(color); } void surface_sdl::pixel_set(int x, int y, tcolor color) { assert(x >= 0 && y >= 0 && x < width_get() && y < height_get()); if(pixel_valid(x,y)) { dword *p_pixels = (dword *)pixels_get(); *(p_pixels+y*(p_surf->pitch>>2)+x) = color; } } bool surface_sdl::pixels_set(tcolor *p_pixels, tpos width, tpos height) { assert(surface_format == SURFACE_TEXTURE && p_surf->format->BytesPerPixel == 4); assert(!lock_required()); tpos target_width = width_get(); tpos target_height = height_get(); assert(width <= target_width); assert(height <= target_height); int y; for(y = 0; y < height; y++) { tcolor *p_pix = (tcolor *)pixels_get(0,y); assert(p_pix); memcpy(p_pix, p_pixels+(width*y), sizeof(tcolor)*width); } return(TRUE); } berusky2-0.12/src/age/graph/color_hsv.cpp0000644000175000017500000000602313674426075015270 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" /* * RGB <-> HSV translations * some code is taken from gtk2 (gtkhsv.c file) */ /* Utility functions */ #define INTENSITY(r, g, b) ((r) * 299f + (g) * 0.587f + (b) * 0.114f) /* Converts from HSV to RGB */ void hsv_to_rgb(float hue, float saturation, float value, float &r, float &g, float &b) { float f, p, q, t; if(saturation == 0) { r = value; g = value; b = value; /* heh */ } else { hue *= 6; if(hue == 6) hue = 0; f = hue - ftoi(hue); p = value * (1 - saturation); q = value * (1 - saturation * f); t = value * (1 - saturation * (1.0 - f)); switch (ftoi(hue)) { case 0: r = value; g = t; b = p; break; case 1: r = q; g = value; b = p; break; case 2: r = p; g = value; b = t; break; case 3: r = p; g = q; b = value; break; case 4: r = t; g = p; b = value; break; case 5: r = value; g = p; b = q; break; } } } /* Converts from RGB to HSV */ void rgb_to_hsv(float red, float green, float blue, float &h, float &s, float &v) { h = 0; float max = MAX3(red,green,blue); float min = MIN3(red,green,blue); v = max; if(max != 0.0) { s = (max - min) / max; } else { s = 0; } if(s == 0) { h = 0; } else { float delta = max - min; if(red == max) h = (green - blue) / delta; else if(green == max) h = 2 + (blue - red) / delta; else if(blue == max) h = 4 + (red - green) / delta; h /= 6; if(h < 0) h += 1; else if(h > 1) h -= 1; } } berusky2-0.12/src/age/graph/triangle.h0000644000175000017500000000246513674426075014552 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ berusky2-0.12/src/age/graph/normals.h0000644000175000017500000000305313674426075014412 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Calculator for normal vectors */ #ifndef __NORMALS_H__ #define __NORMALS_H__ void normals_calc(VECT *p_vertexes, int vertexnum, tface *p_face, int facenum, VECT *p_normals); #endif // __NORMALS_H__ berusky2-0.12/src/age/graph/animation_time.h0000644000175000017500000001147613674426075015744 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Time */ #ifndef __ANIMATION_TIME_H__ #define __ANIMATION_TIME_H__ typedef enum { ANIMATION_CREATED = 0, ANIMATION_STOPPED, ANIMATION_RUNNING } ANIMATION_STATE; typedef class animation_track_time { ANIMATION_STATE state; public: bool running(void) { return(state == ANIMATION_RUNNING); } bool stopped(void) { return(state == ANIMATION_STOPPED); } ANIMATION_STATE anim_state_get(void) { return(state); } private: int animation_length; bool looped; int time_run; // current time in animation (0...length) int time_lenght; // animation length int time_start; // skipped time from start (default is 0) int time_stop; // time when the animation stops (default is length) int system_time_start; // start time in system time int system_time_stop; // stop time in system time public: void anim_start(int system_time_next, int anim_start_time = 0, int anim_stop_time = 0) { time_start = anim_start_time; time_stop = anim_stop_time; time_lenght = !time_stop ? animation_length : time_stop; system_time_start = system_time_next - time_start; system_time_stop = system_time_start + time_lenght; time_run = 0; state = ANIMATION_RUNNING; } void anim_loop(int system_time_next) { system_time_start = system_time_stop - time_start; time_run = system_time_next - system_time_start; if(time_run > time_lenght) { time_run = time_run % time_lenght; // TODO - correction } system_time_stop = system_time_start + time_lenght; } void anim_stop(void) { state = ANIMATION_STOPPED; } void update(int system_time_next) { if(state == ANIMATION_RUNNING) { bool end = system_time_next > system_time_stop; if(end) { if(looped) { anim_loop(system_time_next); } else { time_run = time_lenght; // Stop animation } } else { time_run = system_time_next - system_time_start; } } } public: int run_time_get(void) { return(time_run); } public: void length_set(int animation_time_lenght) { assert(stopped()); animation_length = animation_time_lenght; time_run = 0; time_start = 0; time_stop = 0; system_time_start = 0; system_time_stop = 0; } int length_get(void) { return(time_lenght); } public: animation_track_time(int animation_time_lenght = 0, bool loop = FALSE) : state(ANIMATION_CREATED) { length_set(animation_time_lenght); looped = loop; } animation_track_time(ANIM_TRACK *p_track) : state(ANIMATION_CREATED) { length_set(p_track->length_get()); looped = p_track->looped(); } } ANIMATION_TRACK_TIME; /* int calc_time_akt(int next_time, int time_start) { return(next_time-time_start); } int calc_endtime(int framenum) { return((framenum-1)*SIM_KONSTI); } int calc_keynum(int endtime) { return((endtime/SIM_KONSTI)+1); } int calc_framenum(int endtime) { return((endtime/SIM_KONSTI)+1); } int endtime2framenum(int endtime) { return((endtime/SIM_KONSTI)+1); } int time2frame(int time) { return(time/SIM_KONSTI); } int frame2time(int frame) { return(frame*SIM_KONSTI); } float frame2sec(int frame) { return(frame*0.05f); } float time2sec(int time) { return(time/1000.0f); } */ #endif // __ANIMATION_TIME_H__ berusky2-0.12/src/age/graph/object_list.cpp0000644000175000017500000000251313674426075015573 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" berusky2-0.12/src/age/graph/graph3d.h0000644000175000017500000002603513674426075014274 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* 2D/3D Graphics library */ #ifndef __GRAPH3D_H__ #define __GRAPH3D_H__ #include #include #ifdef ENABLE_GTK_BACKEND #include #include #include #endif /* * Graphics dirs */ typedef struct grf_dirs { char mesh_dir[MAX_FILENAME]; char material_dir[MAX_FILENAME]; char scene_dir[MAX_FILENAME]; public: void mesh_dir_set(char *p_dir) { strncpy(mesh_dir,p_dir,MAX_FILENAME); } char * mesh_dir_get(void) { return(mesh_dir); } void material_dir_set(char *p_dir) { strncpy(material_dir,p_dir,MAX_FILENAME); } char * material_dir_get(void) { return(material_dir); } void scene_dir_set(char *p_dir) { strncpy(scene_dir,p_dir,MAX_FILENAME); } char * scene_dir_get(void) { return(scene_dir); } } GRF_DIRS; /* * Mouse cursors */ typedef enum { MOUSE_CURSOR_NORMAL = 0, MOUSE_CURSOR_RECTANGLE_SELECT, MOUSE_CURSOR_RECTANGLE_SELECTING, MOUSE_CURSOR_SCENE_MOVE, MOUSE_CURSOR_SCENE_MOVING, MOUSE_CURSOR_SCENE_ROTATE, MOUSE_CURSOR_SCENE_ROTATING } MOUSE_CURSOR_TYPE; /* * Render mode (high-level) */ typedef enum { RENDER_POINTS, RENDER_WIRED, RENDER_SOLID, RENDER_TEXTURED } RENDER_MODE; /* * Graphics config */ typedef struct grf_config { bool opengl_lighting; bool debug_culling; bool draw_bouding_boxes; bool draw_grid; bool draw_mouse_cursor; bool draw_console; bool draw_pivots; bool draw_selection; bool draw_selection_rectangle; bool draw_debug_fps; bool draw_debug_wired; bool draw_debug_points; bool draw_debug_normals; bool draw_debug_materials; bool draw_debug_all_objects; } GRF_CONFIG; /* * Error handling */ void gl_error(void); /* * Screen resize callback */ typedef void (* SCREEN_RESIZE_CALLBACK)(tpos width, tpos height); /* * Type of graphics backend */ typedef enum { GRAPH_GTK, GRAPH_SDL } GRAPH_TYPE; // ------------------------------------------------------- // the graph3d store class // ------------------------------------------------------- /* A frame is rendered by sequence: 1. draw_start() 2. draw_end() */ typedef class graph3d : public grf_console_interface, public grf_dirs { private: GRAPH_TYPE graph_type; public: GRAPH_TYPE type_get(void) { return(graph_type); } /* * Configuration */ public: static GRF_CONFIG config; /* * Current active scene */ private: SCENE *p_scene_active; public: void scene_active_set(SCENE *p_scene) { p_scene_active = p_scene; } SCENE * scene_active_get(void) { return(p_scene_active); } /* * Frame interface */ private: int current_frame; float current_fps; public: void current_frame_set(int frame) { current_frame = frame; if(p_scene_active) p_scene_active->current_frame_set(frame); } void current_fps_set(float fps) { current_fps = fps; } public: void fill(tcolor color) { } void fill(tpos x, tpos y, tpos dx, tpos dy, tcolor color) { } void fill(RECT2DI *p_rect, tcolor color) { } void fill(void) { } // Drawing sequence: // 1. draw_start // 2. draw_end public: void draw_start(void); void draw_end(void); public: // Flip GL buffers virtual void flip(void) = 0; private: // Clear buffers void clear(void); void grid_draw(void); void fps_draw(void); public: void config_draw_grid(bool state); void config_draw_boxes(bool state); void config_draw_console(bool state); void config_draw_mouse_cursor(bool state); void config_draw_pivots(bool state); void config_draw_fps(bool state); void config_draw_points(bool state); void config_draw_wired(bool state); void config_draw_normals(bool state); void config_draw_materials(bool state); void config_opengl_lighting(bool state); void config_draw_all_objects(bool state); void config_draw_selection(bool state); void config_draw_selection_rectangle(bool state); public: void config_render_mode_set(RENDER_MODE mode); private: bool screen_clear; RGBAF screen_clear_color; public: void screen_clear_color_set(float r, float g, float b, float a) { screen_clear_color = RGBAF(r,g,b,a); glClearColor(screen_clear_color.r,screen_clear_color.g,screen_clear_color.b,screen_clear_color.a); } void screen_clear_color_set(RGBAF color) { screen_clear_color = color; glClearColor(screen_clear_color.r,screen_clear_color.g,screen_clear_color.b,screen_clear_color.a); } private: float color_zbuffer; public: void z_buffer_clear_set(float z) { color_zbuffer = z; } private: /* * Basic drawing */ public: void draw_rect_line_2d(int x1, int y1, int x2, int y2, RGBB color = RGBB(255,255,255)); void draw_rect_solid_2d(int x1, int y1, int x2, int y2, RGBB color = RGBB(255,255,255)); void draw_line_3d(VECT *p_s, VECT *p_k, RGBB color = RGBB(255,255,255)); void draw_line_3d(float sx, float sy, float sz, float ex, float ey, float ez, RGBB color = RGBB(255,255,255)); void draw_cursor_normal(int mx, int my, int sx, int sy, int xres, int yres, RGBB color = RGBB(255,255,255)); void draw_cursor_rect_select(int mx, int my, RGBB color = RGBB(255,255,255)); void draw_cube_line(VECT *p_center, VECT *p_size, RGBB color = RGBB(255,255,255)); void draw_cube_line(float sx, float sy, float sz, float dx, float dy, float dz, RGBB color = RGBB(255,255,255)); void draw_cube_solid(VECT *p_center, VECT *p_size, RGBB color = RGBB(255,255,255)); void draw_cube_solid(float sx, float sy, float sz, float dx, float dy, float dz, RGBB color = RGBB(255,255,255)); void draw_label(VECT *p_position, const char *p_label, RGBB color = RGBB(255,255,255)); void draw_label(float x, float y, float z, const char *p_label, RGBB color = RGBB(255,255,255)); void draw_floor_line(VECT *p_center, float size, int lines_min, int lines_max); void draw_camera(VECT *p_position, VECT *p_target, float fov, RGBB color = RGBB(255,255,255)); void draw_camera(CAMERA_INTERFACE *p_camera, float size, RGBB color = RGBB(255,255,255)); /* * Axis cross */ public: #define CROSS_COLOR_AXIS_X (1<<0) // Draw x axis as active #define CROSS_COLOR_AXIS_Y (1<<1) // Draw y axis as active #define CROSS_COLOR_AXIS_Z (1<<2) // Draw z axis as active #define CROSS_AXIS_NAMES (1<<3) // Draw axis names #define CROSS_WORLD_SPACE (1<<4) // Draw cros in the global worldspace #define CROSS_DEFAULT_FLAGS (CROSS_COLOR_AXIS_X|CROSS_COLOR_AXIS_Y|CROSS_COLOR_AXIS_Z|CROSS_AXIS_NAMES) void draw_cross(VECT *p_position, float size, tflag flags = CROSS_DEFAULT_FLAGS); /* * Selection rectangle */ private: bool selection_rectangle_active; RGBB selection_rectangle_color; VECT2DI selection_rectangle_start; VECT2DI selection_rectangle_stop; private: void selection_rectangle_draw(void); public: void selection_rectangle_clear(void); void selection_rectangle_set_start(void); void selection_rectangle_set(void); bool selection_rectangle_get(RECT2DI *p_r); /* * Graphics configuration */ private: MOUSE_CURSOR_TYPE mouse_cursor_type; public: void mouse_cursor_set(MOUSE_CURSOR_TYPE type = MOUSE_CURSOR_NORMAL) { mouse_cursor_type = type; } void mouse_cursor_draw(void); /* * Graphics configuration */ public: bool graphics; tpos graphics_width; tpos graphics_height; int graphics_bpp; int graphics_bpp_zbuffer; bool graphics_opengl; bool graphics_fullscreen; public: void set(void); void set(tpos width, tpos height, int screen_depth = 0, bool full_screen = FALSE); void get(tpos *p_width, tpos *p_height, int *p_screen_depth); public: bool create_GL(void); void destroy_GL(void); public: virtual bool screen_create(void) = 0; virtual void screen_destroy(void) = 0; virtual void screen_resize(tpos width, tpos height) = 0; virtual void fullscreen_toggle(void) = 0; protected: SCREEN_RESIZE_CALLBACK p_screen_resize_callback; public: void resize_callback_set(SCREEN_RESIZE_CALLBACK p_callback); public: void destroy(void); public: graph3d(GRAPH_TYPE type); graph3d(GRAPH_TYPE type, tpos width, tpos height, int screen_depth = BPP_DEFAULT, bool full_screen = FALSE); virtual ~graph3d(void); } GRAPH3D; #ifdef ENABLE_GTK_BACKEND // Make our GTK widget ready for rendering inline bool gtk_gl_rendering(GtkWidget *widget) { assert(widget != NULL); return(gtk_gl_area_make_current(GTK_GL_AREA(widget))); } // GTK backend for graph3d typedef class graph3d_gtk : public graph3d { /* * GTK widget */ private: GtkWidget * p_area; public: GtkWidget * gtk_widget_get(void) { return(p_area); } public: // flip GL buffers void flip(void); public: virtual bool screen_create(void); virtual void screen_destroy(void); virtual void screen_resize(tpos width, tpos height); public: graph3d_gtk(void); graph3d_gtk(tpos width, tpos height); ~graph3d_gtk(void); } GRAPH3D_GTK; #endif // ENABLE_GTK_BACKEND #ifdef ENABLE_SDL_BACKEND // SDL backend for graph3d typedef class graph3d_sdl : public graph3d { /* * Screen */ private: SURFACE *p_screen_surface; int sdl_video_flags; public: // flip GL buffers void flip(void); public: virtual bool screen_create(void); virtual void screen_destroy(void); virtual void screen_resize(tpos width, tpos height); virtual void fullscreen_toggle(void); private: bool screen_regenerate(void); public: graph3d_sdl(void); graph3d_sdl(tpos width, tpos height, int screen_depth = BPP_DEFAULT, bool full_screen = FALSE); ~graph3d_sdl(void); } GRAPH3D_SDL; #endif // ENABLE_SDL_BACKEND #endif //__GRAPH3D_H__ berusky2-0.12/src/age/graph/material_texture.cpp0000644000175000017500000007137713674426075016666 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" //TODO -> jak rozdelit ram/video ram textury? /* * Bitmap surfaces for texture */ material_text_bitmap_params::material_text_bitmap_params(void) { pixmap[0] = '\0'; pixmap_alpha[0] = '\0'; } bool material_text_bitmap_params::load(const char *p_file) { // Loads images from texture config file if(tail_compare(p_file, TEXTURE_BITMAP_PARAMS_FILE)) { FFILE f = ini_open(p_file); ini_read_string(f, "surface", pixmap, MAX_FILENAME, ""); ini_read_string(f, "surface_alpha", pixmap_alpha, MAX_FILENAME, ""); f.close(); return(pixmap[0] != '\0'); } else { assert(strlen(p_file) < MAX_FILENAME); strncpy(pixmap,p_file,MAX_FILENAME); pixmap_alpha[0] = '\0'; // No alpha file return(TRUE); } } bool material_text_bitmap::bitmap_destroy(void) { surf.clear(); return(FALSE); } bool material_text_bitmap::bitmap_create(const char *p_dir, const char *p_file, const char *p_name) { /* * If there's a surface there, destroy it */ bitmap_destroy(); /* * Create a new surface */ char file[MAX_FILENAME]; const char *p_disk_file; p_disk_file = p_dir ? return_path(p_dir, p_file, file, MAX_FILENAME) : p_file; // Load surface and texture class from disk MATERIAL_TEXT_BITMAP_PARAMS params; if(!params.load(p_disk_file)) return(FALSE); if(!p_name) { char tmp[MAX_FILENAME]; strcpy(tmp,p_file); p_name = tail_name_get(p_file); } filename.set(p_name); if(!surf.load(params.pixmap)) return(FALSE); if(params.pixmap_alpha[0] && !surf.load_alpha(params.pixmap_alpha)) return(FALSE); return(TRUE); } bool material_text_bitmap::bitmap_create(tpos dx, tpos dy) { // Check if the surface is already here if(bitmap_loaded()) { tpos sdx, sdy; bitmap_size_get(&sdx, &sdy); if(sdx == dx && sdy == dy) return(TRUE); bitmap_destroy(); } // Create a new surface surf.create(dx,dy); return(TRUE); } bool material_text_bitmap::bitmap_create(SURFACE *p_surf) { surf.create(p_surf); return(TRUE); } material_text_bitmap::material_text_bitmap(void) { } material_text_bitmap::~material_text_bitmap(void) { bitmap_destroy(); } int default_text_config::details[TEXT_CLASSES_NUM] = { TEXT_DETAIL_BASE, TEXT_DETAIL_BASE, TEXT_DETAIL_BASE, TEXT_DETAIL_BASE, TEXT_DETAIL_BASE, TEXT_DETAIL_BASE, TEXT_DETAIL_BASE, TEXT_DETAIL_BASE }; int default_text_config::max_x[TEXT_CLASSES_NUM] = { TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT }; int default_text_config::max_y[TEXT_CLASSES_NUM] = { TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT, TEXT_MAX_DEFAULT }; /* GLenum type; // texture type (1D/2D/3D/4D/5D/6D) GLint format; // texture format int compression; // texture compression TEXT_BPP bpp; // bit deph TEXT_FILTER filter; // texture filter TEXT_WRAP wrap; // wrap params int anis; // Anisotropy filter float anis_level; // Anisotropy filter level float sharpness; // texture sharpness tflag flag1; // texture flag 1 tflag flag2; // texture flag 2 */ MATERIAL_TEXT_GL_PARAMS default_text_config::params[TEXT_CLASSES_NUM] = { { // CLASS DEFAULT GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS1 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS2 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS3 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS4 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS5 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS6 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 }, { // CLASS7 GL_TEXTURE_2D, FORMAT_RGB, FALSE, TEXT_DEFAULT, FILTER_LINEAR, TEXT_REPEAT, 0, 0.0f, 0.0f, 0, 0 } }; /* - Orded for each array - FORMAT_RGB = 0, FORMAT_RGBA1 = 1, FORMAT_RGBA4 = 2, FORMAT_LUM = 3, FORMAT_LUM_ALPHA1 = 4, FORMAT_LUM_ALPHA4 = 5, FORMAT_ALPHA = 6, FORMAT_LIGHTMAP = 7 */ int default_text_config::format1d[TEXT_BPP_NUM][TEXT_FORMATS_NUM] = { { // TEXT_DEFAULT GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5 }, { // TEXT_16BPP GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5 }, { // TEXT_32BPP GL_RGB8, GL_RGBA8, GL_RGBA8, GL_LUMINANCE8, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE8_ALPHA8, GL_ALPHA8, GL_RGB5 }, { // TEXT_DTX GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5 } }; int default_text_config::format2d[TEXT_BPP_NUM][TEXT_FORMATS_NUM] = { { // TEXT_DEFAULT GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5 }, { // TEXT_16BPP GL_RGB5, GL_RGB5_A1, GL_RGBA4, GL_LUMINANCE8, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE4_ALPHA4, GL_ALPHA8, GL_RGB5 }, { // TEXT_32BPP GL_RGB8, GL_RGBA8, GL_RGBA8, GL_LUMINANCE8, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE8_ALPHA8, GL_ALPHA8, GL_RGB5 }, { GL_COMPRESSED_RGB_ARB, GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_LUMINANCE_ARB, GL_COMPRESSED_LUMINANCE_ALPHA_ARB, GL_COMPRESSED_LUMINANCE_ALPHA_ARB, GL_COMPRESSED_ALPHA_ARB, GL_RGB5 } }; // Load texture configuration void default_text_config::load(char *p_file) { char item_name[200]; int i; FFILE f = ini_open(p_file); for(i = 0; i < TEXT_CLASSES_NUM; i++) { sprintf(item_name,"detail_class_%d",i); details[i] = ini_read_int(f, item_name, TEXT_DETAIL_BASE); sprintf(item_name,"max_x_class_%d",i); max_x[i] = ini_read_int(f, item_name, TEXT_MAX_DEFAULT); sprintf(item_name,"max_y_class_%d",i); max_y[i] = ini_read_int(f, item_name, TEXT_MAX_DEFAULT); } // Shrink texture max sizes int text_max; glGetIntegerv(GL_MAX_TEXTURE_SIZE,&text_max); for(i = 0; i < TEXT_CLASSES_NUM; i++) { if(text_max < max_x[i]) max_x[i] = text_max; if(text_max < max_y[i]) max_y[i] = text_max; } f.close(); } int default_text_config::format_get(int type, int bpp, int format_index) { if(type == GL_TEXTURE_2D) { return(format2d[bpp][format_index]); } else { return(format1d[bpp][format_index]); } } MATERIAL_TEXT_GL_PARAMS * default_text_config::params_get(TEXT_CLASS texture_class) { assert(texture_class >= 0 && texture_class < TEXT_CLASSES_NUM); return(params+texture_class); } static DEFAULT_TEXT_CONFIG dt_config; DEFAULT_TEXT_CONFIG * default_text_config_get(void) { return(&dt_config); } // **************************************************************************** // material_texture_params class - configuration for every texture / texture class // **************************************************************************** // name -> format static int texture_format_translate(char *p_name) { int i; static char format_string[][50] = { "FORMAT_RGB", "FORMAT_RGBA1", "FORMAT_RGBA4", "FORMAT_LUM", "FORMAT_LUM_ALPHA1", "FORMAT_LUM_ALPHA4", "FORMAT_ALPHA", "FORMAT_LIGHTMAP"}; for(i = 0; i < (int)(sizeof(format_string)/sizeof(format_string[0])); i++) { if(!strcasecmp(format_string[i],(const char *)p_name)) { return(i); } } return(0); } // name -> format static bool texture_type_translate(char *p_name, GLenum *p_type) { int i; static char type_string[][50] = { "GL_TEXTURE_2D", "GL_TEXTURE_1D"}; for(i = 0; i < (int)(sizeof(type_string)/sizeof(type_string[0])); i++) { if(!strcasecmp(type_string[i],(const char *)p_name)) { *p_type = i; return(TRUE); } } return(FALSE); } // Create the class a load data from given file bool material_text_gl_params::load(char *p_file) { char tmp[200]; FFILE f = ini_open(p_file,FALSE); if(!f) return(FALSE); ini_read_string(f, "type", tmp, 200, "GL_TEXTURE_2D"); texture_type_translate(tmp, &type); ini_read_string(f, "format", tmp, 200, "FORMAT_RGB"); format = (TEXT_FORMAT)texture_format_translate(tmp); compression = ini_read_bool(f, "compression", FALSE); bpp = (TEXT_BPP)ini_read_int(f, "bpp", TEXT_16BPP); anis = ini_read_bool(f, "anisotrophy", FALSE); anis_level = ini_read_float(f, "anisotrophy_level", 1.0f); sharpness = ini_read_float(f, "sharpness", 1.0f); if(compression && gl_ext::extlist_text_compresion) { bpp = TEXT_DTX; } if(anis && gl_ext::extlist_text_filter_anisotropic) { float max_anis,as,akt_anis; int i,imax; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anis); akt_anis = anis_level; if(akt_anis > 5) akt_anis = 5; imax = (int)akt_anis-1; for(as = 2, i = 0; i < imax; i++, as *= 2); if(as > max_anis) as = max_anis; anis_level = as/max_anis; } else { anis = FALSE; } f.close(); return(TRUE); } /* bool material_texture_params_load(MATERIAL_TEXT_GL_PARAMS *p_params, char *p_file) { assert(p_params); if(file_exists(NULL,p_file)) { if(p_params->load(p_file)) return(TRUE); } return(FALSE); } MATERIAL_TEXT_GL_PARAMS * material_texture_params_get(TEXT_CLASS texture_class) { assert(texture_class < CLASS_CUSTOM); DEFAULT_TEXTURE_CONFIG *p_conf = default_text_config_get(); return(p_conf->params+texture_class); } */ material_text_gl::material_text_gl(void) { tclass = CLASS_DEFAULT; // texture class gl_text_name = 0; // OpenGL texture name p_params = NULL; // Pointer to texture params } material_text_gl::~material_text_gl(void) { } material_text::material_text(class scene *p_scene_ref) : object_list(p_scene_ref) { } material_text::~material_text(void) { } void material_text_gl::gl_text_params_create(void) { if(!p_params) { p_params = new MATERIAL_TEXT_GL_PARAMS; *p_params = *(default_text_config_get()->params_get(tclass)); } } void material_text_gl::gl_text_params_destroy(void) { if(p_params) { delete p_params; p_params = NULL; } } bool material_text_gl::gl_text_params_load(char *p_file) { char tmp[MAX_FILENAME]; assert(strlen(p_file) < MAX_FILENAME); strncpy(tmp,p_file,MAX_FILENAME); tail_change(tmp,TEXTURE_GL_PARAM_FILE); gl_text_params_create(); assert(p_params); return(p_params->load(tmp)); } bool material_text_gl::gl_text_create(void) { if(!gl_active) return(FALSE); if(!bitmap_loaded()) return(FALSE); // If the texture already exists, destroy it gl_text_destroy(); GLenum type = gl_text_type_get(); glGenTextures(1, &gl_text_name); glBindTexture(type, gl_text_name); MATERIAL_TEXT_GL_PARAMS *p_par = gl_text_params_get(); SURFACE *p_surf = bitmap_get(); if(p_par->filter == FILTER_MIP_NEAR || p_par->filter == FILTER_MIP_LINEAR || p_par->filter == FILTER_MIP_TRILINEAR) { if(type == GL_TEXTURE_2D) { int x,y,i = 0; p_surf->size_get(&x,&y); while(x > 0 || y > 0) { p_surf->scale(x,y); glTexImage2D(GL_TEXTURE_2D, i, gl_text_gl_format_get(), p_surf->width_get(), p_surf->height_get(), 0, GL_RGBA,GL_UNSIGNED_BYTE, p_surf->pixels_get()); x /= 2; y /= 2; i++; } } else if(type == GL_TEXTURE_1D) { gluBuild1DMipmaps(GL_TEXTURE_1D, gl_text_gl_format_get(), p_surf->width_get(), GL_RGBA, GL_UNSIGNED_BYTE, p_surf->pixels_get()); } if(p_par->filter == FILTER_MIP_TRILINEAR) { glTexParameteri(type,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(type,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } else { glTexParameteri(type,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(type,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } } else { if(type == GL_TEXTURE_2D) { glTexImage2D(GL_TEXTURE_2D, 0, gl_text_gl_format_get(), p_surf->width_get(), p_surf->height_get(), 0, GL_RGBA, GL_UNSIGNED_BYTE, p_surf->pixels_get()); } else if(type == GL_TEXTURE_1D) { glTexImage1D(GL_TEXTURE_1D, 0, gl_text_gl_format_get(), p_surf->width_get(), 0, GL_RGBA, GL_UNSIGNED_BYTE, p_surf->pixels_get()); } if(p_par->filter == FILTER_LINEAR) { glTexParameteri(type,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(type,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } else { glTexParameteri(type,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(type,GL_TEXTURE_MAG_FILTER,GL_NEAREST); } } if(p_par->anis) { glTexParameterfv(type, GL_TEXTURE_MAX_ANISOTROPY_EXT, &(p_par->anis_level)); } int wrap = GL_REPEAT; switch(p_par->wrap) { case TEXT_CLAMP: if(gl_ext::extlist_text_edge_clamp) { wrap = GL_CLAMP_TO_EDGE; } else { wrap = GL_CLAMP; } break; case TEXT_REPEAT: wrap = GL_REPEAT; break; } glTexParameteri(type,GL_TEXTURE_WRAP_S,wrap); glTexParameteri(type,GL_TEXTURE_WRAP_T,wrap); return(TRUE); } bool material_text_gl::gl_text_destroy(void) { if(gl_text_name && glIsTexture(gl_text_name)) { glDeleteTextures(1,&gl_text_name); gl_text_name = 0; return(TRUE); } else { return(FALSE); } } bool material_text::load(const char *p_dir, const char *p_file, const char *p_name) { if(bitmap_create(p_dir, p_file, p_name)) { return(gl_text_create()); } return(FALSE); } bool material_text::load(SURFACE *p_surf) { if(bitmap_create(p_surf)) { return(gl_text_create()); } return(FALSE); } bool material_text::save(const char *p_dir, const char *p_file) { SURFACE *p_bitmap = bitmap_get(); if(!p_bitmap) return(FALSE); char tmp[MAX_FILENAME]; return(p_bitmap->save(return_path(p_dir,p_file,tmp,MAX_FILENAME))); } bool material_text::load(void) { if(!bitmap_loaded()) return(FALSE); if(!bitmap_changed()) return(FALSE); return(gl_text_create()); } bool material_text::loaded(void) { return(gl_text_loaded()); } bool material_text::destroy(void) { bitmap_destroy(); gl_text_destroy(); return(TRUE); } void material_text::texture_remove(void) { SCENE *p_scene = scene_get(); assert(p_scene != NULL); p_scene->texture_remove(this); } // Zmeni rozliseni textury podle pozadovanych detailu /* void material_text::bmp_apply_detail(void) { int x = default_text_max_x; int y = default_text_max_y; int scale; int dx,dy; if(surf.cti_x() <= x) x = surf.cti_x(); else scale = TRUE; if(surf.cti_y() <= y) y = surf.cti_y(); else scale = TRUE; for(dx = 2; dx < default_text_max_x && x > dx; dx <<= 1); for(dy = 2; dy < default_text_max_y && y > dy; dy <<= 1); if(x != dx || y != dy) { x = dx; y = dy; scale = TRUE; } if(default_text_detail[trida] > 0) { scale = TRUE; x >>= default_text_detail[trida]; y >>= default_text_detail[trida]; } if(scale) { surf.scale(x,y); } } */ /* // Defaultni konstruktor - nahodi default konfig material_text::material_text(int x, int y, TEXT_FILTR filtr, int format_) { jmeno[0] = 0; load = TRUE; typ = GL_TEXTURE_2D; format = format_; trida = default_text_class; flag = 0; flag2 = 0; text_filtr = filtr; text_wrap = TEXT_CLAMP; alfa_stage = K_CHYBA; p_next = NULL; p_prev = NULL; glGenTextures(1,&text); glBindTexture(typ,text); SURFACEA *p_surf = new SURFACEA(x,y); glTexImage2D(typ, 0, format, surf.cti_x(), surf.cti_y(), 0, GL_RGBA, GL_UNSIGNED_BYTE, surf.cti_data()); delete p_surf; if(filtr == FILTR_LINEAR) { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } else { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); } if(extlist_text_edge_clamp) { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); } else { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); } } static void pridej_alfu(char *p_file, char *p_alfa_file) { char pom[200] = "_a"; strcat(pom,cti_koncovku(p_file)); zamen_koncovku(p_alfa_file,pom); } // load ok void material_text::config_nahraj(APAK_HANDLE *pAHandle, const char *p_file) { char jmeno[200]; char jmeno_alfa[200]; char *p_znak; int format = -1; int alfa; KFILE *f; strcpy(jmeno,p_file); pridej_alfu(jmeno,jmeno_alfa); zamen_koncovku(jmeno,KONCOVKA_TEXT_INFO); alfa = kefile(pAHandle, jmeno_alfa); alfa_stage = K_CHYBA; if(alfa) { flag2 |= TEXT2_ALPHA; } else { flag2 &= ~TEXT2_ALPHA; } if((f = kopen(pAHandle,jmeno,"r"))) { while(kgets(jmeno,200,f)) { fgets_korekce(jmeno); if(jmeno[0] == ';') continue; // Bump-mapping if(strstr(jmeno,"nobump")) { flag2 &= ~TEXT2_BUMP; continue; } // culling if(strstr(jmeno,"no_cull")) { flag2 |= TEXT2_NO_CULL; continue; } if((p_znak = strchr(jmeno,'='))) { *p_znak++ = 0; if(strstr(jmeno,"format")) { if(!preloz_texture_format(&format, p_znak)) { kprintfl(TRUE,"Bad texture format %s",p_znak); } continue; } // Repeat/clamp mody if(strstr(jmeno,"wrap_x")) { text_wrap = atoi(p_znak) ? TEXT_CLAMP : TEXT_REPEAT; continue; } // Repeat/clamp mody if(strstr(jmeno,"wrap_y")) { text_wrap = atoi(p_znak) ? TEXT_CLAMP : TEXT_REPEAT; continue; } if(strstr(jmeno,"wrap")) { text_wrap = atoi(p_znak) ? TEXT_CLAMP : TEXT_REPEAT; continue; } // Mip-mapping if(strstr(jmeno,"mip_map")) { text_filtr = atoi(p_znak) ? FILTR_MIP_TRILINEAR : FILTR_LINEAR; continue; } // Typ 1D/2D if(strstr(jmeno,"typ")) { typ = (atoi(p_znak) == 1) ? GL_TEXTURE_1D : GL_TEXTURE_2D; continue; } // alfa-stage if(strstr(jmeno,"alfa_stage")) { alfa_stage = atoi(p_znak); continue; } } } kclose(f); } if(typ == GL_TEXTURE_1D) { format = (format != K_CHYBA) ? format1d[format] : (alfa) ? format1d[FORMAT_RGBA1] : format1d[FORMAT_RGB]; } else { format = (format != K_CHYBA) ? format2d[format] : (alfa) ? format2d[FORMAT_RGBA1] : format2d[FORMAT_RGB]; } } void material_text::config_default(char *p_file, char *p_koncovka) { strcpy(jmeno,p_file); zamen_koncovku(jmeno,p_koncovka); typ = GL_TEXTURE_2D; format = format2d[FORMAT_RGB]; text_filtr = default_text_filter; text_wrap = default_text_wrap; flag2 |= TEXT2_BUMP; alfa_stage = K_CHYBA; } void material_text::config_lightmap(void) { typ = GL_TEXTURE_2D; format = format2d[FORMAT_LIGHTMAP]; text_filtr = FILTR_LINEAR; text_wrap = TEXT_CLAMP; } int material_text::nahraj_texturu_z_bmp_lightmap(char *p_file, KFILE *f, int save) { AUX_RGBImageRec *p_tmp = NULL; config_lightmap(); if(p_file) { if(!(p_tmp = aux_nahraj(NULL,p_file))) return(FALSE); } else { if(!(p_tmp = aux_nahraj_file(f))) return(FALSE); } load = TRUE; p_surf = new SURFACEA(p_tmp,FALSE); aux_zrus(&p_tmp); upload_to_vram(); if(!save) { delete p_surf; p_surf = NULL; } return(load); } int material_text::nahraj_texturu_z_dds(APAK_HANDLE *pHandle, char *p_file, int save) { void *p_vysl; int ret; if((ret = txt_dds_to_bmp(pHandle,p_file,&p_vysl))) { trida = default_text_class; text_filtr = default_text_filter; text_wrap = TEXT_REPEAT; if(ret == 3) { format = format2d[FORMAT_RGB]; p_surf = new SURFACEA((AUX_RGBImageRec *)p_vysl,FALSE); aux_zrus((AUX_RGBImageRec **)&p_vysl); } else { format = format2d[FORMAT_RGBA4]; p_surf = (SURFACEA *)p_vysl; } upload_to_vram(); load = TRUE; if(!save) { delete p_surf; p_surf = NULL; } } return(load); } int material_text::nahraj_texturu_z_tga(APAK_HANDLE *pHandle, char *p_file) { int ret; if((ret = tgaLoad(pHandle, p_file, FALSE, GL_DUDV_ATI))) { load = TRUE; text = ret; p_surf = NULL; trida = default_text_class; text_filtr = default_text_filter; text_wrap = TEXT_REPEAT; strcpy(jmeno,p_file); glTexParameterf(typ, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(typ, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(typ, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(typ, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } return(load); } */ /* Importni interface soubory pro textury DDS vraci pocet plan -> 3/4 */ /* int txt_dds_to_bmp(APAK_HANDLE *pHandle, char *p_file, void **p_return) { unsigned char *p_data; unsigned char *p_rd; AUX_RGBImageRec *p_rec; SURFACEA *p_surf; byte *p_src,r; int width; int height; int planes; int lTotalWidth; int rowBytes; int x,y,dl; if((file_load = kopen(pHandle,p_file,"rb")) == NULL) { return(FALSE); } p_data = nvDXTdecompress(width, height, planes, lTotalWidth, rowBytes); assert(width == lTotalWidth); // prehodi r<->b for(y = 0; y < height; y ++ ) { for(x = 0; x < width; x++) { p_src = p_data+(y*width*planes)+x*planes; r = p_src[2]; p_src[2] = p_src[0]; p_src[0] = r; } } // prehodi radky dl = sizeof(byte)*width*planes; p_rd = (byte *)malloc(dl*height); for(y = 0; y < height; y++ ) { memcpy(p_rd+(height-y-1)*dl,p_data+y*dl,dl); } memcpy(p_data,p_rd,dl*height); if(planes == 3) { p_rec = (AUX_RGBImageRec *)malloc(sizeof(*p_rec)); assert(p_rec); p_rec->sizeX = width; p_rec->sizeY = height; p_rec->data = p_data; *p_return = p_rec; } else { p_surf = new SURFACEA(width,height,(dword *)p_data); *p_return = p_surf; } free(p_rd); kclose(file_load); return(planes); } void WriteDTXnFile(DWORD count, void *buffer) { } void ReadDTXnFile(DWORD count, void *buffer) { kread(buffer,sizeof(byte),count,file_load); } */ /* class text_list { EDIT_TEXT *p_first; public: ~text_list(void); text_vloz(EDIT_TEXT *p_text); text_vloz_copy(EDIT_TEXT *p_text); text_smaz(EDIT_TEXT *p_text); text_najdi(char jmeno); */ material_text_list::material_text_list(class scene *p_scene_ref) : object_list_head(p_scene_ref) { dir_reset(); } material_text_list::~material_text_list(void) { MATERIAL_TEXT *p_text = (MATERIAL_TEXT *)get_first(); while(p_text) { MATERIAL_TEXT *p_tmp = p_text; p_text = (MATERIAL_TEXT *)p_text->object_list_next(); delete p_tmp; } } void material_text_list::reload(void) { MATERIAL_TEXT *p_text = (MATERIAL_TEXT *)get_first(); pprintf("material_text_list::reload()"); while(p_text) { p_text->print(); if(!p_text->bitmap_loaded()) { int dhandle = dir_next_new(); char *p_dir; while((p_dir = dir_next(&dhandle))) { pprintfnl("Loading %s from '%s'...",p_text->name_get(),p_dir); if(p_text->load(p_text->name_get(),p_dir)) { pprintf("loaded"); break; } } if(!p_text->loaded()) { pprintf("failed"); } } p_text = (MATERIAL_TEXT *)p_text->object_list_next(); } } void material_text_list::dir_reset(void) { texture_dir_last = 0; dir_add("."); } bool material_text_list::dir_add(const char *p_dir) { if(texture_dir_last+1 < TEXT_DIRS) { strcpy(texture_dir[texture_dir_last],p_dir); texture_dir_last++; return(TRUE); } else { return(FALSE); } } int material_text_list::dir_next_new(void) { return(texture_dir_last-1); } char * material_text_list::dir_next(int *p_handle) { return(*p_handle >= 0 ? texture_dir[(*p_handle)--] : NULL); } /* int material_text_list::reload(int save) { int i; for(i = 0; i < TEXT_DIRS; i++) { if(texture_dir[i][0]) { txt_config::txt_trida(texture_dir_class[i]); reload_textur_dir(save,NULL,texture_dir[i]); } } for(i = 0; i < TEXT_DIRS; i++) { if(texture_file[i][0]) { txt_config::txt_trida(texture_file_class[i]); reload_textur_file(texture_file[i],save); } } chyby(); return(TRUE); } */ int material_text_list::errors_print(void) { MATERIAL_TEXT *p_text = (MATERIAL_TEXT *)get_first(); int n = 0; while(p_text) { if(!p_text->gl_text_loaded()) { pprintf("%s is not loaded...",p_text->name_get()); n++; } p_text = (MATERIAL_TEXT *)p_text->object_list_next(); } pprintf("%d textures unloaded.",n); return(n); } int material_text_list::status_print(void) { MATERIAL_TEXT *p_text = (MATERIAL_TEXT *)get_first(); int n = 0; while(p_text) { pprintf("%d texture %s, loaded %d...",n,p_text->name_get(),p_text->gl_text_loaded()); n++; p_text = (MATERIAL_TEXT *)p_text->object_list_next(); } pprintf("%d textures total",n); return(n); } int material_text_list::size_get(void) { int xres,yres,vel = 0; int r,g,b,a,l,in; MATERIAL_TEXT *p_text = (MATERIAL_TEXT *)get_first(); while(p_text) { if(p_text->gl_text_loaded()) { p_text->gl_text_bind(); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_WIDTH,&xres); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_HEIGHT,&yres); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_RED_SIZE,&r); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_GREEN_SIZE,&g); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_BLUE_SIZE,&b); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_ALPHA_SIZE,&a); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_LUMINANCE_SIZE,&l); glGetTexLevelParameteriv(p_text->gl_text_type_get(),0,GL_TEXTURE_INTENSITY_SIZE,&in); vel += xres*yres*(r+b+g+a+l+in); } p_text = (MATERIAL_TEXT *)p_text->object_list_next(); } return(vel >> 3); } int material_text_list::num_get(void) { MATERIAL_TEXT *p_text = (MATERIAL_TEXT *)get_first(); int n = 0; while(p_text) { n++; p_text = (MATERIAL_TEXT *)p_text->object_list_next(); } return(n); } berusky2-0.12/src/age/graph/object_transformation.h0000644000175000017500000001271013674426075017333 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Standart object transfromations interface Can be connected to any GL/Notified matrix All changes can be recorded */ #ifndef __OBJECT_TRANSFORMATION_H__ #define __OBJECT_TRANSFORMATION_H__ #define MATRIX_CHECK { if(p_matrix == NULL) return; } class object_transformation; typedef class object_transformation OBJECT_TRANSFORMATION; typedef void (object_transformation::*OBJECT_TRANSFORMATION_FUNC)(void); typedef class object_transformation { OBJECT_TRANSFORMATION_FUNC p_change_function; public: void change_set(void) { if(p_change_function) (this->*p_change_function)(); } private: GLMATRIX *p_matrix; public: void init(void) { MATRIX_CHECK; p_matrix->init(); change_set(); } public: /* * Translations */ void translate(float px, float py, float pz) { MATRIX_CHECK; p_matrix->translate(px, py, pz); change_set(); } void translate(VECT *p_pos) { MATRIX_CHECK; p_matrix->translate(p_pos); change_set(); } void translation_set(VECT *p_pos) { MATRIX_CHECK; p_matrix->translation_set(p_pos); change_set(); } void translation_set(float px, float py, float pz) { MATRIX_CHECK; p_matrix->translation_set(px, py, pz); change_set(); } void translation_add(VECT *p_pos) { MATRIX_CHECK; p_matrix->translation_add(p_pos); change_set(); } void translation_add(float px, float py, float pz) { MATRIX_CHECK; p_matrix->translation_add(px, py, pz); change_set(); } public: /* * Rotations */ void rotation_set(PLANE *p_r, float scale) { MATRIX_CHECK; p_matrix->rotation_set(p_r, scale); change_set(); } void rotation_set(VECT *p_vx, VECT *p_vy, VECT *p_vz) { MATRIX_CHECK; p_matrix->rotation_set(p_vx, p_vy, p_vz); change_set(); } void rotation_set(VECT *p_vx, VECT *p_vy, VECT *p_vz, VECT *p_pos) { MATRIX_CHECK; p_matrix->rotation_set(p_vx, p_vy, p_vz, p_pos); change_set(); } void rotation_set(QUAT *p_q) { MATRIX_CHECK; p_matrix->rotation_set(p_q); change_set(); } void rotation_set(VECT *p_axis, float angle) { MATRIX_CHECK; p_matrix->rotation_set(p_axis, angle); change_set(); } void rotate_x(float angle) { MATRIX_CHECK; p_matrix->rotate_x(angle); change_set(); } void rotate_y(float angle) { MATRIX_CHECK; p_matrix->rotate_y(angle); change_set(); } void rotate_z(float angle) { MATRIX_CHECK; p_matrix->rotate_z(angle); change_set(); } void rotation_set_z(float angle) { MATRIX_CHECK; p_matrix->rotation_set_z(angle); change_set(); } void rotation_set_inverse(VECT *p_vx, VECT *p_vy, VECT *p_vz) { MATRIX_CHECK; p_matrix->rotation_set_inverse(p_vx, p_vy, p_vz); change_set(); } void rotation_set_inverse(VECT *p_vx, VECT *p_vy, VECT *p_vz, VECT *p_pos) { MATRIX_CHECK; p_matrix->rotation_set_inverse(p_vx, p_vy, p_vz, p_pos); change_set(); } // 2D rotace void rotate_2D(VECT *p_pivot, float angle) { MATRIX_CHECK; p_matrix->rotate_2D(p_pivot, angle); change_set(); } /* * Scaling */ public: void scale(float x, float y, float z) { MATRIX_CHECK; p_matrix->scale(x, y, z); change_set(); } void scale_set(float x, float y, float z) { MATRIX_CHECK; p_matrix->scale_set(x, y, z); change_set(); } void scale(VECT *p_scale) { MATRIX_CHECK; p_matrix->scale(p_scale); change_set(); } void scale_set(VECT *p_scale) { MATRIX_CHECK; p_matrix->scale_set(p_scale); change_set(); } public: void object_transformation_setup(GLMATRIX *p_affected_matrix = NULL, OBJECT_TRANSFORMATION_FUNC p_change_func = NULL) { p_matrix = p_affected_matrix; p_change_function = p_change_func; } public: object_transformation(GLMATRIX *p_affected_matrix = NULL, OBJECT_TRANSFORMATION_FUNC p_change_func = NULL) { object_transformation_setup(p_affected_matrix,p_change_func); } } OBJECT_TRANSFORMATION; #endif // __OBJECT_TRANSFORMATION_H__ berusky2-0.12/src/age/graph/scene.h0000644000175000017500000002526213674426075014042 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Scene class, contains: - Geometry pipe - Scene geometry - Animations - Materials - Environment - Lights */ #ifndef __SCENE_H__ #define __SCENE_H__ class graph3d; typedef class graph3d GRAPH3D; typedef enum { SCENE_B2M = 0, SCENE_3DS, SCENE_TXT, } SCENE_TYPE; typedef class scene : public object_name, public flag_interface { friend class scene_object; #define SCENE_NEEDS_UPDATE_BOX (1<<1) /* Frame runtime flags These flags are used for determining what changes are made by user and what changes need to be done before rendering. */ #define FRAME_NEEDS_UPDATE_ANIMATIONS (1<<10) #define FRAME_NEEDS_UPDATE_HIERARCHY (1<<11) #define FRAME_NEEDS_UPDATE_RENDERLIST (1<<12) private: void update_flags_clear(void) { flag_set(FRAME_NEEDS_UPDATE_ANIMATIONS); flag_set(FRAME_NEEDS_UPDATE_HIERARCHY); flag_set(FRAME_NEEDS_UPDATE_RENDERLIST); } /* * Current frame */ private: static int current_frame; public: static void current_frame_set(int frame) { current_frame = frame; frame_change_interface::current_frame = frame; } static int current_frame_get(void) { return(current_frame); } /* * Animation templates */ private: ANIMATION_TEMPLATE_HEAD anim_templates; public: ANIMATION_TEMPLATE * anim_template_create(char *p_name = NULL); void anim_template_remove(ANIMATION_TEMPLATE *p_anim); ANIMATION_TEMPLATE * anim_template_get(char *p_name); ANIMATION_TEMPLATE * anim_template_get(int name_ID); ANIMATION_TEMPLATE * anim_template_get_first(void); /* * Runtime animations */ private: ANIMATION_RUNTIME_HEAD anim_runtime; public: ANIMATION_RUNTIME * anim_create(char *p_name = NULL); ANIMATION_RUNTIME * anim_remove(ANIMATION_RUNTIME *p_anim); ANIMATION_RUNTIME * anim_get(char *p_name); ANIMATION_RUNTIME * anim_get(int name_ID); ANIMATION_RUNTIME * anim_run(ANIMATION_RUNTIME *p_anim); void anim_stop(ANIMATION_RUNTIME *p_anim); ANIMATION_RUNTIME * anim_get_first(void); private: /* * Textures in the scene */ MATERIAL_TEXT_LIST textures; public: MATERIAL_TEXT * texture_create(const char *p_name); MATERIAL_TEXT * texture_create(const char *p_dir, const char *p_file, const char *p_name = NULL); void texture_remove(MATERIAL_TEXT *p_mat); MATERIAL_TEXT * texture_get(char *p_name); MATERIAL_TEXT * texture_get(int name_ID); MATERIAL_TEXT * texture_get_first(void); void texture_reload(void); void texture_dir_reset(void); bool texture_dir_add(char *p_dir); private: /* * Materials in the scene */ MATERIAL_LIST materials; public: MESH_MATERIAL * material_create(const char *p_name = NULL); void material_remove(MESH_MATERIAL *p_mat); MESH_MATERIAL * material_get(const char *p_name); MESH_MATERIAL * material_get(int name_ID); MESH_MATERIAL * material_get_first(void); public: MESH_MATERIAL * material_load(char *p_dir, char *p_file); MESH_MATERIAL * material_load(FHANDLE *f); public: int materials_load(char *p_dir, char *p_file); int materials_load(FHANDLE *f); /* * Meshes in the scene */ private: GAME_MESH_LIST meshes; public: GAME_MESH * mesh_create(const char *p_name = NULL, const char *p_mesh_parent = NULL); void mesh_remove(GAME_MESH *p_mesh); GAME_MESH * mesh_get(const char *p_name); GAME_MESH * mesh_get(int name_ID); GAME_MESH * mesh_get_first(void); GAME_MESH * mesh_mark_first(int mark); public: GAME_MESH * mesh_load(const char *p_dir, const char *p_file); GAME_MESH * mesh_load(FHANDLE *f); public: int meshes_load(const char *p_dir, const char *p_file); int meshes_load(FHANDLE *f); /* * Graphics pipeline */ private: GPIPE gpipeline; public: void gpipe_set(void) { ::gpipe_set(&gpipeline); } GPIPE * gpipe_get(void) { return(&gpipeline); } /* * Scene camera system */ private: CAMERA_LIST cameras; public: CAMERA_OBJECT * camera_create(const char *p_name = NULL); CAMERA_3DS * camera_3ds_create(const char *p_name = NULL); CAMERA_POLAR * camera_polar_create(const char *p_name = NULL); CAMERA_OBJECT * camera_get(const char *p_name); void camera_active_set(CAMERA_OBJECT *p_camera); bool camera_active_set(const char *p_name); CAMERA_OBJECT * camera_active_get(void); /* * Scene render hierarchy */ private: SCENE_OBJECT_TREE render_hierarchy; /* * Those methods are private - should be called via. objects like * object->render_hierarchy_insert(...) */ private: /* * Insert a new object into scene hierarchy */ bool render_hierarchy_insert(SCENE_OBJECT *p_obj, const char *p_parent_name = NULL) { // New mobject in scene....we need to update the scene box flag_set(SCENE_NEEDS_UPDATE_BOX); return(render_hierarchy.hierarchy_insert(p_obj, p_parent_name)); } bool render_hierarchy_insert(SCENE_OBJECT *p_obj, SCENE_OBJECT *p_parent) { // New mobject in scene....we need to update the scene box flag_set(SCENE_NEEDS_UPDATE_BOX); return(render_hierarchy.hierarchy_insert(p_obj, p_parent)); } /* * Remove already placed object from scene hierarchy */ bool render_hierarchy_remove(SCENE_OBJECT *p_obj) { // Removed object from scene....we need to update the scene box flag_set(SCENE_NEEDS_UPDATE_BOX); return(render_hierarchy.hierarchy_remove(p_obj)); } /* * Find object in scene hierarchy */ SCENE_OBJECT * render_hierarchy_find(char *p_name) { return(render_hierarchy.hierarchy_find(p_name)); } public: /* * Iterate over scene hierarchy * if p_start == NULL start from root */ OBJECT_HIERARCHY_ITERATOR render_hierarchy_next_new(SCENE_OBJECT *p_start = NULL) { return(render_hierarchy.hierarchy_next_new(p_start)); } SCENE_OBJECT * render_hierarchy_next(OBJECT_HIERARCHY_ITERATOR *p_it) { return(render_hierarchy.hierarchy_next(p_it)); } /* * Render list */ private: OBJECT_RENDER_LIST render_list; private: void render_list_compose(void); public: SCENE_OBJECT * render_list_first(void) { return((SCENE_OBJECT *)render_list.render_list_get_first()); } SCENE_OBJECT * render_list_next(SCENE_OBJECT *p_item) { return(p_item ? (SCENE_OBJECT *)(p_item->render_list_next()) : NULL); } /* * Scene bounding box */ private: AABB scene_box; private: void scene_box_update(void); public: VECT *scene_box_center_get(VECT *p_center); // Return center of the scene VECT *scene_box_length_get(VECT *p_size); // Return size of the scene float scene_box_depth_get(void); // Return current depth of the scene void scene_box_depth_get(float *p_averange, float *p_min, float *p_max); /* * Scene main routines */ public: void create(void); void clear(void); void remove(void); private: void load_insert(void); private: int load_b2m(char *p_dir, char *p_file); int save_b2m(char *p_dir, char *p_file); int load_3ds(char *p_dir, char *p_file); int save_3ds(char *p_dir, char *p_file); int load_txt(char *p_dir, char *p_file); int save_txt(char *p_dir, char *p_file); public: /* * Load whole scene from file */ int load(char *p_dir, char *p_file, SCENE_TYPE type = SCENE_B2M); int load(FHANDLE *f, SCENE_TYPE type = SCENE_B2M); /* * Save scene to file */ int save(char *p_dir, char *p_file, SCENE_TYPE type = SCENE_B2M); int save(FHANDLE *f, SCENE_TYPE type = SCENE_B2M); public: /* * Merge give scene with this one and release it */ bool merge(class scene *p_merged); /* * Update scene parts */ public: void update_animations(bool forced = FALSE); void update_hierarchy(bool forced = FALSE); void update_renderlist(bool forced = FALSE); void update_box(bool forced = FALSE); /* * Update all scene animations, calc positions and so on */ public: void update(void); public: void draw_start(int current_frame); void draw_end(bool all = FALSE); public: void render_viewport_absolute_set(tpos sx, tpos sy, tpos dx, tpos dy); void render_viewport_relative_set(float sx, float sy, float dx, float dy); void render_viewport_get(tpos *p_sx, tpos *p_sy, tpos *p_dx, tpos *p_dy); bool render_state_set(bool state); bool render_state_get(void); public: void lighting_on(void); void lighting_off(void); void lighting_set(bool state); /* * Selection interface */ private: SELECTED_OBJECT_HEAD selection; private: bool selection_add(OBJECT_SELECT * p_object); void selection_remove(OBJECT_SELECT * p_object); public: void selection_clear(void); public: SELECTED_OBJECT_ITEM * selection_get(void); public: int selection_add(RECT2DI *p_r); int selection_add_meshes(RECT2DI *p_r); /* * Graphics interface */ private: GRAPH3D *p_graph; public: GRAPH3D * graph_get(void) { return(p_graph); } void graph_set(GRAPH3D *p_graph) { this->p_graph = p_graph; } public: scene(void); ~scene(void); } SCENE; #endif // __SCENE_H__ berusky2-0.12/src/age/graph/matrix.cpp0000644000175000017500000001455313674426075014605 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Matrix module * */ // Constants and types #include "age.h" void glmatrix::print(const char *p_name, int ident) { if(p_name) pprintf("%*cMatrix '%s'",ident,' ',p_name); #define PREFIX "%*c%f %f %f %f",ident,' ' pprintf(PREFIX,_11,_21,_31,_41); pprintf(PREFIX,_12,_22,_32,_42); pprintf(PREFIX,_13,_23,_33,_43); pprintf(PREFIX,_14,_24,_34,_44); } /* * Compute inverse of 4x4 transformation matrix. * Code contributed by Jacques Leroy jle@star.be * Return GL_TRUE for success, GL_FALSE for failure (singular matrix) */ GLMATRIX * glu_invert_matrix(GLMATRIX *p_in, GLMATRIX *p_out) { float * m = (float *)p_in; float * out = (float *)p_out; /* NB. OpenGL Matrices are COLUMN major. */ #define SWAP_ROWS(a, b) { float *_tmp = a; (a)=(b); (b)=_tmp; } #define MAT(m,r,c) (m)[(c)*4+(r)] float wtmp[4][8]; float m0, m1, m2, m3, s; float *r0, *r1, *r2, *r3; r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1), r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3), r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1), r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3), r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1), r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3), r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1), r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3), r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; /* choose pivot - or die */ if (fabs(r3[0]) > fabs(r2[0])) SWAP_ROWS(r3, r2); if (fabs(r2[0]) > fabs(r1[0])) SWAP_ROWS(r2, r1); if (fabs(r1[0]) > fabs(r0[0])) SWAP_ROWS(r1, r0); if (0.0 == r0[0]) return(NULL); /* eliminate first variable */ m1 = r1[0] / r0[0]; m2 = r2[0] / r0[0]; m3 = r3[0] / r0[0]; s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; s = r0[4]; if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } s = r0[5]; if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } s = r0[6]; if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } s = r0[7]; if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } /* choose pivot - or die */ if (fabs(r3[1]) > fabs(r2[1])) SWAP_ROWS(r3, r2); if (fabs(r2[1]) > fabs(r1[1])) SWAP_ROWS(r2, r1); if (0.0 == r1[1]) return(NULL); /* eliminate second variable */ m2 = r2[1] / r1[1]; m3 = r3[1] / r1[1]; r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } /* choose pivot - or die */ if (fabs(r3[2]) > fabs(r2[2])) SWAP_ROWS(r3, r2); if (0.0 == r2[2]) return(NULL); /* eliminate third variable */ m3 = r3[2] / r2[2]; r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; /* last check */ if (0.0 == r3[3]) return(NULL); s = 1.0f / r3[3]; /* now back substitute row 3 */ r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; m2 = r2[3]; /* now back substitute row 2 */ s = 1.0f / r2[2]; r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); m1 = r1[3]; r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; m0 = r0[3]; r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; m1 = r1[2]; /* now back substitute row 1 */ s = 1.0f / r1[1]; r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); m0 = r0[2]; r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; m0 = r0[1]; /* now back substitute row 0 */ s = 1.0f / r0[0]; r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); MAT(out, 0, 0) = r0[4]; MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6]; MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4]; MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6]; MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4]; MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6]; MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4]; MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6]; MAT(out, 3, 3) = r3[7]; return(p_out); #undef MAT #undef SWAP_ROWS } berusky2-0.12/src/age/graph/scene_load.h0000644000175000017500000000761013674426075015036 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SCENE_LOAD_H__ #define __SCENE_LOAD_H__ //v. 2 #define CHUNK_KEYFRAME_ROT2 2006 // hlavicka key-framove animace #define CHUNK_KEYFRAME_NODE 2007 // vetev animace - pro jeden objekt #define CHUNK_KEYFRAME_POS 2008 // chunk s pozicema #define CHUNK_KEYFRAME_ROT 2009 // chunk s rotacema #define CHUNK_KEYFRAME_SCS 2010 // chunk s scalama //v. 3 - sim animace #define CHUNK_SIM_ROOT 2020 // hlavicka key-framove animace #define CHUNK_SIM_NODE 2021 // vetev animace - pro jeden objekt #define CHUNK_SIM_NODE_EXT 2022 // vetev animace - pro jeden objekt #define CHUNK_SIM_NODE_EXT2 2024 // vetev animace - pro jeden objekt /* * Scene objects chunks */ #define CHUNK_STATIC_LIGHT 5003 // chunk se statickym svetlem sceny #define CHUNK_STATIC_LIGHT_MESH 5004 // chunk se statickym svetlem (patri k naposledy nactenemu meshi) #define CHUNK_DYNAMIC_LIGHT 5100 // chunk se dynamickycm svetlem #define CHUNK_DYNAMIC_LIGHT_MESH 5101 // chunk se dynamickycm svetlem (patri k naposledy nactenemu meshi) #define CHUNK_EXTRA_LIGHT 5200 // chunk se extra dynamickycm svetlem #define CHUNK_EXTRA_LIGHT_MESH 5201 // chunk se extra dynamickycm svetlem (patri k naposledy nactenemu meshi) #define CHUNK_ZRCADLO 6000 // chunk se statickym svetlem #define CHUNK_ZRCADLO_2 6001 // chunk se statickym svetlem #define CHUNK_ZRCADLO_3 6002 // chunk se statickym svetlem #define CHUNK_ZRCADLO_3_POLOZKA 6003 // chunk se statickym svetlem #define CHUNK_FLARE 7000 // chunk se flare #define CHUNK_FLARE_SLOZENY 7001 // chunk se slozkama ke flare #define CHUNK_FLARE_MESH 7002 // chunk se flare_pripojeny k mesi #define CHUNK_FLARE_LIGHT 7003 // chunk se flare ke svetlu #define CHUNK_FLARE_EXT 7010 // chunk se flare #define CHUNK_FLARE_MESH_EXT 7011 // chunk se flare_pripojeny k mesi #define CHUNK_FLARE_LIGHT_EXT 7012 // chunk se flare ke svetlu #define CHUNK_AMBIENT 8000 // chunk s ambientnim svetlem #define CHUNK_LEVEL_KONFIG 8001 // chunk s kofiguraci levelu #define CHUNK_LEVEL_KONFIG_EXT 8002 // chunk s kofiguraci levelu #define CHUNK_MLHOKOSTKA 8010 // chunk se starou mlznou kostkou #define CHUNK_MLHOKOSTKA_2 8011 // chunk s mlznou kostkou #define CHUNK_ENVIRONMENT 8020 // chunk s environmentem #define CHUNK_KAMSET 8021 // chunk s environmentem #define CHUNK_KAMSET_2 8022 // chunk s environmentem #define ROOT_NODE_NAME "$$$ROOT_NODE$$$" #endif // __SCENE_LOAD_H__ berusky2-0.12/src/age/graph/color_helpers.h0000644000175000017500000003721413674426075015605 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Color helpers */ #ifndef __COLOR_HELPERS_H__ #define __COLOR_HELPERS_H__ inline tcolor rb_switch(tcolor color) { byte r = (color&0xff); byte b = (color&0xff0000)>>16; tcolor tmp = color&0xff00ff00; tmp |= (dword)(r<<16); tmp |= b; return(tmp); } inline tcolor int_rgb(int r, int g, int b) { tcolor color; if(r > MAX_BYTE) r = MAX_BYTE; if(g > MAX_BYTE) g = MAX_BYTE; if(b > MAX_BYTE) b = MAX_BYTE; color = (tcolor)r; color |= (tcolor)(g<<8); color |= (tcolor)(b<<16); return(color); } inline tcolor byte_rgb(byte r, byte g, byte b) { tcolor color; color = r; color |= (tcolor)(g<<8); color |= (tcolor)(b<<16); return(color); } inline tcolor byte_rgba(byte r, byte g, byte b, byte a) { tcolor color; color = r; color |= (tcolor)(g<<8); color |= (tcolor)(b<<16); color |= (tcolor)(a<<24); return(color); } inline tcolor rgb_byte(tcolor color, byte *p_r, byte *p_g, byte *p_b) { *p_r = (byte)((color)&0xff); *p_g = (byte)((color>>8)&0xff); *p_b = (byte)((color>>16)&0xff); return(color); } inline tcolor rgba_byte(tcolor color, byte *p_r, byte *p_g, byte *p_b, byte *p_a) { *p_r = (byte)((color)&0xff); *p_g = (byte)((color>>8)&0xff); *p_b = (byte)((color>>16)&0xff); *p_a = (byte)((color>>24)&0xff); return(color); } inline tcolor rgb_int(tcolor color, int *p_r, int *p_g, int *p_b) { *p_r = (byte)((color)&0xff); *p_g = (byte)((color>>8)&0xff); *p_b = (byte)((color>>16)&0xff); return(color); } inline tcolor byte_a(tcolor color, int a) { return(color|(tcolor)(a<<24)); } inline byte a_byte(tcolor color) { return((byte)(color>>24)); } inline tcolor float_rgba(float *p_color) { tcolor color; color = (tcolor)(p_color[0]*255.0f); color |= ((tcolor)(p_color[1]*255.0f)<<8); color |= ((tcolor)(p_color[2]*255.0f)<<16); color |= ((tcolor)(p_color[3]*255.0f)<<24); return(color); } inline tcolor float_rgba(float r, float g, float b, float a) { tcolor color; color = (tcolor)(r*255.0f); color |= ((tcolor)(g*255.0f)<<8); color |= ((tcolor)(b*255.0f)<<16); color |= ((tcolor)(a*255.0f)<<24); return(color); } inline tcolor float_rgb(float *p_color) { tcolor color; color = (tcolor)(p_color[0]*255.0f); color |= ((tcolor)(p_color[1]*255.0f)<<8); color |= ((tcolor)(p_color[2]*255.0f)<<16); return(color); } inline tcolor float_rgb(float r, float g, float b) { tcolor color; color = (tcolor)(r*255.0f); color |= ((tcolor)(g*255.0f)<<8); color |= ((tcolor)(b*255.0f)<<16); return(color); } inline tcolor float_a(float alfa) { return((tcolor)(alfa*255.0f)); } inline float * rgba_float(tcolor color, float *p_color) { p_color[0] = ((float)(color&0xff))/255.0f; p_color[1] = ((float)((color&0xff00)>>8))/255.0f; p_color[2] = ((float)((color&0xff0000)>>16))/255.0f; p_color[3] = ((float)((color&0xff000000)>>24))/255.0f; return(p_color); } inline void rgba_float(tcolor color, float *p_r, float *p_g, float *p_b, float *p_a) { *p_r = ((float)(color&0xff))/255.0f; *p_g = ((float)((color&0xff00)>>8))/255.0f; *p_b = ((float)((color&0xff0000)>>16))/255.0f; *p_a = ((float)((color&0xff000000)>>24))/255.0f; } inline float * rgb_float(tcolor color, float *p_color) { p_color[0] = ((float)(color&0xff))/255.0f; p_color[1] = ((float)((color&0xff00)>>8))/255.0f; p_color[2] = ((float)((color&0xff0000)>>16))/255.0f; return(p_color); } inline void rgb_float(tcolor color, float *p_r, float *p_g, float *p_b) { *p_r = ((float)(color&0xff))/255.0f; *p_g = ((float)((color&0xff00)>>8))/255.0f; *p_b = ((float)((color&0xff0000)>>16))/255.0f; } inline float a_float(tcolor color) { return(((float)(color&0xff))/255.0f); } inline float rgb_intensity(tcolor color) { return((((float)(color&0xff))/255.0f) + (((float)((color&0xff00)>>8))/255.0f) + (((float)((color&0xff0000)>>16))/255.0f)) / 3.0f; } // Prace s colorma inline void add_color(tcolor *p_base, tcolor add) { // BGR tcolor rs,gs,bs,as; tcolor rd,gd,bd,ad; rd = ((*p_base)&0xff); gd = ((*p_base)&0xff00)>>8; bd = ((*p_base)&0xff0000)>>16; ad = ((*p_base)&0xff000000)>>24; rs = ((add)&0xff); gs = ((add)&0xff00)>>8; bs = ((add)&0xff0000)>>16; as = ((add)&0xff000000)>>24; rd += rs; gd += gs; bd += bs; ad += as; if(rd > MAX_BYTE) rd = MAX_BYTE; if(gd > MAX_BYTE) gd = MAX_BYTE; if(bd > MAX_BYTE) bd = MAX_BYTE; if(ad > MAX_BYTE) ad = MAX_BYTE; *p_base = rd; *p_base |= (gd<<8); *p_base |= (bd<<16); *p_base |= (ad<<24); } inline void add_color_f(float *p_base, float r, float g, float b) { // BGR p_base[0] += r; p_base[1] += g; p_base[2] += b; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; } inline void add_color_fa(float *p_base, float r, float g, float b, float a) { // BGR p_base[0] += r; p_base[1] += g; p_base[2] += b; p_base[3] += a; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; if(p_base[3] > 1.0f) p_base[3] = 1.0f; } // r,g,b,a inline void add_color_p(float *p_base, float *p_add) { // BGR p_base[0] += p_add[0]; p_base[1] += p_add[1]; p_base[2] += p_add[2]; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; } inline void add_color_pa(float *p_base, float *p_add) { // BGR p_base[0] += p_add[0]; p_base[1] += p_add[1]; p_base[2] += p_add[2]; p_base[3] += p_add[3]; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; if(p_base[3] > 1.0f) p_base[3] = 1.0f; } inline void sub_color(tcolor *p_base, tcolor add) { // BGR int rs,gs,bs,as; int rd,gd,bd,ad; rd = ((*p_base)&0xff); gd = ((*p_base)&0xff00)>>8; bd = ((*p_base)&0xff0000)>>16; ad = ((*p_base)&0xff000000)>>24; rs = ((add)&0xff); gs = ((add)&0xff00)>>8; bs = ((add)&0xff0000)>>16; as = ((add)&0xff000000)>>24; rd -= rs; gd -= gs; bd -= bs; ad -= as; if(rd < 0) rd = 0; if(gd < 0) gd = 0; if(bd < 0) bd = 0; if(ad < 0) ad = 0; *p_base = (tcolor)rd; *p_base |= (tcolor)(gd<<8); *p_base |= (tcolor)(bd<<16); *p_base |= (tcolor)(ad<<24); } inline void sub_color_f(float *p_base, float r, float g, float b) { // BGR p_base[0] -= r; p_base[1] -= g; p_base[2] -= b; if(p_base[0] < 0.0f) p_base[0] = 0.0f; if(p_base[1] < 0.0f) p_base[1] = 0.0f; if(p_base[2] < 0.0f) p_base[2] = 0.0f; } inline void sub_color_fa(float *p_base, float r, float g, float b, float a) { // BGR p_base[0] -= r; p_base[1] -= g; p_base[2] -= b; p_base[3] -= a; if(p_base[0] < 0.0f) p_base[0] = 0.0f; if(p_base[1] < 0.0f) p_base[1] = 0.0f; if(p_base[2] < 0.0f) p_base[2] = 0.0f; if(p_base[3] < 0.0f) p_base[3] = 0.0f; } inline void sub_color_p(float *p_base, float *p_sub) { // BGR p_base[0] -= p_sub[0]; p_base[1] -= p_sub[1]; p_base[2] -= p_sub[2]; if(p_base[0] < 0.0f) p_base[0] = 0.0f; if(p_base[1] < 0.0f) p_base[1] = 0.0f; if(p_base[2] < 0.0f) p_base[2] = 0.0f; } inline void sub_color_pa(float *p_base, float *p_sub) { // BGR p_base[0] -= p_sub[0]; p_base[1] -= p_sub[1]; p_base[2] -= p_sub[2]; p_base[3] -= p_sub[3]; if(p_base[0] < 0.0f) p_base[0] = 0.0f; if(p_base[1] < 0.0f) p_base[1] = 0.0f; if(p_base[2] < 0.0f) p_base[2] = 0.0f; if(p_base[3] < 0.0f) p_base[3] = 0.0f; } inline void add_mult_color_tcolor(float *p_base, tcolor color, float scale) { // BGR float d[4]; rgba_float(color,d); p_base[0] += d[0]*scale; p_base[1] += d[1]*scale; p_base[2] += d[2]*scale; p_base[3] += d[3]*scale; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; if(p_base[3] > 1.0f) p_base[3] = 1.0f; } inline void mult_mult_color_tcolor(float *p_base, tcolor color, float scale) { // BGR float d[4]; rgba_float(color,d); p_base[0] *= d[0]*scale; p_base[1] *= d[1]*scale; p_base[2] *= d[2]*scale; p_base[3] *= d[3]*scale; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; if(p_base[3] > 1.0f) p_base[3] = 1.0f; } inline void add_mult_color(tcolor *p_base, tcolor add, float scale) { // BGR float rs,gs,bs,as; float rd,gd,bd,ad; rd = (float)((*p_base)&0xff); gd = (float)(((*p_base)&0xff00)>>8); bd = (float)(((*p_base)&0xff0000)>>16); ad = (float)(((*p_base)&0xff000000)>>24); rs = (float) (add&0xff); gs = (float)((add&0xff00)>>8); bs = (float)((add&0xff0000)>>16); as = (float)((add&0xff000000)>>24); rd += rs*scale; gd += gs*scale; bd += bs*scale; ad += as*scale; if(rd > MAX_BYTE) rd = MAX_BYTE; if(gd > MAX_BYTE) gd = MAX_BYTE; if(bd > MAX_BYTE) bd = MAX_BYTE; if(ad > MAX_BYTE) ad = MAX_BYTE; *p_base = (byte)rd; *p_base |= (tcolor)((byte)gd<<8); *p_base |= (tcolor)((byte)bd<<16); *p_base |= (tcolor)((byte)ad<<24); } inline void add_mult_color_f(float *p_base, float *p_add, float scale) { // BGR p_base[0] += p_add[0]*scale; p_base[1] += p_add[1]*scale; p_base[2] += p_add[2]*scale; p_base[3] += p_add[3]*scale; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; if(p_base[3] > 1.0f) p_base[3] = 1.0f; } inline void sub_mult_color(tcolor *p_base, tcolor *p_add, float scale) { // BGR float rs,gs,bs,as; float rd,gd,bd,ad; rd = (float)((*p_base)&0xff); gd = (float)(((*p_base)&0xff00)>>8); bd = (float)(((*p_base)&0xff0000)>>16); ad = (float)(((*p_base)&0xff000000)>>24); rs = (float)((*p_add)&0xff); gs = (float)(((*p_add)&0xff00)>>8); bs = (float)(((*p_add)&0xff0000)>>16); as = (float)(((*p_add)&0xff000000)>>24); rd -= rs*scale; gd -= gs*scale; bd -= bs*scale; ad -= as*scale; if(rd < 0) rd = 0; if(gd < 0) gd = 0; if(bd < 0) bd = 0; if(ad < 0) ad = 0; *p_base = (byte)rd; *p_base |= (tcolor)((byte)gd<<8); *p_base |= (tcolor)((byte)bd<<16); *p_base |= (tcolor)((byte)ad<<24); } inline void sub_mult_color_f(float *p_base, float *p_add, float scale) { // BGR p_base[0] -= p_add[0]*scale; p_base[1] -= p_add[1]*scale; p_base[2] -= p_add[2]*scale; p_base[3] -= p_add[3]*scale; if(p_base[0] < 0.0f) p_base[0] = 0.0f; if(p_base[1] < 0.0f) p_base[1] = 0.0f; if(p_base[2] < 0.0f) p_base[2] = 0.0f; if(p_base[3] < 0.0f) p_base[3] = 0.0f; } inline void add_color_rgb_tcolor(tcolor *p_base, dword r, dword g, dword b) { // BGR tcolor rd,gd,bd; rd = ((*p_base)&0xff); gd = ((*p_base)&0xff00)>>8; bd = ((*p_base)&0xff0000)>>16; rd += r; gd += g; bd += b; if(rd > MAX_BYTE) rd = MAX_BYTE; if(gd > MAX_BYTE) gd = MAX_BYTE; if(bd > MAX_BYTE) bd = MAX_BYTE; *p_base = rd; *p_base |= (gd<<8); *p_base |= (bd<<16); } inline void add_color_rgb(float *p_base, dword r, dword g, dword b) { // BGR p_base[0] += r/MAX_BYTE; p_base[1] += g/MAX_BYTE; p_base[2] += b/MAX_BYTE; if(p_base[0] > 1.0f) p_base[0] = 1.0f; if(p_base[1] > 1.0f) p_base[1] = 1.0f; if(p_base[2] > 1.0f) p_base[2] = 1.0f; } inline void add_color_rgb_byte(byte *p_base, byte ar, byte ag, byte ab) { // BGR int r,g,b; r = p_base[0]; g = p_base[1]; b = p_base[2]; r += ar; g += ag; b += ab; if(r > MAX_BYTE) r = MAX_BYTE; if(g > MAX_BYTE) g = MAX_BYTE; if(b > MAX_BYTE) b = MAX_BYTE; p_base[0] = (byte)r; p_base[1] = (byte)g; p_base[2] = (byte)b; } inline void sub_color_rgb(float *p_base, dword r, dword g, dword b) { // BGR p_base[0] -= r/MAX_BYTE; p_base[1] -= g/MAX_BYTE; p_base[2] -= b/MAX_BYTE; if(p_base[0] < 0.0f) p_base[0] = 0.0f; if(p_base[1] < 0.0f) p_base[1] = 0.0f; if(p_base[2] < 0.0f) p_base[2] = 0.0f; } inline void sub_color_rgb_tcolor(tcolor *p_base, dword r, dword g, dword b) { // BGR int rd,gd,bd; rd = ((*p_base)&0xff); gd = ((*p_base)&0xff00)>>8; bd = ((*p_base)&0xff0000)>>16; rd -= r; gd -= g; bd -= b; if(rd < 0) rd = 0; if(gd < 0) gd = 0; if(bd < 0) bd = 0; *p_base = (tcolor)rd; *p_base |= (tcolor)(gd<<8); *p_base |= (tcolor)(bd<<16); } inline void add_mult_color_rgba(tcolor *p_base, int r, int g, int b, float scale) { // BGR float rd,gd,bd,ad; rd = (float)((*p_base)&0xff); gd = (float)(((*p_base)&0xff00)>>8); bd = (float)(((*p_base)&0xff0000)>>16); ad = (float)(((*p_base)&0xff000000)>>24); rd += r*scale; gd += g*scale; bd += b*scale; if(rd > MAX_BYTE) rd = MAX_BYTE; if(gd > MAX_BYTE) gd = MAX_BYTE; if(bd > MAX_BYTE) bd = MAX_BYTE; if(rd < 0) rd = 0; if(gd < 0) gd = 0; if(bd < 0) bd = 0; *p_base = (byte)rd; *p_base |= ((byte)gd<<8); *p_base |= ((byte)bd<<16); *p_base |= ((byte)ad<<24); } inline void add_mult_color_rgb_int(byte *p_base, int r, int g, int b, float scale) { // BGR float rd,gd,bd; rd = (float)p_base[0]; gd = (float)p_base[1]; bd = (float)p_base[2]; rd += r*scale; gd += g*scale; bd += b*scale; if(rd > MAX_BYTE) rd = MAX_BYTE; if(gd > MAX_BYTE) gd = MAX_BYTE; if(bd > MAX_BYTE) bd = MAX_BYTE; if(rd < 0) rd = 0; if(gd < 0) gd = 0; if(bd < 0) bd = 0; p_base[0] = (byte)rd; p_base[1] = (byte)gd; p_base[2] = (byte)bd; } inline void sub_mult_color_rgb(dword *p_base, dword r, dword g, dword b, float scale) { // BGR float rd,gd,bd; rd = (float)((*p_base)&0xff); gd = (float)(((*p_base)&0xff00)>>8); bd = (float)(((*p_base)&0xff0000)>>16); rd -= r*scale; gd -= g*scale; bd -= b*scale; if(rd < 0) rd = 0; if(gd < 0) gd = 0; if(bd < 0) bd = 0; *p_base = (byte)rd; *p_base |= (dword)((byte)gd<<8); *p_base |= (dword)((byte)bd<<16); } inline void get_add_color_rgb(dword base, dword *p_r, dword *p_g, dword *p_b) { // BGR *p_r += ((base)&0xff); *p_g += ((base)&0xff00)>>8; *p_b += ((base)&0xff0000)>>16; } inline void mult_color_rgb_max(dword *p_base, dword r, dword g, dword b, float scale) { // BGR r = (dword)(r*scale); g = (dword)(g*scale); b = (dword)(b*scale); if(r > MAX_BYTE) r = MAX_BYTE; if(g > MAX_BYTE) g = MAX_BYTE; if(b > MAX_BYTE) b = MAX_BYTE; *p_base = (byte)r; *p_base |= ((byte)g<<8); *p_base |= ((byte)b<<16); } inline float color_intensity(float r, float g, float b) { return(0.299f*r + 0.587f*g + 0.114f*b); } inline float color_intensity(int r, int g, int b) { return(color_intensity(r/255.f, g/255.f, b/255.f)); } #endif // __COLOR_HELPERS_H__ berusky2-0.12/src/age/graph/object_name.h0000644000175000017500000000420413674426075015204 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OBJECT_NAME_H__ #define __OBJECT_NAME_H__ #include typedef class object_name : public object_base { public: char name[MAX_NAME]; int name_ID; public: char * name_get(void) { return(name); } void name_set(const char *p_name) { if(p_name) { assert(strlen(p_name) < MAX_NAME); strncpy(name,p_name,MAX_NAME); } else { name[0] = '\0'; } } int name_ID_get(void) { return(name_ID); } void name_ID_set(int mID) { name_ID = mID; } public: bool match_name(const char *p_name) { return(strncmp(name,p_name,MAX_NAME) == 0); } bool match_name(int name) { return(name == name_ID); } public: object_name(void) { name[0] = '\0'; name_ID = 0; } } OBJECT_NAME; #endif // __OBJECT_NAME_H__ berusky2-0.12/src/age/graph/animation_track.cpp0000644000175000017500000000250613674426075016437 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "age.h" berusky2-0.12/src/age/graph/texture_func.cpp0000644000175000017500000005220413674426075016007 00000000000000 /* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* State-bloky pro textury */ //#include "age.h" /* Globalni promenne pro tridu stage_text_koord */ /* int stage_text_koord::texgen_on[MAX_GL_TEXT_UNITS] = {MAT2_CALC_MAP1, MAT2_CALC_MAP2, MAT2_CALC_MAP3, MAT2_CALC_MAP4}; int stage_text_koord::texgen_eye_lin_flagy[MAX_GL_TEXT_UNITS] = {MAT_T1_EYE_LIN,MAT_T2_EYE_LIN,MAT_T3_EYE_LIN,MAT_T4_EYE_LIN}; int stage_text_koord::texgen_sphere_flagy[MAX_GL_TEXT_UNITS] = {MAT_T1_SPHERE, MAT_T2_SPHERE, MAT_T3_SPHERE, MAT_T4_SPHERE}; int stage_text_koord::texgen_matrix_texture_flagy2[MAX_GL_TEXT_UNITS] = {MAT2_T1_MATRIX, MAT2_T2_MATRIX, MAT2_T3_MATRIX, MAT2_T4_MATRIX}; int stage_text_koord::texgen_map_indicie[MAX_GL_TEXT_UNITS]; */ /* Globalni promenne pro tridu stage_func_param */ /* GAME_TEXT_BLOK stage_func_param::st_blok[MAX_STAGE_TEXT_BLOK] = { {"Modulace",0,-1,1,1, {TYP_TEXT_COLOR}, {STAGE_BLOK_MODULACE} }, {"Add",1,-1,1,1, {TYP_TEXT_COLOR}, {STAGE_BLOK_ADD} }, {"Decal",2,-1,1,1, {TYP_TEXT_COLOR}, {STAGE_BLOK_DECAL} }, {"Blend",3,-1,1,1, {TYP_TEXT_COLOR}, {STAGE_BLOK_BLEND} }, {"Replace",4,-1,1,1, {TYP_TEXT_COLOR}, {STAGE_BLOK_REPLACE} }, {"DOT3Color",5,0,2,2, {TYP_TEXT_DOT3,TYP_TEXT_COLOR}, {STAGE_BLOK_DOT3_BUMP,STAGE_BLOK_MODULACE} }, {"DOT3ENV",6,1,3,3, {TYP_TEXT_DOT3,TYP_TEXT_COLOR,TYP_TEXT_COLOR}, {STAGE_BLOK_DOT3_BUMP,STAGE_BLOK_MODULACE,STAGE_BLOK_MODULACE} }, {"EnvBump",7,2,3,3, {TYP_TEXT_DUDV,TYP_TEXT_COLOR,TYP_TEXT_COLOR}, {STAGE_BLOK_BUMP_ENV,STAGE_BLOK_MODULACE,STAGE_BLOK_MODULACE} }, {"Modulace 2X",0,-1,1,1, {TYP_TEXT_COLOR}, {STAGE_BLOK_MODULACE2X} } }; */ /* int (*stage_func_param::p_st_func[MAX_STAGE_TEXT_FUNC])(class stage_func_param *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) = { st _modulace, st_modulace_2x, st_add, st_decal, st_blend, st_replace, st_dot3_bump, st_dot3_bump_env, st_bump_env }; STAGE_FUNC_PARAM *p_stage GAME_TEXT **p_text STAGE_TEXT_KOORD *p_koord int m1flag, int m2flag int stage_func_param::set(int last_text, int reserved) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= reserved; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); gl_texture_operators::set(last_text,...); //gl_texture_coordinates::set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += reserved; return(ret); } int stage_func_param::st_modulace(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= rezerva; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); p_stage->el_set_func(last_text,STAGE_BLOK_MODULACE); p_koord->st_set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += rezerva; return(ret); } int stage_func_param::st_modulace_2x(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= rezerva; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); gl_texture_operators::set(last_text,STAGE_BLOK_MODULACE2X); p_koord->st_set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += rezerva; return(ret); } int stage_func_param::st_add(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= rezerva; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); p_stage->el_set_func(last_text,STAGE_BLOK_ADD); p_koord->st_set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += rezerva; return(ret); } int stage_func_param::st_decal(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= rezerva; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); p_stage->el_set_func(last_text,STAGE_BLOK_DECAL); p_koord->st_set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += rezerva; return(ret); } int stage_func_param::st_blend(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= rezerva; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); p_stage->el_set_func(last_text,STAGE_BLOK_BLEND); p_koord->st_set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += rezerva; return(ret); } int stage_func_param::st_replace(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret = last_text+1; gl_texture::multitext_units -= rezerva; if(gl_texture::set_num(last_text)) { // cislo textury t = p_stage->st_textury[0]; // pouzije se pouze prvni textura p_txt = p_text[t]; // tyhle textury tam narvi if(p_txt) { gl_texture::on(p_txt->type_get()); gl_texture::set(p_txt->text_get(), p_txt->type_get()); p_stage->el_set_func(last_text,STAGE_BLOK_REPLACE); p_koord->st_set(last_text,m1flag,m2flag,p_stage->st_koord[t]); } else { ret = last_text; } } else { ret = ERROR; } gl_texture::multitext_units += rezerva; return(ret); } int stage_func_param::st_dot3_bump(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret; int koord; // Test efektu - je to podporovane videokartou? glstav_multitext_units -= rezerva; if(glstav_bump_mapping && extlist_text_env_dot3 && last_text+p_stage->textur <= glstav_multitext_units) { t = p_text->textury[DOT3_BUMP]; // Text 0 - DOT3 p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text,BLOK_DOT3_BUMP); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(last_text,p_mat->ttext+koord); } else { ret_matrix_texture(last_text); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; } if(last_text < glstav_multitext_units) { t = p_text->textury[DOT3_TEXT]; // Text 1 - Color-mapa p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text,p_text->text_funkce[DOT3_TEXT]); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(last_text,p_mat->ttext+koord); } else { ret_matrix_texture(last_text); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; ret = last_text; } else { ret = ERROR; } glstav_multitext_units += rezerva; return(ret); } int stage_func_param::st_dot3_bump_env(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t, ret; int koord; // Test efektu - je to podporovane videokartou? glstav_multitext_units -= rezerva; if(glstav_bump_mapping && extlist_text_env_dot3 && last_text+p_stage->textur <= glstav_multitext_units) { t = p_text->textury[DOT3_ENV]; // Text 2 - Lightmapa p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text,p_text->text_funkce[DOT3_ENV]); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(last_text,p_mat->ttext+koord); } else { ret_matrix_texture(last_text); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; t = p_text->textury[DOT3_BUMP]; // Text 0 - DOT3 Color-Mapa p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text,BLOK_DOT3_BUMP); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(last_text,p_mat->ttext+koord); } else { ret_matrix_texture(last_text); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; } if(last_text < glstav_multitext_units) { t = p_text->textury[DOT3_TEXT]; // Text 1 - Color-mapa p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text,p_text->text_funkce[DOT3_TEXT]); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(last_text,p_mat->ttext+koord); } else { ret_matrix_texture(last_text); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; ret = last_text; } else { ret = ERROR; } glstav_multitext_units += rezerva; return(ret); } int stage_func_param::st_bump_env(STAGE_FUNC_PARAM *p_stage, GAME_TEXT **p_text, STAGE_TEXT_KOORD *p_koord, int last_text, int rezerva, int m1flag, int m2flag) { GAME_TEXT *p_txt; int t,ret; int bump_unit; int text_unit; int env_unit; int koord; glstav_multitext_units -= rezerva; // Test efektu - je to podporovane videokartou? if(glstav_bump_mapping && extlist_ati_env_bump && last_text+p_stage->textur <= glstav_multitext_units) { assert(extlist_ati_env_bump_unit[last_text]|| extlist_ati_env_bump_unit[last_text+1]|| extlist_ati_env_bump_unit[last_text+2]); // Mam k dispozici text jednotky last_text + 2 // Rozhod to do texturovacich jednotek if(extlist_ati_env_bump_unit[last_text+2]) { bump_unit = last_text+2; env_unit = last_text+1; text_unit = last_text; } else if (extlist_ati_env_bump_unit[last_text+1]) { bump_unit = last_text+1; env_unit = last_text+2; text_unit = last_text; } else { bump_unit = last_text; env_unit = last_text+2; text_unit = last_text+1; } t = p_text->textury[DUDV_TEXT]; // Zakladni textura p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(text_unit); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(text_unit,p_text->text_funkce[DUDV_TEXT]); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(text_unit,p_mat->ttext+koord); } else { ret_matrix_texture(text_unit); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } t = p_text->textury[DUDV_ENV]; // Env textura p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(env_unit); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(env_unit,p_text->text_funkce[DUDV_ENV]); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(env_unit,p_mat->ttext+koord); } else { ret_matrix_texture(env_unit); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } t = p_text->textury[DUDV_BUMP]; // DUDV Bump-mapa p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(bump_unit); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); // Natvrdo nastavim bloky+jednotky if(glstav_text_blok[bump_unit] != BLOK_BUMP_ENV) { glstav_text_blok[bump_unit] = BLOK_BUMP_ENV; glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_BUMP_ENVMAP_ATI); } // Nahod bumpmaping na env texturu glTexEnvi(GL_TEXTURE_ENV, GL_BUMP_TARGET_ATI, GL_TEXTURE0_ARB+env_unit); // we want to scale the bump offsets such that a maximum offset of // 2 pixels occurs (assuming that the dudv map is 256 x 256). // GLfloat bumpMatrix[4] = {2.0f/256, 0.0f, 2.0f/256, 0.0f}; glTexBumpParameterfvATI(GL_BUMP_ROT_MATRIX_ATI, p_text->text_ati_bump_matrix); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(bump_unit,p_mat->ttext+koord); } else { ret_matrix_texture(bump_unit); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } ret = last_text+3; } else { if(last_text < glstav_multitext_units) { t = p_text->textury[DUDV_TEXT]; // Text 1 - Color-mapa p_txt = p_mat->p_text[t]; if(p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text,p_text->text_funkce[DUDV_TEXT]); koord = p_text->text_koord[t]; if(p_mat->flag2&glstav_posun_flagy2[koord]) { set_matrix_texture(last_text,p_mat->ttext+koord); } else { ret_matrix_texture(last_text); } if(p_mat->flag&glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = ERROR; } else if(p_mat->flag&glstav_texgen_eye_lin_flagy[koord]) { linear_eye_2d_on(last_text,p_mat->texgen_koord_s[koord],p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = ERROR; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } ret = last_text+1; } else { ret = ERROR; } } return(ret); } */ /* int glstav_bump_mapping; int glstav_text_array[6]; // texturovaci pole int glstav_text_poly_indicie; // mapovaci indicie pro poly (cislo mapy) void glstav_reset(void) { int i; glstav_bump_mapping = TRUE; for(i = 0; i < 6; i++) { glstav_genenv_s[i] = FALSE; glstav_genenv_t[i] = FALSE; glstav_genenv_r[i] = FALSE; glstav_genenv_q[i] = FALSE; glstav_text_blok[i] = ERROR; glstav_text_array[i] = FALSE; glstav_text_map_indicie[i] = FALSE; } glstav_text_array_akt = ERROR; glstav_text_poly_indicie = ERROR; } */ berusky2-0.12/src/age/graph/matrix_notified.h0000644000175000017500000001751113674426075016130 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Notified matrix interface * * Notified matrix is a normal matrix but every change is marked * */ #ifndef __MATRIX_NOTIFIED_H__ #define __MATRIX_NOTIFIED_H__ #include #include typedef class matrix_notified : public glmatrix { FRAME_CHANGE_INTERFACE chng; public: bool matrix_notified_changed(void) { return(chng.changed()); } void matrix_notified_change_set(void) { chng.change_set(); } public: matrix_notified * zero(void) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::zero()); } matrix_notified * init(void) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::init()); } public: matrix_notified * invert(void) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::invert()); } class matrix_notified * reflexion(VECT *p_a, VECT *p_b, VECT *p_c) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::reflexion(p_a, p_b, p_c)); } matrix_notified * mult(float scale) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::mult(scale)); } public: /* * Translations */ matrix_notified * translate(float px, float py, float pz) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::translate(px, py, pz)); } matrix_notified * translate(VECT *p_pos) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::translate(p_pos)); } matrix_notified * translation_set(VECT *p_pos) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::translation_set(p_pos)); } matrix_notified * translation_set(float px, float py, float pz) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::translation_set(px, py, pz)); } matrix_notified * translation_add(VECT *p_pos) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::translation_add(p_pos)); } matrix_notified * translation_add(float px, float py, float pz) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::translation_add(px, py, pz)); } public: /* * Rotations */ matrix_notified * rotation_set(PLANE *p_r, float scale) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set(p_r, scale)); } matrix_notified * rotation_set(VECT *p_vx, VECT *p_vy, VECT *p_vz) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set(p_vx, p_vy, p_vz)); } matrix_notified * rotation_set(VECT *p_vx, VECT *p_vy, VECT *p_vz, VECT *p_pos) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set(p_vx, p_vy, p_vz, p_pos)); } /* ( 1-2yy-2zz 2xy+2wz 2xz-2wy ) M = ( 2xy-2wz 1-2xx-2zz 2yz+2wx ) ( 2xz+2wy 2yz-2wx 1-2xx-2yy ) */ matrix_notified * rotation_set(QUAT *p_q) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set(p_q)); } matrix_notified * rotation_set(VECT *p_axis, float angle) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set(p_axis, angle)); } matrix_notified * rotate_x(float angle) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotate_x(angle)); } matrix_notified * rotate_y(float angle) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotate_y(angle)); } matrix_notified * rotate_z(float angle) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotate_z(angle)); } matrix_notified * rotation_set_z(float angle) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set_z(angle)); } matrix_notified * rotation_set_inverse(VECT *p_vx, VECT *p_vy, VECT *p_vz) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set_inverse(p_vx, p_vy, p_vz)); } matrix_notified * rotation_set_inverse(VECT *p_vx, VECT *p_vy, VECT *p_vz, VECT *p_pos) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotation_set_inverse(p_vx, p_vy, p_vz, p_pos)); } // 2D rotace matrix_notified * rotate_2D(VECT *p_pivot, float angle) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::rotate_2D(p_pivot, angle)); } /* * Scaling */ public: matrix_notified * scale(float x, float y, float z) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::scale(x, y, z)); } matrix_notified * scale_set(float x, float y, float z) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::scale_set(x, y, z)); } matrix_notified * scale(VECT *p_scale) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::scale(p_scale)); } matrix_notified * scale_set(VECT *p_scale) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::scale_set(p_scale)); } /* * Projection matrixes */ public: matrix_notified * projection(float fovy, float aspect, float zNear, float zFar) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::projection(fovy, aspect, zNear, zFar)); } /* * Pivot transformations */ public: matrix_notified * pivot(VECT *p_pivot) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::pivot(p_pivot)); } matrix_notified * pivot_forward(VECT *p_pivot) { matrix_notified_change_set(); return((matrix_notified *)glmatrix::pivot_forward(p_pivot)); } public: void set(GLMATRIX *p_mat) { matrix_notified_change_set(); *(glmatrix *)this = *p_mat; } GLMATRIX * get(void) { return((glmatrix *)this); } GLMATRIX * get(GLMATRIX *p_mat) { *p_mat = *((GLMATRIX *)this); return(p_mat); } /* * Constructors */ public: matrix_notified(void) { } public: matrix_notified(PLANE *p_r, float scale) : glmatrix(p_r,scale) { matrix_notified_change_set(); } matrix_notified(VECT *p_axis, float angle) : glmatrix(p_axis,angle) { matrix_notified_change_set(); } matrix_notified(VECT *p_pos, QUAT *p_rot, VECT *p_scs) : glmatrix(p_pos, p_rot, p_scs) { matrix_notified_change_set(); } matrix_notified(VECT *p_position) : glmatrix(p_position) { matrix_notified_change_set(); } } MATRIX_NOTIFIED; #endif // __MATRIX_NOTIFIED_H__ berusky2-0.12/src/age/graph/material_texture.h0000644000175000017500000003676713674426621016334 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Material textures */ #ifndef __MATERIAL_TEXTURE_H__ #define __MATERIAL_TEXTURE_H__ /* Textures can be created from: dx,dy - as an empty texture *.tpb - texture config file, contains: surface = name of image file surface_alpha = name of alpha image file class = any number from TEXT_CLASS *.bmp/jpg/png.. - texture surface (bmp, jpg, gif...) *.txp - texture param file, contains: type = "GL_TEXTURE_1D" or "GL_TEXTURE_2D" format = any string from TEXT_FORMAT compression = 0/1 bpp = any number from TEXT_BPP anis = 0/1 anis_level = float point number sharpness = float point number */ #include /* * Bitmap surfaces for texture */ #define TEXTURE_BITMAP_PARAMS_FILE ".tbp" /* * Bitmap texture parameters */ typedef class material_text_bitmap_params { public: char pixmap[MAX_FILENAME]; char pixmap_alpha[MAX_FILENAME]; public: bool load(const char *p_file); public: material_text_bitmap_params(void); } MATERIAL_TEXT_BITMAP_PARAMS; /* * Bitmap textures */ typedef class material_text_bitmap : public change_interface { public: FILE_NAME filename; private: SURFACE_SW surf; public: SURFACE * bitmap_get(void) { return((SURFACE *)&surf); } void bitmap_size_get(tpos *p_dx, tpos *p_dy) { surf.size_get(p_dx, p_dy); } public: bool bitmap_loaded(void) { return(surf.loaded()); } public: bool bitmap_changed(void) { return(changed()); } void bitmap_change_set(void) { change_set(); } void bitmap_change_clear(void) { change_clear(); } public: bool bitmap_create(tpos dx, tpos dy); bool bitmap_create(const char *p_dir, const char *p_file, const char *p_name = NULL); bool bitmap_create(SURFACE *p_surf); bool bitmap_destroy(void); public: material_text_bitmap(void); ~material_text_bitmap(void); } MATERIAL_TEXT_BITMAP; /* * Texture GL params */ /* * Extension GL config files */ #define TEXTURE_GL_PARAM_FILE ".tgl" #define DEFAULT_MIP_LEVEL 9 typedef enum { CLASS_DEFAULT = 0, CLASS1 = 1, CLASS2 = 2, CLASS3 = 3, CLASS4 = 4, CLASS5 = 5, CLASS6 = 6, CLASS7 = 7, CLASS_CUSTOM } TEXT_CLASS; #define TEXT_CLASSES_NUM 9 typedef enum { FORMAT_RGB = 0, FORMAT_RGBA1 = 1, FORMAT_RGBA4 = 2, FORMAT_LUM = 3, FORMAT_LUM_ALPHA1 = 4, FORMAT_LUM_ALPHA4 = 5, FORMAT_ALPHA = 6, FORMAT_LIGHTMAP = 7 } TEXT_FORMAT; #define TEXT_FORMATS_NUM 8 typedef enum { FILTER_NEAR, FILTER_LINEAR, FILTER_MIP_NEAR, FILTER_MIP_LINEAR, FILTER_MIP_TRILINEAR } TEXT_FILTER; typedef enum { TEXT_REPEAT, TEXT_CLAMP } TEXT_WRAP; typedef enum { TEXT_DEFAULT = 0, TEXT_16BPP = 1, TEXT_32BPP = 2, TEXT_DTX = 3 } TEXT_BPP; #define TEXT_BPP_NUM 4 #define TEXT_DETAIL_BASE 0 #define TEXT_MAX_DEFAULT 4096 #define TXT1_GEN_DOT3 0x0001 // texture will be converted to DOT3 format #define TXT1_GEN_DUDV 0x0002 // texture will be converted to DUDV format #define TXT2_USED 0x0001 #define TXT2_FLARE 0x0002 #define TXT2_NO_CULL 0x0004 #define TXT2_BUMP 0x0008 #define TXT2_ALPHA 0x0010 // Parameters what can be attached to any texture typedef struct material_text_gl_params { GLenum type; // texture type (1D/2D/3D/4D/5D/6D) TEXT_FORMAT format; // texture format (from default_texture_config) int compression; // texture compression TEXT_BPP bpp; // bit deph TEXT_FILTER filter; // texture filter TEXT_WRAP wrap; // wrap params int anis; // Anisotropy filter float anis_level; // Anisotropy filter level float sharpness; // texture sharpness tflag flag1; // texture flag 1 tflag flag2; // texture flag 2 /* * Load GL params from given TEXTURE_GL_PARAM_FILE */ public: bool load(char *p_file); } MATERIAL_TEXT_GL_PARAMS; /* * Default texture configuration (for given classes) */ typedef struct default_text_config { /* * Default GL params for each text class */ static MATERIAL_TEXT_GL_PARAMS params[TEXT_CLASSES_NUM]; public: MATERIAL_TEXT_GL_PARAMS * params_get(TEXT_CLASS texture_class); /* * Default texture formats */ public: static int format1d[TEXT_BPP_NUM][TEXT_FORMATS_NUM]; // Format table for 1d textures static int format2d[TEXT_BPP_NUM][TEXT_FORMATS_NUM]; // Format table for 2d textures public: int format_get(int type, int bpp, int format_index); /* * Default params */ public: static int details[TEXT_CLASSES_NUM]; // LOD for each texture class static int max_x[TEXT_CLASSES_NUM]; // max texture resolution (x) static int max_y[TEXT_CLASSES_NUM]; // max texture resolution (y) /* * Load the whole default configuration */ public: void load(char *p_file); } DEFAULT_TEXT_CONFIG; DEFAULT_TEXT_CONFIG * default_text_config_get(void); /* * Video-ram texture */ typedef class material_text_gl : public material_text_bitmap { /* * Texture class */ private: TEXT_CLASS tclass; public: void gl_text_class_set(TEXT_CLASS cl) { if(cl == CLASS_CUSTOM) { gl_text_params_custom_create(); } else { gl_text_params_custom_destroy(); } tclass = cl; } TEXT_CLASS gl_text_class_get(void) { return(tclass); } /* * Texture parameters */ private: // if it's NULL, take the default one from TXT_CONFIG MATERIAL_TEXT_GL_PARAMS *p_params; public: void gl_text_params_create(void); void gl_text_params_destroy(void); bool gl_text_params_load(char *p_file); public: void gl_text_params_custom_create(void) { gl_text_params_create(); tclass = CLASS_CUSTOM; } void gl_text_params_custom_destroy(void) { gl_text_params_destroy(); tclass = CLASS_DEFAULT; } public: MATERIAL_TEXT_GL_PARAMS * gl_text_params_get(void) { if(p_params) return(p_params); return(default_text_config_get()->params_get(tclass)); } public: int gl_text_type_get(void) { return(gl_text_params_get()->type); } bool gl_text_type_set(int type) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->type = type; return(TRUE); } return(FALSE); } int gl_text_bpp_get(void) { return(gl_text_params_get()->bpp); } bool gl_text_bpp_set(TEXT_BPP bpp) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->bpp = bpp; return(TRUE); } return(FALSE); } int gl_text_format_get(void) { return(gl_text_params_get()->format); } bool gl_text_format_set(TEXT_FORMAT format) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->format = format; return(TRUE); } return(FALSE); } int gl_text_gl_format_get(void) { DEFAULT_TEXT_CONFIG *p_pr = default_text_config_get(); return(p_pr->format_get(gl_text_type_get(), gl_text_bpp_get(), gl_text_format_get())); } bool gl_text_gl_format_set(void) { if(!gl_text_loaded()) { gl_text_params_custom_create(); return(TRUE); } return(FALSE); } int gl_text_compression_get(void) { return(gl_text_params_get()->compression); } bool gl_text_compression_set(int compression) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->compression = compression; return(TRUE); } return(FALSE); } TEXT_FILTER gl_text_filter_get(void) { return(gl_text_params_get()->filter); } bool gl_text_filter_set(TEXT_FILTER filter) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->filter = filter; return(TRUE); } return(FALSE); } TEXT_WRAP gl_text_wrap_get(void) { return(gl_text_params_get()->wrap); } bool gl_text_wrap_set(TEXT_WRAP wrap) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->wrap = wrap; return(TRUE); } return(FALSE); } float gl_text_sharpness_get(void) { return(gl_text_params_get()->sharpness); } bool gl_text_sharpness_set(float sharpness) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->sharpness = sharpness; return(TRUE); } return(FALSE); } bool gl_text_anisotrophy_filter_get(void) { return(gl_text_params_get()->anis); } bool gl_text_anisotrophy_filter_set(bool anis) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->anis = anis; return(TRUE); } return(FALSE); } float gl_text_anisotrophy_level_get(void) { return(gl_text_params_get()->anis_level); } bool gl_text_anisotrophy_level_set(float anis_level) { if(!gl_text_loaded()) { gl_text_params_custom_create(); p_params->anis_level = anis_level; return(TRUE); } return(FALSE); } /* * OpenGL texture name */ private: GLuint gl_text_name; public: bool gl_text_loaded(void) { return(gl_text_name != 0); } public: int gl_text_get(void) { return(gl_text_name); } public: void gl_text_bind(void) { glBindTexture(gl_text_type_get(), gl_text_get()); } bool gl_text_create(void); bool gl_text_destroy(void); public: material_text_gl(void); ~material_text_gl(void); } MATERIAL_TEXT_GL; /* * A final material texture */ typedef class material_text : public material_text_gl, public object_list { public: bool loaded(void); bool load(void); bool load(const char *p_dir, const char *p_file, const char *p_name = NULL); bool load(SURFACE *p_surf); bool save(const char *p_dir, const char *p_file = NULL); bool destroy(void); public: void texture_remove(void); public: void print(void) { pprintf("Texture: %s",name_get()); } public: material_text(SCENE *p_scene); ~material_text(void); public: } MATERIAL_TEXT; #define TEXT_DIRS 20 typedef class material_text_list : public object_list_head { public: MATERIAL_TEXT * create(void) { MATERIAL_TEXT *p_new = new MATERIAL_TEXT(scene_get()); object_list_insert(p_new); return(p_new); } MATERIAL_TEXT * create_and_load(const char *p_dir, const char *p_file, const char *p_name = NULL) { MATERIAL_TEXT *p_text = create(); p_text->load(p_dir, p_file, p_name); return(p_text); } void destroy(MATERIAL_TEXT *p_text) { object_list_remove(p_text); delete (MATERIAL_TEXT *)p_text; } public: MATERIAL_TEXT * get_first(void) { return((MATERIAL_TEXT *)object_list_get_first()); } // Texture directories private: int texture_dir_last; char texture_dir[TEXT_DIRS][MAX_FILENAME]; // adresare textur public: bool dir_add(const char *p_dir); void dir_reset(void); private: int dir_next_new(void); char * dir_next(int *p_handle); public: int size_get(void); int num_get(void); public: int errors_print(void); int status_print(void); public: void reload(void); public: material_text_list(SCENE *p_scene_ref); ~material_text_list(void); } MATERIAL_TEXT_LIST; /* *************************************************************************** Texture-coordinates generator setup *************************************************************************** */ typedef class material_text_coordinates { // Texture transformation matrix bool text_matrix_state; GLMATRIX text_matrix; public: GLMATRIX * text_matrix_get(void) { return(&text_matrix); } public: void set(int unit) { if(text_matrix_state) { gl_texture_coordinates::matrix_on(unit, &text_matrix); } else { gl_texture_coordinates::matrix_off(unit); } } /* private: // Texture generator configuration bool generator_state; bool generator_s_state; float generator_s[4]; bool generator_t_state; float generator_t[4]; bool generator_r_state; float generator_r[4]; bool generator_q_state; float generator_q[4]; public: // void set(int text_unit, int m1flag, int m2flag, int mat_text) // text_unit - do jake jednotky se generator ma zapnout // m1,m2 flags - flagy materialu // mat_text - cislo textury v materialu (pro prevod z flagu) void generator_set(int unit) { if(m2flag&texgen_matrix_texture_flagy2[mat_text]) { set_matrix_texture(text_unit,&stage_ttext); } else { ret_matrix_texture(text_unit); } if(m1flag&texgen_sphere_flagy[mat_text]) { gl_env_on(text_unit); texgen_map_indicie[text_unit] = ERROR; } else if(m1flag&texgen_eye_lin_flagy[mat_text]) { gl_linear_eye_2d_on(text_unit,stage_koord_s,stage_koord_t); texgen_map_indicie[text_unit] = ERROR; } else { gl_off(text_unit); texgen_map_indicie[text_unit] = mat_text; } } void st_ttext_matrix(GLMATRIX *p_mat) { if(p_mat) { memcpy(&stage_ttext,p_mat,sizeof(*p_mat)); } } void st_texgen(float *p_s, float *p_t, float *p_r, float *p_q) { if(p_s) { stage_koord_s[0] = p_s[0]; stage_koord_s[1] = p_s[1]; stage_koord_s[2] = p_s[2]; stage_koord_s[3] = p_s[3]; } if(p_t) { stage_koord_t[0] = p_t[0]; stage_koord_t[1] = p_t[1]; stage_koord_t[2] = p_t[2]; stage_koord_t[3] = p_t[3]; } if(p_r) { stage_koord_r[0] = p_r[0]; stage_koord_r[1] = p_r[1]; stage_koord_r[2] = p_r[2]; stage_koord_r[3] = p_r[3]; } if(p_q) { stage_koord_q[0] = p_q[0]; stage_koord_q[1] = p_q[1]; stage_koord_q[2] = p_q[2]; stage_koord_q[3] = p_q[3]; } } */ public: material_text_coordinates(void) { text_matrix_state = FALSE; text_matrix.init(); } } MATERIAL_TEXT_COORDINATES; #endif // __MATERIAL_TEXTURE_H__ berusky2-0.12/src/age/graph/alpha.cpp0000644000175000017500000000375313674426075014366 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Alpha-stage function */ // Constants and types #include "age.h" ALPHA_FUNC material_alpha::alpha_functions; /* Alpha-functions */ void alpha_func::off(void) { blend_off(); alpha_test_off(); } void alpha_func::patch(void) { blend_on(); alpha_test_off(); glBlendFunc(GL_ZERO,GL_SRC_COLOR); } void alpha_func::smoke(void) { blend_on(); alpha_test_off(); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_COLOR); } void alpha_func::transparent(void) { blend_on(); alpha_test_on(); glAlphaFunc(GL_GREATER,0.004f); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); } void alpha_func::test(void) { blend_off(); alpha_test_on(); glAlphaFunc(GL_GREATER,0.5f); } berusky2-0.12/src/age/support/0000755000175000017500000000000013676433304013253 500000000000000berusky2-0.12/src/age/support/age_main.cpp0000644000175000017500000000422213674426075015444 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Loop management */ #include "age.h" // ------------------------------------------------------- // AGE config // ------------------------------------------------------- AGE_CONFIG age_main::config; void age_main::config_scene_selection(bool state) { config.scene_selection = state; } bool age_main::draw(void) { ltimer.frame_start(); // Propagate correct frame to system if(p_graph) { p_graph->current_frame_set(frame); p_graph->current_fps_set(ltimer.fps_get()); } // Draw frame graph_draw(); // Increment frame counter frame++; if(frame < 0) frame = 0; return(TRUE); } age_main::age_main(AGE_EVENT_FUNC p_callback) { p_graph = NULL; p_scene = NULL; frame = 0; srand(current_time_get()); callback_set(p_callback); } age_main::~age_main(void) { if(p_graph) delete p_graph; } berusky2-0.12/src/age/support/timer.cpp0000644000175000017500000000257213674426075015032 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * A timer support */ #include #include "timer.h" berusky2-0.12/src/age/support/input.h0000644000175000017500000001203513674426075014511 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Interface for keyboard/mouse/everything */ #ifndef __INPUT_H__ #define __INPUT_H__ /* Key definition - SDL */ // Add some extra space #define KEYNUM SDLK_LAST+10 #define K_ESC SDLK_ESCAPE #define K_F1 SDLK_F1 #define K_F2 SDLK_F2 #define K_F3 SDLK_F3 #define K_F4 SDLK_F4 #define K_F5 SDLK_F5 #define K_F6 SDLK_F6 #define K_F7 SDLK_F7 #define K_F8 SDLK_F8 #define K_F9 SDLK_F9 #define K_F10 SDLK_F10 #define K_F11 SDLK_F11 #define K_F12 SDLK_F12 #define K_1 SDLK_1 #define K_2 SDLK_2 #define K_3 SDLK_3 #define K_4 SDLK_4 #define K_5 SDLK_5 #define K_6 SDLK_6 #define K_7 SDLK_7 #define K_8 SDLK_8 #define K_9 SDLK_9 #define K_0 SDLK_0 #define KP_0 SDLK_KP0 #define KP_1 SDLK_KP1 #define KP_2 SDLK_KP2 #define KP_3 SDLK_KP3 #define KP_4 SDLK_KP4 #define KP_5 SDLK_KP5 #define KP_6 SDLK_KP6 #define KP_7 SDLK_KP7 #define KP_8 SDLK_KP8 #define KP_9 SDLK_KP9 #define K_A SDLK_a #define K_B SDLK_b #define K_C SDLK_c #define K_D SDLK_d #define K_E SDLK_e #define K_F SDLK_f #define K_G SDLK_g #define K_H SDLK_h #define K_I SDLK_i #define K_J SDLK_j #define K_K SDLK_k #define K_L SDLK_l #define K_M SDLK_m #define K_N SDLK_n #define K_O SDLK_o #define K_P SDLK_p #define K_Q SDLK_q #define K_R SDLK_r #define K_S SDLK_s #define K_T SDLK_t #define K_U SDLK_u #define K_V SDLK_v #define K_W SDLK_w #define K_X SDLK_x #define K_Y SDLK_y #define K_Z SDLK_z #define K_MINUS SDLK_MINUS #define K_PLUS SDLK_PLUS #define K_EQUALS SDLK_EQUALS #define K_BKSP SDLK_BACKSPACE #define K_TAB SDLK_TAB #define K_BRACKET_L SDLK_LEFTBRACKET #define K_BRACKET_R SDLK_RIGHTBRACKET #define K_ENTER SDLK_RETURN #define K_SEMICOL SDLK_SEMICOLON #define K_QUOTE SDLK_QUOTE #define K_TILDA #define K_BACKSLASH SDLK_BACKSLASH #define K_COMMA SDLK_COMMA #define K_PERIOD SDLK_PERIOD #define K_SLASH SDLK_SLASH #define K_SPACE SDLK_SPACE #define K_UP SDLK_UP #define K_LEFT SDLK_LEFT #define K_RIGHT SDLK_RIGHT #define K_DOWN SDLK_DOWN #define K_HOME SDLK_HOME #define K_PGUP SDLK_PAGEUP #define K_END SDLK_END #define K_PGDN SDLK_PAGEDOWN #define K_INSERT SDLK_INSERT #define K_DEL SDLK_DELETE #define K_SHIFT_MASK KMOD_SHIFT #define K_CTRL_MASK KMOD_CTRL typedef SDLKey KEYTYPE; typedef SDLMod KEYMOD; inline bool in_rect(RECT2DI &dst, tpos x, tpos y) { return(x >= dst.x && y >= dst.y && x < dst.x+dst.dx && y < dst.y+dst.dy); } inline bool in_rect(RECT2DI &dst, RECT2DI &src) { return(src.x >= dst.x && src.y >= dst.y && src.x < dst.x+dst.dx && src.y < dst.y+dst.dy); } #define NO_STATE (-1) // ------------------------------------------------------------ // Event prototypes // ------------------------------------------------------------ class age_main; typedef class age_main AGE_MAIN; // ------------------------------------------------------- // Mouse UI // ------------------------------------------------------- #define MOUSE_BUTTONS 5 inline bool key_to_ascii(int key, char *p_char) { if(key < 127) { *p_char = key; return(TRUE); } else { return(FALSE); } } void key_repeat_set(bool state); #endif // __INPUT_H__ berusky2-0.12/src/age/support/timer.h0000644000175000017500000000562513674426075014501 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * A timer support */ #ifndef __TIMER_H__ #define __TIMER_H__ inline Uint32 current_time_get(void) { return(SDL_GetTicks()); } typedef class timer { // Updated by timer routines Uint32 frame_time_start; Uint32 frame_time_end; Uint32 frame_time_length_last; // Set by user Uint32 frame_time_delay; public: void fps_set(float fps) { frame_time_delay = (Uint32)(1000.0f / fps); } float fps_get(void) { return(1000.0f / (float)frame_time_delay); } void frame_length_set(Uint32 frame_length) { frame_time_delay = frame_length; } Uint32 frame_length_get(void) { return(frame_time_delay); } public: float current_fps_get(void) { return(1000.0f / (float)frame_time_length_last); } Uint32 current_frame_length_get(void) { return(frame_time_length_last); } void delay(int msecs) { SDL_Delay((Uint32)msecs); } public: void frame_start(void) { frame_time_start = SDL_GetTicks(); frame_time_end = frame_time_start + frame_time_delay; } void frame_end(bool wait) { Uint32 now; // Wait until the end of this frame now = SDL_GetTicks(); if(now < frame_time_end && wait) SDL_Delay(frame_time_end - now); // Calculate a length of this frame now = SDL_GetTicks(); frame_time_length_last = now - frame_time_start; } public: timer(int fps = 0) { frame_time_start = 0; frame_time_end = 0; frame_time_delay = 50; frame_time_length_last = 50; if(fps) fps_set(fps); } } TIMER; #endif // __TIMER_H__ berusky2-0.12/src/age/support/events.cpp0000644000175000017500000000473513674426075015221 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "defs.h" #include "utils.h" #include "log.h" #include "events.h" int event_generator::last_event = FIRST_SYSTEM_GENERATED_EVENT; const char * game_event::translation_table[] = { "EV_NONE", "EV_TEST", "EV_CALLBACK", "UI_BLOCK_KEYS", "UI_UNBLOCK_ALL", "UI_KEY_DOWN", "UI_KEY_UP", "UI_MOUSE_MOVE", "UI_MOUSE_EVENT", "UI_APP_ACTIVATED", "UI_APP_DEACTIVATED", "UI_QUIT" }; const char * game_event::translate_event(int type) { if(type >= 0 && type < (int)sizeof(game_event::translation_table)) { return(translation_table[type]); } else { return("USER_DEFINED"); } } void event_stream::testcase(void) { extend(EXTEND_STEP); clear(); GAME_EVENT ev(EV_TEST); assert(empty()); assert(!full()); add(ev); assert(read_first == 0); assert(read_next == 0); assert(write_first == 0); assert(write_next == 1); commit(); assert(!empty()); assert(!full()); assert(read_first == 0); assert(read_next == 1); assert(write_first == 1); assert(write_next == 1); ev = get(); assert(empty()); assert(!full()); assert(read_first == 1); assert(read_next == 1); assert(write_first == 1); assert(write_next == 1); } berusky2-0.12/src/age/support/events_types.h0000644000175000017500000000614413674426075016106 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __EVENTS_TYPES_H__ #define __EVENTS_TYPES_H__ #define FIRST_SYSTEM_EVENT (INT_MAX>>1) #define FIRST_SYSTEM_GENERATED_EVENT (FIRST_SYSTEM_EVENT+1000) /**************************************************************** events UI_ - events from user interface **************************************************************** Common parameters: change_sprite = true -> change sprites on screen change_sprite = false -> don't touch sprites on screen */ typedef enum { // Zero-event EV_NONE = FIRST_SYSTEM_EVENT, // Test-event EV_TEST = FIRST_SYSTEM_EVENT+1, // Call event callback function // format: [EV_CALLBACK, callback_adress] EV_CALLBACK = FIRST_SYSTEM_EVENT+2, // ------------------------------------------------------------------------ // GUI events // user interface - block selected event (player move and so on) // format: [GI_BLOCK_KEYS, key_group, blocked] // key_group = key group to block // blocked = true/false UI_BLOCK_KEYS = FIRST_SYSTEM_EVENT+100, // user interface - enable all groups // format: [GI_UNBLOCK_ALL] UI_UNBLOCK_ALL = FIRST_SYSTEM_EVENT+101, // pressed key // format: [GI_KEY_DOWN, key, shift, ctrl] UI_KEY_DOWN = FIRST_SYSTEM_EVENT+102, // released key // format: [GI_KEY_UP, key, shift, ctrl] UI_KEY_UP = FIRST_SYSTEM_EVENT+103, // Mouse was moved // format: [GI_MOUSE_MOVE, x, y, state, button] UI_MOUSE_MOVE = FIRST_SYSTEM_EVENT+104, // format: [GI_MOUSE_EVENT, x, y, state, button] UI_MOUSE_BUTTON = FIRST_SYSTEM_EVENT+105, // Application was activated UI_APP_ACTIVATED = FIRST_SYSTEM_EVENT+106, // Application was deactivated UI_APP_DEACTIVATED = FIRST_SYSTEM_EVENT+107, // SDL quit event UI_QUIT = FIRST_SYSTEM_EVENT+108 } EVENT_TYPE; #endif // __EVENTS_TYPES_H__ berusky2-0.12/src/age/support/input.cpp0000644000175000017500000000330713674426075015046 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Global input interface */ #include "age.h" // ------------------------------------------------------------------------- // Keyboard interface // ------------------------------------------------------------------------- void key_repeat_set(bool state) { if(state) { SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL); } else { SDL_EnableKeyRepeat(0,0); } } berusky2-0.12/src/age/support/events.h0000644000175000017500000002523213674426075014661 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __EVENTS_H__ #define __EVENTS_H__ #include #include #include "events_types.h" #define EVENT_LAST 0 #define EVENT_FIRST 1 #define PARAM_0 0 #define PARAM_1 1 #define PARAM_2 2 #define PARAM_3 3 #define PARAM_4 4 #define PARAM_5 5 #define PARAM_GROUP PARAM_0 #define PARAM_BLOCK PARAM_1 #define PARAMS 6 typedef void * EVENT_PARAM_TYPE; #define EVENT_TYPE_NONE ((EVENT_PARAM_TYPE)(NULL)) #define ET(p) ((EVENT_PARAM_TYPE)(p)) /* Everything */ typedef class game_event { static const char * translation_table[]; static const char * translate_event(int type); private: int type; int depend_events; EVENT_PARAM_TYPE params[PARAMS]; // Basic controls public: bool valid(void) { return(type != EV_NONE); } bool used(void) { return(valid()); } // Clear this event public: void clear(void) { type = EV_NONE; } // Set type of event public: void type_set(int etype) { type = etype; } int type_get(void) { return(type); } // Set parameters of event public: void params_pointer_set(EVENT_PARAM_TYPE p0, EVENT_PARAM_TYPE p1 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p2 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p3 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p4 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p5 = EVENT_TYPE_NONE) { params[0] = p0; params[1] = p1; params[2] = p2; params[3] = p3; params[4] = p4; params[5] = p5; } void params_int_set(int p0, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 0, int p6 = 0) { params[0] = reinterpret_cast(p0); params[1] = reinterpret_cast(p1); params[2] = reinterpret_cast(p2); params[3] = reinterpret_cast(p3); params[4] = reinterpret_cast(p4); params[5] = reinterpret_cast(p5); } int param_int_get(int index) { assert(index < PARAMS); int *p_tmp = (int *)(params+index); return((int)(*p_tmp)); } void param_int_set(int index, int value) { assert(index < PARAMS); params[index] = reinterpret_cast(value); } void * param_pointer_get(int index) { assert(index < PARAMS); return((void *)(params[index])); } void param_pointer_get(int index, void *p_value) { assert(index < PARAMS); params[index] = p_value; } // Helpers public: const char * translate(void) { return(translate_event(type)); } void dump(void) { pprintf("event = %s, params = [%d,%d,%d,%d,%d,%d]", translate(), param_int_get(0), param_int_get(1), param_int_get(2), param_int_get(3), param_int_get(4), param_int_get(5)); } void depends_add(int num) { depend_events += num; } // Constructors public: game_event(void) : type(EV_NONE), depend_events(0) { params_int_set(0,0,0,0,0,0); } game_event(EVENT_TYPE ev) : type(ev), depend_events(0) { params_int_set(0,0,0,0,0,0); } game_event(EVENT_TYPE ev, EVENT_PARAM_TYPE p0, EVENT_PARAM_TYPE p1 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p2 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p3 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p4 = EVENT_TYPE_NONE, EVENT_PARAM_TYPE p5 = EVENT_TYPE_NONE) : type(ev), depend_events(0) { params_pointer_set(p0,p1,p2,p3,p4,p5); } game_event(EVENT_TYPE ev, int p0, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 0) : type(ev), depend_events(0) { params_int_set(p0,p1,p2,p3,p4,p5); } } GAME_EVENT; #define EXTEND_STEP 1000 typedef class event_stream { int max_events; // the lenght of queue GAME_EVENT *p_queue; // read queue int read_first; int read_next; int write_first; int write_next; // ---------------------------------------------------- // Helpers // ---------------------------------------------------- private: bool empty(int first, int next) { return(first == next); } bool full(int first, int next) { return(first == index_next(next)); } bool in_range(int first, int last, int index) { if(first < last) { // normal order return(index >= first && index <= last); } else { // flipped order return(index >= first || index <= last); } } void dump(const char *p_desc, int first, int next) { int akt; if(!empty(first,next)) { pprintf(p_desc); for(akt = first; akt != next; akt = index_next(akt)) { p_queue[akt].dump(); } } } void testcase(void); // ---------------------------------------------------- // basic operations // ---------------------------------------------------- public: int index_next(int index) { return ++index < max_events ? index : index = 0; } int index_prev(int index) { return --index < 0 ? index = max_events -1 : index; } void dump_read(const char *p_desc) { dump(p_desc,read_first,read_next); } void dump_write(const char *p_desc) { dump(p_desc,write_first,write_next); } void dump(void) { dump_read("Read stream"); dump_write("Write stream"); } // ---------------------------------------------------- // basic checks & sets // ---------------------------------------------------- public: bool empty(void) { return(empty(read_first, read_next)); } bool full(void) { return(full(read_first, write_next)); } void clear(void) { read_first = read_next = write_first = write_next = 0; } // ---------------------------------------------------- // Read events // ---------------------------------------------------- public: GAME_EVENT get(void) { assert(!empty()); if(!empty()) { int tmp_index = read_first; read_first = index_next(read_first); return p_queue[tmp_index]; } else { return(GAME_EVENT()); } } // ---------------------------------------------------- // Write events // ---------------------------------------------------- public: void add(GAME_EVENT *p_event, bool safe = TRUE) { if(!full()) { if(p_event->valid()) { p_queue[write_next] = *p_event; write_next = index_next(write_next); } } else if(safe) assert(0); } void add(GAME_EVENT event, bool safe = TRUE) { add(&event,safe); } #define DIRECTION_ARRAY 1 #define DIRECTION_STACK (-1) int add(GAME_EVENT *p_event, int num, int direction = 1, bool safe = TRUE) { assert(p_event); int i; for(i = 0; i < num; i++, p_event += direction) { if(full()) { if(safe) assert(0); else return(num); } else if(p_event->valid()) { p_queue[write_next] = *p_event; write_next = index_next(write_next); } } return(num); } void add(class event_stream *p_stream, bool safe = TRUE) { if(!p_stream || p_stream->empty()) return; while(!p_stream->empty()) { if(!full()) { GAME_EVENT ev = p_stream->get(); if(ev.valid()) add(ev); } else if(safe) assert(0); } } // ---------------------------------------------------- // move all items from write stream to read stream // empty the write stream // ---------------------------------------------------- public: void commit(void) { read_next = write_first = write_next; } // ---------------------------------------------------- // Initialization & creation // ---------------------------------------------------- public: void extend(int step) { if(!p_queue) { max_events = step; p_queue = new GAME_EVENT[step]; } else { commit(); int min = read_first; int max = read_next; GAME_EVENT *p_tmp = new GAME_EVENT[max_events+step]; if(!empty(read_first, read_next)) { int akt,i; for(i = 0, akt = min; akt != max; i++, akt = index_next(akt)) { p_tmp[i++] = p_queue[akt]; } read_first = 0; write_first = write_next = read_next = max; } else { clear(); } delete [] p_queue; p_queue = p_tmp; max_events += step; } } // ---------------------------------------------------- // Constructors // ---------------------------------------------------- public: event_stream(void) : max_events(0), p_queue(NULL) { clear(); extend(EXTEND_STEP); } ~event_stream(void) { max_events = 0; if(p_queue) delete [] p_queue; clear(); } } EVENT_STREAM, GAME_EVENT_QUEUE; // Create an unique event numbers for user-defined events typedef class event_generator { static int last_event; public: static int generate(void) { last_event++; return(last_event); } } EVENT_GENERATOR; #endif // __EVENTS_H__ berusky2-0.12/src/age/support/age_main.h0000644000175000017500000001777013674426075015125 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Loop event management */ #ifndef __AGE_MAIN_H__ #define __AGE_MAIN_H__ /* Basic age scheme: // Age callback (is called from p_age->run()) bool main_callback(AGE_MAIN *p_age) { // Draw single frame p_age->graph_draw(); return(TRUE); } int main(int argc, char **argv) { // Create main age class and register the callback AGE_MAIN *p_age = new AGE_MAIN(main_callback); // Set up graphics and create rendering screen p_age->graph_set(XRES_MENU,YRES_MENU); if(!p_age->graph_screen_create()) return(FALSE); // Set up active 3D scene SCENE *p_scene = p_age->scene_new(); p_age->scene_active_set(p_scene); // Run the whole circus p_age->run(); } */ /* Main AGE class, it runs and owes whole graphics interface. AGE_CONFIG config - some configuration Graphics interface: GRAPH3D *p_graph - graphics interface, owed by AGE GRAPH3D_GTK * graph_gtk_set(tpos width, tpos height) GRAPH3D_SDL * graph_sdl_set(tpos width, tpos height, int screen_depth = BPP_DEFAULT, int fullscreen = FALSE) bool graph_create_screen(void) void graph_draw(void) GRAPH3D * graph_get(void) Scene interface: SCENE *p_scene - active scene SCENE * scene_new(void) SCENE * scene_get(void) void scene_delete(void) void scene_active_set(SCENE *p_scene) SCENE * scene_active_get(void) Age callback (called by every frame): AGE_EVENT_FUNC p_callback - AGE callback -> called every frame void callback_set(AGE_EVENT_FUNC p_fnc) Event stream: EVENT_STREAM estream - events in system GAME_EVENT * event_get(void) void event_add(GAME_EVENT *p_event) Add event to system queue void event_loop(void) Fetches all input events from SDL and transformate them to the system events. Timer interface: TIMER ltimer - timer interface TIMER * timer_get(void) Input interface: INPUT inp - input interface INPUT * input_get(void) Frame interface: int frame Frame configuration: int current_frame_get(void) void events_wait_set(bool state) void fps_set(float fps) void fps_clear(void) Frame/scene rendering: bool draw(void) It does: - sets current frame - draw scene bool run_frame(void) It does: - sets current frame - fetches all events from input and translate them to AGE event queue - calls age callback - waits until end of frame void run(void) Run run_frame until the UI_QUIT appears in system queue. */ #define FPS_DEFAULT 30 #define LOOP_FPS_SET 0x1 // Keep given FPS #define LOOP_EVENT_WAIT 0x2 // Wait for events (block) class age_main; typedef class age_main AGE_MAIN; typedef bool (* AGE_EVENT_FUNC)(AGE_MAIN *p_loop); /* * Graphics config */ typedef struct age_config { bool scene_selection; } AGE_CONFIG; typedef class age_main : public flag_interface, public class_user_data { /* * AGE configuration */ public: static AGE_CONFIG config; private: GRAPH3D *p_graph; public: #ifdef ENABLE_GTK_BACKEND GRAPH3D_GTK * graph_set(tpos width, tpos height) { if(p_graph) delete p_graph; p_graph = new GRAPH3D_GTK(width, height); return((GRAPH3D_GTK *)p_graph); } GtkWidget * graph_gtk_window_get(void) { if(p_graph == NULL) return(NULL); assert(p_graph->type_get() == GRAPH_GTK); return(((GRAPH3D_GTK *)p_graph)->gtk_widget_get()); } #endif // ENABLE_GTK_BACKEND #ifdef ENABLE_SDL_BACKEND GRAPH3D_SDL * graph_set(tpos width, tpos height, int screen_depth = BPP_DEFAULT, int fullscreen = FALSE) { if(p_graph) delete p_graph; p_graph = new GRAPH3D_SDL(width, height, screen_depth, fullscreen); return((GRAPH3D_SDL *)p_graph); } #endif // ENABLE_SDL_BACKEND bool graph_screen_create(void) { assert(p_graph); return(p_graph->screen_create()); } void graph_screen_resize(tpos width, tpos height) { assert(p_graph); return(p_graph->screen_resize(width, height)); } GRAPH3D * graph_get(void) { return(p_graph); } void graph_get(tpos *p_width, tpos *p_height, int *p_screen_depth) { return(p_graph->get(p_width, p_height, p_screen_depth)); } // Draw whole scene void graph_draw(void) { assert(p_graph); if(p_graph) { p_graph->draw_start(); p_graph->draw_end(); } } /* * Scene interfaces */ public: SCENE * p_scene; public: SCENE * scene_new(void) { scene_delete(); p_scene = new SCENE; p_scene->graph_set(p_graph); return(p_scene); } SCENE * scene_get(void) { return(p_scene); } void scene_delete(void) { if(p_scene) { delete p_scene; p_scene = NULL; } } public: void scene_active_set(SCENE *p_scene) { if(p_graph) { p_graph->scene_active_set(p_scene); p_scene->render_state_set(TRUE); } } SCENE * scene_active_get(void) { return(p_graph ? p_graph->scene_active_get() : NULL); } /* * Scene selection interface */ /* public: void scene_selection_add(OBJECT_SELECT * p_object) { SCENE *p_scene = scene_get(); if(p_scene) p_scene->selection_add(p_object); } void scene_selection_remove(OBJECT_SELECT *p_object) { SCENE *p_scene = scene_get(); if(p_scene) p_scene->selection_remove(p_object); } */ public: void scene_selection_clear(void) { SCENE *p_scene = scene_get(); if(p_scene) p_scene->selection_clear(); } SELECTED_OBJECT_ITEM * scene_selection_get(void) { SCENE *p_scene = scene_get(); return(p_scene ? p_scene->selection_get() : NULL); } public: void config_scene_selection(bool state); /* * Callback interface */ private: AGE_EVENT_FUNC p_callback; public: void callback_set(AGE_EVENT_FUNC p_fnc) { p_callback = p_fnc; } private: /* * Main timer class */ private: TIMER ltimer; public: TIMER * timer_get(void) { return(<imer); } /* * Frame interface */ private: int frame; public: int current_frame_get(void) { return(frame); } public: void fps_set(float fps) { ltimer.fps_set(fps); flag_set(LOOP_FPS_SET); } void fps_clear(void) { flag_clear(LOOP_FPS_SET); } /* * Scene rendering */ public: // Draw single frame bool draw(void); public: age_main(AGE_EVENT_FUNC p_callback = NULL); ~age_main(void); } AGE_MAIN; #endif // __AGE_MAIN__ berusky2-0.12/src/age/utils/0000755000175000017500000000000013676433304012677 500000000000000berusky2-0.12/src/age/utils/change.h0000644000175000017500000000411113674426075014217 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Change interface */ #ifndef __CHANGE_H__ #define __CHANGE_H__ #include typedef class change_interface { bool change; public: bool changed(void) { return(change); } void change_set(void) { change = TRUE; } void change_clear(void) { change = FALSE; } public: change_interface(void) { change_clear(); } } CHANGE_INTERFACE; typedef class frame_change_interface { /* * Current scene frame */ public: static int current_frame; /* * Frame when it was changed */ private: int last_frame; public: bool changed(void) { return(last_frame == current_frame); } void change_set(void) { last_frame = current_frame; } } FRAME_CHANGE_INTERFACE; #endif berusky2-0.12/src/age/utils/llist.h0000644000175000017500000000773113674426075014134 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Linear lists */ #ifndef __LLIST_H__ #define __LLIST_H__ class llist_item; typedef class llist_item LLIST_ITEM; class llist_head; typedef class llist_head LLIST_HEAD; typedef bool (* LLIST_ITEM_COMPARE_FUNC)(void *p_search_data, LLIST_ITEM *p_current); typedef class llist_item { friend class llist_head; class llist_item *p_next; class llist_item *p_prev; public: class llist_item * list_append(class llist_item *p_new) { p_next = p_new; if(p_new) { p_new->p_prev = this; } return(this); } void list_remove(void) { if(p_next) { p_next->p_prev = p_prev; } if(p_prev) { p_prev->p_next = p_next; } } class llist_item * list_next(void) { return(p_next); } public: llist_item(void) : p_next(NULL), p_prev(NULL) {}; ~llist_item(void) {}; } LLIST_ITEM; typedef class llist_head { LLIST_ITEM *p_first; LLIST_ITEM *p_last; public: LLIST_ITEM * list_get_first(void) { return(p_first); } LLIST_ITEM * list_get_last(void) { return(p_last); } LLIST_ITEM * list_insert_first(LLIST_ITEM *p_pol) { if(p_first) { p_pol->list_append(p_first); p_pol->p_prev = NULL; p_first = p_pol; } else { p_last = p_first = p_pol; p_pol->p_next = p_pol->p_prev = NULL; } return(p_pol); } LLIST_ITEM * list_insert_last(LLIST_ITEM *p_pol) { if(p_last) { p_last->list_append(p_pol); p_pol->p_next = NULL; p_last = p_pol; } else { p_last = p_first = p_pol; p_pol->p_next = p_pol->p_prev = NULL; } return(p_pol); } LLIST_ITEM * list_insert(LLIST_ITEM *p_pol) { return(list_insert_last(p_pol)); } void list_remove(LLIST_ITEM *p_pol) { if(p_pol == p_first) p_first = p_pol->p_next; if(p_pol == p_last) p_last = p_pol->p_prev; p_pol->list_remove(); } LLIST_ITEM * find(LLIST_ITEM *p_searched) { LLIST_ITEM *p_tmp = list_get_first(); while(p_tmp) { if(p_tmp == p_searched) return(p_tmp); p_tmp = p_tmp->list_next(); } return(NULL); } LLIST_ITEM * find(void *p_search_data, LLIST_ITEM_COMPARE_FUNC compare_func) { LLIST_ITEM *p_tmp = list_get_first(); while(p_tmp) { if(compare_func(p_search_data,p_tmp)) return(p_tmp); p_tmp = p_tmp->list_next(); } return(NULL); } public: void list_clear(void) { p_first = NULL; p_last = NULL; } bool is_empty(void) { return(!p_first && !p_last); } public: llist_head(void) : p_first(NULL), p_last(NULL) {}; ~llist_head(void) {}; } LLIST_HEAD; #endif //__LLIST_H__ berusky2-0.12/src/age/utils/ini.cpp0000644000175000017500000003045113674766375014124 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* ini file handling */ #include #include #include #include #include "utils.h" #include "ini.h" char *ini_remove_end_of_line(char *p_line) { char *p_start = p_line; while (*p_line && *p_line != '\n') p_line++; if (*p_line == '\n') *p_line = '\0'; return (p_start); } bool ini_is_space(char c) { return(c == ' ' || c == '\t' || c == '\n' || c == '\r'); } bool ini_is_separator(char c) { return(c == SEPARATOR_INI); } char *ini_skip_spaces(char *p_line) { while (*p_line && ini_is_space(*p_line)) p_line++; return (p_line); } char *ini_skip_separator(char *p_line, char separator) { char *p_tmp = strchr(p_line, separator); if (p_tmp) { return (ini_skip_spaces(p_tmp + 1)); } else { return (NULL); } } char *ini_read_param(char *p_line, char *p_param, int max_len) { char *p_start = p_param; int i = 0; p_line = ini_skip_spaces(p_line); while (*p_line && i < max_len - 1 && *p_line != '\n') { *p_param++ = *p_line++; i++; } *p_param = '\0'; return (p_start); } char *ini_read_string_section(FFILE f, const char *p_section, const char *p_template, char *p_out, int max_len, const char *p_default) { char line[MAX_TOKEN_LEN]; char section[MAX_TOKEN_LEN]; bool section_found = FALSE; fseek(f, 0, SEEK_SET); while (fgets(line, MAX_TOKEN_LEN, f)) { if(!section_found) { section_found = (bool)read_section(line, section, MAX_TOKEN_LEN); if(section_found) { section_found = !strncasecmp(p_section, section, MAX_TOKEN_LEN); } if(section_found) continue; } if(section_found && is_section(line)) { // we hit next section - so it's not found break; } if(section_found) { int len = is_token(line, p_template); char *p_rest; if (len && (p_rest = ini_skip_separator(line + len))) { return (ini_read_param(p_rest, p_out, max_len)); } } } return p_default ? (strcpy(p_out, p_default)) : NULL; } char *ini_read_string(FFILE f, const char *p_template, char *p_out, int max_len, const char *p_default) { char line[MAX_TOKEN_LEN]; fseek(f, 0, SEEK_SET); while (fgets(line, MAX_TOKEN_LEN, f)) { int len = is_token(line, p_template); char *p_rest; if (len && (p_rest = ini_skip_separator(line + len))) { return (ini_read_param(p_rest, p_out, max_len)); } } return p_default ? (strcpy(p_out, p_default)) : NULL; } bool ini_find_string_section(FFILE f, const char *p_section, const char *p_template, long *p_file_start, long *p_file_end) { char line[MAX_TOKEN_LEN]; char section[MAX_TOKEN_LEN]; bool section_found = FALSE; long file_pos; long file_last_line = 0; file_pos = 0; fseek(f, 0, SEEK_SET); while (fgets(line, MAX_TOKEN_LEN, f)) { if(!section_found) { section_found = (bool)read_section(line, section, MAX_TOKEN_LEN); if(section_found) { section_found = !strncasecmp(p_section, section, MAX_TOKEN_LEN); } if(section_found) { file_pos = ftell(f); continue; } } // Cache last non-section line from recent section if(section_found && !is_section(line) && !is_empty(line)) file_last_line = ftell(f); if(section_found && is_section(line)) { // we hit next section - so it's not found, // create a new entry *p_file_start = *p_file_end = file_last_line; return(TRUE); } // Replace this line if(section_found && is_token(line, p_template)) { *p_file_start = file_pos; *p_file_end = ftell(f); return(TRUE); } file_pos = ftell(f); } // no section -> create a new one return(FALSE); } int ini_write_string_section(FFILE f_in, FFILE f_out, const char *p_section, const char *p_template, const char *p_value) { long file_start, file_end; int found = ini_find_string_section(f_in, p_section, p_template, &file_start, &file_end); fseek(f_in, 0, SEEK_SET); fseek(f_out, 0, SEEK_SET); if(found) { file_copy(f_in, f_out, file_start); // If 'p_value' is NULL, delete it. if (p_value) fprintf(f_out,"%s=%s\n",p_template, p_value); fseek(f_in, file_end, SEEK_SET); file_copy(f_in, f_out); } else { file_copy(f_in, f_out); if (p_value) { fprintf(f_out,"\n[%s]\n",p_section); fprintf(f_out,"%s=%s\n",p_template, p_value); } } return(TRUE); } bool ini_write_string_section(const char *p_file, const char *p_section, const char *p_template, const char *p_value) { int ret; FFILE f_orig(NULL, p_file, "r", FALSE); if (!f_orig) return(FALSE); FFILE f_new(tmpfile()); if (!f_new) return(FALSE); ret = file_copy(f_orig, f_new); if(!ret) { f_orig.close(); f_new.close(); return(FALSE); } f_orig.close(); if(f_orig.open(NULL, p_file, "w", FALSE)) { ret = ini_write_string_section(f_new, f_orig, p_section, p_template, p_value); f_orig.close(); } f_new.close(); return (ret); } int ini_read_int(FFILE f, const char *p_template, int dflt) { char line[MAX_TOKEN_LEN]; char *ret = ini_read_string(f, p_template, line, MAX_TOKEN_LEN, NULL); return ret ? atoi(ini_remove_end_of_line(ret)) : dflt; } int ini_read_int_section(FFILE f, const char *p_section, const char *p_template, int dflt) { char line[MAX_TOKEN_LEN]; char *ret = ini_read_string_section(f, p_section, p_template, line, MAX_TOKEN_LEN, NULL); return ret ? atoi(ini_remove_end_of_line(ret)) : dflt; } float ini_read_float(FFILE f, const char *p_template, float dflt) { char line[MAX_TOKEN_LEN]; char *ret = ini_read_string(f, p_template, line, MAX_TOKEN_LEN, NULL); return ret ? atof(ini_remove_end_of_line(ret)) : dflt; } float ini_read_float_section(FFILE f, const char *p_section, const char *p_template, float dflt) { char line[MAX_TOKEN_LEN]; char *ret = ini_read_string_section(f, p_section, p_template, line, MAX_TOKEN_LEN, NULL); return ret ? atof(ini_remove_end_of_line(ret)) : dflt; } char *ini_read_string(const char *p_file, const char *p_template, char *p_out, int max_len, const char *p_default) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return p_default ? (strcpy(p_out, p_default)) : NULL; char *ret = ini_read_string(f, p_template, p_out, max_len, p_default); f.close(); return (ret); } char *ini_read_string_section(const char *p_file, const char *p_section, const char *p_template, char *p_out, int max_len, const char *p_default) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return p_default ? (strcpy(p_out, p_default)) : NULL; char *ret = ini_read_string_section(f, p_section, p_template, p_out, max_len, p_default); f.close(); return (ret); } int ini_read_int(const char *p_file, const char *p_template, int dflt) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return (dflt); int ret = ini_read_int(f, p_template, dflt); f.close(); return (ret); } int ini_read_int_section(const char *p_file, const char *p_section, const char *p_template, int dflt) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return (dflt); int ret = ini_read_int_section(f, p_section, p_template, dflt); f.close(); return (ret); } float ini_read_float(const char *p_file, const char *p_template, float dflt) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return (dflt); int ret = ini_read_float(f, p_template, dflt); f.close(); return (ret); } float ini_read_float_section(const char *p_file, const char *p_section, const char *p_template, float dflt) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return (dflt); int ret = ini_read_float_section(f, p_section, p_template, dflt); f.close(); return (ret); } int ini_read_bool(FFILE f, const char *p_template, int dflt) { char line[MAX_TOKEN_LEN]; if (ini_read_string(f, p_template, line, MAX_TOKEN_LEN, NULL)) return (dflt); else { if (is_token(line, TOKEN_FALSE1) || is_token(line, TOKEN_FALSE2)) return (FALSE); else if (is_token(line, TOKEN_TRUE1) || is_token(line, TOKEN_TRUE2)) return (TRUE); else return (dflt); } } int ini_read_bool_section(FFILE f, const char *p_section, const char *p_template, int dflt) { char line[MAX_TOKEN_LEN]; if (!ini_read_string_section(f, p_section, p_template, line, MAX_TOKEN_LEN, NULL)) return (dflt); else { if (is_token(line, TOKEN_FALSE1) || is_token(line, TOKEN_FALSE2)) return (FALSE); else if (is_token(line, TOKEN_TRUE1) || is_token(line, TOKEN_TRUE2)) return (TRUE); else return (dflt); } } int ini_read_bool(const char *p_file, const char *p_template, int dflt) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return (dflt); int ret = ini_read_bool(f, p_template, dflt); f.close(); return(ret); } int ini_read_bool_section(const char *p_file, const char *p_section, const char *p_template, int dflt) { FFILE f(NULL, p_file, "r", FALSE); if (!f) return (dflt); int ret = ini_read_bool_section(f, p_section, p_template, dflt); f.close(); return(ret); } /* Check if the given string is a token */ int is_token(const char *p_line, const char *p_token) { const char *p_start = p_line; while (*p_line && *p_token && tolower(*p_line) == tolower(*p_token)) { p_line++; p_token++; } char line_end = *p_line; if(ini_is_space(line_end) || ini_is_separator(line_end)) { return (*p_token ? 0 : p_line - p_start); } else { return(0); } } /* Reading token (between %) from file */ int read_token(FFILE f_in, char *p_line, size_t max, char separator) { size_t len; int c; for (len = 0; (c = fgetc(f_in)) != EOF && c != separator && len + 2 < max; len++, p_line++) { *p_line = c; } if (c == separator) { *p_line++ = c; } *p_line = 0; return (c == separator); } /* Check if the given string is a section (a string between []) */ int is_section(const char *p_line) { char *p_start = ini_skip_spaces((char *)p_line); if(p_start[0] != '[') return(FALSE); return(strchr(p_start+1,']') != NULL); } /* Reading section (between []) from file */ char * read_section(char *p_line, char *p_section, int max_len) { char *p_start = ini_skip_spaces(p_line); char *p_end; if(p_start[0] != '[') return(NULL); p_start++; if(!(p_end = strchr(p_start,']'))) return(NULL); int len = p_end - p_start; if(len+1 >= max_len) return(NULL); strncpy(p_section, p_start, len); p_section[len] = '\0'; return(p_section); } bool is_empty(const char *p_line) { char *p_start = ini_skip_spaces((char *)p_line); return(!p_start[0]); } FFILE ini_open(const char *p_file, bool safe) { FFILE f(NULL,p_file,"r",safe); return(f); } void ini_close(FFILE f) { f.close(); } berusky2-0.12/src/age/utils/mtree.h0000644000175000017500000001202513674426075014111 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Parent || \/ Leaf => Leaf => Leaf || \/ Child */ #ifndef __MTREE_H__ #define __MTREE_H__ #include class mtree_leaf; // mtree node / leaf iterator typedef class mtree_iterator { friend class mtree_leaf; class mtree_leaf *p_stop; class mtree_leaf *p_act; public: mtree_iterator(class mtree_leaf *p_start) { p_stop = p_act = p_start; } } MTREE_ITERATOR; // Base class for tree nodes / leafs typedef class mtree_leaf { class mtree_leaf *p_parent; // Parent of this leaf class mtree_leaf *p_child; // First child of this leaf class mtree_leaf *p_sibling_prev; // List of leafs on the same level class mtree_leaf *p_sibling_next; // /* * Basic routines */ public: class mtree_leaf * leaf_parent_get(void) { return(p_parent); } // Set parent for this leaf and all its siblings // return the last sibling class mtree_leaf *leaf_parent_set(class mtree_leaf *p_parent) { class mtree_leaf *p_tmp = this; class mtree_leaf *p_tmp_last = NULL; while(p_tmp) { p_tmp->p_parent = p_parent; p_tmp_last = p_tmp; p_tmp = p_tmp->p_sibling_next; } return(p_tmp_last); } class mtree_leaf *leaf_sibling_get(void) { return(p_sibling_next); } class mtree_leaf *leaf_sibling_last_get(void) { class mtree_leaf *p_tmp = this; while(p_tmp->p_sibling_next) p_tmp = p_tmp->p_sibling_next; return(p_tmp); } class mtree_leaf *leaf_child_get(void) { return(p_child); } class mtree_leaf *leaf_child_last_get(void) { if(p_child) return(p_child->leaf_sibling_last_get()); else return(NULL); } /* * Hierarchy management */ public: // Addach a new sibling pass this node void leaf_sibling_add(class mtree_leaf *p_sib) { // all the newly inserted siblings have // to point to the current parent class mtree_leaf *p_last_new_sibling = p_sib->leaf_parent_set(p_parent); assert(p_last_new_sibling); p_last_new_sibling->p_sibling_next = p_sibling_next; if(p_sibling_next) p_sibling_next->p_sibling_prev = p_last_new_sibling; p_sib->p_sibling_prev = this; p_sibling_next = p_sib; } // add child to this node void leaf_child_add(class mtree_leaf *p_ch) { // all the newly inserted childs have // to point to this class mtree_leaf *p_last_new_child = p_ch->leaf_parent_set(this); assert(p_last_new_child); // Link current children after the new if(p_child) { p_last_new_child->p_sibling_next = p_child; p_child->p_sibling_prev = p_last_new_child; } // insert-firts the new children p_child = p_ch; p_ch->p_sibling_prev = NULL; } /* * Remove this leaf and all it's siblings from tree */ void leaf_remove(void) { // check if we're the first child of its parent if(p_parent && p_parent->p_child == this) p_parent->p_child = p_sibling_next; if(p_sibling_prev) { p_sibling_prev->p_sibling_next = p_sibling_next; } if(p_sibling_next) { p_sibling_next->p_sibling_prev = p_sibling_prev; } p_parent = NULL; p_sibling_prev = NULL; p_sibling_next = NULL; } /* * Iteration over scene hierarchy */ public: class mtree_leaf * leaf_next(class mtree_iterator *p_it); MTREE_ITERATOR leaf_next_start(void) { return(MTREE_ITERATOR(this)); } /* * Rest */ public: mtree_leaf(void) { p_parent = NULL; p_child = NULL; p_sibling_prev = NULL; p_sibling_next = NULL; } virtual ~mtree_leaf(void) { } } MTREE_LEAF; #endif // __MTREE_H__ berusky2-0.12/src/age/utils/ini.h0000644000175000017500000000763213674426075013564 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* ini file handling */ #ifndef __INI_H__ #define __INI_H__ #define MAX_TOKEN_LEN 1000 #define TOKEN_TRUE1 "yes" #define TOKEN_TRUE2 "on" #define TOKEN_FALSE1 "no" #define TOKEN_FALSE2 "off" #ifndef TRUE #define TRUE (1==1) #endif #ifndef FALSE #define FALSE (1!=1) #endif #define SEPARATOR_INI '=' #define SEPARATOR_DATA '=' char *ini_remove_end_of_line(char *p_line); char *ini_skip_spaces(char *p_line); char *ini_skip_separator(char *p_line, char separator = SEPARATOR_INI); char *ini_read_param(char *p_line, char *p_param, int max_len); FFILE ini_open(const char *p_file, bool safe = TRUE); void ini_close(FFILE f); char *ini_read_string(FFILE f, const char *p_template, char *p_out, int max_len, const char *p_default); char *ini_read_string(const char *p_file, const char *p_template, char *p_out, int max_len, const char *p_default); char *ini_read_string_section(FFILE f, const char *p_section, const char *p_template, char *p_out, int max_len, const char *p_default); char *ini_read_string_section(const char *p_file, const char *p_section, const char *p_template, char *p_out, int max_len, const char *p_default); int ini_read_int(FFILE f, const char *p_template, int dflt); int ini_read_int(const char *p_file, const char *p_template, int dflt); int ini_read_int_section(FFILE f, const char *p_section, const char *p_template, int dflt); int ini_read_int_section(const char *p_file, const char *p_section, const char *p_template, int dflt); float ini_read_float(FFILE f, const char *p_template, float dflt); float ini_read_float(const char *p_file, const char *p_template, int dflt); float ini_read_float_section(FFILE f, const char *p_section, const char *p_template, float dflt); float ini_read_float_section(const char *p_file, const char *p_section, const char *p_template, int dflt); int ini_read_bool(FFILE f, const char *p_template, int dflt); int ini_read_bool(const char *p_file, const char *p_template, int dflt); int ini_read_bool_section(FFILE f, const char *p_section, const char *p_template, int dflt); int ini_read_bool_section(const char *p_file, const char *p_section, const char *p_template, int dflt); bool ini_write_string_section(const char *p_file, const char *p_section, const char *p_template, const char *p_value); int is_token(const char *p_line, const char *p_token); int read_token(FFILE f_in, char *p_line, size_t max, char separator); int is_section(const char *p_line); char *read_section(char *p_line, char *p_section, int max_len); bool is_empty(const char *p_line); #endif // __INI_H__ berusky2-0.12/src/age/utils/flag.h0000644000175000017500000000406013674426075013706 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Flag handler (base class) */ #ifndef __FLAG_INTERFACE_H__ #define __FLAG_INTERFACE_H__ typedef class flag_interface { int iflag; public: operator int(void) { return(iflag); } bool flag_get(int flag) { return(iflag&flag); } void flag_set(int flag) { iflag |= flag; } void flag_clear(int flag) { iflag &= ~flag; } void flag_set(int flag, bool state) { if(state) { flag_set(flag); } else { flag_clear(flag); } } void flag_set_all(void) { iflag = 0; iflag = ~iflag; } void flag_clear_all(void) { iflag = 0; } public: flag_interface(void) { flag_clear_all(); } } FLAG_INTERFACE; #endif // __FLAG_INTERFACE_H__ berusky2-0.12/src/age/utils/btree.h0000644000175000017500000000523213674426075014100 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Binary tree implementation */ #ifndef __BTREE_H__ #define __BTREE_H__ #include class btree_leaf; // btree node / leaf iterator typedef class btree_iterator { friend class btree_leaf; class btree_leaf *p_act; public: btree_iterator(class btree_leaf *p_start) { p_act = p_start; } } BTREE_ITERATOR; // Base class for tree nodes / leafs typedef class btree_leaf { class btree_leaf *p_parent; // Parent of this leaf class btree_leaf *p_childl; // Left child class btree_leaf *p_childr; // Right child /* * Basic routines */ public: class btree_leaf * leaf_parent_get(void) { return(p_parent); } /* * Hierarchy management */ public: // Addach a new sibling pass this node void leaf_sibling_add(class btree_leaf *p_sib) { } // add child to this node void leaf_child_add(class btree_leaf *p_ch) { } /* * Remove this leaf and all it's siblings from tree */ void leaf_remove(void) { } /* * Iteration over scene hierarchy */ public: class btree_leaf * leaf_next(class btree_iterator *p_it); /* * Rest */ public: btree_leaf(void) { p_parent = NULL; p_childl = NULL; p_childr = NULL; } virtual ~btree_leaf(void) { } } BTREE_LEAF; #endif // __MTREE_H__ berusky2-0.12/src/age/utils/data_file.h0000644000175000017500000001415113674426075014707 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Data files */ #ifndef __DATA_FILES_H__ #define __DATA_FILES_H__ #define SECTION_NAME_START '{' #define SECTION_NAME_STOP '}' #define SECTION_NAME_NAME "name" #define SECTION_NAME_TYPE "type" #define SECTION_NAME_INCLUDE "include" #define SECTION_NAME_COMMENT "//" #define SECTION_NAME_COMMENT2 '#' #define SECTION_NAME_COMMENT_START "/*" #define SECTION_NAME_COMMENT_STOP "*/" typedef enum { LINE_NONE = 0, LINE_SECTION_START, LINE_SECTION_STOP, LINE_SECTION_INCLUDE, LINE_SECTION_ITEM, LINE_COMMENT, LINE_COMMENT_START, LINE_COMMENT_STOP, } LINE_TYPE; class data_file; typedef class data_file DATA_FILE; /* Class for one data file section. This section can be one line or */ // Mark line as loaded #define LINE_VALUE_MARK_LOADED (1<<0) typedef class data_file_section : public object_list_head, public object_list { /* * Parent data file */ DATA_FILE *p_file; /* * A line number of this file */ int line_number; /* * raw line */ char *raw_string; /* * Values for this line */ char *value_string; public: int value_int; int value_int_hexa; float value_float; public: void source_line_set(int line) { line_number = line; } int source_line_get(void) { return(line_number); } char * source_file_get(void); char * line_name_get(void) { return(name_get()); } char * line_raw_string_get(void) { return(raw_string); } char * line_value_string_get(void) { return(value_string); } int line_value_int_get(void) { return(value_int); } unsigned int line_value_uint_get(void) { return((unsigned int)value_int); } unsigned int line_value_uint_hexa_get(void) { return((unsigned int)value_int_hexa); } float line_value_float_get(void) { return(value_float); } // Normalize angle from degrees to radians float line_value_angle_get(void) { return(DEG2RAD(value_float)); } public: bool line_value_is_loaded(void) { return(mark_get(LINE_VALUE_MARK_LOADED)); } void line_mark_loaded(void) { mark_set(LINE_VALUE_MARK_LOADED); } public: bool is_line(void) { return(value_string != NULL); } bool is_line_raw(void) { return(raw_string != NULL); } public: void line_print(void); /* * Type of this section */ private: char section_type[MAX_NAME]; public: bool is_section(void) { return(section_type[0] != '\0'); } public: char * section_name_get(void) { return(name_get()); } char * section_type_get(void) { return(section_type); } public: data_file_section * section_new(int line, char *p_line, char *p_token, char *p_value); bool section_new(int line, char *p_line); public: void section_print(int indent); public: /* * Get first child of this section, * it can be line (value) or other section */ data_file_section * section_child_get(void) { return((data_file_section *)object_list_get_first()); } /* * Find specified child */ data_file_section * section_child_find(const char *p_name) { return((data_file_section *)object_list_find(p_name)); } public: /* * Get next section */ data_file_section * section_next(void) { return((data_file_section *)object_list_next()); } public: void load(void); void clear(void); void ppline(void); public: data_file_section(DATA_FILE *p_file); data_file_section(DATA_FILE *p_file, int line, char *p_raw_line, char *p_token, char *p_value); ~data_file_section(void); } DATA_FILE_SECTION; /* * List of all sections in the list */ typedef class data_file : public object_list_head { int current_line_number; char current_file_name[MAX_FILENAME]; char current_dir[MAX_FILENAME]; FFILE current_file; private: DATA_FILE_SECTION * section_new(void); public: DATA_FILE_SECTION * section_get_first(void) { return((DATA_FILE_SECTION *)object_list_get_first()); } DATA_FILE_SECTION * section_find(const char *p_name) { return((DATA_FILE_SECTION *)object_list_find(p_name)); } public: void import(DATA_FILE *p_data); private: bool load(void); void source_file_set(const char *p_file); public: int current_line_get(void) { return(current_line_number); } char * source_file_get(void) { return(current_file_name); } bool load_line(char *p_line); bool load(const char *p_file, bool safe = TRUE); public: void print(void); void clear(void); public: data_file(void); ~data_file(void); } DATA_FILE; #endif // __DATA_FILES_H__ berusky2-0.12/src/age/utils/types.h0000644000175000017500000000274513674426075014151 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* basic types */ #ifndef __TYPES_H__ #define __TYPES_H__ typedef unsigned int dword; typedef unsigned short word; typedef unsigned char byte; #endif // __TYPES_H__ berusky2-0.12/src/age/utils/mtree_named.h0000644000175000017500000002571413674426075015266 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Parent || \/ Leaf => Leaf => Leaf || \/ Child */ #ifndef __MTREE_NAMED_H__ #define __MTREE_NAMED_H__ #include #define CLASS_TREE_LEAF_ITERATOR(name, leaf_class) \ \ class name##_leaf_iterator { \ \ friend class leaf_class; \ \ class leaf_class *p_stop; \ class leaf_class *p_act; \ \ public: \ \ name##_leaf_iterator(class leaf_class *p_start) \ { \ p_stop = p_act = p_start; \ } \ }; #define MEMBER_TREE_LEAF(name, leaf_class) \ \ private: \ \ class leaf_class *p_name##_leaf_parent; \ class leaf_class *p_name##_leaf_child; \ \ class leaf_class *p_name##_leaf_sibling_prev; \ class leaf_class *p_name##_leaf_sibling_next; \ \ public: \ \ class leaf_class * name##_leaf_parent_get(void) \ { \ return(p_name##_leaf_parent); \ } \ \ class leaf_class * name##_leaf_parent_set(class leaf_class *p_parent) \ { \ class leaf_class *p_tmp = this; \ class leaf_class *p_tmp_last = NULL; \ while(p_tmp) { \ p_tmp->p_name##_leaf_parent = p_parent; \ p_tmp_last = p_tmp; \ p_tmp = p_tmp->p_name##_leaf_sibling_next; \ } \ return(p_tmp_last); \ } \ \ class leaf_class * name##_leaf_sibling_get(void) \ { \ return(p_name##_leaf_sibling_next); \ } \ \ class leaf_class * name##_leaf_sibling_last_get(void) \ { \ class leaf_class *p_tmp = this; \ \ while(p_tmp->p_name##_leaf_sibling_next) \ p_tmp = p_tmp->p_name##_leaf_sibling_next; \ \ return(p_tmp); \ } \ \ class leaf_class * name##_leaf_child_get(void) \ { \ return(p_name##_leaf_child); \ } \ \ class leaf_class * name##_leaf_child_last_get(void) \ { \ if(p_name##_leaf_child) \ return(p_name##_leaf_child->name##_leaf_sibling_last_get()); \ else \ return(NULL); \ } \ \ public: \ \ void name##_leaf_sibling_add(class leaf_class *p_sib) \ { \ class leaf_class *p_last_new_sibling = p_sib->name##_leaf_parent_set(p_name##_leaf_parent); \ assert(p_last_new_sibling); \ \ p_last_new_sibling->p_name##_leaf_sibling_next = p_name##_leaf_sibling_next; \ if(p_name##_leaf_sibling_next) \ p_name##_leaf_sibling_next->p_name##_leaf_sibling_prev = p_last_new_sibling; \ \ p_sib->p_name##_leaf_sibling_prev = this; \ p_name##_leaf_sibling_next = p_sib; \ } \ \ void name##_leaf_child_add(class leaf_class *p_ch) \ { \ class leaf_class *p_last_new_child = p_ch->name##_leaf_parent_set(this); \ assert(p_last_new_child); \ \ if(p_name##_leaf_child) { \ p_last_new_child->p_name##_leaf_sibling_next = p_name##_leaf_child; \ p_name##_leaf_child->p_name##_leaf_sibling_prev = p_last_new_child; \ } \ \ p_name##_leaf_child = p_ch; \ p_ch->p_name##_leaf_sibling_prev = NULL; \ } \ \ void name##_leaf_remove(void) \ { \ if(p_name##_leaf_parent && p_name##_leaf_parent->p_name##_leaf_child == this) \ p_name##_leaf_parent->p_name##_leaf_child = p_name##_leaf_sibling_next; \ \ if(p_name##_leaf_sibling_prev) { \ p_name##_leaf_sibling_prev->p_name##_leaf_sibling_next = p_name##_leaf_sibling_next; \ } \ if(p_name##_leaf_sibling_next) { \ p_name##_leaf_sibling_next->p_name##_leaf_sibling_prev = p_name##_leaf_sibling_prev; \ } \ \ p_name##_leaf_parent = NULL; \ p_name##_leaf_sibling_prev = NULL; \ p_name##_leaf_sibling_next = NULL; \ } \ \ public: \ \ void name##_leaf_init(void) \ { \ p_name##_leaf_parent = NULL; \ p_name##_leaf_child = NULL; \ p_name##_leaf_sibling_prev = NULL; \ p_name##_leaf_sibling_next = NULL; \ } \ \ public: \ \ class name##_leaf_iterator name##_leaf_next_start(void) \ { \ class name##_leaf_iterator tmp(this); \ return(tmp); \ } \ \ class leaf_class * name##_leaf_next(class name##_leaf_iterator *p_it) \ { \ class leaf_class * p_act = p_it->p_act; \ \ if(p_it->p_stop == p_act) { \ if(p_act) \ p_it->p_stop = p_act->name##_leaf_parent_get(); \ return(p_act); \ } \ \ class leaf_class * p_last_act = p_it->p_act; \ \ p_act = p_last_act->name##_leaf_child_get(); \ if(p_act) { \ p_it->p_act = p_act; \ return(p_act); \ } \ \ p_act = p_last_act->name##_leaf_sibling_get(); \ if(p_act) { \ p_it->p_act = p_act; \ return(p_act); \ } \ \ do { \ p_act = p_last_act->name##_leaf_parent_get(); \ if(p_act == p_it->p_stop) { \ return(NULL); \ } \ assert(p_act != NULL); \ p_last_act = p_act; \ p_act = p_act->name##_leaf_sibling_get(); \ } while(p_act == NULL); \ \ p_it->p_act = p_act; \ return(p_act); \ } #endif // __MTREE_NAMED_H__ berusky2-0.12/src/age/utils/log.cpp0000644000175000017500000001004713674426075014113 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include "types.h" #include "utils.h" #include "ini.h" #include "log.h" /* Logs & error messages */ FFILE log_file; void log_close(void) { if(log_file) { log_file.close(); log_file = (void *)NULL; } } void log_open(const char *p_file) { log_close(); if(p_file) { log_file.open(NO_DIR,p_file,"a",FALSE); if(!log_file) { PERROR(TRUE, "Unable to open log file '%s', logging is disabled.",p_file); } pprintf("------------- start ----------------"); } } void log_open_ini(const char *p_ini_file) { char logfile[1000]; #define INI_LOGFILE "logfile" #define INI_LOG "log" if(ini_read_bool(p_ini_file, INI_LOG, FALSE)) { ini_read_string(p_ini_file, INI_LOGFILE, logfile, sizeof(logfile),"./b1logfile.txt"); log_open(logfile); } } void log_flush(void) { if(log_file) fflush(log_file); } /* Logs & error messages */ static const char *p_ppfile = NULL; static int ppline = 0; void ppset(const char *p_file, int line) { p_ppfile = p_file; ppline = line; } void ppclear(void) { p_ppfile = NULL; ppline = 0; } void pperror(int quit, const char *p_text,...) { char text[2000]; va_list arguments; va_start(arguments,p_text); vsnprintf(text,2000,p_text,arguments); va_end(arguments); if(p_ppfile) fprintf(stderr,"file %s: line %d: %s\n", p_ppfile, ppline, text); else fprintf(stderr,"Error: %s\n",text); if(quit) abort(); } void ppwarning(const char *p_text,...) { char text[2000]; va_list arguments; va_start(arguments,p_text); vsnprintf(text,2000,p_text,arguments); va_end(arguments); if(ppline && p_ppfile) fprintf(stderr,"Warning at line %d file %s: %s\n", ppline, p_ppfile ? p_ppfile : "",text); else fprintf(stderr,"Warning: %s\n",text); } void pprintf(const char *p_text,...) { char text[2000]; va_list arguments; va_start(arguments,p_text); vsnprintf(text,2000,p_text,arguments); va_end(arguments); fprintf(stderr,"%s\n",text); if(log_file) { fprintf(log_file,"%s\n",text); } } void pprintfnl(const char *p_text,...) { char text[2000]; va_list arguments; va_start(arguments,p_text); vsnprintf(text,2000,p_text,arguments); va_end(arguments); fprintf(stderr,"%s",text); if(log_file) { fprintf(log_file,"%s",text); } } void pdebug(int enabled, const char *p_text,...) { if(enabled) { char text[2000]; va_list arguments; va_start(arguments,p_text); vsnprintf(text,2000,p_text,arguments); va_end(arguments); fprintf(stderr,"%s\n",text); if(log_file) { fprintf(log_file,"%s\n",text); } } } berusky2-0.12/src/age/utils/lock.h0000644000175000017500000000656313674426075013737 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Lock interface */ #ifndef __LOCK_H__ #define __LOCK_H__ #include typedef enum { LOCK_NONE = 0, LOCK_READ = 1, LOCK_READ_WRITE = 2 } LOCK_TYPE; typedef enum { LOCK_UNCHANGED = 0, LOCK_CHANGED = 1, LOCK_DEFAULT = 2 } LOCK_CHANGE_TYPE; typedef class lock_interface { int lock_flag; bool lock_data_change; LOCK_TYPE lock_type; /* * Lock data changes */ private: bool lock_data_changed(void) { return(lock_data_change); } void lock_data_change_set(void) { lock_data_change = TRUE; } void lock_data_change_clear(void) { lock_data_change = FALSE; } /* * General lock */ public: // is locked? bool locked(void) { return(lock_flag > 0); } // Lock data void lock(LOCK_TYPE type = LOCK_READ) { /* * Clear data change flag if it's a first lock */ if(lock_flag == 0) lock_data_change_clear(); /* * Lock it */ lock_flag++; if(type > lock_type) lock_type = type; } /* * Unlock the interface * Returns state of the lock * * FALSE - It's not unlocked or data were not changed * TRUE - It's unlocked and data were changed */ bool unlock(LOCK_CHANGE_TYPE data_changed = LOCK_DEFAULT) { bool ret = FALSE; if(locked()) { if(data_changed == LOCK_DEFAULT) { data_changed = (lock_type == LOCK_READ_WRITE) ? LOCK_CHANGED : LOCK_UNCHANGED; } if(data_changed == LOCK_CHANGED) { lock_data_change_set(); } lock_flag--; if(!locked()) { ret = lock_data_changed(); lock_clear(); } } return(ret); } void lock_clear(void) { lock_flag = 0; lock_data_change = FALSE; lock_type = LOCK_NONE; } void lock_set(LOCK_TYPE type) { lock_flag = 1; lock_type = type; } public: void lock_set(class lock_interface *p_src) { *this = *p_src; } public: lock_interface(void) { lock_clear(); } } LOCK_INTERFACE; #endif // __LOCK_H__ berusky2-0.12/src/age/utils/utils.h0000644000175000017500000003137613676407213014142 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Utility TODO -> nacteni velikosti souboru z zlib?? */ #ifndef __UTILS_H__ #define __UTILS_H__ #include #include #include #include #include #include #include #include #include "compat_mini.h" // ------------------------------------------------------- // file interfaces // ------------------------------------------------------- typedef class file_name { char name[MAX_FILENAME]; public: void set(const char *p_file) { strncpy(name, p_file, MAX_FILENAME - 1); name[MAX_FILENAME - 1] = '\0'; // Ensure it's null-terminated } const char * get(void) { return(name); } public: file_name(void) { name[0] = '\0'; } } FILE_NAME; #define NO_DIR (NULL) typedef unsigned int t_length; /* General file interface */ char * path_correction(char *p_file, int max_lenght); char * return_path(const char *p_dir, const char *p_file, char *p_buffer, int max_lenght); char * construct_path(char *p_buffer, size_t max_length, int n_components, ...); char * return_path_ext(const char *p_file, const char *p_cwd, char *p_buffer, int max_lenght); char * return_dir(const char *p_file, char *p_buffer, int max_lenght); char * return_file(const char *p_path, char *p_buffer, int max_lenght); void get_dir_setting(const char *section, const char *new_key, const char *old_key, const char *default_value, char *out, size_t out_len, const char *ini_file); bool dir_create(const char *p_dir); char * dir_home_get(char *p_dir, int max); bool file_copy(const char *p_src, const char *p_src_dir, const char *p_dest, const char *p_dest_dir, bool safe = TRUE); bool file_exists(const char *p_dir, const char *p_file); t_length file_size_get(char * p_dir, char * p_file); t_length file_size_get(FILE *f); void print_errno(bool new_line = FALSE); /* File abstraction safe = TRUE -> if it fails, call exit safe = FALSE -> if it fails, return NULL file */ typedef class fhandle { public: virtual operator FILE*(void) = 0; virtual operator bool(void) = 0; public: virtual bool open(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE) = 0; virtual void close(void) = 0; virtual t_length read(void * p_mem, t_length lenght, bool safe = FALSE) = 0; virtual t_length write(void * p_mem, t_length lenght, bool safe = FALSE) = 0; virtual int seek(t_length offset, int location) = 0; virtual t_length tell(void) = 0; virtual void rewind(void) = 0; virtual t_length load(char * p_mem, t_length max_lenght, t_length start_address = 0) = 0; virtual t_length load_text(char * p_mem, t_length max_lenght, t_length start_address = 0) = 0; virtual t_length read_string(char * p_string, t_length max_lenght) = 0; virtual t_length write_string(char * p_string) = 0; virtual t_length load(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) = 0; virtual t_length load_text(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) = 0; virtual void * load(const char * p_dir, const char * p_file, t_length *p_lenght, t_length start_address, bool safe) = 0; virtual bool save(const char * p_dir, const char * p_file, void *p_buffer, t_length lenght) = 0; public: virtual ~fhandle(void) {}; } FHANDLE; /* Standart file */ typedef class ffile : public fhandle { FILE *f; public: void operator=(void *f_) { f = (FILE *)f_; } void operator=(class ffile *f_) { f = f_->f; } bool operator==(void *f_) { return(f == f_); } operator FILE*(void) { return(f); } operator bool(void) { return(f != NULL); } public: bool open(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE); void close(void); t_length read(void * p_mem, t_length lenght, bool safe = FALSE); t_length write(void * p_mem, t_length lenght, bool safe = FALSE); int seek(t_length offset, int location); t_length tell(void); void rewind(void); t_length size_get(void); t_length load(char * p_mem, t_length max_lenght, t_length start_address = 0); t_length load_text(char * p_mem, t_length max_lenght, t_length start_address = 0); t_length read_string(char * p_string, t_length max_lenght); t_length write_string(char * p_string); t_length load(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe); t_length load_text(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe); void * load(const char * p_dir, const char * p_file, t_length *p_lenght, t_length start_address, bool safe); bool save(const char * p_dir, const char * p_file, void *p_buffer, t_length lenght); public: ffile(void) { f = NULL; } ffile(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE) { f = NULL; open(p_dir, p_file, p_mode, safe); } ffile(FILE *f) { this->f = f; } } FFILE; /* Gzipped file */ typedef class gzhandle : public fhandle { gzFile f; public: void operator=(class gzhandle *f_) { f = f_->f; } bool operator==(void *f_) { return(f == f_); } operator bool(void) { return(f != NULL); } operator FILE*(void) { return(NULL); } public: bool open(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE); void close(void); t_length read(void * p_mem, t_length lenght, bool safe = FALSE); t_length write(void * p_mem, t_length lenght, bool safe = FALSE); int seek(t_length offset, int location); t_length tell(void); void rewind(void); t_length load(char * p_mem, t_length max_lenght, t_length start_address = 0); t_length load_text(char * p_mem, t_length max_lenght, t_length start_address = 0); t_length read_string(char * p_string, t_length max_lenght); t_length write_string(char * p_string); t_length load(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe); t_length load_text(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe); void * load(const char * p_dir, const char * p_file, t_length *p_lenght, t_length start_address, bool safe); bool save(const char * p_dir, const char * p_file, void *p_buffer, t_length lenght); public: gzhandle(void) { f = NULL; } gzhandle(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE) { open(p_dir, p_file, p_mode, safe); } } GZHANDLE; /* Memory files */ typedef class mmhandle : public fhandle { char *p_buffer; t_length buf_len; t_length buf_pos; public: bool operator==(void *f_) { return(p_buffer == f_); } operator bool(void) { return(p_buffer != NULL); } operator FILE*(void) { return(NULL); } public: bool open(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE); void close(void); t_length read(void * p_mem, t_length lenght, bool safe = FALSE); t_length write(void * p_mem, t_length lenght, bool safe = FALSE) { return(0); }; int seek(t_length offset, int location); t_length tell(void); void rewind(void); t_length size_get(void); t_length load(char * p_mem, t_length max_lenght, t_length start_address = 0) { return(0); }; t_length load_text(char * p_mem, t_length max_lenght, t_length start_address = 0) { return(0); }; t_length read_string(char * p_string, t_length max_lenght); t_length write_string(char * p_string) { return(0); }; t_length load(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) { return(0); }; t_length load_text(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) { return(0); }; void * load(const char * p_dir, const char * p_file, t_length *p_lenght, t_length start_address, bool safe) { return(NULL); }; bool save(const char * p_dir, const char * p_file, void *p_buffer, t_length lenght) { return(FALSE); }; public: mmhandle(void) { p_buffer = NULL; buf_len = 0; buf_pos = 0; } mmhandle(const char *p_dir, const char *p_file, const char *p_mode, bool safe = TRUE) { open(p_dir, p_file, p_mode, safe); } } MMHANDLE; // ------------------------------------------------------- // configuration management // ------------------------------------------------------- typedef class dir_list { char levels[MAX_FILENAME]; char levels_user[MAX_FILENAME]; char gamedata[MAX_FILENAME]; char graphics[MAX_FILENAME]; char tmp[MAX_FILENAME]; char game_binary[MAX_FILENAME]; char cwd[MAX_FILENAME]; public: dir_list(void) { levels[0] = '\0'; levels_user[0] = '\0'; gamedata[0] = '\0'; graphics[0] = '\0'; tmp[0] = '\0'; game_binary[0] = '\0'; cwd[0] = '\0'; } ~dir_list(void) {}; private: void update_path(char *p_dir); public: void load(char *p_ini); char * levels_get(void) { return(levels); } char * levels_user_get(void) { return(levels_user); } char * gamedata_get(void) { return(gamedata); } char * graphics_get(void) { return(graphics); } char * tmp_get(void) { return(tmp); } char * game_binary_get(void) { return(game_binary); } char * cwd_get(void) { return(cwd); } } DIR_LIST; bool get_fullscreen(char *p_ini_file); int get_colors(char *p_ini_file, int default_color_depth); // ------------------------------------------------------- // tail operations // ------------------------------------------------------- inline char * tail_get(const char * p_str, char c = '.') { char *p_last = NULL; while((p_str = strchr(p_str, c))) { p_last = (char *)p_str; p_str++; } return((char *)p_last); } inline char * tail_change(char * p_str, const char * p_end) { char *p_tail = tail_get(p_str); if(p_tail) *p_tail = 0; if(p_end) strcat(p_tail, p_end); return(p_str); } inline char * tail_name_get(const char * p_str) { return(tail_change((char *)p_str,NULL)); } inline bool tail_compare(const char * p_str, const char * p_end) { char *p_tail = tail_get((char *)p_str); return(p_tail ? strcmp(p_tail, p_end) == 0 : FALSE); } inline int fgets_correction(char * p_kor) { int delka = strlen(p_kor); if (p_kor[delka - 1] == '\n') { p_kor[delka - 1] = 0; return (delka - 1); } else { return (delka); } } // ------------------------------------------------------- // user-defined data // ------------------------------------------------------- typedef struct class_user_data { void *p_data; public: void user_data_set(void *p_data) { this->p_data = p_data; } void * user_data_get(void) { return(p_data); } public: class_user_data(void) { p_data = NULL; } } CLASS_USER_DATA; // ------------------------------------------------------- // ugly hack // ------------------------------------------------------- /* inline int void2int(void *p_value) { int *p_tmp = (int *)(&p_value); return(*p_tmp); } inline void * int2void(int value) { void *p_tmp = (void *)value; return(p_tmp); } */ bool file_copy(FFILE f_in, FFILE f_out, int len = 0); #endif // __UTILS_H__ berusky2-0.12/src/age/utils/data_file.cpp0000644000175000017500000002506513674426075015250 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Data files */ #include #include #include #include #include "age.h" #include "data_file.h" void newline_delete(char *p_line) { int c = strlen(p_line); if(p_line[c-1] == '\n') p_line[c-1] = '\0'; } LINE_TYPE line_type_get(char *p_line) { p_line = ini_skip_spaces(p_line); if(!p_line || !(*p_line)) return(LINE_NONE); if(p_line[0] == SECTION_NAME_START) { return(LINE_SECTION_START); } else if(p_line[0] == SECTION_NAME_STOP) { return(LINE_SECTION_STOP); } else if(p_line[0] == SECTION_NAME_COMMENT2) { return(LINE_COMMENT); } else if(p_line[0] == SECTION_NAME_COMMENT[0]) { if(p_line[1] != '\0') { if(p_line[1] == SECTION_NAME_COMMENT[1]) return(LINE_COMMENT); if(p_line[1] == SECTION_NAME_COMMENT_START[1]) return(LINE_COMMENT_START); } } else if(p_line[0] == SECTION_NAME_COMMENT_STOP[0]) { if(p_line[1] != '\0' && p_line[1] == SECTION_NAME_COMMENT_STOP[1]) return(LINE_COMMENT_STOP); } else if(p_line[0] == SECTION_NAME_INCLUDE[0] && !strncasecmp(p_line, SECTION_NAME_INCLUDE, strlen(SECTION_NAME_INCLUDE))) { return(LINE_SECTION_INCLUDE); } return(LINE_SECTION_ITEM); } bool tokenize_line_command(char *p_line, char *p_token, char *p_value) { if(p_token) { ini_read_param(p_line, p_token, MAX_TOKEN_LEN); } p_line = ini_skip_separator(p_line,' '); if(!p_line) { return(FALSE); } if(p_value) { ini_read_param(p_line, p_value, MAX_TOKEN_LEN); } return((p_token == NULL || p_token[0]) && (p_value == NULL || p_value[0])); } bool tokenize_line_param(char *p_line, char *p_token, char *p_value) { if(p_token) { ini_read_param(p_line, p_token, MAX_TOKEN_LEN); } p_line = ini_skip_separator(p_line); if(!p_line) { return(FALSE); } if(p_value) { ini_read_param(p_line, p_value, MAX_TOKEN_LEN); } return((p_token == NULL || p_token[0]) && (p_value == NULL || p_value[0])); } void data_file_section::line_print(void) { pprintf("Line %d: Item: %s",name_get()); if(value_string) pprintf(" String: %s",value_string); pprintf(" Int: %d",value_int); pprintf(" Float: %f",value_float); } void data_file_section::section_print(int indent) { // Print this section pprintf("%*cSection: %s",indent*2,' ',name_get()); // Print child DATA_FILE_SECTION *p_tmp = section_child_get(); if(p_tmp) p_tmp->section_print(indent+1); // Print next section p_tmp = section_next(); if(p_tmp) p_tmp->section_print(indent); } DATA_FILE_SECTION * data_file_section::section_new(int line, char *p_line, char *p_token, char *p_value) { DATA_FILE_SECTION *p_new = new DATA_FILE_SECTION(p_file, line, p_line,p_token,p_value); object_list_insert_last(p_new); return(p_new); } bool data_file_section::section_new(int line, char *p_line) { char token[MAX_TOKEN_LEN] = ""; char value[MAX_TOKEN_LEN] = ""; assert(p_line); tokenize_line_param(p_line, token, value); if(token[0] && value[0]) { if(!strcasecmp(token,SECTION_NAME_NAME)) { name_set(value); source_line_set(line); } else if(!strcasecmp(token,SECTION_NAME_TYPE)) { assert(strlen(value) < MAX_NAME); strncpy(section_type,value,MAX_NAME); source_line_set(line); } else { section_new(line, p_line, token, value); } return(TRUE); } else { // A raw string section_new(line, p_line, token[0] ? token : NULL, value[0] ? value : NULL); } return(FALSE); } void data_file_section::load(void) { bool in_comment = FALSE; char line[MAX_TOKEN_LEN]; while(p_file->load_line(line)) { LINE_TYPE type = line_type_get(line); /* * Skip comments in input file */ if(type == LINE_COMMENT_START) { in_comment = TRUE; continue; } else if(type == LINE_COMMENT_STOP) { in_comment = FALSE; continue; } else if(in_comment) { continue; } /* * Process lines */ switch(type) { case LINE_NONE: case LINE_SECTION_INCLUDE: case LINE_COMMENT: case LINE_COMMENT_START: case LINE_COMMENT_STOP: break; // Create and load new sub-section case LINE_SECTION_START: { data_file_section *p_new = section_new(p_file->current_line_get(), NULL,NULL,NULL); p_new->load(); break; } // Load a line to current section case LINE_SECTION_ITEM: { section_new(p_file->current_line_get(), line); break; } // Close this section case LINE_SECTION_STOP: { return; } } } } void data_file_section::clear(void) { // Remove raw line string if(raw_string) { ffree(raw_string); raw_string = NULL; } // Remove line string if(value_string) { ffree(value_string); value_string = NULL; } object_list_clear(); } char * data_file_section::source_file_get(void) { return(p_file->source_file_get()); } void data_file_section::ppline(void) { ppset(source_file_get(), line_number); pperror(FALSE, raw_string); ppclear(); } data_file_section::data_file_section(DATA_FILE *p_file) : object_list_head(NULL), object_list(NULL), line_number(0), raw_string(NULL), value_string(NULL), value_int(0), value_float(0.0f) { this->p_file = p_file; mark_clear(LINE_VALUE_MARK_LOADED); // Initialize values for section section_type[0] = '\0'; } data_file_section::data_file_section(DATA_FILE *p_file, int line, char *p_raw_line, char *p_token, char *p_value) : object_list_head(NULL), object_list(NULL), line_number(line), raw_string(NULL), value_string(NULL), value_int(0), value_float(0.0f) { this->p_file = p_file; mark_clear(LINE_VALUE_MARK_LOADED); // Initialize values for section section_type[0] = '\0'; // Initialize values for line name_set(p_token); if(p_raw_line) { raw_string = sstrdup(p_raw_line); } if(p_value) { value_string = sstrdup(p_value); if(p_value[0] == '#' && isdigit(p_value[1])) { value_int = value_int_hexa = strtol(p_value+1,NULL,16); value_float = value_int; } else { value_int = atoi(p_value); value_int_hexa = strtol(p_value,NULL,16); value_float = atof(p_value); } } } data_file_section::~data_file_section(void) { clear(); } DATA_FILE_SECTION * data_file::section_new(void) { DATA_FILE_SECTION *p_new = new DATA_FILE_SECTION(this); object_list_insert_last(p_new); return(p_new); } bool data_file::load_line(char *p_line) { char *ret = fgets(p_line, MAX_TOKEN_LEN, current_file); newline_delete(p_line); current_line_number++; return ret; } bool data_file::load(void) { DATA_FILE_SECTION *p_current = NULL; bool in_comment = FALSE; char line[MAX_TOKEN_LEN]; while(load_line(line)) { LINE_TYPE type = line_type_get(line); /* * Skip comments in input file */ if(type == LINE_COMMENT_START) { in_comment = TRUE; continue; } else if(type == LINE_COMMENT_STOP) { in_comment = FALSE; continue; } else if(in_comment) { continue; } switch(type) { case LINE_NONE: case LINE_COMMENT: case LINE_COMMENT_START: case LINE_COMMENT_STOP: break; // Create and load whole section case LINE_SECTION_START: p_current = section_new(); p_current->load(); break; case LINE_SECTION_ITEM: // Should not be here break; case LINE_SECTION_STOP: // Should not be here break; case LINE_SECTION_INCLUDE: { // Load sub-file char value[MAX_TOKEN_LEN]; if(tokenize_line_command(line, NULL, value)) { DATA_FILE file; if(!file.load(value, FALSE)) { char local_file[MAX_FILENAME]; return_path(current_dir, value, local_file, MAX_FILENAME); if(!file.load(local_file, FALSE)) { return(FALSE); } } import(&file); } } break; } } return(TRUE); } bool data_file::load(const char *p_file, bool safe) { FFILE f(NULL,p_file,"r",safe); if(f) { clear(); source_file_set(p_file); current_file = f; return_dir(p_file, current_dir, MAX_FILENAME); load(); f.close(); return(TRUE); } return(FALSE); } void data_file::import(class data_file *p_data) { DATA_FILE_SECTION *p_tmp = p_data->section_get_first(); if(p_tmp) { object_list_insert_list(p_tmp); } // Clear original data file p_data->object_list_head_init(); } void data_file::source_file_set(const char *p_file) { assert(strlen(p_file) < MAX_FILENAME); strncpy(current_file_name, p_file, MAX_FILENAME); } void data_file::clear(void) { current_dir[0] = '\0'; current_file_name[0] = '\0'; current_line_number = 0; object_list_clear(); } void data_file::print(void) { DATA_FILE_SECTION *p_tmp = (DATA_FILE_SECTION *)object_list_get_first(); if(p_tmp) p_tmp->section_print(0); } data_file::data_file(void) : object_list_head(NULL) { clear(); } data_file::~data_file(void) { clear(); } berusky2-0.12/src/age/utils/change.cpp0000644000175000017500000000262413674426075014561 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* Change interface */ #include "age.h" int frame_change_interface::current_frame = -1; berusky2-0.12/src/age/utils/array.h0000644000175000017500000000613713674426075014122 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __ARRAY_H__ #define __ARRAY_H__ #include #define ARRAY_DEFAULT_ITEMS 1000 #ifndef NULL #define NULL (0) #endif template class array { T * p_array; // points after max/actual item int max_size; int act_size; int extend_step; int first; private: void extend(int index) { // Check if we overflow and extend the array if so int new_index = index+1; if(new_index < max_size) return; int new_size = ((new_index / extend_step)+1)*extend_step; T * p_tmp = new T[new_size]; int i; for(i = 0; i < max_size; i++) p_tmp[i] = p_array[i]; max_size = new_size; delete [] p_array; p_array = p_tmp; } public: void reset(void) { act_size = 0; first = 0; } void append(T itm) { // Save itm at p_array[act_size-1], extend extend(act_size); p_array[act_size++] = itm; } T last_get(void) { assert(!is_empty()); return(p_array[--act_size]); } public: bool is_empty(void) { return(act_size <= 0 || first == act_size); } public: T * first_get(void) { return(p_array+first); } int num_get(void) { return(act_size-first); } public: T * item_get(int index) { extend(index); return(p_array+index); } void item_set(int index, T item) { extend(index); p_array[index] = item; } public: T * fetch_ref(void) { assert(!is_empty()); return(p_array+first++); } T fetch(void) { return(*fetch_ref()); } public: array(int step = ARRAY_DEFAULT_ITEMS) { p_array = NULL; max_size = act_size = first = 0; extend_step = step; } ~array(void) { if(p_array) { delete [] p_array; max_size = act_size = first = 0; } } }; #endif berusky2-0.12/src/age/utils/log.h0000644000175000017500000000567513674426075013573 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __LOG_H__ #define __LOG_H__ #define LOG_ENABLED 1 // ------------------------------------------------------- // General macros // ------------------------------------------------------- // Don't use standart I/O /* #define FILE #define fopen(a,b) #define fwrite(a,b,c,d) #define fread(a,b,c,d) #define fseek(a,b,c) #define fclose(a) */ #define DEFAULT_DIR_MASK 0755 #define DEFAULT_FILE_MASK 0644 // ------------------------------------------------------- // log file management // ------------------------------------------------------- //extern FFILE log_file; void log_open(const char *p_file); void log_open_ini(const char *p_ini_file); void log_close(void); void log_flush(void); // ------------------------------------------------------- // logging - helper function // ------------------------------------------------------- typedef enum { DEBUG_ALL = 0, DEBUG_LOAD, DEBUG_LOAD_CHUNK, DEBUG_LOAD_3DS, DEBUG_GENERATOR } DEBUG_PART; #ifdef LOG_ENABLED void ppset(const char *p_file, int line); void ppclear(void); void pperror(int quit, const char *p_text,...); void ppwarning(const char *p_text,...); void pprintf(const char *p_text,...); void pprintfnl(const char *p_text,...); void pdebug(int enabled, const char *p_text,...); #define PERROR ppset(__FILE__,__LINE__); pperror #define PWARNING ppset(__FILE__,__LINE__); ppwarning #else #define pperror(quit, p_text,...) #define ppwarning(p_text,...) #define ppprintf(p_text,...) #define fgets_correction(p_kor) #define pdebug(enabled,p_text,...) #define PERROR #define PWARNING #endif // LOG_ENABLED #endif // __LOG_H__ berusky2-0.12/src/age/utils/utils.cpp0000644000175000017500000004651513676412113014471 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include #include "types.h" #include "utils.h" #include "ini.h" #include "mem_alloc.h" #include "3d_all.h" // We want to use the FFILE defined in utils.h, not zlib_io.h. #undef FFILE /* * Utility */ void dir_list::update_path(char *p_dir) { char buffer[MAX_FILENAME]; return_path(p_dir, "", buffer, MAX_FILENAME); /* Separate assertions so the line number in the assertion message will be more helpful. */ if (chdir(cwd)) assert(0); if (chdir(buffer)) assert(0); if (getcwd(p_dir,MAX_FILENAME) == NULL) assert(0); } void dir_list::load(char *p_ini) { #define INI_LEVEL "level_data" #define INI_GAME "game_data" #define INI_GRAPHICS "graphics_data" #define INI_LEVEL_USER "level_data_user" #define INI_TMP "tmp_data" ini_read_string(p_ini, INI_LEVEL, levels, sizeof(levels), "./Lihen/Levels"); ini_read_string(p_ini, INI_GAME, gamedata, sizeof(gamedata), "./Lihen/GameData"); ini_read_string(p_ini, INI_GRAPHICS, graphics, sizeof(graphics), "./Lihen/Graphics"); ini_read_string(p_ini, INI_LEVEL_USER, levels_user, sizeof(levels_user), "./Lihen/User"); ini_read_string(p_ini, INI_TMP, tmp, sizeof(tmp), "/var/tmp"); if (getcwd(cwd,MAX_FILENAME) == NULL) assert(0); update_path(levels); update_path(gamedata); update_path(graphics); update_path(levels_user); update_path(tmp); if (chdir(cwd)) assert(0); #define INI_BINARY "game_binary" ini_read_string(p_ini, INI_BINARY, game_binary, sizeof(game_binary), "berusky"); pprintf("level_data: %s",levels); pprintf("game_data: %s",gamedata); pprintf("graphics_data: %s",graphics); pprintf("level_data_user: %s",levels_user); pprintf("tmp_data: %s",tmp); pprintf("current working dir: %s",cwd); } bool get_fullscreen(char *p_ini_file) { #define INI_FULLSCREEN "fullscreen" return(ini_read_int(p_ini_file, INI_FULLSCREEN, FALSE)); } int get_colors(char *p_ini_file, int default_color_depth) { #define INI_COLOR "color_depth" return(ini_read_int(p_ini_file, INI_COLOR, default_color_depth)); } /* File interface */ #undef fopen #undef fwrite #undef fread #undef fseek #undef fclose /* Create a path */ char * return_path(const char *p_dir, const char *p_file, char *p_buffer, int max_lenght) { if(p_dir && p_dir[0] != '\0') { if(p_dir[0] == '~') { dir_home_get(p_buffer,max_lenght); strncat(p_buffer,p_dir+1,max_lenght-strlen(p_buffer)-1); } else { strncpy(p_buffer,p_dir,max_lenght-1); } strcat(p_buffer,"/"); strncat(p_buffer,p_file,max_lenght-strlen(p_buffer)); } else { if(p_file[0] == '~') { dir_home_get(p_buffer,max_lenght); strncat(p_buffer,p_file+1,max_lenght-strlen(p_buffer)-1); } else { strncpy(p_buffer,p_file,max_lenght-1); } } return(p_buffer); } /* Like return_path(), but don't expand '~' and handle absolute paths. Also accept any number of arguments (the number of which mussed be passed as `n_components'). */ char * construct_path(char *p_buffer, size_t max_length, int n_components, ...) { va_list ap; const char *path; int i; p_buffer[0] = '\0'; va_start(ap, n_components); for (i = 0; i < n_components; i++) { path = va_arg(ap, const char *); if (!path || !path[0]) continue; if (path[0] == '/') { // This is an absolute path, so overwrite `p_buffer'. strncpy(p_buffer, path, max_length - 1); } else { // This is a relative path. size_t buf_len = strlen(p_buffer); if (buf_len) strncat(p_buffer, DIR_SLASH_STRING, max_length - buf_len++ - 1); strncat(p_buffer, path, max_length - buf_len - 1); } } va_end(ap); // Returning an empty buffer is probably an error. assert(p_buffer[0]); return p_buffer; } char * path_correction(char *p_file, int max_lenght) { char tmp[MAX_FILENAME]; return_path(NULL, p_file, tmp, MAX_FILENAME); assert(strlen(tmp) < (unsigned)max_lenght); strcpy(p_file, tmp); return(p_file); } /* Create a path */ char * return_path_ext(const char *p_file, const char *p_cwd, char *p_buffer, int max_lenght) { if(p_file[0] == '.') { strncpy(p_buffer,p_cwd,max_lenght); strncat(p_buffer,p_file+1,max_lenght-strlen(p_buffer)-1); } else { strncpy(p_buffer,p_file,max_lenght-1); } return(p_buffer); } /* get a dir */ char * return_dir(const char *p_file, char *p_buffer, int max_lenght) { strncpy(p_buffer,p_file,max_lenght-1); char *p_tmp = tail_get(p_buffer,'/'); if(p_tmp) { *p_tmp = '\0'; } return(p_buffer); } /* get a file */ char * return_file(const char *p_path, char *p_buffer, int max_lenght) { const char *p_tmp = tail_get(p_path,'/'); if(p_tmp) { p_tmp++; } else { p_tmp = p_path; } strncpy(p_buffer, p_tmp, max_lenght-1); return(p_buffer); } // Get a new setting from 'new_key' (e.g. "texture_dir0"). If that // fails, write the default setting to the INI file. If the old // setting, specified by 'old_key', is equal to 'default_value' with // ".pak" appended, delete that setting. void get_dir_setting(const char *section, const char *new_key, const char *old_key, const char *default_value, char *out, size_t out_len, const char *ini_file) { char old[MAX_FILENAME]; size_t old_len, default_len; // Get the old and new settings. GetPrivateProfileString(section, new_key, "", out, out_len, ini_file); GetPrivateProfileString(section, old_key, "", old, MAX_FILENAME, ini_file); old_len = strlen(old); default_len = strlen(default_value); // Remove the old setting if it's the default. if (old_len == default_len + 4 && !strncmp(old, default_value, default_len) && !strcmp(old + old_len - 4, ".pak")) { kprintf(TRUE, "Removing obsolete setting with default value: %s=%s", old_key, old); WritePrivateProfileString(section, old_key, NULL, ini_file); } if (!*out) { // The new setting does not exist, so use the default, and write // the default to the INI file if it's not empty. strncpy(out, default_value, out_len); if (*default_value) WritePrivateProfileString(section, new_key, default_value, ini_file); } } /*---------------------------------------------------------------------------- ffile file interface - normal files ---------------------------------------------------------------------------- */ /* Open a file */ bool ffile::open(const char * p_dir, const char * p_file, const char *p_mode, bool safe) { char filename[MAX_FILENAME]; bool ret; assert(f == NULL); return_path(p_dir, p_file, filename, MAX_FILENAME); f = fopen(filename,p_mode); ret = (f != NULL); if(!ret && safe) { char cwd[MAX_FILENAME]; PERROR(FALSE, "Unable to open %s!\nError: %s\nCurrent dir: %s", filename,strerror(errno),getcwd(cwd,MAX_FILENAME)); } return(ret); } void ffile::close(void) { if(f) { fclose(f); f = NULL; } } t_length ffile::read(void * p_mem, t_length lenght, bool safe) { t_length ret; ret = fread(p_mem,1,lenght,f); if(safe && ret != lenght) { PERROR(TRUE, "file_read: read error!"); } return(ret); } t_length ffile::write(void * p_mem, t_length lenght, bool safe) { t_length ret; ret = fwrite(p_mem,1,lenght,f); if(safe && ret != lenght) { PERROR(TRUE, "file_write: write error!"); } return(ret); } int ffile::seek(t_length offset, int location) { return(fseek(f, offset, location)); } t_length ffile::tell(void) { return(ftell(f)); } void ffile::rewind(void) { fseek(f,0,SEEK_SET); } t_length ffile::size_get(void) { t_length size; t_length zal; zal = ftell(f); fseek(f, 0, SEEK_END); size = ftell(f) + 1; fseek(f, zal, SEEK_SET); return(size); } /* load file into memory */ t_length ffile::load(char * p_mem, t_length max_lenght, t_length start_address) { t_length loaded = 0; if(f) { if(start_address) fseek(f, start_address, SEEK_SET); loaded = fread(p_mem, 1, max_lenght, f); fclose(f); } return (loaded); } /* load file into memory */ t_length ffile::load_text(char * p_mem, t_length max_lenght, t_length start_address) { t_length loaded = 0; if(f) { if(start_address) fseek(f, start_address, SEEK_SET); loaded = fread(p_mem, 1, max_lenght, f); p_mem[loaded] = '\0'; fclose(f); } return (loaded); } t_length ffile::read_string(char * p_string, t_length max_lenght) { t_length ret; t_length l; for(l = 0; l < (max_lenght-1); l++, p_string++) { ret = read(p_string,sizeof(char)); if(ret != sizeof(sizeof(char))) break; if(*p_string == '\0') return(l); } *p_string = '\0'; return(l); } t_length ffile::write_string(char * p_string) { t_length to_write = strlen(p_string); return(write(p_string,to_write+1)); } t_length ffile::load(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) { if(open(p_dir, p_file, "rb", safe)) return(load(p_mem, max_lenght, start_address)); else return(0); } t_length ffile::load_text(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) { if(open(p_dir, p_file, "rb", safe)) return(load_text(p_mem, max_lenght, start_address)); else return(0); } void * ffile::load(const char * p_dir, const char * p_file, t_length *p_lenght, t_length start_address, bool safe) { open(p_dir, p_file, "rb", safe); if(!f) return(NULL); t_length to_load = size_get(); void *p_mem = mmalloc(to_load); *p_lenght = fread(p_mem, 1, to_load, f); fclose(f); return (p_mem); } bool ffile::save(const char * p_dir, const char * p_file, void *p_buffer, t_length lenght) { if(open(p_dir, p_file, "wb")) { t_length wrt = write(p_buffer, lenght); close(); return(wrt == lenght); } else { return(FALSE); } } /*---------------------------------------------------------------------------- gzhandle file interface - compressed files ---------------------------------------------------------------------------- */ bool gzhandle::open(const char * p_dir, const char * p_file, const char *p_mode, bool safe) { char filename[MAX_FILENAME]; bool ret; assert(f == NULL); return_path(p_dir, p_file, filename, MAX_FILENAME); f = gzopen(filename, p_mode); ret = (f != NULL); if(!ret && safe) { char cwd[MAX_FILENAME]; PERROR(FALSE, "Unable to open %s!\nError: %s\nCurrent dir: %s", filename,strerror(errno),getcwd(cwd,MAX_FILENAME)); } return(ret); } void gzhandle::close(void) { if(f) { gzclose(f); f = NULL; } } t_length gzhandle::read(void * p_mem, t_length lenght, bool safe) { t_length ret; ret = gzread(f,p_mem,lenght); if(safe && ret != lenght) { PERROR(TRUE, "file_read: read error!"); } return(ret); } t_length gzhandle::write(void * p_mem, t_length lenght, bool safe) { t_length ret; ret = gzwrite(f,p_mem,lenght); if(safe && ret != lenght) { PERROR(TRUE, "file_write: write error!"); } return(ret); } int gzhandle::seek(t_length offset, int location) { return(gzseek(f, offset, location)); } t_length gzhandle::tell(void) { return(gztell(f)); } void gzhandle::rewind(void) { gzseek(f,0,SEEK_SET); } /* load file into memory */ t_length gzhandle::load(char * p_mem, t_length max_lenght, t_length start_address) { t_length loaded = 0; if(f) { if(start_address) gzseek(f, start_address, SEEK_SET); loaded = gzread(f, p_mem, max_lenght); gzclose(f); } return (loaded); } /* load file into memory */ t_length gzhandle::load_text(char * p_mem, t_length max_lenght, t_length start_address) { dword loaded = 0; if(f) { if(start_address) gzseek(f, start_address, SEEK_SET); loaded = gzread(f, p_mem, max_lenght); p_mem[loaded] = '\0'; gzclose(f); } return (loaded); } t_length gzhandle::read_string(char * p_string, t_length max_lenght) { t_length ret; t_length l; for(l = 0; l < (max_lenght-1); l++, p_string++) { ret = read(p_string,sizeof(char)); if(ret != sizeof(sizeof(char))) break; if(*p_string == '\0') return(l); } *p_string = '\0'; return(l); } t_length gzhandle::write_string(char * p_string) { t_length to_write = strlen(p_string); return(write(p_string,to_write+1)); } t_length gzhandle::load(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) { if(open(p_dir, p_file, "rb", safe)) return(load(p_mem, max_lenght, start_address)); else return(0); } t_length gzhandle::load_text(const char * p_dir, const char * p_file, char * p_mem, t_length max_lenght, t_length start_address, bool safe) { if(open(p_dir, p_file, "rb", safe)) return(load_text(p_mem, max_lenght, start_address)); else return(0); } void * gzhandle::load(const char * p_dir, const char * p_file, t_length *p_lenght, t_length start_address, bool safe) { open(p_dir, p_file, "rb", safe); if(!f) return(NULL); if(start_address) seek(start_address, SEEK_SET); #define BUFFER_STEP 32768 char *p_buffer = NULL; t_length pos = 0; t_length ret; do { p_buffer = (char *)rrealloc(p_buffer, pos+BUFFER_STEP); ret = read(p_buffer+pos, BUFFER_STEP); pos += ret; } while(ret == BUFFER_STEP); *p_lenght = pos; return(p_buffer); } bool gzhandle::save(const char * p_dir, const char * p_file, void *p_buffer, t_length lenght) { if(open(p_dir, p_file, "wb")) { t_length wrt = write(p_buffer, lenght); close(); return(wrt == lenght); } else { return(FALSE); } } /*---------------------------------------------------------------------------- memory file interface - files saved in memory ---------------------------------------------------------------------------- */ // Only reading is supported now bool mmhandle::open(const char * p_dir, const char * p_file, const char *p_mode, bool safe) { GZHANDLE f; p_buffer = (char *)f.load(p_dir, p_file, &buf_len, 0, safe); buf_pos = 0; return(p_buffer != NULL && buf_len > 0); } void mmhandle::close(void) { if(p_buffer) { ffree(p_buffer); } p_buffer = NULL; buf_len = 0; buf_pos = 0; } t_length mmhandle::read(void * p_mem, t_length lenght, bool safe) { t_length readed = 0; if(p_buffer) { readed = (buf_pos + lenght < buf_len) ? lenght : buf_len - buf_pos; memcpy(p_mem,p_buffer+buf_pos,readed); buf_pos += readed; } return(readed); } int mmhandle::seek(t_length offset, int location) { switch(location) { case SEEK_SET: buf_pos = offset; break; case SEEK_CUR: buf_pos += offset; break; case SEEK_END: buf_pos = buf_len + offset; break; } if(buf_pos > buf_len) buf_pos = buf_len; if(buf_pos < 0) buf_pos = 0; return(0); } t_length mmhandle::tell(void) { return(buf_pos); } void mmhandle::rewind(void) { buf_pos = 0; } t_length mmhandle::size_get(void) { return(buf_len); } t_length mmhandle::read_string(char * p_string, t_length max_lenght) { t_length ret; t_length l; for(l = 0; l < (max_lenght-1); l++, p_string++) { ret = read(p_string,sizeof(char)); if(ret != sizeof(char)) break; if(*p_string == '\0') return(l); } *p_string = '\0'; return(l); } /*---------------------------------------------------------------------------- General file interface ---------------------------------------------------------------------------- */ #define FILE_BUF_SIZE 4096 bool file_copy(FFILE f_in, FFILE f_out, int len) { char buffer[FILE_BUF_SIZE]; int readed; if(len) { int to_read; do { len -= FILE_BUF_SIZE; to_read = (len < 0) ? len+FILE_BUF_SIZE : FILE_BUF_SIZE; if((readed = fread(buffer,1,to_read,f_in))) { fwrite(buffer,1,readed,f_out); } if(readed != to_read) { pperror(1,"file_copy - missing data?"); } } while(to_read == FILE_BUF_SIZE); } else { while((readed = fread(buffer,1,FILE_BUF_SIZE,f_in))) { fwrite(buffer,1,readed,f_out); } } return(TRUE); } bool file_copy(const char *p_src, const char *p_src_dir, const char *p_dest, const char *p_dest_dir, bool safe) { FFILE src(p_src_dir, p_src, "rb", safe); if(!src) return(FALSE); FFILE dst(p_dest_dir, p_dest, "wb", safe); if(!dst) { src.close(); return(FALSE); } file_copy(src, dst); src.close(); dst.close(); return(TRUE); } bool file_exists(const char * p_dir, const char * p_file) { FFILE f(p_dir, p_file, "rb", FALSE); if(!(f)) { return(FALSE); } else { f.close(); return(TRUE); } } t_length file_size_get(char * p_dir, char * p_file) { FFILE f(p_dir, p_file, "rb", FALSE); if(!(f)) { return(FALSE); } else { t_length size = f.size_get(); f.close(); return(size); } } t_length file_size_get(FILE *f) { FFILE f_handle(f); if(!(f_handle)) { return(FALSE); } else { return(f_handle.size_get()); } } void print_errno(bool new_line) { if(new_line) { pprintf("\n%s",strerror(errno)); } else { pprintf(strerror(errno)); } } char * dir_home_get(char *p_dir, int max) { assert(p_dir); char *p_tmp = getenv("HOME"); if(p_tmp) { strncpy(p_dir,p_tmp,max-1); } else { // a homeless user? assert(max >= 1); p_dir[0] = '\0'; } return(p_dir); } bool dir_create(const char *p_dir) { assert(p_dir); char tmp_dir[MAX_FILENAME]; return_path(p_dir, "", tmp_dir, MAX_FILENAME); struct stat st; // Check the dir pprintfnl("Checking %s...",tmp_dir); if(stat(tmp_dir,&st) == -1 && errno == ENOENT) { pprintfnl("missing, try to create it..."); #ifdef WINDOWS if(mkdir(tmp_dir) != -1) { #else if(mkdir(tmp_dir,DEFAULT_DIR_MASK) != -1) { #endif pprintf("ok"); return(TRUE); } else { print_errno(TRUE); pprintf("failed"); return(FALSE); } } else { pprintf("ok"); return(TRUE); } } berusky2-0.12/src/age/utils/mtree.cpp0000644000175000017500000000463713674426075014456 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "defs.h" #include "typ.h" #include "mtree.h" /* Parent || \/ Leaf => Leaf => Leaf || \/ Child */ /* it(start); while((p_act = next(it))) { p_act; } */ class mtree_leaf * mtree_leaf::leaf_next(MTREE_ITERATOR *p_it) { class mtree_leaf * p_act = p_it->p_act; if(p_it->p_stop == p_act) { if(p_act) p_it->p_stop = p_act->leaf_parent_get(); return(p_act); } class mtree_leaf * p_last_act = p_it->p_act; // We have a child -> check it p_act = p_last_act->leaf_child_get(); if(p_act) { p_it->p_act = p_act; return(p_act); } // We don't have a child -> check next sibling p_act = p_last_act->leaf_sibling_get(); if(p_act) { p_it->p_act = p_act; return(p_act); } // We don't have a sibling -> go up // find a parent with sibling do { p_act = p_last_act->leaf_parent_get(); if(p_act == p_it->p_stop) { return(NULL); } assert(p_act != NULL); p_last_act = p_act; p_act = p_act->leaf_sibling_get(); } while(p_act == NULL); p_it->p_act = p_act; return(p_act); } berusky2-0.12/src/age/utils/barray.h0000644000175000017500000000511513674426075014257 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __BIT_ARRAY_H__ #define __BIT_ARRAY_H__ typedef class bit_array { int *p_pool; int len; int offset_mask; int base_shift; public: void create(int lenght) { clear(); int i,tmp = sizeof(p_pool[0])*8; for(i = 2, base_shift = 1; i < tmp; i *= 2) base_shift++; offset_mask = (i-1); len = lenght / ((int)(sizeof(p_pool[0])*8)) + 1; p_pool = (int *)mmalloc(sizeof(p_pool[0])*len); set(0); } void clear(void) { ffree(p_pool); len = 0; } void set(int index, bool value) { if(index>>base_shift < len) { if(value) { p_pool[index>>base_shift] |= 0x1<<(index&offset_mask); } else { p_pool[index>>base_shift] &= ~(0x1<<(index&offset_mask)); } } } void set(int value) { memset(p_pool,value,sizeof(p_pool[0])*len); } bool get(int index) { if(index>>base_shift < len) { return(p_pool[index>>base_shift]&(0x1<<(index&offset_mask))); } return(FALSE); } bool loaded(void) { return(p_pool != NULL); } public: bit_array(void) { p_pool = NULL; len = 0; } } BIT_ARRAY; #endif // __BIT_ARRAY_H__ berusky2-0.12/src/age/utils/mem_alloc.cpp0000644000175000017500000000375413674426075015271 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "mem_alloc.h" #include "utils.h" #ifdef __cplusplus extern "C" { #endif char * sstrdup(char *p_src) { char *p_tmp = strdup(p_src); if(!p_tmp) { PERROR(TRUE, "Out of memory!"); exit(-1); } else { return(p_tmp); } } void * mmemcpy(void *p_src, int size) { void *p_tmp = mmalloc(size); memcpy(p_tmp, p_src, size); return(p_tmp); } void * rrealloc(void *p_mem, int size) { void *p_tmp = realloc(p_mem,size); if(!p_tmp) { PERROR(TRUE, "Out of memory!"); exit(-1); } else { return(p_tmp); } } void xfree(void **p_mem) { if(p_mem && *p_mem) { free(*p_mem); *p_mem = NULL; } } #ifdef __cplusplus } #endif berusky2-0.12/src/age/utils/llist_named.h0000644000175000017500000003321113674426075015270 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Linear list */ #ifndef __LLIST_NAMED_H__ #define __LLIST_NAMED_H__ #define MEMBER_LIST_ITEM(name, item_class, head_class) \ \ friend class head_class; \ \ private: \ \ class item_class *p_name##_list_item_next; \ class item_class *p_name##_list_item_prev; \ \ public: \ \ class item_class * name##_list_append(class item_class *p_new) \ { \ p_name##_list_item_next = p_new; \ if(p_new) { \ p_new->p_name##_list_item_prev = this; \ } \ return(this); \ } \ \ void name##_list_remove(void) \ { \ if(p_name##_list_item_next) { \ p_name##_list_item_next->p_name##_list_item_prev = p_name##_list_item_prev; \ } \ if(p_name##_list_item_prev) { \ p_name##_list_item_prev->p_name##_list_item_next = p_name##_list_item_next; \ } \ } \ \ class item_class * name##_list_next(void) \ { \ return(p_name##_list_item_next); \ } \ \ class item_class * name##_list_find_last(void) \ { \ class item_class *p_tmp = this; \ class item_class *p_last = this; \ while((p_tmp = p_tmp->name##_list_next())) { \ p_last = p_tmp; \ } \ return(p_last); \ } \ \ public: \ \ void name##_list_item_init(void) \ { \ p_name##_list_item_next = NULL; \ p_name##_list_item_prev = NULL; \ } #define MEMBER_LIST_ITEM_MARK(name, item_class, head_class) \ \ public: \ \ class item_class * name##_list_next_mark(int mark) \ { \ class item_class *p_tmp = this; \ while((p_tmp = p_tmp->name##_list_next())) { \ if(p_tmp->mark_get(mark)) \ return(p_tmp); \ } \ return(NULL); \ } #define MEMBER_LIST_ITEM_NAME(name, item_class, head_class) \ \ public: \ \ class item_class * name##_list_next_find(const char *p_name) \ { \ class item_class *p_tmp = this; \ while((p_tmp = p_tmp->name##_list_next())) { \ if(p_tmp->match_name(p_name)) \ return(p_tmp); \ } \ return(NULL); \ } #define MEMBER_LIST_HEAD(name, item_class, head_class) \ \ private: \ \ class item_class *p_name##_first_item; \ class item_class *p_name##_last_item; \ \ public: \ \ class item_class * name##_list_get_first(void) \ { \ return(p_name##_first_item); \ } \ class item_class * name##_list_get_last(void) \ { \ return(p_name##_last_item); \ } \ \ class item_class * name##_list_insert_first(class item_class *p_pol) \ { \ if(p_name##_first_item) { \ p_pol->name##_list_append(p_name##_first_item); \ p_pol->p_name##_list_item_prev = NULL; \ p_name##_first_item = p_pol; \ } \ else { \ p_name##_last_item = p_name##_first_item = p_pol; \ p_pol->p_name##_list_item_next = p_pol->p_name##_list_item_prev = NULL; \ } \ return(p_pol); \ } \ class item_class * name##_list_insert_last(class item_class *p_pol) \ { \ if(p_name##_last_item) { \ p_name##_last_item->name##_list_append(p_pol); \ p_pol->p_name##_list_item_next = NULL; \ p_name##_last_item = p_pol; \ } else { \ p_name##_last_item = p_name##_first_item = p_pol; \ p_pol->p_name##_list_item_next = p_pol->p_name##_list_item_prev = NULL; \ } \ return(p_pol); \ } \ \ class item_class * name##_list_insert(class item_class *p_pol) \ { \ return(name##_list_insert_last(p_pol)); \ } \ class item_class * name##_list_insert_list(class item_class *p_list) \ { \ if(p_name##_last_item) { \ p_name##_last_item->name##_list_append(p_list); \ } else { \ p_name##_first_item = p_list; \ } \ p_name##_last_item = p_list->name##_list_find_last(); \ return(p_list); \ } \ void name##_list_remove(class item_class *p_pol) \ { \ if(p_pol == p_name##_first_item) \ p_name##_first_item = p_pol->p_name##_list_item_next; \ \ if(p_pol == p_name##_last_item) \ p_name##_last_item = p_pol->p_name##_list_item_prev; \ \ p_pol->name##_list_remove(); \ } \ \ public: \ \ void name##_list_head_init(void) \ { \ p_name##_first_item = NULL; \ p_name##_last_item = NULL; \ } \ void name##_list_clear(void) \ { \ class item_class *p_item = name##_list_get_first(); \ while(p_item) { \ class item_class *p_next = p_item->name##_list_next(); \ delete p_item; \ p_item = p_next; \ } \ name##_list_head_init(); \ } #define MEMBER_LIST_HEAD_NAME(name, item_class, head_class) \ \ public: \ \ class item_class * name##_list_find(const char *p_name) \ { \ if(!p_name) \ return(NULL); \ class item_class *p_tmp = name##_list_get_first(); \ while(p_tmp) { \ if(p_tmp->match_name(p_name)) \ return(p_tmp); \ p_tmp = p_tmp->name##_list_next(); \ } \ return(NULL); \ } #define MEMBER_LIST_HEAD_MARK(name, item_class, head_class) \ \ public: \ \ class item_class * name##_list_first_mark(int mark) \ { \ class item_class *p_tmp = name##_list_get_first(); \ if(!p_tmp) \ return(NULL); \ if(p_tmp->mark_get(mark)) \ return(p_tmp); \ return(p_tmp->name##_list_next_mark(mark)); \ } #endif //__LLIST_NAMED_H__ berusky2-0.12/src/age/utils/mem_alloc.h0000644000175000017500000000410413674426075014724 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __MEM_ALLOC_H__ #define __MEM_ALLOC_H__ #include #include #include #include #include #include #include #include "log.h" #include "mmalloc.h" // ------------------------------------------------------- // memory allocation // ------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif void * mmalloc(size_t size); char * sstrdup(char *p_src); void * mmemcpy(void *p_src, int size); void * rrealloc(void *p_mem, int size); void xfree(void **p_mem); #ifdef __cplusplus } #endif #ifdef __cplusplus #define ffree(ptr) { if(ptr) { ::free(ptr); ptr = NULL; }} #else #define ffree(ptr) { if(ptr) { free(ptr); ptr = NULL; }} #endif #endif // __MEM_ALLOC_H__ berusky2-0.12/src/age/utils/stack.h0000644000175000017500000001053513674426075014106 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * Berusky (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __STACK_H__ #define __STACK_H__ #include #define STACK_DEFAULT_GRANULARITY_LARGE 1000 #define STACK_DEFAULT_GRANULARITY_SMALL 100 #define STACK_DEFAULT_GRANULARITY STACK_DEFAULT_GRANULARITY_SMALL #ifndef NULL #define NULL (0) #endif template class stack { T * p_stack; int max_size; // Max current size of stack int act_size; // Points to next empty item in stack int step_size; // Stack granularity public: void clear(int index = 0) { assert(index >= 0 && index < max_size); if(index < act_size) act_size = index; } private: void extend(void) { T * p_tmp = new T[max_size + step_size]; int i; for(i = 0; i < max_size; i++) p_tmp[i] = p_stack[i]; max_size += step_size; delete [] p_stack; p_stack = p_tmp; } public: int push(T itm) { if(act_size + 1 >= max_size) { extend(); } p_stack[act_size] = itm; // Return index of the inserted item return(act_size++); } T pop(void) { assert(act_size > 0); return(p_stack[--act_size]); } bool is_empty(void) { return(act_size <= 0); } public: bool is_index(int index) { return(act_size - 1 - index >= 0); } T get(int index) { assert(is_index(index)); return(p_stack[act_size - 1 - index]); } public: stack(int size_granularity = STACK_DEFAULT_GRANULARITY) { step_size = size_granularity; max_size = act_size = 0; p_stack = NULL; } ~stack(void) { if(p_stack) { delete [] p_stack; max_size = act_size = 0; } } }; #define CIRCLE_STACK_DEFAULT_GRANULARITY 100 template class circle_stack { T store[CIRCLE_STACK_DEFAULT_GRANULARITY]; int first; // the first used int next; // the next one private: int next_index(int index) { return((index+1 >= CIRCLE_STACK_DEFAULT_GRANULARITY) ? 0 : index+1); } int prev_index(int index) { return((index-1 >= 0) ? index-1 : CIRCLE_STACK_DEFAULT_GRANULARITY-1); } public: void clear(void) { first = next = 0; } // Is empty when next == first bool is_empty(void) { return(first == next); } // Is full when next+1 == first bool is_full(void) { return(next_index(next) == first); } public: void push(T &itm) { if(is_full()) { first = next_index(first); } store[next] = itm; next = next_index(next); } T * push_pointer(void) { if(is_full()) { first = next_index(first); } T *p_tmp = store+next; next = next_index(next); return(p_tmp); } T pop(void) { if(!is_empty()) { next = prev_index(next); return(store[next]); } } T * pop_pointer(void) { if(!is_empty()) { next = prev_index(next); return(store+next); } else { return(NULL); } } T * top(void) { if(!is_empty()) { return(store+prev_index(next)); } else { return(NULL); } } public: circle_stack(void) { clear(); } }; #endif berusky2-0.12/src/age/include/0000755000175000017500000000000013676433304013162 500000000000000berusky2-0.12/src/age/include/floats.h0000644000175000017500000000306613674426075014555 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __FLOATS_H__ #define __FLOATS_H__ #ifndef PI #define PI 3.14159265358979323846f #endif #define DEG2RAD(fi) (((fi)*PI)/180.0f) #define RAD2DEG(fi) (((fi)/PI)*180.0f) #define FLOAT_UNDEFINED (FLT_MAX) #endif //__FLOATS_H__ berusky2-0.12/src/age/include/defs.h0000644000175000017500000000324613674426075014206 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __DEFS_H__ #define __DEFS_H__ #ifndef ERROR #define ERROR (-1) #endif #ifndef TRUE #define TRUE (1==1) #endif #ifndef FALSE #define FALSE 0 #endif #ifndef NULL #define NULL (0) #endif #define MAX_NAME 64 #ifndef INSERT_APPEND #define INSERT_APPEND (-1) #endif #endif //__DEFS_H__ berusky2-0.12/src/age/include/typ_graph.h0000644000175000017500000000314713674426075015262 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __TYP_GRAPH_H__ #define __TYP_GRAPH_H__ #include // Color depths for graphics_start #define BPP_DEFAULT (0) #define BPP_16 (16) #define BPP_32 (32) // Basic SDL types typedef SDL_Rect SDL_RECT; typedef SDL_PixelFormat PIXELFORMAT; #endif //__TYP_GRAPH_H__ berusky2-0.12/src/age/include/defs_config.h0000644000175000017500000000303213674426075015524 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Global configuration */ #ifndef __DEFS_CONFIG_H__ #define __DEFS_CONFIG_H__ #define MAT_TEXTURES 6 #define MAX_GL_TEXT_UNITS MAT_TEXTURES #define MAX_TEXT_ANIM 50 #endif // __DEFS_CONFIG_H__ berusky2-0.12/src/age/include/typ.h0000644000175000017500000000455213674426075014102 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __TYP_H__ #define __TYP_H__ typedef unsigned int dword; typedef unsigned short int word; typedef unsigned char byte; typedef signed int sdword; typedef signed short int sword; typedef signed char sbyte; #define MAX_BYTE (0xff) #define MAX_WORD (0xffff) #define MAX_DWORD (0xffffffff) #define MAX_BYTE_F (255.0f) #define MAX_WORD_F (65353.0f) #define ERROR (-1) typedef int tpos; typedef unsigned int tcolor; typedef int tcount; typedef unsigned char trgbcomp; typedef unsigned int tflag; typedef short int trec; typedef int tface; #define MIN_TPOS (-INT_MAX) #define MAX_TPOS INT_MAX #define INT_UNDEFINED INT_MAX // Basic aritmetic operations typedef enum { OPERATION_SET = 0, OPERATION_ADD = 1, OPERATION_SUB = 2, OPERATION_MODULATE = 3, OPERATION_MODULATE2X = 4 } ARITMETIC_OPERATOR; #endif //__TYP_H__ berusky2-0.12/src/age/include/compatibility.h0000644000175000017500000000410013674426075016124 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __COMPATIBILITY_H__ #define __COMPATIBILITY_H__ #ifdef __cplusplus extern "C" { #endif /* * Windows config */ #ifdef _WIN32 #define WINDOWS 1 #undef LINUX #define WIN32_LEAN_AND_MEAN 1 #include #define PATH_MAX 128 #undef ERROR #undef min #undef max #define copysignf(a,b) (float)_copysign((float)a,(float)b) #endif // _WIN32 /* * Linux config */ #ifndef _WIN32 #undef WINDOWS #ifndef LINUX #define LINUX 1 #endif // LINUX #include // Enable SDL backend #undef ENABLE_GTK_BACKEND #define ENABLE_SDL_BACKEND 1 // Disable/Enable GUI #undef ENABLE_GUI // GL support #define ENABLE_GL 1 // basic rounds int ftoi(float t); #endif // ! _WIN32 #ifdef __cplusplus } #endif #endif // __WINDOWS_COMPATIBILITY_H__ berusky2-0.12/src/age/include/opengl.h0000644000175000017500000000272513674426075014552 00000000000000/* * .þÛÛþ þ þ þÛÛþ. þ þ þÛÛÛþ. þÛÛÛþ .þÛÛþ. þ þ * .þ Û Ûþ. Û Û þ. Û Û Û þ Û. Û. Û Ûþ. Û * Û Û Û Û Û Û Û Û þ. Û. Û Û Û Û Û Û Û * .þþÛÛÛÛþ Û Û Û þÛÛÛÛþþ. þþÛÛ. þþÛÛþ. þÛ Û Û Û Û Û * .Û Û Û .þÛ Û Û. Û Û Û Û Û. þ. Û Û .þÛ * þ. þ þ þ þ .þ þ .þ þ .þ þÛÛÛþ .þÛÛþ. þ þ * * AGE (C) AnakreoN * Martin Stransky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OPENGL_H__ #define __OPENGL_H__ #include #ifdef LINUX #include #include #endif // LINUX #endif //__OPENGL_H__ berusky2-0.12/src/kofola/0000755000175000017500000000000013676433304012256 500000000000000berusky2-0.12/src/kofola/credits.h0000644000175000017500000000021613674426075014010 00000000000000#ifndef __CREDITS_ #define __CREDITS_ int cr_Credits(HWND hWnd, AUDIO_DATA * p_ad); int cr_CreditsUNI(HWND hWnd, AUDIO_DATA * p_ad); #endif berusky2-0.12/src/kofola/menu_def.h0000644000175000017500000000115413674426075014137 00000000000000#ifndef __MENU_DEF_ #define __MENU_DEF_ #include #define CLIST_ITEMC 55 #define TAB_NUM 4 #define TAB_X 90 #define TAB_Y 88 #define TAB_XRES 850 #define TAB_YRES 650 #define MENU_ANIMATION_CORECTION 1 typedef struct _CMD_LINE { int iParam[6]; char cParam[2][256]; int iAnim[200][18]; SDL_TimerID uiTimerID; int iLastfrm; long iCounter; int iLayer; char bActive; char bEndActivate[2]; struct _CMD_LINE *pCmdLine; } CMD_LINE; typedef struct _LIST_ITEM_ { char text[256]; long timespamp; } LIST_ITEM_; int FillStringList(char *cmask, LIST_ITEM_ ** list, int *isize); #endif berusky2-0.12/src/kofola/animend_functions.cpp0000644000175000017500000010550113674426075016414 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Object.h" #include "game_logic.h" #include "animationk.h" #include "animend_functions.h" typedef struct { SIM_ANIMATION animation[32]; int last; } ANIMATION_QUEUE_SET_; extern AUDIO_DATA ad; extern int cameraflag; extern LEVELINFO Level; extern ANIMATION_QUEUE_SET_ *p_set_anim; extern int gl_Get_Column_Height(int x, int y, int z, LEVELINFO * p_Level); void anmend_Play_PadBedny(ITEMDESC * p_itm, LEVELINFO * p_Level) { float pos[3]; int rot; kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 3; ap_Play_Sound(0,0,0, pos, rot + 49, NULL, &ad); gl_Do_Prach(pos, p_Level); } void anmend_Play_Sound_PadBerusky(float *pos, int material) { switch (material) { case 9: ap_Play_Sound(0,0,0, pos, 58, NULL, &ad); break; default: ap_Play_Sound(0,0,0, pos, 57, NULL, &ad); break; } } void anmend_Play_PadBerusky(ITEMDESC * p_itm, LEVELINFO * p_Level) { float pos[3]; int rot; int ipos[3]; kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); memcpy((void *) ipos, (void *) p_itm->Pos, 3 * sizeof(int)); ipos[2]--; gl_Logical2Real(ipos[0], ipos[1], ipos[2], &rot, p_Level); if (p_Level->Level[rot]) anmend_Play_Sound_PadBerusky(pos, p_Level->Level[rot]->p_Object->Material); else { ipos[2]--; if (ipos[2] >= 0) { gl_Logical2Real(ipos[0], ipos[1], ipos[2], &rot, p_Level); if (p_Level->Level[rot]) anmend_Play_Sound_PadBerusky(pos, p_Level->Level[rot]->p_Object->Material); } else anmend_Play_Sound_PadBerusky(pos, -1); } } void anmend_PadBedny(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) param; ITEMDESC *p_itm = (ITEMDESC *) p_param; if (p_itm->p_Object->Class != 1) { anmend_Play_PadBedny(p_itm, p_Level); } else anmend_Play_PadBerusky(p_itm, p_Level); } void anmend_Add_Beetle_Animation(size_ptr param, size_ptr param2, size_ptr p_param) { am_Add_Beetle_Animation(param, reinterpret_cast(p_param), param2, 1); } void anmend_kom_mesh_set_mesh(size_ptr param, size_ptr param2, size_ptr p_param) { kom_mesh_set_mesh(param, param2, p_param); lani_set(param, 0, 0, &Level.TrashFlag, 0, 0, 0); } int anmend_Find_Item(int Mesh, LEVELINFO * p_Level) { int i; /* kprintf(1,"anmend_Find_Item Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ for (i = 0; i < p_Level->Count_Of_Items; i++) if (p_Level->Item[i].Index_Of_Game_Mesh == Mesh) return i; return -1; } void anmend_ExplozeBedny(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) p_param; ITEMDESC *p_itm = p_Level->Level[param2]; float pos[3], pos1[3]; int ipos[3], vipos[3]; int rot; int s; FLEK_K *pFlek; char cFlek[32]; int mat[2]; char bSvetlo = 1; /* kprintf(1,"anmend_ExplozeBedny Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ gl_i2FStr(rand() % 11, cFlek); if (p_Level->Actual_Item == -1) return; memcpy(ipos, p_Level->Level[p_Level->Actual_Item]->Pos, 3 * sizeof(int)); gl_Change_Destonation(p_Level, ipos); gl_Logical2Real(ipos[0], ipos[1], ipos[2], &s, p_Level); if (!p_Level->Level[s]) { ipos[2] -= 2; gl_Logical2Real(ipos[0], ipos[1], ipos[2], &s, p_Level); if (!p_Level->Level[s]) return; } kom_mesh_get_float(p_Level->Level[s]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); memcpy((void *) vipos, (void *) p_Level->Level[s]->Pos, 3 * sizeof(int)); if (p_Level->Square[s].bUnderWater) bSvetlo = 0; pFlek = &p_Level->Level[s]->Square.Flek; switch (p_Level->Level[s]->Rotation) { case 3: pFlek->nx[0] = 1; pFlek->nx[1] = 1; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; break; case 1: pFlek->nx[0] = -1; pFlek->nx[1] = 1; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = -1; break; case 2: pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 1; pFlek->nz[2] = 1; break; case 0: pFlek->nx[0] = -1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 1; pFlek->nz[2] = -1; break; } pFlek->Flag = K_CHYBA; memcpy(pFlek->pos, pos, 3 * sizeof(float)); pFlek->Material = kom_najdi_material(cFlek); if (pFlek->Material == -1) kprintf(1, "Nelze najit material %s", cFlek); p_Level->Level[s]->Square.iUroven = 0; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = 0; if (pFlek->pFlek) { kom_flek_zrus(pFlek->pFlek); pFlek->pFlek = 0; } kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, p_Level->Level[s]->Square.iUroven, pFlek->Material); memcpy(ipos, p_itm->Pos, 3 * sizeof(int)); kom_mesh_get_float(param, &pos1[0], &pos1[1], &pos1[2], &rot); kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); mat[0] = gl_Get_Mesh_Material(param); mat[1] = gl_Get_Mesh_Material(p_itm->Index_Of_Game_Mesh); rot = anmend_Find_Item(param, p_Level); /* kprintf(1,"anmend_Find_Item RETURN Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ if (rot != -1) if (p_Level->Item[rot].Square.Flek.pFlek) { kom_flek_zrus(p_Level->Item[rot].Square.Flek.pFlek); p_Level->Item[rot].Square.Flek.pFlek = 0; } kom_zrus_prvek(param); if (p_itm->Square.Flek.pFlek) kom_flek_zrus(p_itm->Square.Flek.pFlek); kom_zrus_prvek(p_itm->Index_Of_Game_Mesh); gl_Do_Strepiny(pos1, p_Level, mat[0], 0); gl_Do_Strepiny(pos, p_Level, mat[1], bSvetlo); if (!bSvetlo) am_Do_Vybuch_Bublin(vipos, pos, p_Level); gl_Destroy_Item(param2, 1, p_Level); gl_Throw_offAnim(ipos, p_Level); p_Level->Column[0] = ipos[0]; p_Level->Column[1] = ipos[1]; p_Level->Column[2] = ipos[2] + (gl_Get_Column_Height(ipos[0], ipos[1], ipos[2] - 1, p_Level) - 2) * 2; if (p_Level->Column[2] < 0) p_Level->Column[2] = 0; p_Level->bColumn++; p_Level->bCheckDependencesNeeded = 1; p_Level->Flip++; gl_Next_Queue_Set(p_Level); rot = rand() % 5; ap_Play_Sound(0,0,0, pos, rot + 14, NULL, &ad); } void anmend_ExplozeBednyZaSikminou(size_ptr param, size_ptr param2, size_ptr p_param) { int lc; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; //ANIMATION_QUEUE_SET_ *pSet = (ANIMATION_QUEUE_SET_ *) pStruct->pParam; /* kprintf(1,"anmend_ExplozeBednyZaSikminou Act_Item = %d, -> %d\n", pStruct->p_Level->Actual_Item, pStruct->p_Level->Level[pStruct->p_Level->Actual_Item]);*/ // znic vybusnimu gl_Destroy_Item(param, 4, pStruct->p_Level); gl_Throw_offAnim(pStruct->viParam1, pStruct->p_Level); pStruct->p_Level->Column[0] = pStruct->viParam1[0]; pStruct->p_Level->Column[1] = pStruct->viParam1[1]; pStruct->p_Level->Column[2] = pStruct->viParam1[2] + (gl_Get_Column_Height(pStruct->viParam1[0], pStruct->viParam1[1], pStruct->viParam1[2] - 1, pStruct->p_Level) - 2) * 2; if (pStruct->p_Level->Column[2] < 0) lc = 0; else lc = pStruct->p_Level->Column[2]; pStruct->p_Level->bColumn++; // znic bednu gl_Destroy_Item(param2, 3, pStruct->p_Level); gl_Throw_offAnim(pStruct->viParam2, pStruct->p_Level); pStruct->p_Level->Column[2] = lc; pStruct->p_Level->SecColumn[0] = pStruct->viParam2[0]; pStruct->p_Level->SecColumn[1] = pStruct->viParam2[1]; pStruct->p_Level->SecColumn[2] = pStruct->viParam2[2] + (gl_Get_Column_Height(pStruct->viParam2[0], pStruct->viParam2[1], pStruct->viParam2[2] - 1, pStruct->p_Level) - 2) * 2; pStruct->p_Level->bSecColumn++; pStruct->p_Level->bCheckDependencesNeeded = 1; free((void *) pStruct); } int anmend_Find_Lift_PSystem(int mesh, LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (p_Level->LiftParticles[i].System && (int)p_Level->LiftParticles[i].hHnizdo[1] == mesh) return i; return -1; } void anmend_Lift(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) p_param; ITEMDESC *p_itm = p_Level->Level[param2]; float pos[3]; int i, s; if (p_Level->Actual_Item == -1) return; am_Add_Beetle_Animation(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, p_Level, p_Level->Level[p_Level->Actual_Item]->Rotation, 1); kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &i); if (param > 0) gl_Do_Lift_Particles(pos, p_itm->Index_Of_Game_Mesh, p_Level); s = ap_Play_Sound(0,0,0, pos, p_itm->p_Object->Specific[0].Index, NULL, &ad); if (s >= 0) { for(i=0;i<(abs((int)param)-1);i++) adas_Queue_Sound(s, p_itm->p_Object->Specific[1].Index); adas_Queue_Sound(s, p_itm->p_Object->Specific[2].Index); } if (param > 0) { s = anmend_Find_Lift_PSystem(p_itm->Index_Of_Game_Mesh, p_Level); if (s < 0) return; p_Level->LiftParticles[s].dwStop = abs((int)param) * 250; } } void animend_Lift_End(size_ptr param, size_ptr param2, size_ptr p_param) { kom_rozvaz_mesh(param); } void anmend_Play_Sunuti(size_ptr param, size_ptr param2, size_ptr p_param) { float pos[3]; LEVELINFO *p_Level = (LEVELINFO *) p_param; if (p_Level->Actual_Item == -1) return; kom_get_fyz_souradnice(p_Level->Level[p_Level->Actual_Item]->Pos[0], p_Level->Level[p_Level->Actual_Item]->Pos[1], p_Level->Level[p_Level->Actual_Item]->Pos[2], (BOD *) pos); switch (param) { case 10: //snih ap_Play_Sound(0,0,0, pos, 123, NULL, &ad); break; case 9: //zelezo ap_Play_Sound(0,0,0, pos, 124, NULL, &ad); break; case 8: //drevo ap_Play_Sound(0,0,0, pos, 127, NULL, &ad); break; case 5: //kamen ap_Play_Sound(0,0,0, pos, 125, NULL, &ad); break; default: ap_Play_Sound(0,0,0, pos, 125, NULL, &ad); break; } } void PlayStepsA(float *pos, char bQueue, int Num, int iWave, char bStoneSound) { int s, i; s = ap_Play_Sound(0,0,0, pos, iWave, NULL, &ad); if(bStoneSound && s != -1) adas_Queue_Sound(s, 164); if(bQueue && s != -1) for(i=0;iiFloorMaterial) { case 12: //pisek am_Zero_Step(p_Level); return 161; break; case 11: //trava am_Zero_Step(p_Level); return 149; break; case 10: //snih p_Level->bSetStep = 1; return 120 + (rand() % 2); break; case 9: //zelezo am_Zero_Step(p_Level); return 36; break; case 8: //drevo am_Zero_Step(p_Level); return 35; break; case 5: //kamen am_Zero_Step(p_Level); return 119; default: return 35; break; } } void PlaySteps(LEVELINFO * p_Level, OBJECTDESC * pObj, float *pos, char bQueue, int Num, char bSunuti, char bESunuti) { // int s,i; if (pObj->Class == 12) { int rnd = rand() % 4; ap_Play_Sound(0,0,0, pos, rnd+77, NULL, &ad); return; } switch (pObj->Material) { case 10: //snih //am_Set_Step(p_Level); p_Level->bSetStep = 1; PlayStepsA(pos, bQueue, Num, 120 + (rand() % 2), p_Level->bStoneSound); if (bESunuti == 1) PlayStepsA(pos, bQueue, 0, 126, p_Level->bStoneSound); else if (bESunuti == 2) PlayStepsA(pos, bQueue, 0, 122, p_Level->bStoneSound); else if (bSunuti) PlayStepsA(pos, bQueue, Num, 123, p_Level->bStoneSound); break; case 9: //zelezo am_Zero_Step(p_Level); PlayStepsA(pos, bQueue, Num, 36, p_Level->bStoneSound); if (bESunuti == 1) PlayStepsA(pos, bQueue, 0, 126, p_Level->bStoneSound); else if (bESunuti == 2) PlayStepsA(pos, bQueue, 0, 122, p_Level->bStoneSound); else if (bSunuti) PlayStepsA(pos, bQueue, Num, 124, p_Level->bStoneSound); break; case 8: //drevo am_Zero_Step(p_Level); PlayStepsA(pos, bQueue, Num, 35, p_Level->bStoneSound); if (bESunuti == 1) PlayStepsA(pos, bQueue, 0, 126, p_Level->bStoneSound); else if (bESunuti == 2) PlayStepsA(pos, bQueue, 0, 122, p_Level->bStoneSound); else if (bSunuti) PlayStepsA(pos, bQueue, Num, 127, p_Level->bStoneSound); break; case 5: //kamen am_Zero_Step(p_Level); PlayStepsA(pos, bQueue, Num, 119, p_Level->bStoneSound); if (bESunuti == 1) PlayStepsA(pos, bQueue, 0, 126, p_Level->bStoneSound); else if (bESunuti == 2) PlayStepsA(pos, bQueue, 0, 122, p_Level->bStoneSound); else if (bSunuti) PlayStepsA(pos, bQueue, Num, 125, p_Level->bStoneSound); break; default: am_Zero_Step(p_Level); PlayStepsA(pos, bQueue, Num, 35, p_Level->bStoneSound); if (bESunuti == 1) PlayStepsA(pos, bQueue, 0, 126, p_Level->bStoneSound); else if (bESunuti == 2) PlayStepsA(pos, bQueue, 0, 122, p_Level->bStoneSound); else if (bSunuti) PlayStepsA(pos, bQueue, Num, 125, p_Level->bStoneSound); break; } p_Level->bStoneSound = 0; } int anmend_Is_On_Water(long item, LEVELINFO * p_Level) { int pos[3]; int r; if (p_Level->Level[item]) { memcpy((void *) pos, (void *) p_Level->Level[item]->Pos, 3 * sizeof(int)); pos[2]--; gl_Logical2Real(pos[0], pos[1], pos[2], &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 12) return 1; } return 0; } void anmend_Steps(size_ptr param, size_ptr param2, size_ptr p_param) { POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; int p[3], r, s, i, kanim; float pos[3], fr, fi, vzdal; char bSunuti, bESunuti; char bOnWater = 0; p[0] = param; p[1] = param2; p[2] = pStruct->iParam; bSunuti = pStruct->viParam1[2]; bESunuti = pStruct->viParam2[0]; if (anmend_Is_On_Water(pStruct->viParam1[0], p_Level)) { kom_mesh_get_float(p_Level->Level[pStruct->viParam1[0]]-> Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); if (p_Level->Level[pStruct->viParam1[0]]->p_Object->Class != 1) am_Kola_na_VodeB(pos, 0, p_Level->Level[pStruct->viParam1[0]]->Index_Of_Game_Mesh, 0, p_Level); else am_Kola_na_VodeB(pos, 1, p_Level->Level[pStruct->viParam1[0]]->Index_Of_Game_Mesh, 0, p_Level); bOnWater = 1; } kam_pol_get((BOD *) pos, &fr, &fi, &vzdal); if (p_Level->bB1ExtraCameraRot && p_Level->bPohled_Berusky) { kom_get_fyz_souradnice(p_Level->Level[pStruct->viParam1[0]]->Pos[0], p_Level->Level[pStruct->viParam1[0]]->Pos[2], p_Level->Level[pStruct->viParam1[0]]->Pos[1], (BOD *) pos); switch (p_Level->Level[pStruct->viParam1[0]]->Rotation) { case 0: kam_pol_anim((BOD *) pos, 0, fi, vzdal, &p_Level->TrashFlag, GK_REMOVE, 11, 0); break; case 1: kam_pol_anim((BOD *) pos, -90, fi, vzdal, &p_Level->TrashFlag, GK_REMOVE, 11, 0); break; case 2: kam_pol_anim((BOD *) pos, 180, fi, vzdal, &p_Level->TrashFlag, GK_REMOVE, 11, 0); break; case 3: kam_pol_anim((BOD *) pos, 90, fi, vzdal, &p_Level->TrashFlag, GK_REMOVE, 11, 0); break; } } switch (pStruct->bRCamera) { case 1: fr -= 90; kam_pol_anim((BOD *) pos, fr, fi, vzdal, &p_Level->TrashFlag, GK_REMOVE, 11, 0); break; case 2: fr += 90; kam_pol_anim((BOD *) pos, fr, fi, vzdal, &p_Level->TrashFlag, GK_REMOVE, 11, 0); break; case 3: //kam_pol_anim((BOD *)pos, fr, fi, vzdal, &p_Level->TrashFlag, 0, 22, 0); kanim = kam_pol_vyrob_animaci(22, 0, 3, 0, 1); if (kanim != K_CHYBA) { kam_pol_vloz_klic_rotace(kanim, 0, fr, fi, 0); kam_pol_vloz_klic_rotace(kanim, 1, fr + 90, fi, 10); kam_pol_vloz_klic_rotace(kanim, 2, fr + 180, fi, 21); kam_start(kanim, &p_Level->TrashFlag, GK_REMOVE, 0, 0); } fr += 180; break; } kom_get_fyz_souradnice(p[0], p[2], p[1], (BOD *) pos); p[2]--; gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, pStruct->bParam - pStruct->viParam1[1], bSunuti, bESunuti); else { p[2]--; if (p[2] >= 0) { gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, pStruct->bParam - pStruct->viParam1[1], bSunuti, bESunuti); else { p[2]--; if (p[2] >= 0) { gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, pStruct->bParam - pStruct->viParam1[1], bSunuti, bESunuti); } } } else { int idx = GetStep(p_Level); s = ap_Play_Sound(0,0,0, pos, idx, NULL, &ad); if(p_Level->bStoneSound && s != -1) adas_Queue_Sound(s, 164); if(pStruct->bParam && s != -1) for(i=0;i<(pStruct->bParam - pStruct->viParam1[1]);i++) adas_Queue_Sound(s, idx); } } p_Level->bStoneSound = 0; if (bOnWater || p_Level->Square[pStruct->viParam1[0]].bUnderWater) p_Level->bSetStep = 0; free((void *) pStruct); } void anmend_Steps2(size_ptr param, size_ptr param2, size_ptr p_param) { // ANIMATION_QUEUE_SET_ *p_aset; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; int p[3], r, s; float pos[3]; /* kprintf(1,"anmend_Steps2 Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ p[0] = param; p[1] = param2; p[2] = pStruct->iParam; /* p_aset = gl_Get_Prev_Queue_Set(p_Level); if(p_aset->last && Level.bPosouvatKameru) rani_privaz_kameru(p_aset->animation[p_aset->last-1].p_run); */ /* if(p_set_anim->last && Level.bPosouvatKameru) rani_privaz_kameru(p_set_anim->animation[p_set_anim->last-1].p_run);*/ kom_get_fyz_souradnice(p[0], p[2], p[1], (BOD *) pos); p[2]--; gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, 1, 0, 0); else { p[2]--; if (p[2] >= 0) { gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, 1, 0, 0); } else { s = ap_Play_Sound(0,0,0, pos, 35, NULL, &ad); if(pStruct->bParam && s != -1) adas_Queue_Sound(s, 35); } } free((void *) pStruct); } void anmend_StepsSikmina(size_ptr param, size_ptr param2, size_ptr p_param) { // ANIMATION_QUEUE_SET_ *p_aset; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; int p[3], r, s, i; float pos[3]; /* kprintf(1,"anmend_StepsSikmina Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ p[0] = param; p[1] = param2; p[2] = pStruct->iParam; if (anmend_Is_On_Water(pStruct->viParam1[0], p_Level)) { kom_mesh_get_float(p_Level->Level[pStruct->viParam1[0]]-> Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); if (p_Level->Level[pStruct->viParam1[0]]->p_Object->Class != 1) am_Kola_na_VodeB(pos, 0, p_Level->Level[pStruct->viParam1[0]]->Index_Of_Game_Mesh, 0, p_Level); else am_Kola_na_VodeB(pos, 1, p_Level->Level[pStruct->viParam1[0]]->Index_Of_Game_Mesh, 0, p_Level); } kom_get_fyz_souradnice(p[0], p[2], p[1], (BOD *) pos); p[2]--; gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, pStruct->bParam, 0, 0); else { p[2]--; if (p[2] >= 0) { gl_Logical2Real(p[0], p[1], p[2], &r, p_Level); if (p_Level->Level[r]) PlaySteps(p_Level, p_Level->Level[r]->p_Object, pos, pStruct->bParam, pStruct->bParam, 0, 0); } else { s = ap_Play_Sound(0,0,0, pos, 35, NULL, &ad); if(p_Level->bStoneSound && s != -1) adas_Queue_Sound(s, 164); if(pStruct->bParam && s != -1) for(i=0;i<(pStruct->bParam);i++) adas_Queue_Sound(s, 35); } } if (p_Level->Actual_Item != -1) kom_flek_setflag(p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 1); p_Level->bStoneSound = 0; free((void *) pStruct); } void anmend_Water(size_ptr param, size_ptr param2, size_ptr p_param) { float fvpos[3]; int i; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; ITEMDESC *p_itm = p_Level->Level[param2]; int rnd = rand() % 3; int rndp = rand() % 2; float pos[3] = { (float) p_itm->Pos[0] * 2, (float) p_itm->Pos[1] * 2, (float) p_itm->Pos[2] * 2 }; kom_get_fyz_souradnice(pStruct->viParam1[0], pStruct->viParam1[2], pStruct->viParam1[1], (BOD *) fvpos); am_Kola_na_Vode(fvpos, pStruct->iParam, pStruct->bParam, pStruct->viParam2[0], p_Level); am_Do_Vodni_Cakanec1(fvpos, pStruct->bParam, pStruct->viParam2[0], p_Level); switch (param) { case 0: ap_Play_Sound(0,0,0, pos, rnd+37, NULL, &ad); ap_Play_Sound(0,0,0, pos, rnd+40+rndp, NULL, &ad); break; case 1: ap_Play_Sound(0,0,0, pos, rnd+37, NULL, &ad); break; case 2: ap_Play_Sound(0,0,0, pos, rnd+40+rndp, NULL, &ad); break; } if (pStruct->viParam2[1]) for (i = 0; i < 10; i++) if ((int)p_Level->LiftVParticles[i].hHnizdo[1] == pStruct->viParam2[1]) { par_zrus(p_Level->LiftVParticles[i].System); p_Level->LiftVParticles[i].System = (size_ptr)NULL; } if (pStruct->viParam2[2]) free((void *) pStruct); } void anmend_Cakanec(size_ptr param, size_ptr param2, size_ptr p_param) { float fvpos[3]; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; //ITEMDESC *p_itm = p_Level->Level[param2]; /* float pos[3] = { (float) p_itm->Pos[0] * 2, (float) p_itm->Pos[1] * 2, (float) p_itm->Pos[2] * 2 }; */ kom_get_fyz_souradnice(pStruct->viParam1[0], pStruct->viParam1[2], pStruct->viParam1[1], (BOD *) fvpos); am_Do_Vodni_Cakanec2(fvpos, pStruct->bParam, pStruct->viParam2[0], p_Level); free((void *) pStruct); } void anmend_WaterLift(size_ptr param, size_ptr param2, size_ptr p_param) { float fvpos[3]; int rnd = rand() % 3; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; kom_get_fyz_souradnice(pStruct->viParam1[0], pStruct->viParam1[2], pStruct->viParam1[1], (BOD *) fvpos); am_Kola_na_Vode(fvpos, pStruct->iParam, pStruct->bParam, pStruct->viParam2[0], p_Level); am_Do_Vodni_Cakanec1(fvpos, pStruct->bParam, pStruct->viParam2[0], p_Level); //kom_mesh_get_float(param, &fvpos[0], &fvpos[1], &fvpos[2], &r); am_Do_Lift_VParticles(fvpos, param, p_Level); /* if(i != -1) p_Level->VodniKola[i].hHnizdo[1] = 1;*/ ap_Play_Sound(0,0,0, fvpos, rnd+74, NULL, &ad); free((void *) pStruct); } void anmend_Item_Fall(size_ptr param, size_ptr param2, size_ptr p_param) { int rot; float pos[3]; LEVELINFO *p_Level = (LEVELINFO *) p_param; ITEMDESC *p_itm = p_Level->Level[param2]; /* kprintf(1,"anmend_Item_Fall Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 2; switch (p_itm->p_Object->SubClass) { case 0: ap_Play_Sound(0,0,0, pos, 48, NULL, &ad); break; case 1: ap_Play_Sound(0,0,0, pos, 44, NULL, &ad); break; case 4: ap_Play_Sound(0,0,0, pos, 45, NULL, &ad); break; case 7: ap_Play_Sound(0,0,0, pos, 47, NULL, &ad); break; case 8: ap_Play_Sound(0,0,0, pos, 46, NULL, &ad); break; case 9: case 10: case 11: case 12: case 13: case 14: case 15: ap_Play_Sound(0,0,0, pos, 100+rot, NULL, &ad); break; } gl_Pripoj_Flek_k_Predmenu(p_itm, p_Level); } void anmend_Item_FallStartAnim(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) p_param; /* kprintf(1,"anmend_Item_FallStartAnim Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ p_Level->Level[param2]->a_flag = -1; am_Add_Animate_Item(param2, p_Level); p_Level->bCheck_Result = gl_Check_Logic_Dependences(p_Level); p_Level->bCheck = 1; if (p_Level->bCheck_Result) { p_Level->Flip++; gl_Next_Queue_Set(p_Level); if (p_Level->Flip == 1) gl_Go_Animations(); } } void anmend_Send_Event(size_ptr param, size_ptr param2, size_ptr p_param) { // kprintf(1,"anmend_Send_Event \n"); kom_amat_event(param); } void anmend_Set_Flek_Flag(size_ptr param, size_ptr param2, size_ptr p_param) { // kprintf(1,"anmend_Set_Flek_Flag \n"); kom_flek_setflag(param, param2); } void anmend_Set_Flek_Flag_Anim(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) & Level; // kprintf(1,"anmend_Set_Flek_Flag \n"); kom_flek_setflag(param, param2); if (p_Level->Actual_Item == -1) return; am_Add_Beetle_Animation(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, &Level, p_Level->Level[p_Level->Actual_Item]->Rotation, 0); } void anmend_Take_Item(size_ptr param, size_ptr param2, size_ptr p_param) { POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; float pos[3]; int rot; /* kprintf(1,"anmend_Take_Item Act_Item = %d, -> %d\n", pStruct->p_Level->Actual_Item, pStruct->p_Level->Level[pStruct->p_Level->Actual_Item]);*/ kom_mesh_get_float(param, &pos[0], &pos[1], &pos[2], &rot); if(param2 == 3 || param2 == 5) ap_Play_Sound(0,0,0, pos, 53, NULL, &ad); else ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); if (pStruct->p_Level->Item[pStruct->iParam].Square.Flek.pFlek) { kom_flek_zrus(pStruct->p_Level->Item[pStruct->iParam].Square.Flek.pFlek); pStruct->p_Level->Item[pStruct->iParam].Square.Flek.pFlek = 0; } if (pStruct->p_Level->Item[pStruct->iParam].hSvetlo != -1) { sdl_anim_zrus(pStruct->p_Level->Item[pStruct->iParam].hSvetlo); sdl_svetlo_zrus(pStruct->p_Level->Item[pStruct->iParam].hSvetlo); pStruct->p_Level->Item[pStruct->iParam].hSvetlo = -1; } am_Remove_Animate_itemB(pStruct->iParam, pStruct->p_Level); kom_zrus_prvek(param); free((void *) pStruct); } void anmend_Kamen(size_ptr param, size_ptr param2, size_ptr p_param) { float fpos[3]; int pos[3]; int rot; LEVELINFO *p_Level = (LEVELINFO *) p_param; ITEMDESC *p_itm = p_Level->Level[param]; int mat = gl_Get_Mesh_Material(p_itm->Index_Of_Game_Mesh); /* kprintf(1,"anmend_Kamen Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &fpos[0], &fpos[1], &fpos[2], &rot); memcpy((void *) pos, (void *) p_itm->Pos, 3 * sizeof(int)); rot = rand() % 3; if (p_itm->p_Object->Specific[rot].Index == -1) rot = 0; if(p_itm->p_Object->Specific[rot].Index != -1) ap_Play_Sound(0,0,0, fpos, p_itm->p_Object->Specific[rot].Index, NULL, &ad); gl_Destroy_Item(param, 0, p_Level); gl_Do_Kameni(fpos, p_Level, mat); mat = kom_najdi_material("cvytah1"); gl_Do_Krompac(fpos, p_Level, mat); gl_Throw_off(pos, p_Level); } void anmend_ZrusCastice(size_ptr param, size_ptr param2, size_ptr p_param) { SYSTEMZHAVYCHCASTIC *pSystem = (SYSTEMZHAVYCHCASTIC *) param2; // kprintf(1,"anmend_ZrusCastice Act_Item = %d, -> %d\n"); free(reinterpret_cast(p_param)); if (param != (size_ptr)-1) sdl_svetlo_zrus(param); if (pSystem) am_Release_Zhave_castice(pSystem); } void anmend_ZrusCastice2(size_ptr param, size_ptr param2, size_ptr p_param) { SYSTEMZHAVYCHCASTIC *pSystem = (SYSTEMZHAVYCHCASTIC *) param2; SYSTEMKOUROVYCHCASTIC *pSystemK = (SYSTEMKOUROVYCHCASTIC *) param; free(reinterpret_cast(p_param)); if (pSystem) am_Release_Zhave_castice(pSystem); if (pSystemK) am_Release_Kourove_Castice(pSystemK); } void anmend_ZrusCastice3(size_ptr param, size_ptr param2, size_ptr p_param) { free(reinterpret_cast(p_param)); } void anmend_Are_Animations_Done(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) p_param; /* kprintf(1,"anmend_Are_Animations_Done Act_Item = %d, -> %d\n", p_Level->Actual_Item, p_Level->Level[p_Level->Actual_Item]);*/ gl_Are_Animations_Done(p_Level); } void anmend_Tlacitko(size_ptr param, size_ptr param2, size_ptr p_param) { float pos[3]; int rot; //LEVELINFO *p_Level = (LEVELINFO *) p_param; ITEMDESC *p_itm = (ITEMDESC *) param; kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 3; if (p_itm->p_Object->Specific[rot].Index == -1) rot = 0; if (p_itm->p_Object->Specific[rot].Index == -1) return; ap_Play_Sound(0,0,0, pos, p_itm->p_Object->Specific[rot].Index, NULL, &ad); } void anmend_Teleport(size_ptr param, size_ptr param2, size_ptr p_param) { float pos[3], target[3], r, fi, dist; int rot; int newr; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; ITEMDESC *p_itm = (ITEMDESC *) param; ITEMDESC *p_itmNEW; ITEMDESC *p_tel = (ITEMDESC *) p_Level->Level[param2]; if (p_Level->Actual_Item == -1) return; if (p_itm->p_Object->Class == 1) am_Remove_Beetle_Animation(p_itm->Index_Of_Game_Mesh, p_Level); pStruct->viParam1[0] = p_itm->Pos[0]; pStruct->viParam1[1] = p_itm->Pos[1]; pStruct->viParam1[2] = p_itm->Pos[2]; gl_Logical2Real(pStruct->viParam2[0], pStruct->viParam2[1], pStruct->viParam2[2], &rot, p_Level); p_Level->Level[rot] = p_itm; p_itmNEW = p_Level->Level[rot]; newr = rot; gl_Logical2Real(pStruct->viParam1[0], pStruct->viParam1[1], pStruct->viParam1[2], &rot, p_Level); if (rot == p_Level->Actual_Item) p_Level->Actual_Item = newr; p_Level->Level[rot] = 0; p_itmNEW->Pos[0] = pStruct->viParam2[0]; p_itmNEW->Pos[1] = pStruct->viParam2[1]; p_itmNEW->Pos[2] = pStruct->viParam2[2]; p_itm = p_itmNEW; if (p_itm->Square.pExtFlek && p_itm->Square.pExtFlek->pFlek) { kom_flek_zrus(p_itm->Square.pExtFlek->pFlek); p_itm->Square.pExtFlek->pFlek = 0; p_itm->Square.pExtFlek = NULL; } if (p_itm->p_Object->Class == 13) { kom_flek_zrus(p_itm->Square.Flek.pFlek); p_itm->Square.Flek.pFlek = 0; } kprintf(1, "kom_umisti_prvek"); kom_umisti_prvek(p_itm->Index_Of_Game_Mesh, p_itm->Pos[0], p_itm->Pos[2], p_itm->Pos[1], p_itm->Rotation); kprintf(1, "kom_umisti_prvek DONE"); if (p_itm->p_Object->Class == 13) gl_Pripoj_Flek_k_Predmenu(p_itm, p_Level); kom_mesh_get_float(p_itm->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); if (p_itm->p_Object->Class == 1 && p_Level->Level[p_Level->Actual_Item]->iItem == p_itm->iItem && p_Level->bPosouvatKameru) { kam_pol_get((BOD *) & target, &r, &fi, &dist); kam_pol_anim((BOD *) pos, r, fi, dist, &cameraflag, GK_REMOVE, 10, 1); kom_flek_setflag(p_itm->Square.Flek.pFlek, 0); } kom_mesh_get_float(p_tel->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); gl_Do_Teleport_Sparks(pos, p_Level); gl_Throw_off(p_tel->Pos, p_Level); p_Level->Flip++; gl_Next_Queue_Set(p_Level); if (p_Level->Flip == 1) gl_Go_Animations(); p_Level->status = 5; free((void *) pStruct); if (p_itm->p_Object->Class == 1) am_Add_Beetle_Animation(p_itm->Index_Of_Game_Mesh, p_Level, p_itm->Rotation, 1); } void anmend_TeleportStart(size_ptr param, size_ptr param2, size_ptr p_param) { float pos[3]; int rot; POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; LEVELINFO *p_Level = pStruct->p_Level; ITEMDESC *p_itm = (ITEMDESC *) param; ITEMDESC *p_tel = (ITEMDESC *) p_Level->Level[param2]; kom_mesh_get_float(p_tel->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = gl_Do_Teleport_Flare(pos, p_Level); if (rot != -1) { p_Level->Flare[rot].mesh = p_itm->Index_Of_Game_Mesh; p_Level->Flare[rot].hSvetlo = gl_Do_Teleport_Light(pos, p_Level, rot); p_Level->Flare[rot].Teleport = -1; p_Level->Flare[rot].Item = NULL; } kom_get_fyz_souradnice(pStruct->viParam2[0], pStruct->viParam2[2], pStruct->viParam2[1], (BOD *) pos); rot = gl_Do_Teleport_Flare(pos, p_Level); if (rot != -1) { p_Level->Flare[rot].hEXSvetlo = -1; p_Level->Flare[rot].hSvetlo = gl_Do_Teleport_Light(pos, p_Level, -1); p_Level->Flare[rot].Teleport = param2; if (p_itm->p_Object->Class == 13 || !p_Level->Flip) p_Level->Flare[rot].Item = p_itm; else p_Level->Flare[rot].Item = NULL; p_Level->Flare[rot].pPointer = (void *) pStruct; } rot = rand() % 3; if (p_tel->p_Object->Specific[rot].Index == -1) rot = 0; if (p_tel->p_Object->Specific[rot].Index == -1) return; ap_Play_Sound(0,0,0, pos, p_tel->p_Object->Specific[rot].Index, NULL, &ad); } void anmend_Exit(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) p_param; am_Do_Exit(param, param2, p_Level); lani_set(param, 0, K_CHYBA, &p_Level->TrashFlag,0,0,0); // We don't need it - the bug is removed in am_Do_Exit_Efects() //kom_zrus_prvek(param); } void anmend_Lift_Item(size_ptr param, size_ptr param2, size_ptr p_param) { kom_svaz_meshe(param, param2); } void anmend_KamenZaSikmonou(size_ptr param, size_ptr param2, size_ptr p_param) { //int mat = kom_najdi_material("cvytah1"); POINTERSTRUCTURE *pStruct = (POINTERSTRUCTURE *) p_param; anmend_Kamen(pStruct->viParam1[0], pStruct->viParam1[1], reinterpret_cast(pStruct->p_Level)); anmend_kom_mesh_set_mesh(pStruct->viParam2[0], pStruct->viParam2[1], pStruct->viParam2[2]); free((void *) pStruct); } void anmend_PlayKrumpac(size_ptr param, size_ptr param2, size_ptr p_param) { } void anmend_kom_mesh_set_meshK(size_ptr param, size_ptr param2, size_ptr p_param) { float pos[3]; int rot; kom_mesh_get_float(param, &pos[0], &pos[1], &pos[2], &rot); ap_Play_Sound(0,0,0, pos, 162 + (rand()%2), NULL, &ad); kom_mesh_set_mesh(param, param2, p_param); lani_set(param, 0, 0, &Level.TrashFlag, 0, 0, 0); } berusky2-0.12/src/kofola/Command.cpp0000644000175000017500000000224413674426075014267 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "2D_graphic.h" extern RECT_LINE rline; //------------------------------------------------------------------------------------------------ // nakresli obrazek //------------------------------------------------------------------------------------------------ void menucommand_Draw(HDC hdc, int *com, int layer) { /* RECT r; r.left = com[2]; r.top = com[3]; r.right = _2dd.bitmap[com[1]].bitmap.bmWidth; r.bottom = _2dd.bitmap[com[1]].bitmap.bmHeight; BitBlt(hdc,r.left,r.top, r.right, r.bottom, _2dd.bitmap[com[1]].bitmapDC,0,0,SRCCOPY); _2d_Add_RectItem(&rline, r, layer);*/ } void menucommand_DrawT(HDC hdc, int *com) { /* TransparentBltU(hdc,com[2],com[3], _2dd.bitmap[com[1]].bitmap.bmWidth, _2dd.bitmap[com[1]].bitmap.bmHeight, _2dd.bitmap[com[1]].bitmapDC,0,0, _2dd.bitmap[com[1]].bitmap.bmWidth, _2dd.bitmap[com[1]].bitmap.bmHeight, RGB(255, 0, 255));*/ } berusky2-0.12/src/kofola/font3d.cpp0000644000175000017500000007572613674426075014125 00000000000000#include #include #include "font3d.h" //#include "2d_graphic.h" //#include "2ddx.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky_universal.h" #include "Berusky3d_kofola2d.h" //#pragma comment(lib,"Msimg32.lib") B2_FONT b2_3d_font; extern _3D_DATA _3dd; void fn2_Release_Font(void); void Uni2Char(WCHAR * cUni, char *cText, int ctsize); int fn2_Find_Char(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, int *top, int *left, int *bottom, int *right, int *ycor, WCHAR cWChar, float xbmp, float ybmp) { float *l, *t, *r, *b, *y; int i; /* for(i=0;ilastcommand;i++) switch(gt->command[i].iCommand) { case 1: { if(gt->command[i].LastParam > 5 && gt->command[i].Parametr[0].Type == 3) { if((WCHAR)gt->command[i].Parametr[0].Value == cWChar) { l = (float *)>->command[i].Parametr[1].Value; t = (float *)>->command[i].Parametr[2].Value; r = (float *)>->command[i].Parametr[3].Value; b = (float *)>->command[i].Parametr[4].Value; y = (float *)>->command[i].Parametr[5].Value; *left = ftoi((*l) * xbmp); *top = ftoi((*t) * ybmp); *right = ftoi((*r) * xbmp); *bottom = ftoi((*b) * ybmp); *ycor = ftoi((*y) * ybmp); return 1; } } } break; }*/ if (cWChar > b2_3d_font.iMaxCharValue) return 0; i = b2_3d_font.pTTable[cWChar]; if (i < 0) return 0; else { l = (float *) >->command[i].Parametr[1].Value; t = (float *) >->command[i].Parametr[2].Value; r = (float *) >->command[i].Parametr[3].Value; b = (float *) >->command[i].Parametr[4].Value; y = (float *) >->command[i].Parametr[5].Value; *left = ftoi((*l) * xbmp); *top = ftoi((*t) * ybmp); *right = ftoi((*r) * xbmp); *bottom = ftoi((*b) * ybmp); *ycor = ftoi((*y) * ybmp); } return 1; } int fn2_Create_TTable(int iMaxCharValue, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts) { int i; b2_3d_font.pTTable = (int *) malloc((iMaxCharValue + 1) * sizeof(int)); if (!b2_3d_font.pTTable) return 0; for (i = 0; i < iMaxCharValue + 1; i++) b2_3d_font.pTTable[i] = -1; for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 1: if (gt->command[i].Parametr[0].Value < (unsigned) iMaxCharValue + 1) b2_3d_font.pTTable[(int) gt->command[i].Parametr[0].Value] = i; break; } b2_3d_font.iMaxCharValue = iMaxCharValue; return 1; } int fn2_Set_Font_Params(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts) { int iMaxCharValue = 0; int i; for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 1: if ((int) gt->command[i].Parametr[0].Value > iMaxCharValue) iMaxCharValue = (int) gt->command[i].Parametr[0].Value; break; case 2: { if (gt->command[i].LastParam > 2 && gt->command[i].Parametr[0].Type == 0) b2_3d_font.tcolor = RGB(gt->command[i].Parametr[0].Value, gt->command[i].Parametr[1].Value, gt->command[i].Parametr[2].Value); } break; case 3: { if (gt->command[i].LastParam > 0 && gt->command[i].Parametr[0].Type == 0) b2_3d_font.iYPlus = gt->command[i].Parametr[0].Value; } break; case 6: { if (gt->command[i].LastParam > 0 && gt->command[i].Parametr[0].Type == 0) b2_3d_font.iXPlus = gt->command[i].Parametr[0].Value; } break; } if (!fn2_Create_TTable(iMaxCharValue, gt, ts)) return 0; return 1; } int fn2_Set_Font_Bmps(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts) { char text[256]; int i; txt_trida(TEXT_MENU); for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 4: { if (gt->command[i].LastParam > 1 && gt->command[i].Parametr[1].Type == 2) { memset(text, 0, 256); WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, (wchar_t *) ts->StrTable[gt->command[i].Parametr[1].Value], wcslen((wchar_t *) ts->StrTable[gt->command[i].Parametr[1]. Value]), text, 256, NULL, NULL); b2_3d_font.iBitmap[gt->command[i].Parametr[0].Value] = ddx2LoadBitmap(text, b2_3d_font.dir); } } break; case 5: { if (gt->command[i].LastParam > 1 && gt->command[i].Parametr[1].Type == 2) { memset(text, 0, 256); WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, (wchar_t *) ts->StrTable[gt->command[i].Parametr[1].Value], wcslen((wchar_t *) ts->StrTable[gt->command[i].Parametr[1]. Value]), text, 256, NULL, NULL); txt_nahraj_texturu_z_func(b2_3d_font.dir, text, &b2_3d_font.tex[gt->command[i].Parametr[0].Value], 1, 0, &b2_3d_font.konf[gt->command[i].Parametr[0].Value], bmp_nahraj); } } break; } return 0; } void fn2_Draw_Message(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXmax, int *iYmax) { WCHAR wtext[1024]; int i; int top, bottom, left, right, ycor; int x = iXpos, y = iYpos - b2_3d_font.iYPlus; *iXmax = x; *iYmax = y; i = wcslen(cFile); cFile = wcsstr((WCHAR *) b2_3d_font.pTBuffer, cFile); if (!cFile) return; cStop = wcsstr(cFile, cStop); if (!cStop) return; ZeroMemory(wtext, 1024 * sizeof(WCHAR)); wcsncpy(wtext, cFile + i, cStop - cFile - i); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { //x+= 50; x += b2_3d_font.iXPlus; continue; } else if (wtext[i] == 10) { //y+= 17; y += b2_3d_font.iYPlus; x = iXpos; *iYmax = y; continue; } else if (fn2_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float) ddx2GetWidth(b2_3d_font.iBitmap[iSection]), (float) ddx2GetHeight(b2_3d_font.iBitmap[iSection]))) { /*TransparentBltU(hdc, x, y + ycor, right - left + 1, bottom - top + 1, _2dd.bitmap[b2_3d_font.iBitmap[iSection]].bitmapDC, left, top, right - left + 1, bottom - top + 1, b2_3d_font.tcolor); */ ddx2TransparentBlt(iSurface, x, y + ycor, right - left + 1, bottom - top + 1, b2_3d_font.iBitmap[iSection], left, top, b2_3d_font.tcolor); x += right - left + 2; if (x > *iXmax) *iXmax = x; } } } typedef struct { int xStart; int xEnd; WCHAR *wcWord; int wLen; } TEXT_WORLD; int end_char(WCHAR wChar) { if (wChar == 10 || wChar == 13 || wChar == 32) return 1; else return 0; } void fn2_Draw_Format_Line(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, TEXT_WORLD * tWord, int iWordl, int x, int y, int xmax, int iSection, int iSurface, char bFormat) { int top, bottom, left, right, ycor; int i, j; int sx; float fp = 0; float f = 0; if (bFormat) fp = (xmax - tWord[iWordl - 1].xEnd) / (float) (iWordl - 1); if (!iWordl) return; for (i = 0; i < iWordl; i++) { sx = tWord[i].xStart + ftoi(f); for (j = 0; j < 128; j++) { if (!tWord[i].wcWord) return; if (!end_char(tWord[i].wcWord[j])) { if (fn2_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, tWord[i].wcWord[j], (float) ddx2GetWidth(b2_3d_font.iBitmap[iSection]), (float) ddx2GetHeight(b2_3d_font.iBitmap[iSection]))) { ddx2TransparentBlt(iSurface, sx, y + ycor, right - left + 1, bottom - top + 1, b2_3d_font.iBitmap[iSection], left, top, b2_3d_font.tcolor); sx += right - left + 2; } } else break; } f += fp; } } void fn2_Draw_MessageRECT(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXmax, int *iYmax, RECT * pR) { //rovnatko................... TEXT_WORLD tWord[64]; int iWordl = 0; //rovnatko................... WCHAR wtext[2024]; int i; int top, bottom, left, right, ycor; int x = iXpos, y = iYpos - b2_3d_font.iYPlus; int lx; ZeroMemory(tWord, 64 * sizeof(TEXT_WORLD)); *iXmax = x; *iYmax = y; i = wcslen(cFile); cFile = wcsstr((WCHAR *) b2_3d_font.pTBuffer, cFile); if (!cFile) return; cStop = wcsstr(cFile, cStop); if (!cStop) return; ZeroMemory(wtext, 2024 * sizeof(WCHAR)); wcsncpy(wtext, cFile + i, cStop - cFile - i); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { x += b2_3d_font.iXPlus; //pokud posledni pismeno nebyla mezera ani enter, tak konec slova if (!end_char(wtext[i - 1])) { tWord[iWordl].xEnd = x - b2_3d_font.iXPlus; tWord[iWordl].wLen = &wtext[i] - tWord[iWordl].wcWord; iWordl++; } continue; } else if (wtext[i] == 10) { //y+= 17; y += b2_3d_font.iYPlus; x = iXpos; *iYmax = y; if (i && !end_char(wtext[i - 1])) { tWord[iWordl].xEnd = x - b2_3d_font.iXPlus; tWord[iWordl].wLen = &wtext[i] - tWord[iWordl].wcWord; iWordl++; } fn2_Draw_Format_Line(gt, ts, tWord, iWordl + 1, pR->left, y - b2_3d_font.iYPlus, pR->right, iSection, iSurface, 0); ZeroMemory(tWord, 64 * sizeof(TEXT_WORLD)); iWordl = 0; continue; } else if (fn2_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float) ddx2GetWidth(b2_3d_font.iBitmap[iSection]), (float) ddx2GetHeight(b2_3d_font.iBitmap[iSection]))) { //pretekl sem? if (x + right - left + 2 > pR->right) { if (tWord[iWordl].xStart) { lx = x - tWord[iWordl].xStart; x = pR->left + (x - tWord[iWordl].xStart); } else x = pR->left; if (iWordl > 0) { if (tWord[iWordl - 1].wLen == 1) { if (!tWord[iWordl].xStart) { fn2_Draw_Format_Line(gt, ts, tWord, iWordl - 1, pR->left, y, pR->right, iSection, iSurface, 1); y += b2_3d_font.iYPlus; ZeroMemory(&tWord[0], sizeof(TEXT_WORLD)); tWord[0].wcWord = tWord[iWordl - 1].wcWord; tWord[0].xEnd = pR->left + (tWord[iWordl - 1].xEnd - tWord[iWordl - 1].xStart); tWord[0].xStart = pR->left; tWord[0].wLen = tWord[iWordl - 1].wLen; ZeroMemory(&tWord[1], 63 * sizeof(TEXT_WORLD)); x = tWord[0].xEnd + b2_3d_font.iXPlus; iWordl = 1; } else { fn2_Draw_Format_Line(gt, ts, tWord, iWordl - 1, pR->left, y, pR->right, iSection, iSurface, 1); y += b2_3d_font.iYPlus; ZeroMemory(&tWord[0], sizeof(TEXT_WORLD)); tWord[0].wcWord = tWord[iWordl - 1].wcWord; tWord[0].xEnd = pR->left + (tWord[iWordl - 1].xEnd - tWord[iWordl - 1].xStart); tWord[0].xStart = pR->left; tWord[0].wLen = tWord[iWordl - 1].wLen; ZeroMemory(&tWord[1], sizeof(TEXT_WORLD)); tWord[1].wcWord = tWord[iWordl].wcWord; tWord[1].xStart = tWord[0].xEnd + (tWord[iWordl].xStart - tWord[iWordl - 1].xEnd); ZeroMemory(&tWord[2], 62 * sizeof(TEXT_WORLD)); x = tWord[1].xStart + lx; iWordl = 1; } } else { FN2_DRAW_MESSAGERECT_NORMAL_FORMAT_LINE: fn2_Draw_Format_Line(gt, ts, tWord, iWordl, pR->left, y, pR->right, iSection, iSurface, 1); y += b2_3d_font.iYPlus; ZeroMemory(&tWord[0], sizeof(TEXT_WORLD)); tWord[0].wcWord = tWord[iWordl].wcWord; tWord[0].xStart = pR->left; ZeroMemory(&tWord[1], 63 * sizeof(TEXT_WORLD)); iWordl = 0; } } else goto FN2_DRAW_MESSAGERECT_NORMAL_FORMAT_LINE; *iYmax = y; } /*ddx2TransparentBlt(iSurface, x, y + ycor, right - left + 1, bottom - top + 1, b2_3d_font.iBitmap[iSection],left, top, right - left +1, bottom - top +1, b2_3d_font.tcolor); */ //pokud posledni pismeno byla mezera nebo enter, tak zacatek slova if (end_char(wtext[i - 1])) { tWord[iWordl].xStart = x; tWord[iWordl].wcWord = &wtext[i]; } x += right - left + 2; if (x > *iXmax) *iXmax = x; } } } void fn2_Draw_MessageA(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cText, int iSection, int *iXmax, int *iYmax) { WCHAR wtext[1024]; int i; int top, bottom, left, right, ycor; int x = iXpos, y = iYpos; *iXmax = x; *iYmax = y; ZeroMemory(wtext, 1024 * sizeof(WCHAR)); wcsncpy(wtext, cText, wcslen(cText)); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { //x+= 50; x += b2_3d_font.iXPlus; continue; } else if (wtext[i] == 10) { //y+= 17; y += b2_3d_font.iYPlus; x = iXpos; *iYmax = y; continue; } else if (fn2_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float) ddx2GetWidth(b2_3d_font.iBitmap[iSection]), (float) ddx2GetHeight(b2_3d_font.iBitmap[iSection]))) { /*TransparentBltU(hdc, x, y + ycor, right - left + 1, bottom - top + 1, _2dd.bitmap[b2_3d_font.iBitmap[iSection]].bitmapDC, left, top, right - left + 1, bottom - top + 1, b2_3d_font.tcolor); */ ddx2TransparentBlt(iSurface, x, y + ycor, right - left + 1, bottom - top + 1, b2_3d_font.iBitmap[iSection], left, top, b2_3d_font.tcolor); x += right - left + 2; if (x > *iXmax) *iXmax = x; } } } void fn2_Set_Char(unsigned int *pTexture, int iXSize, int iYSize, int iXpos, int iYpos, unsigned int *pSource, int iXSSize, int iYSSize, int iCXSize, int iCYSize, int iXCpos, int iYCpos) { unsigned int *pT = &pTexture[(iXSize * (iYSize - iYpos)) - (iXSize - iXpos)]; unsigned int *pS = &pSource[(iXSSize * (iYSSize - iYCpos)) - (iXSSize - iXCpos)]; int y; for (y = iYCpos; y < iYCpos + iCYSize; y++) { memcpy((void *) pT, (void *) pS, iCXSize * sizeof(unsigned int)); pT -= iXSize; pS -= iXSSize; } } void fn2_Gen_Texture(byte ** lpTexture, int iXSize, int iYSize, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXres, int *iYres) { WCHAR wtext[1024]; int i; int top, bottom, left, right, ycor; byte *pT = NULL; int x = iXpos, y = iYpos - b2_3d_font.iYPlus; *iXres = iXpos; *iYres = iYpos; i = wcslen(cFile); cFile = wcsstr((WCHAR *) b2_3d_font.pTBuffer, cFile); if (!cFile) return; cStop = wcsstr(cFile, cStop); if (!cStop) return; ZeroMemory(wtext, 1024 * sizeof(WCHAR)); wcsncpy(wtext, cFile + i, cStop - cFile - i); pT = (byte *) malloc(iXSize * iYSize * sizeof(unsigned int)); if (!pT) return; *lpTexture = pT; ZeroMemory(pT, iXSize * iYSize * sizeof(unsigned int)); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { x += b2_3d_font.iXPlus; continue; } else if (wtext[i] == 10) { //y+= 17; y += b2_3d_font.iYPlus; // *iYres = y; x = iXpos; continue; } else if (fn2_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float) b2_3d_font.tex[iSection].p_bmp->x, (float) b2_3d_font.tex[iSection].p_bmp->y)) { if (b2_3d_font.tex[iSection].p_bmp) { fn2_Set_Char((unsigned int *) pT, iXSize, iYSize, x, y + ycor, (unsigned int *) b2_3d_font.tex[iSection].p_bmp->data, b2_3d_font.tex[iSection].p_bmp->x, b2_3d_font.tex[iSection].p_bmp->y, right - left, bottom - top, left, top); } x += right - left + 2; if (x > *iXres) *iXres = x; if (bottom - top > *iYres) *iYres = bottom - top; } } } int fn2_Load_Grammar(char *pFile, GRAMMAR * pGr) { FILE *file; char text[MAX_FILENAME]; construct_path(text, MAX_FILENAME, 2, b2_3d_font.dir, pFile); file = fopen(text, "rb"); if (!file) return 0; pGr->LastMask = 0; while (fgets(text, 256, file)) { gr_Add_Mask(text, pGr); strcpy(text, ""); } fclose(file); return 1; } char fn2_Load_Triger(char *pFile, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct) { FILE *file; char text[64]; WCHAR wtext[sizeof(text)*4]; char filename[MAX_FILENAME]; pTriger->lastcommand = 0; construct_path(filename, MAX_FILENAME, 2, b2_3d_font.dir, pFile); file = fopen(filename, "rb"); if (!file) return 0; while (!feof(file)) { memset(wtext, 0, sizeof(wtext)); if (fgets(text, sizeof(text), file)) { if (MultiByteToWideChar(CP_ACP, 0, text, sizeof(text)/sizeof(*text), wtext, sizeof(wtext)/sizeof(*wtext)) < 0) { fclose(file); return 0; } trig_Parse_LineU(wtext, &pTriger->command[pTriger->lastcommand], pTriger, pGr, pTStruct); } } fclose(file); return 1; } int fn2_Set_Font(char *cDir) { int i; char filename[MAX_FILENAME]; long size; int iTSize; char *buffer; memset(&b2_3d_font, 0, sizeof(B2_FONT)); construct_path(b2_3d_font.dir, MAX_FILENAME, 2, p_ber->dir.bitmap_dir, cDir); construct_path(filename, MAX_FILENAME, 2, b2_3d_font.dir, "texts.txt"); b2_3d_font.file = fopen(filename, "rb"); if (!b2_3d_font.file) return 0; if (fseek(b2_3d_font.file, 0, SEEK_END) < 0 || (size = ftell(b2_3d_font.file)) < 0 || fseek(b2_3d_font.file, 0, SEEK_SET) < 0) return 0; buffer = (char *) mmalloc(sizeof(*buffer) * (size + 1)); if (fread(buffer, sizeof(*buffer), size, b2_3d_font.file) != (size_t) size) return 0; buffer[size] = 0; iTSize = MultiByteToWideChar(CP_ACP, 0, buffer, size, NULL, 0); b2_3d_font.pTBuffer = (WCHAR *) mmalloc(sizeof(*b2_3d_font.pTBuffer) * (iTSize + 1)); size = MultiByteToWideChar(CP_ACP, 0, buffer, size, b2_3d_font.pTBuffer, iTSize + 1); assert(size == iTSize); free(buffer); if (!fn2_Load_Grammar("font_grammar.txt", &b2_3d_font.gr)) return 0; b2_3d_font.ts.LastStr = 0; b2_3d_font.ts.sizeofT = 0; b2_3d_font.ts.pTriger = NULL; if (!fn2_Load_Triger("font_def.txt", &b2_3d_font.gt, &b2_3d_font.gr, &b2_3d_font.ts)) return 0; for (i = 0; i < FONT_MAX_BMP; i++) b2_3d_font.iBitmap[i] = -1; b2_3d_font.pTTable = NULL; if (!fn2_Set_Font_Params(&b2_3d_font.gt, &b2_3d_font.ts)) return 0; return 1; } int fn2_Load_Bitmaps(void) { if (b2_3d_font.dir[0] == '\0') return 0; kom_set_default_text_config(0, 0, 1, 0, 0, 1); fn2_Set_Font_Bmps(&b2_3d_font.gt, &b2_3d_font.ts); kom_ret_default_text_config(); return 1; } void fn2_Release_Font(void) { int i; fclose(b2_3d_font.file); free(b2_3d_font.pTBuffer); // if(_2dd.bitmap) for (i = 0; i < FONT_MAX_BMP; i++) if (b2_3d_font.iBitmap[i] != -1) { ddx2ReleaseBitmap(b2_3d_font.iBitmap[i]); } for (i = 0; i < FONT_MAX_BMP; i++) if (b2_3d_font.tex[i].load) { txt_zrus_texturu_ram(&b2_3d_font.tex[i]); b2_3d_font.tex[i].load = 0; } if (b2_3d_font.pTTable) free((void *) b2_3d_font.pTTable); b2_3d_font.pTTable = NULL; } void fn2_Release_3d_Textures_Full(void) { int i; for (i = 133; i < _3dd.last; i++) { txt_zrus_texturu(&_3dd.p_texture[i]); _3dd.p_texture[i].text = -1; free((void *) _3dd.p_sysramtexture[i].data); } _3dd.last = 133; } void fn2_Release_3d_Textures_RAM(void) { int i; for (i = 133; i < _3dd.last; i++) { free((void *) _3dd.p_sysramtexture[i].data); _3dd.p_sysramtexture[i].data = NULL; } _3dd.last = 133; } void fn2_Release_3d_Textures(void) { int i; for (i = 133; i < _3dd.last; i++) { txt_zrus_texturu(&_3dd.p_texture[i]); _3dd.p_texture[i].text = -1; } } void fn2_Test(int hdc) { int x, y; WCHAR wc[64]; WCHAR ws[64]; MultiByteToWideChar(CP_ACP, 0, "##message1", strlen("##message1") + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(hdc, 360, 230, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 0, &x, &y); } void fn2_Test2(int hdc) { int x, y; WCHAR wc[64]; WCHAR ws[64]; MultiByteToWideChar(CP_ACP, 0, "##settings", strlen("##settings") + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(hdc, 800, 600, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 0, &x, &y); } int fn2_Text_Blt(int hdc, WCHAR * ws, WCHAR * wc, int iSurface, int iSection, int *i) { int x, y; int tmpDC; fn2_Draw_Message(iSurface, 0, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, iSection, &x, &y); *i = ddx2FindFreeSurface(); tmpDC = ddx2CreateSurface(x, y, *i); if (!tmpDC) return 0; else ddx2TransparentBlt(tmpDC, 0, 0, x, y, iSurface, 0, 0, TRANSCOLOR); return 1; } int fn2_Gen_Menu_Text(int iSection, int hdc, char *cText, int *i1, int *i2) { WCHAR wc[64]; WCHAR ws[64]; int sidx = ddx2FindFreeSurface(); int fDC = ddx2CreateSurface(1024, 200, sidx); if (!fDC) return -1; MultiByteToWideChar(CP_ACP, 0, cText, strlen(cText) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); if (!fn2_Text_Blt(hdc, ws, wc, fDC, iSection, i1)) { ddx2ReleaseBitmap(sidx); return -1; } if (!fn2_Text_Blt(hdc, ws, wc, fDC, iSection + 1, i2)) { ddx2ReleaseBitmap(sidx); return -1; } ddx2ReleaseBitmap(sidx); return sidx; } int fn2_Gen_Menu_Texts(int iSection, int hdc) { // TODO? assert(0); /* int x; WCHAR wc[64]; WCHAR ws[64]; int sidx = ddx2FindFreeSurface(); int fDC = ddx2CreateSurface(1024, 200, sidx); if(!fDC) return 0; MultiByteToWideChar( CP_ACP, 0, "##menu_newgame", strlen("##menu_newgame")+1, wc, sizeof(wc)/sizeof(wc[0]) ); MultiByteToWideChar( CP_ACP, 0, "##endofmessage", strlen("##endofmessage")+1, ws, sizeof(ws)/sizeof(ws[0]) ); if(!fn2_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if(!fn2_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; MultiByteToWideChar( CP_ACP, 0, "##menu_loadgame", strlen("##menu_loadgame")+1, wc, sizeof(wc)/sizeof(wc[0]) ); if(!fn2_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if(!fn2_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; MultiByteToWideChar( CP_ACP, 0, "##menu_settings", strlen("##menu_settings")+1, wc, sizeof(wc)/sizeof(wc[0]) ); if(!fn2_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if(!fn2_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; MultiByteToWideChar( CP_ACP, 0, "##menu_credits", strlen("##menu_credits")+1, wc, sizeof(wc)/sizeof(wc[0]) ); if(!fn2_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if(!fn2_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; ddx2_Release_Bitmap(sidx);*/ return 1; } int fn2_Gen_Menu(void) { return fn2_Gen_Menu_Texts(0, HDC2DD); } #define FONT_X_MAX 1024 #define FONT_Y_MAX 1024 int fn2_Up(int iValue) { int i, x = 4; for (i = 3; i < 12; i++) { x = x * 2; if (x > iValue) return x; } return FONT_X_MAX; } int fn2_Blt(byte * pT, byte ** pD, int ix, int iy) { int y; unsigned int *puT = (unsigned int *) pT + (FONT_X_MAX * (FONT_Y_MAX - 1)); unsigned int *puD; *pD = (byte *) malloc(ix * iy * sizeof(unsigned int)); if (!(*pD)) return 0; memset((*pD), 0, ix * iy * sizeof(unsigned int)); puD = (unsigned int *) (*pD) + (ix * (iy - 1)); for (y = 0; y < iy; y++) { memcpy((void *) puD, (void *) puT, ix * sizeof(unsigned int)); puT -= FONT_X_MAX; puD -= ix; } for (y = 0; y < FONT_X_MAX * FONT_Y_MAX; y++) if (pT[y]) pT[y] = pT[y]; free((void *) pT); return 1; } int fn2_Put_in_3d_List(int text, EDIT_TEXT * p_tex, EDIT_TEXT_KONFIG * p_konf, int x, int y, char *pMem, int ox, int oy) { memcpy(&_3dd.p_texture[_3dd.last], p_tex, sizeof(EDIT_TEXT)); memcpy(&_3dd.p_sysramtexture[_3dd.last].konf, p_konf, sizeof(EDIT_TEXT_KONFIG)); _3dd.p_texture[_3dd.last].text = text; _3dd.p_sysramtexture[_3dd.last].data = pMem; _3dd.p_sysramtexture[_3dd.last].x = x; _3dd.p_sysramtexture[_3dd.last].y = y; _3dd.p_sysramtexture[_3dd.last].tx = ox; _3dd.p_sysramtexture[_3dd.last].ty = oy; _3dd.p_sysramtexture[_3dd.last].bSLoaded = 0; _3dd.p_sysramtexture[_3dd.last].bVLoaded = 0; _3dd.last++; return _3dd.last - 1; } int fn2_Get_Font_Texture(int iSection, char *cText) { int tx, ty; int Xmax, Ymax; byte *pT = NULL; byte *pnT = NULL; WCHAR wc[64]; WCHAR ws[64]; MultiByteToWideChar(CP_ACP, 0, cText, strlen(cText) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Gen_Texture(&pT, FONT_X_MAX, FONT_Y_MAX, 0, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, iSection, &Xmax, &Ymax); tx = Xmax; ty = Ymax; Xmax = fn2_Up(Xmax); Ymax = fn2_Up(Ymax); fn2_Blt(pT, &pnT, Xmax, Ymax); /*glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, b2_3d_font.tex.p_bmp->x, b2_3d_font.tex.p_bmp->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b2_3d_font.tex.p_bmp->data); */ return fn2_Put_in_3d_List(b2_3d_font.tex[iSection].text, &b2_3d_font.tex[iSection], &b2_3d_font.konf[iSection], Xmax, Ymax, (char *)pnT, tx, ty); } void fn2_Load_Textures_From_RAM(void) { int i; for (i = 133; i < _3dd.last; i++) { glGenTextures(1, &_3dd.p_texture[i].text); glBindTexture(GL_TEXTURE_2D, _3dd.p_texture[i].text); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _3dd.p_sysramtexture[i].x, _3dd.p_sysramtexture[i].y, 0, GL_RGBA, GL_UNSIGNED_BYTE, _3dd.p_sysramtexture[i].data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } } void fn2_Texture(int iSection) { int i; for (i = 0; i <= iSection; i++) fn2_Get_Font_Texture(i, "##restartlevel"); for (i = 0; i <= iSection; i++) fn2_Get_Font_Texture(i, "##mainmenu"); for (i = 0; i <= iSection; i++) fn2_Get_Font_Texture(i, "##settings"); for (i = 0; i <= iSection; i++) fn2_Get_Font_Texture(i, "##recorddemo"); for (i = 0; i <= iSection; i++) fn2_Get_Font_Texture(i, "##back"); } //int fn2_Find_Char(GAME_TRIGER *gt, TRIGER_STRUCTURE *ts, int *top, int *left, int *bottom, int *right, int *ycor, WCHAR cWChar) void fn2_Convert_Rect(char *cFile, int xmax, int ymax) { FILE *f; FILE *fi; GAME_TRIGER *gt = &b2_3d_font.gt; // TRIGER_STRUCTURE *ts = &b2_3d_font.ts; int i; char text[256]; char textt[256]; char t[32]; float *fl1, *fl2, *fl3, *fl4, *fl5; f = fopen("fontout.txt", "w"); fi = fopen("font_def.txt", "r"); for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 1: { if (gt->command[i].LastParam > 5 && gt->command[i].Parametr[0].Type == 3) { if (fgets(textt, 256, fi) == NULL) { fclose(fi); fclose(f); return; } strncpy(t, textt, 10); t[10] = '\0'; strcpy(text, ""); fl1 = (float *) >->command[i].Parametr[1].Value; fl2 = (float *) >->command[i].Parametr[2].Value; fl3 = (float *) >->command[i].Parametr[3].Value; fl4 = (float *) >->command[i].Parametr[4].Value; fl5 = (float *) >->command[i].Parametr[5].Value; sprintf(text, "%s %f, %f, %f, %f, %f);\n", t, (*fl1) * 0.75f, (*fl2) * 0.75f, (*fl3) * 0.75f, (*fl4) * 0.75f, (*fl5) * 0.75f); fputs(text, f); } } break; } fclose(fi); fclose(f); return; } void fn2_Draw_Line(int x1, int y1, int x2, int y2, COLORREF color, HDC hdc) { /* TODO HPEN LastPen; HPEN MePen; MePen = CreatePen(PS_SOLID,1,color); LastPen = (HPEN)SelectObject(hdc,MePen); MoveToEx(hdc,x1, y1, NULL); LineTo(hdc,x2, y2); SelectObject(hdc,LastPen); DeleteObject(MePen); */ } /* int fn2_DC2Tex(HDC hdc, int xr, int yr, int turn, int texture) { int tex; int i, c = 0; // HDC hdcMem; BITMAPINFO *pbmiRGB = (BITMAPINFO *) NULL; HBITMAP hbmRGB = (HBITMAP) NULL; PBYTE pjBitsRGB; PBYTE pjBitsTEX; // hdcMem = CreateCompatibleDC(hdc); pbmiRGB = (BITMAPINFO *)LocalAlloc(LMEM_FIXED|LMEM_ZEROINIT, sizeof(BITMAPINFO) ); if (!pbmiRGB) return 0; pbmiRGB->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmiRGB->bmiHeader.biWidth = xr; pbmiRGB->bmiHeader.biHeight = yr; pbmiRGB->bmiHeader.biPlanes = 1; pbmiRGB->bmiHeader.biBitCount = 24; pbmiRGB->bmiHeader.biCompression = BI_RGB; pbmiRGB->bmiHeader.biSizeImage = pbmiRGB->bmiHeader.biWidth * abs(pbmiRGB->bmiHeader.biHeight) * 3; */ /* hbmRGB = CreateDIBSection(hdcMem, pbmiRGB, DIB_RGB_COLORS, (PVOID *) &pjBitsRGB, NULL, 0); if (!hbmRGB) return 0; if (!SelectObject(hdcMem, hbmRGB)) return 0; if (!BitBlt(hdcMem, 0,0, xr, yr, hdc, 0,0,SRCCOPY)) return 0;*/ /* pjBitsRGB = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbmiRGB->bmiHeader.biSizeImage); if (!pjBitsRGB) return 0; if (!GetDIBits(hdc, hbmRGB, 0, (UINT)pbmiRGB->bmiHeader.biHeight, pjBitsRGB, (LPBITMAPINFO)pbmiRGB, DIB_RGB_COLORS)) return 0; pjBitsTEX = (PBYTE) malloc(pbmiRGB->bmiHeader.biWidth * abs(pbmiRGB->bmiHeader.biHeight) * 4); memset(pjBitsTEX, 0, pbmiRGB->bmiHeader.biWidth * abs(pbmiRGB->bmiHeader.biHeight) * 4); for(i=0;i<(signed)pbmiRGB->bmiHeader.biSizeImage;i+=3) { pjBitsTEX[c] = pjBitsRGB[i+2]; pjBitsTEX[c+1] = pjBitsRGB[i+1]; pjBitsTEX[c+2] = pjBitsRGB[i]; pjBitsTEX[c+3] = 0xff; c+=4; } if(!turn) { glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, xr, yr, 0, GL_RGBA, GL_UNSIGNED_BYTE, pjBitsTEX); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); } else { //void glTexSubImage2D ( GLenum target , GLint level , GLint xoffset , GLint yoffset , GLsizei width , // GLsizei height , GLenum format , GLenum type , const GLvoid *pixels ); glTexSubImage2D(texture, 0, 0, 0, 1024, 768, GL_RGBA, GL_TEXTURE_2D, pjBitsTEX); } //DeleteDC(hdcMem); DeleteObject(hbmRGB); LocalFree(pbmiRGB); GlobalFree((HGLOBAL)pjBitsRGB); free((void *) pjBitsTEX); return tex; } */ berusky2-0.12/src/kofola/grammar.h0000644000175000017500000000056213674426075014005 00000000000000#ifndef __GRAMMAR_ #define __GRAMMAR_ typedef struct { DWORD Value; char Type; } VALUE; typedef struct { int iCommand; char cCommand[64]; VALUE Parametr[16]; int LastParam; } COMMAND; typedef struct { COMMAND Mask[256]; int LastMask; } GRAMMAR; char gr_Load_Grammar(char *pFile, GRAMMAR * pGr); void gr_Add_Mask(char *pMask, GRAMMAR * pGr); #endif berusky2-0.12/src/kofola/grammar.cpp0000644000175000017500000000263213674426075014340 00000000000000#include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "grammar.h" #include "menu_script.h" extern char pDataDir[MAX_FILENAME]; int StrtoType(char *pStr) { if (!strcmp(pStr, "iV")) return 0; if (!strcmp(pStr, "fV")) return 1; if (!strcmp(pStr, "sV")) return 2; if (!strcmp(pStr, "uV")) return 3; return -1; } void gr_Add_Mask(char *pMask, GRAMMAR * pGr) { char Expression[64]; int cursor = 0, lm = pGr->LastMask; if (!strlen(pMask)) return; cursor = Find_Next_Expresion(pMask, cursor, pGr->Mask[lm].cCommand); cursor = Find_Next_Expresion(pMask, cursor, Expression); pGr->Mask[lm].iCommand = atoi(Expression); pGr->Mask[lm].LastParam = 0; while (cursor != -1) { cursor = Find_Next_Expresion(pMask, cursor, Expression); if (cursor != -1) { pGr->Mask[lm].Parametr[pGr->Mask[lm].LastParam].Type = StrtoType(Expression); pGr->Mask[lm].LastParam++; } } pGr->LastMask++; } char gr_Load_Grammar(char *pFile, GRAMMAR * pGr) { FILE *file; char text[MAX_FILENAME]; if (chdir(DATA_DIR)) return 0; construct_path(text, MAX_FILENAME, 2, pDataDir, pFile); file = fopen(text, "r"); if (!file) return 0; pGr->LastMask = 0; while (!feof(file)) { if(fgets(text, 256, file)) { gr_Add_Mask(text, pGr); strcpy(text, ""); } } fclose(file); return 1; } berusky2-0.12/src/kofola/codec.h0000644000175000017500000001715513674426075013442 00000000000000/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * * by the XIPHOPHORUS Company http://www.xiph.org/ * ******************************************************************** function: libvorbis codec headers last mod: $Id: codec.h,v 1.40 2002/02/28 04:12:47 xiphmont Exp $ ********************************************************************/ #ifndef _vorbis_codec_h_ #define _vorbis_codec_h_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "ogg.h" typedef struct vorbis_info { int version; int channels; long rate; /* The below bitrate declarations are *hints*. Combinations of the three values carry the following implications: all three set to the same value: implies a fixed rate bitstream only nominal set: implies a VBR stream that averages the nominal bitrate. No hard upper/lower limit upper and or lower set: implies a VBR bitstream that obeys the bitrate limits. nominal may also be set to give a nominal rate. none set: the coder does not care to speculate. */ long bitrate_upper; long bitrate_nominal; long bitrate_lower; long bitrate_window; void *codec_setup; } vorbis_info; /* vorbis_dsp_state buffers the current vorbis audio analysis/synthesis state. The DSP state belongs to a specific logical bitstream ****************************************************/ typedef struct vorbis_dsp_state { int analysisp; vorbis_info *vi; float **pcm; float **pcmret; int pcm_storage; int pcm_current; int pcm_returned; int preextrapolate; int eofflag; long lW; long W; long nW; long centerW; ogg_int64_t granulepos; ogg_int64_t sequence; ogg_int64_t glue_bits; ogg_int64_t time_bits; ogg_int64_t floor_bits; ogg_int64_t res_bits; void *backend_state; } vorbis_dsp_state; typedef struct vorbis_block { /* necessary stream state for linking to the framing abstraction */ float **pcm; /* this is a pointer into local storage */ oggpack_buffer opb; long lW; long W; long nW; int pcmend; int mode; int eofflag; ogg_int64_t granulepos; ogg_int64_t sequence; vorbis_dsp_state *vd; /* For read-only access of configuration */ /* local storage to avoid remallocing; it's up to the mapping to structure it */ void *localstore; long localtop; long localalloc; long totaluse; struct alloc_chain *reap; /* bitmetrics for the frame */ long glue_bits; long time_bits; long floor_bits; long res_bits; void *internal; } vorbis_block; /* vorbis_block is a single block of data to be processed as part of the analysis/synthesis stream; it belongs to a specific logical bitstream, but is independant from other vorbis_blocks belonging to that logical bitstream. *************************************************/ struct alloc_chain { void *ptr; struct alloc_chain *next; }; /* vorbis_info contains all the setup information specific to the specific compression/decompression mode in progress (eg, psychoacoustic settings, channel setup, options, codebook etc). vorbis_info and substructures are in backends.h. *********************************************************************/ /* the comments are not part of vorbis_info so that vorbis_info can be static storage */ typedef struct vorbis_comment { /* unlimited user comment fields. libvorbis writes 'libvorbis' whatever vendor is set to in encode */ char **user_comments; int *comment_lengths; int comments; char *vendor; } vorbis_comment; /* libvorbis encodes in two abstraction layers; first we perform DSP and produce a packet (see docs/analysis.txt). The packet is then coded into a framed OggSquish bitstream by the second layer (see docs/framing.txt). Decode is the reverse process; we sync/frame the bitstream and extract individual packets, then decode the packet back into PCM audio. The extra framing/packetizing is used in streaming formats, such as files. Over the net (such as with UDP), the framing and packetization aren't necessary as they're provided by the transport and the streaming layer is not used */ /* Vorbis PRIMITIVES: general ***************************************/ extern void vorbis_info_init(vorbis_info * vi); extern void vorbis_info_clear(vorbis_info * vi); extern int vorbis_info_blocksize(vorbis_info * vi, int zo); extern void vorbis_comment_init(vorbis_comment * vc); extern void vorbis_comment_add(vorbis_comment * vc, char *comment); extern void vorbis_comment_add_tag(vorbis_comment * vc, char *tag, char *contents); extern char *vorbis_comment_query(vorbis_comment * vc, char *tag, int count); extern int vorbis_comment_query_count(vorbis_comment * vc, char *tag); extern void vorbis_comment_clear(vorbis_comment * vc); extern int vorbis_block_init(vorbis_dsp_state * v, vorbis_block * vb); extern int vorbis_block_clear(vorbis_block * vb); extern void vorbis_dsp_clear(vorbis_dsp_state * v); /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ extern int vorbis_analysis_init(vorbis_dsp_state * v, vorbis_info * vi); extern int vorbis_commentheader_out(vorbis_comment * vc, ogg_packet * op); extern int vorbis_analysis_headerout(vorbis_dsp_state * v, vorbis_comment * vc, ogg_packet * op, ogg_packet * op_comm, ogg_packet * op_code); extern float **vorbis_analysis_buffer(vorbis_dsp_state * v, int vals); extern int vorbis_analysis_wrote(vorbis_dsp_state * v, int vals); extern int vorbis_analysis_blockout(vorbis_dsp_state * v, vorbis_block * vb); extern int vorbis_analysis(vorbis_block * vb, ogg_packet * op); extern int vorbis_bitrate_addblock(vorbis_block * vb); extern int vorbis_bitrate_flushpacket(vorbis_dsp_state * vd, ogg_packet * op); /* Vorbis PRIMITIVES: synthesis layer *******************************/ extern int vorbis_synthesis_headerin(vorbis_info * vi, vorbis_comment * vc, ogg_packet * op); extern int vorbis_synthesis_init(vorbis_dsp_state * v, vorbis_info * vi); extern int vorbis_synthesis(vorbis_block * vb, ogg_packet * op); extern int vorbis_synthesis_trackonly(vorbis_block * vb, ogg_packet * op); extern int vorbis_synthesis_blockin(vorbis_dsp_state * v, vorbis_block * vb); extern int vorbis_synthesis_pcmout(vorbis_dsp_state * v, float ***pcm); extern int vorbis_synthesis_read(vorbis_dsp_state * v, int samples); extern long vorbis_packet_blocksize(vorbis_info * vi, ogg_packet * op); /* Vorbis ERRORS and return codes ***********************************/ #define OV_FALSE -1 #define OV_EOF -2 #define OV_HOLE -3 #define OV_EREAD -128 #define OV_EFAULT -129 #define OV_EIMPL -130 #define OV_EINVAL -131 #define OV_ENOTVORBIS -132 #define OV_EBADHEADER -133 #define OV_EVERSION -134 #define OV_ENOTAUDIO -135 #define OV_EBADPACKET -136 #define OV_EBADLINK -137 #define OV_ENOSEEK -138 #ifdef __cplusplus } #endif /* __cplusplus */ #endif berusky2-0.12/src/kofola/controls3d.h0000644000175000017500000002145413674426075014454 00000000000000#ifndef __CONTROLS_ #define __CONTROLS_ #define BUTTON_LARGE 0 #define BUTTON_SMALL 1 typedef void (* CONTROL_CALLBACK)(void *p_control); typedef struct _HDC_INFO2 { int x; int y; HDC hdc; //HBITMAP hbitmap; //HBITMAP hbitmapold; } HDC_INFO2; typedef struct _HDC_EDIT_CONTROL2 { int hdcEdit; } HDC_EDIT_CONTROL2; typedef struct _HDC_COMBO_CONTROL2 { int hdcCombo; int hdcComboEnd; int hdcComboMid; int hdcComboUp; int hdcComboDown; int hdcComboDrop; int hdcComboMover; int hdcComboMoverb; } HDC_COMBO_CONTROL2; typedef struct _HDC_BUTTON_CONTROL2 { int hdcButtonL; int hdcButtonS; } HDC_BUTTON_CONTROL2; typedef struct _HDC_FRAME_CONTROL2 { int hdcFrame; } HDC_FRAME_CONTROL2; typedef struct _HDC_PROGRES_CONTROL2 { int hdcLine; int hdcMover; } HDC_PROGRES_CONTROL2; typedef struct _HDC_CHECKBOX_CONTROL2 { int hdcCheck; int hdcGray; } HDC_CHECKBOX_CONTROL2; typedef struct _HDC_LIST_CONTROL2 { int hdcListDown; int hdcListUp; int hdcListMover; int hdcListTop; int hdcListBottom; int hdcListLeft; int hdcListRight; int hdcListTL; int hdcListTR; int hdcListBL; int hdcListBR; } HDC_LIST_CONTROL2; typedef struct _COMBO_ITEM2 { char text[256]; int Sel; int Norm; float fValue; } COMBO_ITEM2; typedef struct _COMBO_CONTROL2 { int comboID; int x; int y; int Width; int WidthR; int Hight; int ListHight; int ListMaxHight; int ListMaxHightR; int Selected; int CSelected; int SSelected; int OSelected; COMBO_ITEM2 *pItem; int CounfOfItems; int CounfOfItemsL; RECT coEditRect; RECT coDownRect; RECT coListRect; RECT coLUp; RECT coLDown; RECT coLMov; RECT coLMovA; char bEdit; char bList; char bOpen; int *pBDC; int xmstart; int xm; int xmp; char bIn; } COMBO_CONTROL2; typedef struct _COMBO_DROP_CONTROL2 { int dropID; RECT coLUp; RECT coLDown; int x; int y; int Selected; COMBO_ITEM2 *pItem; int CounfOfItems; } COMBO_DROP_CONTROL2; typedef struct _BUTTON_CONTROL2 { int x; int y; int type; RECT Rect; int dc; int ButtonID; char bActivated; } BUTTON_CONTROL2; typedef struct _CHECKBOX_CONTROL2 { int x; int y; RECT Rect; RECT RectFull; int iDC; int checkID; char bChecked; char bChange; void *p_callback_data; CONTROL_CALLBACK p_callback; } CHECKBOX_CONTROL2; typedef struct _PROGRES_CONTROL2 { RECT rectMover; RECT rectProgres; int progID; int min; int max; int pos; int cor; int x; int y; int bDC; char bIn; char bChange; char bExclusive; RECT RectFull; int iDC; } PROGRES_CONTROL2; typedef struct _LIST_VIEW_CONTROL2 { int listID; int dx; int listnum; int x; int y; int mpmin; int mpmax; int mpos; RECT rectList; RECT rectUp; RECT rectDown; RECT rectMoverA; RECT rectMover; int bDCn; int bDCs; int bDCm; char bIn; char bInE; int Selected; int Pushc; DWORD pTime; int cSelected; char bClck; char bDblClck; int *piValue; WCHAR **pwText; char **cText; int cClckSel; int bSelection; } LIST_VIEW_CONTROL2; typedef struct _LIST_VIEW2_CONTROL2 { int listID; int dx; int x; int y; int mpmin; int mpmax; int mpos; RECT rectList; RECT rectUp; RECT rectDown; RECT rectMoverA; RECT rectMover; int bDC; int bDCm; int iViewHeight; char bIn; char bInE; } LIST_VIEW2_CONTROL2; typedef struct _CONTROL_EDIT2 { int bDC; //int bDCb; int x; int y; WCHAR wtext[64]; int lchar; int editID; RECT rect; char bActive; char bcActive; DWORD pTime; int tx; } CONTROL_EDIT2; typedef struct _CONTROL_LIST_ITEM2 { COMBO_CONTROL2 *p_combo; BUTTON_CONTROL2 *p_button; CHECKBOX_CONTROL2 *p_check; PROGRES_CONTROL2 *p_prog; LIST_VIEW_CONTROL2 *p_list; LIST_VIEW2_CONTROL2 *p_list_v; CONTROL_EDIT2 *p_edit; COMBO_DROP_CONTROL2 *p_combod; int iTab; char bActive; char bFocus; char bDisabled; } CONTROL_LIST_ITEM2; int co2_Load_Graphic(int combo_var); int co2_Release_Graphic(void); COMBO_CONTROL2 *co2_Create_Combo(int hdc, int x, int y, int maxlisthight, int id); int co2_Combo_Add_String(COMBO_CONTROL2 * p_co, char *text); int co2_Combo_Add_StringWC(COMBO_CONTROL2 * p_co, char *text); int co2_Combo_Set_Params(COMBO_CONTROL2 * p_co, int itemnum); int co2_Combo_Set_Sel(int hdc, COMBO_CONTROL2 * p_co, int i); int co2_Combo_Get_Sel_Not_Opend(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); int co2_Combo_Get_Sel(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); void co2_Release_Combo(COMBO_CONTROL2 * p_co); BUTTON_CONTROL2 *co2_Create_Button(int hdc, int x, int y, int type, char *text, int isection, int buttonID); int co2_Is_Button_Activated(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); void co2_Release_Button(BUTTON_CONTROL2 * p_bu); CHECKBOX_CONTROL2 *co2_Create_CheckBox(int hdc, int x, int y, char *text, int isection, int checkID, CONTROL_CALLBACK p_callback = NULL, void *p_callback_data = NULL); int co2_Check_Get_State(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); int co2_Check_Set_State(CHECKBOX_CONTROL2 * p_ch, int hdc, int state, char bDraw); void co2_Release_CheckBox(CHECKBOX_CONTROL2 * p_ch); PROGRES_CONTROL2 *co2_Create_Progres(int hdc, int x, int y, int min, int max, int progID); int co2_Progres_Set(PROGRES_CONTROL2 * p_pr, int hdc, int i); int co2_Progres_Get(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); int co2_Progres_Changed(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); void co2_Release_Progres(PROGRES_CONTROL2 * p_pr); int co2_Set_Text(int hdc, int x, int y, char *text, int isection); int co2_Set_Text_Center(int hdc, char *text, int isection, RECT r); int co2_Set_Text_Formated_Rect(int hdc, int x, int y, char *text, int isection, RECT * pR); int co2_Set_Text_Right(int hdc, char *text, int isection, int x, int y); LIST_VIEW_CONTROL2 *co2_Create_List(int hdc, int x, int y, int width, int hight, int id, int numofitems, char bSelection); int co2_List_Add_String(LIST_VIEW_CONTROL2 * p_li, int index, int x, char *text, int iValue, char bSelected); int co2_List_Add_StringWC(LIST_VIEW_CONTROL2 * p_li, int index, int x, char *text, int iValue, char bSelected); int co2_List_Add_StringWC2(LIST_VIEW_CONTROL2 * p_li, int index, int x, WCHAR * wc, char *text, int iValue, char bSelected); int co2_List_Redraw(int hdc, LIST_VIEW_CONTROL2 * p_li, int y); int co2_List_Get_Dbclck(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, LIST_VIEW_CONTROL2 ** p_li); int co2_List_Get_Clck(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, LIST_VIEW_CONTROL2 ** p_li); int co2_List_Delete_Item(LIST_VIEW_CONTROL2 * p_li, char **cValue); int co2_List_Get_Value(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, int index); void co2_Release_List(LIST_VIEW_CONTROL2 * p_li); CONTROL_EDIT2 *co2_Create_Edit(int hdc, int x, int y, int editID); WCHAR *co2_Edit_Get_Text(CONTROL_EDIT2 * p_ed); void co2_Edit_Set_Text(CONTROL_EDIT2 * p_ed, WCHAR * cText, char bRedraw, int hdc, int xcor, int ycor); COMBO_DROP_CONTROL2 *co2_Create_Combo_Drop(int hdc, int x, int y, int id); int co2_Combo_Drop_Add_String(COMBO_DROP_CONTROL2 * p_co, char *text, float fValue); int co2_Combo_Drop_Set_Sel(int hdc, COMBO_DROP_CONTROL2 * p_co, int i); int co2_Combo_Drop_Set_String(int hdc, COMBO_DROP_CONTROL2 * p_co, int xcor, int ycor); int co2_Combo_Drop_Get_Sel(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, float *pf); void co2_Handle_Controls(CONTROL_LIST_ITEM2 * p_list, int lsize, int x, int y, int hdc, int xcor, int ycor); void co2_Handle_Release(CONTROL_LIST_ITEM2 * p_list, int lsize); void co2_Frame_Draw(HDC hdc, int x, int y, int xr, int yr); int co2_Rect_Hit(RECT rect, int x, int y); LIST_VIEW2_CONTROL2 *co2_Create_List_View(int hdc, int x, int y, int width, int hight, int id, int iViewHeight); void co2_Release_List_View(LIST_VIEW2_CONTROL2 * p_li); int co2_Get_List_View_DC(LIST_VIEW2_CONTROL2 * p_li); int co2_List_View_Redraw(int hdc, LIST_VIEW2_CONTROL2 * p_li, int y); void co2_Set_List_View_List_Pos(LIST_VIEW2_CONTROL2 * p_li, int y, int hdc, int xcor, int ycor); void co2_Release_Combo_Drop(COMBO_DROP_CONTROL2 * p_co); int co2_Set_TextWC(int hdc, int x, int y, char *text, int isection); void co2_Check_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id); void co2_Check_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id); int co2_Check_Get_State_Change(CONTROL_LIST_ITEM2 * p_list, int lsize, int id); void co2_Draw_Disable(int hdc, int xcor, int ycor, int x, int y, int dx, int dy); void co2_Progres_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id, char bSave, int shdc); void co2_Progres_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id); void co_delete(char *cfile); #endif berusky2-0.12/src/kofola/3d_math.h0000644000175000017500000000142313674426075013673 00000000000000#ifndef __3D_MATHEMATIC_ #define __3D_MATHEMATIC_ // Calculate lungth of vector float Vector_Length(float *Vector); // Normalize vector float Normalize_Vector(float *Vector); // Add two vectors void Add_Vector(float *Vector1, float *Vector2, float *vResult); // Sub two vectors void Sub_Vector(float *Vector1, float *Vector2, float *vResult); // Multiple vector with constant void Multiple_Vector(float *Vector, float Const); // Make vectors void Make_Vector(float *Point1, float *Point2, float *vResult); // Make normal 3D vector (axe Y is static) void Normal_Vector(float *Vector, float *vResult); // Calculate inverse vector void Inverse_Vector(float *Vector, float *vResult, unsigned int uiDimension); #endif berusky2-0.12/src/kofola/ambient_sounds.h0000644000175000017500000000040013674426075015360 00000000000000#ifndef __AMBIENT_SOUNDS_ #define __AMBIENT_SOUNDS_ // starts environment void as_Start(int Env_ID, AUDIO_DATA * p_ad, void *p_Level); // starts environment void as_Do_Ambient_Sounds(int Env_ID, AUDIO_DATA * p_ad, void *p_Level); #endif berusky2-0.12/src/kofola/trigers.cpp0000644000175000017500000002004313674426075014365 00000000000000#include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "trigers.h" #include "menu_script.h" #include "game_logic.h" extern char pGDataDir[MAX_FILENAME]; int Find_Next_ExpresionU(WCHAR * p_Command, int start, WCHAR * p_Expresion); int trig_Commandtoi(char *pCommand, GRAMMAR * pGr, int *iMask) { int i; for (i = 0; i < pGr->LastMask; i++) if (!strcmp(pCommand, pGr->Mask[i].cCommand)) { *iMask = i; return pGr->Mask[i].iCommand; } return -1; } void trig_Parse_Line(char *pLine, COMMAND * pCommand, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct) { char Expression[64]; int cursor = 0, par = 0, iMask; // int cursoru = 1; float fValue; cursor = Find_Next_Expresion(pLine, cursor, Expression); strcpy(pCommand->cCommand, Expression); pCommand->iCommand = trig_Commandtoi(Expression, pGr, &iMask); if (pCommand->iCommand == -1) return; while (cursor != -1) { cursor = Find_Next_Expresion(pLine, cursor, Expression); // cursoru = cursor + 1; if (cursor != -1) { switch (pGr->Mask[iMask].Parametr[par].Type) { //int case 0: pCommand->Parametr[par].Type = 0; pCommand->Parametr[par].Value = atoi(Expression); break; //float case 1: pCommand->Parametr[par].Type = 1; fValue = (float) atof(Expression); memcpy((void *) &pCommand->Parametr[par].Value, (void *) &fValue, sizeof(float)); break; //string case 2: pCommand->Parametr[par].Type = 2; pCommand->Parametr[par].Value = pTStruct->LastStr; strcpy(pTStruct->StrTable[pTStruct->LastStr], Expression); pTStruct->LastStr++; break; } par++; } } pCommand->LastParam = par; pTriger->lastcommand++; } void Uni2Char(WCHAR * cUni, char *cText, int ctsize) { int cu = wcslen(cUni), i; ZeroMemory(cText, ctsize); for (i = 0; i < cu; i++) cText[i] = (char) cUni[i]; } void trig_Parse_LineU(WCHAR * pLine, COMMAND * pCommand, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct) { WCHAR Expression[64]; char tmp[64]; int cursor = 0, par = 0, iMask; float fValue; cursor = Find_Next_ExpresionU(pLine, cursor, Expression); if (cursor == -1) return; Uni2Char(Expression, pCommand->cCommand, 64); pCommand->iCommand = trig_Commandtoi(pCommand->cCommand, pGr, &iMask); if (pCommand->iCommand == -1) return; while (cursor != -1) { cursor = Find_Next_ExpresionU(pLine, cursor, Expression); if (cursor != -1) { switch (pGr->Mask[iMask].Parametr[par].Type) { //int case 0: pCommand->Parametr[par].Type = 0; Uni2Char(Expression, tmp, 64); pCommand->Parametr[par].Value = atoi(tmp); break; //float case 1: pCommand->Parametr[par].Type = 1; Uni2Char(Expression, tmp, 64); fValue = (float) atof(tmp); memcpy((void *) &pCommand->Parametr[par].Value, (void *) &fValue, sizeof(float)); break; //string case 2: pCommand->Parametr[par].Type = 2; pCommand->Parametr[par].Value = pTStruct->LastStr; wcscpy((WCHAR *) pTStruct->StrTable[pTStruct->LastStr], Expression); pTStruct->LastStr++; break; //Uni Code case 3: { pCommand->Parametr[par].Type = 3; ZeroMemory((void *) &pCommand->Parametr[par].Value, sizeof(DWORD)); if (Expression[0] == MAKEWORD('\\', 0)) memcpy((void *) &pCommand->Parametr[par].Value, (void *) &Expression[1], 1 * sizeof(WCHAR)); else memcpy((void *) &pCommand->Parametr[par].Value, (void *) Expression, 1 * sizeof(WCHAR)); } break; } par++; } } pCommand->LastParam = par; pTriger->lastcommand++; } char trig_Load_Triger(char *pFile, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct) { FILE *file; char text[MAX_FILENAME]; pTriger->lastcommand = 0; construct_path(text, MAX_FILENAME, 2, pGDataDir, pFile); file = fopen(text, "r"); if (!file) return 0; while (!feof(file)) { if(fgets(text, 256, file)) { trig_Parse_Line(text, &pTriger->command[pTriger->lastcommand], pTriger, pGr, pTStruct); text[0] = '\0'; } } fclose(file); return 1; } char trig_Load_Trigers(char *pLevel, char *pFile, TRIGER_STRUCTURE * pTStruct, GRAMMAR * pGr) { FILE *file; char text[MAX_FILENAME]; int i; pTStruct->pTriger = NULL; pTStruct->sizeofT = 0; if (chdir(GAME_LEVEL_DIR)) return 0; strcpy(text, pLevel); text[strlen(pLevel) - 4] = '\0'; //TODO - newline? if (chdir(text)) return 0; file = fopen(pFile, "r"); if (!file) return 0; if (chdir(DATA_DIR) || fgets(text, MAX_FILENAME, file) == NULL) { fclose(file); return 0; } pTStruct->sizeofT = atoi(text); pTStruct->pTriger = (GAME_TRIGER *) malloc(pTStruct->sizeofT * sizeof(GAME_TRIGER)); if (!pTStruct->pTriger) { pTStruct->sizeofT = 0; fclose(file); return 0; } pTStruct->LastStr = 0; for (i = 0; i < pTStruct->sizeofT; i++) { if (fgets(text, MAX_FILENAME, file) == NULL) { pTStruct->pTriger = NULL; pTStruct->sizeofT = 0; fclose(file); return 0; } newline_cut(text); if (!trig_Load_Triger(text, &pTStruct->pTriger[i], pGr, pTStruct)) kprintf(1, "Unable to load triger %s", text); } fclose(file); return 1; } char trig_cmp(int i, char *c) { int n; if (c[0] == '?') return 1; else { n = atoi(c); if (n == i) return 1; else return 0; } } char trig_Check_ifPos_Trigers(TRIGER_STRUCTURE * pTStruct, LEVELINFO * pLevel) { int i, r; COMMAND *pCom; for (i = 0; i < pTStruct->sizeofT; i++) if (pTStruct->pTriger[i].command[0].iCommand == 1) { pCom = &pTStruct->pTriger[i].command[0]; gl_Logical2Real(pCom->Parametr[2].Value, pCom->Parametr[3].Value, pCom->Parametr[4].Value, &r, pLevel); if (pLevel->Level[r]) if (trig_cmp(pLevel->Level[r]->p_Object->Class, pTStruct->StrTable[pCom->Parametr[0].Value]) && trig_cmp(pLevel->Level[r]->p_Object->SubClass, pTStruct->StrTable[pCom->Parametr[1].Value])) return 1; } return 0; } int trig_Find_Triger(TRIGER_STRUCTURE * pTStruct, LEVELINFO * pLevel) { int i, r; COMMAND *pCom; for (i = 0; i < pTStruct->sizeofT; i++) switch (pTStruct->pTriger[i].command[0].iCommand) { case 1: { pCom = &pTStruct->pTriger[i].command[0]; gl_Logical2Real(pCom->Parametr[2].Value, pCom->Parametr[3].Value, pCom->Parametr[4].Value, &r, pLevel); if (pLevel->Level[r]) if (trig_cmp(pLevel->Level[r]->p_Object->Class, pTStruct->StrTable[pCom->Parametr[0].Value]) && trig_cmp(pLevel->Level[r]->p_Object->SubClass, pTStruct->StrTable[pCom->Parametr[1].Value])) return i; } break; } return -1; } void trig_Do_MoveCameraTo(COMMAND * pCommand, int *p_flag) { BOD p_p, p_t; memcpy((void *) &p_p.x, (void *) &pCommand->Parametr[0].Value, sizeof(float)); memcpy((void *) &p_p.y, (void *) &pCommand->Parametr[1].Value, sizeof(float)); memcpy((void *) &p_p.z, (void *) &pCommand->Parametr[2].Value, sizeof(float)); memcpy((void *) &p_t.x, (void *) &pCommand->Parametr[3].Value, sizeof(float)); memcpy((void *) &p_t.y, (void *) &pCommand->Parametr[4].Value, sizeof(float)); memcpy((void *) &p_t.z, (void *) &pCommand->Parametr[5].Value, sizeof(float)); kam_3ds_anim(&p_p, &p_t, 0.0f, p_flag, 0, 10, 1.0f); } void trig_Do_Triger_Command(COMMAND * pCommand, int *p_flag) { switch (pCommand->iCommand) { case 2: trig_Do_MoveCameraTo(pCommand, p_flag); break; } } berusky2-0.12/src/kofola/init.h0000644000175000017500000000032513674426075013317 00000000000000#ifndef __INIT_ #define __INIT_ #include "Object.h" // nahraje databazi objektu int lsi_Load_Items(LEVELINFO * p_Level); // release datazabe void lsi_Release_Items(LEVELINFO * p_Level); #endif berusky2-0.12/src/kofola/2D_graphic.cpp0000644000175000017500000000334313674426075014654 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.2 //------------------------------------------------------------------------------------------------ #include #include #include #include "3d_all.h" #include "Berusky_universal.h" #include "2D_graphic.h" #include "Berusky3d_ini.h" //------------------------------------------------------------------------------------------------ // Rectangles //------------------------------------------------------------------------------------------------ void _2d_Clear_RectLine(RECT_LINE * p_rl) { memset(p_rl, 0, sizeof(RECT_LINE)); p_rl->rlast = 0; } int _2d_Is_InRectLine(RECT * rline, RECT * p_r, int size) { int i; for (i = 0; i < size; i++) { if (rline[i].bottom == p_r->bottom && rline[i].left == p_r->left && rline[i].right == p_r->right && rline[i].top == p_r->top) { return 1; } } return 0; } void _2d_Add_RectItem_IfNPresent(RECT_LINE * p_rl, RECT rect, int iLayer) { int i; for (i = 0; i < p_rl->rlast; i++) if (p_rl->rect[i].rect.bottom == rect.bottom && p_rl->rect[i].rect.left == rect.left && p_rl->rect[i].rect.right == rect.right && p_rl->rect[i].rect.top == rect.top) return; if (p_rl->rlast < DRAW_RECT_NUM) { p_rl->rect[p_rl->rlast].rect = rect; p_rl->rect[p_rl->rlast].iLayer = iLayer; p_rl->rect[p_rl->rlast].bUsed = 1; p_rl->rlast++; } } void _2d_Add_RectItem(RECT_LINE * p_rl, RECT rect, int iLayer) { if (p_rl->rlast < DRAW_RECT_NUM) { p_rl->rect[p_rl->rlast].rect = rect; p_rl->rect[p_rl->rlast].iLayer = iLayer; p_rl->rect[p_rl->rlast].bUsed = 1; p_rl->rlast++; } } berusky2-0.12/src/kofola/volume.cpp0000644000175000017500000000604113674426075014217 00000000000000#include "3d_all.h" //static HMIXER m_hMixer = NULL; /* static int m_dwVolumeControlID = 0; static long m_dwMinimum = 0; static long m_dwMaximum = 0; */ BOOL amdInitialize(HWND hwnd) { /* MIXERCAPS m_mxcaps; // get the number of mixer devices present in the system int m_nNumMixers = mixerGetNumDevs(); ZeroMemory(&m_mxcaps, sizeof(MIXERCAPS)); // open the first mixer // A "mapper" for audio mixer devices does not currently exist. if (m_nNumMixers != 0) { if(mixerOpen(&m_hMixer,0,0,0,MIXER_OBJECTF_MIXER) != MMSYSERR_NOERROR) { return FALSE; } if(mixerGetDevCaps((unsigned int) m_hMixer,&m_mxcaps, sizeof(MIXERCAPS)) != MMSYSERR_NOERROR) { return FALSE; } } kprintf(1, "Mixer: %s", m_mxcaps.szPname); */ return TRUE; } void amdUninitialize() { /* if (m_hMixer != NULL) { mixerClose(m_hMixer); m_hMixer = NULL; } */ return; } BOOL amdGetMasterVolumeControl() { /* MIXERLINE mxl; MIXERCONTROL mxc; MIXERLINECONTROLS mxlc; if (m_hMixer == NULL) { return FALSE; } // get dwLineID mxl.cbStruct = sizeof(MIXERLINE); mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS; if (mixerGetLineInfo((HMIXEROBJ)(m_hMixer),&mxl, MIXER_OBJECTF_HMIXER | MIXER_GETLINEINFOF_COMPONENTTYPE)!= MMSYSERR_NOERROR) { return FALSE; } // get dwControlID mxlc.cbStruct = sizeof(MIXERLINECONTROLS); mxlc.dwLineID = mxl.dwLineID; mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME; mxlc.cControls = 1; mxlc.cbmxctrl = sizeof(MIXERCONTROL); mxlc.pamxctrl = &mxc; if (mixerGetLineControls((HMIXEROBJ)(m_hMixer), &mxlc, MIXER_OBJECTF_HMIXER | MIXER_GETLINECONTROLSF_ONEBYTYPE)!= MMSYSERR_NOERROR) { return FALSE; } // store dwControlID m_dwMinimum = mxc.Bounds.dwMinimum; m_dwMaximum = mxc.Bounds.dwMaximum; m_dwVolumeControlID = mxc.dwControlID; */ return TRUE; } BOOL amdGetMasterVolumeValue(float *dwVal) { /* MIXERCONTROLDETAILS_UNSIGNED mxcdVolume; MIXERCONTROLDETAILS mxcd; if (m_hMixer == NULL) { return FALSE; } mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mxcd.dwControlID = m_dwVolumeControlID; mxcd.cChannels = 1; mxcd.cMultipleItems = 0; mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); mxcd.paDetails = &mxcdVolume; if (mixerGetControlDetails((HMIXEROBJ)(m_hMixer),&mxcd, MIXER_OBJECTF_HMIXER | MIXER_GETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR) { return FALSE; } *dwVal = mxcdVolume.dwValue / (float)(m_dwMaximum - m_dwMinimum); */ return TRUE; } BOOL amdSetMasterVolumeValue(float dwVal) { /* MIXERCONTROLDETAILS_UNSIGNED mxcdVolume; MIXERCONTROLDETAILS mxcd; if (m_hMixer == NULL) { return FALSE; } mxcdVolume.dwValue = m_dwMinimum + (int)floor((m_dwMaximum - m_dwMinimum) * dwVal); mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mxcd.dwControlID = m_dwVolumeControlID; mxcd.cChannels = 1; mxcd.cMultipleItems = 0; mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); mxcd.paDetails = &mxcdVolume; if (mixerSetControlDetails((HMIXEROBJ)(m_hMixer),&mxcd, MIXER_OBJECTF_HMIXER | MIXER_SETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR) { return FALSE; } */ return TRUE; } berusky2-0.12/src/kofola/water.h0000644000175000017500000000120713674426075013476 00000000000000#ifndef __WATER_ #define __WATER_ #define WATER_BOUNDARY_METHOD_RANDOM 1 #define WATER_BOUNDARY_METHOD_MAX_SIZE 2 #define WATER_BOUNDARY_METHOD_SIZE_HEURISTICS 3 typedef struct _WATER_BOUNDARY { float Top; float Bottom; float Left; float Right; float Height; float AspectRatio; float Size; struct _WATER_BOUNDARY *pNext; } WATER_BOUNDARY; typedef struct { WATER_BOUNDARY *pFirst; WATER_BOUNDARY *pLast; int iCount; } WATER_STRUCT; void w_Create_Water_Boundaries(void); void w_Release_Water_Boundaries(void); void w_Choose_Best_Boundary(WATER_BOUNDARY * pBoundary, float fx, float fy, float fz, int Method); #endif berusky2-0.12/src/kofola/Object.h0000644000175000017500000003526013674426075013570 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.6 //------------------------------------------------------------------------------------------------ #ifndef _OBJECT__ #define _OBJECT__ #include #include //#include #include "3d_all.h" #include "Berusky_universal.h" #include "Berusky3d_castice.h" #include "camera.h" #define _3DKOREKCE 40 #define SAVE_VER 2 #define DEMO_VER 1 #define PROFILE_VER 1 typedef struct { int Index; // index wavu int Type; // typ wavu } SOUND; typedef struct { int item[16]; // predmety char Count_of_Items; // pocet predmetu co nese char Max_Items; // maximalni pocet predmetu int Strength; // sila(kolik utlaci) } BACK_PACK; typedef struct { char File_Name[10][30]; // jmena souboru (mesh, textury) } SECONDDATADESC; typedef struct { int handle_materialove_animace; int handle_meshe; int cislo_objektu; } MATERIAL_BUNKA_K; typedef struct { int bSwitch; int Mesh; int iRot; int Flag; int iID; DWORD dwTime; int iAnimCount; int iSound; int iEffect; int iEffectCounter; } BEETLEANIMATION; typedef struct { char cType; int iFlag; } MATERIAL_EVENT; typedef struct { char Name[30]; // jmeno int GUID; // Glabal Uniqe Identificator int Class; // trida objektu int SubClass; // pod-trida objektu int Material; // material pro zvuky SOUND Specific[3]; // specificke zvuky SOUND Reserved[3]; // jine zvuky SECONDDATADESC Out_File; // ponechano pro pridavani prvku do databaze MATERIAL_EVENT MatEvent[3]; } OBJECTDESC; typedef struct { float pos[3]; int Flag; float nx[3]; float nz[3]; float dx; float dy; int Rotation; int Material; size_ptr pFlek; } FLEK_K; typedef struct { FLEK_K Flek; // flek prvku int iUroven; // uroven fleku FLEK_K *pExtFlek; // pointer na flek privazany k nemu jinym prvkem (napr. predmetem) } SQUAREDESC; typedef struct { OBJECTDESC *p_Object; // pointer na objekt int Pos[3]; // logicka pozice int Connection[2]; // vazby int Rotation; // natoceni int Index_Of_Game_Mesh; // mesh BACK_PACK *p_Back_Pack; // pointer na batoh (predmety) char bDestroed; // indikator, ze prvek se nepouziva RunHandle a_run; // animace int a_flag; // flag_animace int iItem; // jaky sem index v poli Itemu char bMatEvent[3]; // Flag pouziti jednotlivych eventu (pro animace) MATERIAL_BUNKA_K *mMaterial; // pointer material (komat) SQUAREDESC Square; // Informace o vecech s prvkem int _3ds_flag; // flaq 3ds animace (beruska,...) int hSvetlo; // handle svetla } ITEMDESC; typedef struct { uint32_t room; float size; char bsize; int32_t wall_occlusion; char bwall_occlusion; float wall_occlusionLF; char bwall_occlusionLF; float wall_occlusion_room; char bwall_occlusion_room; int32_t out_room; char bout_room; int32_t out_roomHF; char bout_roomHF; float out_room_rolloff; char bout_room_rolloff; float out_air_absorbtion; char bout_air_absorbtion; int32_t id; char extsoundf[64]; char bunderwater; } ENVIRONMENT; typedef struct { PAR_STREPINA *pCastice; int Sizeof; int flag; DWORD dwStart; } SYSTEMCASTIC; typedef struct { PAR_KOUR_STOPA *pCastice; size_ptr System; int Sizeof; int flag; size_ptr hHnizdo[64]; float dir[64][3]; float pivot[64][3]; float nx[64][3]; float ny[64][3]; DWORD dwStart; DWORD dwTime; DWORD dwStop; DWORD dwExpire; DWORD dwExpireTime; } SYSTEMKOUROVYCHCASTIC; typedef struct { PAR_KOUR_STOPA *pCastice; PAR_KOUR_STOPA *pWCastice; int SizeofCastice; int SizeofWCastice; size_ptr pSystem; size_ptr pWSystem; int flag; size_ptr *hHnizdo; size_ptr *hWHnizdo; int SizeofHnizda; int SizeofWHnizda; BOD dir; BOD nx; BOD ny; BOD Wnx; BOD Wny; BOD *pivot; BOD *Wpivot; BOD *Wpos; BOD RainCenter; unsigned int uiDensity; unsigned int uiIntensity; float fmaxDivergence; float fDist; float fSky; float fLowPlain; char bRain; char bWaterCircles; } RAINSYSTEM; typedef struct { PAR_KOUR_STOPA *pCastice; int SizeofCastice; size_ptr pSystem; int flag; size_ptr *hHnizdo; int SizeofHnizda; BOD dir; BOD *pivot; BOD SnowCenter; unsigned int uiDensity; unsigned int uiIntensity; float fmaxDivergence; float fDist; float fSky; float fLowPlain; char bSnow; } SNOWSYSTEM; typedef struct { int hSvetlo; char bMist; } MISTSYSTEM; typedef struct { int EffectID; PAR_KOUR_STOPA *pCastice; int SizeofCastice; size_ptr pSystem; int flag; size_ptr *hHnizdo; int SizeofHnizda; BOD *dir; int SizeofDir; BOD *pivot; int SizeofPivot; BOD *nx; int SizeofNX; BOD *ny; int SizeofNY; float fRadius; unsigned int uiDensity; unsigned int uiIntensity; float fSky; float fLowPlain; char bEffect; DWORD dwTime; DWORD dwRegTime; DWORD dwGenTime; DWORD dwGenTimeCounter; int iGenProbability; BOD AddDir; } NATUREEFFECTSYSTEM; typedef struct { SYSTEMCASTIC System; int hSvetlo[64]; size_ptr hFlare[64]; int iKourStopa; } SYSTEMZHAVYCHCASTIC; typedef struct { PAR_FLEK *pCastice; int Sizeof; int flag; DWORD dwStart; } SYSTEMFLEKCASTIC; typedef struct { FlareHandle pFlare; int hSvetlo; int hEXSvetlo; int hEXSvetloAnim; int mesh; float mSpeed; float Speed[14]; ITEMDESC *Item; void *pPointer; int Teleport; DWORD dwStart; } FLARESTRUCT; typedef struct { char bUnderWater; } SQUAREINFO; typedef struct { int mesh; int iItem; SYSTEMKOUROVYCHCASTIC System; int iStart; int bOn; } BUBLSYSTEM; typedef struct { DWORD dwTime; int actFrame; int forward; } MENUITEMANIM; typedef struct { int hSvetlo; int hEXSvetlo[2]; SYSTEMKOUROVYCHCASTIC System; int mesh; } EXITEFECT; typedef struct { int hSvetlo; float pos[3]; unsigned long eStart; unsigned long eCounter; unsigned long ePause; unsigned long epCounter; unsigned long dwEfTime; unsigned long dwRiseTime; unsigned long dwLightTime; float Speed; FlareHandle hFlare; float fdx; char bUsed; char bConnected; } STREET_LIGHT_EFFECT; typedef struct _KOFOLOVA_CARA2 { BOD p1, p2; BODRGB b1, b2; } KOFOLOVA_CARA2; typedef struct { size_ptr hWater; size_ptr hVodnik[3]; char bWater; } WATERDESC; typedef struct { DWORD dwTime; DWORD dwExpTime; DWORD dwRealTime; int iItem; SYSTEMKOUROVYCHCASTIC sStopy; int iStepc; } BEATLE_SMOKE_SYSTEM; typedef struct { PAR_KOUR_STOPA *pCastice; int csize; size_ptr hHnizdo; size_ptr pSystem; BOD pivot; BOD dir; float fLowPlain; int flag; DWORD dwTime; DWORD dwRegTime; RECT rScene; float pos[3]; float speed; float faire_dir[3]; int iSwampLight; float falngle[3]; float fmult[3]; float fsinspeed[3]; float fScene[6]; int iSound; } FAIRY_EFFECT; typedef struct { PAR_KOUR_STOPA *pCastice; int csize; size_ptr hHnizdo; size_ptr pSystem; BOD pivot; BOD dir; float fLowPlain; int flag; float pos[3]; float speed; int hSvetlo; } CANDLE_EFFECT; typedef struct { int Size[3]; // rozmery levelu int Count_Of_Objects; // pocet objektu int Count_Of_Items; // pocet predmetu int Count_Of_Action_Items; // pocet akcnich prvku int Size_of_Level; // velikost levelu OBJECTDESC *Object; // pointer na objekty ITEMDESC **Level; // mapa ITEMDESC *Item; // pointer na prvky long *Action_Item; // seznam spec. log. prvku (teleport, tkacitko,...) long *Anim_Item; // seznam prvku, ktere se konstantne // HWND hWnd; // hWnd aplikace long Actual_Item; // aktualni predmet (brouk) int status; // status hry int Column[3]; // nejzassi posouvany sloupec char bColumn; // identifikace jeho zvoleni int SecColumn[3]; char bSecColumn; char bExit; // identfifikater stoupnuti na exit char Level_Exit; // exit z levelu char Throw_off; // setrasat? int Base_Priority; // Zakladni priotita podle rychlosti CPU AUDIO_DATA *p_ad; // Audio Data char Item_Lock; // Zamikani predmetu char Move_Exeption; // Vijimka z pravidel posunu ENVIRONMENT Environment; // prostredi int Beetle[6]; // aktivni brouci; BEETLEANIMATION BeetleAnim[6]; // meshe brouku; char Beetle_Index; // index aktivniho brouka v strukture Beetle char Sikmina_Flag; // flag se nastavi, jestlize se sunulo na sikminu char Sikmina_FlagOld; // udrzuje posledni flag na sikminu; int Actual_Qset; // actual queue set int Actual_Anim_Qset; // actual animation queue set char bCheck_Result; // retrun value of gl_Check_Logical_Dependences char bCheck; // retrun value of gl_Throwoff_Test char Flip; // if animation set must be fliped char bAllow_Key; // player is allows to press next key ITEMDESC *pWall; // pointer na zed v levelu. Pouziva se u vytahu char bInventory; // kresleni inventorare char bLInventory; char bTopLedge; // kresleni horni listy char bLastTopLedge; char bSikminaSound; // slo se pres sikminu MATERIAL_BUNKA_K *pMaterialb; // seznam animujicich se materuali int iMaterialb; // pocet animujicich se materialu SQUAREDESC *pSquare; // informace o spodnim patre (fleky,...) char bSunuti; // indikator, zda beruska neco sune; char bVypniFlek; // indikator, ze se musi vypnout flek char bTriger; // indikator, trigeru SYSTEMCASTIC Exploze[20]; // 10 predvyrobenych vybuchu SYSTEMCASTIC Jiskra[20]; // 10 predvyrobenych vybuchu zhavych strepin SYSTEMCASTIC Propadla[20]; // 10 predvyrobenych propadel SYSTEMCASTIC Kamen[20]; // 10 predvyrobenych kamen SYSTEMCASTIC Krompac[10]; // 10 rozpad krompace int TrashFlag; // odpadni flag char bPohled_Berusky; // indikator pohledu berusky float fVitr[3]; // vitr v levelu SYSTEMZHAVYCHCASTIC ZhaveCastice[20]; // castice se zhavimi strepinamy (svetly) SYSTEMKOUROVYCHCASTIC KourovaStopa[20]; // system kourovych stop SYSTEMKOUROVYCHCASTIC Kour[20]; // kour po vybuchu; SYSTEMKOUROVYCHCASTIC KourKameni[20]; // kour po vybuchu; BEATLE_SMOKE_SYSTEM BeatleSmoke[6]; SYSTEMKOUROVYCHCASTIC KourUst[10]; // kour z ust; SYSTEMFLEKCASTIC Prach[20]; // zvyrany prach po dopadu char Sub_Svetla; // flag, zda pouzivat sub svetla LEVEL_HEADER LevelHeader; // hlavicka nahraneho levelu char bSikminaUp; // posun bedny na sikminu smerem navrch char bSikminaDown; char bSikminaUpExeption; // vijimka na animaci na na sikmine FLARESTRUCT Flare[20]; // flary teleportu SYSTEMKOUROVYCHCASTIC TeleportSparks[20]; // jiskry po teleportaci SYSTEMKOUROVYCHCASTIC LiftParticles[10]; // caticky odpadavajici z vitahu za jizdy SYSTEMKOUROVYCHCASTIC LiftVParticles[10]; // caticky odpadavajici z vitahu za jizdy SYSTEMKOUROVYCHCASTIC VodniKola[10]; // kona na vode SYSTEMKOUROVYCHCASTIC VodniKolaB[100]; // kona na vode po pohybujicich se prvcich // (beruska, bedna,...) SYSTEMCASTIC VodniCakanec1[10]; // System tvorici hnanove castice pri dopadu // bedny do vody SYSTEMCASTIC VodniCakanec2[10]; // System tvorici hnanove castice pri dopadu // bedny do vody int LastMesh; // mesh posledniho prvku FLEK_K SelectionFlek; // flek ukazujici vybranou berusku SQUAREINFO *Square; BUBLSYSTEM BublSystem[6]; // system pro bublinky berusek pod vodou BUBLSYSTEM BublSystemE; // nature effect bubl system BUBLSYSTEM BublSystemC; // nature effect bubl system SYSTEMKOUROVYCHCASTIC BublVybuch[20]; // vybuch z bublin char bPosouvatKameru; // ma se posouvat kamera s beruskou? int KvalitaCastic; // kvalita castic int KvalitaCasticV; // kvalita castic vody MENUITEMANIM MenuItemAnim[6]; // animace predmetu v inventorari char bMenuRunning; // indikuje, ze bezi menu char bMenuButton; // je nad tlacitkem menu EXITEFECT ExitEfect[10]; // efekt exitu SYSTEMKOUROVYCHCASTIC ExitSparks[10]; // konstantni efekt exitu SYSTEMKOUROVYCHCASTIC TelCSparks[10]; // konstantni efekt teleportu SYSTEMKOUROVYCHCASTIC BarelSparks[30]; // konstantni efekt barelu KOFOLOVA_CARA2 *pCara; // list cas ke kresleni RAINSYSTEM Rain; // system na dest SNOWSYSTEM Snow; // system na snih NATUREEFFECTSYSTEM NatureESystem[10]; // system prirodnich efektu (chmiri,...) WATERDESC Water; // vlny na vode MISTSYSTEM Mist; // mlha long lLastKeyCounter; char bMultiConnect; char bCheckDependencesNeeded; char bB1ExtraCameraRot; CAMERA_STRUCT lCamera; long lLevel_Exitc; char bSetStep; int iNSrart; char bUnderWaterLevel; char bExtraSoundSunuti; STREET_LIGHT_EFFECT StreetL[8]; STREET_LIGHT_EFFECT SwampL[10]; RAINSYSTEM StreetRain; char bResetini; char bSaveDemo; FAIRY_EFFECT FairyEffect[4]; int iFloorMaterial; STREET_LIGHT_EFFECT StarL[200]; FAIRY_EFFECT StarFall[2]; CANDLE_EFFECT CandleEffect[6]; CANDLE_EFFECT CandleSmoke[6]; char cLevelName[64]; char cLoadedFrom[256+1]; DWORD dwPlayTime; DWORD dwStartTime; int iNumOfSteps; int iWalkAnimation; char bStone; char bStoneSound; char bSikminaMoveExeption; int iCursor; int iKursorMesh; RunHandle iKursorAnimation; char bRestart; int iMessageBoxReturn; char bCancelMenu; char bReturnToMenu; DWORD dwLastMusicCheck; char bDemoSaveExeption; char bGameResume; } LEVELINFO; typedef struct { ITEMDESC Item; int GUID; int mesh; } SAVE_FILE_ITEM; extern int PRCameraFlag; //indikator, ze je pozno pohybovat kamerou pomoci P&R extern int PRCameraFlagChange; // byl pozit pohyb pomoci P&R int gl_Get_Active_Beetle_Mesh(void); // musi se volat az po kom_prvotni_init void gl_Get_PR_ScanCode(int *pPScan, int *pRScan); void gl_Kofola_Minimalize(void); void gl_Kofola_Maximalize(void); int gl_Allow_Key(int iScanCode); void gl_Kofola_End(int InMenu); extern char bInMenu; #endif berusky2-0.12/src/kofola/animend_functions.h0000644000175000017500000000534413674426075016065 00000000000000#ifndef __ANMEND_ #define __ANMEND_ #include "Object.h" typedef struct { LEVELINFO *p_Level; void *pParam; int iParam; char bParam; char bRCamera; int viParam1[3]; int viParam2[3]; } POINTERSTRUCTURE; void anmend_PadBedny(size_ptr param, size_ptr param2, size_ptr param3); void anmend_ExplozeBedny(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Lift(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Steps(size_ptr param, size_ptr param2, size_ptr param3); void anmend_StepsSikmina(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Steps2(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Water(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Cakanec(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Item_Fall(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Item_FallStartAnim(size_ptr param, size_ptr param2, size_ptr param3); void animend_Lift_End(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Send_Event(size_ptr param, size_ptr param2, size_ptr param3); void anmend_ExplozeBednyZaSikminou(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Set_Flek_Flag(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Take_Item(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Kamen(size_ptr param, size_ptr param2, size_ptr param3); void anmend_ZrusCastice(size_ptr param, size_ptr param2, size_ptr param3); void anmend_ZrusCastice2(size_ptr param, size_ptr param2, size_ptr param3); void anmend_ZrusCastice3(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Are_Animations_Done(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Tlacitko(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Teleport(size_ptr param, size_ptr param2, size_ptr param3); void anmend_TeleportStart(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Add_Beetle_Animation(size_ptr param, size_ptr param2, size_ptr param3); void anmend_WaterLift(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Exit(size_ptr param, size_ptr param2, size_ptr param3); void anmend_kom_mesh_set_mesh(size_ptr param, size_ptr param2, size_ptr param3); void anmend_kom_mesh_set_mesh(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Play_Sunuti(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Set_Flek_Flag_Anim(size_ptr param, size_ptr param2, size_ptr param3); void anmend_Lift_Item(size_ptr param, size_ptr param2, size_ptr param3); void anmend_KamenZaSikmonou(size_ptr param, size_ptr param2, size_ptr param3); void anmend_PlayKrumpac(size_ptr param, size_ptr param2, size_ptr param3); void anmend_kom_mesh_set_meshK(size_ptr param, size_ptr param2, size_ptr param3); #endif berusky2-0.12/src/kofola/3D_graphic.h0000644000175000017500000000242013674426075014315 00000000000000#ifndef __3D_GRAPHIC_ #define __3D_GRAPHIC_ typedef struct { int x; int tx; int y; int ty; EDIT_TEXT text; } HINT_TEXTURE; typedef struct { EDIT_TEXT_KONFIG konf; char bVLoaded; char bSLoaded; int x; int y; int tx; int ty; char *data; } _3D_TEXTURE; typedef struct { int count; int last; char bm_dir[MAX_FILENAME]; EDIT_TEXT *p_texture; _3D_TEXTURE *p_sysramtexture; int bMenuVRAMLoad; } _3D_DATA; typedef struct { int idx; int idy; int iaddx; int iaddy; } _3D_CURSOR; void _3d_Begin_Draw(void); void _3d_End_Draw(void); void _3d_Set_Mask(void); void _3d_Set_Smooth(void); // Draws box in 3d device // int i, float {left, top, right, bottom} void _3d_Draw_Box(int i, float *vfPoint); // init 3d int _3d_Init(void); // release 3d void _3d_Release(void); // release texture void _3d_Release_Texture(int Index); // load texture int _3d_Load_Texture(char *p_File_Name, int Index, char bVideoRAM, char bSeek); // load list of textures int _3d_Load_List(char *p_File_Name); void _3d_Load_From_Sys_To_Video(int iStart); void _3d_Release_From_Video(int iStart); void _3d_Gen_Hints(HINT_TEXTURE * bTexture, int tsize); void _3d_Release_Hints(HINT_TEXTURE * bTexture, int tsize); #endif berusky2-0.12/src/kofola/game_init.cpp0000644000175000017500000001355513674426075014654 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.1 //------------------------------------------------------------------------------------------------ #include #include #include "adas.h" //------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include "compat_mini.h" #include "game_init.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky_universal.h" extern HW_KONFIG hwconf; extern char pSndDir[MAX_FILENAME]; int iWinVer = 0; void gi_Set_Win_Version(void) { /* OSVERSIONINFO osvi; ZeroMemory( &osvi, sizeof( osvi ) ); osvi.dwOSVersionInfoSize = sizeof( osvi ); if(GetVersionEx( &osvi )) iWinVer = (osvi.dwMajorVersion * 100) + osvi.dwMinorVersion; kprintf(1, "Sytem info: Windows v%d.%d build %d - platform ID %d", osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.dwPlatformId); */ } /* int gi_EnumDisplaySettings(DEVMODE *pdevmode) { return EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, pdevmode); } */ /* int gi_APAK_Load(unsigned long mem, struct _finddata_t *pData) { char *pMem; apuInt size; FILE *file; if(!pData) return(FALSE); file = aopen(pSndArchive, pData->name,"rb"); if(!file) { kprintf(1, "%s: %s", pData->name, pSndArchive->cError); return(FALSE); } agetbuffer(file, &pMem, &size); int ret = (!mem) ? adas_Load_FirstMemory("index.dat",pMem,size,pData->name) : adas_Load_NextMemory(pMem, size, pData->name); aclose(file); return(ret); } */ //------------------------------------------------------------------------------------------------ // nahodi sound engine //------------------------------------------------------------------------------------------------ void gi_Init_Sound_Engine(AUDIO_DATA *p_ad) { char text[MAX_FILENAME]; ADAS_INIT_DATA init_data; //unsigned long max_mem; //unsigned long mem = 0; // long Done,error; // struct _finddata_t Data; float listenerPos[]={0.0,0.0,0.0}; float listenerVel[]={0.0,0.0,0.0}; float listenerOri[]={0.0,0.0,1.0, 0.0,1.0,0.0}; int iValue; const char *cString; int iLowV, iHiV; init_data.Channels = GetPrivateProfileInt("soundengine","channels",8,ini_file); #ifdef WINDOWS init_data.Implementation = "DirectSound3D"; #else init_data.Implementation = NULL; #endif p_ad->Max_Sources = init_data.Channels; //p_ad->hWnd = hWnd; ap_Init(p_ad); //max_mem = GetPrivateProfileInt("soundengine","pre_load",0,ini_file); iValue = GetPrivateProfileInt("soundengine","soundvolume",0,ini_file); p_ad->Sound_Gain = (float)(iValue/100.0f); iValue = GetPrivateProfileInt("soundengine","musicvolume",0,ini_file); p_ad->Music_Gain = (float)(iValue/100.0f); iValue = GetPrivateProfileInt("soundengine","ambientvolume",0,ini_file); p_ad->Ambient_Gain = (float)(iValue/100.0f); init_data.Scale_Factor = 0.005f; iValue = GetPrivateProfileInt("game","no_sound",0,ini_file); adas_OGG_Init(); if(!iValue) { adas_Reset_Last_Error(); kprintf(1,"Init Sound Engine..."); adas_Init(&init_data); if (adas_Get_Last_Error(text,MAX_FILENAME)) { //MessageBox(hWnd,text,"Error",MB_OK); kprintf(1,text); //MyMessageBox(hwnd_hry, "##error_title", "##adas_init_error",""); p_ad->bAudio = 0; } else { if (adas_Get_Last_Warning(text,MAX_FILENAME)) { //MessageBox(hWnd,text,"Error",MB_OK); kprintf(1,text); } adas_Get_Version(&iHiV, &iLowV); kprintf(1, "AnakreoN Digital Audio System v%d.%d", iHiV, iLowV); cString = alGetString(AL_VENDOR); kprintf(1, "Vendor: %s", cString); cString = alGetString(AL_VERSION); kprintf(1, "Version: %s", cString); cString = alGetString(AL_RENDERER); kprintf(1, "Renderer: %s", cString); cString = alGetString(AL_EXTENSIONS); kprintf(1, "Extensions: %s", cString); p_ad->bAudio = 1; if (chdir(p_ber->dir.sound_dir)) { kprintf(1, "Cannot change directory to %s: %s", p_ber->dir.sound_dir, strerror, errno); return; } ap_Load_Sound_List(p_ad, "basicset.dat", 0); /* kprintf(1,"Memory for waves: %.1fMB", max_mem / 1000000.0f); kprintf(1,"Loading waves..."); Done = afindfirst(pSndArchive, "*.wav",&Data); error = Done; while ((error != -1) && (mem < max_mem)) { if ((error != -1) && ((mem + Data.size) < max_mem)) { adas_Reset_Last_Error(); gi_APAK_Load(mem, &Data); if (adas_Get_Last_Error(text,MAX_FILENAME)) { kprintf(1,"File not found: index.dat"); } else mem += Data.size; } error = afindnext(Done,&Data); } afindclose(Done);*/ kprintf(1,"Distance Model: AL_INVERSE_DISTANCE_CLAMPED"); adas_Set_Distance_Model(AL_INVERSE_DISTANCE_CLAMPED); kprintf(1,"Doppler Factor: 1.0"); adas_Set_Doppler_Factor(1.0f); kprintf(1,"Doppler Velocity: 343.0"); adas_Set_Doppler_Velocity(343.0f); kprintf(1,"Setting Listener..."); adas_Reset_Last_Error(); adas_Set_Listener_Position(listenerPos); adas_Set_Listener_Velocity(listenerVel); adas_Set_Listener_Orientation(listenerOri); adas_Set_Listener_Environment(EAX_ENVIRONMENT_GENERIC); if (adas_Get_Last_Error(text,MAX_FILENAME)) { //MyMessageBox(hwnd_hry, "##error_title", "##adas_init_error",""); //MessageBox(hWnd,text,"Error",MB_OK); kprintf(1,text); } } } else p_ad->bAudio = 0; } //------------------------------------------------------------------------------------------------ // ukonci sound engine //------------------------------------------------------------------------------------------------ void gi_Release_Sound_Engine(void) { kprintf(1,"Release loaded waves..."); adas_Release_Loaded_Data(); kprintf(1,"Release sound engine..."); adas_Exit(); } berusky2-0.12/src/kofola/3D_menus.h0000644000175000017500000000233513674426075014034 00000000000000#ifndef __3D_MENUS_ #define __3D_MENUS_ typedef struct { float x, y; int iHint; char bHint; DWORD dwTCounter; } HINT_STATE; typedef struct { float x; float y; EDIT_TEXT text; DWORD dwTCounter; float Speed; int iState; char bKUK; } KUK_STATE; void _3d_Draw_Menus(char *bCursor, int *Cursor_Time_Out, LEVELINFO * p_Level, int act_item, int *p_Return, int demo); int _3d_Check_Beatle_Select(void); int _3d_Is_There_Beetle(int SubClass, LEVELINFO * p_Level); void _3d_Load_Animations(void); int _3d_Start_Animation(int iIndex, float *vfLocation, int *pFlag); void _3d_Run_Cibule(void); void _3d_Cancel_Animations(LEVELINFO * p_Level); void _3d_Draw_Inventory(void); void _3d_Draw_MenusB(LEVELINFO * p_Level, int act_item, char *bCursor, int bTutor, int bTText, int ty); void _3d_Display_Hint(LEVELINFO * p_Level); void _3d_Display_Hint_Inventory(LEVELINFO * p_Level, ITEMDESC * pItem, int idx, int x, int y); void _3d_Nahraj_Kuk(void); void _3d_Release_Kuk(void); void _3d_Load_Indikace(void); int _3d_Draw_MessageBox(int iMessage); void _3d_Cancel_Menu(LEVELINFO * p_Level); void _3d_Stop_Menu_Select(void); #endif berusky2-0.12/src/kofola/game_main.cpp0000644000175000017500000001440713676411410014617 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.2 //------------------------------------------------------------------------------------------------ #include #include #include "compat_mini.h" #include "game_init.h" #include "game_logic.h" #include #include "config.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "2D_graphic.h" #include "3D_graphic.h" #include "3D_menus.h" #include "Menu.h" #include "Comics.h" #include "font.h" #include "profiles.h" #include "Menu.h" #include "Menu2.h" #include "utils.h" char pBmpDir[MAX_FILENAME] = { 0 }; char pControlsDir[MAX_FILENAME] = { 0 }; char p3DMDir[MAX_FILENAME] = { 0 }; char pSndDir[MAX_FILENAME] = { 0 }; char pDataDir[MAX_FILENAME] = { 0 }; char pGDataDir[MAX_FILENAME] = { 0 }; char CurrentWorkingDirectory[MAX_FILENAME]; int bWindowMenu; extern int iWinVer; extern HINT_TEXTURE pHintTexture[26]; extern PLAYER_PROFILE pPlayerProfile; extern AUDIO_DATA ad; extern int iActualScene; extern int iActualLevel; extern int bScreenshot; char bInMenu = 0; int bScreenshot = 0; char cFontDir[5][64]; // Save a screenshot. void do_screenshot(int signal) { // We can't call gl_Make_Screenshot directly, because it isn't // async-signal-safe. So set a flag instead, and let flip() do the // work. bScreenshot = 1; } //------------------------------------------------------------------------------------------------ // kostra behu hry //------------------------------------------------------------------------------------------------ int winmain_Game_Run(char *p_Level_Name) { TIMER_ID Timer_ID; int cpu; char bGame = strlen(p_Level_Name); char filename[MAX_FILENAME]; struct sigaction act; // Save a screenshot on SIGUSR1. act.sa_handler = do_screenshot; sigemptyset(&(act.sa_mask)); act.sa_flags = 0; // Errors should never occur. if (sigaction(SIGUSR1, &act, NULL)) assert(0); ShowCursor(FALSE); cpu = sizeof(AUDIO_DATA); kprintf(1, "Kofola - verze zdrojaku: MASTER %s", VERSION); gi_Set_Win_Version(); if (getcwd(CurrentWorkingDirectory, MAX_FILENAME) == NULL) return 0; srand((unsigned) time(NULL)); get_dir_setting("files", "bitmap_subdir", "bitmap_pak", "bitmap", filename, MAX_FILENAME, ini_file); construct_path(pBmpDir, MAX_FILENAME, 2, p_ber->dir.bitmap_dir, filename); for (int i = 0; i < 5; i++) { char dir[64], pak[64]; const char *const default_dirs[5] = { "font_en", "font3d_en", "font_system_en", "font_system2_en", "font_system3d_en" }; snprintf(dir, sizeof(dir), "font_dir%d", i + 1); snprintf(pak, sizeof(pak), "font_pak%d", i + 1); get_dir_setting("files", dir, pak, default_dirs[i], cFontDir[i], 64, ini_file); kprintf(1, "font_dir%d = %s", i + 1, cFontDir[i]); } construct_path(pControlsDir, MAX_FILENAME, 2, p_ber->dir.bitmap_dir, "controls"); construct_path(pSndDir, MAX_FILENAME, 2, p_ber->dir.sound_dir, "sound"); get_dir_setting("files", "3dmenu_dir", "3dmenu_pak", "3dmenu", filename, MAX_FILENAME, ini_file); construct_path(p3DMDir, MAX_FILENAME, 2, p_ber->dir.bitmap_dir, filename); strncpy(pDataDir, p_ber->dir.data_dir, MAX_FILENAME); strncpy(pGDataDir, p_ber->dir.game_data_dir, MAX_FILENAME); gi_Init_Sound_Engine(&ad); if (chdir(p_ber->dir.music_dir)) return 0; ap_Load_Play_List("play_list.dat",&ad); if (chdir(p_ber->dir.sound_dir)) return 0; ap_Load_Material_List("material.dat", &ad); if (!bGame) { InitDirectDraw(); spracuj_spravy(0); } if (bGame) { int ret = sscanf(p_Level_Name, "level%d.lv6", &iActualLevel); assert(ret == 1); // Search for the scene this level is in. for (iActualScene = 0; iActualScene < 13; iActualScene++) { char cTmp[64]; int iTmp; int iLevelStart, iNumOfLevels; GetRunMenuNewGameSceneLoadGame(cTmp, cTmp, cTmp, cTmp, &iLevelStart, &iNumOfLevels, &iTmp, &iTmp, cTmp, &iTmp, &iTmp); if (iActualLevel >= iLevelStart && iActualLevel < iLevelStart + iNumOfLevels) break; } assert(iActualScene < 13); RunMenuLoadScreen2(); RunMenuLoadScreenInitBar(15); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); _3d_Init(); _3d_Load_List("3d_load.dat"); _3d_Gen_Hints(pHintTexture, 26); if (!fn_Set_Font(cFontDir[1])) { kprintf(1, "Unable to set font!"); return 0; } if (!fn_Load_Bitmaps()) kprintf(1, "Unable to load font bitmaps"); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); } if (!bGame) { //schovej_konzoli(); SetCursor(NULL); ddxInit(); RunMenuCinemax(); ap_Play_Song(0, 0, &ad); ddxLoadList("2d_load.dat", 1); if (!fn_Set_Font(cFontDir[0])) { return 0; } if (!fn_Load_Bitmaps()) kprintf(1, "Unable to load font bitmaps"); } if (bGame) { pr_ReadProfile("Default", &pPlayerProfile); SetCursor(NULL); Timer_ID = SetTimer(NULL, 0, 250, (TIMERPROC) gl_Set_Frame_Rate); _3d_Load_Indikace(); char cenv[64] = "default.env"; gl_Run_Level(p_Level_Name, cenv, &ad, cpu); _3d_Release_Hints(pHintTexture, 26); KillTimer(NULL, Timer_ID); } else { SetCursor(NULL); ShowCursor(FALSE); RunMenu("mainmenu.txt", NULL, &ad, cpu); } if (ogg_playing()) ap_Stop_Song(&ad); if (!bGame) { /*_2d_Blackness(); _2d_Release();*/ ddxRelease(); FreeDirectDraw(); } else { //fn_Release_Font(); _3d_Release(); } //kprintf(1, "cmcs_Play_Intro"); //cmcs_Play_Intro("gamelogo.txt", hWnd, &ad); //kprintf(1, "release FONT"); //fn_Release_Font(); kprintf(1, "gi_Release_Sound_Engine"); gi_Release_Sound_Engine(); kprintf(1, "ap_Release_Play_List"); ap_Release_Play_List(&ad); kprintf(1, "ap_Release_Material_List"); ap_Release_Material_List(&ad); kprintf(1, "ap_Release"); ap_Release(&ad); //ChangeDisplaySettings(NULL,0); //ShowWindow(hwnd_hry, SW_MAXIMIZE); spracuj_spravy(0); ShowCursor(TRUE); spracuj_spravy(0); //UnloadTransparentBlt(); //MSS_LOG_BLOCK_LIST; //DestroyWindow(hwnd_hry); exit(0); return 0; } berusky2-0.12/src/kofola/font.h0000644000175000017500000000330713674426075013325 00000000000000//------------------------------------------------------------------------------------------------ // 1.0.0 //------------------------------------------------------------------------------------------------ #ifndef __FONT_ #define __FONT_ #include #include "trigers.h" #include "3D_graphic.h" #include "3d_all.h" #include "Berusky_universal.h" #define FONT_MAX_BMP 16 typedef struct _B2_FONT { int iBitmap[FONT_MAX_BMP]; char dir[FILENAME_MAX]; GRAMMAR gr; TRIGER_STRUCTURE ts; GAME_TRIGER gt; EDIT_TEXT tex[FONT_MAX_BMP]; EDIT_TEXT_KONFIG konf[FONT_MAX_BMP]; WCHAR *pTBuffer; size_t iTSize; FILE *file; COLORREF tcolor; int iYPlus; int iXPlus; int *pTTable; int iMaxCharValue; } B2_FONT; int fn_Set_Font(char *cDir); void fn_Release_Font(int bTextures); void fn_Release_3d_Textures_Full(void); void fn_Release_3d_Textures(void); void fn_Load_Textures_From_RAM(void); int fn_Load_Bitmaps(void); void fn_Test(int hdc); void fn_Test2(int hdc); void fn_Texture(int iSection); //HDC fn_CreateDC(HDC hdc, int x, int y, int _2dd_idx); int fn_Gen_Menu(void); int fn_Gen_Menu_Text(int iSection, int hdc, char *cText, int *i1, int *i2); void fn_Convert_Rect(char *cFile, int xmax, int ymax); void fn_Draw_Draw_Frames(void); bool fn_Draw_Message(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXmax, int *iYmax); bool fn_Draw_MessageA(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cText, int iSection, int *iXmax, int *iYmax); //int fn_DC2Tex(HDC hdc, int xr, int yr, int turn, int texture); int fn_Get_Font_Texture(int iSection, char *cText); #endif berusky2-0.12/src/kofola/ambient_sounds.cpp0000644000175000017500000004031513674426075015724 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.1 //------------------------------------------------------------------------------------------------ #include "compat_mini.h" #include "adas.h" #include "audio_plug-in.h" #include "ambient_sounds.h" #include #include "3d_all.h" #include "Object.h" static long amb_counter[3]; void as_Start_Env23(int i, AUDIO_DATA * p_ad, float *pos, char bRelative) { int r = rand() % 2; ap_Play_Sound(2, bRelative, 1, pos, i + r, NULL, p_ad); } //------------------------------------------------------------------------------------------------ // starts environment //------------------------------------------------------------------------------------------------ void as_Start(int Env_ID, AUDIO_DATA * p_ad, void *p_Level) { float pos[3] = { 0.0f, 0.0f, 0.0f }; int source; LEVELINFO *p_L = (LEVELINFO *) p_Level; //EAX_DATA Eax; for (source = 0; source < 3; source++) amb_counter[source] = 0; if (p_L->Environment.bwall_occlusion) p_ad->Eax.wall_occlusion = p_L->Environment.wall_occlusion; else p_ad->Eax.wall_occlusion = UNDEFINED_VALUE; if (p_L->Environment.bwall_occlusion_room) p_ad->Eax.wall_occlusion_room = p_L->Environment.wall_occlusion_room; else p_ad->Eax.wall_occlusion_room = (float) UNDEFINED_VALUE; if (p_L->Environment.bwall_occlusionLF) p_ad->Eax.wall_occlusionLF = p_L->Environment.wall_occlusionLF; else p_ad->Eax.wall_occlusionLF = (float) UNDEFINED_VALUE; if (p_L->Environment.bout_room) p_ad->Eax.out_room = p_L->Environment.out_room; else p_ad->Eax.out_room = UNDEFINED_VALUE; if (p_L->Environment.bout_room_rolloff) p_ad->Eax.out_room_rolloff = p_L->Environment.out_room_rolloff; else p_ad->Eax.out_room_rolloff = (float) UNDEFINED_VALUE; if (p_L->Environment.bout_roomHF) p_ad->Eax.out_roomHF = p_L->Environment.out_roomHF; else p_ad->Eax.out_roomHF = UNDEFINED_VALUE; if (p_L->Environment.bout_air_absorbtion) p_ad->Eax.out_air_absorbtion = p_L->Environment.out_air_absorbtion; else p_ad->Eax.out_air_absorbtion = (float) UNDEFINED_VALUE; p_ad->Eax.Obstruction = UNDEFINED_VALUE; p_ad->Eax.ObstructionLF = (float) UNDEFINED_VALUE; switch (Env_ID) { case 0: ap_Play_Sound(2, 1, 1, pos, 4, &(p_ad->Eax), p_ad); break; case 2: as_Start_Env23(90, p_ad, pos, 1); break; case 3: ap_Play_Sound(2, 1, 1, pos, (rand() % 3) + 111, NULL, p_ad); break; case 4: { pos[0] = 10; pos[1] = 0; pos[2] = -40; as_Start_Env23(92, p_ad, pos, 0); p_ad->Eax.Obstruction = p_ad->Eax.wall_occlusion; p_ad->Eax.ObstructionLF = p_ad->Eax.wall_occlusionLF; p_ad->Eax.wall_occlusion = UNDEFINED_VALUE; p_ad->Eax.wall_occlusionLF = (float) UNDEFINED_VALUE; p_ad->Eax.wall_occlusion_room = (float) UNDEFINED_VALUE; } break; case 10: ap_Play_Sound(2, 1, 1, pos, 4, &(p_ad->Eax), p_ad); break; case 9: as_Start_Env23(129, p_ad, pos, 1); as_Start_Env23(131, p_ad, pos, 1); break; case 11: ap_Play_Sound(2, 1, 1, pos, 128, &(p_ad->Eax), p_ad); break; case 13: ap_Play_Sound(2, 1, 1, pos, 150, &(p_ad->Eax), p_ad); break; } } //------------------------------------------------------------------------------------------------ // Thunder //------------------------------------------------------------------------------------------------ void as_Thunder(AUDIO_DATA * p_ad, void *p_Level) { int index, rnd; float pos[3]; // LEVELINFO *p_L = (LEVELINFO *)p_Level; index = rand() % 4; pos[0] = (float) (rand() % 500); rnd = rand() % 2; if (rnd) pos[0] *= -1; pos[1] = (float) (rand() % 500); pos[2] = (float) (rand() % 500); rnd = rand() % 2; if (rnd) pos[0] *= -1; ap_Play_Sound(1, 0, 1, pos, index, &(p_ad->Eax), p_ad); } //------------------------------------------------------------------------------------------------ // Bird //------------------------------------------------------------------------------------------------ void as_Bird(int Bird, AUDIO_DATA * p_ad, void *p_Level) { int rnd; float pos[3]; // LEVELINFO *p_L = (LEVELINFO *)p_Level; pos[0] = (float) (rand() % 200); rnd = rand() % 2; if (rnd) pos[0] *= -1; pos[1] = (float) (rand() % 20); pos[2] = (float) (rand() % 200); rnd = rand() % 2; if (rnd) pos[0] *= -1; ap_Play_Sound(1, 0, 1, pos, Bird, &(p_ad->Eax), p_ad); } //------------------------------------------------------------------------------------------------ // Rat //------------------------------------------------------------------------------------------------ void as_Rat(int Rat, AUDIO_DATA * p_ad, void *p_Level) { int rnd; float pos[3]; pos[0] = (float) (rand() % 20); rnd = rand() % 2; if (rnd) pos[0] *= -1; pos[1] = 0; pos[2] = (float) (rand() % 20); rnd = rand() % 2; if (rnd) pos[0] *= -1; ap_Play_Sound(1, 0, 1, pos, Rat, NULL, p_ad); } //------------------------------------------------------------------------------------------------ // Thunder //------------------------------------------------------------------------------------------------ void as_Bell(AUDIO_DATA * p_ad, void *p_Level) { float pos[3] = { -50.0f, 5.0f, 20.0f }; // LEVELINFO *p_L = (LEVELINFO *)p_Level; amb_counter[0]++; if (amb_counter[0] > 2400) { amb_counter[0] = 0; amb_counter[1]++; } if (amb_counter[1]) { if (amb_counter[1] > 5) { amb_counter[1] = 0; amb_counter[2] = 0; } amb_counter[2]++; if (amb_counter[2] > 12) { amb_counter[2] = 0; amb_counter[1]++; ap_Play_Sound(1, 0, 1, pos, 13, &(p_ad->Eax), p_ad); } } } //------------------------------------------------------------------------------------------------ // Bird //------------------------------------------------------------------------------------------------ void as_Car(int Car, AUDIO_DATA * p_ad, void *p_Level, float fPos2) { float pos[3]; pos[0] = 0.0f; pos[1] = 0.0f; pos[2] = fPos2; ap_Play_Sound(1, 1, 1, pos, Car, &(p_ad->Eax), p_ad); } void as_Car4(int Car, AUDIO_DATA * p_ad, void *p_Level) { float pos[3]; pos[0] = 0.0f; pos[1] = 200.0f; pos[2] = 0.0f; ap_Play_Sound(1, 1, 1, pos, Car, &(p_ad->Eax), p_ad); } //------------------------------------------------------------------------------------------------ //pokoj + balkon //------------------------------------------------------------------------------------------------ void ad_Do_Environment1(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; if (rnd < 10) as_Thunder(p_ad, p_Level); rnd = rand() % 400; if (rnd < 7) switch (rnd1) { case 0: as_Bird(8, p_ad, p_Level); break; case 1: as_Bird(9, p_ad, p_Level); break; case 2: as_Bird(10, p_ad, p_Level); break; case 3: as_Bird(11, p_ad, p_Level); break; case 4: as_Bird(12, p_ad, p_Level); break; } as_Bell(p_ad, p_Level); rnd = rand() % 400; if (rnd < 10) switch (rnd1) { case 0: as_Car(5, p_ad, p_Level, -1000.0f); break; case 1: as_Car(6, p_ad, p_Level, -1000.0f); break; case 2: as_Car(7, p_ad, p_Level, -1000.0f); break; case 3: as_Car(138, p_ad, p_Level, -1000.0f); break; } } void ad_Do_Environment2(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; if (rnd < 3) as_Thunder(p_ad, p_Level); as_Bell(p_ad, p_Level); rnd = rand() % 400; if (rnd < 10) switch (rnd1) { case 0: as_Car(5, p_ad, p_Level, -1000.0f); break; case 1: as_Car(6, p_ad, p_Level, -1000.0f); break; case 2: as_Car(7, p_ad, p_Level, -1000.0f); break; case 3: as_Car(138, p_ad, p_Level, -1000.0f); break; } } void ad_Do_Environment2b(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; as_Bell(p_ad, p_Level); if (rnd < 15) switch (rnd1) { case 0: as_Car(5, p_ad, p_Level, -1000.0f); break; case 1: as_Car(6, p_ad, p_Level, -1000.0f); break; case 2: as_Car(7, p_ad, p_Level, -1000.0f); break; case 3: as_Car(138, p_ad, p_Level, -1000.0f); break; } } //------------------------------------------------------------------------------------------------ //pokoj + balkon //------------------------------------------------------------------------------------------------ void ad_Do_Environment5(AUDIO_DATA * p_ad, void *p_Level) { int rnd; int rnd1 = rand() % 5; as_Bell(p_ad, p_Level); rnd = rand() % 400; if (rnd < 10) switch (rnd1) { case 0: as_Car(5, p_ad, p_Level, -1000.0f); break; case 1: as_Car(6, p_ad, p_Level, -1000.0f); break; case 2: as_Car(7, p_ad, p_Level, -1000.0f); break; case 3: as_Car(138, p_ad, p_Level, -1000.0f); break; } } //------------------------------------------------------------------------------------------------ // zima (tutorial) //------------------------------------------------------------------------------------------------ void ad_Do_Environment3(AUDIO_DATA * p_ad, void *p_Level) { int rnd; int rnd1 = rand() % 3; rnd = rand() % 400; if (rnd < 7) switch (rnd1) { case 0: as_Bird(105, p_ad, p_Level); break; case 1: as_Bird(106, p_ad, p_Level); break; case 2: as_Bird(107, p_ad, p_Level); break; } } void ad_Do_Environment6(AUDIO_DATA * p_ad, void *p_Level) { int rnd; int rnd1 = rand() % 5; rnd = rand() % 400; if (rnd < 7) switch (rnd1) { case 0: as_Bird(8, p_ad, p_Level); break; case 1: as_Bird(9, p_ad, p_Level); break; case 2: as_Bird(10, p_ad, p_Level); break; case 3: as_Bird(11, p_ad, p_Level); break; case 4: as_Bird(12, p_ad, p_Level); break; } as_Bell(p_ad, p_Level); } void ad_Do_Environment3a(AUDIO_DATA * p_ad, void *p_Level) { int rnd; int rnd1 = rand() % 3; rnd = rand() % 1000; if (rnd < 7) switch (rnd1) { case 0: as_Bird(108, p_ad, p_Level); break; case 1: as_Bird(109, p_ad, p_Level); break; case 2: as_Bird(110, p_ad, p_Level); break; } } //------------------------------------------------------------------------------------------------ // kanal //------------------------------------------------------------------------------------------------ void ad_Do_Environment4(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 3; if (rnd < 10) as_Rat(87 + rnd1, p_ad, p_Level); rnd = rand() % 400; if (rnd < 10) as_Rat(84 + rnd1, p_ad, p_Level); rnd = rand() % 400; if (rnd < 10) as_Car4(5 + rnd1, p_ad, p_Level); //as_Bell(p_ad,p_Level); return; } void ad_Do_Environment9(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; as_Bell(p_ad, p_Level); if (rnd < 25) switch (rnd1) { case 0: as_Car(5, p_ad, p_Level, -500.0f); break; case 1: as_Car(6, p_ad, p_Level, -500.0f); break; case 2: as_Car(7, p_ad, p_Level, -500.0f); break; case 3: as_Car(138, p_ad, p_Level, -500.0f); break; } } void ad_Do_Environment10(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; as_Bell(p_ad, p_Level); if (rnd < 10) as_Thunder(p_ad, p_Level); if (rnd < 15) switch (rnd1) { case 0: as_Car(5, p_ad, p_Level, -250.0f); break; case 1: as_Car(6, p_ad, p_Level, -250.0f); break; case 2: as_Car(7, p_ad, p_Level, -250.0f); break; case 3: as_Car(138, p_ad, p_Level, -250.0f); break; } } void ad_Do_Environment11(AUDIO_DATA * p_ad, void *p_Level) { int rnd; int rnd1 = rand() % 5; rnd = rand() % 400; if (rnd < 65) switch (rnd1) { case 0: as_Bird(133, p_ad, p_Level); break; case 1: as_Bird(134, p_ad, p_Level); break; case 2: as_Bird(135, p_ad, p_Level); break; case 3: as_Bird(136, p_ad, p_Level); break; case 4: as_Bird(137, p_ad, p_Level); break; } } //------------------------------------------------------------------------------------------------ //pokoj + balkon //------------------------------------------------------------------------------------------------ void ad_Do_Environment12(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; if (rnd < 7) switch (rnd1) { case 0: as_Bird(8, p_ad, p_Level); break; case 1: as_Bird(9, p_ad, p_Level); break; case 2: as_Bird(10, p_ad, p_Level); break; case 3: as_Bird(11, p_ad, p_Level); break; case 4: as_Bird(12, p_ad, p_Level); break; } } //------------------------------------------------------------------------------------------------ //pokoj + balkon //------------------------------------------------------------------------------------------------ void ad_Do_Environment13(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 5; if (rnd < 15) switch (rnd1) { case 0: as_Bird(140, p_ad, p_Level); break; case 1: as_Bird(141, p_ad, p_Level); break; case 2: as_Bird(142, p_ad, p_Level); break; case 3: as_Bird(143, p_ad, p_Level); break; case 4: as_Bird(144, p_ad, p_Level); break; } } //------------------------------------------------------------------------------------------------ //pokoj + balkon //------------------------------------------------------------------------------------------------ void ad_Do_Environment14(AUDIO_DATA * p_ad, void *p_Level) { int rnd = rand() % 400; int rnd1 = rand() % 10; if (rnd < 15) switch (rnd1) { case 0: as_Bird(151, p_ad, p_Level); break; case 1: as_Bird(152, p_ad, p_Level); break; case 2: as_Bird(153, p_ad, p_Level); break; case 3: as_Bird(154, p_ad, p_Level); break; case 4: as_Bird(155, p_ad, p_Level); break; case 5: as_Bird(156, p_ad, p_Level); break; case 6: as_Bird(157, p_ad, p_Level); break; case 7: as_Bird(158, p_ad, p_Level); break; case 8: as_Bird(159, p_ad, p_Level); break; case 9: as_Bird(160, p_ad, p_Level); break; } } //------------------------------------------------------------------------------------------------ // starts environment //------------------------------------------------------------------------------------------------ void as_Do_Ambient_Sounds(int Env_ID, AUDIO_DATA * p_ad, void *p_Level) { if (!p_ad->bAudio) return; switch (Env_ID) { case 0: ad_Do_Environment1(p_ad, p_Level); break; case 1: ad_Do_Environment2(p_ad, p_Level); break; case 2: ad_Do_Environment3(p_ad, p_Level); break; case 3: ad_Do_Environment3a(p_ad, p_Level); break; case 4: ad_Do_Environment4(p_ad, p_Level); break; case 5: ad_Do_Environment5(p_ad, p_Level); break; case 6: ad_Do_Environment6(p_ad, p_Level); break; case 8: ad_Do_Environment2b(p_ad, p_Level); break; case 9: ad_Do_Environment9(p_ad, p_Level); break; case 10: ad_Do_Environment10(p_ad, p_Level); break; case 11: ad_Do_Environment11(p_ad, p_Level); break; case 12: ad_Do_Environment12(p_ad, p_Level); break; case 13: ad_Do_Environment13(p_ad, p_Level); break; case 14: ad_Do_Environment14(p_ad, p_Level); break; } } berusky2-0.12/src/kofola/animationk.cpp0000644000175000017500000063344613674426075015061 00000000000000//------------------------------------------------------------------------------------------------ // version 1.0.1 //------------------------------------------------------------------------------------------------ #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Berusky3d_kofola2d.h" #include "game_logic.h" #include "animationk.h" #include "animend_functions.h" #include "water.h" #include "3d_math.h" #include "3D_graphic.h" #include "menu_def.h" #include "3D_menus.h" #define randf() ((float)rand()) extern char pDataDir[MAX_FILENAME]; extern LEVELINFO Level; extern _3D_CURSOR _3dCur; extern G_KONFIG ber; extern AUDIO_DATA ad; void am_Do_Vodni_Cakanec2(float *pos, int VyskaPadu, int predmet, LEVELINFO * p_Level); int am_Find_Water(int i, float *f, LEVELINFO * p_Level); extern int gl_Choose_Wave_Index(int Plus); extern void gl_Do_Strepiny_Na_Vode(float *pos, LEVELINFO * p_Level, float fycor); static int mx = 0; static int my = 0; RECT rDrawRect[DRAW_RECT_NUM]; float am_vzdal_bodu(float x1, float y1, float x2, float y2) { return ((float) sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))); } float am_vzdal_bodu_single(float x1, float x2) { return ((float) sqrt((x2 - x1) * (x2 - x1))); } //------------------------------------------------------------------------------------------------ // init animation module //------------------------------------------------------------------------------------------------ int am_Init(ANIMATION_MODULE * p_am, LEVELINFO * p_Level) { FILE *file = NULL; char text[MAX_FILENAME]; int i; p_am->Size_of_Anim = 100; p_am->p_animation = (SIM_ANIMATION *) malloc((p_am->Size_of_Anim) * sizeof(SIM_ANIMATION)); if (!p_am->p_animation) { //MessageBox(p_am->hWnd,"Unable to allocate memory for animatin module","Error",MB_OK); kprintf(1, "Unable to allocate memory for animatin module"); return 0; } else ZeroMemory(p_am->p_animation, (p_am->Size_of_Anim) * sizeof(SIM_ANIMATION)); for (i = 0; i < p_am->Size_of_Anim; i++) { p_am->p_animation[i].flag = 0; p_am->p_animation[i].p_run = 0; p_am->p_animation[i].p_matrix = -1; } if (chdir(DATA_DIR)) { kprintf(1, "Unable to change directory to %s", DATA_DIR); return 0; } construct_path(text, MAX_FILENAME, 2, pDataDir, "animload.dat"); file = fopen(text, "r"); if (!file) { kprintf(1, "animload.dat not found"); return 0; } for (i = 0; i < 110; i++) p_am->sim_anim[i] = -1; i = 0; kprintf(1, "Kofola - Nahravam animace..."); while (!feof(file)) { if (!fgets(text, 256, file)) break; newline_cut(text); //kprintf(1, "%s", text); p_am->sim_anim[i] = sim_nahraj_animaci(pDataDir, text, 0); i++; } fclose(file); return 1; } //------------------------------------------------------------------------------------------------ // release animation module //------------------------------------------------------------------------------------------------ void am_Release(ANIMATION_MODULE * p_am, LEVELINFO * p_Level) { int i; for (i = 0; i < 110; i++) if (p_am->sim_anim[i] != -1) { kprintf(1, "sim_zrus_animaci[%d], sim = %d", i, p_am->sim_anim[i]); sim_zrus_animaci(p_am->sim_anim[i]); } free((void *) p_am->p_animation); p_am->Size_of_Anim = 0; for (i = 0; i < 10; i++) { if (p_Level->ExitSparks[i].System) { kprintf(1, "ExitSparks[%d], par_zrus %d", i, p_Level->ExitSparks[i].System); par_zrus(p_Level->ExitSparks[i].System); p_Level->ExitSparks[i].System = (size_ptr)NULL; } } } //------------------------------------------------------------------------------------------------ // find free animation item //------------------------------------------------------------------------------------------------ int am_Find_Free_Animation_Item(ANIMATION_MODULE * p_am) { int i; for (i = 0; i < p_am->Size_of_Anim; i++) if (p_am->p_animation[i].flag == -1) return i; return -1; } //------------------------------------------------------------------------------------------------ // get animaton status //------------------------------------------------------------------------------------------------ int am_Animation_Status(SIM_ANIMATION * p_animation, ANIMATION_MODULE * p_am) { if (p_animation->flag == -1) { if (p_animation->p_run) { //rani_rozvaz(p_animation->p_run,p_animation->p_matrix); rani_zrus(p_animation->p_run); p_animation->p_run = 0; p_animation->p_matrix = -1; } return 0; } else return 1; } //------------------------------------------------------------------------------------------------ // pripoji funkci na start animace //------------------------------------------------------------------------------------------------ void am_Set_Start_Function(SIM_ANIMATION * p_animation, END_FUNKCE pStartf, size_ptr iParam1, size_ptr iParam2, size_ptr pParam, int index) { p_animation->tStart[index].pProc = pStartf; p_animation->tStart[index].pParam = reinterpret_cast(pParam); p_animation->tStart[index].iParam[0] = iParam1; p_animation->tStart[index].iParam[1] = iParam2; } //------------------------------------------------------------------------------------------------ // nastavi spusteni funkce na ucrite misto animace //------------------------------------------------------------------------------------------------ void am_Set_Triger_Function(SIM_ANIMATION * p_animation, END_FUNKCE pTrigerf, size_ptr iParam1, size_ptr iParam2, size_ptr pParam, int flag, int index) { p_animation->tTriger[index].pProc = pTrigerf; p_animation->tTriger[index].pParam = reinterpret_cast(pParam); p_animation->tTriger[index].iParam[0] = iParam1; p_animation->tTriger[index].iParam[1] = iParam2; p_animation->tTriger[index].flag = flag; } //------------------------------------------------------------------------------------------------ // nastavi spusteni funkce na ucrite misto animace //------------------------------------------------------------------------------------------------ void am_Set_aMaterial_Function(SIM_ANIMATION * p_animation, int i, END_FUNKCE taMateral, size_ptr iParam1, size_ptr iParam2, size_ptr pParam, int flag) { p_animation->taMateral[i].pProc = taMateral; p_animation->taMateral[i].pParam = reinterpret_cast(pParam); p_animation->taMateral[i].iParam[0] = iParam1; p_animation->taMateral[i].iParam[1] = iParam2; p_animation->taMateral[i].flag = flag; } //------------------------------------------------------------------------------------------------ // odebere predmet ke konstantni animaci //------------------------------------------------------------------------------------------------ void am_Remove_Animate_item(long item, LEVELINFO * p_Level) { int i = 0; while (p_Level->Anim_Item[i] != p_Level->Level[item]->iItem) i++; if (p_Level->Item[p_Level->Anim_Item[i]].a_run) { rani_zrus(p_Level->Item[p_Level->Anim_Item[i]].a_run); p_Level->Item[p_Level->Anim_Item[i]].a_run = 0; p_Level->Item[p_Level->Anim_Item[i]].a_flag = -1; } i++; while (p_Level->Anim_Item[i] != -1) { p_Level->Anim_Item[i - 1] = p_Level->Anim_Item[i]; i++; } if (i > 0) p_Level->Anim_Item[i - 1] = p_Level->Anim_Item[i]; else p_Level->Anim_Item[0] = -1; } //------------------------------------------------------------------------------------------------ // odebere predmet ke konstantni animaci //------------------------------------------------------------------------------------------------ void am_Remove_Animate_itemB(int iItem, LEVELINFO * p_Level) { int i = 0; while (p_Level->Anim_Item[i] != iItem) i++; if (p_Level->Item[p_Level->Anim_Item[i]].a_run) { rani_zrus(p_Level->Item[p_Level->Anim_Item[i]].a_run); p_Level->Item[p_Level->Anim_Item[i]].a_run = 0; p_Level->Item[p_Level->Anim_Item[i]].a_flag = -1; } i++; while (p_Level->Anim_Item[i] != -1) { p_Level->Anim_Item[i - 1] = p_Level->Anim_Item[i]; i++; } if (i > 0) p_Level->Anim_Item[i - 1] = p_Level->Anim_Item[i]; else p_Level->Anim_Item[0] = -1; } //------------------------------------------------------------------------------------------------ // prida predmet ke konstantni animaci //------------------------------------------------------------------------------------------------ void am_Add_Animate_Item(long item, LEVELINFO * p_Level) { // int iPos[3]; // float pos[3]; int i = 0; //, rot; while (p_Level->Anim_Item[i] != -1) i++; p_Level->Anim_Item[i] = p_Level->Level[item]->iItem; p_Level->Anim_Item[i + 1] = -1; /* memcpy((void *) iPos, (void *) p_Level->Level[item]->Pos, 3*sizeof(int)); iPos[2]--; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &rot, p_Level); if(p_Level->Level[rot]) if(p_Level->Level[rot]->p_Object->Class == 12) { kom_mesh_get_float(p_Level->Level[item]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); am_Kola_na_VodeB(pos, 1, -1, 1, p_Level); }*/ } //------------------------------------------------------------------------------------------------ // prida predmet ke konstantni animaci //------------------------------------------------------------------------------------------------ void am_Add_Animate_ItemB(int iItem, LEVELINFO * p_Level) { // int iPos[3]; // float pos[3]; int i = 0; //, rot; while (p_Level->Anim_Item[i] != -1) i++; p_Level->Anim_Item[i] = iItem; p_Level->Anim_Item[i + 1] = -1; /* memcpy((void *) iPos, (void *) p_Level->Item[iItem].Pos, 3*sizeof(int)); iPos[2]--; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &rot, p_Level); if(p_Level->Level[rot]) if(p_Level->Level[rot]->p_Object->Class == 12) { kom_mesh_get_float(p_Level->Item[iItem].Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); am_Kola_na_VodeB(pos, 1, -1, 1, p_Level); }*/ } //------------------------------------------------------------------------------------------------ // animuje predmety //------------------------------------------------------------------------------------------------ void am_Animate_Items(ANIMATION_MODULE * p_am, LEVELINFO * p_Level) { int i = 0; ITEMDESC *p_item; while (p_Level->Anim_Item[i] != -1) { if (p_Level->Item[p_Level->Anim_Item[i]].a_flag == -1) { p_item = &p_Level->Item[p_Level->Anim_Item[i]]; if (p_item->a_run) { rani_zrus(p_item->a_run); p_item->a_run = 0; } p_item->a_run = rani_aktivuj(p_am->sim_anim[34], &p_item->a_flag, GK_LOOP, 0, 0); if (p_item->a_run) { rani_privaz_mesh(p_item->a_run, p_item->Index_Of_Game_Mesh, 0); p_item->a_flag = 0; } } i++; if (i > p_Level->Count_Of_Items) return; } } //------------------------------------------------------------------------------------------------ // animuje predmety //------------------------------------------------------------------------------------------------ void am_Release_Animate_Items(ANIMATION_MODULE * p_am, LEVELINFO * p_Level) { int i = 0; ITEMDESC *p_item; while (p_Level->Anim_Item[i] != -1) { kprintf(1, "am_Release_Animate_Items - p_Level->Anim_Item[%d]", i); p_item = &p_Level->Item[p_Level->Anim_Item[i]]; if (p_item->a_run) { kprintf(1, "rani_zrus..."); rani_zrus(p_item->a_run); p_item->a_run = 0; } i++; } } void am_Set_aMaterial_Trigers(SIM_ANIMATION * p_animation, ITEMDESC * p_Item, LEVELINFO * p_Level) { int i; for (i = 0; i < 3; i++) if (p_Item->p_Object->MatEvent[i].cType == 1) am_Set_aMaterial_Function(p_animation, i, anmend_Send_Event, p_Item->mMaterial->handle_materialove_animace, 0, 0, p_Item->p_Object->MatEvent[i].iFlag); else if (p_Item->p_Object->MatEvent[i].cType == 2) am_Set_aMaterial_Function(p_animation, i, anmend_Send_Event, p_Item->mMaterial->handle_materialove_animace, 0, 0, -1); else if (!p_Item->p_Object->MatEvent[i].cType) am_Set_aMaterial_Function(p_animation, i, NULL, 0, 0, 0, -1); } void am_Set_Beetle_Switching(LEVELINFO * p_Level, int mesh, int bSwitch) { int i; for (i = 0; i < 6; i++) if (p_Level->BeetleAnim[i].Mesh == mesh) { p_Level->BeetleAnim[i].bSwitch = bSwitch; return; } return; } void am_Play_Beatle_Sound(BEETLEANIMATION * p_anim, int mesh, int idx) { float pos[3]; int rot; kom_mesh_get_float(mesh, &pos[0], &pos[1], &pos[2], &rot); p_anim->iSound = ap_Play_Sound(0, 0, 0, pos, idx + (rand()%3), NULL, &ad); p_anim->dwTime = timeGetTime(); } void am_Do_Beatle_Cakanec(int mesh, LEVELINFO * p_Level, int id) { int iPos[3], r; float pos[3], fPos[3]; int real; if (p_Level->bUnderWaterLevel) return; kom_mesh_get_float(mesh, &pos[0], &pos[1], &pos[2], &r); iPos[0] = ftoi((pos[0] - ber.x_start - X_PRVEK / 2) / X_PRVEK); iPos[2] = ftoi(((pos[1] - ber.y_start - Y_PRVEK / 2) / Y_PRVEK) * 2); iPos[1] = ftoi((pos[2] - ber.z_start - Z_PRVEK / 2) / Z_PRVEK); if (iPos[0] < 0 || iPos[1] < 0 || iPos[2] < 0 || iPos[0] >= p_Level->Size[0] || iPos[1] >= p_Level->Size[1] || iPos[2] >= p_Level->Size[2]) return; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 12) { fPos[0] = pos[0]; fPos[1] = pos[1] - 1; fPos[2] = pos[2]; if (!id) { am_Kola_na_Vode(fPos, 1, 4, 0, p_Level); ap_Play_Sound(0,0,0, pos, 74+(rand()%3), NULL, &ad); } else { pos[1] += -0.7f; am_Do_Vodni_Cakanec1(pos, 4, 0, p_Level); //am_Do_Vodni_Cakanec2(pos, 4, 0, p_Level); ap_Play_Sound(0,0,0, pos, 40+(rand()%4), NULL, &ad); } } } void am_Animate_Beetle(LEVELINFO * p_Level, int i) { int r; switch (p_Level->BeetleAnim[i].iID) { case 3: case 4: case 5: case 6: case 7: case 8: lani_set(p_Level->BeetleAnim[i].Mesh, 0, 0, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); p_Level->BeetleAnim[i].iAnimCount++; return; case 2: r = rand() % 8; lani_set(p_Level->BeetleAnim[i].Mesh, 0, 2 + r, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); p_Level->BeetleAnim[i].iAnimCount++; return; case 0: r = rand() % 12; lani_set(p_Level->BeetleAnim[i].Mesh, 0, 3 + r, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); if (p_Level->BeetleAnim[i].iAnimCount) { if (r == 4) // pada am_Play_Beatle_Sound(&p_Level->BeetleAnim[i], p_Level->BeetleAnim[i].Mesh, 165); else if (r == 5) // salto { am_Play_Beatle_Sound(&p_Level->BeetleAnim[i], p_Level->BeetleAnim[i].Mesh, 168); p_Level->BeetleAnim[i].iEffect = 1; p_Level->BeetleAnim[i].iEffectCounter = 0; } else if (r == 11) // meditace am_Play_Beatle_Sound(&p_Level->BeetleAnim[i], p_Level->BeetleAnim[i].Mesh, 171); } p_Level->BeetleAnim[i].iAnimCount++; return; } kprintf(1, "Nemuzu animovat brouka! ID = %d", p_Level->BeetleAnim[i].iID); } void am_Animate_Beetles(LEVELINFO * p_Level) { DWORD time = timeGetTime(); int i, r, x; for (i = 0; i < 6; i++) if (p_Level->BeetleAnim[i].Mesh != -1 && p_Level->BeetleAnim[i].Flag == -1) { //jedu na starem cekani ... a tak to musi zustat /*if(p_Level->BeetleAnim[i].iID == 2) { kom_mesh_set_mesh(p_Level->BeetleAnim[i].Mesh, 2, p_Level->BeetleAnim[i].iRot); r = rand()%8; lani_set(p_Level->BeetleAnim[i].Mesh, 0, 2 + r, &p_Level->BeetleAnim[i].Flag,0,0,0); } else */ if (gl_Check_Mesh_Sim(p_Level->BeetleAnim[i].Mesh)) //brouk se animuje -> nemuzu prepinat meshe am_Animate_Beetle(p_Level, i); else { r = (rand() % 10); /* r <0-6> nejcastejsi cekani r <7-8> ridke cekani r <9> stare cekani */ if (time - p_Level->BeetleAnim[i].dwTime > 180000 && !(rand() % 2)) { p_Level->BeetleAnim[i].dwTime = time; r = 7; } if (r < 7) { x = (rand() % 6); kom_mesh_set_mesh(p_Level->BeetleAnim[i].Mesh, 3 + x, p_Level->BeetleAnim[i].iRot); p_Level->BeetleAnim[i].iID = 3 + x; lani_set(p_Level->BeetleAnim[i].Mesh, 0, 0, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); p_Level->BeetleAnim[i].iAnimCount++; } else if (r > 6) { kom_mesh_set_mesh(p_Level->BeetleAnim[i].Mesh, 0, p_Level->BeetleAnim[i].iRot); p_Level->BeetleAnim[i].iID = 0; x = rand() % 12; lani_set(p_Level->BeetleAnim[i].Mesh, 0, 3 + x, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); if (p_Level->BeetleAnim[i].iAnimCount) { if (x == 4) // pada am_Play_Beatle_Sound(&p_Level->BeetleAnim[i], p_Level->BeetleAnim[i].Mesh, 165); else if (x == 5) // salto { am_Play_Beatle_Sound(&p_Level->BeetleAnim[i], p_Level->BeetleAnim[i].Mesh, 168); p_Level->BeetleAnim[i].iEffect = 1; p_Level->BeetleAnim[i].iEffectCounter = 0; } else if (x == 11) // meditace am_Play_Beatle_Sound(&p_Level->BeetleAnim[i], p_Level->BeetleAnim[i].Mesh, 171); } p_Level->BeetleAnim[i].iAnimCount++; } /*else { kom_mesh_set_mesh(p_Level->BeetleAnim[i].Mesh, 2, p_Level->BeetleAnim[i].iRot); p_Level->BeetleAnim[i].iID = 2; x = rand()%8; lani_set(p_Level->BeetleAnim[i].Mesh, 0, 2 + x, &p_Level->BeetleAnim[i].Flag,0,0,0); } */ } } else if (p_Level->BeetleAnim[i].Mesh != -1 && p_Level->BeetleAnim[i].Flag != -1 && p_Level->BeetleAnim[i].iEffect) { if (!p_Level->BeetleAnim[i].iEffectCounter) { am_Do_Beatle_Cakanec(p_Level->BeetleAnim[i].Mesh, p_Level, 0); p_Level->BeetleAnim[i].iEffectCounter++; } else if (p_Level->BeetleAnim[i].Flag >= 10) { p_Level->BeetleAnim[i].iEffect = 0; am_Do_Beatle_Cakanec(p_Level->BeetleAnim[i].Mesh, p_Level, 1); p_Level->BeetleAnim[i].iEffectCounter = 0; } } } void am_Remove_Beetle_Animation(int mesh, LEVELINFO * p_Level) { int i; for (i = 0; i < 6; i++) if (p_Level->BeetleAnim[i].Mesh == mesh) { lani_set(p_Level->BeetleAnim[i].Mesh, 0, K_CHYBA, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); kom_mesh_set_mesh(mesh, 0, p_Level->BeetleAnim[i].iRot); //kprintf(1, "am_Remove_Beetle_Animation set na je %d", p_Level->BeetleAnim[i].iRot); p_Level->BeetleAnim[i].Mesh = -1; p_Level->BeetleAnim[i].iID = 0; /* if(timeGetTime() - p_Level->BeetleAnim[i].dwTime < 1000 && p_Level->BeetleAnim[i].iSound != -1) adas_Release_Source(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_Level->BeetleAnim[i].iSound); */ p_Level->BeetleAnim[i].iSound = -1; return; } } void am_Correct_Beetle_Animation(int mesh, LEVELINFO * p_Level, int rot) { int i; for (i = 0; i < 6; i++) if (p_Level->BeetleAnim[i].Mesh == mesh) { p_Level->BeetleAnim[i].iRot = rot; return; } } int am_Add_Beetle_Animation(int mesh, LEVELINFO * p_Level, int iRot, char bExeption) { int i; for (i = 0; i < 6; i++) if (p_Level->BeetleAnim[i].Mesh == mesh) return 0; if (gl_Check_Mesh_Sim(mesh) && !bExeption) return 0; for (i = 0; i < 6; i++) if (p_Level->BeetleAnim[i].Mesh == -1) { lani_set(mesh, 0, K_CHYBA, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); p_Level->BeetleAnim[i].Mesh = mesh; p_Level->BeetleAnim[i].Flag = -1; p_Level->BeetleAnim[i].iRot = iRot; // kom_mesh_set_mesh(mesh, 2, iRot); p_Level->BeetleAnim[i].dwTime = timeGetTime(); p_Level->BeetleAnim[i].iAnimCount = 1; p_Level->BeetleAnim[i].iSound = -1; p_Level->BeetleAnim[i].iEffect = 0; p_Level->BeetleAnim[i].iEffectCounter = 0; return 1; } return 0; } void am_Stop_Beetle_Animations(LEVELINFO * p_Level) { int i; for (i = 0; i < 6; i++) { if (p_Level->BeetleAnim[i].Mesh != -1) { lani_set(p_Level->BeetleAnim[i].Mesh, 0, K_CHYBA, &p_Level->BeetleAnim[i].Flag, 0, 0, 0); p_Level->BeetleAnim[i].Mesh = -1; } } } void am_Init_Zhave_Castice(LEVELINFO * p_Level) { int i, j; p_Level->BublSystemE.System.System = (size_ptr)NULL; p_Level->BublSystemE.System.pCastice = NULL; p_Level->BublSystemC.System.System = (size_ptr)NULL; p_Level->BublSystemC.System.pCastice = NULL; for (i = 0; i < 10; i++) { p_Level->KourUst[i].pCastice = NULL; p_Level->KourUst[i].System = (size_ptr)NULL; } for (i = 0; i < 20; i++) { p_Level->TeleportSparks[i].pCastice = NULL; p_Level->TeleportSparks[i].System = (size_ptr)NULL; p_Level->ZhaveCastice[i].System.pCastice = NULL; p_Level->KourovaStopa[i].pCastice = NULL; p_Level->KourovaStopa[i].System = (size_ptr)NULL; p_Level->Kour[i].pCastice = NULL; p_Level->Kour[i].System = (size_ptr)NULL; p_Level->KourKameni[i].pCastice = NULL; p_Level->KourKameni[i].System = (size_ptr)NULL; p_Level->BublVybuch[i].pCastice = NULL; p_Level->BublVybuch[i].System = (size_ptr)NULL; for (j = 0; j < 64; j++) p_Level->BublVybuch[i].hHnizdo[j] = 0; for (j = 0; j < 64; j++) { p_Level->ZhaveCastice[i].hSvetlo[j] = -1; p_Level->ZhaveCastice[i].hFlare[j] = 0; p_Level->KourovaStopa[i].hHnizdo[j] = 0; p_Level->Kour[i].hHnizdo[j] = 0; p_Level->KourKameni[i].hHnizdo[j] = 0; p_Level->BublVybuch[i].hHnizdo[j] = 0; p_Level->TeleportSparks[i].hHnizdo[j] = 0; } } for (i = 0; i < 30; i++) { p_Level->BarelSparks[i].pCastice = NULL; p_Level->BarelSparks[i].System = (size_ptr)NULL; for (j = 0; j < 64; j++) p_Level->BarelSparks[i].hHnizdo[j] = 0; } for (i = 0; i < 10; i++) { p_Level->LiftParticles[i].pCastice = NULL; p_Level->LiftParticles[i].System = (size_ptr)NULL; p_Level->VodniKola[i].pCastice = NULL; p_Level->VodniKola[i].System = (size_ptr)NULL; p_Level->LiftVParticles[i].pCastice = NULL; p_Level->LiftVParticles[i].System = (size_ptr)NULL; p_Level->ExitEfect[i].hSvetlo = -1; p_Level->ExitEfect[i].System.System = (size_ptr)NULL; p_Level->ExitEfect[i].hEXSvetlo[0] = -1; p_Level->ExitEfect[i].hEXSvetlo[1] = -1; p_Level->ExitEfect[i].System.hHnizdo[0] = 0; p_Level->ExitEfect[i].System.hHnizdo[1] = 0; p_Level->ExitSparks[i].pCastice = NULL; p_Level->ExitSparks[i].System = (size_ptr)NULL; p_Level->TelCSparks[i].pCastice = NULL; p_Level->TelCSparks[i].System = (size_ptr)NULL; p_Level->NatureESystem[i].pCastice = NULL; p_Level->NatureESystem[i].pSystem = (size_ptr)NULL; p_Level->NatureESystem[i].hHnizdo = 0; p_Level->NatureESystem[i].EffectID = 0; for (j = 0; j < 64; j++) { p_Level->LiftParticles[i].hHnizdo[j] = 0; p_Level->LiftVParticles[i].hHnizdo[j] = 0; p_Level->VodniKola[i].hHnizdo[j] = 0; p_Level->ExitSparks[i].hHnizdo[j] = 0; p_Level->TelCSparks[i].hHnizdo[j] = 0; } } for (i = 0; i < 100; i++) { p_Level->VodniKolaB[i].pCastice = NULL; p_Level->VodniKolaB[i].System = (size_ptr)NULL; } for (i = 0; i < 10; i++) { for (j = 0; j < 64; j++) p_Level->VodniKola[i].hHnizdo[j] = 0; } for (i = 0; i < 6; i++) { p_Level->BublSystem[i].System.System = (size_ptr)NULL; p_Level->BublSystem[i].iStart = (int) ceil((randf() / (float) RAND_MAX) * 3000); for (j = 0; j < 64; j++) { p_Level->BublSystem[i].System.hHnizdo[j] = 0; } } for (i = 0; i < 8; i++) memset(&p_Level->StreetL[i], 0, sizeof(STREET_LIGHT_EFFECT)); for (i = 0; i < 10; i++) memset(&p_Level->SwampL[i], 0, sizeof(STREET_LIGHT_EFFECT)); for (i = 0; i < 200; i++) memset(&p_Level->StarL[i], 0, sizeof(STREET_LIGHT_EFFECT)); for (i = 0; i < 2; i++) { memset((void *) &p_Level->StarFall[i], 0, sizeof(FAIRY_EFFECT)); } for (i = 0; i < 6; i++) { memset((void *) &p_Level->CandleEffect[i], 0, sizeof(CANDLE_EFFECT)); p_Level->CandleEffect[i].hSvetlo = -1; memset((void *) &p_Level->CandleSmoke[i], 0, sizeof(CANDLE_EFFECT)); p_Level->CandleSmoke[i].hSvetlo = -1; } for (i = 0; i < 4; i++) { memset((void *) &p_Level->FairyEffect[i], 0, sizeof(FAIRY_EFFECT)); } } void am_Obsluha_Koure(int i, LEVELINFO * p_Level) { DWORD dwTime, dwEplased; int j; if (p_Level->Kour[i].System) { dwTime = timeGetTime(); dwEplased = dwTime - p_Level->Kour[i].dwStart; if (dwEplased > 1000) { for (j = 0; j < p_Level->Kour[i].Sizeof; j++) { if (p_Level->Kour[i].hHnizdo[j]) { par_vloz_hnizdo_pivot(p_Level->Kour[i].hHnizdo[j], NULL); p_Level->Kour[i].hHnizdo[j] = 0; } } } if (!par_get_hnizda(p_Level->Kour[i].System)) { par_zrus(p_Level->Kour[i].System); p_Level->Kour[i].System = (size_ptr)NULL; } } } void am_Obsluha_Koure_Kameni(int i, LEVELINFO * p_Level) { DWORD dwTime, dwEplased; int j; if (p_Level->KourKameni[i].System) { dwTime = timeGetTime(); dwEplased = dwTime - p_Level->KourKameni[i].dwStart; if (dwEplased > 1000) { for (j = 0; j < p_Level->KourKameni[i].Sizeof; j++) { if (p_Level->KourKameni[i].hHnizdo[j]) { par_vloz_hnizdo_pivot(p_Level->KourKameni[i].hHnizdo[j], NULL); p_Level->KourKameni[i].hHnizdo[j] = 0; } } } if (!par_get_hnizda(p_Level->KourKameni[i].System)) { par_zrus(p_Level->KourKameni[i].System); p_Level->KourKameni[i].System = (size_ptr)NULL; } } } void am_Do_Zhave_castice(LEVELINFO * p_Level) { int i, j; SYSTEMZHAVYCHCASTIC *pSystem; DWORD dwTime, dwEplased; for (i = 0; i < 20; i++) { if (p_Level->ZhaveCastice[i].System.pCastice) { pSystem = &p_Level->ZhaveCastice[i]; for (j = 0; j < pSystem->System.Sizeof; j++) if (!pSystem->System.pCastice[j].aktivni) { if (pSystem->hSvetlo[j] != -1) { sdl_svetlo_zrus(pSystem->hSvetlo[j]); pSystem->hSvetlo[j] = -1; } if (pSystem->hFlare[j]) { kom_flare_zrus(pSystem->hFlare[j]); pSystem->hFlare[j] = (size_ptr)NULL; } if (pSystem->iKourStopa >= 0) { if (p_Level->KourovaStopa[pSystem->iKourStopa].hHnizdo[j]) { dwTime = timeGetTime(); dwEplased = dwTime - p_Level->KourovaStopa[pSystem->iKourStopa].dwStart; if (dwEplased < 100) { par_zrus_hnizdo(p_Level->KourovaStopa[pSystem->iKourStopa]. System, p_Level->KourovaStopa[pSystem->iKourStopa].hHnizdo[j]); } else { par_vloz_hnizdo_pivot(p_Level->KourovaStopa[pSystem->iKourStopa].hHnizdo[j], NULL); } p_Level->KourovaStopa[pSystem->iKourStopa].hHnizdo[j] = 0; } } } else sdl_svetlo_set_pos(pSystem->hSvetlo[j], (BOD *) & pSystem->System.pCastice[j].p); } if (p_Level->KourovaStopa[i].System) if (!par_get_hnizda(p_Level->KourovaStopa[i].System)) { par_zrus(p_Level->KourovaStopa[i].System); p_Level->KourovaStopa[i].System = (size_ptr)NULL; } //obslouzeni kouru am_Obsluha_Koure(i, p_Level); //obslouzeni koure do kamenech am_Obsluha_Koure_Kameni(i, p_Level); } } void am_Release_Zhave_castice(SYSTEMZHAVYCHCASTIC * pSystem) { int i; pSystem->System.pCastice = NULL; for (i = 0; i < 32; i++) { if (pSystem->hSvetlo[i] != -1) { sdl_svetlo_zrus(pSystem->hSvetlo[i]); pSystem->hSvetlo[i] = -1; } if (pSystem->hFlare[i]) { kom_flare_zrus(pSystem->hFlare[i]); pSystem->hFlare[i] = (size_ptr)NULL; } } } void am_Release_Kourove_Castice(SYSTEMKOUROVYCHCASTIC * pSystem) { int i; pSystem->pCastice = NULL; for (i = 0; i < 64; i++) { if (pSystem->hHnizdo[i]) { par_vloz_hnizdo_pivot(pSystem->hHnizdo[i], NULL); pSystem->hHnizdo[i] = 0; } } } void am_Change_Wind(LEVELINFO * p_Level) { float f; p_Level->fVitr[0] = rand() & 0x1 ? randf() : -randf(); p_Level->fVitr[1] = rand() & 0x1 ? randf() : -randf(); p_Level->fVitr[2] = rand() & 0x1 ? randf() : -randf(); vektor_norm((BOD *) p_Level->fVitr); f = (randf() / (float) (RAND_MAX)) * (_3DKOREKCE / 2.0f); p_Level->fVitr[0] *= f / 30.0f; p_Level->fVitr[1] *= f / 50.0f; p_Level->fVitr[2] *= f / 30.0f; } void am_Obsluha_Teleportacnich_Jisker(int i, LEVELINFO * p_Level) { PAR_KOUR_STOPA *pCastice; DWORD dwTime, dwEplased; int j, r; float f; if (p_Level->TeleportSparks[i].System) { dwTime = timeGetTime(); dwEplased = dwTime - p_Level->TeleportSparks[i].dwStart; if (!p_Level->bGameResume) p_Level->TeleportSparks[i].dwTime += ber.TimeLastFrame; if (dwEplased > 30000) { for (j = 0; j < p_Level->TeleportSparks[i].Sizeof; j++) { if (p_Level->TeleportSparks[i].hHnizdo[j]) { par_zrus_hnizdo(p_Level->TeleportSparks[i].System, p_Level->TeleportSparks[i].hHnizdo[j]); p_Level->TeleportSparks[i].hHnizdo[j] = 0; } } } //mihotani jisker if (p_Level->TeleportSparks[i].dwTime > 100) { for (j = 0; j < p_Level->TeleportSparks[i].Sizeof; j++) if (p_Level->TeleportSparks[i].hHnizdo[j]) { pCastice = par_cti_hnizdo_castice(p_Level->TeleportSparks[i].hHnizdo[j]); if (pCastice) { while (pCastice) { if (pCastice->rychlost_x > 0.01f && pCastice->rychlost_y > 0.01f) { r = rand() % 100; if (r < 10) { f = (randf() / (float) (RAND_MAX)) / 7.5f; pCastice->rychlost_x += f; pCastice->rychlost_y += f; } } else pCastice->a = 0; pCastice = pCastice->p_next; } } } p_Level->TeleportSparks[i].dwTime = 0; } if (!par_get_hnizda(p_Level->TeleportSparks[i].System)) { par_zrus(p_Level->TeleportSparks[i].System); p_Level->TeleportSparks[i].System = (size_ptr)NULL; } } } void am_Do_Flares(LEVELINFO * p_Level) { int i, j; LENS_FLARE *pFlare; DWORD dwTime, dwEplased; float koef = ber.TimeLastFrame / 1000.0f; dwTime = timeGetTime(); for (i = 0; i < 20; i++) if (p_Level->Flare[i].pFlare) { dwEplased = dwTime - p_Level->Flare[i].dwStart; if (dwEplased > 1000) { //pokud se napodarilo prvek presunout v terminu (500 ms) udelej to ted if (p_Level->Flare[i].Item) { (anmend_Teleport) (reinterpret_cast(p_Level->Flare[i].Item), p_Level->Flare[i].Teleport, reinterpret_cast(p_Level->Flare[i].pPointer)); p_Level->Flare[i].Item = NULL; p_Level->Flare[i].Teleport = -1; } kom_flare_zrus(p_Level->Flare[i].pFlare); p_Level->Flare[i].pFlare = 0; if (p_Level->Flare[i].hSvetlo != -1) { sdl_svetlo_zrus(p_Level->Flare[i].hSvetlo); p_Level->Flare[i].hSvetlo = -1; } if (p_Level->Flare[i].hEXSvetlo != -1) { edl_svetlo_zrus(p_Level->Flare[i].hEXSvetlo); p_Level->Flare[i].hEXSvetlo = -1; } } else if (dwEplased > 500) { //proved teleportaci, pokud je zapsan predmet if (p_Level->Flare[i].Item) { (anmend_Teleport) (reinterpret_cast(p_Level->Flare[i].Item), p_Level->Flare[i].Teleport, reinterpret_cast(p_Level->Flare[i].pPointer)); p_Level->Flare[i].Item = NULL; p_Level->Flare[i].Teleport = -1; } pFlare = kom_flare_get_pointer(p_Level->Flare[i].pFlare); pFlare->dx -= p_Level->Flare[i].mSpeed * koef; pFlare->dy -= p_Level->Flare[i].mSpeed * koef; for (j = 0; j < 14; j++) if (pFlare->p_sloz[j].vzdal) { pFlare->p_sloz[j].dx -= p_Level->Flare[i].Speed[j] * koef; pFlare->p_sloz[j].dy -= p_Level->Flare[i].Speed[j] * koef; } else break; } else { pFlare = kom_flare_get_pointer(p_Level->Flare[i].pFlare); pFlare->dx += p_Level->Flare[i].mSpeed * koef; pFlare->dy += p_Level->Flare[i].mSpeed * koef; for (j = 0; j < 14; j++) if (pFlare->p_sloz[j].vzdal) { pFlare->p_sloz[j].dx += p_Level->Flare[i].Speed[j] * koef; pFlare->p_sloz[j].dy += p_Level->Flare[i].Speed[j] * koef; } else break; } } for (i = 0; i < 20; i++) am_Obsluha_Teleportacnich_Jisker(i, p_Level); } void am_Do_LiftVParticies(int i, LEVELINFO * p_Level) { int r; float f, pos[3]; DWORD dwTime, dwEplased; PARMETAC_HNIZDO *pHnizdo; dwTime = timeGetTime(); if (p_Level->LiftVParticles[i].System) { dwEplased = dwTime - p_Level->LiftVParticles[i].dwStart; if (dwEplased > 200000) { par_zrus(p_Level->LiftVParticles[i].System); p_Level->LiftVParticles[i].System = (size_ptr)NULL; } else { if (!p_Level->bGameResume) p_Level->LiftVParticles[i].dwTime += ber.TimeLastFrame; if (p_Level->LiftVParticles[i].dwTime > 500) { p_Level->LiftVParticles[i].dwTime = 0; if (p_Level->LiftVParticles[i].hHnizdo[0]) { pHnizdo = par_cti_hnizdo(p_Level->LiftVParticles[i].hHnizdo[0]); pHnizdo->time_interval += 10; } } if (p_Level->LiftVParticles[i].hHnizdo[0]) { kom_mesh_get_float(p_Level->LiftVParticles[i].hHnizdo[1], &pos[0], &pos[1], &pos[2], &r); memcpy((void *) p_Level->LiftVParticles[i].pivot[0], (void *) pos, 3 * sizeof(float)); p_Level->LiftVParticles[i].pivot[0][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftVParticles[i].pivot[0][1]--; p_Level->LiftVParticles[i].pivot[0][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftVParticles[i].dir[0][0] = 0; p_Level->LiftVParticles[i].dir[0][1] = ((-randf() / (float) (RAND_MAX)) / 7.0f) * _3DKOREKCE; if (p_Level->LiftVParticles[i].dir[0][1] > (-0.1f) * _3DKOREKCE) p_Level->LiftVParticles[i].dir[0][1] = (-0.1f) * _3DKOREKCE; p_Level->LiftVParticles[i].dir[0][2] = 0; f = (randf() / (float) (RAND_MAX)) / 8.0f; par_vloz_hnizdo_scale(p_Level->LiftVParticles[i].hHnizdo[0], f, f, 0, 0); } } } } void am_Do_Lifts(LEVELINFO * p_Level) { int i, r; float f, pos[3]; DWORD dwTime, dwEplased; dwTime = timeGetTime(); for (i = 0; i < 10; i++) { if (p_Level->LiftParticles[i].System) { dwEplased = dwTime - p_Level->LiftParticles[i].dwStart; if (dwEplased > p_Level->LiftParticles[i].dwStop) { if (!par_get_hnizda(p_Level->LiftParticles[i].System)) { par_zrus(p_Level->LiftParticles[i].System); p_Level->LiftParticles[i].System = (size_ptr)NULL; } else if (p_Level->LiftParticles[i].hHnizdo[0]) { par_vloz_hnizdo_pivot(p_Level->LiftParticles[i].hHnizdo[0], NULL); p_Level->LiftParticles[i].hHnizdo[0] = 0; } } else { if (!p_Level->bGameResume) p_Level->LiftParticles[i].dwTime += ber.TimeLastFrame; if (p_Level->LiftParticles[i].dwTime > 100) { p_Level->LiftParticles[i].dwTime = 0; r = rand() % 100; if (r < 50 && p_Level->LiftParticles[i].hHnizdo[0]) { //nacteni pozice vytahu kom_mesh_get_float(p_Level->LiftParticles[i].hHnizdo[1], &pos[0], &pos[1], &pos[2], &r); memcpy((void *) p_Level->LiftParticles[i].pivot[0], (void *) pos, 3 * sizeof(float)); p_Level->LiftParticles[i].pivot[0][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftParticles[i].pivot[0][1]--; p_Level->LiftParticles[i].pivot[0][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftParticles[i].dir[0][0] = 0; p_Level->LiftParticles[i].dir[0][1] = ((-randf() / (float) (RAND_MAX)) / 10.0f) * _3DKOREKCE; if (p_Level->LiftParticles[i].dir[0][1] > (-0.03f) * _3DKOREKCE) p_Level->LiftParticles[i].dir[0][1] = (-0.03f) * _3DKOREKCE; p_Level->LiftParticles[i].dir[0][2] = 0; f = (randf() / (float) (RAND_MAX)) / 25.0f; par_vloz_hnizdo_scale(p_Level->LiftParticles[i].hHnizdo[0], f, f, 0, 0); par_vloz_hnizdo_pust_castici(p_Level->LiftParticles[i]. hHnizdo[0]); } } } } am_Do_LiftVParticies(i, p_Level); } } void am_Do_Water_KolaB(LEVELINFO * p_Level) { int i, rot; float a, pos[3]; DWORD dwTime, dwEplased; PARMETAC_HNIZDO *pHnizdo; WATER_BOUNDARY Boundary; dwTime = timeGetTime(); for (i = 0; i < 100; i++) if (p_Level->VodniKolaB[i].System) { dwEplased = dwTime - p_Level->VodniKolaB[i].dwStart - ber.TimeLastFrame; if (p_Level->VodniKolaB[i].dwExpire) { if (!p_Level->bGameResume) p_Level->VodniKolaB[i].dwExpireTime += ber.TimeLastFrame; if (p_Level->VodniKolaB[i].dwExpireTime >= p_Level->VodniKolaB[i].dwExpire && p_Level->VodniKolaB[i].hHnizdo[2] != (size_ptr) -1) p_Level->VodniKolaB[i].hHnizdo[2] = -1; } if (p_Level->VodniKolaB[i].hHnizdo[2] != (size_ptr) -1) { kom_mesh_get_float(p_Level->VodniKolaB[i].hHnizdo[2], &pos[0], &pos[1], &pos[2], &rot); if (!p_Level->VodniKolaB[i].dwExpire) w_Choose_Best_Boundary(&Boundary, pos[0], pos[2], pos[1] - 1, WATER_BOUNDARY_METHOD_SIZE_HEURISTICS); else w_Choose_Best_Boundary(&Boundary, pos[0], pos[2], p_Level->VodniKolaB[i].pivot[0][1] - 0.67f, WATER_BOUNDARY_METHOD_SIZE_HEURISTICS); if (p_Level->VodniKolaB[i].hHnizdo[0]) { par_vloz_hnizdo_clip(p_Level->VodniKolaB[i].hHnizdo[0], Boundary.Left, Boundary.Bottom, Boundary.Right, Boundary.Top); } pos[1] -= 0.33f; p_Level->VodniKolaB[i].pivot[0][0] = pos[0]; if (!p_Level->VodniKolaB[i].dwExpire) p_Level->VodniKolaB[i].pivot[0][1] = pos[1]; p_Level->VodniKolaB[i].pivot[0][2] = pos[2]; } if (dwEplased > p_Level->VodniKolaB[i].dwStop) { if (!par_get_hnizda(p_Level->VodniKolaB[i].System)) { par_zrus(p_Level->VodniKolaB[i].System); p_Level->VodniKolaB[i].System = (size_ptr)NULL; } else { pHnizdo = par_cti_hnizdo(p_Level->VodniKolaB[i].hHnizdo[0]); if (pHnizdo) { if (!p_Level->bGameResume) p_Level->VodniKolaB[i].dwTime += ber.TimeLastFrame; if (p_Level->VodniKolaB[i].dwTime > 250) { p_Level->VodniKolaB[i].dwTime = 0; if (pHnizdo->a > 0) { a = pHnizdo->a - 0.05f; if (a <= 0) a = 0; par_vloz_hnizdo_diff(p_Level->VodniKolaB[i].hHnizdo[0], pHnizdo->r, pHnizdo->g, pHnizdo->b, a, pHnizdo->dr, pHnizdo->dg, pHnizdo->db, pHnizdo->da, pHnizdo->ka); } else if (p_Level->VodniKolaB[i].hHnizdo[0]) { par_vloz_hnizdo_pivot(p_Level->VodniKolaB[i].hHnizdo[0], NULL); p_Level->VodniKolaB[i].hHnizdo[0] = 0; } } } } } } } void am_Do_Water(LEVELINFO * p_Level) { int i; float a; DWORD dwTime, dwEplased; PARMETAC_HNIZDO *pHnizdo; dwTime = timeGetTime(); for (i = 0; i < 10; i++) if (p_Level->VodniKola[i].System) { dwEplased = dwTime - p_Level->VodniKola[i].dwStart - ber.TimeLastFrame; if (dwEplased > p_Level->VodniKola[i].dwStop) { if (!par_get_hnizda(p_Level->VodniKola[i].System)) { par_zrus(p_Level->VodniKola[i].System); p_Level->VodniKola[i].System = (size_ptr)NULL; } else { pHnizdo = par_cti_hnizdo(p_Level->VodniKola[i].hHnizdo[0]); if (pHnizdo) { if (!p_Level->bGameResume) p_Level->VodniKola[i].dwTime += ber.TimeLastFrame; if (p_Level->VodniKola[i].dwTime > 250) { p_Level->VodniKola[i].dwTime = 0; if (pHnizdo->a > 0) { a = pHnizdo->a - 0.05f; if (a <= 0) a = 0; par_vloz_hnizdo_diff(p_Level->VodniKola[i].hHnizdo[0], pHnizdo->r, pHnizdo->g, pHnizdo->b, a, pHnizdo->dr, pHnizdo->dg, pHnizdo->db, pHnizdo->da, pHnizdo->ka); } else if (p_Level->VodniKola[i].hHnizdo[0]) { par_vloz_hnizdo_pivot(p_Level->VodniKola[i].hHnizdo[0], NULL); p_Level->VodniKola[i].hHnizdo[0] = 0; } } } } } } } int am_Get_Free_VodniKola(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->VodniKola[i].System) return i; return -1; } int am_Kola_na_Vode(float *pos, int VyskaSloupce, int VyskaPadu, int predmet, LEVELINFO * p_Level) { int k, m; PAR_KOUR_STOPA *pKourovaS; PARMETAC_HNIZDO *pHnizdo = NULL; SYSTEMKOUROVYCHCASTIC *pSystem; WATER_BOUNDARY Boundary; int size = ftoi(100 / p_Level->KvalitaCastic); k = am_Get_Free_VodniKola(p_Level); if (k == -1) return -1; pSystem = &p_Level->VodniKola[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return -1; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; pSystem->dwStart = timeGetTime(); m = kom_najdi_material("cvkolo1"); if (m == -1) kprintf(1, "Nelze najit material cvkolo1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = 1.5f; pKourovaS[0].utlum_x = 2.75f + ((VyskaPadu - 1) * 0.25f); pKourovaS[0].utlum_y = 2.75f + ((VyskaPadu - 1) * 0.25f); pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.6f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = -0.15f; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_3D | TPAR_SCALE_ADD | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_2DCLIP, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 550, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 550, -550); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][1] += 0.7f; if (pSystem->hHnizdo[0]) pHnizdo = par_cti_hnizdo(pSystem->hHnizdo[0]); pSystem->nx[0][0] = 1; pSystem->nx[0][1] = 0; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 0; pSystem->ny[0][2] = 1; pHnizdo->p_nx = (BOD *) pSystem->nx[0]; pHnizdo->p_ny = (BOD *) pSystem->ny[0]; pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwExpire = 0; pSystem->dwExpireTime = 0; pSystem->dwStop = VyskaSloupce * 10; memcpy((void *) pSystem->pivot[1], (void *) pos, 3 * sizeof(float)); // pSystem->hHnizdo[1] = 0; pSystem->hHnizdo[2] = VyskaPadu; pSystem->hHnizdo[3] = predmet; w_Choose_Best_Boundary(&Boundary, pos[0], pos[2], pos[1], WATER_BOUNDARY_METHOD_SIZE_HEURISTICS); par_vloz_hnizdo_clip(pSystem->hHnizdo[0], Boundary.Left, Boundary.Bottom, Boundary.Right, Boundary.Top); par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); return k; } void am_Do_Vodni_Cakanec1(float *pos, int vyska, int Predmet, LEVELINFO * p_Level) { int i, r; PAR_STREPINA *pCastice; int pocercastic; int material; float v; float fpos[3]; memcpy((void *) fpos, (void *) pos, 3 * sizeof(float)); fpos[1] += 0.7f; for (i = 0; i < 10; i++) { r = rand() % 10; if (p_Level->VodniCakanec1[r].flag == -1) break; } if (i == 10) return; p_Level->VodniCakanec1[r].dwStart = timeGetTime(); if (Predmet) pocercastic = p_Level->VodniCakanec1[r].Sizeof / 2; else pocercastic = p_Level->VodniCakanec1[r].Sizeof; pCastice = (PAR_STREPINA *) malloc(pocercastic * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->VodniCakanec1[r].pCastice, pocercastic * sizeof(PAR_STREPINA)); //pregeneruj parametry podle vysky padu for (i = 0; i < pocercastic; i++) { v = (pCastice[i].vel1 + pCastice[i].vel2 + pCastice[i].vel3 + pCastice[i].vel4) / 2.0f; if (Predmet) { pCastice[i].rychlost = (((randf() / (float) (RAND_MAX)) * v) * (8.0f + (vyska * 0.25f))) * _3DKOREKCE; if (pCastice[i].rychlost < 0.1f * _3DKOREKCE) pCastice[i].rychlost = 0.1f * _3DKOREKCE; pCastice[i].p.z = ((rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX) / 5.0f; pCastice[i].p.x = ((rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX) / 5.0f; } else { pCastice[i].rychlost = (((randf() / (float) (RAND_MAX)) * v) * (8.0f + (vyska * 0.5f))) * _3DKOREKCE; if (pCastice[i].rychlost < 0.1f * _3DKOREKCE) pCastice[i].rychlost = 0.1f * _3DKOREKCE; } } ParHandle ph = par_vyrob(); material = kom_najdi_material("ckapka2"); if (material == -1) kprintf(1, "Nelze najit material ckapka2"); par_set_param(ph, material, TPAR_YPLANE_LOW | TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) fpos, NULL); par_set_y_plane(ph, fpos[1] - 0.1f); par_vloz_strepy(ph, pCastice, pocercastic); par_pripoj_funkci(ph, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pCastice)); par_go(ph, &p_Level->VodniCakanec1[r].flag, 0, 0); } void am_Do_Vodni_Cakanec2(float *pos, int VyskaPadu, int predmet, LEVELINFO * p_Level) { int i, r; PAR_STREPINA *pCastice; int pocercastic; int material; float v; float fpos[3]; memcpy((void *) fpos, (void *) pos, 3 * sizeof(float)); fpos[1] += 0.7f; for (i = 0; i < 10; i++) { r = rand() % 10; if (p_Level->VodniCakanec2[r].flag == -1) break; } if (i == 10) { for (i = 0; i < 10; i++) { if (p_Level->VodniCakanec2[i].flag == -1) break; } if (i == 10) return; r = i; } if (predmet) pocercastic = p_Level->VodniCakanec1[r].Sizeof / 2; else pocercastic = p_Level->VodniCakanec1[r].Sizeof; p_Level->VodniCakanec2[r].dwStart = timeGetTime(); pCastice = (PAR_STREPINA *) malloc(pocercastic * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->VodniCakanec2[r].pCastice, pocercastic * sizeof(PAR_STREPINA)); //pregeneruj parametry podle vysky padu for (i = 0; i < pocercastic; i++) { v = (pCastice[i].vel1 + pCastice[i].vel2 + pCastice[i].vel3 + pCastice[i].vel4) / 2.0f; if (!predmet) pCastice[i].rychlost = (((randf() / (float) (RAND_MAX)) * v) * (8.0f + VyskaPadu)) * _3DKOREKCE; else pCastice[i].rychlost = (((randf() / (float) (RAND_MAX)) * v) * (8.0f + (VyskaPadu / 2.0f))) * _3DKOREKCE; if (pCastice[i].rychlost < 0.1f * _3DKOREKCE) pCastice[i].rychlost = 0.1f * _3DKOREKCE; } ParHandle ph = par_vyrob(); if (!ph) return; material = kom_najdi_material("ckapka2"); if (material == -1) kprintf(1, "Nelze najit material ckapka2"); par_set_param(ph, material, TPAR_YPLANE_LOW | TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) fpos, NULL); par_set_y_plane(ph, fpos[1] - 0.1f); par_vloz_strepy(ph, pCastice, pocercastic); par_pripoj_funkci(ph, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pCastice)); par_go(ph, &p_Level->VodniCakanec2[r].flag, 0, 0); } int am_Get_Free_Lift_VParticles(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->LiftVParticles[i].System) return i; return -1; } void am_Do_Lift_VParticles(float *pos, int mesh, LEVELINFO * p_Level) { int k, m; PAR_KOUR_STOPA *pKourovaS; int size = ftoi(500 / p_Level->KvalitaCastic); k = am_Get_Free_Lift_VParticles(p_Level); if (k == -1) return; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; p_Level->LiftVParticles[k].pCastice = pKourovaS; p_Level->LiftVParticles[k].Sizeof = size; p_Level->LiftVParticles[k].dwStart = timeGetTime(); m = kom_najdi_material("ckapka1"); if (m == -1) kprintf(1, "Nelze najit material ckapka1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)); pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 1.0f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; p_Level->LiftVParticles[k].System = par_vyrob(); par_set_param(p_Level->LiftVParticles[k].System, m, TPAR_NO_FOG | TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->LiftVParticles[k].System, pKourovaS, p_Level->LiftVParticles[k].Sizeof); p_Level->LiftVParticles[k].hHnizdo[0] = par_vloz_hnizdo(p_Level->LiftVParticles[k].System); par_vloz_hnizdo_komplet(p_Level->LiftVParticles[k].hHnizdo[0], 1, (BOD *) p_Level->LiftVParticles[k].pivot[0], pKourovaS); par_vloz_hnizdo_timer(p_Level->LiftVParticles[k].hHnizdo[0], 1, -1); memcpy((void *) p_Level->LiftVParticles[k].pivot[0], (void *) pos, 3 * sizeof(float)); p_Level->LiftParticles[k].pivot[0][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftParticles[k].pivot[0][1]--; p_Level->LiftParticles[k].pivot[0][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftParticles[k].dir[0][0] = 0; p_Level->LiftParticles[k].dir[0][1] = ((-randf() / (float) (RAND_MAX)) / 10.0f) * _3DKOREKCE; if (p_Level->LiftVParticles[k].dir[0][1] > (-0.03f) * _3DKOREKCE) p_Level->LiftVParticles[k].dir[0][1] = (-0.03f) * _3DKOREKCE; p_Level->LiftVParticles[k].dir[0][2] = 0; par_vloz_hnizdo_dir(p_Level->LiftVParticles[k].hHnizdo[0], (BOD *) p_Level->LiftVParticles[k].dir[0]); par_vloz_hnizdo_y_plane(p_Level->LiftVParticles[k].hHnizdo[0], pos[1] + 0.7f); p_Level->LiftVParticles[k].dwStart = timeGetTime(); p_Level->LiftVParticles[k].dwTime = 0; par_pripoj_funkci(p_Level->LiftVParticles[k].System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); p_Level->LiftVParticles[k].hHnizdo[1] = mesh; par_go(p_Level->LiftVParticles[k].System, &p_Level->LiftVParticles[k].flag, 0, 0); } int am_Get_Free_VodniKolaB(LEVELINFO * p_Level) { int i; for (i = 0; i < 100; i++) if (!p_Level->VodniKolaB[i].System) return i; return -1; } int am_Find_Corresponding_VodniKolaB(int mesh, LEVELINFO * p_Level) { int i; for (i = 0; i < 100; i++) { if (p_Level->VodniKolaB[i].System && p_Level->VodniKolaB[i].hHnizdo[2] == (size_ptr) mesh) return i; } return -1; } int am_Kola_na_VodeB(float *pos, int Beruska, int mesh, int infinity, LEVELINFO * p_Level) { int k, m; PAR_KOUR_STOPA *pKourovaS; PARMETAC_HNIZDO *pHnizdo = NULL; SYSTEMKOUROVYCHCASTIC *pSystem; WATER_BOUNDARY Boundary; int size = ftoi(100 / p_Level->KvalitaCastic); pos[1] -= 0.5f; k = am_Find_Corresponding_VodniKolaB(mesh, p_Level); if (k != -1) { p_Level->VodniKolaB[k].dwStart = timeGetTime(); par_vloz_hnizdo_diff(p_Level->VodniKolaB[k].hHnizdo[0], 1.0f, 1.0f, 1.0f, 0.6f, -0.25f, -0.25f, -0.25f, -0.25f, 0); par_vloz_hnizdo_pivot(p_Level->VodniKolaB[k].hHnizdo[0], (BOD *) p_Level->VodniKolaB[k].pivot[0]); w_Choose_Best_Boundary(&Boundary, pos[0], pos[2], pos[1] - 0.5f, WATER_BOUNDARY_METHOD_SIZE_HEURISTICS); par_vloz_hnizdo_clip(p_Level->VodniKolaB[k].hHnizdo[0], Boundary.Left, Boundary.Bottom, Boundary.Right, Boundary.Top); return -1; } k = am_Get_Free_VodniKolaB(p_Level); if (k == -1) return -1; pSystem = &p_Level->VodniKolaB[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return -1; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; pSystem->dwStart = timeGetTime(); m = kom_najdi_material("cvkolo1"); if (m == -1) kprintf(1, "Nelze najit material cvkolo1"); if (!Beruska) pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = 1.5f; else pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = 0.5f; pKourovaS[0].utlum_x = 1.75f; pKourovaS[0].utlum_y = 1.75f; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.6f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = -0.25f; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_3D | TPAR_SCALE_ADD | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_2DCLIP, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 400, (BOD *) pSystem->pivot[0], pKourovaS); if (p_Level->bSikminaDown) par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 400, 500); else par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 400, -400); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][1] += 0.7f; if (pSystem->hHnizdo[0]) pHnizdo = par_cti_hnizdo(pSystem->hHnizdo[0]); pSystem->nx[0][0] = 1; pSystem->nx[0][1] = 0; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 0; pSystem->ny[0][2] = 1; pHnizdo->p_nx = (BOD *) pSystem->nx[0]; pHnizdo->p_ny = (BOD *) pSystem->ny[0]; pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwExpire = 0; pSystem->dwExpireTime = 0; if (!infinity) pSystem->dwStop = 500; else pSystem->dwStop = 7200000; pSystem->hHnizdo[1] = Beruska; pSystem->hHnizdo[2] = mesh; //if(infinity) w_Choose_Best_Boundary(&Boundary, pos[0], pos[2], pos[1] - 0.5f, WATER_BOUNDARY_METHOD_SIZE_HEURISTICS); par_vloz_hnizdo_clip(pSystem->hHnizdo[0], Boundary.Left, Boundary.Bottom, Boundary.Right, Boundary.Top); par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); return k; } void am_Release_BublSystem(int i, LEVELINFO * p_Level) { par_zrus(p_Level->BublSystem[i].System.System); p_Level->BublSystem[i].System.System = (size_ptr)NULL; } void am_Do_BublSystem(int i, LEVELINFO * p_Level) { float pos[3], f; int rot; SYSTEMKOUROVYCHCASTIC *pSystem = &p_Level->BublSystem[i].System; if (!p_Level->bGameResume) pSystem->dwTime += ber.TimeLastFrame; if (pSystem->dwTime > pSystem->dwStop) { pSystem->dwTime = 0; if (p_Level->BublSystem[i].bOn) { p_Level->BublSystem[i].bOn = 0; par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 100000, 0); pSystem->dwStop = 3000; } else { pSystem->dwStop = 1000 + p_Level->BublSystem[i].iStart; p_Level->BublSystem[i].bOn = 1; par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 1, p_Level->BublSystem[i].iStart); p_Level->BublSystem[i].iStart = 0; } } kom_mesh_get_float(p_Level->BublSystem[i].mesh, &pos[0], &pos[1], &pos[2], &rot); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][0] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->pivot[0][1] += 0.70f; pSystem->pivot[0][2] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 5.0f; if (pSystem->dir[0][1] < 1.0f) pSystem->dir[0][1] = 1.0f; f = (randf() / (float) (RAND_MAX)) / 7.0f; par_vloz_hnizdo_scale(pSystem->hHnizdo[0], f, f, 0, 0); if (am_Find_Water(i, &f, p_Level)) par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], f); } int am_Find_Water(int i, float *f, LEVELINFO * p_Level) { int r; int j; int iPos[3]; float pos[3]; memcpy((void *) iPos, (void *) p_Level->Item[p_Level->BublSystem[i].iItem].Pos, 3 * sizeof(int)); iPos[2]++; for (j = iPos[2]; j < p_Level->Size[2]; j += 2) { gl_Logical2Real(iPos[0], iPos[1], j, &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 12) { kom_get_fyz_souradnice(iPos[0], j, iPos[1], (BOD *) pos); *f = pos[1] + 0.6f; return 1; } gl_Logical2Real(iPos[0], iPos[1], j + 1, &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 2) { kom_get_fyz_souradnice(iPos[0], j, iPos[1], (BOD *) pos); *f = pos[1]; return 1; } } *f = ber.y_start + 50; return p_Level->bUnderWaterLevel; } int am_Find_WaterB(int *viPos, float *f, LEVELINFO * p_Level) { int r; int j; int iPos[3]; float pos[3]; memcpy((void *) iPos, (void *) viPos, 3 * sizeof(int)); iPos[2]++; for (j = iPos[2]; j < p_Level->Size[2]; j += 2) { gl_Logical2Real(iPos[0], iPos[1], j, &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 12) { kom_get_fyz_souradnice(iPos[0], j, iPos[1], (BOD *) pos); *f = pos[1] + 0.6f; return 1; } } *f = ber.y_start + 50; return p_Level->bUnderWaterLevel; } void am_Create_BublSystem(int i, LEVELINFO * p_Level) { float pos[3], f; int m, rot; PAR_KOUR_STOPA *pKourovaS; SYSTEMKOUROVYCHCASTIC *pSystem = &p_Level->BublSystem[i].System; int size = ftoi(500 / p_Level->KvalitaCastic); pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; m = kom_najdi_material("cbublina1"); if (m == -1) kprintf(1, "Nelze najit material cbublina1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 7.0f; pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.8f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); kom_mesh_get_float(p_Level->BublSystem[i].mesh, &pos[0], &pos[1], &pos[2], &rot); pos[1]++; par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 100000, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 100000, -100000); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][0] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->pivot[0][1] += 0.70f; pSystem->pivot[0][2] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->dir[0][0] = 0; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 5.0f; if (pSystem->dir[0][1] < 1.0f) pSystem->dir[0][1] = 1.0f; pSystem->dir[0][2] = 0; par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); if (am_Find_Water(i, &f, p_Level)) par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], f); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 2000; p_Level->BublSystem[i].bOn = 0; par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); } void am_Do_Bubliny_Berusek(LEVELINFO * p_Level) { int real; int i, j; for (i = 0; i < 6; i++) { if (p_Level->BublSystem[i].iItem != -1) { j = p_Level->BublSystem[i].iItem; gl_Logical2Real(p_Level->Item[j].Pos[0], p_Level->Item[j].Pos[1], p_Level->Item[j].Pos[2], &real, p_Level); if (p_Level->Square[real].bUnderWater && !p_Level->BublSystem[i].System.System) am_Create_BublSystem(i, p_Level); else if (p_Level->Square[real].bUnderWater && p_Level->BublSystem[i].System.System) am_Do_BublSystem(i, p_Level); else if (!p_Level->Square[real].bUnderWater && p_Level->BublSystem[i].System.System) am_Release_BublSystem(i, p_Level); } } } void am_Do_BublVybuchy(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) { if (p_Level->BublVybuch[i].System) { if (p_Level->BublVybuch[i].hHnizdo[0]) { par_vloz_hnizdo_pivot(p_Level->BublVybuch[i].hHnizdo[0], NULL); p_Level->BublVybuch[i].hHnizdo[0] = 0; if (!par_get_hnizda(p_Level->BublVybuch[i].System)) { par_zrus(p_Level->BublVybuch[i].System); p_Level->BublVybuch[i].System = (size_ptr)NULL; } } } } } int am_Get_Free_BublVybuch(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->BublVybuch[i].System) return i; return -1; } void am_Do_Vybuch_Bublin(int *iPos, float *fPos, LEVELINFO * p_Level) { float f; int m; PAR_KOUR_STOPA *pKourovaS; PAR_KOUR_STOPA *pCastice; SYSTEMKOUROVYCHCASTIC *pSystem; int size = ftoi(500 / p_Level->KvalitaCastic); m = am_Get_Free_BublVybuch(p_Level); if (m == -1) return; pSystem = &p_Level->BublVybuch[m]; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; m = kom_najdi_material("cbublina1"); if (m == -1) kprintf(1, "Nelze najit material cbublina1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 4.5f; pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.8f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR, (BOD *) fPos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 1, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 1, -1); memcpy((void *) pSystem->pivot[0], (void *) fPos, 3 * sizeof(float)); if (am_Find_WaterB(iPos, &f, p_Level)) { float fpos[3]; par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], f); fpos[0] = pSystem->pivot[0][0]; fpos[2] = pSystem->pivot[0][2]; //fpos[1] = pSystem->pivot[0][1] + (f - 0.6f); fpos[1] = f; if (!p_Level->bUnderWaterLevel) gl_Do_Strepiny_Na_Vode(fpos, p_Level, -0.7f); } pCastice = par_vloz_hnizdo_pust_castice(pSystem->System, pSystem->hHnizdo[0], size); while (pCastice) { pCastice->p.x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)); pCastice->p.y += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)); pCastice->p.z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)); pCastice->dir.x = 0; pCastice->dir.y = (randf() / (float) (RAND_MAX)) * 5.0f; if (pCastice->dir.y < 1.0f) pCastice->dir.y = 1.0f; pCastice->dir.z = 0; pCastice->rychlost_x = pCastice->rychlost_y = (randf() / (float) (RAND_MAX)) / 4.5f; pCastice = pCastice->p_next; } pSystem->dir[0][0] = 0; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 5.0f; if (pSystem->dir[0][1] < 1.0f) pSystem->dir[0][1] = 1.0f; pSystem->dir[0][2] = 0; par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 0; par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); } void am_Do_Exit_Efects(LEVELINFO * p_Level) { EXITEFECT *pEEfect; int i; for (i = 0; i < 10; i++) if (p_Level->ExitEfect[i].System.System) { pEEfect = &p_Level->ExitEfect[i]; if (!p_Level->bGameResume) pEEfect->System.dwTime += ber.TimeLastFrame; if (pEEfect->System.dwTime > pEEfect->System.dwStop) { if (pEEfect->System.hHnizdo[0]) { par_vloz_hnizdo_pivot(pEEfect->System.hHnizdo[0], NULL); pEEfect->System.hHnizdo[0] = 0; } if (pEEfect->System.hHnizdo[1]) { par_vloz_hnizdo_pivot(pEEfect->System.hHnizdo[1], NULL); pEEfect->System.hHnizdo[1] = 0; } } if (par_get_hnizda(pEEfect->System.System) < 2) { par_zrus(pEEfect->System.System); pEEfect->System.System = (size_ptr)NULL; if (pEEfect->hSvetlo != -1) { sdl_svetlo_zrus(pEEfect->hSvetlo); pEEfect->hSvetlo = -1; } if (pEEfect->hEXSvetlo[0] != -1) { edl_svetlo_zrus(pEEfect->hEXSvetlo[0]); pEEfect->hEXSvetlo[0] = -1; } if (pEEfect->hEXSvetlo[1] != -1) { edl_svetlo_zrus(pEEfect->hEXSvetlo[1]); pEEfect->hEXSvetlo[1] = -1; } lani_set(pEEfect->mesh, 0, K_CHYBA, &p_Level->TrashFlag, 0, 0, 0); kom_zrus_prvek(pEEfect->mesh); } } } int am_Get_Free_ExitSystem(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (p_Level->ExitEfect[i].hSvetlo == -1) return i; return -1; } #define EXIT_PARTICES_NUM 100 void am_Do_Exit(int Bmesh, int Emesh, LEVELINFO * p_Level) { int m, k, i; PAR_KOUR_STOPA *pKourovaS; PARMETAC_HNIZDO *pHnizdo = NULL; SYSTEMKOUROVYCHCASTIC *pSystem; EXITEFECT *pEEfect; int hSvetlo; float pos[3]; int rot; i = am_Get_Free_ExitSystem(p_Level); if (i == -1) return; pEEfect = &p_Level->ExitEfect[i]; pEEfect->mesh = Bmesh; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); if (hSvetlo != -1) { kom_mesh_get_float(Bmesh, &pos[0], &pos[1], &pos[2], &rot); sdl_svetlo_set_pos(hSvetlo, (BOD *) pos); sdl_svetlo_set_diff(hSvetlo, 1, 1, 1, 4, 10, 10); sdl_anim_vyrob(hSvetlo, 15, 0, 0, 2); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 10, 4, 10, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 4, 4, 4, 14); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, 0, 0, 0); pEEfect->hSvetlo = hSvetlo; } else pEEfect->hSvetlo = -1; pEEfect->hEXSvetlo[0] = edl_svetlo_vyrob(EDL_BODOVE | EDL_GOURAND | EDL_SPEC_ADD | EDL_DOSAH | EDL_UTLUM_LIN, 0); hSvetlo = pEEfect->hEXSvetlo[0]; if (hSvetlo != -1) { kom_mesh_get_float(Emesh, &pos[0], &pos[1], &pos[2], &rot); pos[1] += 1.0f; edl_svetlo_set_pos(hSvetlo, (BOD *) pos, (BOD *) pos); edl_svetlo_set_spec(hSvetlo, 1, 1, 1); edl_svetlo_set_par(hSvetlo, 1, 3, 0, 4.0f); } pEEfect->hEXSvetlo[1] = edl_svetlo_vyrob(EDL_MESH_LIGHT | EDL_PRUHL_LIGHT | EDL_ALFA_SET | EDL_DOSAH | EDL_UTLUM_KVAD | EDL_PLOSNE_Y, 1); hSvetlo = pEEfect->hEXSvetlo[1]; if (hSvetlo != -1) { edl_svetlo_pridej_mesh(hSvetlo, Bmesh); edl_svetlo_uzavri_meshe(hSvetlo); kom_mesh_get_float(Bmesh, &pos[0], &pos[1], &pos[2], &rot); edl_svetlo_set_pos(hSvetlo, (BOD *) pos, (BOD *) pos); edl_svetlo_set_diff(hSvetlo, 1); edl_svetlo_set_par(hSvetlo, 1, 0, 0, 0); edl_anim_vyrob(hSvetlo, 20, 0, 0, 0, 0, 2); edl_anim_vloz_klic_vzdal(hSvetlo, 0, 0, 0, 1, 0); edl_anim_vloz_klic_vzdal(hSvetlo, 1, 1, 0, 1, 19); edl_anim_start(hSvetlo, &p_Level->TrashFlag, 0, 0, 0); } int ret = kom_mesh_get_float(Bmesh, &pos[0], &pos[1], &pos[2], &rot); assert(ret != K_CHYBA); pSystem = &pEEfect->System; pSystem->Sizeof = EXIT_PARTICES_NUM; pKourovaS = (PAR_KOUR_STOPA *) mmalloc(pSystem->Sizeof * sizeof(PAR_KOUR_STOPA)); pSystem->pCastice = pKourovaS; pSystem->dwStart = timeGetTime(); m = kom_najdi_material("flare11"); if (m == -1) kprintf(1, "Nelze najit material flare11"); for(i = 0; i < pSystem->Sizeof; i++) { pKourovaS[i].rychlost_x = pKourovaS[0].rychlost_y = 1.0f; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 1.0f; } pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_LOW | TPAR_DIR | TPAR_3D | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); for (k = 0; k < 2; k++) { pSystem->hHnizdo[k] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[k], 1000, (BOD *)pSystem->pivot[k], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[k], 1000, -1000); pSystem->pivot[k][0] = pos[0]; pSystem->pivot[k][1] = pos[1]; pSystem->pivot[k][2] = pos[2]; pSystem->dir[k][0] = 0; if (k == 0) pSystem->dir[k][1] = 1; else { pSystem->dir[k][1] = -1; par_vloz_hnizdo_y_plane(pSystem->hHnizdo[k], pos[1] - 0.8f); } pSystem->dir[k][2] = 0; vektor_norm((BOD *) pSystem->dir[k]); par_vloz_hnizdo_dir(pSystem->hHnizdo[k], (BOD *) pSystem->dir[k]); if (pSystem->hHnizdo[k]) pHnizdo = par_cti_hnizdo(pSystem->hHnizdo[k]); pSystem->nx[k][0] = 1; pSystem->nx[k][1] = 0; pSystem->nx[k][2] = 0; pSystem->ny[k][0] = 0; pSystem->ny[k][1] = 0; pSystem->ny[k][2] = 1; pHnizdo->p_nx = (BOD *) pSystem->nx[k]; pHnizdo->p_ny = (BOD *) pSystem->ny[k]; pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 250; } par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); kom_mesh_get_float(Emesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 3; ap_Play_Sound(0, 0, 0, pos, 81 + rot, NULL, &ad); } int am_Get_Free_ExitSparksSystem(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->ExitSparks[i].System) return i; return -1; } void am_Do_Exit_Sparks(LEVELINFO * p_Level) { ITEMDESC *pItem; PAR_KOUR_STOPA *pCastice; int i, r; float f, pos[3]; for (i = 0; i < 10; i++) if (p_Level->ExitSparks[i].System) { if (!p_Level->bGameResume) p_Level->ExitSparks[i].dwTime += ber.TimeLastFrame; //mihotani jisker if (p_Level->ExitSparks[i].dwTime > 100) { if (p_Level->ExitSparks[i].hHnizdo[0]) { pCastice = par_cti_hnizdo_castice(p_Level->ExitSparks[i].hHnizdo[0]); if (pCastice) { while (pCastice) { r = rand() % 100; if (r < 10) { f = (randf() / (float) (RAND_MAX)) / 7.5f; pCastice->rychlost_x += f; pCastice->rychlost_y += f; } pCastice = pCastice->p_next; } } } p_Level->ExitSparks[i].dwTime = 0; } pItem = reinterpret_cast(p_Level->ExitSparks[i].hHnizdo[1]); kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); p_Level->ExitSparks[i].pivot[0][0] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->ExitSparks[i].pivot[0][2] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect_2D(&p_Level->ExitSparks[i].pivot[0][0], &p_Level->ExitSparks[i].pivot[0][2]); f = (randf() / (float) (RAND_MAX)) / 1.35f; p_Level->ExitSparks[i].pivot[0][0] *= f; p_Level->ExitSparks[i].pivot[0][2] *= f; p_Level->ExitSparks[i].pivot[0][0] += pos[0]; p_Level->ExitSparks[i].pivot[0][2] += pos[2]; f = (randf() / (float) (RAND_MAX)) / 10.0f; par_vloz_hnizdo_scale(p_Level->ExitSparks[i].hHnizdo[0], f, f, -0.5f, -0.5f); } } void am_Do_TelCSparks(LEVELINFO * p_Level) { ITEMDESC *pItem; int i, r; float f, pos[3]; PAR_KOUR_STOPA *pCastice; for (i = 0; i < 10; i++) { if (p_Level->TelCSparks[i].System) { // test na vypnuti efektu if (!par_get_hnizda(p_Level->TelCSparks[i].System)) { par_zrus(p_Level->TelCSparks[i].System); p_Level->TelCSparks[i].System = (size_ptr)NULL; sdl_svetlo_zrus(p_Level->TelCSparks[i].hHnizdo[2]); p_Level->TelCSparks[i].hHnizdo[2] = (size_ptr)NULL; continue; } pCastice = par_cti_hnizdo_castice(p_Level->TelCSparks[i].hHnizdo[0]); // test na velikost castic. Pokud je moc mala, tak pric s ni if (pCastice) { while (pCastice) { if (pCastice->rychlost_x < 0.001f || pCastice->rychlost_y < 0.001f) pCastice->a = 0; pCastice = pCastice->p_next; } } pItem = reinterpret_cast(p_Level->TelCSparks[i].hHnizdo[1]); if (pItem) { if ((rand() % 3)) kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); else { int iPos[3]; gl_Real2Logical(pItem->Connection[0], iPos, p_Level); kom_get_fyz_souradnice(iPos[0], iPos[2], iPos[1], (BOD *) pos); } p_Level->TelCSparks[i].pivot[0][0] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->TelCSparks[i].pivot[0][2] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect_2D(&p_Level->TelCSparks[i].pivot[0][0], &p_Level->TelCSparks[i].pivot[0][2]); f = (randf() / (float) (RAND_MAX)) * 0.75f; p_Level->TelCSparks[i].pivot[0][0] *= f; p_Level->TelCSparks[i].pivot[0][2] *= f; p_Level->TelCSparks[i].pivot[0][0] += pos[0]; p_Level->TelCSparks[i].pivot[0][2] += pos[2]; f = (randf() / (float) (RAND_MAX)) / 2.0f; par_vloz_hnizdo_scale(p_Level->TelCSparks[i].hHnizdo[0], f, f, -2.0f, -2.0f); p_Level->TelCSparks[i].dir[0][1] = (randf() / (float) (RAND_MAX)) * 5; } } } } void am_Release_BarelSparks(LEVELINFO * p_Level, ITEMDESC * pBarel) { int i; for (i = 0; i < 30; i++) if (p_Level->BarelSparks[i].System && reinterpret_cast(p_Level->BarelSparks[i].hHnizdo[1]) == pBarel) { par_zrus(p_Level->BarelSparks[i].System); p_Level->BarelSparks[i].System = (size_ptr)NULL; sdl_svetlo_zrus(p_Level->BarelSparks[i].hHnizdo[2]); p_Level->BarelSparks[i].hHnizdo[2] = -1; return; } } void am_Do_BarelSparks(LEVELINFO * p_Level) { ITEMDESC *pItem; int i, r; float f, pos[3]; PAR_KOUR_STOPA *pCastice; for (i = 0; i < 30; i++) { if (p_Level->BarelSparks[i].System) { // test na vypnuti efektu if (!par_get_hnizda(p_Level->BarelSparks[i].System)) { par_zrus(p_Level->BarelSparks[i].System); p_Level->BarelSparks[i].System = (size_ptr)NULL; sdl_svetlo_zrus(p_Level->BarelSparks[i].hHnizdo[2]); p_Level->BarelSparks[i].hHnizdo[2] = -1; continue; } pCastice = par_cti_hnizdo_castice(p_Level->BarelSparks[i].hHnizdo[0]); // test na velikost castic. Pokud je moc mala, tak pric s ni if (pCastice) { while (pCastice) { if (pCastice->rychlost_x < 0.001f || pCastice->rychlost_y < 0.001f) pCastice->a = 0; pCastice = pCastice->p_next; } } pItem = reinterpret_cast(p_Level->BarelSparks[i].hHnizdo[1]); if (pItem) { kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); p_Level->BarelSparks[i].pivot[0][0] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->BarelSparks[i].pivot[0][1] = pos[1] + 1; p_Level->BarelSparks[i].pivot[0][2] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect_2D(&p_Level->BarelSparks[i].pivot[0][0], &p_Level->BarelSparks[i].pivot[0][2]); f = (randf() / (float) (RAND_MAX)) * 0.75f; p_Level->BarelSparks[i].pivot[0][0] *= f; p_Level->BarelSparks[i].pivot[0][2] *= f; p_Level->BarelSparks[i].pivot[0][0] += pos[0]; p_Level->BarelSparks[i].pivot[0][2] += pos[2]; f = (randf() / (float) (RAND_MAX)) / 2.0f; par_vloz_hnizdo_scale(p_Level->BarelSparks[i].hHnizdo[0], f, f, -2.0f, -2.0f); p_Level->BarelSparks[i].dir[0][1] = (randf() / (float) (RAND_MAX)) * 1; pos[1] += 1.25f; sdl_svetlo_set_pos(p_Level->BarelSparks[i].hHnizdo[2], (BOD *) pos); } } } } void am_Create_Exit_Sparks(ITEMDESC * pExit, char Down, LEVELINFO * p_Level) { int m, k; PAR_KOUR_STOPA *pKourovaS; SYSTEMKOUROVYCHCASTIC *pSystem; float pos[3]; int rot; int size = ftoi(100 / p_Level->KvalitaCastic); k = am_Get_Free_ExitSparksSystem(p_Level); if (k == -1) return; pSystem = &p_Level->ExitSparks[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; kom_mesh_get_float(pExit->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; pSystem->dwStart = timeGetTime(); m = kom_najdi_material("flare12"); if (m == -1) kprintf(1, "Nelze najit material flare12"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 10.0f; pKourovaS[0].utlum_x = -0.5f; pKourovaS[0].utlum_y = -0.5f; pKourovaS[0].r = 0.98f; pKourovaS[0].g = 0.91f; pKourovaS[0].b = 0.33f; pKourovaS[0].a = 1.0f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); if (Down) par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_LOW | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); else par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 10, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 10, -10); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); if (Down) pSystem->pivot[0][1] += 0.8f; else pSystem->pivot[0][1] -= 0.8f; pSystem->dir[0][0] = 0; if (Down) pSystem->dir[0][1] = -1; else pSystem->dir[0][1] = 1; pSystem->dir[0][2] = 0; if (Down) par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], pos[1] - 0.8f); else par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], pos[1] + 0.8f); par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 0; pSystem->hHnizdo[1] = reinterpret_cast(pExit); par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); } int am_Get_Free_TelCSparksSystem(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->TelCSparks[i].System) return i; return -1; } int am_Create_TelCSparks(ITEMDESC * pTel, LEVELINFO * p_Level) { int m, k; PAR_KOUR_STOPA *pKourovaS; SYSTEMKOUROVYCHCASTIC *pSystem; float pos[3]; int rot; int size = ftoi(300 / p_Level->KvalitaCastic); k = am_Get_Free_TelCSparksSystem(p_Level); if (k == -1) return -1; pSystem = &p_Level->TelCSparks[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return -1; kom_mesh_get_float(pTel->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; pSystem->dwStart = timeGetTime(); m = kom_najdi_material("flare104"); if (m == -1) kprintf(1, "Nelze najit material flare104"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 3.0f; pKourovaS[0].utlum_x = -2; pKourovaS[0].utlum_y = -2; pKourovaS[0].r = 0; pKourovaS[0].g = 0.8f; pKourovaS[0].b = 0.97f; pKourovaS[0].a = 1.0f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 10, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 10, -10); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][1]--; pSystem->dir[0][0] = 0; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 5; pSystem->dir[0][2] = 0; par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], pos[1] + 3); par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 0; pSystem->hHnizdo[1] = reinterpret_cast(pTel); par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); return k; } void am_TurnOn_The_Teleport(ITEMDESC * pTel, LEVELINFO * p_Level) { float pos[3]; int hSvetlo, rot; int i = am_Create_TelCSparks(pTel, p_Level); int rnd = rand() % 3; if (i == -1) return; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_KVADRATIC); kom_mesh_get_float(pTel->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); if (hSvetlo != -1) { pos[1]++; sdl_svetlo_set_pos(hSvetlo, (BOD *) pos); sdl_svetlo_set_diff(hSvetlo, 1, 1, 1, 2, 3, 3); sdl_anim_vyrob(hSvetlo, 20, 0, 0, 2); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 0, 0, 0, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 3, 2, 3, 19); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, 0, 0, 0); p_Level->TelCSparks[i].hHnizdo[2] = hSvetlo; } else p_Level->TelCSparks[i].hHnizdo[2] = -1; ap_Play_Sound(0,0,0, pos, rnd+71, NULL, &ad); } int am_Find_TelCSparks(ITEMDESC * pTel, LEVELINFO * p_Level) { ITEMDESC *pItem; int i; for (i = 0; i < 10; i++) if (p_Level->TelCSparks[i].System) { pItem = reinterpret_cast(p_Level->TelCSparks[i].hHnizdo[1]); if (pItem) if (pItem->iItem == pTel->iItem) return i; } return -1; } void am_TurnOff_The_Teleport(ITEMDESC * pTel, LEVELINFO * p_Level) { int hSvetlo; float pos[3]; int i = am_Find_TelCSparks(pTel, p_Level); int rnd = rand() % 3; if (i == -1) return; hSvetlo = p_Level->TelCSparks[i].hHnizdo[2]; if (hSvetlo != -1) { sdl_anim_vyrob(hSvetlo, 20, 0, 0, 2); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 3, 2, 3, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 0, 0, 0, 19); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, 0, 0, 0); } if (p_Level->TelCSparks[i].hHnizdo[0]) par_vloz_hnizdo_pivot(p_Level->TelCSparks[i].hHnizdo[0], NULL); p_Level->TelCSparks[i].hHnizdo[1] = 0; kom_get_fyz_souradnice(pTel->Pos[0], pTel->Pos[2], pTel->Pos[1], (BOD *) pos); ap_Play_Sound(0,0,0, pos, rnd+68, NULL, &ad); } void am_Create_Sparks_To_Exits(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) { if (p_Level->Level[i]->p_Object->Class == 4) { am_Create_Exit_Sparks(p_Level->Level[i], 1, p_Level); am_Create_Exit_Sparks(p_Level->Level[i], 0, p_Level); } if (p_Level->Level[i]->p_Object->Class == 9 && !p_Level->Level[i]->p_Object->SubClass) am_Create_TelCSparks(p_Level->Level[i], p_Level); } } int am_Counet_Waters(LEVELINFO * p_Level) { int i, c = 0; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 12) c++; return c; } ITEMDESC *am_Find_Next_Water(int *LastIndex, LEVELINFO * p_Level) { int i, x = (*LastIndex) + 1; for (i = x; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 12) { (*LastIndex) = i; return p_Level->Level[i]; } (*LastIndex) = -1; return NULL; } void am_Do_Rain(RAINSYSTEM * pRain) { float dir[6], pos[3]; int i; // pregeneruj pivoty hnizd vodnich kol if (pRain->bWaterCircles) for (i = 0; i < pRain->SizeofWHnizda; i++) { memcpy((void *) &pRain->Wpivot[i], (void *) &pRain->Wpos[i], sizeof(BOD)); pRain->Wpivot[i].x += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pRain->Wpivot[i].z += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pRain->Wpivot[i].y -= 0.3f; } // pregeneruj pivoty hnizd deste if (pRain->bRain) { kam_get_float_ext(dir, pos); //kprintf(1,"y: %f + %f = %f | floor: %f", pos[1], pRain->fSky, pos[1] + pRain->fSky, ber.y_start); memcpy((void *) &pRain->RainCenter, (void *) pos, sizeof(BOD)); for (i = 0; i < pRain->SizeofHnizda; i++) { memcpy((void *) &pRain->pivot[i], (void *) &pRain->RainCenter, sizeof(BOD)); pRain->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pRain->fDist; pRain->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pRain->fDist; //pRain->pivot[i].y = pRain->fSky; //pRain->pivot[i].y = pos[1] + 1.0f; pRain->pivot[i].y = pos[1] + pRain->fSky; } } } void am_Do_Snow(SNOWSYSTEM * pSnow) { float dir[6], pos[3]; int i; // pregeneruj pivoty hnizd snehu if (pSnow->bSnow) { kam_get_float_ext(dir, pos); memcpy((void *) &pSnow->SnowCenter, (void *) pos, sizeof(BOD)); for (i = 0; i < pSnow->SizeofHnizda; i++) { memcpy((void *) &pSnow->pivot[i], (void *) &pSnow->SnowCenter, sizeof(BOD)); pSnow->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pSnow->fDist; pSnow->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pSnow->fDist; //pSnow->pivot[i].y = pSnow->fSky; //pSnow->pivot[i].y = pos[1] + 1.0f; pSnow->pivot[i].y = pos[1] + pSnow->fSky; assert(fabs(pSnow->pivot[i].x) < 1000); } } } void am_Do_NESChmiri(NATUREEFFECTSYSTEM * pNESystem) { float dir[6], pos[3]; int j; if (!Level.bGameResume) pNESystem->dwTime += ber.TimeLastFrame; if (pNESystem->dwTime > pNESystem->dwRegTime) { pNESystem->dwTime = 0; kam_get_float_ext(dir, pos); for (j = 0; j < pNESystem->SizeofHnizda; j++) { memcpy((void *) &pNESystem->pivot[j], (void *) pos, sizeof(BOD)); pNESystem->pivot[j].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pNESystem->fRadius; pNESystem->pivot[j].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pNESystem->fRadius; //pNESystem->pivot[j].y = pNESystem->fSky; //pNESystem->pivot.y = pos[1] + 1.0f; pNESystem->pivot[j].y = pos[1] + pNESystem->fSky; pNESystem->dir[j].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; //pNESystem->dir[j].y = -0.15f; pNESystem->dir[j].y = (-randf() / (float) (RAND_MAX)) * 0.25f; pNESystem->dir[j].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; } } } void am_Do_NESSvetluska(NATUREEFFECTSYSTEM * pNESystem) { float dir[6], pos[3]; int j; if (!Level.bGameResume) pNESystem->dwTime += ber.TimeLastFrame; if (!Level.bGameResume) pNESystem->dwGenTimeCounter += ber.TimeLastFrame; if (pNESystem->dwGenTimeCounter > pNESystem->dwGenTime) { pNESystem->dwGenTimeCounter = 0; if (!(rand() % pNESystem->iGenProbability)) { int r = rand() % pNESystem->SizeofHnizda; kam_get_float_ext(dir, pos); memcpy((void *) &pNESystem->pivot[r], (void *) pos, sizeof(BOD)); pNESystem->pivot[r].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pNESystem->fRadius; pNESystem->pivot[r].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pNESystem->fRadius; pNESystem->pivot[r].y = pNESystem->fLowPlain; par_vloz_hnizdo_pust_castici(pNESystem->hHnizdo[r]); } return; } if (pNESystem->dwTime > pNESystem->dwRegTime) { pNESystem->dwTime = 0; for (j = 0; j < pNESystem->SizeofHnizda; j++) { if (!(rand() % pNESystem->iGenProbability)) par_vloz_hnizdo_pust_castici(pNESystem->hHnizdo[j]); pNESystem->dir[j].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; pNESystem->dir[j].y = (randf() / (float) (RAND_MAX)) * 0.5f; pNESystem->dir[j].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; } } } void am_Do_NESMusku(NATUREEFFECTSYSTEM * pNESystem) { PAR_KOUR_STOPA *pCastice; int j; if (!Level.bGameResume) pNESystem->dwTime += ber.TimeLastFrame; if (pNESystem->dwTime > pNESystem->dwRegTime) { pNESystem->dwTime = 0; for (j = 0; j < pNESystem->SizeofHnizda; j++) { if (!(rand() % 2)) { pNESystem->dir[j].x = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pNESystem->dir[j].y = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.15f; pNESystem->dir[j].z = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect(&pNESystem->dir[j].x, &pNESystem->dir[j].y, &pNESystem->dir[j].z); memcpy((void *) &pNESystem->nx[j], (void *) &pNESystem->dir[j], sizeof(BOD)); pCastice = par_cti_hnizdo_castice(pNESystem->hHnizdo[j]); if (pCastice) memcpy((void *) &pCastice->nx, (void *) &pNESystem->dir[j], sizeof(BOD)); pNESystem->dir[j].x *= 4; pNESystem->dir[j].z *= 4; } } } } void am_Do_NESList(NATUREEFFECTSYSTEM * pNESystem, LEVELINFO * p_Level) { PAR_KOUR_STOPA *pCastice; float dir[6], pos[3]; int j; if (!p_Level->bGameResume) pNESystem->dwTime += ber.TimeLastFrame; if (!p_Level->bGameResume) pNESystem->dwGenTimeCounter += ber.TimeLastFrame; if (pNESystem->dwGenTimeCounter > pNESystem->dwGenTime) { pNESystem->dwGenTimeCounter = 0; if (!(rand() % pNESystem->iGenProbability)) { int r = rand() % pNESystem->SizeofHnizda; kam_get_float_ext(dir, pos); memcpy((void *) &pNESystem->pivot[r], (void *) pos, sizeof(BOD)); pNESystem->pivot[r].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pNESystem->fRadius; pNESystem->pivot[r].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pNESystem->fRadius; //pNESystem->pivot[r].y = pNESystem->fSky; //pNESystem->pivot.y = pos[1] + 1.0f; pNESystem->pivot[r].y = pos[1] + pNESystem->fSky; par_vloz_hnizdo_pust_castici(pNESystem->hHnizdo[r]); } return; } if (pNESystem->dwTime > pNESystem->dwRegTime) { pNESystem->dwTime = 0; for (j = 0; j < pNESystem->SizeofHnizda; j++) { if (!(rand() % pNESystem->iGenProbability)) par_vloz_hnizdo_pust_castici(pNESystem->hHnizdo[j]); pNESystem->dir[j].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.5f; pNESystem->dir[j].y = -3; pNESystem->dir[j].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.5f; pNESystem->dir[j].x += pNESystem->AddDir.x; pNESystem->dir[j].y += pNESystem->AddDir.y; pNESystem->dir[j].z += pNESystem->AddDir.z; pNESystem->dir[j].x += p_Level->fVitr[0]; pNESystem->dir[j].y += p_Level->fVitr[1]; pNESystem->dir[j].z += p_Level->fVitr[2]; memcpy((void *) &pNESystem->nx[j], (void *) &pNESystem->dir[j], sizeof(BOD)); norm_vect(&pNESystem->nx[j].x, &pNESystem->nx[j].y, &pNESystem->nx[j].z); pCastice = par_cti_hnizdo_castice(pNESystem->hHnizdo[j]); while (pCastice) { memcpy((void *) &pCastice->nx, (void *) &pNESystem->nx[j], sizeof(BOD)); pCastice = pCastice->p_next; } } } } void am_Do_Nature_Effects(LEVELINFO * p_Level) { NATUREEFFECTSYSTEM *pNESystem; int i; for (i = 0; i < 10; i++) if (p_Level->NatureESystem[i].pSystem) { pNESystem = &p_Level->NatureESystem[i]; switch (pNESystem->EffectID) { case 1: case 2: case 3: am_Do_NESChmiri(pNESystem); break; case 4: case 5: am_Do_NESMusku(pNESystem); break; case 6: case 7: case 8: case 9: case 10: case 11: am_Do_NESList(pNESystem, p_Level); break; case 12: am_Do_NESSvetluska(pNESystem); break; } } } int am_Create_Water_Circles(LEVELINFO * p_Level, RAINSYSTEM * pRain, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence) { PARMETAC_HNIZDO *pWHnizdo; ITEMDESC *pItem; float pos[3] = { 0, 0, 0 }; PAR_KOUR_STOPA *pCastice; int cWaters, i, material, LastItem = 0, rot; int intensity, delay; pRain->hWHnizdo = NULL; pRain->Wpivot = NULL; pRain->Wpos = NULL; cWaters = am_Counet_Waters(p_Level); if (!cWaters) { pRain->bWaterCircles = 0; return 1; } pRain->SizeofWHnizda = cWaters; // pamet na hnizda pRain->hWHnizdo = (size_ptr *)malloc(cWaters * sizeof(pRain->hWHnizdo[0])); if (!pRain->hWHnizdo) { pRain->bWaterCircles = 0; return 0; } // pamet na pivoty pRain->Wpivot = (BOD *) malloc(cWaters * sizeof(BOD)); if (!pRain->Wpivot) { free((void *) pRain->hWHnizdo); pRain->bWaterCircles = 0; return 0; } // pamet na pozice vody pRain->Wpos = (BOD *) malloc(cWaters * sizeof(BOD)); if (!pRain->Wpos) { free((void *) pRain->hWHnizdo); free((void *) pRain->Wpivot); pRain->bWaterCircles = 0; return 0; } // vypocet potrebne velikosti pameti na castice pRain->SizeofWCastice = cWaters * 10; // pamet na castice pRain->pWCastice = (PAR_KOUR_STOPA *) malloc(pRain->SizeofWCastice * sizeof(PAR_KOUR_STOPA)); if (!pRain->pWCastice) { free((void *) pRain->hWHnizdo); free((void *) pRain->Wpivot); free((void *) pRain->Wpos); pRain->bWaterCircles = 0; return 0; } material = kom_najdi_material("ckolo1"); if (material == -1) kprintf(1, "Nelze najit material ckolo1"); pCastice = &pRain->pWCastice[0]; pCastice->rychlost_x = 0.01f; pCastice->rychlost_y = 0.01f; pCastice->utlum_x = pCastice->utlum_y = 3.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 0.8f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = -3.0f; pCastice->ka = 0.0f; pRain->Wnx.x = 1; pRain->Wnx.y = 0; pRain->Wnx.z = 0; pRain->Wny.x = 0; pRain->Wny.y = 0; pRain->Wny.z = 1; pRain->pWSystem = par_vyrob(); if (!pRain->pWSystem) { free((void *) pRain->hWHnizdo); free((void *) pRain->Wpivot); free((void *) pRain->Wpos); free((void *) pRain->pWCastice); pRain->bWaterCircles = 0; return 0; } par_set_param(pRain->pWSystem, material, TPAR_NO_FOG | TPAR_3D | TPAR_SCALE_ADD | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); pCastice = pRain->pWCastice; par_vloz_kour_stopu(pRain->pWSystem, pCastice, pRain->SizeofWCastice); for (i = 0; i < pRain->SizeofWHnizda; i++) { pRain->hWHnizdo[i] = par_vloz_hnizdo(pRain->pWSystem); if (pRain->hWHnizdo[i]) { pItem = am_Find_Next_Water(&LastItem, p_Level); if (pItem) { kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pRain->Wpos[i].x, &pRain->Wpos[i].y, &pRain->Wpos[i].z, &rot); memcpy((void *) &pRain->Wpivot[i], (void *) &pRain->Wpos[i], sizeof(BOD)); pRain->Wpivot[i].x += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pRain->Wpivot[i].z += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pRain->Wpivot[i].y -= 0.3f; intensity = (int) ceil((uiIntensity / 2.0f) + ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * ((uiIntensity * fmaxDivergence) / 2.0f)); delay = rand() % uiIntensity; par_vloz_hnizdo_timer(pRain->hWHnizdo[i], intensity, delay); par_vloz_hnizdo_komplet(pRain->hWHnizdo[i], intensity, &pRain->Wpivot[i], pCastice); pWHnizdo = par_cti_hnizdo(pRain->hWHnizdo[i]); if (pWHnizdo) { pWHnizdo->p_nx = &pRain->Wnx; pWHnizdo->p_ny = &pRain->Wny; } } } } par_go(pRain->pWSystem, &pRain->flag, 0, 0); pRain->bWaterCircles = 1; return 1; } int am_Create_Rain(LEVELINFO * p_Level, RAINSYSTEM * pRain, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence, float fSky) { PARMETAC_HNIZDO *pHnizdo; float fvPos[3]; PAR_KOUR_STOPA *pCastice; int i, material, intensity, delay; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pRain->fDist = fRadius; // radius deste pRain->uiDensity = uiDensity; // hustota deste (pocet hnizd) pRain->uiIntensity = uiIntensity; // intenzita deste (casovy interval knizd) pRain->fSky = fSky; // vyska oblohy (y souradnice, odkud kapky padaji) pRain->fLowPlain = ber.y_start; // dno levelu memcpy((void *) &pRain->RainCenter, (void *) fvPos, 3 * sizeof(float)); // pamet na hnizda pRain->hHnizdo = (size_ptr *)malloc(uiDensity * sizeof(pRain->hHnizdo[0])); if (!pRain->hHnizdo) { pRain->bRain = 0; return 0; } else { pRain->SizeofHnizda = uiDensity; } // pamet na pivoty pRain->pivot = (BOD *) malloc(uiDensity * sizeof(BOD)); if (!pRain->pivot) { free((void *) pRain->hHnizdo); pRain->bRain = 0; return 0; } // vypocet potrebne velikosti pameti na castice pRain->SizeofCastice = (int) ceil((uiDensity * 2) + (fRadius * fRadius)); // pamet na castice pRain->pCastice = (PAR_KOUR_STOPA *) malloc(pRain->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pRain->pCastice) { free((void *) pRain->hHnizdo); free((void *) pRain->pivot); pRain->bRain = 0; return 0; } // prvotni nagenerovani deste material = kom_najdi_material("ckapka3"); if (material == -1) kprintf(1, "Nelze najit material ckapka3"); pCastice = &pRain->pCastice[0]; pCastice->rychlost_x = 0.3f; pCastice->rychlost_y = 0.02f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pRain->dir.x = (rand() & 0x1 ? randf() : -randf()) / (2 * (float) RAND_MAX); pRain->dir.y = -27.0f; pRain->dir.z = (rand() & 0x1 ? randf() : -randf()) / (2 * (float) RAND_MAX); memcpy((void *) &pRain->nx, (void *) &pRain->dir, sizeof(BOD)); norm_vect(&pRain->nx.x, &pRain->nx.y, &pRain->nx.z); pRain->pSystem = par_vyrob(); if (!pRain->pSystem) { free((void *) pRain->hHnizdo); free((void *) pRain->pivot); free((void *) pRain->pCastice); pRain->bRain = 0; return 0; } par_set_param(pRain->pSystem, material, TPAR_3D | TPAR_HALF_LIFE | TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_NO_FOG, (BOD *) fvPos, NULL); pCastice = pRain->pCastice; par_vloz_kour_stopu(pRain->pSystem, pCastice, pRain->SizeofCastice); for (i = 0; i < pRain->SizeofHnizda; i++) { pRain->hHnizdo[i] = par_vloz_hnizdo(pRain->pSystem); if (pRain->hHnizdo[i]) { intensity = (int) ceil(uiIntensity + ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * (uiIntensity * fmaxDivergence)); delay = rand() % uiIntensity; par_vloz_hnizdo_timer(pRain->hHnizdo[i], intensity, delay); par_vloz_hnizdo_komplet(pRain->hHnizdo[i], intensity, &pRain->pivot[i], pCastice); memcpy((void *) &pRain->pivot[i], (void *) fvPos, 3 * sizeof(float)); pRain->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pRain->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pRain->pivot[i].y = ber.y_start + fSky; par_vloz_hnizdo_dir(pRain->hHnizdo[i], &pRain->dir); par_vloz_hnizdo_y_plane(pRain->hHnizdo[i], pRain->fLowPlain); pHnizdo = par_cti_hnizdo(pRain->hHnizdo[i]); if (pHnizdo) { pHnizdo->p_nx = &pRain->nx; pHnizdo->p_ny = &pRain->ny; } } } par_go(pRain->pSystem, &pRain->flag, 0, 0); pRain->bRain = 1; am_Create_Water_Circles(p_Level, pRain, fRadius, uiDensity, uiIntensity, fmaxDivergence); return 1; } int am_Create_Snow(LEVELINFO * p_Level, SNOWSYSTEM * pSnow, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence, float fSky) { float fvPos[3]; PAR_KOUR_STOPA *pCastice; int i, material, intensity, delay; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pSnow->fDist = fRadius; // radius snehu pSnow->uiDensity = uiDensity; // hustota snehu (pocet hnizd) pSnow->uiIntensity = uiIntensity; // intenzita snehu (casovy interval knizd) pSnow->fSky = fSky; // vyska oblohy (y souradnice, odkud kapky padaji) pSnow->fLowPlain = ber.y_start; // dno levelu memcpy((void *) &pSnow->SnowCenter, (void *) fvPos, 3 * sizeof(float)); // pamet na hnizda pSnow->hHnizdo = (size_ptr *) mmalloc(uiDensity * sizeof(size_ptr)); if (!pSnow->hHnizdo) { pSnow->bSnow = 0; return 0; } else pSnow->SizeofHnizda = uiDensity; // pamet na pivoty pSnow->pivot = (BOD *) mmalloc(uiDensity * sizeof(BOD)); if (!pSnow->pivot) { free((void *) pSnow->hHnizdo); pSnow->bSnow = 0; return 0; } // vypocet potrebne velikosti pameti na castice pSnow->SizeofCastice = (int) ceil((uiDensity * 20) + (fRadius * fRadius)); // pamet na castice pSnow->pCastice = (PAR_KOUR_STOPA *) mmalloc(pSnow->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pSnow->pCastice) { free((void *) pSnow->hHnizdo); free((void *) pSnow->pivot); pSnow->bSnow = 0; return 0; } // prvotni nagenerovani deste material = kom_najdi_material("cvlocka1"); if (material == -1) kprintf(1, "Nelze najit material cvlocka1"); pCastice = &pSnow->pCastice[0]; pCastice->rychlost_y = 0.02f; pCastice->rychlost_y = 0.02f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pSnow->dir.x = (rand() & 0x1 ? randf() : -randf()) / (6 * (float) RAND_MAX); pSnow->dir.y = -0.25f; pSnow->dir.z = (rand() & 0x1 ? randf() : -randf()) / (6 * (float) RAND_MAX); pSnow->pSystem = par_vyrob(); if (!pSnow->pSystem) { free((void *) pSnow->hHnizdo); free((void *) pSnow->pivot); free((void *) pSnow->pCastice); pSnow->bSnow = 0; return 0; } par_set_param(pSnow->pSystem, material, TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_NO_FOG, (BOD *) fvPos, NULL); pCastice = pSnow->pCastice; par_vloz_kour_stopu(pSnow->pSystem, pCastice, pSnow->SizeofCastice); for (i = 0; i < pSnow->SizeofHnizda; i++) { pSnow->hHnizdo[i] = par_vloz_hnizdo(pSnow->pSystem); if (pSnow->hHnizdo[i]) { intensity = (int) ceil(uiIntensity + ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * (uiIntensity * fmaxDivergence)); delay = rand() % (uiIntensity * 1000); par_vloz_hnizdo_timer(pSnow->hHnizdo[i], intensity, delay); par_vloz_hnizdo_komplet(pSnow->hHnizdo[i], intensity, &pSnow->pivot[i], pCastice); memcpy((void *) &pSnow->pivot[i], (void *) fvPos, 3 * sizeof(float)); pSnow->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pSnow->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pSnow->pivot[i].y = fSky; par_vloz_hnizdo_dir(pSnow->hHnizdo[i], &pSnow->dir); par_vloz_hnizdo_y_plane(pSnow->hHnizdo[i], pSnow->fLowPlain); //pregenerovani nekterych parametru pCastice[0].rychlost_y = pCastice[0].rychlost_x = randf() / (50 * (float)RAND_MAX); if (pCastice[0].rychlost_y < 0.005f) pCastice[0].rychlost_y = pCastice[0].rychlost_x = 0.005f; } } par_go(pSnow->pSystem, &pSnow->flag, 0, 0); pSnow->bSnow = 1; return 1; } void am_Error_NESRelease(NATUREEFFECTSYSTEM * pNESystem) { if (pNESystem->hHnizdo) free((void *) pNESystem->hHnizdo); if (pNESystem->pCastice) free((void *) pNESystem->pCastice); if (pNESystem->pivot) free((void *) pNESystem->pivot); if (pNESystem->dir) free((void *) pNESystem->dir); if (pNESystem->nx) free((void *) pNESystem->nx); if (pNESystem->ny) free((void *) pNESystem->ny); pNESystem->hHnizdo = NULL; pNESystem->pCastice = NULL; pNESystem->pivot = NULL; pNESystem->dir = NULL; pNESystem->nx = NULL; pNESystem->ny = NULL; } int am_Create_Chmiri_Pampelisek(LEVELINFO * p_Level, NATUREEFFECTSYSTEM * pNESystem, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane, int iID) { float fvPos[3]; PAR_KOUR_STOPA *pCastice; int material, i; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pNESystem->EffectID = iID; pNESystem->fRadius = fRadius; pNESystem->uiDensity = uiDensity; pNESystem->uiIntensity = uiIntensity; pNESystem->fSky = fSky; pNESystem->fLowPlain = ber.y_start + fLowPlane; pNESystem->SizeofCastice = uiDensity; pNESystem->SizeofHnizda = uiDensity; pNESystem->SizeofDir = uiDensity; pNESystem->SizeofPivot = uiDensity; pNESystem->hHnizdo = NULL; pNESystem->pCastice = NULL; pNESystem->pivot = NULL; pNESystem->dir = NULL; pNESystem->nx = NULL; pNESystem->ny = NULL; // pamet na castice pNESystem->pCastice = (PAR_KOUR_STOPA *) malloc(pNESystem->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pNESystem->pCastice) return 0; pNESystem->hHnizdo = (size_ptr *)malloc(pNESystem->SizeofHnizda * sizeof(pNESystem->hHnizdo[0])); if (!pNESystem->hHnizdo) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->pivot = (BOD *) malloc(pNESystem->SizeofPivot * sizeof(BOD)); if (!pNESystem->pivot) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->dir = (BOD *) malloc(pNESystem->SizeofDir * sizeof(BOD)); if (!pNESystem->dir) { am_Error_NESRelease(pNESystem); return 0; } material = kom_najdi_material("cchmiri1"); if (material == -1) kprintf(1, "Nelze najit material cchmiri1"); pCastice = &pNESystem->pCastice[0]; pCastice->rychlost_x = 0.16f; pCastice->rychlost_y = 0.08f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pNESystem->pSystem = par_vyrob(); if (!pNESystem->pSystem) { free((void *) pNESystem->pCastice); return 0; } par_set_param(pNESystem->pSystem, material, TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_VITR | TPAR_NO_FOG, (BOD *) fvPos, NULL); pCastice = pNESystem->pCastice; par_vloz_kour_stopu(pNESystem->pSystem, pCastice, pNESystem->SizeofCastice); for (i = 0; i < pNESystem->SizeofHnizda; i++) { pNESystem->hHnizdo[i] = par_vloz_hnizdo(pNESystem->pSystem); if (pNESystem->hHnizdo[i]) { par_vloz_hnizdo_komplet(pNESystem->hHnizdo[i], uiIntensity, &pNESystem->pivot[i], pCastice); par_vloz_hnizdo_timer(pNESystem->hHnizdo[i], uiIntensity, -1 * uiIntensity); memcpy((void *) &pNESystem->pivot[i], (void *) fvPos, 3 * sizeof(float)); pNESystem->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].y = fSky; pNESystem->dir[i].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; //pNESystem->dir[i].y = -0.15f; pNESystem->dir[i].y = (-randf() / (float) (RAND_MAX)) * 0.25f; pNESystem->dir[i].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; par_vloz_hnizdo_dir(pNESystem->hHnizdo[i], &pNESystem->dir[i]); par_vloz_hnizdo_y_plane(pNESystem->hHnizdo[i], pNESystem->fLowPlain); par_vloz_hnizdo_vitr(pNESystem->hHnizdo[i], (BOD *) p_Level->fVitr); } } par_go(pNESystem->pSystem, &pNESystem->flag, 0, 0); pNESystem->dwTime = 0; pNESystem->dwRegTime = uiIntensity; return 1; } int am_Create_Chmiri(LEVELINFO * p_Level, NATUREEFFECTSYSTEM * pNESystem, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane, char *cMaterial, int iID) { float fvPos[3]; PAR_KOUR_STOPA *pCastice; int material, i; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pNESystem->EffectID = iID; pNESystem->fRadius = fRadius; pNESystem->uiDensity = uiDensity; pNESystem->uiIntensity = uiIntensity; pNESystem->fSky = fSky; pNESystem->fLowPlain = ber.y_start + fLowPlane; pNESystem->SizeofCastice = uiDensity; pNESystem->SizeofHnizda = uiDensity; pNESystem->SizeofDir = uiDensity; pNESystem->SizeofPivot = uiDensity; pNESystem->hHnizdo = NULL; pNESystem->pCastice = NULL; pNESystem->pivot = NULL; pNESystem->dir = NULL; pNESystem->nx = NULL; pNESystem->ny = NULL; // pamet na castice pNESystem->pCastice = (PAR_KOUR_STOPA *) malloc(pNESystem->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pNESystem->pCastice) return 0; pNESystem->hHnizdo = (size_ptr *)malloc(pNESystem->SizeofHnizda * sizeof(pNESystem->hHnizdo[0])); if (!pNESystem->hHnizdo) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->pivot = (BOD *) malloc(pNESystem->SizeofPivot * sizeof(BOD)); if (!pNESystem->pivot) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->dir = (BOD *) malloc(pNESystem->SizeofDir * sizeof(BOD)); if (!pNESystem->dir) { am_Error_NESRelease(pNESystem); return 0; } material = kom_najdi_material(cMaterial); if (material == -1) kprintf(1, "Nelze najit material %s", cMaterial); pCastice = &pNESystem->pCastice[0]; pCastice->rychlost_x = 0.06f; pCastice->rychlost_y = 0.06f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pNESystem->pSystem = par_vyrob(); if (!pNESystem->pSystem) { free((void *) pNESystem->pCastice); return 0; } par_set_param(pNESystem->pSystem, material, TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_VITR | TPAR_NO_FOG, (BOD *) fvPos, NULL); pCastice = pNESystem->pCastice; par_vloz_kour_stopu(pNESystem->pSystem, pCastice, pNESystem->SizeofCastice); for (i = 0; i < pNESystem->SizeofHnizda; i++) { pNESystem->hHnizdo[i] = par_vloz_hnizdo(pNESystem->pSystem); if (pNESystem->hHnizdo[i]) { par_vloz_hnizdo_komplet(pNESystem->hHnizdo[i], uiIntensity, &pNESystem->pivot[i], pCastice); par_vloz_hnizdo_timer(pNESystem->hHnizdo[i], uiIntensity, -1 * uiIntensity); memcpy((void *) &pNESystem->pivot[i], (void *) fvPos, 3 * sizeof(float)); pNESystem->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].y = fSky; pNESystem->dir[i].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; //pNESystem->dir[i].y = -0.15f; pNESystem->dir[i].y = (-randf() / (float) (RAND_MAX)) * 0.25f; pNESystem->dir[i].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; par_vloz_hnizdo_dir(pNESystem->hHnizdo[i], &pNESystem->dir[i]); par_vloz_hnizdo_y_plane(pNESystem->hHnizdo[i], pNESystem->fLowPlain); par_vloz_hnizdo_vitr(pNESystem->hHnizdo[i], (BOD *) p_Level->fVitr); } } par_go(pNESystem->pSystem, &pNESystem->flag, 0, 0); pNESystem->dwTime = 0; pNESystem->dwRegTime = uiIntensity; return 1; } int am_Create_Svetlusky(LEVELINFO * p_Level, NATUREEFFECTSYSTEM * pNESystem, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane, char *cMaterial, int iID) { float fvPos[3], r; PAR_KOUR_STOPA *pCastice; int material, i; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pNESystem->EffectID = iID; pNESystem->fRadius = fRadius; pNESystem->uiDensity = uiDensity; pNESystem->uiIntensity = uiIntensity; pNESystem->fSky = ber.y_start + fSky; pNESystem->fLowPlain = ber.y_start; pNESystem->SizeofCastice = uiDensity; pNESystem->SizeofHnizda = uiDensity; pNESystem->SizeofDir = uiDensity; pNESystem->SizeofPivot = uiDensity; pNESystem->hHnizdo = NULL; pNESystem->pCastice = NULL; pNESystem->pivot = NULL; pNESystem->dir = NULL; pNESystem->nx = NULL; pNESystem->ny = NULL; // pamet na castice pNESystem->pCastice = (PAR_KOUR_STOPA *) malloc(pNESystem->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pNESystem->pCastice) return 0; pNESystem->hHnizdo = (size_ptr *)malloc(pNESystem->SizeofHnizda * sizeof(pNESystem->hHnizdo[0])); if (!pNESystem->hHnizdo) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->pivot = (BOD *) malloc(pNESystem->SizeofPivot * sizeof(BOD)); if (!pNESystem->pivot) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->dir = (BOD *) malloc(pNESystem->SizeofDir * sizeof(BOD)); if (!pNESystem->dir) { am_Error_NESRelease(pNESystem); return 0; } material = kom_najdi_material(cMaterial); if (material == -1) kprintf(1, "Nelze najit material %s", cMaterial); pCastice = &pNESystem->pCastice[0]; pCastice->rychlost_x = 0.06f; pCastice->rychlost_y = 0.06f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = 0.99f; pCastice->g = 0.96f; pCastice->b = 0.66f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pNESystem->pSystem = par_vyrob(); if (!pNESystem->pSystem) { free((void *) pNESystem->pCastice); return 0; } par_set_param(pNESystem->pSystem, material, TPAR_YPLANE_TOP | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_VITR | TPAR_NO_FOG, (BOD *) fvPos, NULL); pCastice = pNESystem->pCastice; par_vloz_kour_stopu(pNESystem->pSystem, pCastice, pNESystem->SizeofCastice); for (i = 0; i < pNESystem->SizeofHnizda; i++) { r = (randf() / (float) (RAND_MAX)) * 0.1f; pCastice->rychlost_x = 0.05f + r; pCastice->rychlost_y = 0.05f + r; pNESystem->hHnizdo[i] = par_vloz_hnizdo(pNESystem->pSystem); if (pNESystem->hHnizdo[i]) { par_vloz_hnizdo_komplet(pNESystem->hHnizdo[i], uiIntensity, &pNESystem->pivot[i], pCastice); par_vloz_hnizdo_timer(pNESystem->hHnizdo[i], uiIntensity, -1 * uiIntensity); memcpy((void *) &pNESystem->pivot[i], (void *) fvPos, 3 * sizeof(float)); pNESystem->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].y = ber.y_start; pNESystem->dir[i].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; //pNESystem->dir[i].y = -0.15f; pNESystem->dir[i].y = (randf() / (float) (RAND_MAX)) * 0.5f; pNESystem->dir[i].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; par_vloz_hnizdo_dir(pNESystem->hHnizdo[i], &pNESystem->dir[i]); par_vloz_hnizdo_y_plane(pNESystem->hHnizdo[i], pNESystem->fSky); par_vloz_hnizdo_vitr(pNESystem->hHnizdo[i], &pNESystem->dir[i]); } } par_go(pNESystem->pSystem, &pNESystem->flag, 0, 0); pNESystem->dwTime = 0; pNESystem->dwGenTimeCounter = 0; pNESystem->dwRegTime = 500; pNESystem->dwGenTime = rand() % (uiIntensity * 10); pNESystem->iGenProbability = uiIntensity; return 1; } int am_Create_Musku(LEVELINFO * p_Level, NATUREEFFECTSYSTEM * pNESystem, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane, char *cMaterial, int iID) { PARMETAC_HNIZDO *pHnizdo; float fvPos[3]; PAR_KOUR_STOPA *pCastice; int material, i; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pNESystem->EffectID = iID; pNESystem->fRadius = fRadius; pNESystem->uiDensity = uiDensity; pNESystem->uiIntensity = uiIntensity; pNESystem->fSky = ber.y_start + fSky; pNESystem->fLowPlain = ber.y_start + fLowPlane; pNESystem->SizeofCastice = uiDensity; pNESystem->SizeofHnizda = uiDensity; pNESystem->SizeofDir = uiDensity; pNESystem->SizeofPivot = uiDensity; pNESystem->SizeofNX = uiDensity; pNESystem->SizeofNY = uiDensity; pNESystem->hHnizdo = NULL; pNESystem->pCastice = NULL; pNESystem->pivot = NULL; pNESystem->dir = NULL; pNESystem->nx = NULL; pNESystem->ny = NULL; // pamet na castice pNESystem->pCastice = (PAR_KOUR_STOPA *) malloc(pNESystem->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pNESystem->pCastice) return 0; pNESystem->hHnizdo = (size_ptr *)malloc(pNESystem->SizeofHnizda * sizeof(pNESystem->hHnizdo[0])); if (!pNESystem->hHnizdo) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->pivot = (BOD *) malloc(pNESystem->SizeofPivot * sizeof(BOD)); if (!pNESystem->pivot) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->dir = (BOD *) malloc(pNESystem->SizeofDir * sizeof(BOD)); if (!pNESystem->dir) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->nx = (BOD *) malloc(pNESystem->SizeofNX * sizeof(BOD)); if (!pNESystem->nx) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->ny = (BOD *) malloc(pNESystem->SizeofNY * sizeof(BOD)); if (!pNESystem->ny) { am_Error_NESRelease(pNESystem); return 0; } material = kom_najdi_material(cMaterial); if (material == -1) kprintf(1, "Nelze najit material %s", cMaterial); pCastice = &pNESystem->pCastice[0]; pCastice->rychlost_x = 0.06f; pCastice->rychlost_y = 0.06f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pNESystem->pSystem = par_vyrob(); if (!pNESystem->pSystem) { free((void *) pNESystem->pCastice); return 0; } par_set_param(pNESystem->pSystem, material, TPAR_3D | TPAR_HALF_LIFE | TPAR_NO_FOG | TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_VITR, (BOD *) fvPos, NULL); pCastice = pNESystem->pCastice; par_vloz_kour_stopu(pNESystem->pSystem, pCastice, pNESystem->SizeofCastice); for (i = 0; i < pNESystem->SizeofHnizda; i++) { pNESystem->hHnizdo[i] = par_vloz_hnizdo(pNESystem->pSystem); if (pNESystem->hHnizdo[i]) { par_vloz_hnizdo_komplet(pNESystem->hHnizdo[i], uiIntensity, &pNESystem->pivot[i], pCastice); par_vloz_hnizdo_timer(pNESystem->hHnizdo[i], uiIntensity, -1 * uiIntensity); memcpy((void *) &pNESystem->pivot[i], (void *) fvPos, 3 * sizeof(float)); pNESystem->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].y = fSky; pNESystem->dir[i].x = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pNESystem->dir[i].y = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.15f; pNESystem->dir[i].z = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect(&pNESystem->dir[i].x, &pNESystem->dir[i].y, &pNESystem->dir[i].z); par_vloz_hnizdo_vitr(pNESystem->hHnizdo[i], &pNESystem->dir[i]); par_vloz_hnizdo_y_plane(pNESystem->hHnizdo[i], pNESystem->fLowPlain); memcpy((void *) &pNESystem->nx[i], (void *) &pNESystem->dir[i], sizeof(BOD)); norm_vect(&pNESystem->nx[i].x, &pNESystem->nx[i].y, &pNESystem->nx[i].z); pHnizdo = par_cti_hnizdo(pNESystem->hHnizdo[i]); if (pHnizdo) { pHnizdo->p_nx = &pNESystem->nx[i]; pHnizdo->p_ny = &pNESystem->ny[i]; } } } par_go(pNESystem->pSystem, &pNESystem->flag, 0, 0); pNESystem->dwTime = 0; pNESystem->dwRegTime = 250; return 1; } int am_Create_Padajici_Listi(LEVELINFO * p_Level, NATUREEFFECTSYSTEM * pNESystem, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane, char *cMaterial, int iID) { PARMETAC_HNIZDO *pHnizdo; float fvPos[3]; PAR_KOUR_STOPA *pCastice; int material, i; kom_get_fyz_souradnice((int) floor(p_Level->Size[0] / 2.0f), 0, (int) floor(p_Level->Size[2] / 2.0f), (BOD *) fvPos); fvPos[1] = ber.y_start; pNESystem->EffectID = iID; pNESystem->fRadius = fRadius; pNESystem->uiDensity = uiDensity; pNESystem->uiIntensity = uiIntensity; pNESystem->fSky = fSky * 2; pNESystem->fLowPlain = ber.y_start + fLowPlane; pNESystem->SizeofCastice = (uiDensity * 10); pNESystem->SizeofHnizda = uiDensity; pNESystem->SizeofDir = uiDensity; pNESystem->SizeofPivot = uiDensity; pNESystem->SizeofNX = uiDensity; pNESystem->SizeofNY = uiDensity; pNESystem->hHnizdo = NULL; pNESystem->pCastice = NULL; pNESystem->pivot = NULL; pNESystem->dir = NULL; pNESystem->nx = NULL; pNESystem->ny = NULL; // pamet na castice pNESystem->pCastice = (PAR_KOUR_STOPA *) malloc(pNESystem->SizeofCastice * sizeof(PAR_KOUR_STOPA)); if (!pNESystem->pCastice) return 0; pNESystem->hHnizdo = (size_ptr *)malloc(pNESystem->SizeofHnizda * sizeof(pNESystem->hHnizdo[0])); if (!pNESystem->hHnizdo) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->pivot = (BOD *) malloc(pNESystem->SizeofPivot * sizeof(BOD)); if (!pNESystem->pivot) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->dir = (BOD *) malloc(pNESystem->SizeofDir * sizeof(BOD)); if (!pNESystem->dir) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->nx = (BOD *) malloc(pNESystem->SizeofNX * sizeof(BOD)); if (!pNESystem->nx) { am_Error_NESRelease(pNESystem); return 0; } pNESystem->ny = (BOD *) malloc(pNESystem->SizeofNY * sizeof(BOD)); if (!pNESystem->ny) { am_Error_NESRelease(pNESystem); return 0; } material = kom_najdi_material(cMaterial); if (material == -1) kprintf(1, "Nelze najit material %s", cMaterial); pCastice = &pNESystem->pCastice[0]; pCastice->rychlost_x = 0.2f; pCastice->rychlost_y = 0.2f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 1.0f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pNESystem->pSystem = par_vyrob(); if (!pNESystem->pSystem) { free((void *) pNESystem->pCastice); return 0; } par_set_param(pNESystem->pSystem, material, TPAR_3D | TPAR_HALF_LIFE | TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_VITR | TPAR_NO_FOG, (BOD *) fvPos, NULL); pCastice = pNESystem->pCastice; par_vloz_kour_stopu(pNESystem->pSystem, pCastice, pNESystem->SizeofCastice); for (i = 0; i < pNESystem->SizeofHnizda; i++) { pNESystem->hHnizdo[i] = par_vloz_hnizdo(pNESystem->pSystem); if (pNESystem->hHnizdo[i]) { par_vloz_hnizdo_komplet(pNESystem->hHnizdo[i], 3600000, &pNESystem->pivot[i], pCastice); par_vloz_hnizdo_timer(pNESystem->hHnizdo[i], 3600000, 0); memcpy((void *) &pNESystem->pivot[i], (void *) fvPos, 3 * sizeof(float)); pNESystem->pivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pNESystem->pivot[i].y = fSky; pNESystem->dir[i].x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.5f; pNESystem->dir[i].y = -1; pNESystem->dir[i].z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.5f; norm_vect(&pNESystem->dir[i].x, &pNESystem->dir[i].y, &pNESystem->dir[i].z); par_vloz_hnizdo_vitr(pNESystem->hHnizdo[i], &pNESystem->dir[i]); par_vloz_hnizdo_y_plane(pNESystem->hHnizdo[i], pNESystem->fLowPlain); pCastice->rychlost_x = pCastice->rychlost_y = (randf() / (float) (RAND_MAX)); if (pCastice->rychlost_x < 0.05f) pCastice->rychlost_x = pCastice->rychlost_y = 0.05f; if (pCastice->rychlost_x > 0.3f) pCastice->rychlost_x = pCastice->rychlost_y = 0.3f; par_vloz_hnizdo_scale(pNESystem->hHnizdo[i], pCastice->rychlost_x, pCastice->rychlost_y, 0, 0); memcpy((void *) &pNESystem->nx[i], (void *) &pNESystem->dir[i], sizeof(BOD)); norm_vect(&pNESystem->nx[i].x, &pNESystem->nx[i].y, &pNESystem->nx[i].z); pHnizdo = par_cti_hnizdo(pNESystem->hHnizdo[i]); if (pHnizdo) { pHnizdo->p_nx = &pNESystem->nx[i]; pHnizdo->p_ny = &pNESystem->ny[i]; } } } pNESystem->AddDir.x = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 3; pNESystem->AddDir.y = (randf() / (float) (RAND_MAX)) * 2; pNESystem->AddDir.z = ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 3; //norm_vect(&pNESystem->AddDir.x, &pNESystem->AddDir.y, &pNESystem->AddDir.z); par_go(pNESystem->pSystem, &pNESystem->flag, 0, 0); pNESystem->dwTime = 0; pNESystem->dwGenTimeCounter = 0; pNESystem->dwRegTime = 500; pNESystem->dwGenTime = rand() % (uiIntensity * 10); pNESystem->iGenProbability = uiIntensity; return 1; } int am_Get_Free_Nature_Effect_System(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->NatureESystem[i].pSystem) return i; return -1; } int am_Create_Nature_Effect(LEVELINFO * p_Level, int iEffectID, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane) { int k = am_Get_Free_Nature_Effect_System(p_Level); if (k == -1) return 0; switch (iEffectID) { case 1: return am_Create_Chmiri_Pampelisek(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, 1); case 2: return am_Create_Chmiri(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "cchmiri2", 2); case 3: return am_Create_Chmiri(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "cchmiri3", 3); case 4: return am_Create_Musku(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "cmuska1", 4); case 5: return am_Create_Musku(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "cmuska2", 5); case 6: return am_Create_Padajici_Listi(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "clist1", 6); case 7: return am_Create_Padajici_Listi(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "clist2", 7); case 8: return am_Create_Padajici_Listi(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "clist3", 8); case 9: return am_Create_Padajici_Listi(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "clist4", 9); case 10: return am_Create_Padajici_Listi(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "clist5", 10); case 11: return am_Create_Padajici_Listi(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "clist6", 11); case 12: return am_Create_Svetlusky(p_Level, &p_Level->NatureESystem[k], fRadius, uiDensity, uiIntensity, fSky, fLowPlane, "csvetluska1", 12); default: return 0; } } void am_Create_Water_Effect(LEVELINFO * p_Level) { long guid; BOD p(0, 0, 0); WATERDESC *pWater; int i, c = 0; pWater = &p_Level->Water; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 12) { c++; guid = p_Level->Level[i]->p_Object->GUID; } if (!c) { pWater->bWater = 0; return; } pWater->hWater = vod_vyrob(c); for (i = 0; i < p_Level->Size_of_Level; i++) { if (p_Level->Level[i]) { if (p_Level->Level[i]->p_Object->Class == 12) { vod_pridej_mesh(pWater->hWater, p_Level->Level[i]->Index_Of_Game_Mesh); } } } vod_uzavri_meshe(pWater->hWater); if (guid == 12000) pWater->hVodnik[0] = vod_vloz_vodnika(pWater->hWater, &p, VOD_AKTIVNI | VOD_Z_PLANE | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.04f, 100, 1, 0, 0, 200); else pWater->hVodnik[0] = vod_vloz_vodnika(pWater->hWater, &p, VOD_AKTIVNI | VOD_Z_PLANE | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.01f, 100, 1, 0, 0, 200); if (guid == 12000) { vod_vloz_vodnika_spec(pWater->hVodnik[0], 0.1f, 0.1f, 0.1f); vod_vloz_vodnika_add_spec(pWater->hVodnik[0], 0, 0, 0); vod_vloz_vodnika_diff(pWater->hVodnik[0], 0.05f, 0.05f, 0.05f, 0.125f); vod_vloz_vodnika_add_diff(pWater->hVodnik[0], 0, 0, 0, 0); } else { vod_vloz_vodnika_spec(pWater->hVodnik[0], 0.05f, 0.05f, 0.05f); vod_vloz_vodnika_add_spec(pWater->hVodnik[0], 0, 0, 0); vod_vloz_vodnika_diff(pWater->hVodnik[0], 0.025f, 0.025f, 0.025f, 0.05f); vod_vloz_vodnika_add_diff(pWater->hVodnik[0], 0, 0, 0, 0); } if (guid == 12000) { pWater->hVodnik[1] = vod_vloz_vodnika(pWater->hWater, &p, VOD_AKTIVNI | VOD_X_PLANE, 0.04f, 100, 1, 0, 0, 200); pWater->hVodnik[2] = vod_vloz_vodnika(pWater->hWater, &p, VOD_AKTIVNI | VOD_BOD, 0.04f, 200, 1, 0, 0, 300); } else { pWater->hVodnik[1] = vod_vloz_vodnika(pWater->hWater, &p, VOD_AKTIVNI | VOD_X_PLANE, 0.01f, 100, 1, 0, 0, 200); pWater->hVodnik[2] = vod_vloz_vodnika(pWater->hWater, &p, VOD_AKTIVNI | VOD_BOD, 0.01f, 200, 1, 0, 0, 300); } pWater->bWater = 1; } void am_Create_Prizemni_Mlhu(LEVELINFO * p_Level, float fDensity, float fHeight) { float pos[3]; int hSvetlo; hSvetlo = edl_svetlo_vyrob(EDL_PLOSNE_Y | EDL_SPEC_ADD | EDL_SCENA | EDL_DOSAH | EDL_UTLUM_LIN, 0); if (hSvetlo != -1) { pos[0] = 0; pos[1] = ber.y_start; pos[2] = 0; edl_svetlo_set_pos(hSvetlo, (BOD *) pos, (BOD *) pos); edl_svetlo_set_spec(hSvetlo, 0.5f, 0.5f, 0.5f); edl_svetlo_set_par(hSvetlo, 1, fHeight, 0, 0); p_Level->Mist.hSvetlo = hSvetlo; } else p_Level->Mist.bMist = 0; } void am_Start_Animaci_Pontonky(ITEMDESC * pItem) { int guid = pItem->p_Object->GUID == 5007; BOD b((float) (rand() % 2), 0, (float) (rand() % 2)); AnimHandle anim; int i, f1, f2; float r; if (pItem->a_run) return; if (!b.x && !b.z) { b.x = 1.0f; b.z = 1.0f; } anim = sim_vyrob_animaci(4, 4, 0); sim_vloz_pivot(anim, 0.0f, 1.0f, 0.0f); sim_vloz_klic_posun(anim, 0, 0.0f, 0.0f, 0.0f, 0); i = rand() % 2; if (guid == 5007) r = rand() / ((float) RAND_MAX * 5); else r = rand() / ((float) RAND_MAX * 40); if (r < 0.05f) r = 0.05f; if (guid == 5007) f1 = (int) ceil(r * 200); else f1 = (int) ceil(r * 400); if (i) r *= -1; sim_vloz_klic_posun(anim, 1, 0.0f, r, 0.0f, f1); if (guid == 5007) r = rand() / ((float)RAND_MAX * 5); else r = rand() / ((float)RAND_MAX * 40); if (r < 0.05f) r = 0.05f; if (guid == 5007) f2 = (int) ceil((r * 200) + f1); else f2 = (int) ceil((r * 400) + f1); if (!i) r *= -1; sim_vloz_klic_posun(anim, 2, 0.0f, r, 0.0f, f1 + f2); sim_vloz_klic_posun(anim, 3, 0.0f, 0.0f, 0.0f, 2 * f1 + f2); sim_vloz_klic_rotace(anim, 0, &b, 0, 0); i = rand() % 2; if (guid == 5007) r = (rand() / (float) (RAND_MAX)) * 10; else r = (rand() / (float) (RAND_MAX)) * 2; if (i) r *= -1; sim_vloz_klic_rotace(anim, 1, &b, r, f1); if (guid == 5007) r = (rand() / (float) (RAND_MAX)) * 10; else r = (rand() / (float) (RAND_MAX)) * 2; if (!i) r *= -1; sim_vloz_klic_rotace(anim, 2, &b, r, f1 + f2); sim_vloz_klic_rotace(anim, 3, &b, 0, 2 * f1 + f2); sim_interpoluj_animaci(anim, 2 * f1 + f2 + 1, 1); pItem->a_run = rani_aktivuj(anim, &pItem->a_flag, GK_LOOP, 0, 0); rani_privaz_mesh(pItem->a_run, pItem->Index_Of_Game_Mesh, 0); } void am_Start_Animace_Pontonek(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Count_Of_Items; i++) if (p_Level->Item[i].p_Object) { if (p_Level->Item[i].p_Object->Class == 5 && p_Level->Item[i].p_Object->SubClass == 3) if (gl_Check_Anim_Pontonky(&p_Level->Item[i], p_Level)) am_Start_Animaci_Pontonky(&p_Level->Item[i]); } else kprintf(1, "p_Level->Item[%d].p_Object == NULL", i); } int am_Get_Free_BarelSparksSystem(LEVELINFO * p_Level) { int i; for (i = 0; i < 30; i++) if (!p_Level->BarelSparks[i].System) return i; return -1; } int am_Create_BarelSparksSystem(ITEMDESC * pTel, LEVELINFO * p_Level) { int m, k; PAR_KOUR_STOPA *pKourovaS; SYSTEMKOUROVYCHCASTIC *pSystem; float pos[3]; int rot; int size = ftoi(10 / p_Level->KvalitaCastic); k = am_Get_Free_BarelSparksSystem(p_Level); if (k == -1) return -1; pSystem = &p_Level->BarelSparks[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return -1; kom_mesh_get_float(pTel->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; pSystem->dwStart = timeGetTime(); //m = kom_najdi_material("flare12"); m = kom_najdi_material("flare100"); if (m == -1) kprintf(1, "Nelze najit material flare12"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 1.0f; pKourovaS[0].utlum_x = -2; pKourovaS[0].utlum_y = -2; pKourovaS[0].r = 0; pKourovaS[0].g = 1; pKourovaS[0].b = 0.5f; pKourovaS[0].a = 1.0f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 10, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 10, -10); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][1]++; pSystem->dir[0][0] = 0; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 1; pSystem->dir[0][2] = 0; par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], pos[1] + 3); par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 0; pSystem->hHnizdo[1] = reinterpret_cast(pTel); par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); return k; } void am_Start_Barels(LEVELINFO * p_Level) { float pos[3]; int hSvetlo, rot; // int rnd = rand() % 3; int i, k; for (i = 0; i < p_Level->Count_Of_Items; i++) if (p_Level->Item[i].p_Object) { if (p_Level->Item[i].p_Object->Class == 6 && p_Level->Item[i].p_Object->GUID == 6014) { hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); kom_mesh_get_float(p_Level->Item[i].Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); if (hSvetlo != -1) { pos[1] += 1.25f; sdl_svetlo_set_pos(hSvetlo, (BOD *) pos); sdl_svetlo_set_diff(hSvetlo, 0, 1, 0.5f, 1, 4, 4); k = am_Create_BarelSparksSystem(&p_Level->Item[i], p_Level); if (k > -1) p_Level->BarelSparks[k].hHnizdo[2] = (int) hSvetlo; else sdl_svetlo_zrus(hSvetlo); } } } else kprintf(1, "p_Level->Item[%d].p_Object == NULL", i); } int gl_Get_Free_Kour_Pusa(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->KourUst[i].System) return i; return -1; } void am_Do_Mouth_Smoke(int iItem, float *pos, LEVELINFO * p_Level) { int k, m, i; PAR_KOUR_STOPA *pKourovaS; float f; k = gl_Get_Free_Kour_Pusa(p_Level); if (k == -1) return; pKourovaS = (PAR_KOUR_STOPA *) mmalloc(20 * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; p_Level->KourUst[k].pCastice = pKourovaS; p_Level->KourUst[k].Sizeof = 1; p_Level->KourUst[k].dwStart = timeGetTime(); m = kom_najdi_material("mrak1_1"); if (m == -1) kprintf(1, "Nelze najit material mrak1_1"); pKourovaS[0].rychlost_x = 0.02f; pKourovaS[0].rychlost_y = 0.02f; pKourovaS[0].utlum_x = 2.7f; pKourovaS[0].utlum_y = 2.7f; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 0.95f; pKourovaS[0].a = 0.3f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = -0.2f; pKourovaS[0].ka = 0.0f; p_Level->KourUst[k].System = par_vyrob(); par_set_param(p_Level->KourUst[k].System, m, TPAR_NO_FOG | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_VITR, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->KourUst[k].System, pKourovaS, 20); for (i = 0; i < p_Level->KourUst[k].Sizeof; i++) { p_Level->KourUst[k].hHnizdo[i] = par_vloz_hnizdo(p_Level->KourUst[k].System); par_vloz_hnizdo_komplet(p_Level->KourUst[k].hHnizdo[i], 100, (BOD *) p_Level->KourUst[k].pivot[i], pKourovaS); par_vloz_hnizdo_timer(p_Level->KourUst[k].hHnizdo[i], 100, -100); //vygeneruj dir p_Level->KourUst[k].dir[i][0] = (rand() & 0x1 ? randf() : -randf()); p_Level->KourUst[k].dir[i][1] = (randf()); p_Level->KourUst[k].dir[i][2] = (rand() & 0x1 ? randf() : -randf()); vektor_norm((BOD *) p_Level->KourUst[k].dir[i]); f = (randf() / (float) (RAND_MAX)) * _3DKOREKCE; p_Level->KourUst[k].dir[i][0] *= f / 100.0f; p_Level->KourUst[k].dir[i][1] *= f / 100.0f; p_Level->KourUst[k].dir[i][2] *= f / 100.0f; memcpy((void *) p_Level->KourUst[k].pivot[i], (void *) pos, 3 * sizeof(float)); par_vloz_hnizdo_dir(p_Level->KourUst[k].hHnizdo[i], (BOD *) p_Level->KourUst[k].dir[i]); par_vloz_hnizdo_vitr(p_Level->KourUst[k].hHnizdo[i], (BOD *) p_Level->fVitr); } p_Level->KourUst[k].dwStart = timeGetTime(); p_Level->KourUst[k].hHnizdo[1] = iItem; par_pripoj_funkci(p_Level->KourUst[k].System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(p_Level->KourUst[k].System, &p_Level->KourUst[k].flag, 0, 0); } void am_Do_BeatleSmokes(LEVELINFO * p_Level) { float pos[3], f; int rot, i; int real; BEATLE_SMOKE_SYSTEM *pBeatle; if (!p_Level->Snow.bSnow) return; for (i = 0; i < 10; i++) { if (p_Level->KourUst[i].System) { int ret = kom_mesh_get_float(p_Level->Item[p_Level->KourUst[i].hHnizdo[1]].Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); if(ret == K_CHYBA) { continue; } //vygeneruj dir p_Level->KourUst[i].dir[0][0] = (rand() & 0x1 ? randf() : -randf()); p_Level->KourUst[i].dir[0][1] = (randf()); p_Level->KourUst[i].dir[0][2] = (rand() & 0x1 ? randf() : -randf()); vektor_norm((BOD *) p_Level->KourUst[i].dir[0]); f = (randf() / (float) (RAND_MAX)) * _3DKOREKCE; p_Level->KourUst[i].dir[0][0] *= f / 100.0f; p_Level->KourUst[i].dir[0][1] *= f / 100.0f; p_Level->KourUst[i].dir[0][2] *= f / 100.0f; pos[1] += 0.70f; switch (p_Level->Item[p_Level->KourUst[i].hHnizdo[1]].Rotation) { case 0: pos[2] += 0.5f; break; case 1: pos[0] += 0.5f; break; case 2: pos[2] -= 0.5f; break; case 3: pos[0] -= 0.5f; break; } p_Level->KourUst[i].pivot[0][0] = pos[0]; p_Level->KourUst[i].pivot[0][1] = pos[1]; p_Level->KourUst[i].pivot[0][2] = pos[2]; } } for (i = 0; i < 6; i++) { pBeatle = &p_Level->BeatleSmoke[i]; if (pBeatle->iItem != -1) { if (!p_Level->bGameResume) pBeatle->dwRealTime += ber.TimeLastFrame; if (pBeatle->dwRealTime > pBeatle->dwExpTime) { int ret = kom_mesh_get_float(p_Level->Item[pBeatle->iItem].Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); if(ret == K_CHYBA) { continue; } pos[1] += 0.70f; pBeatle->dwRealTime = 0; gl_Logical2Real(p_Level->Item[pBeatle->iItem].Pos[0], p_Level->Item[pBeatle->iItem].Pos[1], p_Level->Item[pBeatle->iItem].Pos[2], &real, p_Level); if (!p_Level->Square[real].bUnderWater) am_Do_Mouth_Smoke(pBeatle->iItem, pos, p_Level); } } } } void am_Obsluha_Koure_Brouku(LEVELINFO * p_Level) { DWORD dwTime, dwEplased; int j, i; if (!p_Level->Snow.bSnow) return; for (i = 0; i < 10; i++) if (p_Level->KourUst[i].System) { dwTime = timeGetTime(); dwEplased = dwTime - p_Level->KourUst[i].dwStart; if (dwEplased > 1500) { for (j = 0; j < p_Level->KourUst[i].Sizeof; j++) { if (p_Level->KourUst[i].hHnizdo[j]) { par_vloz_hnizdo_pivot(p_Level->KourUst[i].hHnizdo[j], NULL); p_Level->KourUst[i].hHnizdo[j] = 0; } } } if (!par_get_hnizda(p_Level->KourUst[i].System)) { par_zrus(p_Level->KourUst[i].System); p_Level->KourUst[i].System = (size_ptr)NULL; } } } void am_Create_Steps_System(LEVELINFO * p_Level) { int i, m; PAR_KOUR_STOPA *pKourovaS; PARMETAC_HNIZDO *pHnizdo = NULL; SYSTEMKOUROVYCHCASTIC *pSystem; int size = 100, rot; float pos[3]; for (i = 0; i < 6; i++) if (p_Level->BeatleSmoke[i].iItem != -1) { pSystem = &p_Level->BeatleSmoke[i].sStopy; kom_mesh_get_float(p_Level->Item[p_Level->BeatleSmoke[i].iItem]. Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; pSystem->dwStart = timeGetTime(); m = kom_najdi_material("csteps0"); if (m == -1) { kprintf(1, "Nelze najit material csteps0"); free((void *) pKourovaS); return; } pKourovaS[0].rychlost_x = 0.5f; pKourovaS[0].rychlost_y = 0.5f; pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = 0.14f; pKourovaS[0].g = 0.47f; pKourovaS[0].b = 0.65f; pKourovaS[0].a = 0.75f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = 0; pKourovaS[0].da = -0.02f; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_3D | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 1000000, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 1000000, 0); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][1] -= 0.95f; if (pSystem->hHnizdo[0]) pHnizdo = par_cti_hnizdo(pSystem->hHnizdo[0]); pSystem->nx[0][0] = 1; pSystem->nx[0][1] = 0; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 0; pSystem->ny[0][2] = 1; pHnizdo->p_nx = (BOD *) pSystem->nx[0]; pHnizdo->p_ny = (BOD *) pSystem->ny[0]; pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwExpire = 0; pSystem->dwExpireTime = 0; pSystem->dwStop = 0; // pSystem->hHnizdo[1] = 0; par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); } return; } void am_Change_NXNZ(LEVELINFO * p_Level, ITEMDESC * pItem, SYSTEMKOUROVYCHCASTIC * pSystem) { int iPos[3]; int real; memcpy((void *) iPos, pItem->Pos, 3 * sizeof(int)); switch (pItem->Rotation) { case 0: iPos[1]--; break; case 1: iPos[0]--; break; case 2: iPos[1]++; break; case 3: iPos[0]++; break; } gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class != 19) iPos[2] -= 2; } else iPos[2] -= 2; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class != 19) return; } else return; switch (p_Level->Level[real]->Rotation) { case 3: pSystem->nx[0][0] = 1; pSystem->nx[0][1] = 1; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 0; pSystem->ny[0][2] = 1; break; case 1: pSystem->nx[0][0] = -1; pSystem->nx[0][1] = 1; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 0; pSystem->ny[0][2] = -1; break; case 2: pSystem->nx[0][0] = 1; pSystem->nx[0][1] = 0; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 1; pSystem->ny[0][2] = 1; break; case 0: pSystem->nx[0][0] = -1; pSystem->nx[0][1] = 0; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 1; pSystem->ny[0][2] = -1; break; } } void am_Set_Step(int iFoot, LEVELINFO * p_Level) { int i, rot; float pos[3]; SYSTEMKOUROVYCHCASTIC *pSystem; PARMETAC_HNIZDO *pHnizdo; if (p_Level->Actual_Item == -1) return; for (i = 0; i < 6; i++) if (p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh == p_Level->Item[p_Level->BeatleSmoke[i].iItem].Index_Of_Game_Mesh && p_Level->BeatleSmoke[i].iItem != -1) { if (p_Level->BeatleSmoke[i].iStepc) { kom_mesh_get_float(p_Level->Item[p_Level->BeatleSmoke[i].iItem]. Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pSystem = &p_Level->BeatleSmoke[i].sStopy; memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); if (!iFoot) { pSystem->pivot[0][1] -= 0.95f; pSystem->nx[0][0] = 1; pSystem->nx[0][1] = 0; pSystem->nx[0][2] = 0; pSystem->ny[0][0] = 0; pSystem->ny[0][1] = 0; pSystem->ny[0][2] = 1; } else { /*am_Change_NXNZ(p_Level, p_Level->Level[p_Level->Actual_Item], pSystem); if(!(p_Level->BeatleSmoke[i].iStepc%2)) pSystem->pivot[0][1] -= 0.7f; else pSystem->pivot[0][1] += 0.2f; */ } pHnizdo = par_cti_hnizdo(pSystem->hHnizdo[0]); if (pHnizdo) { pHnizdo->rotace = p_Level->Level[p_Level->Actual_Item]->Rotation; switch (pHnizdo->rotace) { case 0: if (!(p_Level->BeatleSmoke[i].iStepc % 2)) pSystem->pivot[0][0] += 0.4f; else pSystem->pivot[0][0] -= 0.4f; break; case 2: if (!(p_Level->BeatleSmoke[i].iStepc % 2)) pSystem->pivot[0][0] -= 0.4f; else pSystem->pivot[0][0] += 0.4f; break; case 1: if (!(p_Level->BeatleSmoke[i].iStepc % 2)) pSystem->pivot[0][2] -= 0.4f; else pSystem->pivot[0][2] += 0.4f; break; case 3: if (!(p_Level->BeatleSmoke[i].iStepc % 2)) pSystem->pivot[0][2] += 0.4f; else pSystem->pivot[0][2] -= 0.4f; break; } } par_vloz_hnizdo_pust_castici(pSystem->hHnizdo[0]); } p_Level->BeatleSmoke[i].iStepc++; return; } } void am_Zero_Step(LEVELINFO * p_Level) { int i; if (p_Level->Actual_Item == -1) return; p_Level->bSetStep = 0; for (i = 0; i < 6; i++) if (p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh == p_Level->Item[p_Level->BeatleSmoke[i].iItem].Index_Of_Game_Mesh && p_Level->BeatleSmoke[i].iItem != -1) { p_Level->BeatleSmoke[i].iStepc = 0; return; } } void am_Release_Steps(LEVELINFO * p_Level) { int i; for (i = 0; i < 6; i++) { if (p_Level->BeatleSmoke[i].iItem != -1 && p_Level->BeatleSmoke[i].sStopy.System) { kprintf(1, "p_Level->BeatleSmoke[%d], par_zrus %d", i, p_Level->BeatleSmoke[i].sStopy.System); par_zrus(p_Level->BeatleSmoke[i].sStopy.System); p_Level->BeatleSmoke[i].sStopy.System = (size_ptr)NULL; } } } void am_Do_Step(size_ptr param, size_ptr param2, size_ptr p_param) { LEVELINFO *p_Level = (LEVELINFO *) p_param; if (!p_Level->bSetStep) return; am_Set_Step(param, p_Level); // p_Level->bSetStep = 0; } void am_Destroy_Steps(ITEMDESC * pItem, LEVELINFO * p_Level) { float pos[3]; int rot, i; PAR_KOUR_STOPA *pks; if (!pItem) return; kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pos[1] += 1.05f; for (i = 0; i < 6; i++) { if (p_Level->BeatleSmoke[i].iItem != -1 && p_Level->BeatleSmoke[i].sStopy.System) { pks = par_cti_hnizdo_castice(p_Level->BeatleSmoke[i].sStopy.hHnizdo[0]); if (pks) { while (pks) { if (pks->p.x >= pos[0] - 1 && pks->p.x <= pos[0] + 1 && pks->p.z >= pos[2] - 1 && pks->p.z <= pos[2] + 1 && pks->p.y >= pos[1] - 0.5f && pks->p.y <= pos[1] + 0.5f) pks->a = 0; pks = pks->p_next; } } } } } void am_Create_BublSystem_Effect1(float *pos, LEVELINFO * p_Level, int iSize) { int m; PAR_KOUR_STOPA *pKourovaS; SYSTEMKOUROVYCHCASTIC *pSystem = &p_Level->BublSystemE.System; int size = ftoi(iSize / p_Level->KvalitaCastic); pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; m = kom_najdi_material("cbublina1"); if (m == -1) kprintf(1, "Nelze najit material cbublina1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 7.0f; pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.8f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 100000, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 100000, -100000); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); memcpy((void *) pSystem->pivot[1], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][0] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->pivot[0][2] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->dir[0][0] = 0; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 5.0f; if (pSystem->dir[0][1] < 1.0f) pSystem->dir[0][1] = 1.0f; pSystem->dir[0][2] = 0; par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], 50.0f); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 2000; p_Level->BublSystemE.bOn = 0; par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); } void am_Create_BublSystem_Effect2(float *pos, LEVELINFO * p_Level, int iSize, float yPlane) { int m; PAR_KOUR_STOPA *pKourovaS; SYSTEMKOUROVYCHCASTIC *pSystem = &p_Level->BublSystemC.System; int size = ftoi(iSize / p_Level->KvalitaCastic); pKourovaS = (PAR_KOUR_STOPA *) malloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; pSystem->pCastice = pKourovaS; pSystem->Sizeof = size; m = kom_najdi_material("cbublina1"); if (m == -1) kprintf(1, "Nelze najit material cbublina1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 7.0f; pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.8f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->System = par_vyrob(); par_set_param(pSystem->System, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->System, pKourovaS, pSystem->Sizeof); pSystem->hHnizdo[0] = par_vloz_hnizdo(pSystem->System); par_vloz_hnizdo_komplet(pSystem->hHnizdo[0], 100000, (BOD *) pSystem->pivot[0], pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 100000, -100000); memcpy((void *) pSystem->pivot[0], (void *) pos, 3 * sizeof(float)); memcpy((void *) pSystem->pivot[1], (void *) pos, 3 * sizeof(float)); pSystem->pivot[0][0] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->pivot[0][2] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) / 5.0f; pSystem->dir[0][0] = 0; pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 5.0f; if (pSystem->dir[0][1] < 1.0f) pSystem->dir[0][1] = 1.0f; pSystem->dir[0][2] = 0; par_vloz_hnizdo_dir(pSystem->hHnizdo[0], (BOD *) pSystem->dir[0]); par_vloz_hnizdo_y_plane(pSystem->hHnizdo[0], yPlane); pSystem->dwStart = timeGetTime(); pSystem->dwTime = 0; pSystem->dwStop = 2000; p_Level->BublSystemC.bOn = 0; par_pripoj_funkci(pSystem->System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->System, &pSystem->flag, 0, 0); } void am_Do_BublSystemE(LEVELINFO * p_Level) { float f; SYSTEMKOUROVYCHCASTIC *pSystem = &p_Level->BublSystemE.System; if (!p_Level->BublSystemE.System.System) return; if (!p_Level->bGameResume) pSystem->dwTime += ber.TimeLastFrame; if (pSystem->dwTime > pSystem->dwStop) { pSystem->dwTime = 0; if (p_Level->BublSystemE.bOn) { p_Level->BublSystemE.bOn = 0; par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 100000, 0); pSystem->dwStop = 3000 + (int) ceil((randf() / (float) (RAND_MAX)) * 1000); } else { pSystem->dwStop = 2000; p_Level->BublSystemE.bOn = 1; par_vloz_hnizdo_timer(pSystem->hHnizdo[0], 1, 0); ap_Play_Sound(0,0,1, pSystem->pivot[1], gl_Choose_Wave_Index(102), NULL, &ad); } } memcpy((void *) pSystem->pivot[0], (void *) pSystem->pivot[1], 3 * sizeof(float)); pSystem->pivot[0][0] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)); pSystem->pivot[0][1] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)); pSystem->pivot[0][2] += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)); pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 10.0f; if (pSystem->dir[0][1] < 4.0f) pSystem->dir[0][1] = 4.0f + (randf() / (float) (RAND_MAX)) * 5.0f; f = (randf() / (float) (RAND_MAX)) / 2.0f; par_vloz_hnizdo_scale(pSystem->hHnizdo[0], f, f, 0, 0); } void am_Do_BublSystemC(LEVELINFO * p_Level) { float f; SYSTEMKOUROVYCHCASTIC *pSystem = &p_Level->BublSystemC.System; if (!p_Level->BublSystemC.System.System) return; if (!p_Level->bGameResume) pSystem->dwTime += ber.TimeLastFrame; if (pSystem->dwTime > pSystem->dwStop) { pSystem->dwTime = 0; p_Level->BublSystemC.bOn = 0; par_vloz_hnizdo_pust_castici(pSystem->hHnizdo[0]); pSystem->dwStop = 3000 + (int) ceil((randf() / (float) (RAND_MAX)) * 1000); pSystem->dir[0][1] = (randf() / (float) (RAND_MAX)) * 10.0f; if (pSystem->dir[0][1] < 4.0f) pSystem->dir[0][1] = 4.0f + (randf() / (float) (RAND_MAX)) * 5.0f; f = (randf() / (float) (RAND_MAX)) * 1.5f; par_vloz_hnizdo_scale(pSystem->hHnizdo[0], f, f, 0, 0); } } void am_Start_Joint_Animations(void) { ExMeshHandle mh, next; ChapadloHandle *p_handle = NULL; int chapadel; static int flag; int i, j, objektu; /* ----------------------------------------------------------- Tuto cast musis delat nekde na zacatku - trva to dlouho (nacteni animaci objektu) */ /* Smycka - hleda a vraci postupne vsechny meshe ve scene ktere maji joint-animace */ next = 0; while ((mh = kom_najdi_mesh_joint(&next)) != K_CHYBA) { /* U nalezeneho meshe nacte pocet objektu ktere maji joint-animace */ objektu = chani_mesh_cti_objekty(mh); /* Projede objekty meshe (pocet objektu s animacema = objektu) a spusti jejich prvni animaci */ for (i = 0; i < objektu; i++) { /* Nacni animace i-teho objektu v poradi */ chani_mesh_cti_chapadelniky(mh, i, &p_handle, &chapadel); /* chapadel = pocet animaci objektu p_handle = pole handlu na tyto animace */ /* Vrati jmena animaci objektu */ for (j = 0; j < chapadel; j++) { char *p_jmeno = chani_cti_jmeno(p_handle[j]); (void)p_jmeno; } /* ----------------------------------------------------------- Tuto cast muzes delat behem hry - je to rychle */ /* Vyberu si 1. animaci v objektu a tu zaradim do seznamu animaci (!!! pozor !!! pri zarazovani animace nekontroluju jestli ta animace tam uz je nebo ne, tak to musis volat jen 1x! nejlepe pred spustenim animace) */ j = 0; chani_zarad(p_handle[j]); /* Zarazenou animaci spustim */ chani_go(p_handle[j], &flag, GK_LOOP, 0, 0); /* Uvolnim pole handlu (je to pole integeru, alokuje se pri volani chani_mesh_cti_chapadelniky pomoci malloc a ty to musis uvolnit kdyz to pole nepotrebujes To pole si klidne muzes ulozit do nejake sve struktury, ja ho k nicemu nepozuivam a je urceny jen pro tebe */ free(p_handle); } } /* Postup pri ruseni bezici animace: 1) Zastavim animaci chani_stop(p_handle[j]); 2) Vymazu ji z fronty animaci chani_zrus(p_handle[j]); */ } int find_free_street_light(LEVELINFO * p_Level) { int i; for (i = 0; i < 8; i++) if (!p_Level->StreetL[i].bUsed) return i; return -1; } void am_Create_Street_Light(LEVELINFO * p_Level, int iStart, int iPause, float *pos) { STREET_LIGHT_EFFECT *psle; int idx = find_free_street_light(p_Level); if (idx < 0) return; psle = &p_Level->StreetL[idx]; psle->bUsed = 1; psle->eCounter = 0; psle->ePause = iPause; psle->epCounter = iPause; psle->eStart = iStart; psle->hFlare = 0; psle->dwEfTime = 0; psle->hSvetlo = -1; psle->pos[0] = pos[0]; psle->pos[1] = pos[1]; psle->pos[2] = pos[2]; psle->Speed = 10; } void am_Do_Street_Lights(LEVELINFO * p_Level) { STREET_LIGHT_EFFECT *psle; int i, hSvetlo; DWORD e = ber.TimeLastFrame; float k = ber.TimeLastFrame / 1000.0f; LENS_FLARE *pFlare; DWORD t = timeGetTime(); DWORD ep; for (i = 0; i < 8; i++) if (p_Level->StreetL[i].bUsed) { psle = &p_Level->StreetL[i]; if (psle->eCounter < psle->eStart) psle->eCounter += e; else if (psle->epCounter < psle->ePause) { psle->epCounter += e; if (psle->hFlare) { ep = t - psle->dwEfTime; if (ep < 250) { pFlare = kom_flare_get_pointer(psle->hFlare); pFlare->dx += psle->Speed * k; pFlare->dy += psle->Speed * k; if (pFlare->dx > 2.5f) { pFlare->dx = pFlare->dy = 2.5f; } } else if (ep > 1000 && ep < 1250) { pFlare = kom_flare_get_pointer(psle->hFlare); pFlare->dx -= psle->Speed * k; pFlare->dy -= psle->Speed * k; if (pFlare->dx < 0) { pFlare->dy = 0; pFlare->dx = 0; } } else if (ep >= 1250) { kom_flare_zrus(psle->hFlare); psle->hFlare = (size_ptr)NULL; } } } else { /*if(!i) kprintf(1, "Svetlo [%d] na %f, %f, %f", i, psle->pos[0], psle->pos[1], psle->pos[2]); */ psle->epCounter = 0; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); if (hSvetlo != -1) { sdl_svetlo_set_pos(hSvetlo, (BOD *) psle->pos); sdl_svetlo_set_diff(hSvetlo, 0.996f, 0.617f, 0, 0, 0, 0); sdl_anim_vyrob(hSvetlo, 30, 0, 0, 4); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 0, 0, 0, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 70, 10, 70, 5); sdl_anim_vloz_klic_vzdal(hSvetlo, 2, 70, 10, 70, 25); sdl_anim_vloz_klic_vzdal(hSvetlo, 3, 0, 0, 0, 29); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, GK_REMOVE, 0, 0); psle->hSvetlo = hSvetlo; } psle->dwEfTime = timeGetTime(); if (psle->hFlare) kom_flare_zrus(psle->hFlare); psle->hFlare = kom_flare_vyrob(FLR_NO_ZTEST); if (psle->hFlare) { int m = kom_najdi_material("flare4"); if (m != -1) { kom_flare_set_param(psle->hFlare, 0.996f, 0.617f, 0, 0.75f, 0.001f, 0.001f, m, GL_ONE); kom_flare_set_pivot(psle->hFlare, (BOD *) & psle->pos); } } } } } void am_Do_Street_Lights_Release(LEVELINFO * p_Level) { int i; STREET_LIGHT_EFFECT *psle; for (i = 0; i < 8; i++) if (p_Level->StreetL[i].bUsed) { kprintf(1, "am_Do_Street_Lights_Release[%d] ...", i); psle = &p_Level->StreetL[i]; if (psle->hFlare) { kprintf(1, "kom_flare_zrus ..."); kom_flare_zrus(psle->hFlare); } if (psle->hSvetlo != -1) { kprintf(1, "sdl_svetlo_zrus ..."); sdl_svetlo_zrus(psle->hSvetlo); } } } void am_Do_RainB(RAINSYSTEM * pRain) { int i; for (i = 0; i < pRain->SizeofWHnizda; i++) { memcpy((void *) &pRain->Wpivot[i], (void *) &pRain->Wpos[i], sizeof(BOD)); pRain->Wpivot[i].x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pRain->fDist; pRain->Wpivot[i].z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * pRain->fDist; //pRain->Wpivot[i].y -= 0.3f; } } int am_Create_Water_CirclesB(LEVELINFO * p_Level, RAINSYSTEM * pRain, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence, float *rPos) { PARMETAC_HNIZDO *pWHnizdo; float pos[3] = { 0, 0, 0 }; PAR_KOUR_STOPA *pCastice; int cWaters, i, material; int intensity, delay; pRain->hWHnizdo = NULL; pRain->Wpivot = NULL; pRain->Wpos = NULL; cWaters = 20; pRain->SizeofWHnizda = cWaters; // pamet na hnizda pRain->hWHnizdo = (size_ptr *)malloc(cWaters * sizeof(pRain->hWHnizdo[0])); if (!pRain->hWHnizdo) { pRain->bWaterCircles = 0; return 0; } // pamet na pivoty pRain->Wpivot = (BOD *) malloc(cWaters * sizeof(BOD)); if (!pRain->Wpivot) { free((void *) pRain->hWHnizdo); pRain->bWaterCircles = 0; return 0; } // pamet na pozice vody pRain->Wpos = (BOD *) malloc(cWaters * sizeof(BOD)); if (!pRain->Wpos) { free((void *) pRain->hWHnizdo); free((void *) pRain->Wpivot); pRain->bWaterCircles = 0; return 0; } // vypocet potrebne velikosti pameti na castice pRain->SizeofWCastice = cWaters * 10; // pamet na castice pRain->pWCastice = (PAR_KOUR_STOPA *) malloc(pRain->SizeofWCastice * sizeof(PAR_KOUR_STOPA)); if (!pRain->pWCastice) { free((void *) pRain->hWHnizdo); free((void *) pRain->Wpivot); free((void *) pRain->Wpos); pRain->bWaterCircles = 0; return 0; } material = kom_najdi_material("ckolo1"); if (material == -1) kprintf(1, "Nelze najit material ckolo1"); pCastice = &pRain->pWCastice[0]; pCastice->rychlost_x = 0.01f; pCastice->rychlost_y = 0.01f; pCastice->utlum_x = pCastice->utlum_y = 20.0f; pCastice->r = pCastice->g = pCastice->b = 1.0f; pCastice->a = 0.8f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = -3.0f; pCastice->ka = 0.0f; pRain->Wnx.x = 1; pRain->Wnx.y = 0; pRain->Wnx.z = 0; pRain->Wny.x = 0; pRain->Wny.y = 0; pRain->Wny.z = 1; pRain->pWSystem = par_vyrob(); if (!pRain->pWSystem) { free((void *) pRain->hWHnizdo); free((void *) pRain->Wpivot); free((void *) pRain->Wpos); free((void *) pRain->pWCastice); pRain->bWaterCircles = 0; return 0; } par_set_param(pRain->pWSystem, material, TPAR_NO_FOG | TPAR_3D | TPAR_SCALE_ADD | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); pCastice = pRain->pWCastice; par_vloz_kour_stopu(pRain->pWSystem, pCastice, pRain->SizeofWCastice); for (i = 0; i < pRain->SizeofWHnizda; i++) { pRain->hWHnizdo[i] = par_vloz_hnizdo(pRain->pWSystem); if (pRain->hWHnizdo[i]) { //pItem = am_Find_Next_Water(&LastItem, p_Level); //if(pItem) { /*kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pRain->Wpos[i].x, &pRain->Wpos[i].y, &pRain->Wpos[i].z, &rot); */ pRain->Wpos[i].x = rPos[0]; pRain->Wpos[i].y = rPos[1]; pRain->Wpos[i].z = rPos[2]; memcpy((void *) &pRain->Wpivot[i], (void *) &pRain->Wpos[i], sizeof(BOD)); pRain->Wpivot[i].x += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pRain->Wpivot[i].z += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pRain->Wpivot[i].y -= 0.3f; intensity = (int) ceil((uiIntensity / 2.0f) + ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * ((uiIntensity * fmaxDivergence) / 2.0f)); delay = rand() % uiIntensity; par_vloz_hnizdo_timer(pRain->hWHnizdo[i], intensity, delay); par_vloz_hnizdo_komplet(pRain->hWHnizdo[i], intensity, &pRain->Wpivot[i], pCastice); pWHnizdo = par_cti_hnizdo(pRain->hWHnizdo[i]); if (pWHnizdo) { pWHnizdo->p_nx = &pRain->Wnx; pWHnizdo->p_ny = &pRain->Wny; } } } } par_go(pRain->pWSystem, &pRain->flag, 0, 0); pRain->fDist = fRadius; pRain->bWaterCircles = 1; return 1; } void am_Flip(LEVELINFO * p_Level, ANIMATION_MODULE * p_am, char bAll, RECT_LINE * rline, int rsize, int bTutor, int bTText, int ty) { RECT r; char c = 0; int i, x = 0; float pos[4]; am_Animate_Items(p_am, p_Level); am_Animate_Beetles(p_Level); am_Do_Zhave_castice(p_Level); am_Do_Flares(p_Level); am_Do_Lifts(p_Level); am_Do_Water(p_Level); am_Do_Water_KolaB(p_Level); am_Do_Bubliny_Berusek(p_Level); am_Do_BublVybuchy(p_Level); am_Do_Exit_Efects(p_Level); am_Do_Exit_Sparks(p_Level); am_Do_TelCSparks(p_Level); am_Do_Rain(&p_Level->Rain); am_Do_RainB(&p_Level->StreetRain); am_Do_Snow(&p_Level->Snow); am_Do_Nature_Effects(p_Level); am_Do_BarelSparks(p_Level); am_Do_BeatleSmokes(p_Level); am_Obsluha_Koure_Brouku(p_Level); am_Do_BublSystemE(p_Level); am_Do_BublSystemC(p_Level); am_Do_Street_Lights(p_Level); am_Do_Swamp_Lights(p_Level); am_Do_Star_Lights(p_Level); am_Do_StarFall(p_Level); am_Do_CandleSparks(p_Level); am_Do_CandleSmoke(p_Level); r.left = mx; r.top = my; r.right = _3dCur.idx; r.bottom = _3dCur.idy; if (rline) { ddx2AddRectItem(rline, r, 0); if (!rline->rlast) ddx2SetRect(NULL, 0); else { ZeroMemory(rDrawRect, sizeof(RECT) * DRAW_RECT_NUM); for (i = 0; i < rline->rlast; i++) if (!_2d_Is_InRectLine(rDrawRect, &rline->rect[i].rect, x)) { memcpy(&rDrawRect[x], &rline->rect[i].rect, sizeof(RECT)); x++; } ddx2SetRect(rDrawRect, x); } } p_Level->bGameResume = 0; spracuj_spravy(0); kom_klavesy_hra(); kom_kresli_level(); _3d_Begin_Draw(); if (!bAll) _3d_Draw_MenusB(p_Level, -1, &c, bTutor, bTText, ty); _3d_End_Draw(); if (bAll) ddx2RenderujVse(p_ber); else ddx2RenderDevices(p_ber); _3d_Begin_Draw(); _3d_Set_Smooth(); if (p_Level->bRestart) p_Level->iMessageBoxReturn = _3d_Draw_MessageBox(5); if (p_Level->bReturnToMenu) p_Level->iMessageBoxReturn = _3d_Draw_MessageBox(7); pos[0] = (float) mi.x + _3dCur.iaddx; pos[1] = (float) mi.y + _3dCur.iaddy; pos[2] = (float) mi.x + _3dCur.idx + _3dCur.iaddx; pos[3] = (float) mi.y + _3dCur.idy + _3dCur.iaddy; _3d_Draw_Box(p_Level->iCursor, pos); _3d_End_Draw(); flip(); _2d_Clear_RectLine(rline); mx = mi.x; my = mi.y; } void am_FlipA(LEVELINFO * p_Level, ANIMATION_MODULE * p_am, char bAll, RECT_LINE * rline, int rsize, int bTutor, int bTText, int ty) { char c = 0; float pos[4]; am_Animate_Items(p_am, p_Level); am_Animate_Beetles(p_Level); am_Do_Zhave_castice(p_Level); am_Do_Flares(p_Level); am_Do_Lifts(p_Level); am_Do_Water(p_Level); am_Do_Water_KolaB(p_Level); am_Do_Bubliny_Berusek(p_Level); am_Do_BublVybuchy(p_Level); am_Do_Exit_Efects(p_Level); am_Do_Exit_Sparks(p_Level); am_Do_TelCSparks(p_Level); am_Do_Rain(&p_Level->Rain); am_Do_RainB(&p_Level->StreetRain); am_Do_Snow(&p_Level->Snow); am_Do_Nature_Effects(p_Level); am_Do_BarelSparks(p_Level); am_Do_BeatleSmokes(p_Level); am_Obsluha_Koure_Brouku(p_Level); am_Do_BublSystemE(p_Level); am_Do_BublSystemC(p_Level); am_Do_Street_Lights(p_Level); am_Do_Swamp_Lights(p_Level); am_Do_Star_Lights(p_Level); am_Do_StarFall(p_Level); am_Do_CandleSparks(p_Level); am_Do_CandleSmoke(p_Level); p_Level->bGameResume = 0; spracuj_spravy(0); kom_klavesy_hra(); kom_kresli_level(); _3d_Begin_Draw(); _3d_Draw_MenusB(p_Level, -1, &c, bTutor, bTText, ty); if (!p_Level->iCursor) { pos[0] = (float) mi.x + _3dCur.iaddx; pos[1] = (float) mi.y + _3dCur.iaddy; pos[2] = (float) mi.x + _3dCur.idx + _3dCur.iaddx; pos[3] = (float) mi.y + _3dCur.idy + _3dCur.iaddy; } else { pos[0] = (float) mi.x; pos[1] = (float) mi.y; pos[2] = (float) mi.x + 32; pos[3] = (float) mi.y + 32; } _3d_Draw_Box(p_Level->iCursor, pos); _3d_End_Draw(); flip(); mx = mi.x; my = mi.y; } void am_Start_Gen_Animation(char *cMesh, LEVELINFO * p_Level) { BOD b((float) (rand() % 2), 0, (float) (rand() % 2)); BOD p; int anim, i, f1, f2; float r; MeshHandle iMesh = kom_pridej_mesh_do_levelu(cMesh); if (iMesh == K_CHYBA) return; if (!b.x && !b.z) { b.x = 1.0f; b.z = 1.0f; } anim = sim_vyrob_animaci(1, 4, 0); kom_mesh_get_pivot(iMesh, &p); sim_vloz_pivot(anim, p.x, p.y, p.z); sim_vloz_klic_posun(anim, 0, 0, 0, 0, 0); r = rand() / ((float)RAND_MAX * 40); if (r < 0.05f) r = 0.05f; f1 = (int) ceil(r * 800); r = rand() / ((float)RAND_MAX * 40); if (r < 0.05f) r = 0.05f; f2 = (int) ceil((r * 800) + f1); sim_vloz_klic_rotace(anim, 0, &b, 0, 0); i = rand() % 2; r = (rand() / ((float)RAND_MAX)) * 2; if (i) r *= -1; sim_vloz_klic_rotace(anim, 1, &b, r, f1); r = (rand() / ((float)RAND_MAX)) * 2; if (!i) r *= -1; sim_vloz_klic_rotace(anim, 2, &b, r, f1 + f2); sim_vloz_klic_rotace(anim, 3, &b, 0, 2 * f1 + f2); sim_interpoluj_animaci(anim, 2 * f1 + f2 + 1, 1); RunHandle iAnimation = rani_aktivuj(anim, &p_Level->TrashFlag, GK_LOOP, 0, 0); if (!iAnimation) return; rani_privaz_mesh(iAnimation, iMesh, 0); } int find_free_swamp_light(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->SwampL[i].bUsed) return i; return -1; } void am_Create_Swamp_Light(LEVELINFO * p_Level, int iStart, int iPause, float *pos) { STREET_LIGHT_EFFECT *psle; int hSvetlo; int idx = find_free_swamp_light(p_Level); if (idx < 0) return; psle = &p_Level->SwampL[idx]; ZeroMemory(psle, sizeof(STREET_LIGHT_EFFECT)); psle->bUsed = 1; psle->eCounter = 0; psle->ePause = iPause; psle->epCounter = iPause; psle->eStart = iStart; psle->hFlare = 0; psle->dwEfTime = 0; psle->hSvetlo = -1; psle->pos[0] = pos[0]; psle->pos[1] = pos[1]; psle->pos[2] = pos[2]; psle->Speed = (randf() / (float) RAND_MAX) * 0.3f; psle->fdx = (randf() / (float) RAND_MAX) * 0.3f; psle->dwRiseTime = (int) ceil(rand() / (float) RAND_MAX) * 150; if (psle->dwRiseTime < 50) psle->dwRiseTime = 50; psle->dwLightTime = (int) ceil(rand() / (float) RAND_MAX) * 250; if (psle->dwLightTime < psle->dwRiseTime) psle->dwLightTime = psle->dwRiseTime + 50; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); if (hSvetlo != -1) { sdl_svetlo_set_pos(hSvetlo, (BOD *) psle->pos); sdl_svetlo_set_diff(hSvetlo, 0.996f, 0.617f, 0, 1, psle->Speed * 200, psle->Speed * 200); psle->hSvetlo = hSvetlo; } psle->hFlare = kom_flare_vyrob(0); if (psle->hFlare) { int m = kom_najdi_material("flare4"); if (m != -1) { kom_flare_set_param(psle->hFlare, 0.996f, 0.617f, 0, 0.5f, psle->fdx, psle->fdx, m, GL_ONE); kom_flare_set_pivot(psle->hFlare, (BOD *) & psle->pos); } } } void am_Do_Swamp_Lights(LEVELINFO * p_Level) { STREET_LIGHT_EFFECT *psle; int i; DWORD e = ber.TimeLastFrame; float k = ber.TimeLastFrame / 1000.0f; LENS_FLARE *pFlare; DWORD t = timeGetTime(); DWORD ep; if (p_Level->bGameResume) { e = 0; k = 0; } for (i = 0; i < 10; i++) if (p_Level->SwampL[i].bUsed) { psle = &p_Level->SwampL[i]; if (psle->eCounter < psle->eStart) psle->eCounter += e; else if (psle->epCounter < psle->ePause) { psle->epCounter += e; if (psle->hFlare) { ep = t - psle->dwEfTime; if (ep < psle->dwRiseTime) { pFlare = kom_flare_get_pointer(psle->hFlare); pFlare->dx += psle->Speed * k; pFlare->dy += psle->Speed * k; if (pFlare->dx > 0.5f) { pFlare->dx = psle->fdx; pFlare->dy = psle->fdx; } } else if (ep >= psle->dwRiseTime && ep <= 2 * psle->dwRiseTime) { pFlare = kom_flare_get_pointer(psle->hFlare); pFlare->dx -= psle->Speed * k; pFlare->dy -= psle->Speed * k; if (pFlare->dx < psle->fdx) { pFlare->dy = psle->fdx; pFlare->dx = psle->fdx; } } } } else { psle->epCounter = 0; psle->dwEfTime = timeGetTime(); psle->dwRiseTime = (int) ceil(rand() / (float) RAND_MAX) * 150; if (psle->dwRiseTime < 50) psle->dwRiseTime = 50; psle->dwLightTime = (int) ceil(rand() / (float) RAND_MAX) * 250; if (psle->dwLightTime < psle->dwRiseTime) psle->dwLightTime = psle->dwRiseTime + 50; psle->ePause = (2 * psle->dwRiseTime); // + psle->dwLightTime; } } } void am_Do_Swamp_Lights_Release(LEVELINFO * p_Level) { int i; STREET_LIGHT_EFFECT *psle; for (i = 0; i < 10; i++) { if (p_Level->SwampL[i].bUsed) { kprintf(1, "am_Do_Swamp_Lights_Release[%d] ...", i); psle = &p_Level->SwampL[i]; if (psle->hFlare) { kprintf(1, "kom_flare_zrus[%d] ...", i); kom_flare_zrus(psle->hFlare); } if (psle->hSvetlo != -1) { kprintf(1, "sdl_svetlo_zrus[%d] ...", i); sdl_svetlo_zrus(psle->hSvetlo); } } } } void am_Do_Star_Lights_Release(LEVELINFO * p_Level) { int i; STREET_LIGHT_EFFECT *psle; for (i = 0; i < 200; i++) if (p_Level->StarL[i].bUsed) { kprintf(1, "am_Do_Star_Lights_Release[%d] ...", i); psle = &p_Level->StarL[i]; if (psle->hFlare) { kprintf(1, "kom_flare_zrus[%d] ...", i); kom_flare_zrus(psle->hFlare); } if (psle->hSvetlo != -1) { kprintf(1, "sdl_svetlo_zrus[%d] ...", i); sdl_svetlo_zrus(psle->hSvetlo); } } } void am_Gen_Swamp_Lights(LEVELINFO * p_Level, RECT * r) { BOD p1, p2; float p[3]; int i, t; int done = 0; kom_get_level_size(&p1, &p2); p1.x -= 25.0f; p1.z -= 25.0f; p2.x += 25.0f; p2.z += 25.0f; //generuj staticke msvetilka for (i = 0; i < 10; i++) { t = (int) ftoi((randf() / (float) RAND_MAX) * 1000.0f); done = 0; while (!done) { p[0] = r->left + (float) (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) r->left, (float) r->right); p[1] = p_ber->y_start + 1 + ((rand() / (float) RAND_MAX) * 40); p[2] = r->top + (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) r->top, (float) r->bottom); if ((p[0] < p1.x || p[0] > p2.x) && (p[2] < p1.z || p[2] > p2.z)) done = 1; } am_Create_Swamp_Light(p_Level, t, t, p); } } int find_used_swamp_light(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (p_Level->SwampL[i].bUsed && !p_Level->SwampL[i].bConnected) return i; return -1; } int am_Create_Fairy(LEVELINFO * p_Level, FAIRY_EFFECT * pF, float pos[3], float fLowPlain, char *cMaterial, float fRadius, float fStartY, RECT * pScene) { PAR_KOUR_STOPA *pCastice; int material; int iSwampL = find_used_swamp_light(p_Level); if (iSwampL == -1) return 0; ZeroMemory(pF, sizeof(FAIRY_EFFECT)); pF->hHnizdo = (size_ptr)NULL; pF->pSystem = (size_ptr)NULL; pF->iSound = ap_Play_Sound(2, 0, 1, pos, 139, NULL, &ad); memcpy(&pF->rScene, pScene, sizeof(RECT)); pF->csize = 300; pF->pCastice = (PAR_KOUR_STOPA *) malloc(pF->csize * sizeof(PAR_KOUR_STOPA)); pF->fLowPlain = fLowPlain; if (!pF->pCastice) return 0; pF->faire_dir[0] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pF->faire_dir[2] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect(&pF->faire_dir[0], &pF->faire_dir[1], &pF->faire_dir[2]); pF->speed = 20 + ((randf() / (float) (RAND_MAX)) * 60); memcpy((void *) &pF->pos, (void *) pos, 3 * sizeof(float)); if (p_Level->SwampL[iSwampL].hFlare) kom_flare_set_pivot(p_Level->SwampL[iSwampL].hFlare, &pF->pivot); if (p_Level->SwampL[iSwampL].hSvetlo != K_CHYBA) sdl_svetlo_set_pos(p_Level->SwampL[iSwampL].hSvetlo, &pF->pivot); p_Level->SwampL[iSwampL].bConnected = 1; pF->iSwampLight = iSwampL; material = kom_najdi_material(cMaterial); if (material == -1) { kprintf(1, "Nelze najit material %s", cMaterial); free((void *) pF->pCastice); return 0; } //gen sinu pF->falngle[0] = (randf() / (float) RAND_MAX) * 4; pF->falngle[1] = (randf() / (float) RAND_MAX) * 4; pF->falngle[2] = (randf() / (float) RAND_MAX) * 4; pF->fsinspeed[0] = (randf() / (float) RAND_MAX) * 2; pF->fsinspeed[1] = (randf() / (float) RAND_MAX) * 2; pF->fsinspeed[2] = (randf() / (float) RAND_MAX) * 2; pF->fmult[0] = (randf() / (float) RAND_MAX) * 10; pF->fmult[1] = (randf() / (float) RAND_MAX) * 10; pF->fmult[2] = (randf() / (float) RAND_MAX) * 10; pCastice = &pF->pCastice[0]; pCastice->rychlost_x = 0.06f; pCastice->rychlost_y = 0.06f; pCastice->utlum_x = pCastice->utlum_y = 0.0f; pCastice->r = 0.98f; pCastice->g = 0.91f; pCastice->b = 0.33f; pCastice->a = 0.75f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pF->pSystem = par_vyrob(); if (!pF->pSystem) { free((void *) pF->pCastice); return 0; } memcpy((void *) &pF->pivot, (void *) pos, 3 * sizeof(float)); par_set_param(pF->pSystem, material, TPAR_NO_FOG | TPAR_YPLANE_LOW | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, &pF->pivot, &pF->pivot); pCastice = pF->pCastice; par_vloz_kour_stopu(pF->pSystem, pCastice, pF->csize); pF->hHnizdo = par_vloz_hnizdo(pF->pSystem); if (pF->hHnizdo) { par_vloz_hnizdo_komplet(pF->hHnizdo, 5, &pF->pivot, pCastice); par_vloz_hnizdo_timer(pF->hHnizdo, 5, 0); memcpy((void *) &pF->pivot, (void *) pos, 3 * sizeof(float)); pF->pivot.x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pF->pivot.z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * fRadius; pF->pivot.y = fStartY; memcpy((void *) &pF->dir, (void *) pos, 3 * sizeof(float)); pF->dir.x = 0; pF->dir.y = -1; pF->dir.z = 0; par_vloz_hnizdo_dir(pF->hHnizdo, &pF->dir); par_vloz_hnizdo_y_plane(pF->hHnizdo, pF->fLowPlain); } par_pripoj_funkci(pF->pSystem, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pF->pCastice)); par_go(pF->pSystem, &pF->flag, 0, 0); pF->dwTime = 0; pF->dwRegTime = 250; return 1; } int find_free_fairy_system(LEVELINFO * p_Level) { int i; for (i = 0; i < 4; i++) if (!p_Level->FairyEffect[i].pSystem) return i; return -1; } int am_Create_Fairies(LEVELINFO * p_Level, RECT * r) { //RECT r = {-200, -200, 200, 200}; int i, idx; float pos[3], low_plane, radius, start; for (i = 0; i < 4; i++) { idx = find_free_fairy_system(p_Level); if (idx == -1) return 0; radius = 10; low_plane = p_ber->y_start; start = p_ber->y_start + 5 + ((rand() / (float) RAND_MAX) * 25); pos[0] = r->left + (float) (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) r->left, (float) r->right); pos[1] = p_ber->y_start + 25 + ((rand() / (float) RAND_MAX) * 25); pos[2] = r->top + (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) r->top, (float) r->bottom); am_Create_Fairy(p_Level, &p_Level->FairyEffect[idx], pos, low_plane, "flare12", radius, start, r); } return 1; } void am_move_Fiere(FAIRY_EFFECT * pF, LEVELINFO * p_Level) { float f = ber.TimeLastFrame / 1000.0f; int c = 0; memcpy((void *) &pF->pivot, (void *) pF->pos, 3 * sizeof(float)); pF->pivot.x += pF->faire_dir[0] * pF->speed * f; pF->pivot.z += pF->faire_dir[2] * pF->speed * f; if (pF->pivot.x < pF->rScene.left) { pF->pivot.x = (float) pF->rScene.left; c++; } if (pF->pivot.x > pF->rScene.right) { pF->pivot.x = (float) pF->rScene.right; c++; } if (pF->pivot.z < pF->rScene.top) { pF->pivot.z = (float) pF->rScene.top; c++; } if (pF->pivot.z > pF->rScene.bottom) { pF->pivot.z = (float) pF->rScene.bottom; c++; } if (c) { pF->faire_dir[0] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); pF->faire_dir[2] = (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); norm_vect(&pF->faire_dir[0], &pF->faire_dir[1], &pF->faire_dir[2]); pF->speed = 20 + ((randf() / (float) (RAND_MAX)) * 60); pF->fsinspeed[0] = (randf() / (float) RAND_MAX) * 2; pF->fsinspeed[1] = (randf() / (float) RAND_MAX) * 2; pF->fsinspeed[2] = (randf() / (float) RAND_MAX) * 2; pF->fmult[0] = (randf() / (float) RAND_MAX) * 10; pF->fmult[1] = (randf() / (float) RAND_MAX) * 10; pF->fmult[2] = (randf() / (float) RAND_MAX) * 10; } memcpy((void *) pF->pos, (void *) &pF->pivot, 3 * sizeof(float)); //modulace pozice; pF->falngle[0] += pF->fsinspeed[0] * f; pF->falngle[1] += pF->fsinspeed[1] * f; pF->falngle[2] += pF->fsinspeed[2] * f; pF->pivot.x += ((float) sin(pF->falngle[0]) * pF->fmult[0]); pF->pivot.y += ((float) sin(pF->falngle[1]) * pF->fmult[1]); pF->pivot.z += ((float) sin(pF->falngle[2]) * pF->fmult[2]); //kprintf(1, "f = %f", (float)sin(pF->falngle[0]) * pF->fmult[0]); if (p_Level->SwampL[pF->iSwampLight].hSvetlo != K_CHYBA) sdl_svetlo_set_pos(p_Level->SwampL[pF->iSwampLight].hSvetlo, &pF->pivot); if (pF->iSound != -1) { float ftmp[3]; memcpy((void *) ftmp, (void *) &pF->pivot, 3 * sizeof(float)); //adas_Set_Source_Position(PARTICULAR_SOUND_SOURCE, 2, pF->iSound, ftmp); } } void am_Do_Fairies(LEVELINFO * p_Level) { FAIRY_EFFECT *pF; int i; float f; for (i = 0; i < 4; i++) if (p_Level->FairyEffect[i].pSystem) { pF = &p_Level->FairyEffect[i]; //pF->dwTime += ber.TimeLastFrame; pF->dir.y = ((-randf() / (float) (RAND_MAX)) * 60.0f); if (pF->dir.y > -10) pF->dir.y = -10 + ((-randf() / (float) (RAND_MAX)) * 20.0f); f = (randf() / (float) (RAND_MAX)) * 1.0f; par_vloz_hnizdo_scale(pF->hHnizdo, f, f, 0, 0); am_move_Fiere(pF, p_Level); } } int find_free_star_system(LEVELINFO * p_Level) { int i; for (i = 0; i < 200; i++) if (!p_Level->StarL[i].bUsed) return i; return -1; } void am_Gen_Star_Light(LEVELINFO * p_Level, int iStart, int iPause, float *pos, int iNoLight) { STREET_LIGHT_EFFECT *psle; int hSvetlo; int idx = find_free_star_system(p_Level); if (idx < 0) return; psle = &p_Level->StarL[idx]; ZeroMemory(psle, sizeof(STREET_LIGHT_EFFECT)); psle->bUsed = 1; psle->eCounter = 0; psle->ePause = iPause; psle->epCounter = iPause; psle->eStart = iStart; psle->hFlare = 0; psle->dwEfTime = 0; psle->hSvetlo = -1; psle->pos[0] = pos[0]; psle->pos[1] = pos[1]; psle->pos[2] = pos[2]; psle->Speed = (randf() / (float) RAND_MAX) * 0.3f; if (!iNoLight) psle->fdx = 0.1f + (randf() / (float) RAND_MAX) * 0.3f; else psle->fdx = 0.01f + (randf() / (float) RAND_MAX) * 0.1f; psle->dwRiseTime = (int) ceil(rand() / (float) RAND_MAX) * 150; if (psle->dwRiseTime < 50) psle->dwRiseTime = 50; psle->dwLightTime = (int) ceil(rand() / (float) RAND_MAX) * 250; if (psle->dwLightTime < psle->dwRiseTime) psle->dwLightTime = psle->dwRiseTime + 50; if (!iNoLight) { hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); if (hSvetlo != -1) { sdl_svetlo_set_pos(hSvetlo, (BOD *) psle->pos); sdl_svetlo_set_diff(hSvetlo, 0.765f, 0.89f, 0.89f, 1, psle->Speed * 1000, psle->Speed * 1000); psle->hSvetlo = hSvetlo; } } psle->hFlare = kom_flare_vyrob(0); if (psle->hFlare) { int m = kom_najdi_material("flare4"); if (m != -1) { kom_flare_set_param(psle->hFlare, 0.765f, 0.89f, 0.89f, 0.75f, psle->fdx, psle->fdx, m, GL_ONE); kom_flare_set_pivot(psle->hFlare, (BOD *) & psle->pos); } } } void am_Gen_Star_Lights(LEVELINFO * p_Level, float *pos) { BOD p1, p2; int done = 0; float p[3]; int i, t, s; kom_get_level_size(&p1, &p2); p1.x -= 50.0f; p1.z -= 50.0f; p2.x += 50.0f; p2.z += 50.0f; for (i = 0; i < 200; i++) { s = (int) ftoi((randf() / (float) RAND_MAX) * 10000.0f); t = (int) ftoi((randf() / (float) RAND_MAX) * 1000.0f); done = 0; while (!done) { p[0] = pos[0] + (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) pos[0], (float) pos[3]); p[1] = -50 + pos[1] + (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) pos[1], (float) pos[4]); p[2] = pos[2] + (rand() / (float) RAND_MAX) * am_vzdal_bodu_single((float) pos[2], (float) pos[5]); if ((p[0] < p1.x || p[0] > p2.x) && (p[2] < p1.z || p[2] > p2.z)) done = 1; } am_Gen_Star_Light(p_Level, s, t, p, i); } } void am_Do_Star_Lights(LEVELINFO * p_Level) { STREET_LIGHT_EFFECT *psle; int i; DWORD e = ber.TimeLastFrame; float k = ber.TimeLastFrame / 1000.0f; LENS_FLARE *pFlare; DWORD t = timeGetTime(); DWORD ep; for (i = 0; i < 200; i++) if (p_Level->StarL[i].bUsed) { psle = &p_Level->StarL[i]; if (psle->eCounter < psle->eStart) psle->eCounter += e; else if (psle->epCounter < psle->ePause) { psle->epCounter += e; if (psle->hFlare) { ep = t - psle->dwEfTime; if (ep < psle->dwRiseTime) { pFlare = kom_flare_get_pointer(psle->hFlare); pFlare->dx += psle->Speed * k; pFlare->dy += psle->Speed * k; if (pFlare->dx > 0.2f) { pFlare->dx = psle->fdx; pFlare->dy = psle->fdx; } } else if (ep >= psle->dwRiseTime && ep <= 2 * psle->dwRiseTime) { pFlare = kom_flare_get_pointer(psle->hFlare); pFlare->dx -= psle->Speed * k; pFlare->dy -= psle->Speed * k; if (pFlare->dx < psle->fdx) { pFlare->dy = psle->fdx; pFlare->dx = psle->fdx; } } } } else { psle->epCounter = 0; psle->dwEfTime = timeGetTime(); psle->dwRiseTime = (int) ceil(rand() / (float) RAND_MAX) * 150; if (psle->dwRiseTime < 50) psle->dwRiseTime = 50; psle->dwLightTime = (int) ceil(rand() / (float) RAND_MAX) * 250; if (psle->dwLightTime < psle->dwRiseTime) psle->dwLightTime = psle->dwRiseTime + 50; psle->ePause = (2 * psle->dwRiseTime); // + psle->dwLightTime; } } } int am_Create_Falling_Star(LEVELINFO * p_Level, FAIRY_EFFECT * pF, float pos[3], float fLowPlain, char *cMaterial, float fRadius, float fStartY, float *pScene) { float pos1[3], pos2[3]; PAR_KOUR_STOPA *pCastice; int material; int iStarL = 0; if (iStarL == -1) return 0; ZeroMemory(pF, sizeof(FAIRY_EFFECT)); pF->hHnizdo = (size_ptr)NULL; pF->pSystem = (size_ptr)NULL; pF->iSound = -1; memcpy(&pF->fScene, pScene, 6 * sizeof(float)); pF->csize = 7000; pF->pCastice = (PAR_KOUR_STOPA *) malloc(pF->csize * sizeof(PAR_KOUR_STOPA)); pF->fLowPlain = fLowPlain; if (!pF->pCastice) return 0; pos1[0] = pScene[0] + ((randf() / (float) (RAND_MAX)) * am_vzdal_bodu_single(pScene[3], pScene[0])); pos1[1] = pScene[4]; pos1[2] = pScene[2] + ((randf() / (float) (RAND_MAX)) * am_vzdal_bodu_single(pScene[2], pScene[5])); pos2[0] = pScene[0] + ((randf() / (float) (RAND_MAX)) * am_vzdal_bodu_single(pScene[3], pScene[0])); pos2[1] = pScene[1]; pos2[2] = pScene[2] + ((randf() / (float) (RAND_MAX)) * am_vzdal_bodu_single(pScene[2], pScene[5])); Make_Vector(pos1, pos2, pF->faire_dir); norm_vect(&pF->faire_dir[0], &pF->faire_dir[1], &pF->faire_dir[2]); pF->speed = 40 + ((randf() / (float) (RAND_MAX)) * 100); memcpy((void *) &pF->pos, (void *) pos1, 3 * sizeof(float)); if (p_Level->StarL[iStarL].hFlare) kom_flare_set_pivot(p_Level->StarL[iStarL].hFlare, &pF->pivot); if (p_Level->StarL[iStarL].hSvetlo != K_CHYBA) sdl_svetlo_set_pos(p_Level->StarL[iStarL].hSvetlo, &pF->pivot); p_Level->StarL[iStarL].bConnected = 1; pF->iSwampLight = iStarL; material = kom_najdi_material(cMaterial); if (material == -1) { kprintf(1, "Nelze najit material %s", cMaterial); free((void *) pF->pCastice); return 0; } //gen sinu pF->falngle[0] = (randf() / (float) RAND_MAX) * 4; pF->falngle[1] = (randf() / (float) RAND_MAX) * 4; pF->falngle[2] = (randf() / (float) RAND_MAX) * 4; pF->fsinspeed[0] = (randf() / (float) RAND_MAX) * 2; pF->fsinspeed[1] = (randf() / (float) RAND_MAX) * 2; pF->fsinspeed[2] = (randf() / (float) RAND_MAX) * 2; pF->fmult[0] = (randf() / (float) RAND_MAX) * 10; pF->fmult[1] = (randf() / (float) RAND_MAX) * 10; pF->fmult[2] = (randf() / (float) RAND_MAX) * 10; pCastice = &pF->pCastice[0]; pCastice->rychlost_x = 0.06f; pCastice->rychlost_y = 0.06f; pCastice->utlum_x = pCastice->utlum_y = -0.1f; pCastice->r = 0.765f; pCastice->g = 0.89f; pCastice->b = 0.89f; pCastice->a = 0.75f; pCastice->da = pCastice->dr = pCastice->dg = pCastice->db = 0.0f; pF->pSystem = par_vyrob(); if (!pF->pSystem) { free((void *) pF->pCastice); return 0; } memcpy((void *) &pF->pivot, (void *) pos, 3 * sizeof(float)); par_set_param(pF->pSystem, material, TPAR_NO_FOG | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, &pF->pivot, &pF->pivot); pCastice = pF->pCastice; par_vloz_kour_stopu(pF->pSystem, pCastice, pF->csize); pF->hHnizdo = par_vloz_hnizdo(pF->pSystem); if (pF->hHnizdo) { par_vloz_hnizdo_komplet(pF->hHnizdo, 5, &pF->pivot, pCastice); par_vloz_hnizdo_timer(pF->hHnizdo, 5, 0); memcpy((void *) &pF->pivot, (void *) pos1, 3 * sizeof(float)); /* pF->pivot.x += ((rand()&0x1 ? randf() : -randf())/(float)(RAND_MAX)) * fRadius; pF->pivot.z += ((rand()&0x1 ? randf() : -randf())/(float)(RAND_MAX)) * fRadius; pF->pivot.y = fStartY;*/ /* memcpy((void *)&pF->dir, (void *)pos, 3 * sizeof(float)); pF->dir.x = 0; pF->dir.y = -1; pF->dir.z = 0; par_vloz_hnizdo_dir(pF->hHnizdo, &pF->dir);*/ //par_vloz_hnizdo_y_plane(pF->hHnizdo, pF->fLowPlain); } par_pripoj_funkci(pF->pSystem, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pF->pCastice)); par_go(pF->pSystem, &pF->flag, 0, 0); pF->dwTime = 0; pF->dwRegTime = 250; return 1; } void am_move_Star(FAIRY_EFFECT * pF, LEVELINFO * p_Level) { float pos1[3], pos2[3]; float f = ber.TimeLastFrame / 1000.0f; int c = 0; if (p_Level->bGameResume) { f = 0; } memcpy((void *) &pF->pivot, (void *) pF->pos, 3 * sizeof(float)); pF->pivot.x += pF->faire_dir[0] * pF->speed * f; pF->pivot.y += pF->faire_dir[1] * pF->speed * f; pF->pivot.z += pF->faire_dir[2] * pF->speed * f; if (pF->pivot.y < pF->fScene[1]) c++; if (c) { pos1[0] = pF->fScene[0] + ((randf() / (float) (RAND_MAX)) * pF->fScene[3]); pos1[1] = pF->fScene[4]; pos1[2] = pF->fScene[2] + ((randf() / (float) (RAND_MAX)) * pF->fScene[5]); pos2[0] = pF->fScene[0] + ((randf() / (float) (RAND_MAX)) * pF->fScene[3]); pos2[1] = pF->fScene[1]; pos2[2] = pF->fScene[2] + ((randf() / (float) (RAND_MAX)) * pF->fScene[5]); Make_Vector(pos1, pos2, pF->faire_dir); norm_vect(&pF->faire_dir[0], &pF->faire_dir[1], &pF->faire_dir[2]); pF->speed = 40 + ((randf() / (float) (RAND_MAX)) * 100); memcpy((void *) &pF->pivot, (void *) pos1, 3 * sizeof(float)); } memcpy((void *) pF->pos, (void *) &pF->pivot, 3 * sizeof(float)); if (p_Level->StarL[pF->iSwampLight].hSvetlo != K_CHYBA) sdl_svetlo_set_pos(p_Level->StarL[pF->iSwampLight].hSvetlo, &pF->pivot); } void am_Do_StarFall(LEVELINFO * p_Level) { PAR_KOUR_STOPA *pCastice; FAIRY_EFFECT *pF; int i; float f, f1; for (i = 0; i < 2; i++) if (p_Level->StarFall[i].pSystem) { pF = &p_Level->StarFall[i]; f = (randf() / (float) (RAND_MAX)) * 4.0f; f1 = 0.025f + (randf() / (float) (RAND_MAX)) * 2.0f; par_vloz_hnizdo_scale(pF->hHnizdo, f, f, -f1, -f1); am_move_Star(pF, p_Level); pCastice = par_cti_hnizdo_castice(pF->hHnizdo); // test na velikost castic. Pokud je moc mala, tak pric s ni if (pCastice) { while (pCastice) { if (pCastice->rychlost_x < 0.01f || pCastice->rychlost_y < 0.01f) pCastice->a = 0; pCastice = pCastice->p_next; } } } } int am_Create_Falling_Stars(LEVELINFO * p_Level, float *r) { int i, idx; float pos[3], low_plane, radius, start; for (i = 0; i < 1; i++) { idx = 0; if (idx == -1) return 0; radius = 10; low_plane = r[1]; start = r[4]; pos[0] = r[0] + randf() * r[3]; pos[1] = r[4]; pos[2] = r[2] + randf() * r[5]; am_Create_Falling_Star(p_Level, &p_Level->StarFall[idx], pos, low_plane, "flare100", radius, start, r); } return 1; } int am_Get_Free_CandleSystem(LEVELINFO * p_Level) { int i; for (i = 0; i < 6; i++) if (!p_Level->CandleEffect[i].pSystem) return i; return -1; } int am_Create_CandleSystem(float *pos, LEVELINFO * p_Level) { int m, k, hSvetlo; PAR_KOUR_STOPA *pKourovaS; CANDLE_EFFECT *pSystem; k = am_Get_Free_CandleSystem(p_Level); if (k == -1) return -1; pSystem = &p_Level->CandleEffect[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(200 * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return -1; pSystem->pCastice = pKourovaS; pSystem->csize = 200; m = kom_najdi_material("flare5"); if (m == -1) kprintf(1, "Nelze najit material flare5"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 1.0f; pKourovaS[0].utlum_x = -2; pKourovaS[0].utlum_y = -2; pKourovaS[0].r = 1; pKourovaS[0].g = 1; pKourovaS[0].b = 0.5f; pKourovaS[0].a = 0.75f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; pSystem->pSystem = par_vyrob(); par_set_param(pSystem->pSystem, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->pSystem, pKourovaS, pSystem->csize); pSystem->hHnizdo = par_vloz_hnizdo(pSystem->pSystem); par_vloz_hnizdo_komplet(pSystem->hHnizdo, 10, &pSystem->pivot, pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo, 10, -10); memcpy((void *) &pSystem->pivot, (void *) pos, 3 * sizeof(float)); memcpy((void *) &pSystem->pos, (void *) pos, 3 * sizeof(float)); pSystem->dir.x = 0; pSystem->dir.y = (randf() / (float) (RAND_MAX)) * 1; pSystem->dir.z = 0; par_vloz_hnizdo_y_plane(pSystem->hHnizdo, pos[1] + 10); par_vloz_hnizdo_dir(pSystem->hHnizdo, &pSystem->dir); par_pripoj_funkci(pSystem->pSystem, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->pSystem, &pSystem->flag, 0, 0); hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); if (hSvetlo != -1) { int cfames = 50 * ((rand() % 9) + 1); int cklicu = (int) floor(cfames / 4.0f); float dosah; int frm; sdl_svetlo_set_pos(hSvetlo, (BOD *) pSystem->pos); sdl_svetlo_set_diff(hSvetlo, 0.25f, 0.25f, 0.197f, 0, 0, 0); sdl_anim_vyrob(hSvetlo, cfames, 0, 0, cklicu); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 30, 0, 30, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, cklicu - 1, 30, 0, 30, cfames - 1); for (m = 1; m < cklicu - 1; m++) { dosah = 30 + (((rand() & 0x1 ? randf() : -randf()) / RAND_MAX) * 25.0f); frm = (m * (int) floor(cfames / (float) cklicu)); sdl_anim_vloz_klic_vzdal(hSvetlo, m, dosah, 0, dosah, frm); } sdl_anim_start(hSvetlo, &p_Level->TrashFlag, GK_LOOP, 0, 0); } pSystem->hSvetlo = hSvetlo; return k; } void am_Do_CandleSparks(LEVELINFO * p_Level) { int i; float f; PAR_KOUR_STOPA *pCastice; CANDLE_EFFECT *pSystem; for (i = 0; i < 6; i++) { if (p_Level->CandleEffect[i].pSystem) { pCastice = par_cti_hnizdo_castice(p_Level->CandleEffect[i].hHnizdo); pSystem = &p_Level->CandleEffect[i]; // test na velikost castic. Pokud je moc mala, tak pric s ni if (pCastice) { while (pCastice) { if (pCastice->rychlost_x < 0.001f || pCastice->rychlost_y < 0.001f) pCastice->a = 0; pCastice = pCastice->p_next; } } memcpy((void *) &pSystem->pivot, (void *) &pSystem->pos, 3 * sizeof(float)); pSystem->pivot.x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; pSystem->pivot.y = pSystem->pos[1]; pSystem->pivot.z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; //norm_vect_2D(&pSystem->pivot.x, &pSystem->pivot.y); f = (randf() / (float) (RAND_MAX)) * 2; if (f < 1) f = 1; par_vloz_hnizdo_scale(pSystem->hHnizdo, f, f, -2.0f, -2.0f); pSystem->dir.y = (randf() / (float) (RAND_MAX)) * 2; } } } int am_Get_Free_SmokeSystem(LEVELINFO * p_Level) { int i; for (i = 0; i < 6; i++) { if (!p_Level->CandleSmoke[i].pSystem) return i; } return -1; } int am_Create_CandleSmokeSystem(float *pos, LEVELINFO * p_Level) { int m, k; PAR_KOUR_STOPA *pKourovaS; CANDLE_EFFECT *pSystem; k = am_Get_Free_CandleSystem(p_Level); if (k == -1) return -1; pSystem = &p_Level->CandleSmoke[k]; pKourovaS = (PAR_KOUR_STOPA *) malloc(300 * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return -1; pSystem->pCastice = pKourovaS; pSystem->csize = 300; m = kom_najdi_material("mrak1_1"); if (m == -1) kprintf(1, "Nelze najit material mrak1_1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 10.0f; pKourovaS[0].utlum_x = 1; pKourovaS[0].utlum_y = 1; pKourovaS[0].r = 0.75f; pKourovaS[0].g = 0.75f; pKourovaS[0].b = 0.75f; pKourovaS[0].a = 0.5f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = 0; pKourovaS[0].da = -0.1f; pKourovaS[0].ka = 0; pSystem->pSystem = par_vyrob(); par_set_param(pSystem->pSystem, m, TPAR_NO_FOG | TPAR_YPLANE_TOP | TPAR_DIR | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(pSystem->pSystem, pKourovaS, pSystem->csize); pSystem->hHnizdo = par_vloz_hnizdo(pSystem->pSystem); par_vloz_hnizdo_komplet(pSystem->hHnizdo, 10, &pSystem->pivot, pKourovaS); par_vloz_hnizdo_timer(pSystem->hHnizdo, 10, -10); memcpy((void *) &pSystem->pivot, (void *) pos, 3 * sizeof(float)); memcpy((void *) &pSystem->pos, (void *) pos, 3 * sizeof(float)); pSystem->dir.x = 0; pSystem->dir.y = (randf() / (float) (RAND_MAX)) * 1; pSystem->dir.z = 0; par_vloz_hnizdo_y_plane(pSystem->hHnizdo, pos[1] + 10); par_vloz_hnizdo_dir(pSystem->hHnizdo, &pSystem->dir); par_pripoj_funkci(pSystem->pSystem, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(pSystem->pSystem, &pSystem->flag, 0, 0); return k; } void am_Do_CandleSmoke(LEVELINFO * p_Level) { int i; float f; CANDLE_EFFECT *pSystem; for (i = 0; i < 6; i++) { if (p_Level->CandleSmoke[i].pSystem) { pSystem = &p_Level->CandleSmoke[i]; memcpy((void *) &pSystem->pivot, (void *) &pSystem->pos, 3 * sizeof(float)); pSystem->pivot.x += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; pSystem->pivot.y = pSystem->pos[1]; pSystem->pivot.z += ((rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX)) * 0.25f; //norm_vect_2D(&pSystem->pivot.x, &pSystem->pivot.y); f = (randf() / (float) (RAND_MAX)) * 0.01f; par_vloz_hnizdo_scale(pSystem->hHnizdo, f, f, 1.0f, 1.0f); pSystem->dir.y = (randf() / (float) (RAND_MAX)) * 2; } } } void am_Start_Voda_Kanal(void) { BOD p(0, 0, 0); MeshHandle mh; VodnikHandle voh; VodaHandle vh = vod_vyrob(5); mh = kom_pridej_mesh_do_levelu("voda.b2m_Voda1"); vod_pridej_mesh(vh, mh); mh = kom_pridej_mesh_do_levelu("voda.b2m_Voda2"); vod_pridej_mesh(vh, mh); mh = kom_pridej_mesh_do_levelu("voda.b2m_Voda3"); vod_pridej_mesh(vh, mh); mh = kom_pridej_mesh_do_levelu("voda.b2m_Voda4"); vod_pridej_mesh(vh, mh); mh = kom_pridej_mesh_do_levelu("voda.b2m_Voda5"); vod_pridej_mesh(vh, mh); vod_uzavri_meshe(vh); voh = vod_vloz_vodnika(vh, &p, VOD_AKTIVNI | VOD_Z_PLANE | VOD_DIFF_ADD | VOD_SPEC_ADD, 1, 50, 1, 0, 0, 200); vod_vloz_vodnika_spec(voh, 0.1f, 0.1f, 0.1f); vod_vloz_vodnika_add_spec(voh, 0, 0, 0); vod_vloz_vodnika_diff(voh, 0.05f, 0.05f, 0.05f, 0.125f); vod_vloz_vodnika_add_diff(voh, 0, 0, 0, 0); p.x = 100; p.z = 100; voh = vod_vloz_vodnika(vh, &p, VOD_AKTIVNI | VOD_X_PLANE | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.5f, 50, 1, 0, 0, 200); voh = vod_vloz_vodnika(vh, &p, VOD_AKTIVNI | VOD_BOD | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.25f, 50, 1, 0, 0, 200); } void am_Create_Item_Lights(LEVELINFO * p_Level) { float pos[3]; int i, hSvetlo, rot; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 13) { hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); if (hSvetlo != -1) { kom_mesh_get_float(p_Level->Level[i]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); sdl_svetlo_set_pos(hSvetlo, (BOD *) pos); sdl_svetlo_set_diff(hSvetlo, 1.0f, 1.0f, 0.75f, 0, 0, 0); sdl_anim_vyrob(hSvetlo, 40, 0, 0, 4); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 1, 0, 1, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 1.5f, 0, 1.5f, 9); sdl_anim_vloz_klic_vzdal(hSvetlo, 2, 2, 0, 2, 19); sdl_anim_vloz_klic_vzdal(hSvetlo, 3, 1, 0, 1, 29); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, GK_LOOP, 0, 0); } p_Level->Level[i]->hSvetlo = hSvetlo; } } void am_Start_Voda_Akvarko(void) { BOD p(0, 0, 0); MeshHandle mh; VodnikHandle voh; VodaHandle vh = vod_vyrob(1); mh = kom_pridej_mesh_do_levelu("akvarko_voda.b2m"); vod_pridej_mesh(vh, mh); vod_uzavri_meshe(vh); voh = vod_vloz_vodnika(vh, &p, VOD_AKTIVNI | VOD_Z_PLANE | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.1f, 50, 1, 0, 0, 200); vod_vloz_vodnika_spec(voh, 0.1f, 0.1f, 0.1f); vod_vloz_vodnika_add_spec(voh, 0, 0, 0); vod_vloz_vodnika_diff(voh, 0.05f, 0.05f, 0.05f, 0.125f); vod_vloz_vodnika_add_diff(voh, 0, 0, 0, 0); p.x = 100; p.z = 100; voh = vod_vloz_vodnika(vh, &p, VOD_AKTIVNI | VOD_X_PLANE | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.1f, 50, 1, 0, 0, 200); voh = vod_vloz_vodnika(vh, &p, VOD_AKTIVNI | VOD_BOD | VOD_DIFF_ADD | VOD_SPEC_ADD, 0.1f, 50, 1, 0, 0, 200); } berusky2-0.12/src/kofola/game_logic.h0000644000175000017500000000324713674426075014450 00000000000000#ifndef __GAMA_LOGIC_ #define __GAMA_LOGIC_ #include "3d_all.h" #include "Object.h" // spusti level int gl_Run_Level(char *p_Level_Name, char *p_Env_Name, AUDIO_DATA * p_ad, int iCPU); // set_ frame rate void gl_Set_Frame_Rate(void); int gl_Throw_off(int *column, LEVELINFO * p_Level); int gl_Throw_offAnim(int *column, LEVELINFO * p_Level); void gl_Destroy_Item(long Item, int Type, LEVELINFO * p_Level); void gl_Real2Logical(int Real_Pos, int *Log_Pos, LEVELINFO * p_Level); void gl_Logical2Real(int x, int y, int z, int *Real_Pos, LEVELINFO * p_Level); void gl_Next_Queue_Set(LEVELINFO * p_Level); void gl_Change_Destonation(LEVELINFO * p_Level, int *pos); void gl_i2FStr(int i, char *cStr); void gl_Pripoj_Flek_k_Predmenu(ITEMDESC * pItem, LEVELINFO * p_Level); void gl_Do_Strepiny(float *pos, LEVELINFO * p_Level, int material, char bSvetlo); int gl_Get_Mesh_Material(int Mesh); void gl_Do_Kameni(float *pos, LEVELINFO * p_Level, int material); void gl_Go_Animations(void); int gl_Check_Logic_Dependences(LEVELINFO * p_Level); int gl_Are_Animations_Done(LEVELINFO * p_Level); void gl_Do_Prach(float *pos, LEVELINFO * p_Level); void gl_Do_Teleport_Sparks(float *pos, LEVELINFO * p_Level); int gl_Do_Teleport_Light(float *pos, LEVELINFO * p_Level, int iFlare); int gl_Do_Teleport_Flare(float *pos, LEVELINFO * p_Level); void gl_Do_Lift_Particles(float *pos, int mesh, LEVELINFO * p_Level); int gl_Check_Anim_Pontonky(ITEMDESC * pItem, LEVELINFO * p_Level); void gl_Do_Krompac(float *pos, LEVELINFO * p_Level, int material); char gl_Check_Mesh_Sim(int iMesh); void gl_Logical2Real(int x, int y, int z, int *Real_Pos, LEVELINFO * p_Level); int gl_Screen_Shot(int i); #endif berusky2-0.12/src/kofola/2D_graphic.h0000644000175000017500000000072613674426075014323 00000000000000#ifndef __2D_GRAPHIC_ #define __2D_GRAPHIC_ typedef struct { RECT rect; int iLayer; char bUsed; } DRAW_RECT; #define DRAW_RECT_NUM 40 typedef struct { DRAW_RECT rect[DRAW_RECT_NUM]; int rlast; } RECT_LINE; void _2d_Add_RectItem(RECT_LINE * p_rl, RECT rect, int iLayer); void _2d_Add_RectItem_IfNPresent(RECT_LINE * p_rl, RECT rect, int iLayer); int _2d_Is_InRectLine(RECT * rline, RECT * p_r, int size); void _2d_Clear_RectLine(RECT_LINE * p_rl); #endif berusky2-0.12/src/kofola/game_logic.cpp0000644000175000017500000131310213674430176014773 00000000000000//------------------------------------------------------------------------------------------------ // version 1.0.0 //------------------------------------------------------------------------------------------------ #include #include #include #include "3d_all.h" #include "Object.h" #include "init.h" #include "load_level.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "Berusky3d_kamery.h" #include "animationk.h" #include "ambient_sounds.h" #include "3D_menus.h" #include "Demo.h" #include "Dda.h" #include "Bind.h" #include "animend_functions.h" #include "3D_graphic.h" #include "2D_graphic.h" #include "trigers.h" #include "water.h" #include "font.h" #include "game_init.h" #include "Tools.h" #include "Menu2.h" #include "adas.h" #include "json_export.h" #include "Setup.h" extern HINT_STATE sHint; extern KUK_STATE sKuk; extern _3D_CURSOR _3dCur; extern int iActualScene; extern int iActualLevel; extern char cFontDir[5][64]; extern HINT_STATE sHint; extern HINT_TEXTURE pHintTexture[26]; #define NEXTDEMOFRAMETIMERID 10001 #define randf() ((float)rand()) extern char pGDataDir[MAX_FILENAME]; typedef struct { int mesh; int c_anim; int *p_flag; int flag; int start; int stop; } _3DSANIM; typedef struct { int TopMesh; int LowMesh; } PMESH; typedef struct { SIM_ANIMATION animation[32]; int last; PMESH PrivazanyMesh[32]; // privazane meshe int pMesh; // uikazatel posledniho privazaneho meshe _3DSANIM _3dsAnim[6]; // 3ds animace; char bSetMesh; // ma se zmenit mesh? int iMeshID; // id meshe int iMesh; // mesh int iRot; // rotace } ANIMATION_QUEUE_SET; char bSet_Frame_Rate; ANIMATION_MODULE am; AUDIO_DATA ad; DEMOSTRUCTURE Demo; ANIMATION_QUEUE_SET queue_set[3]; ANIMATION_QUEUE_SET *p_set = NULL; ANIMATION_QUEUE_SET *p_set_anim = NULL; int cam_flag; extern char CurrentWorkingDirectory[MAX_FILENAME]; int CamRotationFlag; int cameraflag; int PRCameraFlag; //indikator, ze je pozno pohybovat kamerou pomoci P&R int PRCameraFlagChange; // byl pozit pohyb pomoci P&R LEVELINFO Level; CONTROL_KEYS control; static char demo = 0; // 1 = real play, 2= fast play, 0 = record extern int Xresolution; extern int Yresolution; extern B2_FONT b2_3d_font; int gl_Do_Lift(int Lift, int *pos, LEVELINFO * p_Level); int gl_Gate_Keeper(int Door, int *Item, LEVELINFO * p_Level); int gl_Count_Weight(int *column, LEVELINFO * p_Level); void gl_Destroy_Item(long Item, int Type, LEVELINFO * p_Level); int gl_Are_Animations_Done(LEVELINFO * p_Level); void gl_Hrebik(ITEMDESC * pItem); void gl_Go_Animations(void); int gl_Find_Bottom(int *p_Pos, int *bVoda, LEVELINFO * p_Level); int gl_Is_There_Beatle(int *iPos, ITEMDESC ** pItem, LEVELINFO * p_Level); int gl_Will_Go_Under_Water(int *iPos, int DontCountPos, int Plus, int *pVaha, LEVELINFO * p_Level); int gl_Can_Go_Into_Water(ITEMDESC * pItem); int gl_Check_Detonation_Pack_Water_Rules(int *iPos, LEVELINFO * p_Level); int gl_Test_Rule1(ITEMDESC * pItem, ITEMDESC * pTestItem, LEVELINFO * p_Level); void gl_Logical2Real(int x, int y, int z, int *Real_Pos, LEVELINFO * p_Level); int gl_Test_Rule2(int *pos, LEVELINFO * p_Level); int gl_Test_Rule1B(ITEMDESC * pItem, int *pTestPos, LEVELINFO * p_Level); int gl_Is_Included_In(SIM_ANIMATION * p_animation, int mesh); void gl_Add_Mesh(SIM_ANIMATION * p_animation, int mesh); int gl_Include_Coincidence(SIM_ANIMATION * p_anim1, SIM_ANIMATION * p_anim2); SIM_ANIMATION *gl_Is_Included_In_AnimSet(ANIMATION_QUEUE_SET * p_aset, int mesh); int gl_Is_There_Water(int *from, int *to, LEVELINFO * p_Level); char MenuCheckBossExit(void); char MenuCheckSuccessExit(void); void gl_Kofola_End(int InMenu); int gl_Get_Active_Beetle_Mesh(void) { if (Level.Actual_Item != -1) return Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; return -1; } void gl_Get_PR_ScanCode(int *pPScan, int *pRScan) { if (pPScan) *pPScan = control.camera_move; if (pRScan) *pRScan = control.camera_rotation; } int gl_Chech_Wall(int *Pos, LEVELINFO * p_Level) { int real; gl_Logical2Real(Pos[0], Pos[1], Pos[2], &real, p_Level); if (Pos[2] < 1 || Pos[2] > p_Level->Size[2] - 1 || Pos[1] < 0 || Pos[1] > p_Level->Size[1] - 1 || Pos[0] < 0 || Pos[0] > p_Level->Size[0] - 1) return 0; if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 2) return 1; else return 0; else return 0; } void gl_Sand_Fill(int *Pos, int IncomingSide, int bUnderWater, LEVELINFO * p_Level) { int real, ireal; int iPos[3]; memcpy((void *) iPos, (void *) Pos, 3 * sizeof(int)); //jestlize jsem se dostal mimo level, tak konec if (iPos[2] < 1 || iPos[2] > p_Level->Size[2] - 1 || iPos[1] < 0 || iPos[1] > p_Level->Size[1] - 1 || iPos[0] < 0 || iPos[0] > p_Level->Size[0] - 1) return; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); //jestlize tento prvek byl jiz nastaven, tak konec if (p_Level->Square[real].bUnderWater != -1) return; //jestlize se jedna o vertikalni pohyb, tak pouze okopiriruj flag if (IncomingSide > 1) p_Level->Square[real].bUnderWater = bUnderWater; else if (!IncomingSide) { iPos[2]--; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &ireal, p_Level); //pohyb smeren navrch a prosel vodou if (p_Level->Level[ireal]) if (p_Level->Level[ireal]->p_Object->Class == 12) p_Level->Square[real].bUnderWater = 0; else p_Level->Square[real].bUnderWater = bUnderWater; else p_Level->Square[real].bUnderWater = bUnderWater; iPos[2]++; } else if (IncomingSide == 1) { iPos[2]++; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &ireal, p_Level); //pohyb smeren dolu a prosel vodou if (iPos[2] < p_Level->Size[2]) if (p_Level->Level[ireal]) if (p_Level->Level[ireal]->p_Object->Class == 12) p_Level->Square[real].bUnderWater = 1; else p_Level->Square[real].bUnderWater = bUnderWater; else p_Level->Square[real].bUnderWater = bUnderWater; else p_Level->Square[real].bUnderWater = bUnderWater; iPos[2]--; } //jestli jsem u zdi, tak konec if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 2) return; //postup vsemi smery iPos[0]++; gl_Sand_Fill(iPos, 2, p_Level->Square[real].bUnderWater, p_Level); iPos[0] -= 2; gl_Sand_Fill(iPos, 3, p_Level->Square[real].bUnderWater, p_Level); iPos[0]++; iPos[1]++; gl_Sand_Fill(iPos, 4, p_Level->Square[real].bUnderWater, p_Level); iPos[1] -= 2; gl_Sand_Fill(iPos, 5, p_Level->Square[real].bUnderWater, p_Level); iPos[1]++; iPos[2] += 2; gl_Sand_Fill(iPos, 0, p_Level->Square[real].bUnderWater, p_Level); iPos[2] -= 4; gl_Sand_Fill(iPos, 1, p_Level->Square[real].bUnderWater, p_Level); } void gl_Set_Water_Marks(LEVELINFO * p_Level) { int pos[3] = { 0, 0, p_Level->Size[2] - 1 }; gl_Sand_Fill(pos, 2, 0, p_Level); } //------------------------------------------------------------------------------------------------ // randomly choose wave index to play (depends on object class) //------------------------------------------------------------------------------------------------ int gl_Choose_Wave_Index(int Plus) { int index; index = rand() % 3; index += Plus; return index; } //------------------------------------------------------------------------------------------------ // next queue set //------------------------------------------------------------------------------------------------ void gl_Next_Queue_Set(LEVELINFO * p_Level) { p_Level->Actual_Qset++; if (p_Level->Actual_Qset > 2) p_Level->Actual_Qset = 0; p_set = &queue_set[p_Level->Actual_Qset]; } void gl_Next_Anim_Queue_Set(LEVELINFO * p_Level) { p_Level->Actual_Anim_Qset++; if (p_Level->Actual_Anim_Qset > 2) p_Level->Actual_Anim_Qset = 0; p_set_anim = &queue_set[p_Level->Actual_Anim_Qset]; } ANIMATION_QUEUE_SET *gl_Get_Prev_Queue_Set(LEVELINFO * p_Level) { int set = p_Level->Actual_Qset - 1; if (set < 0) set = 2; return &queue_set[set]; } ANIMATION_QUEUE_SET *gl_Get_Prev_Queue_SetA(int dec, LEVELINFO * p_Level) { int set = p_Level->Actual_Qset - dec; if (set < 0) set = 3 + set; return &queue_set[set]; } int gl_Multi_Animation(ANIMATION_QUEUE_SET * p_aset, SIM_ANIMATION * p_animation) { int i, c = 0, j; for (i = 0; i < p_aset->last; i++) for (j = 0; j < 8; j++) if (gl_Is_Included_In(&p_aset->animation[i], p_animation->mesh[j]) && p_animation->mesh[j] != -1 && p_animation->p_run != p_aset->animation[i].p_run) c++; return c; } int gl_Animation_Colision(ANIMATION_QUEUE_SET * p_aset, SIM_ANIMATION * p_animation) { int i; SIM_ANIMATION *p_anim, *p_lanim = NULL; for (i = 0; i < 8; i++) { p_anim = gl_Is_Included_In_AnimSet(p_aset, p_animation->mesh[i]); if (p_anim) { if (p_lanim && p_lanim != p_anim) return 1; p_lanim = p_anim; } } return 0; } SIM_ANIMATION *gl_Find_Lowest_Animation(ANIMATION_QUEUE_SET * p_aset) { SIM_ANIMATION *p_anim = NULL; int i, min = 101; for (i = 0; i < p_aset->last; i++) if ((p_aset->animation[i].flag > -1) && (p_aset->animation[i].flag < min)) { min = p_aset->animation[i].flag; p_anim = &p_aset->animation[i]; } return p_anim; } int gl_Check_Connection_Collision(SIM_ANIMATION * p_prev_anim, ANIMATION_QUEUE_SET * p_a_set, SIM_ANIMATION * p_anim) { SIM_ANIMATION *p_tanim; int i, c = 0; for (i = 0; i < 8; i++) if (p_prev_anim->mesh[i] == -1) return c; else { p_tanim = gl_Is_Included_In_AnimSet(p_a_set, p_prev_anim->mesh[i]); if (p_tanim) if (p_tanim->bconnected) c++; } return c; } void gl_Connect_Animations(LEVELINFO * p_Level) { int i, j; ANIMATION_QUEUE_SET *p_prev_set = gl_Get_Prev_Queue_Set(p_Level); if (!p_prev_set->last) return; for (i = 0; i < p_set->last; i++) for (j = p_prev_set->last - 1; j >= 0; j--) if (gl_Include_Coincidence(&p_set->animation[i], &p_prev_set->animation[j]) && p_prev_set->animation[j].p_run && p_set->animation[i].p_run) { if (gl_Animation_Colision(p_prev_set, &p_set->animation[i])) break; else if (gl_Multi_Animation(p_set, &p_set->animation[i])) { if (!p_set->animation[i].bnext && !gl_Check_Connection_Collision(&p_prev_set->animation[j], p_set, &p_set->animation[i])) { p_set->animation[i].bconnected = 1; rani_next_animace(p_prev_set->animation[j].p_run, p_set->animation[i].p_run, 0, 0, 0); break; } } else if (!gl_Check_Connection_Collision(&p_prev_set->animation[j], p_set, &p_set->animation[i])) { p_set->animation[i].bconnected = 1; rani_next_animace(p_prev_set->animation[j].p_run, p_set->animation[i].p_run, 0, 0, 0); break; } } } //------------------------------------------------------------------------------------------------ // transtales real position to logical position //------------------------------------------------------------------------------------------------ void gl_Logical2Real(int x, int y, int z, int *Real_Pos, LEVELINFO * p_Level) { *Real_Pos = x + y * p_Level->Size[0] + z * p_Level->Size[0] * p_Level->Size[1]; } //------------------------------------------------------------------------------------------------ // transtales real position to logical position //------------------------------------------------------------------------------------------------ void gl_Logical2Real2D(int x, int y, int *Real_Pos, LEVELINFO * p_Level) { *Real_Pos = x + y * p_Level->Size[0]; } //------------------------------------------------------------------------------------------------ // transtales real position to logical position //------------------------------------------------------------------------------------------------ void gl_Real2Logical(int Real_Pos, int *Log_Pos, LEVELINFO * p_Level) { int c; Log_Pos[2] = (int) floor(Real_Pos / (p_Level->Size[0] * p_Level->Size[1])); c = Real_Pos % (p_Level->Size[0] * p_Level->Size[1]); Log_Pos[1] = (int) floor(c / p_Level->Size[0]); c = c % p_Level->Size[0]; Log_Pos[0] = c; } void gl_fPos2iPos(float *fPos, int *iPos) { iPos[0] = ftoi(fPos[0]); iPos[1] = ftoi(fPos[1]); iPos[2] = ftoi(fPos[2]); } //------------------------------------------------------------------------------------------------ // finds next beatle //------------------------------------------------------------------------------------------------ long gl_Find_Next_Beatle(long pos, LEVELINFO * p_Level) { long i; int counter = 0; if ((p_Level->Beetle_Index + 1) > 5) p_Level->Beetle_Index = 0; else p_Level->Beetle_Index++; while (p_Level->Beetle[(int)p_Level->Beetle_Index] == -1) { if ((p_Level->Beetle_Index + 1) > 5) p_Level->Beetle_Index = 0; else p_Level->Beetle_Index++; counter++; if (counter > 6) return -1; } for (i = pos + 1; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if ((p_Level->Level[i]->p_Object->Class == 1) && (p_Level->Level[i]->p_Object->SubClass == p_Level->Beetle[(int)p_Level->Beetle_Index])) return i; for (i = 0; i < (pos + 1); i++) if (p_Level->Level[i]) if ((p_Level->Level[i]->p_Object->Class == 1) && (p_Level->Level[i]->p_Object->SubClass == p_Level->Beetle[(int)p_Level->Beetle_Index])) return i; return -1; } //------------------------------------------------------------------------------------------------ // finds beatle //------------------------------------------------------------------------------------------------ long gl_Select_Beatle(int Beatle, LEVELINFO * p_Level) { long i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if ((p_Level->Level[i]->p_Object->Class == 1) && (p_Level->Level[i]->p_Object->SubClass == p_Level->Beetle[Beatle])) return i; return -1; } //------------------------------------------------------------------------------------------------ // spociva posuny po osach v ctvercich //------------------------------------------------------------------------------------------------ void gl_Get_Move(int *iValue_old, int *iValue_new, int *iMove) { int i; for (i = 0; i < 3; i++) { iMove[i] = iValue_new[i] - iValue_old[i]; } iMove[2] >>= 1; } int gl_Get_Free_Flare(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->Flare[i].pFlare) return i; return -1; } int gl_Do_Teleport_Flare(float *pos, LEVELINFO * p_Level) { int f, m, i; float rr, rg, rb, ra, dx, dy; LENS_FLARE *pFlare; LENS_FLARE_SLOZ *pSFlare; f = gl_Get_Free_Flare(p_Level); if (f == -1) return -1; //udelej flare rr = 0.54f; rg = 0.83f; rb = 1.0f; ra = 1; dy = dx = 0; m = kom_najdi_material("flare4"); if (m == -1) kprintf(1, "Nelze najit material flare4"); FlareHandle flare = kom_flare_vyrob(FLR_NO_ZTEST); kom_flare_set_param(flare, rr, rg, rb, ra, dy, dx, m, GL_ONE); kom_flare_set_pos(flare, (BOD *) pos); pFlare = kom_flare_get_pointer(flare); p_Level->Flare[f].pFlare = flare; p_Level->Flare[f].mSpeed = 2.0f; pSFlare = (LENS_FLARE_SLOZ *) malloc(14 * sizeof(LENS_FLARE_SLOZ)); pFlare->p_sloz = pSFlare; if (!pSFlare) { kprintf(1, "Nealokovala se pamet pro LENS_FLARE_SLOZ!\n"); return -1; } for (i = 0; i < 14; i++) pSFlare[i].vzdal = 0; pSFlare[0].vzdal = 0.001f; pSFlare[0].r = 0.97f; pSFlare[0].g = 0.57f; pSFlare[0].b = 0.5f; pSFlare[0].a = 0.15f; pSFlare[0].material = kom_najdi_material("flare1"); pSFlare[0].dx = 0; pSFlare[0].dy = 0; pSFlare[0].p_mat = kom_preloz_material(pSFlare[0].material); p_Level->Flare[f].Speed[0] = 2.0f; if (pSFlare[0].material == -1) kprintf(1, "Nelze najit material flare1"); pSFlare[1].vzdal = 0.2f; pSFlare[1].r = 0.33f; pSFlare[1].g = 0.5f; pSFlare[1].b = 0.98f; pSFlare[1].a = 0.15f; pSFlare[1].material = kom_najdi_material("flare6"); pSFlare[1].dx = 0; pSFlare[1].dy = 0; pSFlare[1].p_mat = kom_preloz_material(pSFlare[1].material); p_Level->Flare[f].Speed[1] = 0.15f; if (pSFlare[1].material == -1) kprintf(1, "Nelze najit material flare6"); pSFlare[2].vzdal = 0.4f; pSFlare[2].r = 0.03f; pSFlare[2].g = 0.83f; pSFlare[2].b = 0.03f; pSFlare[2].a = 0.5f; pSFlare[2].material = kom_najdi_material("flare5"); pSFlare[2].dx = 0; pSFlare[2].dy = 0; pSFlare[2].p_mat = kom_preloz_material(pSFlare[2].material); p_Level->Flare[f].Speed[2] = 0.05f; if (pSFlare[2].material == -1) kprintf(1, "Nelze najit material flare5"); pSFlare[3].vzdal = 0.5f; pSFlare[3].r = 0.73f; pSFlare[3].g = 0.09f; pSFlare[3].b = 0.03f; pSFlare[3].a = 0.4f; pSFlare[3].material = kom_najdi_material("flare5"); pSFlare[3].dx = 0; pSFlare[3].dy = 0; pSFlare[3].p_mat = kom_preloz_material(pSFlare[3].material); p_Level->Flare[f].Speed[3] = 0.05f; if (pSFlare[3].material == -1) kprintf(1, "Nelze najit material flare5"); pSFlare[4].vzdal = 0.52f; pSFlare[4].r = 0.25f; pSFlare[4].g = 0.72f; pSFlare[4].b = 0.05f; pSFlare[4].a = 0.20f; pSFlare[4].material = kom_najdi_material("flare2"); pSFlare[4].dx = 0; pSFlare[4].dy = 0; pSFlare[4].p_mat = kom_preloz_material(pSFlare[4].material); p_Level->Flare[f].Speed[4] = 0.2f; if (pSFlare[4].material == -1) kprintf(1, "Nelze najit material flare2"); pSFlare[5].vzdal = 0.54f; pSFlare[5].r = 1; pSFlare[5].g = 1; pSFlare[5].b = 1; pSFlare[5].a = 0.3f; pSFlare[5].material = kom_najdi_material("flare5"); pSFlare[5].dx = 0; pSFlare[5].dy = 0; pSFlare[5].p_mat = kom_preloz_material(pSFlare[5].material); p_Level->Flare[f].Speed[5] = 0.03f; if (pSFlare[5].material == -1) kprintf(1, "Nelze najit material flare5"); pSFlare[6].vzdal = 0.59f; pSFlare[6].r = 0.64f; pSFlare[6].g = 0.64f; pSFlare[6].b = 0.05f; pSFlare[6].a = 0.15f; pSFlare[6].material = kom_najdi_material("flare6"); pSFlare[6].dx = 0; pSFlare[6].dy = 0; pSFlare[6].p_mat = kom_preloz_material(pSFlare[6].material); p_Level->Flare[f].Speed[6] = 0.13f; if (pSFlare[6].material == -1) kprintf(1, "Nelze najit material flare6"); pSFlare[7].vzdal = 0.69f; pSFlare[7].r = 0.03f; pSFlare[7].g = 0.44f; pSFlare[7].b = 0.66f; pSFlare[7].a = 0.20f; pSFlare[7].material = kom_najdi_material("flare2"); pSFlare[7].dx = 0; pSFlare[7].dy = 0; pSFlare[7].p_mat = kom_preloz_material(pSFlare[7].material); p_Level->Flare[f].Speed[7] = 0.35f; if (pSFlare[7].material == -1) kprintf(1, "Nelze najit material flare2"); pSFlare[8].vzdal = 0.8f; pSFlare[8].r = 0.78f; pSFlare[8].g = 0.97f; pSFlare[8].b = 0.99f; pSFlare[8].a = 0.05f; pSFlare[8].material = kom_najdi_material("flare1"); pSFlare[8].dx = 1; pSFlare[8].dy = 1; pSFlare[8].p_mat = kom_preloz_material(pSFlare[8].material); p_Level->Flare[f].Speed[8] = 1.0f; if (pSFlare[8].material == -1) kprintf(1, "Nelze najit material flare1"); p_Level->Flare[f].dwStart = timeGetTime(); return f; } int gl_Do_Teleport_Light(float *pos, LEVELINFO * p_Level, int iFlare) { int hSvetlo; int hEXSvetlo; float rr, rb, rg; if (!p_Level->Sub_Svetla) { rr = 1; rb = 1; rg = 1; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); sdl_svetlo_set_pos(hSvetlo, (BOD *) pos); sdl_svetlo_set_diff(hSvetlo, rr, rg, rb, 0, 0, 0); sdl_anim_vyrob(hSvetlo, 20, 0, 0, 3); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 0, 0, 0, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 10, 0, 10, 10); sdl_anim_vloz_klic_vzdal(hSvetlo, 2, 0, 0, 0, 19); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, 0, 0, 0); } else { rr = 0; rg = 0; rb = 0; //hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR | SDL_SUB); hSvetlo = -1; } if (iFlare != -1) { //extra svetlo hEXSvetlo = edl_svetlo_vyrob(EDL_MESH_LIGHT | EDL_PRUHL_LIGHT | EDL_ALFA_SET, 1); if (hEXSvetlo != -1) { p_Level->Flare[iFlare].hEXSvetlo = hEXSvetlo; edl_svetlo_pridej_mesh(hEXSvetlo, p_Level->Flare[iFlare].mesh); edl_svetlo_uzavri_meshe(hEXSvetlo); edl_svetlo_set_pos(hEXSvetlo, (BOD *) pos, (BOD *) pos); edl_svetlo_set_diff(hEXSvetlo, 0); edl_anim_vyrob(hEXSvetlo, 20, 0, 0, 3, 0, 0); edl_anim_vloz_klic_diff(hEXSvetlo, 0, 0, 0); edl_anim_vloz_klic_diff(hEXSvetlo, 1, 1, 10); edl_anim_vloz_klic_diff(hEXSvetlo, 2, 0, 19); edl_anim_start(hEXSvetlo, &p_Level->TrashFlag, 0, 0, 0); } else p_Level->Flare[iFlare].hEXSvetlo = -1; } else hEXSvetlo = -1; return hSvetlo; } int gl_Get_Free_Lift_Particles(LEVELINFO * p_Level) { int i; for (i = 0; i < 10; i++) if (!p_Level->LiftParticles[i].System) return i; return -1; } int gl_Do_Lift_Particles(float *pos, int mesh, LEVELINFO * p_Level) { int k, m, i; PAR_KOUR_STOPA *pKourovaS; int size = ftoi(50 / p_Level->KvalitaCastic); k = gl_Get_Free_Lift_Particles(p_Level); if (k == -1) return (0); pKourovaS = (PAR_KOUR_STOPA *)mmalloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return (0); p_Level->LiftParticles[k].pCastice = pKourovaS; p_Level->LiftParticles[k].Sizeof = size; p_Level->LiftParticles[k].dwStart = timeGetTime(); i = rand() % 2; if (i) m = kom_najdi_material("cvytah1"); else m = kom_najdi_material("cvytah1"); if (m == -1) kprintf(1, "Nelze najit material cvytah1"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 25.0f; pKourovaS[0].utlum_x = 0; pKourovaS[0].utlum_y = 0; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 1.0f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0; pKourovaS[0].ka = 0; p_Level->LiftParticles[k].System = par_vyrob(); par_set_param(p_Level->LiftParticles[k].System, m, TPAR_YPLANE_LOW | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_NO_FOG, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->LiftParticles[k].System, pKourovaS, p_Level->LiftParticles[k].Sizeof); p_Level->LiftParticles[k].hHnizdo[0] = par_vloz_hnizdo(p_Level->LiftParticles[k].System); par_vloz_hnizdo_komplet(p_Level->LiftParticles[k].hHnizdo[0], 100000, (BOD *) p_Level->LiftParticles[k].pivot[0], pKourovaS); par_vloz_hnizdo_timer(p_Level->LiftParticles[k].hHnizdo[0], 100000, 0); memcpy((void *) p_Level->LiftParticles[k].pivot[0], (void *) pos, 3 * sizeof(float)); p_Level->LiftParticles[k].pivot[0][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftParticles[k].pivot[0][1]--; p_Level->LiftParticles[k].pivot[0][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->LiftParticles[k].dir[0][0] = 0; p_Level->LiftParticles[k].dir[0][1] = ((-randf() / (float) (RAND_MAX)) / 10.0f) * _3DKOREKCE; if (p_Level->LiftParticles[k].dir[0][1] > (-0.03f) * _3DKOREKCE) p_Level->LiftParticles[k].dir[0][1] = (-0.03f) * _3DKOREKCE; p_Level->LiftParticles[k].dir[0][2] = 0; par_vloz_hnizdo_dir(p_Level->LiftParticles[k].hHnizdo[0], (BOD *) p_Level->LiftParticles[k].dir[0]); par_vloz_hnizdo_y_plane(p_Level->LiftParticles[k].hHnizdo[0], pos[1]); p_Level->LiftParticles[k].dwStart = timeGetTime(); p_Level->LiftParticles[k].dwTime = 0; par_pripoj_funkci(p_Level->LiftParticles[k].System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); p_Level->LiftParticles[k].hHnizdo[1] = mesh; par_go(p_Level->LiftParticles[k].System, &p_Level->LiftParticles[k].flag, 0, 0); return (0); } int gl_Get_Free_Teleport_Sparks(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->TeleportSparks[i].System) return i; return -1; } void gl_Do_Teleport_Sparks(float *pos, LEVELINFO * p_Level) { int k, m, i; PAR_KOUR_STOPA *pKourovaS; int size = ftoi(60 / p_Level->KvalitaCastic); k = gl_Get_Free_Teleport_Sparks(p_Level); if (k == -1) return; pKourovaS = (PAR_KOUR_STOPA *) mmalloc(size * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; p_Level->TeleportSparks[k].pCastice = pKourovaS; p_Level->TeleportSparks[k].Sizeof = size; p_Level->TeleportSparks[k].dwStart = timeGetTime(); /* i = rand()%3; switch(i) { case 0: m = kom_najdi_material("flare8"); break; case 1: m = kom_najdi_material("flare9"); break; case 2: m = kom_najdi_material("flare10"); break; }*/ m = kom_najdi_material("flare105"); if (m == -1) kprintf(1, "Nelze najit material flare105"); pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 10.0f; pKourovaS[0].utlum_x = -0.5f; pKourovaS[0].utlum_y = -0.5f; pKourovaS[0].r = 0; pKourovaS[0].g = 0.8f; pKourovaS[0].b = 0.97f; pKourovaS[0].a = 1.0f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = 0.0f; pKourovaS[0].ka = 0.0f; p_Level->TeleportSparks[k].System = par_vyrob(); par_set_param(p_Level->TeleportSparks[k].System, m, TPAR_NO_FOG | TPAR_YPLANE_LOW | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->TeleportSparks[k].System, pKourovaS, p_Level->TeleportSparks[k].Sizeof); for (i = 0; i < p_Level->TeleportSparks[k].Sizeof; i++) { p_Level->TeleportSparks[k].hHnizdo[i] = par_vloz_hnizdo(p_Level->TeleportSparks[k].System); par_vloz_hnizdo_komplet(p_Level->TeleportSparks[k].hHnizdo[i], 100000, (BOD *) p_Level->TeleportSparks[k].pivot[i], pKourovaS); par_vloz_hnizdo_timer(p_Level->TeleportSparks[k].hHnizdo[i], 100000, -100000); //pridej nahodnosti pKourovaS[0].rychlost_x = pKourovaS[0].rychlost_y = (randf() / (float) (RAND_MAX)) / 10.0f; //vygeneruj dir p_Level->TeleportSparks[k].dir[i][0] = 0; p_Level->TeleportSparks[k].dir[i][1] = ((-randf() / (float) (RAND_MAX)) / 100.0f) * _3DKOREKCE; p_Level->TeleportSparks[k].dir[i][2] = 0; memcpy((void *) p_Level->TeleportSparks[k].pivot[i], (void *) pos, 3 * sizeof(float)); p_Level->TeleportSparks[k].pivot[i][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->TeleportSparks[k].pivot[i][1] += randf() / (float) (RAND_MAX); p_Level->TeleportSparks[k].pivot[i][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); par_vloz_hnizdo_dir(p_Level->TeleportSparks[k].hHnizdo[i], (BOD *) p_Level->TeleportSparks[k].dir[i]); par_vloz_hnizdo_y_plane(p_Level->TeleportSparks[k].hHnizdo[i], pos[1] - 1.0f); } p_Level->TeleportSparks[k].dwStart = timeGetTime(); p_Level->TeleportSparks[k].dwTime = 0; par_pripoj_funkci(p_Level->TeleportSparks[k].System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(p_Level->TeleportSparks[k].System, &p_Level->TeleportSparks[k].flag, 0, 0); } //------------------------------------------------------------------------------------------------ // teleport item //------------------------------------------------------------------------------------------------ int gl_Teleport_Item(long Teleport, long Item, LEVELINFO * p_Level) { int old_pos[3], test_pos[3]; int new_real, test_real; ANIMATION_QUEUE_SET *p_prev_set; int rot, iConnect = 0; float pos[3]; POINTERSTRUCTURE *pS; if (!p_Level->Level[Item]) return -1; if (!p_Level->Level[Teleport]) return -1; // if (p_Level->Level[p_Level->Level[Teleport]->Connection[0]]) return -1; new_real = p_Level->Level[Teleport]->Connection[0]; gl_Real2Logical(new_real, test_pos, p_Level); test_pos[2]++; gl_Logical2Real(test_pos[0], test_pos[1], test_pos[2], &test_real, p_Level); if (p_Level->Level[test_real]) return -1; //pokud teleportuje berusku bez snorchlu pod vodu, tak nic if (p_Level->Square[test_real].bUnderWater && !gl_Can_Go_Into_Water(p_Level->Level[Item])) return -1; kom_mesh_get_float(p_Level->Level[Teleport]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { pS->p_Level = p_Level; old_pos[0] = p_Level->Level[Item]->Pos[0]; old_pos[1] = p_Level->Level[Item]->Pos[1]; old_pos[2] = p_Level->Level[Item]->Pos[2]; memcpy((void *) pS->viParam1, (void *) old_pos, 3 * sizeof(int)); memcpy((void *) pS->viParam2, (void *) test_pos, 3 * sizeof(int)); } p_prev_set = gl_Get_Prev_Queue_Set(p_Level); if (p_Level->Level[Item]->p_Object->Class == 13 || !p_Level->Flip || !p_prev_set->last) { anmend_TeleportStart(reinterpret_cast(p_Level->Level[Item]), Teleport, reinterpret_cast(pS)); } else { if (gl_Multi_Animation(p_prev_set, &p_prev_set->animation[0])) iConnect = 1; rani_pripoj_funkci(p_prev_set->animation[iConnect].p_run, anmend_Teleport, reinterpret_cast(p_Level->Level[Item]), Teleport, reinterpret_cast(pS)); if (!p_Level->Sikmina_FlagOld) am_Set_Triger_Function(&p_prev_set->animation[iConnect], anmend_TeleportStart, reinterpret_cast(p_Level->Level[Item]), Teleport, reinterpret_cast(pS), 1, 0); else am_Set_Triger_Function(&p_prev_set->animation[iConnect], anmend_TeleportStart, reinterpret_cast(p_Level->Level[Item]), Teleport, reinterpret_cast(pS), 50, 0); if (p_Level->Level[Item]->p_Object->Class == 1 && Item == p_Level->Actual_Item && p_Level->bPosouvatKameru) cameraflag = 0; } p_Level->status = 1; p_Level->bAllow_Key = 0; return test_real; } int gl_Get_Column_Height(int x, int y, int z, LEVELINFO * p_Level) { int h = 1, i; int r; for (i = z; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(x, y, i, &r, p_Level); if (p_Level->Level[r]) break; if (i + 1 >= p_Level->Size[2]) break; gl_Logical2Real(x, y, i + 1, &r, p_Level); if (p_Level->Level[r]) { if (p_Level->Level[r]->p_Object->Class == 2 || p_Level->Level[r]->p_Object->Class == 17 || p_Level->Level[r]->p_Object->Class == 19) break; else h++; } else break; } return h; } int gl_Check_Throw_off_Water(int *column, int z, LEVELINFO * p_Level) { int real; gl_Logical2Real(column[0], column[1], z - 1, &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 12) return 1; return 0; } //------------------------------------------------------------------------------------------------ // setrepava sloupce //------------------------------------------------------------------------------------------------ int gl_Throw_off(int *column, LEVELINFO * p_Level) { int move[100][2]; int real_pos1, real_pos2; int test_pos1, test_pos2; int iValue1[3], iValue2[3], iValue3[3]; //, iValue4[3]; int i, m = 0, test, n; int w; int ret = 0; ITEMDESC *p_test_pos1, *p_test_pos2; int test_column[3]; int counter = 0; int voda = -1, vc = 0; int LastMesh = -1; int vodapos[3]; int VyskaSloupce = 0; int VyskaPadu = 0; int Korekce = 0; int x, y; if ((column[0] < 0) || (column[0] > (p_Level->Size[0] - 1))) return 0; if ((column[1] < 0) || (column[1] > (p_Level->Size[1] - 1))) return 0; for (i = 0; i < p_Level->Size[2]; i++) { gl_Logical2Real(column[0], column[1], i, &real_pos1, p_Level); if (p_Level->Level[real_pos1]) { move[i][0] = i; move[i][1] = i; } else { move[i][0] = -1; move[i][1] = -1; } } for (i = 1; i < p_Level->Size[2]; i += 2) { if (move[i][0] != -1) { gl_Logical2Real(column[0], column[1], i, &test_pos1, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; if (p_test_pos1->p_Object->Class == 2) continue; if (move[i - 1][0] != -1) { gl_Logical2Real(column[0], column[1], i - 1, &test_pos1, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; if (p_test_pos1->p_Object->Class != 12) continue; } for (m = i - 2; m >= 1; m -= 2) { if (i - 2 > 0) { gl_Logical2Real(column[0], column[1], i - 2, &test_pos1, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; if (p_test_pos1) if (p_test_pos1->p_Object->Class != 1 && p_test_pos1->p_Object->Class != 5 && p_test_pos1->p_Object->Class != 6 && p_test_pos1->p_Object->Class != 7 && p_test_pos1->p_Object->Class != 13) break; } if ((move[m][0] != -1) || (move[m + 1][0] != -1)) { gl_Logical2Real(column[0], column[1], i, &test_pos1, p_Level); gl_Logical2Real(column[0], column[1], (m + 1), &test_pos2, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; p_test_pos2 = p_Level->Level[test_pos2]; if (!p_test_pos1 || !p_test_pos2) break; if (p_test_pos2->p_Object->Class == 12) { memcpy((void *) vodapos, (void *) p_test_pos2->Pos, 3 * sizeof(int)); if (p_Level->Level[test_pos1]->p_Object->Class == 5 && p_Level->Level[test_pos1]->p_Object->SubClass == 3) Korekce = 1; else Korekce = 0; if (m + 2 != p_Level->Level[test_pos1]->Pos[2] || !Korekce) { voda = m + 1; VyskaPadu = (move[i][0] - m + 1) / 2; } } else break; if ((p_test_pos1->p_Object->Class != 5) && (p_test_pos2->p_Object->Class == 12)) goto THROW_OFF_PROPAD; else { test_column[0] = column[0]; test_column[1] = column[1]; test_column[2] = i; w = gl_Count_Weight(test_column, p_Level); if ((p_test_pos1->p_Object->Class == 5) && (p_test_pos2->p_Object->Class == 12)) { if ((p_test_pos1->p_Object->SubClass == 3) && (w < 3)) { break; } else { THROW_OFF_PROPAD: test = 0; for (n = m; n >= 0; n -= 2) if (move[n][0] == -1) test++; if (!test) break; } } } } } if (i > 2) { gl_Logical2Real(column[0], column[1], (m + 1), &test_pos2, p_Level); if (p_Level->Level[test_pos2]) if (p_Level->Level[test_pos2]->p_Object->Class == 4 || p_Level->Level[test_pos2]->p_Object->Class == 8) m += 4; else m += 2; else m += 2; move[i][1] = m; if (m == 1 && gl_Check_Throw_off_Water(column, m, p_Level)) { VyskaPadu = (move[i][0] - m + 1) / 2; voda = 0; vodapos[0] = column[0]; vodapos[1] = column[1]; vodapos[2] = voda; } } } if (((move[i][0] - move[i][1]) >= 2) && (move[i][1] > -1)) { gl_Logical2Real(column[0], column[1], move[i][0], &real_pos1, p_Level); gl_Logical2Real(column[0], column[1], move[i][1], &real_pos2, p_Level); p_test_pos1 = p_Level->Level[real_pos1]; p_test_pos2 = p_Level->Level[real_pos2]; if ((p_test_pos1->p_Object->Class != 2) && (p_test_pos1->p_Object->Class != 17) && (p_test_pos1->p_Object->Class != 19)) { if (!p_test_pos2) { int canim = p_set->last; ret = 1; p_Level->Throw_off = 1; VyskaSloupce = gl_Get_Column_Height(column[0], column[1], move[i][0] + 1, p_Level) - Korekce; iValue1[0] = column[0]; iValue1[1] = column[1]; iValue1[2] = move[i][0]; iValue2[0] = column[0]; iValue2[1] = column[1]; iValue2[2] = move[i][1]; gl_Get_Move(iValue1, iValue2, iValue3); if (!vc && voda > -1) { //bedna prosla vodou -> bubl,bubl,.... POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); int r; int percent, percent1; if (pS) { gl_Logical2Real(iValue1[0], iValue1[1], voda, &r, p_Level); vc++; pS->p_Level = p_Level; if (p_test_pos1->p_Object->Class != 13) { pS->iParam = VyskaSloupce; pS->bParam = VyskaPadu; pS->viParam2[0] = 0; pS->viParam2[1] = 0; pS->viParam2[2] = 0; percent = (int) floor((float) ((iValue1[2] - voda - 1) * 100) / (float) abs(iValue3[2] * 2)); if (percent > 99) percent = 95; percent1 = (int) floor((float) (VyskaSloupce * 100) / (float) abs(iValue3[2] * 2)); } else { pS->iParam = 1; pS->bParam = VyskaPadu / 2; pS->viParam2[0] = 1; pS->viParam2[1] = 0; pS->viParam2[2] = 0; x = (int) floor(((iValue1[2] - voda - 1) * 100) / (float) abs(iValue3[2] * 2)); y = (int) floor((((-1 * iValue3[2] * 2) - 1) * 100) / (float) ((-1 * iValue3[2] * 2) + 4)); percent = (x * y) / 100; x = (int) floor((100 / (float) abs(iValue3[2] * 2))); percent1 = (x * y) / 100; } memcpy((void *) pS->viParam1, (void *) vodapos, 3 * sizeof(int)); if (voda > iValue2[2]) if (voda + 1 == iValue1[2]) { am_Set_Triger_Function(&p_set->animation[canim], anmend_Water, 1, r, reinterpret_cast(pS), percent, 0); am_Set_Triger_Function(&p_set->animation[canim], anmend_Cakanec, 1, r, reinterpret_cast(pS), percent + percent1, 1); } else { am_Set_Triger_Function(&p_set->animation[canim], anmend_Water, 0, r, reinterpret_cast(pS), percent, 0); am_Set_Triger_Function(&p_set->animation[canim], anmend_Cakanec, 0, r, reinterpret_cast(pS), percent + percent1, 1); } else am_Set_Triger_Function(&p_set->animation[canim], anmend_Water, 2, r, reinterpret_cast(pS), percent, 0); } } if (p_Level->Level[real_pos1]->p_Object->Class == 13) { if (LastMesh != -1) { p_set->PrivazanyMesh[p_set->pMesh].TopMesh = LastMesh; p_set->PrivazanyMesh[p_set->pMesh].LowMesh = p_Level->Level[real_pos1]->Index_Of_Game_Mesh; p_set->pMesh++; } else { //pada jako prvni -> pada sam int r = rand() % 2; BOD b(1, 1, 1); am_Remove_Animate_item(real_pos1, p_Level); p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(3, 3, 0); sim_vloz_pivot(p_set->animation[p_set->last].p_anim, 0.0f, 1.0f, 0.0f); sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 0, &b, 0, 0); if (r) sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 1, &b, (-1 * iValue3[2]) * 20.0f, (-1 * iValue3[2] * 2) - 1); else sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 1, &b, iValue3[2] * 20.0f, (-1 * iValue3[2] * 2) - 1); sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 2, &b, 0.0f, (-1 * iValue3[2] * 2) + 4); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, 0.0f, (float) (iValue3[2] * 2), 0.0f, (-1 * iValue3[2] * 2) - 1); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 2, 0.0f, (float) (iValue3[2] * 2), 0.0f, (-1 * iValue3[2] * 2) + 4); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, (-1 * iValue3[2]) * 2 + 5, 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[real_pos1]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[real_pos1]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[real_pos1]->Index_Of_Game_Mesh; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Item_Fall, 0, real_pos2, reinterpret_cast(p_Level), floor((float) (((-1 * iValue3[2]) * 2 + 2) * 100) / (float) (((-1 * iValue3[2]) * 2) + 5)), 1); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Item_FallStartAnim, 0, real_pos2, reinterpret_cast(p_Level)); if (!counter && p_Level->Actual_Item != -1) am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Add_Beetle_Animation, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[p_Level->Actual_Item]->Rotation, reinterpret_cast(p_Level), 0); p_set->last++; counter++; } } else { p_set->animation[canim].p_anim = sim_vyrob_animaci(2, 0, 0); sim_vloz_klic_posun(p_set->animation[canim].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[canim].p_anim, 1, 0.0f, (float) (iValue3[2] * 2), 0.0f, (-1 * iValue3[2] * 2) - 1); sim_interpoluj_animaci(p_set->animation[canim].p_anim, (-1 * iValue3[2]) * 2, 0); p_set->animation[canim].p_run = rani_aktivuj_cekej(p_set->animation[canim].p_anim, &p_set->animation[canim].flag); p_set->animation[canim].p_matrix = rani_privaz_mesh(p_set->animation[canim].p_run, p_test_pos1->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[canim], p_test_pos1->Index_Of_Game_Mesh); LastMesh = p_test_pos1->Index_Of_Game_Mesh; //LastMesh = p_set->animation[canim].mesh = p_test_pos1->Index_Of_Game_Mesh; p_set->last++; } if (p_Level->Level[real_pos1]->a_run && p_Level->Level[real_pos1]->p_Object->Class != 13) { //rani_rozvaz(p_Level->Level[real_pos1]->a_run,p_Level->Level[real_pos1]->Index_Of_Game_Mesh); rani_zrus(p_Level->Level[real_pos1]->a_run); p_Level->Level[real_pos1]->a_run = 0; kom_umisti_prvek(p_Level->Level[real_pos1]->Index_Of_Game_Mesh, p_Level->Level[real_pos1]->Pos[0], p_Level->Level[real_pos1]->Pos[2], p_Level->Level[real_pos1]->Pos[1], p_Level->Level[real_pos1]->Rotation); } p_Level->Level[real_pos2] = p_Level->Level[real_pos1]; if (real_pos1 == p_Level->Actual_Item) p_Level->Actual_Item = real_pos2; p_Level->Level[real_pos1] = 0; move[i][0] = -1; move[i][1] = -1; p_test_pos2 = p_Level->Level[real_pos2]; p_test_pos2->Pos[0] = iValue2[0]; p_test_pos2->Pos[1] = iValue2[1]; p_test_pos2->Pos[2] = iValue2[2]; if (!counter && p_Level->Actual_Item != -1) am_Set_Start_Function(&p_set->animation[p_set->last - 1], anmend_Add_Beetle_Animation, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[p_Level->Actual_Item]->Rotation, reinterpret_cast(p_Level), 0); if (!counter && voda < 0) { rani_pripoj_funkci(p_set->animation[canim].p_run, anmend_PadBedny, reinterpret_cast(p_Level), 0, reinterpret_cast(p_test_pos2)); counter++; } /* else if(counter && voda >= 0 && p_set->pMesh) rani_pripoj_funkci(p_set->animation[canim].p_run, anmend_PadBedny, (int)p_Level, 0, p_test_pos2);*/ //presunu column o pad niz, jelikos se setrasa od spodu navrch, tak posledni // column[2] bude nejvissiho prvku p_Level->Column[2] = iValue2[2]; //test na hrebik gl_Logical2Real(iValue2[0], iValue2[1], iValue2[2] - 1, &real_pos1, p_Level); p_test_pos1 = p_Level->Level[real_pos1]; if (p_test_pos1) if (p_test_pos1->p_Object->Class == 16) { if (p_test_pos1->Square.Flek.pFlek) { kom_flek_zrus(p_test_pos1->Square.Flek.pFlek); p_test_pos1->Square.Flek.pFlek = 0; } kom_zrus_prvek(p_test_pos1->Index_Of_Game_Mesh); p_Level->Level[real_pos1] = 0; } real_pos2 = 0; real_pos1 = 0; move[m][0] = 1; move[m][1] = 1; } } } } return ret; } //------------------------------------------------------------------------------------------------ // setrepava sloupce //------------------------------------------------------------------------------------------------ int gl_Throw_offAnim(int *column, LEVELINFO * p_Level) { int move[100][2]; int real_pos1, real_pos2; int test_pos1, test_pos2; int iValue1[3], iValue2[3], iValue3[3]; //, iValue4[3]; int i, m = 0, test, n; int w; int ret = 0; ITEMDESC *p_test_pos1, *p_test_pos2; int test_column[3]; int counter = 0; int voda = -1, vc = 0; int LastMesh = -1; int vodapos[3]; int VyskaSloupce = 0; int VyskaPadu = 0; int Korekce = 0; int x, y; if ((column[0] < 0) || (column[0] > (p_Level->Size[0] - 1))) return 0; if ((column[1] < 0) || (column[1] > (p_Level->Size[1] - 1))) return 0; for (i = 0; i < p_Level->Size[2]; i++) { gl_Logical2Real(column[0], column[1], i, &real_pos1, p_Level); if (p_Level->Level[real_pos1]) { move[i][0] = i; move[i][1] = i; } else { move[i][0] = -1; move[i][1] = -1; } } for (i = 1; i < p_Level->Size[2]; i += 2) { if (move[i][0] != -1) { if (move[i - 1][0] != -1) { gl_Logical2Real(column[0], column[1], i - 1, &test_pos1, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; if (p_test_pos1->p_Object->Class != 12) continue; } for (m = i - 2; m >= 1; m -= 2) { if (i - 2 > 0) { gl_Logical2Real(column[0], column[1], i - 2, &test_pos1, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; if (p_test_pos1) if (p_test_pos1->p_Object->Class != 1 && p_test_pos1->p_Object->Class != 5 && p_test_pos1->p_Object->Class != 6 && p_test_pos1->p_Object->Class != 7 && p_test_pos1->p_Object->Class != 13) break; } if ((move[m][0] != -1) || (move[m + 1][0] != -1)) { gl_Logical2Real(column[0], column[1], i, &test_pos1, p_Level); gl_Logical2Real(column[0], column[1], (m + 1), &test_pos2, p_Level); p_test_pos1 = p_Level->Level[test_pos1]; p_test_pos2 = p_Level->Level[test_pos2]; if (!p_test_pos1 || !p_test_pos2) break; if (p_test_pos2->p_Object->Class == 12) { memcpy((void *) vodapos, (void *) p_test_pos2->Pos, 3 * sizeof(int)); if (p_Level->Level[test_pos1]->p_Object->Class == 5 && p_Level->Level[test_pos1]->p_Object->SubClass == 3) Korekce = 1; else Korekce = 0; if (m + 2 != p_Level->Level[test_pos1]->Pos[2] || !Korekce) { voda = m + 1; VyskaPadu = (move[i][0] - m + 1) / 2; } } else break; if ((p_test_pos1->p_Object->Class != 5) && (p_test_pos2->p_Object->Class == 12)) { goto THROW_OFF_PROPAD; } else { test_column[0] = column[0]; test_column[1] = column[1]; test_column[2] = i; w = gl_Count_Weight(test_column, p_Level); if ((p_test_pos1->p_Object->Class == 5) && (p_test_pos2->p_Object->Class == 12)) { if ((p_test_pos1->p_Object->SubClass == 3) && (w < 3)) { break; } else { THROW_OFF_PROPAD: test = 0; for (n = m; n >= 0; n -= 2) if (move[n][0] == -1) test++; if (!test) break; } } } } } if (i > 2) { gl_Logical2Real(column[0], column[1], (m + 1), &test_pos2, p_Level); if (p_Level->Level[test_pos2]) if (p_Level->Level[test_pos2]->p_Object->Class == 4 || p_Level->Level[test_pos2]->p_Object->Class == 9) m += 4; else m += 2; else m += 2; move[i][1] = m; } } if (((move[i][0] - move[i][1]) >= 2) && (move[i][1] > -1)) { gl_Logical2Real(column[0], column[1], move[i][0], &real_pos1, p_Level); gl_Logical2Real(column[0], column[1], move[i][1], &real_pos2, p_Level); p_test_pos1 = p_Level->Level[real_pos1]; p_test_pos2 = p_Level->Level[real_pos2]; if ((p_test_pos1->p_Object->Class != 2) && (p_test_pos1->p_Object->Class != 17) && (p_test_pos1->p_Object->Class != 19)) { if (!p_test_pos2) { int canim = p_set_anim->last; ret = 1; p_Level->Throw_off = 1; VyskaSloupce = gl_Get_Column_Height(column[0], column[1], move[i][0] + 1, p_Level) - Korekce; iValue1[0] = column[0]; iValue1[1] = column[1]; iValue1[2] = move[i][0]; iValue2[0] = column[0]; iValue2[1] = column[1]; iValue2[2] = move[i][1]; gl_Get_Move(iValue1, iValue2, iValue3); if (!vc && voda > -1) { //bedna prosla vodou -> bubl,bubl,.... POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); int r; int percent, percent1; if (pS) { gl_Logical2Real(iValue1[0], iValue1[1], voda, &r, p_Level); vc++; pS->p_Level = p_Level; if (p_test_pos1->p_Object->Class != 13) { pS->iParam = VyskaSloupce; pS->bParam = VyskaPadu; pS->viParam2[0] = 0; pS->viParam2[1] = 0; pS->viParam2[2] = 0; percent = (int) floor((float) ((iValue1[2] - voda - 1) * 100) / (float) abs(iValue3[2] * 2)); percent1 = (int) floor((float) (VyskaSloupce * 100) / (float) abs(iValue3[2] * 2)); } else { pS->iParam = 1; pS->bParam = VyskaPadu / 2; pS->viParam2[0] = 1; pS->viParam2[1] = 0; pS->viParam2[2] = 0; x = (int) floor(((iValue1[2] - voda - 1) * 100) / (float) abs(iValue3[2] * 2)); y = (int) floor((((-1 * iValue3[2] * 2) - 1) * 100) / (float) ((-1 * iValue3[2] * 2) + 4)); percent = (x * y) / 100; x = (int) floor((100 / (float) abs(iValue3[2] * 2))); percent1 = (x * y) / 100; } memcpy((void *) pS->viParam1, (void *) vodapos, 3 * sizeof(int)); if (voda > iValue2[2]) if (voda + 1 == iValue1[2]) { am_Set_Triger_Function(&p_set_anim->animation[canim], anmend_Water, 1, r, reinterpret_cast(pS), percent, 0); am_Set_Triger_Function(&p_set_anim->animation[canim], anmend_Cakanec, 1, r, reinterpret_cast(pS), percent + percent1, 1); } else { am_Set_Triger_Function(&p_set_anim->animation[canim], anmend_Water, 0, r, reinterpret_cast(pS), percent, 0); am_Set_Triger_Function(&p_set_anim->animation[canim], anmend_Cakanec, 0, r, reinterpret_cast(pS), percent + percent1, 1); } else am_Set_Triger_Function(&p_set_anim->animation[canim], anmend_Water, 2, r, reinterpret_cast(pS), percent, 0); } } if (p_Level->Level[real_pos1]->p_Object->Class == 13) { if (LastMesh != -1) { p_set_anim->PrivazanyMesh[p_set_anim->pMesh].TopMesh = LastMesh; p_set_anim->PrivazanyMesh[p_set_anim->pMesh].LowMesh = p_Level->Level[real_pos1]->Index_Of_Game_Mesh; p_set_anim->pMesh++; } else { //pada jako prvni -> pada sam int r = rand() % 2; BOD b(1, 1, 1); am_Remove_Animate_item(real_pos1, p_Level); p_set_anim->animation[p_set_anim->last].p_anim = sim_vyrob_animaci(3, 3, 0); sim_vloz_pivot(p_set_anim->animation[p_set_anim->last].p_anim, 0.0f, 1.0f, 0.0f); sim_vloz_klic_rotace(p_set_anim->animation[p_set_anim->last]. p_anim, 0, &b, 0, 0); if (r) sim_vloz_klic_rotace(p_set_anim->animation[p_set_anim->last]. p_anim, 1, &b, (-1 * iValue3[2]) * 20.0f, (-1 * iValue3[2] * 2) - 1); else sim_vloz_klic_rotace(p_set_anim->animation[p_set_anim->last]. p_anim, 1, &b, iValue3[2] * 20.0f, (-1 * iValue3[2] * 2) - 1); sim_vloz_klic_rotace(p_set_anim->animation[p_set_anim->last]. p_anim, 2, &b, 0.0f, (-1 * iValue3[2] * 2) + 4); sim_vloz_klic_posun(p_set_anim->animation[p_set_anim->last]. p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set_anim->animation[p_set_anim->last]. p_anim, 1, 0.0f, (float) (iValue3[2] * 2), 0.0f, (-1 * iValue3[2] * 2) - 1); sim_vloz_klic_posun(p_set_anim->animation[p_set_anim->last]. p_anim, 2, 0.0f, (float) (iValue3[2] * 2), 0.0f, (-1 * iValue3[2] * 2) + 4); sim_interpoluj_animaci(p_set_anim->animation[p_set_anim->last]. p_anim, (-1 * iValue3[2]) * 2 + 5, 0); p_set_anim->animation[p_set_anim->last].p_run = rani_aktivuj(p_set_anim->animation[p_set_anim->last].p_anim, &p_set_anim->animation[p_set_anim->last].flag, 0, 0, 0); p_set_anim->animation[p_set_anim->last].p_matrix = rani_privaz_mesh(p_set_anim->animation[p_set_anim->last]. p_run, p_Level->Level[real_pos1]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set_anim->last], p_Level->Level[real_pos1]->Index_Of_Game_Mesh); //p_set_anim->animation[p_set_anim->last].mesh = p_Level->Level[real_pos1]->Index_Of_Game_Mesh; am_Set_Triger_Function(&p_set_anim->animation[p_set_anim->last], anmend_Item_Fall, 0, real_pos2, reinterpret_cast(p_Level), floor((float) (((-1 * iValue3[2]) * 2 + 2) * 100) / (float) (((-1 * iValue3[2]) * 2) + 5)), 1); rani_pripoj_funkci(p_set_anim->animation[p_set_anim->last].p_run, anmend_Item_FallStartAnim, 0, real_pos2, reinterpret_cast(p_Level)); if (!counter && p_Level->Actual_Item != -1) am_Set_Start_Function(&p_set_anim->animation[p_set_anim-> last], anmend_Add_Beetle_Animation, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[p_Level->Actual_Item]->Rotation, reinterpret_cast(p_Level), 0); p_set_anim->last++; counter++; } } else { p_set_anim->animation[canim].p_anim = sim_vyrob_animaci(2, 0, 0); sim_vloz_klic_posun(p_set_anim->animation[canim].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set_anim->animation[canim].p_anim, 1, 0.0f, (float) (iValue3[2] * 2), 0.0f, (-1 * iValue3[2] * 2) - 1); sim_interpoluj_animaci(p_set_anim->animation[canim].p_anim, (-1 * iValue3[2]) * 2, 0); p_set_anim->animation[canim].p_run = rani_aktivuj(p_set_anim->animation[canim].p_anim, &p_set_anim->animation[canim].flag, 0, 0, 0); p_set_anim->animation[canim].p_matrix = rani_privaz_mesh(p_set_anim->animation[canim].p_run, p_test_pos1->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[canim], p_test_pos1->Index_Of_Game_Mesh); //LastMesh = p_set_anim->animation[canim].mesh = p_test_pos1->Index_Of_Game_Mesh; LastMesh = p_test_pos1->Index_Of_Game_Mesh; p_set_anim->last++; } if (p_Level->Level[real_pos1]->a_run && p_Level->Level[real_pos1]->p_Object->Class != 13) { //rani_rozvaz(p_Level->Level[real_pos1]->a_run,p_Level->Level[real_pos1]->Index_Of_Game_Mesh); rani_zrus(p_Level->Level[real_pos1]->a_run); p_Level->Level[real_pos1]->a_run = 0; kom_umisti_prvek(p_Level->Level[real_pos1]->Index_Of_Game_Mesh, p_Level->Level[real_pos1]->Pos[0], p_Level->Level[real_pos1]->Pos[2], p_Level->Level[real_pos1]->Pos[1], p_Level->Level[real_pos1]->Rotation); } p_Level->Level[real_pos2] = p_Level->Level[real_pos1]; if (real_pos1 == p_Level->Actual_Item) p_Level->Actual_Item = real_pos2; p_Level->Level[real_pos1] = 0; move[i][0] = -1; move[i][1] = -1; p_test_pos2 = p_Level->Level[real_pos2]; p_test_pos2->Pos[0] = iValue2[0]; p_test_pos2->Pos[1] = iValue2[1]; p_test_pos2->Pos[2] = iValue2[2]; if (!counter && p_Level->Actual_Item != -1) am_Set_Start_Function(&p_set_anim->animation[p_set_anim->last - 1], anmend_Add_Beetle_Animation, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[p_Level->Actual_Item]->Rotation, reinterpret_cast(p_Level), 0); if (!counter && voda < 0) { rani_pripoj_funkci(p_set_anim->animation[canim].p_run, anmend_PadBedny, reinterpret_cast(p_Level), 0, reinterpret_cast(p_test_pos2)); counter++; } //presunu column o pad niz, jelikos se setrasa od spodu navrch, tak posledni // column[2] bude nejvissiho prvku p_Level->Column[2] = iValue2[2]; //test na hrebik gl_Logical2Real(iValue2[0], iValue2[1], iValue2[2] - 1, &real_pos1, p_Level); p_test_pos1 = p_Level->Level[real_pos1]; if (p_test_pos1) if (p_test_pos1->p_Object->Class == 16) { if (p_test_pos1->Square.Flek.pFlek) { kom_flek_zrus(p_test_pos1->Square.Flek.pFlek); p_test_pos1->Square.Flek.pFlek = 0; } kom_zrus_prvek(p_test_pos1->Index_Of_Game_Mesh); p_Level->Level[real_pos1] = 0; } real_pos2 = 0; real_pos1 = 0; move[m][0] = 1; move[m][1] = 1; } } } } return ret; } //------------------------------------------------------------------------------------------------ // prevede cislo na string fleku //------------------------------------------------------------------------------------------------ void gl_i2FStr(int i, char *cStr) { char text[32]; strcpy(cStr, "flek"); if (i < 10) strcat(cStr, "0"); strcat(cStr, itoa(i, text, 10)); strcat(cStr, "\0"); } void gl_Create_Flek(int *iPos, LEVELINFO * p_Level) { FLEK_K *pFlek; float pos[3]; pFlek = &p_Level->SelectionFlek; pFlek->Flag = K_CHYBA; kom_get_fyz_souradnice(iPos[0], iPos[2], iPos[1], (BOD *) pos); memcpy(pFlek->pos, pos, 3 * sizeof(float)); pFlek->Material = kom_najdi_material("select"); pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = 0; if (pFlek->Material == -1) kprintf(1, "Nelze najit material select"); pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, 2, pFlek->Material); } void gl_TEST(LEVELINFO * p_Level) { int Pos[3], i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Square[i].bUnderWater == 0) { gl_Real2Logical(i, Pos, p_Level); if (Pos[2] & 0x1) gl_Create_Flek(Pos, p_Level); } } void gl_Set_Underwater_Level(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) p_Level->Square[i].bUnderWater = 1; } void gl_Set_Underwater_Level_Snorchl(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Square[i].bUnderWater == 1) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 1) p_Level->Level[i]->p_Back_Pack->item[0] = 1; } void gl_Create_SelectionFlek(ITEMDESC * p_Item, LEVELINFO * p_Level) { FLEK_K *pFlek; float pos[3]; pFlek = &p_Level->SelectionFlek; pFlek->Flag = K_CHYBA; kom_get_fyz_souradnice(p_Item->Pos[0], p_Item->Pos[2], p_Item->Pos[1], (BOD *) pos); memcpy(pFlek->pos, pos, 3 * sizeof(float)); pFlek->Material = kom_najdi_material("select"); pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = 0; if (pFlek->Material == -1) kprintf(1, "Nelze najit material select"); pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, 2, pFlek->Material); kom_prvek_viditelnost(p_Level->iKursorMesh, 1); ber_umisti_prvek(p_Level->iKursorMesh, p_Item->Pos[0], p_Item->Pos[2] + 1, p_Item->Pos[1], p_Item->Rotation); p_Level->iKursorAnimation = rani_aktivuj(am.sim_anim[34], &p_Level->TrashFlag, GK_LOOP, 0, 0); rani_privaz_mesh(p_Level->iKursorAnimation, p_Level->iKursorMesh, 0); } void gl_Select_BeatleFlek(ITEMDESC * p_Item, LEVELINFO * p_Level) { FLEK_K *pFlek; float pos[3]; pFlek = &p_Level->SelectionFlek; kom_get_fyz_souradnice(p_Item->Pos[0], p_Item->Pos[2], p_Item->Pos[1], (BOD *) pos); memcpy(pFlek->pos, pos, 3 * sizeof(float)); kom_flek_zmen(pFlek->pFlek, (BOD *) pFlek->pos, (BOD *) pFlek->nx, (BOD *) pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, 2, pFlek->Material); kom_flek_setflag(pFlek->pFlek, 0); if (p_Level->iKursorAnimation) { rani_zrus(p_Level->iKursorAnimation); p_Level->iKursorAnimation = 0; } kom_prvek_viditelnost(p_Level->iKursorMesh, 1); ber_umisti_prvek(p_Level->iKursorMesh, p_Item->Pos[0], p_Item->Pos[2] + 1, p_Item->Pos[1], p_Item->Rotation); p_Level->iKursorAnimation = rani_aktivuj(am.sim_anim[34], &p_Level->TrashFlag, GK_LOOP, 0, 0); rani_privaz_mesh(p_Level->iKursorAnimation, p_Level->iKursorMesh, 0); } //------------------------------------------------------------------------------------------------ // nakresli flek //------------------------------------------------------------------------------------------------ void gl_Do_Flek(float *pos, ITEMDESC * p_Item, LEVELINFO * p_Level) { int rs; FLEK_K *pFlek = NULL; char cFlek[32]; int pos_[3]; char bStat = 1; float plus_pos = 2.0f; gl_i2FStr((rand() % 9) + 1, cFlek); memcpy(pos_, p_Item->Pos, 3 * sizeof(int)); pos_[2]--; gl_Logical2Real(pos_[0], pos_[1], pos_[2], &rs, p_Level); if (p_Level->Level[rs]) if (p_Level->Level[rs]->p_Object->Class != 12) { bStat = kom_je_prvek_staticky(p_Level->Level[rs]->p_Object->GUID); plus_pos = 0.1f; goto gl_Do_Flek_SET; } pos_[2]--; if (pos_[2] >= 0) { gl_Logical2Real(pos_[0], pos_[1], pos_[2], &rs, p_Level); if (p_Level->Level[rs]) bStat = kom_je_prvek_staticky(p_Level->Level[rs]->p_Object->GUID); } gl_Do_Flek_SET: if (bStat) { //pridej flek na podlahu if (p_Item->Pos[2] == 1) { gl_Logical2Real2D(p_Item->Pos[0], p_Item->Pos[1], &rs, p_Level); pFlek = &p_Level->pSquare[rs].Flek; } if (p_Item->Pos[2] > 1) { if (!p_Level->Level[rs]) return; pFlek = &p_Level->Level[rs]->Square.Flek; } pFlek->Flag = K_CHYBA; memcpy(pFlek->pos, pos, 3 * sizeof(float)); pFlek->pos[1]--; pFlek->Material = kom_najdi_material(cFlek); pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = rand() % 4; if (pFlek->Material == -1) kprintf(1, "Nelze najit material %s", cFlek); if (p_Item->Pos[2] == 1) { if (pFlek->pFlek) { kom_flek_zrus(pFlek->pFlek); pFlek->pFlek = 0; } pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, p_Level->pSquare[rs].iUroven, pFlek->Material); } if (p_Item->Pos[2] > 1) { if (pFlek->pFlek) { kom_flek_zrus(pFlek->pFlek); pFlek->pFlek = 0; } pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, p_Level->Level[rs]->Square.iUroven, pFlek->Material); } } else { if (!p_Level->Level[rs]) return; pFlek = &p_Level->Level[rs]->Square.Flek; pFlek->Flag = p_Level->Level[rs]->Index_Of_Game_Mesh; pFlek->pos[0] = 0; pFlek->pos[1] = plus_pos; pFlek->pos[2] = 0; pFlek->Material = kom_najdi_material(cFlek); pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = rand() % 4; if (pFlek->Material == -1) kprintf(1, "Nelze najit material %s", cFlek); if (pFlek->pFlek) { kom_flek_zrus(pFlek->pFlek); pFlek->pFlek = 0; } pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, p_Level->Level[rs]->Square.iUroven, pFlek->Material); } } //------------------------------------------------------------------------------------------------ // pripoj flek k berusce //------------------------------------------------------------------------------------------------ void gl_Pripoj_Flek_k_Berusce(ITEMDESC * pItem) { FLEK_K *pFlek; pFlek = &pItem->Square.Flek; pFlek->Flag = pItem->Index_Of_Game_Mesh; pFlek->pos[0] = 0; // Raise shadows a bit. This fixes an issue in level 323. pFlek->pos[1] = 0.01; pFlek->pos[2] = 0; pFlek->Material = kom_najdi_material("flek10"); pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = rand() % 4; pItem->Square.iUroven = 1; if (pFlek->Material == -1) kprintf(1, "Nelze najit material flek10"); pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, pItem->Square.iUroven, pFlek->Material); } void gl_Pripoj_Flek_k_Beruskam(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 1 && !p_Level->Level[i]->bDestroed) gl_Pripoj_Flek_k_Berusce(p_Level->Level[i]); } void gl_Pripoj_Flek_k_Predmenu(ITEMDESC * pItem, LEVELINFO * p_Level) { float pos[3]; int ipos[3]; int r; FLEK_K *pFlek; char stat; pFlek = &pItem->Square.Flek; memcpy((void *) ipos, (void *) pItem->Pos, 3 * sizeof(int)); ipos[2]--; gl_Logical2Real(ipos[0], ipos[1], ipos[2], &r, p_Level); if (p_Level->Level[r]) { if (p_Level->Level[r]->p_Object->Class != 12) { if (kom_je_prvek_staticky(p_Level->Level[r]->p_Object->GUID)) { pFlek->Flag = K_CHYBA; stat = 1; } else if (p_Level->Level[r]->p_Object->Class == 12 || p_Level->Level[r]->p_Object->Class == 8) { pFlek->Flag = K_CHYBA; stat = 1; } else { p_Level->Level[r]->Square.pExtFlek = pFlek; pFlek->Flag = p_Level->Level[r]->Index_Of_Game_Mesh; stat = 0; } } else goto NEXT_FLEK_TEST; } else { NEXT_FLEK_TEST: ipos[2]--; gl_Logical2Real(ipos[0], ipos[1], ipos[2], &r, p_Level); if (ipos[2] > 0) if (p_Level->Level[r]) { if (kom_je_prvek_staticky(p_Level->Level[r]->p_Object->GUID)) { pFlek->Flag = K_CHYBA; stat = 1; } else { p_Level->Level[r]->Square.pExtFlek = pFlek; pFlek->Flag = p_Level->Level[r]->Index_Of_Game_Mesh; stat = 0; } } else { pFlek->Flag = K_CHYBA; stat = 1; } else { pFlek->Flag = K_CHYBA; stat = 1; } } kom_get_fyz_souradnice(pItem->Pos[0], pItem->Pos[2], pItem->Pos[1], (BOD *) pos); if (stat) { pFlek->pos[0] = pos[0]; pFlek->pos[1] = pos[1]; pFlek->pos[2] = pos[2]; } else { pFlek->pos[0] = 0; if (p_Level->Level[r]->p_Object->Class == 11 || p_Level->Level[r]->p_Object->Class == 10 || p_Level->Level[r]->p_Object->Class == 15) pFlek->pos[1] = 0; else pFlek->pos[1] = 2; pFlek->pos[2] = 0; } pFlek->Material = kom_najdi_material("flek10"); pFlek->nx[0] = 1; pFlek->nx[1] = 0; pFlek->nx[2] = 0; pFlek->nz[0] = 0; pFlek->nz[1] = 0; pFlek->nz[2] = 1; pFlek->dx = 1; pFlek->dy = 1; pFlek->Rotation = rand() % 4; pItem->Square.iUroven = 1; if (pFlek->Material == -1) kprintf(1, "Nelze najit material flek03"); pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, pItem->Square.iUroven, pFlek->Material); if (!pFlek->pFlek) { kprintf(1, "Neporarilo ze pripojit flek k predmetu"); pFlek->pFlek = 0; } } void gl_Pripoj_Flek_k_Predmetum(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 13 && !p_Level->Level[i]->bDestroed) gl_Pripoj_Flek_k_Predmenu(p_Level->Level[i], p_Level); } int gl_Get_Free_Zhavy_System(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->ZhaveCastice[i].System.pCastice) return i; return -1; } int gl_Get_Free_Kourovy_System(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->KourovaStopa[i].System) return i; return -1; } int gl_Get_Free_Kour(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->Kour[i].System) return i; return -1; } int gl_Get_Free_Kour_Kameni(LEVELINFO * p_Level) { int i; for (i = 0; i < 20; i++) if (!p_Level->KourKameni[i].System) return i; return -1; } void gl_Do_Smoke(float *pos, LEVELINFO * p_Level, int r) { int k, m, i; PAR_KOUR_STOPA *pKourovaS; float f; k = gl_Get_Free_Kour(p_Level); if (k == -1) return; pKourovaS = (PAR_KOUR_STOPA *) malloc(p_Level->Jiskra[r].Sizeof * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; p_Level->Kour[k].pCastice = pKourovaS; p_Level->Kour[k].Sizeof = p_Level->Jiskra[r].Sizeof; p_Level->Kour[k].dwStart = timeGetTime(); m = kom_najdi_material("mrak1_1"); if (m == -1) kprintf(1, "Nelze najit material mrak1_1"); pKourovaS[0].rychlost_x = 2.0f; pKourovaS[0].rychlost_y = 2.0f; pKourovaS[0].utlum_x = 0.1f; pKourovaS[0].utlum_y = 0.1f; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 0.25f + randf() / (float) (RAND_MAX); pKourovaS[0].a = 0.6f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = -0.075f; pKourovaS[0].ka = 0.0f; p_Level->Kour[k].System = par_vyrob(); par_set_param(p_Level->Kour[k].System, m, TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_VITR | TPAR_NO_FOG, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->Kour[k].System, pKourovaS, p_Level->Kour[k].Sizeof); for (i = 0; i < p_Level->Kour[k].Sizeof; i++) { p_Level->Kour[k].hHnizdo[i] = par_vloz_hnizdo(p_Level->Kour[k].System); par_vloz_hnizdo_komplet(p_Level->Kour[k].hHnizdo[i], 100000, (BOD *) p_Level->Kour[k].pivot[i], pKourovaS); par_vloz_hnizdo_timer(p_Level->Kour[k].hHnizdo[i], 100000, -100000); //vygeneruj dir p_Level->Kour[k].dir[i][0] = rand() & 0x1 ? randf() : -randf(); p_Level->Kour[k].dir[i][1] = randf() * 2.0f; p_Level->Kour[k].dir[i][2] = rand() & 0x1 ? randf() : -randf(); vektor_norm((BOD *) p_Level->Kour[k].dir[i]); f = (randf() / (float) (RAND_MAX)) * _3DKOREKCE; p_Level->Kour[k].dir[i][0] *= f / 50.0f; p_Level->Kour[k].dir[i][1] *= f / 20.0f; p_Level->Kour[k].dir[i][2] *= f / 50.0f; memcpy((void *) p_Level->Kour[k].pivot[i], (void *) pos, 3 * sizeof(float)); p_Level->Kour[k].pivot[i][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->Kour[k].pivot[i][1] += randf() / (float) (RAND_MAX); p_Level->Kour[k].pivot[i][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); par_vloz_hnizdo_dir(p_Level->Kour[k].hHnizdo[i], (BOD *) p_Level->Kour[k].dir[i]); par_vloz_hnizdo_vitr(p_Level->Kour[k].hHnizdo[i], (BOD *) p_Level->fVitr); } p_Level->Kour[k].dwStart = timeGetTime(); par_pripoj_funkci(p_Level->Kour[k].System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(p_Level->Kour[k].System, &p_Level->Kour[k].flag, 0, 0); } void gl_Do_Prach(float *pos, LEVELINFO * p_Level) { int r, m; PAR_FLEK *pCastice; pos[1] += 0.25f; r = rand() % 10; p_Level->Prach[r].dwStart = timeGetTime(); pCastice = (PAR_FLEK *) malloc(p_Level->Prach[r].Sizeof * sizeof(PAR_FLEK)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->Prach[r].pCastice, p_Level->Prach[r].Sizeof * sizeof(PAR_FLEK)); ParHandle ph = par_vyrob(); m = kom_najdi_material("mrak1_1"); if (m == -1) kprintf(1, "Nelze najit material mrak1_1"); par_set_param(ph, m, TPAR_NO_FOG | TPAR_VETSI | TPAR_HTEST | TPAR_AUTOREMOVE | TPAR_SCALE_ADD, (BOD *) pos, NULL); par_vloz_fleky(ph, pCastice, p_Level->Prach[r].Sizeof); par_pripoj_funkci(ph, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pCastice)); par_go(ph, &p_Level->Prach[r].flag, 0, 0); } void gl_Do_Strepiny_Na_Vode(float *pos, LEVELINFO * p_Level, float fycor) { float fPos[3]; int real; int iPos[3]; if (p_Level->bUnderWaterLevel) return; iPos[0] = ftoi((pos[0] - ber.x_start - X_PRVEK / 2) / X_PRVEK); iPos[2] = ftoi(((pos[1] - ber.y_start - Y_PRVEK / 2) / Y_PRVEK) * 2); iPos[1] = ftoi((pos[2] - ber.z_start - Z_PRVEK / 2) / Z_PRVEK); gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 12) { fPos[0] = pos[0]; fPos[1] = pos[1] - 1; fPos[2] = pos[2]; am_Kola_na_Vode(fPos, 1, 4, 0, p_Level); pos[1] += fycor; am_Do_Vodni_Cakanec1(pos, 4, 0, p_Level); am_Do_Vodni_Cakanec2(pos, 4, 0, p_Level); } } void gl_Do_Krompac(float *pos, LEVELINFO * p_Level, int material) { int i, r; PAR_STREPINA *pCastice; for (i = 0; i < 10; i++) { r = rand() % 10; if (p_Level->Krompac[r].flag == -1) break; } if (i == 20) return; p_Level->Krompac[r].dwStart = timeGetTime(); pCastice = (PAR_STREPINA *) malloc(p_Level->Krompac[r].Sizeof * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->Krompac[r].pCastice, p_Level->Krompac[r].Sizeof * sizeof(PAR_STREPINA)); ParHandle ph = par_vyrob(); par_set_param(ph, material, TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_strepy(ph, pCastice, p_Level->Krompac[r].Sizeof); par_go(ph, &p_Level->Krompac[r].flag, 0, 0); par_pripoj_funkci(ph, anmend_ZrusCastice, -1, 0, reinterpret_cast(pCastice)); } void gl_Do_Strepiny(float *pos, LEVELINFO * p_Level, int material, char bSvetlo) { int i, r, s, k, m, rm; PAR_STREPINA *pCastice; PAR_KOUR_STOPA *pKourovaS; float rg, rb, rr, ra, rdx, rdy; float rgs, rbs, rrs; for (i = 0; i < 20; i++) { r = rand() % 20; if (p_Level->Exploze[r].flag == -1) break; } if (i == 20) return; p_Level->Exploze[r].dwStart = timeGetTime(); pCastice = (PAR_STREPINA *) malloc(p_Level->Exploze[r].Sizeof * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->Exploze[r].pCastice, p_Level->Exploze[r].Sizeof * sizeof(PAR_STREPINA)); ParHandle ph = par_vyrob(); par_set_param(ph, material, TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_strepy(ph, pCastice, p_Level->Exploze[r].Sizeof); par_go(ph, &p_Level->Exploze[r].flag, 0, 0); LightHandle hSvetlo; if (bSvetlo) { if (!p_Level->Sub_Svetla) { rr = 1; rg = 0.8f + ((float) (rand() % 20) / 100.0f); rb = 0; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); } else { rr = 0; rg = 1.0f - (0.8f + ((float) (rand() % 20) / 100.0f)); rb = 1; hSvetlo = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR | SDL_SUB); } sdl_svetlo_set_pos(hSvetlo, (BOD *) pos); sdl_svetlo_set_diff(hSvetlo, rr, rg, rb, 0, 0, 0); sdl_anim_vyrob(hSvetlo, 15, 0, 0, 3); sdl_anim_vloz_klic_vzdal(hSvetlo, 0, 0, 0, 0, 0); sdl_anim_vloz_klic_vzdal(hSvetlo, 1, 7, 0, 7, 2); sdl_anim_vloz_klic_vzdal(hSvetlo, 2, 0, 0, 0, 14); sdl_anim_start(hSvetlo, &p_Level->TrashFlag, 0, 0, 0); par_pripoj_funkci(ph, anmend_ZrusCastice, (size_ptr)hSvetlo, 0, reinterpret_cast(pCastice)); } else { par_pripoj_funkci(ph, anmend_ZrusCastice, -1, 0, reinterpret_cast(pCastice)); } //zhave jistry if (bSvetlo) { //najdi volny system jisker for (i = 0; i < 20; i++) { r = rand() % 20; if (p_Level->Jiskra[r].flag == -1) break; } if (i == 20) return; p_Level->Jiskra[r].dwStart = timeGetTime(); //najdi alokuj pamet pro system pCastice = (PAR_STREPINA *) malloc(p_Level->Jiskra[r].Sizeof * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->Jiskra[r].pCastice, p_Level->Jiskra[r].Sizeof * sizeof(PAR_STREPINA)); ph = par_vyrob(); material = kom_najdi_material("lava"); if (material == -1) kprintf(1, "Nelze najit material lava"); par_set_param(ph, material, TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_strepy(ph, pCastice, p_Level->Jiskra[r].Sizeof); par_go(ph, &p_Level->Jiskra[r].flag, 0, 0); s = gl_Get_Free_Zhavy_System(p_Level); if (s == -1) return; p_Level->ZhaveCastice[s].System.pCastice = pCastice; p_Level->ZhaveCastice[s].System.Sizeof = p_Level->Jiskra[r].Sizeof; p_Level->ZhaveCastice[s].System.dwStart = timeGetTime(); p_Level->ZhaveCastice[s].iKourStopa = -1; //kourova stopa za casticema k = gl_Get_Free_Kourovy_System(p_Level); if (k == -1) return; p_Level->ZhaveCastice[s].iKourStopa = k; pKourovaS = (PAR_KOUR_STOPA *) malloc(p_Level->Jiskra[r].Sizeof * sizeof(PAR_KOUR_STOPA) * 100); if (!pKourovaS) return; p_Level->KourovaStopa[k].pCastice = pKourovaS; p_Level->KourovaStopa[k].Sizeof = p_Level->Jiskra[r].Sizeof * 100; p_Level->KourovaStopa[k].dwStart = timeGetTime(); pKourovaS[0].rychlost_x = 0.1f; pKourovaS[0].rychlost_y = 0.1f; pKourovaS[0].utlum_x = 0.3f; pKourovaS[0].utlum_y = 0.3f; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 1.0f; pKourovaS[0].a = 0.5f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = -0.1f; pKourovaS[0].ka = 0.0f; m = kom_najdi_material("mrak1_1"); if (m == -1) kprintf(1, "Nelze najit material mrak1_1"); p_Level->KourovaStopa[k].System = par_vyrob(); par_set_param(p_Level->KourovaStopa[k].System, m, TPAR_NO_FOG | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->KourovaStopa[k].System, pKourovaS, p_Level->KourovaStopa[k].Sizeof); par_pripoj_funkci(ph, anmend_ZrusCastice2, reinterpret_cast(&p_Level->KourovaStopa[k]), reinterpret_cast(&p_Level->ZhaveCastice[s]), reinterpret_cast(pCastice)); for (i = 0; i < p_Level->Jiskra[r].Sizeof; i++) { rr = 1; rg = 0.8f + ((float) (rand() % 20) / 100.0f); rb = 0; if (!p_Level->Sub_Svetla) { rrs = rr; rgs = rg; rbs = rb; } else { rrs = 1.0f - rr; rgs = 1.0f - rg; rbs = 1.0f - rb; } ra = 0.1f + ((float) (rand() % 30) / 100.0f); rdy = rdx = (float) (rand() % 20) / 100.0f; rm = rand() % 2; if (rm) rm = kom_najdi_material("flare4"); else rm = kom_najdi_material("flare5"); if (rm == -1) kprintf(1, "Nelze najit material flare4 nebo flare5"); //svetlo if (!p_Level->Sub_Svetla) p_Level->ZhaveCastice[s].hSvetlo[i] = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR); else p_Level->ZhaveCastice[s].hSvetlo[i] = sdl_svetlo_vyrob(SDL_UTLUM_LINEAR | SDL_SUB); hSvetlo = p_Level->ZhaveCastice[s].hSvetlo[i]; sdl_svetlo_set_pos(hSvetlo, (BOD *) & p_Level->Jiskra[r].pCastice[i].p); sdl_svetlo_set_diff(hSvetlo, rrs, rgs, rbs, 0, rdx + 1.3f, rdx + 1.3f); //flare FlareHandle fh = p_Level->ZhaveCastice[s].hFlare[i] = kom_flare_vyrob(0); kom_flare_set_param(fh, rr, rg, rb, ra, rdy, rdx, rm, GL_ONE); kom_flare_set_pivot(fh, &pCastice[i].p); //kourova stopa HnizdoHandle hh = p_Level->KourovaStopa[k].hHnizdo[i] = par_vloz_hnizdo(p_Level->KourovaStopa[k].System); par_vloz_hnizdo_komplet(hh, (int) ceil(1.0f / pCastice[i].rychlost), &pCastice[i].p, pKourovaS); par_vloz_hnizdo_timer(hh, (int) ceil(1.0f / pCastice[i].rychlost), -(int) ceil(1.0f / pCastice[i].rychlost)); } par_go(p_Level->KourovaStopa[k].System, &p_Level->KourovaStopa[k].flag, 0, 0); //kour na miste vybuchu gl_Do_Smoke(pos, p_Level, r); gl_Do_Strepiny_Na_Vode(pos, p_Level, 0); } } void gl_Do_Smoke_Kameni(float *pos, LEVELINFO * p_Level) { int k, m, i; PAR_KOUR_STOPA *pKourovaS; float f; k = gl_Get_Free_Kour_Kameni(p_Level); if (k == -1) return; pKourovaS = (PAR_KOUR_STOPA *) malloc(5 * sizeof(PAR_KOUR_STOPA)); if (!pKourovaS) return; p_Level->KourKameni[k].pCastice = pKourovaS; p_Level->KourKameni[k].Sizeof = 5; p_Level->KourKameni[k].dwStart = timeGetTime(); m = kom_najdi_material("mrak1_1"); if (m == -1) kprintf(1, "Nelze najit material mrak1_1"); pKourovaS[0].rychlost_x = 2.0f; pKourovaS[0].rychlost_y = 2.0f; pKourovaS[0].utlum_x = 0.2f; pKourovaS[0].utlum_y = 0.2f; pKourovaS[0].r = pKourovaS[0].g = pKourovaS[0].b = 0.75f; pKourovaS[0].a = 0.5f; pKourovaS[0].dr = pKourovaS[0].dg = pKourovaS[0].db = pKourovaS[0].da = -0.2f; pKourovaS[0].ka = 0.0f; p_Level->KourKameni[k].System = par_vyrob(); par_set_param(p_Level->KourKameni[k].System, m, TPAR_NO_FOG | TPAR_SCALE | TPAR_VETSI | TPAR_AUTOREMOVE | TPAR_DIR | TPAR_VITR, (BOD *) pos, NULL); par_vloz_kour_stopu(p_Level->KourKameni[k].System, pKourovaS, p_Level->KourKameni[k].Sizeof); for (i = 0; i < p_Level->KourKameni[k].Sizeof; i++) { p_Level->KourKameni[k].hHnizdo[i] = par_vloz_hnizdo(p_Level->KourKameni[k].System); par_vloz_hnizdo_komplet(p_Level->KourKameni[k].hHnizdo[i], 100000, (BOD *) p_Level->KourKameni[k].pivot[i], pKourovaS); par_vloz_hnizdo_timer(p_Level->KourKameni[k].hHnizdo[i], 100000, -100000); //vygeneruj dir p_Level->KourKameni[k].dir[i][0] = rand() & 0x1 ? randf() : -randf(); //p_Level->KourKameni[k].dir[i][1] = randf() * 2.0f; p_Level->KourKameni[k].dir[i][2] = rand() & 0x1 ? randf() : -randf(); vektor_norm((BOD *) p_Level->KourKameni[k].dir[i]); f = (randf() / (float) (RAND_MAX)) * _3DKOREKCE; p_Level->KourKameni[k].dir[i][0] *= f / 100.0f; p_Level->KourKameni[k].dir[i][1] *= f / 100.0f; p_Level->KourKameni[k].dir[i][2] *= f / 100.0f; memcpy((void *) p_Level->KourKameni[k].pivot[i], (void *) pos, 3 * sizeof(float)); p_Level->KourKameni[k].pivot[i][0] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); p_Level->KourKameni[k].pivot[i][1] += 0.0f; p_Level->KourKameni[k].pivot[i][2] += (rand() & 0x1 ? randf() : -randf()) / (float) (RAND_MAX); par_vloz_hnizdo_dir(p_Level->KourKameni[k].hHnizdo[i], (BOD *) p_Level->KourKameni[k].dir[i]); par_vloz_hnizdo_vitr(p_Level->KourKameni[k].hHnizdo[i], (BOD *) p_Level->fVitr); } p_Level->KourKameni[k].dwStart = timeGetTime(); par_pripoj_funkci(p_Level->KourKameni[k].System, anmend_ZrusCastice3, 0, 0, reinterpret_cast(pKourovaS)); par_go(p_Level->KourKameni[k].System, &p_Level->KourKameni[k].flag, 0, 0); } void gl_Do_Kameni(float *pos, LEVELINFO * p_Level, int material) { int i, r; PAR_STREPINA *pCastice; for (i = 0; i < 20; i++) { r = rand() % 20; if (p_Level->Kamen[r].flag == -1) break; } if (i == 20) return; pCastice = (PAR_STREPINA *) malloc(p_Level->Kamen[r].Sizeof * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->Kamen[r].pCastice, p_Level->Kamen[r].Sizeof * sizeof(PAR_STREPINA)); ParHandle ph = par_vyrob(); par_set_param(ph, material, TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_strepy(ph, pCastice, p_Level->Kamen[r].Sizeof); par_pripoj_funkci(ph, anmend_ZrusCastice, -1, 0, reinterpret_cast(pCastice)); par_go(ph, &p_Level->Kamen[r].flag, 0, 0); gl_Do_Smoke_Kameni(pos, p_Level); } int gl_Get_Mesh_Material(int Mesh) { size_ptr * p_mat = NULL; int i; int matnum = kom_mesh_get_matnum(Mesh); p_mat = (size_ptr *) malloc(matnum * sizeof(size_ptr)); if (!p_mat) return -1; kom_mesh_get_mat(Mesh, reinterpret_cast(p_mat)); i = p_mat[0]; free((void *) p_mat); return i; } //------------------------------------------------------------------------------------------------ // destroy item //------------------------------------------------------------------------------------------------ void gl_Destroy_Item(long Item, int Type, LEVELINFO * p_Level) { ITEMDESC *p_Item = p_Level->Level[Item]; am_Destroy_Steps(p_Item, p_Level); if (p_Item->p_Object->Class == 6 && p_Item->p_Object->GUID == 6014) am_Release_BarelSparks(p_Level, p_Item); if (p_Level->Level[Item]->a_run) { //rani_rozvaz(p_Level->Level[Item]->a_run,p_Level->Level[Item]->Index_Of_Game_Mesh); rani_zrus(p_Level->Level[Item]->a_run); p_Level->Level[Item]->a_run = 0; } switch (Type) { case 1: p_Item->bDestroed = 1; p_Level->Level[Item] = 0; return; break; case 2: { int rot; float pos[3]; kom_mesh_get_float(p_Item->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 5; ap_Play_Sound(0,0,0, pos, rot + 14, NULL, &ad); p_Item->bDestroed = 1; p_Level->Level[Item] = 0; return; } break; case 3: { int rot; float pos[3]; int mat = gl_Get_Mesh_Material(p_Item->Index_Of_Game_Mesh); kom_mesh_get_float(p_Item->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 5; ap_Play_Sound(0,0,0, pos, rot + 14, NULL, &ad); rot = p_Item->Index_Of_Game_Mesh; if (p_Item->Square.Flek.pFlek) { kom_flek_zrus(p_Item->Square.Flek.pFlek); p_Item->Square.Flek.pFlek = 0; } if (p_Item->Square.pExtFlek && p_Item->Square.pExtFlek->pFlek) { kom_flek_zrus(p_Item->Square.pExtFlek->pFlek); p_Item->Square.pExtFlek->pFlek = 0; } kom_zrus_prvek(p_Item->Index_Of_Game_Mesh); gl_Do_Strepiny(pos, p_Level, mat, 0); p_Item->bDestroed = 1; p_Level->Level[Item] = 0; return; } break; case 4: { int rot; float pos[3]; int mat = gl_Get_Mesh_Material(p_Item->Index_Of_Game_Mesh); int iPos[3]; char bSvetlo = 1; memcpy((void *) iPos, (void *) p_Item->Pos, 3 * sizeof(int)); kom_mesh_get_float(p_Item->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); gl_Do_Flek(pos, p_Item, p_Level); rot = p_Item->Index_Of_Game_Mesh; if (p_Item->Square.Flek.pFlek) { kom_flek_zrus(p_Item->Square.Flek.pFlek); p_Item->Square.Flek.pFlek = 0; } if (p_Item->Square.pExtFlek && p_Item->Square.pExtFlek->pFlek) { kom_flek_zrus(p_Item->Square.pExtFlek->pFlek); p_Item->Square.pExtFlek->pFlek = 0; } gl_Logical2Real(p_Item->Pos[0], p_Item->Pos[1], p_Item->Pos[2], &rot, p_Level); if (p_Level->Square[rot].bUnderWater) bSvetlo = 0; kom_zrus_prvek(p_Item->Index_Of_Game_Mesh); gl_Do_Strepiny(pos, p_Level, mat, bSvetlo); if (!bSvetlo) am_Do_Vybuch_Bublin(iPos, pos, p_Level); p_Item->bDestroed = 1; p_Level->Level[Item] = 0; return; } break; case 5: if (p_Item->Square.Flek.pFlek) { kom_flek_zrus(p_Item->Square.Flek.pFlek); p_Item->Square.Flek.pFlek = 0; } if (p_Item->Square.pExtFlek && p_Item->Square.pExtFlek->pFlek) { kom_flek_zrus(p_Item->Square.pExtFlek->pFlek); p_Item->Square.pExtFlek->pFlek = 0; } break; case 6: { int rot; float pos[3]; int mat = gl_Get_Mesh_Material(p_Item->Index_Of_Game_Mesh); kom_mesh_get_float(p_Item->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = p_Item->Index_Of_Game_Mesh; if (p_Item->Square.Flek.pFlek) { kom_flek_zrus(p_Item->Square.Flek.pFlek); p_Item->Square.Flek.pFlek = 0; } if (p_Item->Square.pExtFlek && p_Item->Square.pExtFlek->pFlek) { kom_flek_zrus(p_Item->Square.pExtFlek->pFlek); p_Item->Square.pExtFlek->pFlek = 0; } kom_zrus_prvek(p_Item->Index_Of_Game_Mesh); gl_Do_Strepiny(pos, p_Level, mat, 0); p_Item->bDestroed = 1; p_Level->Level[Item] = 0; return; } break; } if (p_Item->Square.Flek.pFlek) { kom_flek_zrus(p_Item->Square.Flek.pFlek); p_Item->Square.Flek.pFlek = 0; } if (p_Item->Square.pExtFlek && p_Item->Square.pExtFlek->pFlek) { kom_flek_zrus(p_Item->Square.pExtFlek->pFlek); p_Item->Square.pExtFlek->pFlek = 0; } kom_zrus_prvek(p_Item->Index_Of_Game_Mesh); p_Item->bDestroed = 1; p_Level->Level[Item] = 0; } //------------------------------------------------------------------------------------------------ // analyzuje sloupec po padu a provede vybuchy vybusnin u beden //------------------------------------------------------------------------------------------------ int gl_Analyse_Column(int *column, LEVELINFO * p_Level) { int i, result = 0, w, c[3]; int item_pos, check_pos; OBJECTDESC *p_real_posO, *p_check_posO; for (i = column[2]; i > 1; i -= 2) { gl_Logical2Real(column[0], column[1], i, &item_pos, p_Level); gl_Logical2Real(column[0], column[1], i - 1, &check_pos, p_Level); if (p_Level->Level[check_pos]) if (p_Level->Level[check_pos]->p_Object->Class != 12) break; gl_Logical2Real(column[0], column[1], i - 2, &check_pos, p_Level); if ((p_Level->Level[item_pos]) && p_Level->Level[check_pos] && ((i - 2) > 0)) { p_real_posO = p_Level->Level[item_pos]->p_Object; p_check_posO = p_Level->Level[check_pos]->p_Object; if ((p_real_posO->Class == 6) && (p_check_posO->Class == 5)) { DESTROY_ITEMS: gl_Destroy_Item(item_pos, 4, p_Level); gl_Destroy_Item(check_pos, 3, p_Level); result++; i -= 2; continue; } if ((p_real_posO->Class == 6) && (p_real_posO->SubClass == 1) && ((p_check_posO->Class == 5) || (p_check_posO->Class == 6) || (p_check_posO->Class == 7) || (p_check_posO->Class == 3) || (p_check_posO->Class == 16) )) goto DESTROY_ITEMS; //jestlize je to pontonka, zkontroluji zatez if (p_check_posO->Class == 5 && p_check_posO->SubClass == 3) { c[0] = column[0]; c[1] = column[1]; c[2] = i; w = gl_Count_Weight(c, p_Level); if (w > 1) { result++; continue; } } } if (!p_Level->Level[item_pos] || !p_Level->Level[check_pos]) break; } return result; } //------------------------------------------------------------------------------------------------ // provede rychlou predbeznou analyzu, zda je posun mozny (zdi) //------------------------------------------------------------------------------------------------ int gl_Is_Move_Possible(int *iValue_old, int *iValue_new, LEVELINFO * p_Level) { int Move[3], act_pos[3], pos[3], old_pos[3]; int Vrstva; int real_pos, test_pos, check_pos; int i; int counter = 0; int Weight, Total_Weight = 0; char Ignore_Weight = 0; ITEMDESC *p_real_posI = NULL, *p_test_posI = NULL; OBJECTDESC *p_real_posO = NULL, *p_test_posO = NULL, *p_LastO = NULL; BACK_PACK *p_Back = p_Level->Level[p_Level->Actual_Item]->p_Back_Pack; gl_Get_Move(iValue_old, iValue_new, Move); if ((iValue_new[0] < 0) || (iValue_new[0] > (p_Level->Size[0] - 1))) return 0; if ((iValue_new[1] < 0) || (iValue_new[1] > (p_Level->Size[1] - 1))) return 0; act_pos[0] = iValue_new[0]; act_pos[1] = iValue_new[1]; act_pos[2] = iValue_new[2]; gl_Logical2Real(iValue_new[0], iValue_new[1], iValue_new[2], &real_pos, p_Level); p_real_posI = p_Level->Level[real_pos]; if (p_Level->bSikminaMoveExeption && p_Level->Flip) return 0; p_Level->bSikminaMoveExeption = 0; if (p_real_posI) p_real_posO = p_Level->Level[real_pos]->p_Object; if (p_real_posI) { if (p_real_posO->Class == 13) return 1; /* if(p_real_posO->Class == 6) if(gl_Count_Weight(iValue_new, p_Level) > p_Back->Strength) return 0; else Ignore_Weight = 1;*/ if (p_real_posO->Class == 6) Ignore_Weight = 1; if (p_real_posO->Class == 7) return 1; } // postupuju do predu az dokud nenarazim na konec radi while (p_real_posI) { Vrstva = act_pos[2]; if ((act_pos[0] >= 0) && (act_pos[0] < p_Level->Size[0]) && (act_pos[1] >= 0) && (act_pos[1] < p_Level->Size[1]) && (act_pos[2] >= 0) && (act_pos[2] < p_Level->Size[2])) { gl_Logical2Real(act_pos[0], act_pos[1], act_pos[2], &test_pos, p_Level); p_test_posI = p_Level->Level[test_pos]; if (p_test_posI) p_test_posO = p_test_posI->p_Object; // jedu az na konec sloupce if (!Ignore_Weight) { Weight = gl_Count_Weight(act_pos, p_Level); Total_Weight += Weight; if (Total_Weight > p_Back->Strength) return 0; } while (p_Level->Level[test_pos]) { if (Vrstva > (p_Level->Size[2] - 1)) break; if (p_test_posO->Class == 2) break; pos[0] = act_pos[0] + Move[0]; pos[1] = act_pos[1] + Move[1]; pos[2] = Vrstva; gl_Logical2Real(pos[0], pos[1], pos[2], &check_pos, p_Level); // jestli je pred tim zed -> neda se posunout if ((pos[0] >= 0) && (pos[0] < p_Level->Size[0]) && (pos[1] >= 0) && (pos[1] < p_Level->Size[1]) && (pos[2] >= 0) && (pos[2] < p_Level->Size[2])) if (p_Level->Level[check_pos]) { if ((p_Level->Level[check_pos]->p_Object->Class == 2) && (p_test_posO->Class == 19)) return 1; else if ((p_Level->Level[check_pos]->p_Object->Class == 19) && ((p_test_posO->Class == 5) || (p_test_posO->Class == 6))) return 1; else if (p_Level->Level[check_pos]->p_Object->Class == 2) return 0; } // mrknu se, jestli vedle toho neni magnet if (Move[0]) i = 1; else i = 0; pos[0] = act_pos[0]; pos[1] = act_pos[1]; pos[i]++; gl_Logical2Real(pos[0], pos[1], pos[2], &check_pos, p_Level); if (pos[i] < p_Level->Size[i]) if (p_Level->Level[check_pos]) if (p_Level->Level[check_pos]->p_Object->Class == 17) { gl_Hrebik(p_Level->Level[check_pos]); return 0; } pos[i] -= 2; gl_Logical2Real(pos[0], pos[1], pos[2], &check_pos, p_Level); if (pos[i] >= 0) if (p_Level->Level[check_pos]) if (p_Level->Level[check_pos]->p_Object->Class == 17) { gl_Hrebik(p_Level->Level[check_pos]); return 0; } pos[i]++; if ((pos[2] + 2) < p_Level->Size[2]) { gl_Logical2Real(pos[0], pos[1], pos[2] + 2, &check_pos, p_Level); if (p_Level->Level[check_pos]) if (p_Level->Level[check_pos]->p_Object->Class == 17) { gl_Hrebik(p_Level->Level[check_pos]); return 0; } } if ((pos[2] - 2) >= 0) { gl_Logical2Real(pos[0], pos[1], pos[2] - 2, &check_pos, p_Level); if (p_Level->Level[check_pos]) if (p_Level->Level[check_pos]->p_Object->Class == 17) { gl_Hrebik(p_Level->Level[check_pos]); return 0; } } Vrstva += 2; if (Vrstva > (p_Level->Size[2] - 1)) break; gl_Logical2Real(act_pos[0], act_pos[1], Vrstva, &test_pos, p_Level); p_test_posI = p_Level->Level[test_pos]; /*if(Vrstva > (p_Level->Size[2]-1)) break; else */ if (p_test_posI) p_test_posO = p_test_posI->p_Object; counter++; if ((counter > p_Back->Strength) && (!Ignore_Weight)) return 0; else if (Ignore_Weight) { int test_weight = 0; gl_Logical2Real(act_pos[0], act_pos[1], act_pos[2], &test_pos, p_Level); old_pos[0] = act_pos[0]; old_pos[1] = act_pos[1]; old_pos[2] = act_pos[2]; act_pos[0] += Move[0]; act_pos[1] += Move[1]; act_pos[2] = iValue_new[2]; gl_Logical2Real(act_pos[0], act_pos[1], act_pos[2], &real_pos, p_Level); if (p_Level->Level[real_pos]) { test_weight += gl_Count_Weight(old_pos, p_Level) + gl_Count_Weight(act_pos, p_Level); if (p_Level->Level[test_pos]->p_Object->Class == 6 && p_Level->Level[test_pos]->p_Object->SubClass && p_Level->Level[real_pos]->p_Object->Class == 6 && !p_Level->Level[real_pos]->p_Object->SubClass) return 1; else if (p_Level->Level[test_pos]->p_Object->Class == 6 && p_Level->Level[real_pos]->p_Object->Class == 6 && p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength < test_weight) return 0; else return 1; } else //tlacim bombu -> Ignore_Wigth, ale musim zamezit, aby se dal tracit sloupec bez omezeni if (counter == 1 && gl_Count_Weight(old_pos, p_Level) > p_Back->Strength) return 0; else return 1; } } act_pos[0] += Move[0]; act_pos[1] += Move[1]; act_pos[2] = iValue_new[2]; p_LastO = p_real_posI->p_Object; if ((act_pos[0] >= 0) && (act_pos[0] < p_Level->Size[0]) && (act_pos[1] >= 0) && (act_pos[1] < p_Level->Size[1]) && (act_pos[2] >= 0) && (act_pos[2] < p_Level->Size[2])) { gl_Logical2Real(act_pos[0], act_pos[1], act_pos[2], &real_pos, p_Level); p_real_posI = p_Level->Level[real_pos]; } if ((act_pos[0] >= 0) && (act_pos[0] < p_Level->Size[0]) && (act_pos[1] >= 0) && (act_pos[1] < p_Level->Size[1]) && (act_pos[2] >= 0) && (act_pos[2] < p_Level->Size[2])) if (p_real_posI) { if (p_real_posI->p_Object->Class == 6) { if ((p_LastO->Class == 6) && (p_LastO->SubClass == 1) && (!p_real_posI->p_Object->SubClass)) { return 1; } else { //!!!!!!!!!!!!!!!!!!!!!!!!! ZMENA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (Total_Weight > p_Back->Strength) return 0; } } else { //!!!!!!!!!!!!!!!!!!!!!!!!! ZMENA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (p_LastO->Class == 6 && p_real_posI->p_Object->Class == 5) return 1; } } /* else return 0;*/ } else return 0; } return 1; } //------------------------------------------------------------------------------------------------ // Check Item logic annd take item if possible //------------------------------------------------------------------------------------------------ int gl_Take_Item(long Item, long Beatle, LEVELINFO * p_Level, char bSound, char bRemove) { OBJECTDESC *p_Item_Object = p_Level->Level[Item]->p_Object; BACK_PACK *p_Beatle_BP = p_Level->Level[Beatle]->p_Back_Pack; float pos[3]; int rot; if (bSound) kom_mesh_get_float(p_Level->Level[Item]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); // je to klic if (p_Level->Level[Item]->p_Object->SubClass >= 9) { if (p_Beatle_BP->Count_of_Items >= p_Beatle_BP->Max_Items) return 0; p_Beatle_BP->item[p_Level->Level[Item]->p_Object->SubClass]++; p_Beatle_BP->Count_of_Items++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } //batoh if (p_Item_Object->SubClass == 1) { if (!p_Beatle_BP->item[1]) { p_Beatle_BP->item[1]++; p_Beatle_BP->Max_Items *= 2; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } else return 0; } //vybusniny balicek if (p_Item_Object->SubClass == 4) { if (p_Beatle_BP->Count_of_Items >= p_Beatle_BP->Max_Items) return 0; p_Beatle_BP->item[4]++; p_Beatle_BP->Count_of_Items++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } //krompac if (p_Item_Object->SubClass == 8) { if (p_Beatle_BP->Count_of_Items >= p_Beatle_BP->Max_Items) return 0; p_Beatle_BP->item[8]++; p_Beatle_BP->Count_of_Items++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } //snotchl if (p_Item_Object->SubClass == 0) { if (!p_Beatle_BP->item[0]) { if (p_Beatle_BP->Count_of_Items >= p_Beatle_BP->Max_Items) return 0; p_Beatle_BP->item[0]++; p_Beatle_BP->Count_of_Items++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } else return 0; } //potravina if (p_Item_Object->SubClass == 3) { if (!p_Beatle_BP->item[3]) { p_Beatle_BP->item[3]++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } else return 0; } //hormonalni vytamin if (p_Item_Object->SubClass == 5) { if (!p_Beatle_BP->item[5]) { p_Beatle_BP->item[5]++; p_Beatle_BP->Strength *= 2; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } else return 0; } //kahan if (p_Item_Object->SubClass == 6) { if (!p_Level->Level[Beatle]->p_Back_Pack->item[6]) { p_Beatle_BP->item[6]++; p_Beatle_BP->Count_of_Items++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); return 1; } else return 0; } //zavazi if (p_Item_Object->SubClass == 7) { if (!p_Beatle_BP->item[7]) { int iPos[3]; int real; memcpy((void *) iPos, (void *) p_Level->Level[Item]->Pos, 3 * sizeof(int)); if (!gl_Test_Rule2(iPos, p_Level)) return 0; iPos[2] -= 2; if (iPos[2] > 0) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) if (!gl_Test_Rule1(p_Level->Level[p_Level->Actual_Item], p_Level->Level[real], p_Level)) return 0; } iPos[2]++; if (iPos[2] >= 0) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 15) if (!gl_Test_Rule1B(p_Level->Level[p_Level->Actual_Item], iPos, p_Level)) return 0; } p_Beatle_BP->item[7]++; p_Beatle_BP->Count_of_Items++; if (bRemove) am_Remove_Animate_item(Item, p_Level); if(bSound) ap_Play_Sound(0,0,0, pos, 52, NULL, &ad); p_Level->Throw_off = 1; return 1; } else return 0; } return 0; } //------------------------------------------------------------------------------------------------ // Check Item logic annd take item if possible //------------------------------------------------------------------------------------------------ int gl_Is_Take_Posible(long Item, long Beatle, LEVELINFO * p_Level) { OBJECTDESC *p_Item_Object = p_Level->Level[Item]->p_Object; BACK_PACK *p_Beatle_BP = p_Level->Level[Beatle]->p_Back_Pack; //batoh if (p_Item_Object->SubClass == 1) { if (!p_Beatle_BP->item[1]) return 1; else return 0; } //vybusniny balicek if (p_Item_Object->SubClass == 4 || p_Item_Object->SubClass == 8 || p_Item_Object->SubClass == 0) { if (p_Beatle_BP->Count_of_Items >= p_Beatle_BP->Max_Items) return 0; else return 1; } //potravina if (p_Item_Object->SubClass == 3) { if (!p_Beatle_BP->item[3]) return 1; else return 0; } //hormonalni vytamin if (p_Item_Object->SubClass == 5) { if (!p_Beatle_BP->item[5]) return 1; else return 0; } //kahan if (p_Item_Object->SubClass == 6) { if (!p_Level->Level[Beatle]->p_Back_Pack->item[6]) return 1; else return 0; } //zavazi if (p_Item_Object->SubClass == 7) { if (!p_Beatle_BP->item[7]) return 1; else return 0; } return 0; } //------------------------------------------------------------------------------------------------ // zvuk hrebiku //------------------------------------------------------------------------------------------------ void gl_Hrebik(ITEMDESC * pItem) { float pos[3]; int rot; OBJECTDESC *pItemO = pItem->p_Object; kom_mesh_get_float(pItem->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); rot = rand() % 3; if(pItemO->Specific[rot].Index != -1) ap_Play_Sound(0, 0, 0, pos, pItemO->Specific[rot].Index, NULL, &ad); else if(pItemO->Specific[0].Index != -1) ap_Play_Sound(0, 0, 0, pos,pItemO->Specific[0].Index, NULL, &ad); } //------------------------------------------------------------------------------------------------ // provede kontrolu, zda je pod predmetem pontonova bedna //------------------------------------------------------------------------------------------------ void gl_Kontrola_Pontonky(int *iValue, LEVELINFO * p_Level) { int Vrstva = iValue[2] - 2; int r; if (Vrstva < 0) return; gl_Logical2Real(iValue[0], iValue[1], Vrstva, &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 5 && p_Level->Level[r]->p_Object->SubClass == 3) p_Level->Throw_off = 1; } void gl_Do_Propadlo(float *pos, LEVELINFO * p_Level, int material) { PAR_STREPINA *pCastice; int i, r; for (i = 0; i < 20; i++) { r = rand() % 20; if (p_Level->Propadla[r].flag == -1) break; } if (i == 20) return; pCastice = (PAR_STREPINA *) malloc(p_Level->Propadla[r].Sizeof * sizeof(PAR_STREPINA)); if (!pCastice) return; memcpy((void *) pCastice, (void *) p_Level->Propadla[r].pCastice, p_Level->Propadla[r].Sizeof * sizeof(PAR_STREPINA)); ParHandle ph = par_vyrob(); par_set_param(ph, material, TPAR_HTEST | TPAR_AUTOREMOVE, (BOD *) pos, NULL); par_vloz_strepy(ph, pCastice, p_Level->Propadla[r].Sizeof); par_pripoj_funkci(ph, anmend_ZrusCastice, -1, 0, reinterpret_cast(pCastice)); par_go(ph, &p_Level->Propadla[r].flag, 0, 0); } void gl_Set_3ds_Mesh(char bSet, int iID, int iMesh, int iRotace) { p_set->bSetMesh = bSet; p_set->iMeshID = iID; p_set->iMesh = iMesh; p_set->iRot = iRotace; } void gl_Set_3ds_Anim(int mesh, int poradi, int c_anim, int *p_flag, int flag, int start, int stop) { p_set->_3dsAnim[poradi].mesh = mesh; p_set->_3dsAnim[poradi].c_anim = c_anim; p_set->_3dsAnim[poradi].p_flag = p_flag; p_set->_3dsAnim[poradi].flag = flag; p_set->_3dsAnim[poradi].start = start; p_set->_3dsAnim[poradi].stop = stop; } int gl_Test_Rule1(ITEMDESC * pItem, ITEMDESC * pTestItem, LEVELINFO * p_Level) { ITEMDESC *pBreatle = NULL; int pos[3], c, plus = 0, PlusVaha; int r; if (pTestItem->p_Object->Class != 5 && pTestItem->p_Object->Class != 6) return 1; memcpy((void *) pos, (void *) pItem->Pos, 3 * sizeof(int)); c = gl_Is_There_Beatle(pos, &pBreatle, p_Level); if (!pBreatle) return 1; memcpy((void *) pos, (void *) pTestItem->Pos, 3 * sizeof(int)); pos[2] += 2; gl_Logical2Real(pos[0], pos[1], pos[2], &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 13 && p_Level->Level[r]->p_Object->SubClass == 7) plus = 1; memcpy((void *) pos, (void *) pTestItem->Pos, 3 * sizeof(int)); if (gl_Will_Go_Under_Water(pos, -1, c, &PlusVaha, p_Level) && !gl_Can_Go_Into_Water(pItem)) { c = gl_Count_Weight(pItem->Pos, p_Level) + plus; c += PlusVaha; if (c > 2) return 0; else { p_Level->Throw_off = 1; return 1; } } //p_Level->Throw_off = 1; return 1; } int gl_Test_Rule1B(ITEMDESC * pItem, int *pTestPos, LEVELINFO * p_Level) { ITEMDESC *pBreatle = NULL; int pos[3], c, plus = 0; int r; memcpy((void *) pos, (void *) pItem->Pos, 3 * sizeof(int)); c = gl_Is_There_Beatle(pos, &pBreatle, p_Level); if (!pBreatle) return 1; memcpy((void *) pos, (void *) pTestPos, 3 * sizeof(int)); pos[2]++; if (pos[2] > p_Level->Size[2] - 1) return 1; gl_Logical2Real(pos[0], pos[1], pos[2], &r, p_Level); if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 13 && p_Level->Level[r]->p_Object->SubClass == 7) plus = 1; memcpy((void *) pos, (void *) pTestPos, 3 * sizeof(int)); pos[2]--; /*if(pos[2] < 0) return 1; */ if (gl_Will_Go_Under_Water(pos, -1, c, NULL, p_Level) && !gl_Can_Go_Into_Water(pItem)) { c = gl_Count_Weight(pItem->Pos, p_Level) + plus; if (c > 1) return 0; else { //p_Level->Throw_off = 1; return 1; } } // p_Level->Throw_off = 1; return 1; } int gl_Test_Rule2(int *pos, LEVELINFO * p_Level) { int real; int iPos[3], i; memcpy((void *) iPos, (void *) pos, 3 * sizeof(int)); iPos[2]--; if (iPos[2] >= 0) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class == 15) { iPos[2]--; // zkontroluju, jestli to neoporuje pravidlum for (i = iPos[2]; i > 0; i -= 2) { gl_Logical2Real(iPos[0], iPos[1], i, &real, p_Level); if (p_Level->Level[real]) if ((p_Level->Level[real]->p_Object->Class == 1) || (p_Level->Level[real]->p_Object->Class == 13)) return 0; } } else return 1; } else return 1; } else return 1; return 1; } int gl_Test_Rule2B(int *pos, LEVELINFO * p_Level) { int real; int iPos[3], i; memcpy((void *) iPos, (void *) pos, 3 * sizeof(int)); iPos[2] -= 2; if (iPos[2] >= 0) { for (i = iPos[2]; i > 0; i -= 2) { gl_Logical2Real(iPos[0], iPos[1], i, &real, p_Level); if (p_Level->Level[real]) { if ((p_Level->Level[real]->p_Object->Class == 1) || (p_Level->Level[real]->p_Object->Class == 13)) return 0; else return 1; } gl_Logical2Real(iPos[0], iPos[1], i - 1, &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class != 12) return 1; } } else return 1; return 1; } int gl_Test_Rule3(ITEMDESC * pItem, int *iPos, LEVELINFO * p_Level) { int real; int ivPos[3]; memcpy((void *) ivPos, (void *) iPos, 3 * sizeof(int)); ivPos[2]--; if (ivPos[2] < 0) return 1; gl_Logical2Real(ivPos[0], ivPos[1], ivPos[2], &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class != 12) return 1; if (!gl_Will_Go_Under_Water(iPos, -1, 0, NULL, p_Level)) return 1; else if (pItem->p_Object->Class == 1) return 0; if (gl_Test_Rule2B(iPos, p_Level)) return 1; return 0; } void gl_Test_Rule4(ITEMDESC * pItem, int *iPos, LEVELINFO * p_Level) { int real; int w = gl_Count_Weight(pItem->Pos, p_Level); if (iPos[2] - 3 >= 0) { gl_Logical2Real(iPos[0], iPos[1], iPos[2] - 3, &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class == 12 && w > 1) p_Level->Throw_off = 1; } } void gl_Walk_Out_Of_Water(int *pos, int iMesh, DWORD dwExpire, LEVELINFO * p_Level) { int real; int iPos[3], i; memcpy((void *) iPos, (void *) pos, 3 * sizeof(int)); iPos[2]--; if (iPos[2] < 0) return; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class == 12) { for (i = 0; i < 100; i++) { if (p_Level->VodniKolaB[i].System && p_Level->VodniKolaB[i].hHnizdo[2] == (size_ptr)iMesh) { if (dwExpire) p_Level->VodniKolaB[i].dwExpire = dwExpire; else p_Level->VodniKolaB[i].hHnizdo[2] = -1; return; } } } } } int gl_Test_Rule5(int *pos, LEVELINFO * p_Level) { int real; int iPos[3]; if (!pos) return 1; iPos[0] = pos[0]; iPos[1] = pos[1]; iPos[2] = pos[2]; iPos[2]--; if (iPos[2] < 0) return 1; //musi pod ni byt voda gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class != 12) return 1; } else return 1; //nesmi pod ni byt bedna iPos[2]--; if (iPos[2] >= 0) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) return 1; } return 0; } int gl_TestRule7(ITEMDESC * pItem, int *pos, LEVELINFO * p_Level) { int real; int iPos[3]; memcpy((void *) iPos, (void *) pos, 3 * sizeof(int)); iPos[2]--; if (iPos[2] < 0) return 1; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if ((p_Level->Level[real]->p_Object->Class == 12) && (pItem->p_Object->Class == 1)) { iPos[2]--; if (iPos[2] >= 0) { int rtest_pos; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &rtest_pos, p_Level); if (!p_Level->Level[rtest_pos]) return 0; else { switch (p_Level->Level[rtest_pos]->p_Object->Class) { case 1: case 13: case 4: return 0; break; default: return 1; break; } } } } } else return 1; return 1; } int gl_Test_Rule8(int *Old_Pos, int *New_Pos, LEVELINFO * p_Level) { ITEMDESC *pItem; int iVoda, iBottom; int from[3]; char bSnorchl; gl_Is_There_Beatle(Old_Pos, &pItem, p_Level); if (pItem) if (pItem->p_Back_Pack->item[0]) bSnorchl = 1; else bSnorchl = 0; else return 1; iBottom = gl_Find_Bottom(New_Pos, &iVoda, p_Level); if (iBottom < 0) iBottom = 0; from[2] = iBottom; from[0] = New_Pos[0]; from[1] = New_Pos[1]; iVoda = gl_Is_There_Water(from, New_Pos, p_Level); if (iVoda == -1) { int iTmp = New_Pos[2]; New_Pos[2] = pItem->Pos[2]; iVoda = gl_Is_There_Water(from, New_Pos, p_Level); New_Pos[2] = iTmp; } if (!iVoda) return 1; if ((pItem->Pos[2] - New_Pos[2] < iVoda - iBottom) && !bSnorchl) return 0; return 1; } //------------------------------------------------------------------------------------------------ // move item //------------------------------------------------------------------------------------------------ long gl_Move_Item(int *iValue_old, int *iValue, long Item, LEVELINFO * p_Level) { int i; int real_p; int iValue_new[3], ret; int real_pos; int Vrstva = p_Level->Level[Item]->Pos[2]; OBJECTDESC *p_ItemO = p_Level->Level[Item]->p_Object; OBJECTDESC *p_real_pO = NULL, *p_real_posO = NULL; ITEMDESC *p_real_pI = NULL, *p_real_posI = NULL; gl_Logical2Real(iValue[0], iValue[1], iValue[2], &real_pos, p_Level); Vrstva -= 2; if (Vrstva > p_Level->Size[2] - 1) return -1; if (Vrstva >= 0) { gl_Logical2Real(iValue[0], iValue[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; if (p_real_pI) p_real_pO = p_real_pI->p_Object; } // zkontroluje, zda nechci prvek posunout mimo hranice for (i = 0; i < 3; i++) if ((iValue[i] > (p_Level->Size[i] - 1)) || (iValue[i] < 0)) return -1; // nachazi se na miste, kam chci prvek posunout jiny prvek? //- ne if (!p_Level->Level[real_pos]) { // muze se prvek vubec posouvat? if (!p_Level->Move_Exeption) if ((p_ItemO->Class != 1) && (p_ItemO->Class != 5) && (p_ItemO->Class != 6) && (p_ItemO->Class != 19) && (p_ItemO->Class != 20)) return -1; if ((iValue[2] - 1) >= 0) { gl_Logical2Real(iValue[0], iValue[1], iValue[2] - 1, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; } if ((iValue[2] - 1) >= 0) if (p_real_pI) { p_real_pO = p_Level->Level[real_p]->p_Object; // test na propadlo if (p_real_pO->Class == 15) { int iTest[3]; int test_pos; int w; OBJECTDESC *p_test_posO; iTest[0] = iValue[0]; iTest[1] = iValue[1]; iTest[2] = iValue[2] - 1; if (!gl_Test_Rule1B(p_Level->Level[Item], iTest, p_Level)) return -1; w = gl_Count_Weight(iValue, p_Level); if (w > 1) { // zkontroluju, jestli to neoporuje pravidlum for (i = Vrstva; i > 0; i -= 2) { gl_Logical2Real(iValue[0], iValue[1], i, &test_pos, p_Level); p_test_posO = p_Level->Level[test_pos]->p_Object; if (p_Level->Level[test_pos]) if ((p_test_posO->Class == 1) || (p_test_posO->Class == 13)) return -1; } // musi se setrasat p_Level->Throw_off = 1; } } // test na prah if ((p_real_pO->Class == 3) && (p_ItemO->Class == 6) && (p_ItemO->SubClass)) { // znic vybusninu gl_Destroy_Item(Item, 0, p_Level); queue_set[p_Level->Actual_Qset].last++; gl_Throw_off(iValue_old, p_Level); p_Level->Column[0] = iValue_old[0]; p_Level->Column[1] = iValue_old[1]; p_Level->Column[2] = iValue_old[2] + (gl_Get_Column_Height(iValue_old[0], iValue_old[1], iValue_old[2] - 1, p_Level) - 2) * 2; if (p_Level->Column[2] < 0) p_Level->Column[2] = 0; p_Level->bColumn++; // znic prah gl_Destroy_Item(real_p, 2, p_Level); p_Level->bDemoSaveExeption = 1; return -1; } if ((p_real_pO->Class == 3) && (p_ItemO->Class != 1)) return -1; // test na exit if ((p_real_pO->Class == 4) && (p_ItemO->Class != 1)) return -1; // test na hrebik if ((p_real_pO->Class == 16) && (p_ItemO->Class != 1)) { gl_Hrebik(p_real_pI); return -1; } // posouvam berusku na vodu if ((p_real_pO->Class == 12) && (p_ItemO->Class == 1) && !p_Level->Move_Exeption) { int iPos[3]; memcpy((void *) iPos, (void *) p_real_pI->Pos, 3 * sizeof(int)); iPos[2]--; if (iPos[2] >= 0) { int rtest_pos; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &rtest_pos, p_Level); if (!p_Level->Level[rtest_pos]) { iPos[2]--; if (iPos[2] >= 0) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &rtest_pos, p_Level); if (!p_Level->Level[rtest_pos]) return -1; else if (p_Level->Level[rtest_pos]->p_Object->Class != 4) return -1; } } else if (p_Level->Level[rtest_pos]->p_Object->Class == 1 || p_Level->Level[rtest_pos]->p_Object->Class == 13) return -1; } } if ((p_real_pO->Class == 12) && (p_ItemO->Class != 1)) { float fpos[3]; int rot; if (!gl_Test_Rule3(p_Level->Level[Item], iValue, p_Level)) return -1; kom_mesh_get_float(p_Level->Level[Item]->Index_Of_Game_Mesh, &fpos[0], &fpos[1], &fpos[2], &rot); am_Kola_na_VodeB(fpos, 0, p_Level->Level[Item]->Index_Of_Game_Mesh, 0, p_Level); if (!gl_Test_Rule5(iValue, p_Level)) p_Level->Throw_off = 1; } // test dveri if (p_real_pO->Class == 8) { if ((p_real_pO->SubClass > 12) && (p_real_pO->SubClass < 19) && (p_ItemO->Class != 1)) return -1; if (!gl_Gate_Keeper(real_p, iValue_old, p_Level)) return -1; } } // muze prvek spadnout? if (Vrstva >= 0) { gl_Logical2Real(iValue[0], iValue[1], iValue[2] - 1, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; if (!p_real_pI) { gl_Logical2Real(iValue[0], iValue[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; if (!p_real_pI) { gl_Logical2Real(iValue[0], iValue[1], Vrstva - 1, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; //muze ale chodit po exitu a teleportu if (Vrstva - 1 > -1) { if (p_real_pI) { if (p_real_pI->p_Object->Class != 4 && p_real_pI->p_Object->Class != 8) p_real_pI = NULL; } else p_real_pI = NULL; } else p_real_pI = NULL; } //ano if (!p_real_pI) { if (!gl_Test_Rule8(iValue_old, iValue, p_Level)) return -1; // jestli je to brouk, tak to nejde, protoze ten spadnout nesmi if (p_ItemO->Class == 1 && !p_Level->Move_Exeption) return -1; // zkontroluju, jestli to neoporuje pravidlum for (i = Vrstva; i > 0; i -= 2) { gl_Logical2Real(iValue[0], iValue[1], i, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; if (p_real_pI) { if (p_real_pI->p_Object->Class == 1) { float pos[3]; //int wave; int rot; kom_mesh_get_float(p_Level->Level[real_p]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); /* wave = gl_Choose_Wave_Index(13); if (!adas_Is_Sound_Processed(12,-1) && !adas_Is_Sound_Processed(13,-1) && !adas_Is_Sound_Processed(14,-1)) ap_Play_Sound(0,0,pos,wave,NULL,p_Level->p_ad); */ return -1; } if ((p_real_pI->p_Object->Class == 19) || (p_real_pI->p_Object->Class == 20) || (p_real_pI->p_Object->Class == 13)) return -1; } } // musi se setrasat if (!p_Level->Move_Exeption) p_Level->Throw_off = 1; goto Move_Forward; } else { if (!gl_Test_Rule1(p_Level->Level[Item], p_real_pI, p_Level)) return -1; // beruska sice spadnout nemuze, ale taky se na ni nesmi nic nasunout, // nebo stoupnout na zada p_real_pO = p_real_pI->p_Object; if ((p_real_pO->Class == 1) || (p_real_pO->Class == 13)) return -1; //p_Level->Throw_off = 1; } } } Move_Forward: Vrstva = iValue[2] - 2; if (Vrstva >= 0) { gl_Logical2Real(iValue[0], iValue[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; if (p_real_pI) { if ((p_real_pI->p_Object->Class == 20) && (p_ItemO->Class != 1)) return -1; //pokud je pod predmetem pontonka, tak mozna je tam voda a musi se to setrast if (p_real_pI->p_Object->Class == 5 && p_real_pI->p_Object->SubClass == 3) { gl_Test_Rule4(p_Level->Level[Item], p_Level->Level[Item]->Pos, p_Level); gl_Test_Rule4(p_Level->Level[Item], iValue, p_Level); } //----------------------------------------------------------------------------------- // posun po sikmine dolu //----------------------------------------------------------------------------------- if (p_real_pI->p_Object->Class == 19) { int dest_pos; int Move[3], dest[3], m; ITEMDESC *p_destI; p_Level->bSikminaMoveExeption = 1; gl_Get_Move(iValue_old, iValue, Move); if (!Move[0]) { if ((Move[1] > 0) && (!p_real_pI->Rotation)) goto Move_OK_B; if ((Move[1] < 0) && (p_real_pI->Rotation == 2)) goto Move_OK_B; return -1; } else { if ((Move[0] > 0) && (p_real_pI->Rotation == 1)) goto Move_OK_B; if ((Move[0] < 0) && (p_real_pI->Rotation == 3)) goto Move_OK_B; return -1; } Move_OK_B: gl_Walk_Out_Of_Water(iValue_old, p_Level->Level[Item]->Index_Of_Game_Mesh, 600, p_Level); for (m = 0; m < 3; m++) dest[m] = iValue_old[m]; dest[2]--; gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); if (p_Level->Level[dest_pos]) if (p_Level->Level[dest_pos]->p_Object->Class == 12) if (!gl_Can_Go_Into_Water(p_Level->Level[Item])) return -1; for (m = 0; m < 3; m++) dest[m] = iValue_old[m] + (2 * Move[m]); dest[2] -= 2; if (dest[2] - 2 > 0) { gl_Logical2Real(dest[0], dest[1], dest[2] - 2, &dest_pos, p_Level); p_destI = p_Level->Level[dest_pos]; if (!p_destI) { p_Level->Column[0] = dest[0]; p_Level->Column[1] = dest[1]; p_Level->Column[2] = dest[2]; p_Level->Throw_off = 1; } } p_Level->bSikminaUp = 0; p_Level->bSikminaDown = 1; //posunuju brouka na sikminu if (p_ItemO->Class == 1) { if (dest[2] - 2 > 0) { gl_Logical2Real(dest[0], dest[1], dest[2] - 2, &dest_pos, p_Level); p_destI = p_Level->Level[dest_pos]; if (!p_destI) return -1; } gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); p_destI = p_Level->Level[dest_pos]; if (!p_destI) { //normalni posun. na destinaci neni nic BEATLE_MOVE_B: p_Level->Level[dest_pos] = p_Level->Level[Item]; p_destI = p_Level->Level[dest_pos]; p_Level->Level[Item] = 0; p_Level->Actual_Item = dest_pos; p_destI->Pos[0] = dest[0]; p_destI->Pos[1] = dest[1]; p_destI->Pos[2] = dest[2]; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level->Actual_Item]->Rotation + 14], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 0, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); if (p_Level->bSunuti) { gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 1, 2, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); } /* if(p_Level->bSunuti) rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_mesh, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 1, (void *)p_Level->Level[p_Level->Actual_Item]->Rotation);*/ p_set->last++; p_set->animation[p_set->last].bnext++; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level->Actual_Item]->Rotation + 65], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; if (!p_Level->bSunuti) gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Set_Flek_Flag, p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 0, 0); /* if(!p_set->last && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run);*/ p_Level->bVypniFlek = 1; p_Level->bSikminaSound = 1; p_Level->bSunuti = 0; am_Destroy_Steps(p_Level->Level[Item], p_Level); return p_Level->Actual_Item; } else { if (p_destI->p_Object->Class == 13) { POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { pS->p_Level = p_Level; pS->iParam = p_Level->Level[dest_pos]->iItem; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Take_Item, p_Level->Level[dest_pos]->Index_Of_Game_Mesh, p_Level->Level[dest_pos]->p_Object->SubClass, reinterpret_cast(pS), 70, 0); } //na destinace je predmet if (!gl_Take_Item(dest_pos, Item, p_Level, 0, 0)) { free((void *) pS); am_Set_Triger_Function(&p_set->animation[p_set->last], NULL, 0, 0, 0, 1, 0); return -1; } gl_Destroy_Item(dest_pos, 1, p_Level); goto BEATLE_MOVE_B; } if (p_destI->p_Object->Class == 5) { NORMAL_BEATLE_ITEM_MOVE_B: //je tam dedna int next_dest[3]; int weight = 0, cweight; int Lnext_dest; weight = 0; for (m = 0; m < 3; m++) next_dest[m] = dest[m]; //zvazim 4 sloupce za sikminou (4 kvuli prasku, jinak bych vazil 2) for (m = 0; m < 3; m++) { cweight = gl_Count_Weight(next_dest, p_Level); if (!cweight) break; weight += cweight; next_dest[0] += Move[0]; next_dest[1] += Move[1]; next_dest[2] += Move[2]; if ((next_dest[0] < 0) || (next_dest[0] >= p_Level->Size[0])) break; if ((next_dest[1] < 0) || (next_dest[1] >= p_Level->Size[1])) break; } //pokud veci za sikminou vazi vic, nez je povoleno, tak fuj if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; gl_Logical2Real(dest[0], dest[1], dest[2], &Lnext_dest, p_Level); if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level->Actual_Item]->Rotation + 6], &p_set->animation[p_set->last].flag); if (gl_Is_Move_Possible(dest, next_dest, p_Level)) { weight = gl_Move_Item(dest, next_dest, Lnext_dest, p_Level); if (weight < 0) return -1; } else return -1; next_dest[0] = dest[0]; next_dest[1] = dest[1]; next_dest[2] = dest[2] - 2; if (next_dest[2] >= 0) { gl_Logical2Real(next_dest[0], next_dest[1], next_dest[2], &Lnext_dest, p_Level); if (p_Level->Level[Lnext_dest]) am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Play_Sunuti, p_Level->Level[Lnext_dest]->p_Object->Material, 0, reinterpret_cast(p_Level), 55, 4); else am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Play_Sunuti, -1, 0, reinterpret_cast(p_Level), 55, 4); } else am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Play_Sunuti, -1, 0, reinterpret_cast(p_Level), 55, 4); p_set->last++; p_Level->bSunuti = 1; goto BEATLE_MOVE_B; } if (p_destI->p_Object->Class == 6) { //je tam vybusnina int next_dest[3]; int Lnext_dest, Ldest; POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; // jestlize tou vybusninou neni co vyhodit, tak skoc na normalni posun if (!gl_Count_Weight(next_dest, p_Level)) goto NORMAL_BEATLE_ITEM_MOVE_B; gl_Logical2Real(dest[0], dest[1], dest[2], &Ldest, p_Level); gl_Logical2Real(next_dest[0], next_dest[1], next_dest[2], &Lnext_dest, p_Level); if ((p_Level->Level[Ldest]->p_Object->SubClass != 1) && (p_Level->Level[Lnext_dest]->p_Object->Class != 5)) return -1; if ((p_Level->Level[Ldest]->p_Object->SubClass == 1) && ((p_Level->Level[Lnext_dest]->p_Object->Class != 5) && (p_Level->Level[Lnext_dest]->p_Object->Class != 6))) return -1; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 39], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); /* rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_mesh, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0, (void *)p_Level->Level[p_Level->Actual_Item]->Rotation);*/ p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 61], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Set_Flek_Flag, p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 0, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); if (pS) { memcpy(pS->viParam1, dest, 3 * sizeof(int)); memcpy(pS->viParam2, next_dest, 3 * sizeof(int)); pS->p_Level = p_Level; pS->pParam = (void *) p_set; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_ExplozeBednyZaSikminou, Ldest, Lnext_dest, reinterpret_cast(pS), 1, 0); p_set->last++; } else { int lc; // znic vybusnimu gl_Destroy_Item(Ldest, 4, p_Level); p_set->last++; gl_Throw_off(dest, p_Level); p_Level->Column[0] = dest[0]; p_Level->Column[1] = dest[1]; p_Level->Column[2] = dest[2] + (gl_Get_Column_Height(dest[0], dest[1], dest[2] - 1, p_Level) - 2) * 2; if (p_Level->Column[2] < 0) lc = 0; else lc = p_Level->Column[2]; p_Level->bColumn++; // znic bednu gl_Destroy_Item(Lnext_dest, 3, p_Level); gl_Throw_off(next_dest, p_Level); p_Level->Column[2] = lc; p_Level->SecColumn[0] = next_dest[0]; p_Level->SecColumn[1] = next_dest[1]; p_Level->SecColumn[2] = next_dest[2] + (gl_Get_Column_Height(next_dest[0], next_dest[1], next_dest[2] - 1, p_Level) - 2) * 2; p_Level->bSecColumn++; p_Level->bCheckDependencesNeeded = 1; } p_Level->bSikminaSound = 1; p_Level->bVypniFlek = 1; p_Level->bSunuti = 1; am_Destroy_Steps(p_Level->Level[Item], p_Level); return p_Level->Actual_Item; } if (p_destI->p_Object->Class == 7) { //je tam kamen int Ldest; POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (p_Level->Item_Lock || p_Level->Flip) return -1; if (!p_Level->Level[Item]->p_Back_Pack->item[8]) return -1; p_Level->Level[Item]->p_Back_Pack->item[8]--; p_Level->Level[Item]->p_Back_Pack->Count_of_Items--; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } //chuze dolu p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 86], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_meshK, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 1, p_Level->Level[p_Level->Actual_Item]->Rotation); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, 0, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 2, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); //buchanec p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[77], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); /*am_Set_Start_Function(&p_set->animation[p_set->last], anmend_PlayKrumpac, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0, NULL, 0); */ gl_Logical2Real(dest[0], dest[1], dest[2], &Ldest, p_Level); if (pS) { pS->p_Level = p_Level; pS->viParam1[0] = Ldest; pS->viParam1[1] = 0; pS->viParam1[2] = 0; pS->viParam2[0] = p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh; pS->viParam2[1] = 0; pS->viParam2[2] = p_Level->Level[p_Level->Actual_Item]->Rotation; rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_KamenZaSikmonou, 0, 0, reinterpret_cast(pS)); } else kprintf(1, "FATAL ERROR - nejde udelat pamet na data ukoncovaci funkce"); /*am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Kamen, Ldest, 0, (void *)p_Level, 50, 0); */ /*rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_mesh, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0, (void *)p_Level->Level[p_Level->Actual_Item]->Rotation); */ //chuze spatky p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 90], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Set_Flek_Flag, p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 0, 0); p_set->last += 2; p_Level->bSikminaSound = 1; p_Level->bVypniFlek = 1; p_Level->bStoneSound = 1; return p_Level->Actual_Item; } return -1; } } if (p_ItemO->Class == 5) { int item_pos[3]; int p_sikmina; int weight; gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); p_destI = p_Level->Level[dest_pos]; //nad bednou nesmi nikdo byt item_pos[0] = p_Level->Level[Item]->Pos[0]; item_pos[1] = p_Level->Level[Item]->Pos[1]; item_pos[2] = p_Level->Level[Item]->Pos[2]; // kdyz to moc vazi, tak exit weight = gl_Count_Weight(item_pos, p_Level); if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; item_pos[2] += 2; // nad bednou nesmi nic byt if (item_pos[2] <= p_Level->Size[2]) { gl_Logical2Real(item_pos[0], item_pos[1], item_pos[2], &p_sikmina, p_Level); if (p_Level->Level[p_sikmina]) return -1; } if (!p_destI) { //normalni posun. na destinaci neni nic int p_tmp; int p_sikmina; ITEMDESC *p_sikminaI; int item_pos[3]; NORMAL_BEATLE_ITEM_MOVE__B: item_pos[0] = p_Level->Level[Item]->Pos[0] + Move[0]; item_pos[1] = p_Level->Level[Item]->Pos[1] + Move[1]; item_pos[2] = p_Level->Level[Item]->Pos[2]; item_pos[2] -= 2; gl_Logical2Real(item_pos[0], item_pos[1], item_pos[2], &p_sikmina, p_Level); p_sikminaI = p_Level->Level[p_sikmina]; p_Level->Level[dest_pos] = p_Level->Level[Item]; p_destI = p_Level->Level[dest_pos]; p_Level->Level[Item] = 0; p_destI->Pos[0] = dest[0]; p_destI->Pos[1] = dest[1]; p_destI->Pos[2] = dest[2]; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].flag = 0; } else { p_set->last++; } //Test jestli za tim jeste neni hned dira item_pos[0] += Move[0]; item_pos[1] += Move[1]; item_pos[2] -= 2; gl_Logical2Real(item_pos[0], item_pos[1], item_pos[2], &p_tmp, p_Level); if (item_pos[2] < 0) p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[(p_sikminaI->Rotation * 2) + 26], &p_set->animation[p_set->last].flag); else if (p_Level->Level[p_tmp]) p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[(p_sikminaI->Rotation * 2) + 26], &p_set->animation[p_set->last].flag); else p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[(p_sikminaI->Rotation) + 73], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; p_set->last++; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[(p_sikminaI->Rotation * 2) + 27], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); p_set->animation[p_set->last].bnext = 1; rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; /* if(!p_set->last && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run);*/ p_set->last++; p_Level->Sikmina_Flag++; p_Level->bSikminaUp = -1; p_Level->bExtraSoundSunuti = 2; am_Destroy_Steps(p_Level->Level[Item], p_Level); return dest_pos; } else { //na destinaci je predmet int next_dest[3], m, cweight; int rpos; ITEMDESC *p_rposI; for (m = 0; m < 3; m++) next_dest[m] = dest[m]; //zvazim 4 sloupce za sikminou (4 kvuli prasku, jinak bych vazil 2) for (m = 0; m < 3; m++) { gl_Logical2Real(next_dest[0], next_dest[1], next_dest[2], &rpos, p_Level); p_rposI = p_Level->Level[rpos]; if (p_rposI) if (p_rposI->p_Object->Class == 1) return -1; cweight = gl_Count_Weight(next_dest, p_Level); if (!cweight) break; weight += cweight; next_dest[0] += Move[0]; next_dest[1] += Move[1]; next_dest[2] += Move[2]; if ((next_dest[0] < 0) || (next_dest[0] >= p_Level->Size[0])) break; if ((next_dest[1] < 0) || (next_dest[1] >= p_Level->Size[1])) break; } //pokud veci za sikminou vazi vic, nez je povoleno, tak fuj if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; // posun sloupce za sikminou gl_Logical2Real(dest[0], dest[1], dest[2], &p_sikmina, p_Level); if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level->Actual_Item]->Rotation + 6], &p_set->animation[p_set->last].flag); if (gl_Is_Move_Possible(dest, next_dest, p_Level)) { weight = gl_Move_Item(dest, next_dest, p_sikmina, p_Level); if (weight < 0) return -1; } else return -1; goto NORMAL_BEATLE_ITEM_MOVE__B; } } if (p_ItemO->Class == 6) { //tlasim vybusninu int item_pos[3]; int p_sikmina; ITEMDESC *p_sikminaI; //nad bednou nesmi nikdo byt item_pos[0] = p_Level->Level[Item]->Pos[0]; item_pos[1] = p_Level->Level[Item]->Pos[1]; item_pos[2] = p_Level->Level[Item]->Pos[2]; item_pos[2] += 2; // nad bednou nesmi nic byt if (item_pos[2] <= p_Level->Size[2]) { gl_Logical2Real(item_pos[0], item_pos[1], item_pos[2], &p_sikmina, p_Level); if (p_Level->Level[p_sikmina]) return -1; } item_pos[0] = p_Level->Level[Item]->Pos[0] + Move[0]; item_pos[1] = p_Level->Level[Item]->Pos[1] + Move[1]; item_pos[2] = p_Level->Level[Item]->Pos[2] - 2; gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); gl_Logical2Real(item_pos[0], item_pos[1], item_pos[2], &p_sikmina, p_Level); p_sikminaI = p_Level->Level[p_sikmina]; p_destI = p_Level->Level[dest_pos]; if (!p_destI) goto NORMAL_BEATLE_ITEM_MOVE__B; if ((p_ItemO->SubClass != 1) && (p_destI->p_Object->Class != 5)) return -1; if ((p_ItemO->SubClass == 1) && ((p_destI->p_Object->Class != 5) && (p_destI->p_Object->Class != 6))) return -1; // znic vybusnimu item_pos[0] = p_Level->Level[Item]->Pos[0]; item_pos[1] = p_Level->Level[Item]->Pos[1]; item_pos[2] = p_Level->Level[Item]->Pos[2]; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].flag = 0; } else { p_set->last++; } p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[(p_sikminaI->Rotation * 2) + 26], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[Item]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[Item]->Index_Of_Game_Mesh; /* if(!p_set->last && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run);*/ rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_ExplozeBedny, p_Level->Level[Item]->Index_Of_Game_Mesh, dest_pos, reinterpret_cast(p_Level)); p_set->last++; p_Level->Sikmina_Flag++; p_Level->Throw_off = 1; p_Level->bSikminaUp = -1; am_Destroy_Steps(p_Level->Level[Item], p_Level); gl_Destroy_Item(Item, 1, p_Level); return Item; } return -1; } } } //nove !!!(mozno nepojede v poho)!!! if (p_Level->Level[Item]->p_Object->Class != 1 && p_Level->Level[Item]->p_Object->Class != 13 && iValue_old[2] + 2 < p_Level->Size[2]) { Vrstva = iValue_old[2] + 2; iValue_new[0] = iValue_old[0]; iValue_new[1] = iValue_old[1]; iValue_new[2] = Vrstva; // zkusi posunout dedny nad ni gl_Logical2Real(iValue_old[0], iValue_old[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; // pokud je nad ni bedna, posun ji if (Vrstva < p_Level->Size[2] && Vrstva > 0) if (p_real_pI) { int iValue_new1[3]; int test_pos; // postupuj az ke stropu while (Vrstva < p_Level->Size[2]) { iValue_new1[0] = iValue[0]; iValue_new1[1] = iValue[1]; iValue_new1[2] = Vrstva; gl_Logical2Real(iValue_old[0], iValue_old[1], Vrstva - 1, &test_pos, p_Level); // nepostupuj pres vytah, atd... if (p_Level->Level[test_pos]) if (p_Level->Level[test_pos]->p_Object->Class != 12) break; if (p_real_pI->p_Object->Class == 2) break; p_Level->LastMesh = p_Level->Level[Item]->Index_Of_Game_Mesh; p_Level->Move_Exeption = 1; ret = gl_Move_Item(iValue_new, iValue_new1, real_p, p_Level); p_Level->Move_Exeption = 0; // jestlize se bedna neda posunou, ukonci if (ret < 0) { gl_Logical2Real(iValue[0], iValue[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; if (p_real_pI) return -1; } Vrstva += 2; if (Vrstva > (p_Level->Size[2] - 1)) break; iValue_new[2] += 2; gl_Logical2Real(iValue_old[0], iValue_old[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; // jestlize vis uz nic neni,tak ukonci if (!p_real_pI) break; } } } p_Level->Level[real_pos] = p_Level->Level[Item]; gl_Get_Move(iValue_old, iValue, iValue_new); if (p_Level->Level[real_pos]->p_Object->Class == 13) { p_set->PrivazanyMesh[p_set->pMesh].TopMesh = p_Level->LastMesh; p_set->PrivazanyMesh[p_set->pMesh].LowMesh = p_Level->Level[real_pos]->Index_Of_Game_Mesh; p_set->pMesh++; } else p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[real_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[real_pos]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[real_pos]->Index_Of_Game_Mesh; p_real_posI = p_Level->Level[real_pos]; p_real_posI->Pos[0] = iValue[0]; p_real_posI->Pos[1] = iValue[1]; p_real_posI->Pos[2] = iValue[2]; am_Destroy_Steps(p_Level->Level[Item], p_Level); p_Level->Level[Item] = 0; if (!p_Level->bColumn) { p_Level->Column[0] = iValue[0]; p_Level->Column[1] = iValue[1]; p_Level->Column[2] = iValue[2]; p_Level->bColumn++; } if (p_real_posI->p_Object->Class == 5 || p_real_posI->p_Object->Class == 6) p_Level->bSunuti = 1; return real_pos; } else { //----- ano gl_Logical2Real(iValue_old[0], iValue_old[1], iValue_old[2] - 2, &real_p, p_Level); if ((iValue_old[2] - 2) >= 0) { p_real_pI = p_Level->Level[real_p]; if (p_real_pI) p_real_pO = p_real_pI->p_Object; } p_real_posI = p_Level->Level[real_pos]; // posouvam berusku na vodu if (!gl_TestRule7(p_Level->Level[Item], iValue, p_Level)) return -1; //------------------------------------------------------------------------------------- // sune se na sikminu //------------------------------------------------------------------------------------- if ((p_real_posI->p_Object->Class == 19) || (p_real_posI->p_Object->Class == 20)) { int dest_pos; int Move[3], dest[3], m; ITEMDESC *p_destI; gl_Get_Move(iValue_old, iValue, Move); p_Level->bSikminaMoveExeption = 1; if (!Move[0]) { if ((Move[1] > 0) && (p_real_posI->Rotation == 2)) goto Move_OK; if ((Move[1] < 0) && (!p_real_posI->Rotation)) goto Move_OK; return -1; } else { if ((Move[0] > 0) && (p_real_posI->Rotation == 3)) goto Move_OK; if ((Move[0] < 0) && (p_real_posI->Rotation == 1)) goto Move_OK; return -1; } Move_OK: gl_Walk_Out_Of_Water(iValue_old, p_Level->Level[Item]->Index_Of_Game_Mesh, 400, p_Level); if ((p_real_posI->p_Object->Class == 20) && (p_ItemO->Class != 1)) return -1; for (m = 0; m < 3; m++) dest[m] = iValue_old[m] + (2 * Move[m]); dest[2] += 2; p_Level->bSikminaUp = 1; //posunuju brouka na sikminu if (p_ItemO->Class == 1) { gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); p_destI = p_Level->Level[dest_pos]; if (!p_destI) { //normalni posun. na destinaci neni nic BEATLE_MOVE: p_Level->Level[dest_pos] = p_Level->Level[Item]; p_destI = p_Level->Level[dest_pos]; p_Level->Level[Item] = 0; p_Level->Actual_Item = dest_pos; p_destI->Pos[0] = dest[0]; p_destI->Pos[1] = dest[1]; p_destI->Pos[2] = dest[2]; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 10], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 0, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); if (p_Level->bSunuti) gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, 2, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); /* if(p_Level->bSunuti) rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_mesh, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 1, (void *)p_Level->Level[p_Level->Actual_Item]->Rotation);*/ p_set->last++; p_set->animation[p_set->last].bnext++; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 69], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; if (!p_Level->bSunuti) gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Set_Flek_Flag_Anim, p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 0, 0); /* if(!p_set->last && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run);*/ p_Level->bVypniFlek = 1; p_Level->bSikminaSound = 1; p_Level->bSunuti = 0; am_Destroy_Steps(p_Level->Level[Item], p_Level); return p_Level->Actual_Item; } else { if (p_destI->p_Object->Class == 13) { POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { pS->p_Level = p_Level; pS->iParam = p_Level->Level[dest_pos]->iItem; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Take_Item, p_Level->Level[dest_pos]->Index_Of_Game_Mesh, p_Level->Level[dest_pos]->p_Object->SubClass, reinterpret_cast(pS), 70, 0); } //na destinace je predmet if (!gl_Take_Item(dest_pos, Item, p_Level, 0, 0)) { free((void *) pS); am_Set_Triger_Function(&p_set->animation[p_set->last], NULL, 0, 0, 0, 1, 0); return -1; } gl_Destroy_Item(dest_pos, 1, p_Level); goto BEATLE_MOVE; } if (p_destI->p_Object->Class == 5) { NORMAL_BEATLE_ITEM_MOVE: //je tam dedna int next_dest[3]; int weight = 0, cweight; int Lnext_dest; for (m = 0; m < 3; m++) next_dest[m] = dest[m]; //zvazim 4 sloupce za sikminou (4 kvuli prasku, jinak bych vazil 2) for (m = 0; m < 3; m++) { cweight = gl_Count_Weight(next_dest, p_Level); /*kprintf(1,"[%d,%d,%d] w = %d", next_dest[0], next_dest[1], next_dest[2], cweight); */ if (!cweight) break; weight += cweight; next_dest[0] += Move[0]; next_dest[1] += Move[1]; next_dest[2] += Move[2]; if ((next_dest[0] < 0) || (next_dest[0] >= p_Level->Size[0])) break; if ((next_dest[1] < 0) || (next_dest[1] >= p_Level->Size[1])) break; } //kprintf(1, "w = %d", weight); //pokud veci za sikminou vazi vic, nez je povoleno, tak fuj if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; // posun sloupce za sikminou gl_Logical2Real(dest[0], dest[1], dest[2], &Lnext_dest, p_Level); if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 6], &p_set->animation[p_set->last].flag); if (gl_Is_Move_Possible(dest, next_dest, p_Level)) { weight = gl_Move_Item(dest, next_dest, Lnext_dest, p_Level); if (weight < 0) return -1; } else return -1; next_dest[0] = dest[0]; next_dest[1] = dest[1]; next_dest[2] = dest[2] - 2; gl_Logical2Real(next_dest[0], next_dest[1], next_dest[2], &Lnext_dest, p_Level); if (p_Level->Level[Lnext_dest]) am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Play_Sunuti, p_Level->Level[Lnext_dest]->p_Object->Material, 0, reinterpret_cast(p_Level), 55, 4); else am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Play_Sunuti, -1, 0, reinterpret_cast(p_Level), 55, 4); p_set->last++; p_Level->bSunuti = 1; goto BEATLE_MOVE; } if (p_destI->p_Object->Class == 6) { //je tam vybusnina int next_dest[3]; int Lnext_dest, Ldest; POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; // jestlize tou vybusninou neni co vyhodit, tak skoc na normalni posun if (!gl_Count_Weight(next_dest, p_Level)) goto NORMAL_BEATLE_ITEM_MOVE; gl_Logical2Real(dest[0], dest[1], dest[2], &Ldest, p_Level); gl_Logical2Real(next_dest[0], next_dest[1], next_dest[2], &Lnext_dest, p_Level); if ((p_ItemO->SubClass != 1) && (p_Level->Level[Lnext_dest]->p_Object->Class != 5)) return -1; if ((p_ItemO->SubClass == 1) && ((p_Level->Level[Lnext_dest]->p_Object->Class != 5) && (p_Level->Level[Lnext_dest]->p_Object->Class != 6))) return -1; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level->Actual_Item]->Rotation + 35], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, 2, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); /* rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_mesh, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0, (void *)p_Level->Level[p_Level->Actual_Item]->Rotation);*/ p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 57], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Set_Flek_Flag, p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 0, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); am_Destroy_Steps(p_Level->Level[Item], p_Level); if (pS) { memcpy(pS->viParam1, dest, 3 * sizeof(int)); memcpy(pS->viParam2, next_dest, 3 * sizeof(int)); pS->p_Level = p_Level; pS->pParam = (void *) p_set; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_ExplozeBednyZaSikminou, Ldest, Lnext_dest, reinterpret_cast(pS), 1, 0); p_set->last++; } else { int lc; // znic vybusnimu gl_Destroy_Item(Ldest, 4, p_Level); p_set->last++; gl_Throw_off(dest, p_Level); p_Level->Column[0] = dest[0]; p_Level->Column[1] = dest[1]; p_Level->Column[2] = dest[2] + (gl_Get_Column_Height(dest[0], dest[1], dest[2] - 1, p_Level) - 2) * 2; if (p_Level->Column[2] < 0) lc = 0; else lc = p_Level->Column[2]; p_Level->bColumn++; // znic bednu gl_Destroy_Item(Lnext_dest, 3, p_Level); gl_Throw_off(next_dest, p_Level); p_Level->Column[2] = lc; p_Level->SecColumn[0] = next_dest[0]; p_Level->SecColumn[1] = next_dest[1]; p_Level->SecColumn[2] = next_dest[2] + (gl_Get_Column_Height(next_dest[0], next_dest[1], next_dest[2] - 1, p_Level) - 2) * 2; p_Level->bSecColumn++; p_Level->bCheckDependencesNeeded = 1; } p_Level->bSikminaSound = 1; p_Level->bVypniFlek = 1; p_Level->bSunuti = 1; Level.bSikminaUpExeption = 1; return p_Level->Actual_Item; } if (p_destI->p_Object->Class == 7) { //je tam kamen POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); int Ldest; if (p_Level->Item_Lock || p_Level->Flip) return -1; if (!p_Level->Level[Item]->p_Back_Pack->item[8]) return -1; p_Level->Level[Item]->p_Back_Pack->item[8]--; p_Level->Level[Item]->p_Back_Pack->Count_of_Items--; if (p_set->animation[p_set->last].p_matrix == -1) rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].flag = 0; //chuze navrch p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 78], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, 0, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 2, p_Level->iWalkAnimation, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_kom_mesh_set_meshK, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 1, p_Level->Level[p_Level->Actual_Item]->Rotation); //buchnuti p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[77], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); /*am_Set_Start_Function(&p_set->animation[p_set->last], anmend_PlayKrumpac, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0, NULL, 0); */ gl_Logical2Real(dest[0], dest[1], dest[2], &Ldest, p_Level); if (pS) { pS->p_Level = p_Level; pS->viParam1[0] = Ldest; pS->viParam1[1] = 0; pS->viParam1[2] = 0; pS->viParam2[0] = p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh; pS->viParam2[1] = 0; pS->viParam2[2] = p_Level->Level[p_Level->Actual_Item]->Rotation; rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_KamenZaSikmonou, 0, 0, reinterpret_cast(pS)); } else kprintf(1, "FATAL ERROR - nejde udelat pamet na data ukoncovaci funkce"); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); //chuze dolu p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 82], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, 0); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Set_Flek_Flag, p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek, 0, 0); p_set->last += 2; p_Level->bSikminaSound = 1; p_Level->bVypniFlek = 1; p_Level->bStoneSound = 1; return p_Level->Actual_Item; } return -1; } } //posunuju bednu na sikminu if (p_ItemO->Class == 5) { int p_sikmina; ITEMDESC *p_sikminaI; int item_pos[3]; int weight; p_sikminaI = p_Level->Level[Item]; // siknima se schodkem -> zadna bedna pred to nemuze if (p_real_posI->p_Object->Class == 20) return -1; gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); p_destI = p_Level->Level[dest_pos]; item_pos[0] = p_Level->Level[Item]->Pos[0]; item_pos[1] = p_Level->Level[Item]->Pos[1]; item_pos[2] = p_Level->Level[Item]->Pos[2]; item_pos[2] += 2; // nad bednou nesmi nic byt if (item_pos[2] <= p_Level->Size[2]) { gl_Logical2Real(item_pos[0], item_pos[1], item_pos[2], &p_sikmina, p_Level); if (p_Level->Level[p_sikmina]) return -1; } // jestlize je to moc tezky, tak exit item_pos[2] -= 2; weight = gl_Count_Weight(item_pos, p_Level); if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; if (!p_destI) { NORMAL_BEATLE_ITEM_MOVE_: //normalni posun. na destinaci neni nic int anm_i = -1; gl_Logical2Real(dest[0], dest[1], dest[2], &dest_pos, p_Level); gl_Logical2Real(iValue[0], iValue[1], iValue[2], &p_sikmina, p_Level); p_sikminaI = p_Level->Level[p_sikmina]; p_Level->Level[dest_pos] = p_Level->Level[Item]; p_destI = p_Level->Level[dest_pos]; p_Level->Level[Item] = 0; p_destI->Pos[0] = dest[0]; p_destI->Pos[1] = dest[1]; p_destI->Pos[2] = dest[2]; if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].flag = 0; } else p_set->last++; switch (p_sikminaI->Rotation) { case 0: anm_i = 22; break; case 1: anm_i = 24; break; case 2: anm_i = 18; break; case 3: anm_i = 20; break; } p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[anm_i], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; p_set->last++; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[anm_i + 1], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_destI->Index_Of_Game_Mesh, 0); p_set->animation[p_set->last].bnext = 1; rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_destI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_destI->Index_Of_Game_Mesh; /* if(!p_set->last && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run);*/ p_set->last++; p_Level->Sikmina_Flag++; p_Level->bSikminaUp = 1; p_Level->bExtraSoundSunuti = 1; am_Destroy_Steps(p_Level->Level[Item], p_Level); return dest_pos; } else { //na destinaci je predmet //ITEMDESC *p_sikminaI = p_Level->Level[Item]; int next_dest[3]; int cweight; if (p_destI->p_Object->Class == 5) { //na destinaci je bedna // jestlize soucet vah je moc velky, tak exit for (m = 0; m < 3; m++) next_dest[m] = dest[m]; //zvazim 4 sloupce za sikminou (4 kvuli prasku, jinak bych vazil 2) for (m = 0; m < 3; m++) { cweight = gl_Count_Weight(next_dest, p_Level); if (!cweight) break; weight += cweight; next_dest[0] += Move[0]; next_dest[1] += Move[1]; next_dest[2] += Move[2]; if ((next_dest[0] < 0) || (next_dest[0] >= p_Level->Size[0])) break; if ((next_dest[1] < 0) || (next_dest[1] >= p_Level->Size[1])) break; } if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; // posun sloupce za sikminou gl_Logical2Real(dest[0], dest[1], dest[2], &p_sikmina, p_Level); if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 6], &p_set->animation[p_set->last].flag); if (gl_Is_Move_Possible(dest, next_dest, p_Level)) { weight = gl_Move_Item(dest, next_dest, p_sikmina, p_Level); if (weight < 0) return -1; } else return -1; goto NORMAL_BEATLE_ITEM_MOVE_; } if (p_destI->p_Object->Class == 6) { //chci vedet, co je za vybusninou for (m = 0; m < 3; m++) next_dest[m] = dest[m] + Move[m]; gl_Logical2Real(next_dest[0], next_dest[1], next_dest[2], &p_sikmina, p_Level); if (!p_Level->Level[p_sikmina]) { weight += gl_Count_Weight(dest, p_Level); if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; } gl_Logical2Real(dest[0], dest[1], dest[2], &p_sikmina, p_Level); if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 6], &p_set->animation[p_set->last].flag); if (gl_Is_Move_Possible(dest, next_dest, p_Level)) { weight = gl_Move_Item(dest, next_dest, p_sikmina, p_Level); if (weight < 0) return -1; } else return -1; } } } if (p_ItemO->Class == 6) { //tlasim vybusninu int Ldest; //int item_pos[3]; int weight; int anm_i = -1; int p_sikmina; ITEMDESC *p_sikminaI; // jestlize tou vybusninou neni co vyhodit, tak skoc na normalni posun weight = gl_Count_Weight(p_Level->Level[Item]->Pos, p_Level); if (weight > p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength) return -1; gl_Logical2Real(dest[0], dest[1], dest[2], &Ldest, p_Level); gl_Logical2Real(iValue[0], iValue[1], iValue[2], &p_sikmina, p_Level); p_sikminaI = p_Level->Level[p_sikmina]; if (!p_Level->Level[Ldest]) goto NORMAL_BEATLE_ITEM_MOVE_; if ((p_ItemO->SubClass != 1) && (p_Level->Level[Ldest]->p_Object->Class != 5)) return -1; if ((p_ItemO->SubClass == 1) && ((p_Level->Level[Ldest]->p_Object->Class != 5) && (p_Level->Level[Ldest]->p_Object->Class != 6))) return -1; // znic vybusnimu /* item_pos[0] = p_Level->Level[Item]->Pos[0]; item_pos[1] = p_Level->Level[Item]->Pos[1]; item_pos[2] = p_Level->Level[Item]->Pos[2]; */ if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].flag = 0; } else p_set->last++; switch (p_sikminaI->Rotation) { case 0: anm_i = 22; break; case 1: anm_i = 24; break; case 2: anm_i = 18; break; case 3: anm_i = 20; break; } p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[anm_i], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[Item]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[Item]->Index_Of_Game_Mesh; /* if(!p_set->last && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run);*/ rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_ExplozeBedny, (int) p_Level->Level[Item]->Index_Of_Game_Mesh, Ldest, reinterpret_cast(p_Level)); p_Level->Sikmina_Flag++; p_Level->bSikminaUp = -1; p_set->last++; p_Level->Throw_off = 1; am_Destroy_Steps(p_Level->Level[Item], p_Level); gl_Destroy_Item(Item, 1, p_Level); return Item; } return -1; } //pokud je pod predmetem pontonka, tak mozna je tam voda a musi se to setrast gl_Kontrola_Pontonky(iValue, p_Level); p_real_posO = p_Level->Level[real_pos]->p_Object; // pokud beruska chce vzit predmet if ((p_ItemO->Class == 1) && (p_real_posO->Class == 13)) { POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { pS->p_Level = p_Level; pS->iParam = p_Level->Level[real_pos]->iItem; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Take_Item, p_Level->Level[real_pos]->Index_Of_Game_Mesh, p_Level->Level[real_pos]->p_Object->SubClass, reinterpret_cast(pS), 1, 0); } //na destinace je predmet if (!gl_Take_Item(real_pos, Item, p_Level, 0, 0)) { free((void *) pS); am_Set_Triger_Function(&p_set->animation[p_set->last], NULL, 0, 0, 0, 1, 0); return -1; } gl_Destroy_Item(real_pos, 1, p_Level); p_Level->Level[real_pos] = p_Level->Level[Item]; p_real_posI = p_Level->Level[real_pos]; gl_Get_Move(iValue_old, iValue, iValue_new); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[real_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[real_pos]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[real_pos]->Index_Of_Game_Mesh; p_real_posI->Pos[0] = iValue[0]; p_real_posI->Pos[1] = iValue[1]; p_real_posI->Pos[2] = iValue[2]; p_Level->Level[Item] = 0; return real_pos; } // pokud posouvam berusku na kamen if ((p_ItemO->Class == 1) && (p_real_posO->Class == 7)) { if (p_Level->Item_Lock || p_Level->Flip) return -1; if (p_Level->Level[Item]->p_Back_Pack->item[8]) { float fpos[3]; int rot; //int mat = gl_Get_Mesh_Material(p_real_posI->Index_Of_Game_Mesh); kom_mesh_get_float(p_real_posI->Index_Of_Game_Mesh, &fpos[0], &fpos[1], &fpos[2], &rot); if (p_set->animation[p_set->last].p_run) { rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].p_run = 0; } p_set->animation[p_set->last].flag = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[77], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Kamen, real_pos, 0, reinterpret_cast(p_Level)); p_set->last++; am_Remove_Beetle_Animation(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, p_Level); gl_Set_3ds_Mesh(1, 1, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[p_Level->Actual_Item]->Rotation); gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 0, 0, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); p_Level->Level[Item]->p_Back_Pack->item[8]--; p_Level->Level[Item]->p_Back_Pack->Count_of_Items--; ap_Play_Sound(0,0,0, fpos, 162 + (rand()%2), NULL, &ad); //gl_Destroy_Item(real_pos,0,p_Level); //gl_Do_Kameni(fpos, p_Level, mat); p_Level->Flip++; gl_Next_Queue_Set(&Level); gl_Go_Animations(); //gl_Throw_off(iValue,p_Level); p_Level->status = 5; p_Level->bAllow_Key = 0; p_Level->bStone = 1; p_Level->Throw_off = 1; p_Level->bDemoSaveExeption = 1; return -1; } } // pokud pousouvam vybusninu, tak to co je predemnou vyhodit? if (p_ItemO->Class == 6) if ((p_real_posO->Class == 5) || ((p_ItemO->SubClass == 1) && ((p_real_posO->Class == 5) || (p_real_posO->Class == 6) || (p_real_posO->Class == 7) || (p_real_posO->Class == 3) || (p_real_posO->Class == 16) ) ) ) { int lc; //jeslize je flip, tak to znamena, ze animac jeste nedobehla a ja bych ji //smazal mesh a spadlo by to, takze nic if (p_Level->Flip) return -1; if (!gl_Check_Detonation_Pack_Water_Rules(p_real_posI->Pos, p_Level)) return -1; // znic vybusninu rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].p_run = 0; gl_Destroy_Item(Item, 4, p_Level); //p_set->last++; gl_Throw_off(iValue_old, p_Level); p_Level->Column[0] = iValue_old[0]; p_Level->Column[1] = iValue_old[1]; p_Level->Column[2] = iValue_old[2] + (gl_Get_Column_Height(iValue_old[0], iValue_old[1], iValue_old[2] - 1, p_Level) - 2) * 2; if (p_Level->Column[2] < 0) lc = 0; else lc = p_Level->Column[2]; p_Level->bColumn++; // znic bednu gl_Destroy_Item(real_pos, 3, p_Level); gl_Throw_off(iValue, p_Level); p_Level->Column[2] = lc; p_Level->SecColumn[0] = iValue[0]; p_Level->SecColumn[1] = iValue[1]; p_Level->SecColumn[2] = iValue[2] + (gl_Get_Column_Height(iValue[0], iValue[1], iValue[2] - 1, p_Level) - 2) * 2; p_Level->bSecColumn++; p_Level->bCheckDependencesNeeded = 1; p_Level->bDemoSaveExeption = 1; return -1; } // pokud je to bedna, nebo vybusnina tak ji posun if ((p_real_posO->Class == 5) || (p_real_posO->Class == 6)) { if (!gl_Test_Rule3(p_Level->Level[Item], iValue, p_Level)) return -1; for (i = 0; i < 3; i++) { iValue_new[i] = iValue[i] - iValue_old[i]; iValue_new[i] += iValue[i]; } // posouva bednu ret = gl_Move_Item(iValue, iValue_new, real_pos, p_Level); //bylo posouvano na sikmine, je treba udelat novou animaci pro predmety pred timto if (p_Level->Sikmina_Flag) { //neni-li to brouk, udelam normalni animaci if (p_Level->Level[Item]->p_Object->Class != 1) { p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation], &p_set->animation[p_set->last].flag); p_Level->Sikmina_Flag = 0; } else //jinak udelam special animaci { if (p_Level->bSikminaUp == 1) { p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 45], &p_set->animation[p_set->last].flag); p_set->last++; p_set->animation[p_set->last].bnext = 1; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 53], &p_set->animation[p_set->last].flag); rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); p_Level->bSunuti = 1; p_Level->bSikminaSound = 2; p_Level->bMultiConnect = 1; } else if (!p_Level->bSikminaUp) { p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation + 49], &p_set->animation[p_set->last].flag); p_Level->bSunuti = 1; p_Level->bSikminaSound = 2; } else { p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[p_Level->Level[p_Level-> Actual_Item]->Rotation], &p_set->animation[p_set->last].flag); p_Level->bSunuti = 1; rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Add_Beetle_Animation, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[p_Level->Actual_Item]->Rotation, reinterpret_cast(p_Level)); } } } // podarilo se ji posunout? if (ret >= 0) { Vrstva += 4; iValue_new[2] += 2; // zkusi posunout dedny nad ni if (Vrstva >= 0 && Vrstva < p_Level->Size[2] && iValue_new[2] < p_Level->Size[2]) { gl_Logical2Real(iValue[0], iValue[1], Vrstva, &real_p, p_Level); p_real_pI = p_Level->Level[real_p]; // pokud je nad ni bedna, posun ji if (p_real_pI) { int iValue_new1[3]; int test_pos; // postupuj az ke stropu while (Vrstva < p_Level->Size[2]) { iValue_new1[0] = iValue[0]; iValue_new1[1] = iValue[1]; iValue_new1[2] = iValue_new[2]; if (p_Level->Level[real_p]->p_Object->Class == 2) break; if (Vrstva - 1 < 0) break; gl_Logical2Real(iValue_old[0], iValue_old[1], Vrstva - 1, &test_pos, p_Level); // nepostupuj pres vytah, atd... if (p_Level->Level[test_pos]) if (p_Level->Level[test_pos]->p_Object->Class != 12) break; p_Level->Move_Exeption = 1; ret = gl_Move_Item(iValue_new1, iValue_new, real_p, p_Level); p_Level->Move_Exeption = 0; // jestlize se bedna neda posunou, ukonci if (ret < 0) { gl_Logical2Real(iValue_old[0], iValue_old[1], Vrstva, &real_p, p_Level); if (p_Level->Level[real_p]) return -1; } Vrstva += 2; if (Vrstva > (p_Level->Size[2] - 1)) break; iValue_new[2] += 2; //???????????????????????????????????????????????????????????????????????????????????????? if (iValue_new[2] > (p_Level->Size[2] - 1)) break; //////////////////////////????????????????????? //???????????????????????????????????????????????????????????????????????????????????????? gl_Logical2Real(iValue[0], iValue[1], Vrstva, &real_p, p_Level); // jestlize vis uz nic neni,tak ukonci if (!p_Level->Level[real_p]) break; } } } p_Level->Level[real_pos] = p_Level->Level[Item]; p_real_posI = p_Level->Level[real_pos]; gl_Get_Move(iValue_old, iValue, iValue_new); if (!p_Level->bMultiConnect) p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_real_posI->Index_Of_Game_Mesh, 0); else { p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_real_posI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh); // p_set->animation[p_set->last].mesh = // Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; p_set->animation[p_set->last - 1].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last - 1].p_run, p_real_posI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last - 1], Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh); // p_set->animation[p_set->last-1].mesh = // Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; gl_Set_3ds_Anim(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, 1, 2, &p_Level->Level[p_Level->Actual_Item]->_3ds_flag, 0, 0, 0); /* rani_pripoj_funkci(p_set->animation[p_set->last-1].p_run, anmend_kom_mesh_set_mesh, p_real_posI->Index_Of_Game_Mesh, 0, (void *)p_real_posI->Rotation);*/ p_Level->bMultiConnect = 0; } gl_Add_Mesh(&p_set->animation[p_set->last], p_real_posI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_real_posI->Index_Of_Game_Mesh; p_real_posI->Pos[0] = iValue[0]; p_real_posI->Pos[1] = iValue[1]; p_real_posI->Pos[2] = iValue[2]; am_Destroy_Steps(p_Level->Level[Item], p_Level); p_Level->Level[Item] = 0; return real_pos; } // nelze posunout return -1; } } return -1; } //------------------------------------------------------------------------------------------------ // zjisti vahu od urcite vrstvy //------------------------------------------------------------------------------------------------ int gl_Count_Weight(int *column, LEVELINFO * p_Level) { int i, weight = 0; int real_pos; OBJECTDESC *p_real_posO; for (i = column[2]; i < p_Level->Size[2]; i += 2) { //real_pos = column[0] + column[1]*p_Level->Size[0] + i*p_Level->Size[0]*p_Level->Size[1]; gl_Logical2Real(column[0], column[1], i, &real_pos, p_Level); if (p_Level->Level[real_pos]) { p_real_posO = p_Level->Level[real_pos]->p_Object; if (p_real_posO->Class == 2) break; if (p_real_posO->Class == 1) { weight++; if (p_Level->Level[real_pos]->p_Back_Pack->item[7]) weight++; } if ((p_real_posO->Class == 5) && (!p_real_posO->SubClass)) weight += 2; if ((p_real_posO->Class == 5) && (p_real_posO->SubClass)) weight++; if (p_real_posO->Class == 6) weight += 2; if (p_real_posO->Class == 7) weight += 2; if (p_real_posO->Class == 17) weight += 2; if (p_real_posO->Class == 13) weight++; } else break; } return weight; } int gl_Stlac_Tlacitko(ITEMDESC * pTlacitko, char *bPowerOn, LEVELINFO * p_Level) { int pos[3]; int r; char off; *bPowerOn = -1; memcpy((void *) pos, (void *) pTlacitko->Pos, 3 * sizeof(int)); pos[2]++; gl_Logical2Real(pos[0], pos[1], pos[2], &r, p_Level); if ((p_Level->Level[r] && pTlacitko->p_Back_Pack->item[0]) || (!p_Level->Level[r] && !pTlacitko->p_Back_Pack->item[0])) return 0; if (p_Level->Level[r] && !pTlacitko->p_Back_Pack->item[0]) { off = 0; pTlacitko->p_Back_Pack->item[0] = 1; *bPowerOn = 1; } else { *bPowerOn = 0; off = 1; pTlacitko->p_Back_Pack->item[0] = 0; } RunHandle p_run; if (!off) p_run = rani_aktivuj(am.sim_anim[43], &p_Level->TrashFlag, GK_REMOVE, 0, 0); else p_run = rani_aktivuj(am.sim_anim[44], &p_Level->TrashFlag, GK_REMOVE, 0, 0); rani_privaz_mesh(p_run, pTlacitko->Index_Of_Game_Mesh, 0); anmend_Tlacitko(reinterpret_cast(pTlacitko), 0, reinterpret_cast(p_Level)); return 0; } //------------------------------------------------------------------------------------------------ // provede akci na tlacitko //------------------------------------------------------------------------------------------------ int gl_Do_Button(long real_pos, char bUse, LEVELINFO * p_Level) { int test_pos, ret, connection, connection1; int pos[3]; int ret_value = 0; char bPowerOn; ITEMDESC *p_connection, *p_connection1; connection = p_Level->Level[real_pos]->Connection[0]; connection1 = p_Level->Level[real_pos]->Connection[1]; p_connection = p_Level->Level[connection]; p_connection1 = p_Level->Level[connection1]; ret_value = gl_Stlac_Tlacitko(p_Level->Level[real_pos], &bPowerOn, p_Level); if (!bPowerOn && p_connection) if (p_connection->p_Object->Class == 9) am_TurnOff_The_Teleport(p_connection, p_Level); if (!bPowerOn && p_connection) if (p_connection->p_Object->Class == 11) p_connection->p_Back_Pack->item[1] = 0; if (!bPowerOn && p_connection1) if (p_connection1->p_Object->Class == 11) p_connection1->p_Back_Pack->item[1] = 0; if (!bUse) return ret_value; // aktivuj teleport if (p_connection) if (p_connection->p_Object->Class == 9) { pos[0] = p_connection->Pos[0]; pos[1] = p_connection->Pos[1]; pos[2] = p_connection->Pos[2]; //test_pos = pos[0] + pos[1]*p_Level->Size[0] + (pos[2]+1)*p_Level->Size[0]*p_Level->Size[1]; if (bPowerOn == 1) am_TurnOn_The_Teleport(p_connection, p_Level); gl_Logical2Real(pos[0], pos[1], pos[2] + 1, &test_pos, p_Level); if (p_Level->Level[test_pos]) { ret = gl_Teleport_Item(connection, test_pos, p_Level); if (ret != -1) ret_value = 1; } return ret_value; } // aktivuj vytah if (p_connection) if (p_connection->p_Object->Class == 11) { pos[0] = p_connection->Pos[0]; pos[1] = p_connection->Pos[1]; pos[2] = p_connection->Pos[2]; ret_value = gl_Do_Lift(connection, pos, p_Level); return ret_value; } if (p_connection1) if (p_connection1->p_Object->Class == 11) { pos[0] = p_connection1->Pos[0]; pos[1] = p_connection1->Pos[1]; pos[2] = p_connection1->Pos[2]; ret_value = gl_Do_Lift(connection1, pos, p_Level); return ret_value; } return ret_value; } int gl_Lift_Is_Move_Possible(ITEMDESC * p_Lift, int *Beruska, int real_pos, LEVELINFO * p_Level, int *move) { int pos[3], dist, i; int real; memcpy((void *) pos, (void *) p_Lift->Pos, 3 * sizeof(int)); pos[2]++; while (pos[2] < p_Level->Size[2]) { gl_Logical2Real(pos[0], pos[1], pos[2], &real, p_Level); if (!p_Level->Level[real]) break; if (p_Level->Level[real]->p_Object->Class == 1 && !p_Level->Level[real]->p_Back_Pack->item[0]) *Beruska = 1; pos[2] += 2; } dist = pos[2] - (p_Lift->Pos[2] + 1); // gl_Real2Logical(real_pos, pos, p_Level); if ((pos[2] + dist - 2) >= p_Level->Size[2]) { *move = ftoi(((pos[2] + dist - 2) - p_Level->Size[2]) / 2.0f); return 0; } else { int max = pos[2] + dist; if (max >= p_Level->Size[2]) max = p_Level->Size[2]; for (i = pos[2]; i < max; i++) { gl_Logical2Real(pos[0], pos[1], i, &real, p_Level); if (p_Level->Level[real]) if (p_Level->Level[real]->p_Object->Class != 12) { *move = ftoi((i - pos[2]) / 2.0f); return 0; } } return 1; } } int gl_Is_There_Water(int *from, int *to, LEVELINFO * p_Level) { int i; int r; for (i = from[2]; i < to[2]; i++) { gl_Logical2Real(from[0], from[1], i, &r, p_Level); if (i > -1) if (p_Level->Level[r]) if (p_Level->Level[r]->p_Object->Class == 12) return i; } return -1; } int gl_Find_Top_Of_Lift_things(LEVELINFO * p_Level, int x, int y, int z) { int r; int i; for (i = z; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(x, y, i, &r, p_Level); if (!p_Level->Level[r]) return i; else if (p_Level->Level[r]->p_Object->Class == 2) return i; } return i; } //------------------------------------------------------------------------------------------------ // provede akci na vytah //------------------------------------------------------------------------------------------------ int gl_Do_Lift(int Lift, int *pos, LEVELINFO * p_Level) { int test_pos, real_pos, test1_pos; int item, new_pos[3], move[3], old_Zpos; int i, j; char bMove; //int Lift_Zpos; int voda; int vpos[3]; int lpos[3]; int VyskaSloupce = 0; int Beruska = 0; char SmerDolu; int liftanim; int LiftTop; int lmove = 0; ITEMDESC *p_LiftI = p_Level->Level[Lift]; memcpy((void *) lpos, (void *) p_LiftI->Pos, 3 * sizeof(int)); gl_Logical2Real(pos[0], pos[1], pos[2] + 1, &test_pos, p_Level); // Ugly hack - pointer to int conversion item = POINTER_TO_INT(p_Level->Level[test_pos]); if (!p_LiftI->p_Object->SubClass) { if (item != p_LiftI->p_Back_Pack->item[2]) bMove = 1; else return 0; } if (p_LiftI->p_Object->SubClass == 1) { //item = (long)p_Level->Level[test_pos]; if ((!p_LiftI->p_Back_Pack->item[2] && item) || (!item && p_LiftI->p_Back_Pack->item[2])) bMove = 1; else { p_LiftI->p_Back_Pack->item[2] = item; return 0; } } if (p_LiftI->p_Object->SubClass == 2) { if (p_LiftI->p_Back_Pack->item[1] < 10) { p_LiftI->p_Back_Pack->item[1]++; return 0; } else { if (!p_LiftI->p_Back_Pack->item[0]) bMove = 1; p_LiftI->p_Back_Pack->item[1] = 0; } } if (p_LiftI->p_Object->SubClass == 3) { if (!p_LiftI->p_Back_Pack->item[1]) { p_LiftI->p_Back_Pack->item[1] = 1; bMove = 1; } else return 0; } if (bMove) { p_LiftI->p_Back_Pack->item[3] = 1; p_LiftI->p_Back_Pack->item[2] = item; // real_pos = pozice destinace vytahu if (p_LiftI->Connection[0] == Lift) real_pos = p_LiftI->Connection[1]; else real_pos = p_LiftI->Connection[0]; gl_Real2Logical(real_pos, new_pos, p_Level); gl_Get_Move(pos, new_pos, move); //vertikalni vytah if (!move[0] && !move[1]) { // jestlize je vytah navrchu, tak musim promazat zdi if (p_LiftI->p_Back_Pack->item[4]) { for (j = (new_pos[2] + 1); j < pos[2]; j += 2) { gl_Logical2Real(pos[0], pos[1], j, &test_pos, p_Level); p_Level->Level[test_pos] = 0; } SmerDolu = 1; } else SmerDolu = 0; if (!gl_Lift_Is_Move_Possible(p_LiftI, &Beruska, real_pos, p_Level, &lmove) && !SmerDolu) { //posun vytahu a veci na nem TAM A ZPET p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(3, 0, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, 0.0f, (float) (lmove * 2), 0.0f, abs(lmove * 5) - 1); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 2, 0.0f, 0.0f, 0.0f, 2 * abs(lmove * 5) - 1); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, 2 * abs(lmove * 5), 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_LiftI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_LiftI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_LiftI->Index_Of_Game_Mesh; am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift, 2 * lmove, Lift, reinterpret_cast(p_Level), 0); am_Set_aMaterial_Trigers(&p_set->animation[p_set->last], p_LiftI, p_Level); p_set->animation[p_set->last].flag = 0; //posun veci nad vytahem for (i = p_LiftI->Pos[2] + 1; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(pos[0], pos[1], i, &test_pos, p_Level); if (!p_Level->Level[test_pos]) { p_set->last++; return 1; } else { if (p_Level->Level[test_pos]->p_Object->Class == 13) { //kom_svaz_meshe(p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh); am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift_Item, p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh, reinterpret_cast(p_Level), 1); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, animend_Lift_End, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0, 0); } else if (p_Level->Level[test_pos]->p_Object->Class == 5 || p_Level->Level[test_pos]->p_Object->Class == 6 || p_Level->Level[test_pos]->p_Object->Class == 1 || p_Level->Level[test_pos]->p_Object->Class == 7) { p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[test_pos]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[test_pos]->Index_Of_Game_Mesh; } if (test_pos == p_Level->Actual_Item && p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run); } } return 1; } vpos[0] = pos[0]; vpos[1] = pos[1]; vpos[2] = pos[2] - 1; if (SmerDolu) { gl_Find_Bottom(vpos, &voda, p_Level); if (Beruska && voda != -1) return 0; } else voda = gl_Is_There_Water(vpos, new_pos, p_Level); //posun vytahu a veci na nem liftanim = p_set->last; p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(2, 0, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, 0.0f, (float) (move[2] * 2), 0.0f, abs(move[2] * 5) - 1); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, abs(move[2] * 5), 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_LiftI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_LiftI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_LiftI->Index_Of_Game_Mesh; am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift, move[2], real_pos, reinterpret_cast(p_Level), 0); am_Set_aMaterial_Trigers(&p_set->animation[p_set->last], p_LiftI, p_Level); p_set->animation[p_set->last].flag = 0; // posun vytahu p_Level->Level[real_pos] = p_Level->Level[Lift]; p_Level->Level[Lift] = 0; p_LiftI = p_Level->Level[real_pos]; old_Zpos = p_LiftI->Pos[2]; p_LiftI->Pos[0] = new_pos[0]; p_LiftI->Pos[1] = new_pos[1]; p_LiftI->Pos[2] = new_pos[2]; LiftTop = gl_Find_Top_Of_Lift_things(p_Level, pos[0], pos[1], old_Zpos + 1); //posun veci nad vytahem //-->nahoru for(i=LiftTop-2;i > old_Zpos;i-=2) //-->dolu for(i=old_Zpos+1;i < LiftTop;i+=2) if (SmerDolu) for (i = old_Zpos + 1; i < LiftTop; i += 2) { gl_Logical2Real(pos[0], pos[1], i, &test_pos, p_Level); if (p_Level->Level[test_pos]) { VyskaSloupce++; new_pos[0] = p_LiftI->Pos[0]; new_pos[1] = p_LiftI->Pos[1]; new_pos[2] = i + move[2] * 2; gl_Logical2Real(new_pos[0] + move[0], new_pos[1] + move[1], i + move[2] * 2, &test1_pos, p_Level); if (p_Level->Level[test_pos]->p_Object->Class == 13) { //kom_svaz_meshe(p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh); am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift_Item, p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh, reinterpret_cast(p_Level), 1); /*am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift_Item, p_Level->Level[test_pos]->Index_Of_Game_Mesh, p_LiftI->Index_Of_Game_Mesh, p_Level, 1); */ rani_pripoj_funkci(p_set->animation[p_set->last].p_run, animend_Lift_End, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0, 0); } else { p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[test_pos]->Index_Of_Game_Mesh); } if (test_pos == p_Level->Actual_Item) p_Level->Actual_Item = test1_pos; if (p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run); p_Level->Level[test1_pos] = p_Level->Level[test_pos]; p_Level->Level[test_pos] = 0; p_Level->Level[test1_pos]->Pos[0] = new_pos[0]; p_Level->Level[test1_pos]->Pos[1] = new_pos[1]; p_Level->Level[test1_pos]->Pos[2] = new_pos[2]; } } else for (i = LiftTop - 2; i > old_Zpos; i -= 2) { gl_Logical2Real(pos[0], pos[1], i, &test_pos, p_Level); if (p_Level->Level[test_pos]) { VyskaSloupce++; new_pos[0] = p_LiftI->Pos[0]; new_pos[1] = p_LiftI->Pos[1]; new_pos[2] = i + move[2] * 2; gl_Logical2Real(new_pos[0] + move[0], new_pos[1] + move[1], i + move[2] * 2, &test1_pos, p_Level); if (p_Level->Level[test_pos]->p_Object->Class == 13) { kom_svaz_meshe(p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, animend_Lift_End, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0, 0); } else { p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[test_pos]->Index_Of_Game_Mesh); } if (test_pos == p_Level->Actual_Item) p_Level->Actual_Item = test1_pos; if (p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run); p_Level->Level[test1_pos] = p_Level->Level[test_pos]; p_Level->Level[test_pos] = 0; p_Level->Level[test1_pos]->Pos[0] = new_pos[0]; p_Level->Level[test1_pos]->Pos[1] = new_pos[1]; p_Level->Level[test1_pos]->Pos[2] = new_pos[2]; } } p_set->last++; if (p_LiftI->p_Back_Pack->item[4]) p_LiftI->p_Back_Pack->item[4] = 0; else { //vytah byl dole -> vytvorit zdi pod vytahem p_LiftI->p_Back_Pack->item[4] = 1; for (j = old_Zpos + 1; j < p_LiftI->Pos[2]; j += 2) { gl_Logical2Real(new_pos[0], new_pos[1], j, &test_pos, p_Level); p_Level->Level[test_pos] = p_Level->pWall; } } if (voda != -1 && SmerDolu) { POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { int r; int percent; gl_Logical2Real(pos[0], pos[1], voda + 1, &r, p_Level); pS->p_Level = p_Level; pS->iParam = (VyskaSloupce + 1) * 25; pS->bParam = 1; pS->viParam2[0] = 0; pS->viParam2[1] = p_LiftI->Index_Of_Game_Mesh; pS->viParam2[2] = 1; vpos[0] = pos[0]; vpos[1] = pos[1]; vpos[2] = voda + 1; memcpy((void *) pS->viParam1, (void *) vpos, 3 * sizeof(int)); percent = ((lpos[2] - (voda + 1)) * 100) / (lpos[2] - p_LiftI->Pos[2]); am_Set_Triger_Function(&p_set->animation[liftanim], anmend_Water, 2, r, reinterpret_cast(pS), percent, 0); } } if (voda != -1 && !SmerDolu) { POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); int percent; percent = ((voda - (lpos[2] + VyskaSloupce)) * 100) / (p_LiftI->Pos[2] - lpos[2]); if (percent < 1) percent = 1; if (pS) { int r; gl_Logical2Real(pos[0], pos[1], voda + 1, &r, p_Level); pS->p_Level = p_Level; pS->iParam = (VyskaSloupce + 1) * 25; pS->bParam = -2; pS->viParam2[0] = 0; pS->viParam2[1] = 0; pS->viParam2[2] = 1; vpos[0] = pos[0]; vpos[1] = pos[1]; vpos[2] = voda + 1; memcpy((void *) pS->viParam1, (void *) vpos, 3 * sizeof(int)); am_Set_Triger_Function(&p_set->animation[liftanim], anmend_WaterLift, p_LiftI->Index_Of_Game_Mesh, 0, reinterpret_cast(pS), percent, 0); } } return 1; } else if (!move[2]) { //horizontalni vytah DDA dda; char bStop = 0; dda.x1 = pos[0]; dda.y1 = pos[1]; dda.x2 = new_pos[0]; dda.y2 = new_pos[1]; dda_First(&dda); dda_Next(&dda); do { gl_Logical2Real(dda.x, dda.y, pos[2] - 1, &test_pos, p_Level); /*if((pos[2]-1) >= 0) if(p_Level->Level[test_pos]) { bStop = 1; break; } */ gl_Logical2Real(dda.x, dda.y, pos[2] + 1, &test_pos, p_Level); if (p_Level->Level[test_pos]) { bStop = 1; break; } } while (dda_Next(&dda)); if (bStop) { // neco je v ceste -> vetah pojede tam a zpet dda_Prev(&dda); if (dda.main_axe <= 0) return 0; new_pos[0] = dda.x; new_pos[1] = dda.y; new_pos[2] = pos[2]; gl_Get_Move(pos, new_pos, move); p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(3, 0, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, (float) move[0] * 2, 0.0f, (float) move[1] * 2, (dda.main_axe * 5) - 1); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 2, 0.0f, 0.0f, 0.0f, (dda.main_axe * 10) - 1); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, dda.main_axe * 10, 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_LiftI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_LiftI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_LiftI->Index_Of_Game_Mesh; p_set->animation[p_set->last].flag = 0; am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift, dda.main_axe * 2, Lift, reinterpret_cast(p_Level), 0); am_Set_aMaterial_Trigers(&p_set->animation[p_set->last], p_LiftI, p_Level); for (i = pos[2] + 1; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(pos[0], pos[1], i, &test_pos, p_Level); if (!p_Level->Level[test_pos]) { p_set->last++; return 1; } else if (p_Level->Level[test_pos]->p_Object->Class == 2) { p_set->last++; return 1; } else { if (p_Level->Level[test_pos]->p_Object->Class == 13) { kom_svaz_meshe(p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, animend_Lift_End, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0, 0); } else { p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[test_pos]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[test_pos]->Index_Of_Game_Mesh; } } } } else { //normalni posun p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(2, 0, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, (float) (move[0] * 2), 0.0f, (float) (move[1] * 2), (dda.main_axe * 5) - 1); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, dda.main_axe * 5, 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_LiftI->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_LiftI->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_LiftI->Index_Of_Game_Mesh; am_Set_Start_Function(&p_set->animation[p_set->last], anmend_Lift, dda.main_axe, real_pos, reinterpret_cast(p_Level), 0); // posun vytahu p_Level->Level[real_pos] = p_Level->Level[Lift]; p_Level->Level[Lift] = 0; p_LiftI = p_Level->Level[real_pos]; old_Zpos = p_LiftI->Pos[2]; p_LiftI->Pos[0] = new_pos[0]; p_LiftI->Pos[1] = new_pos[1]; p_LiftI->Pos[2] = new_pos[2]; //posun veci nad vytahem for (i = old_Zpos + 1; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(pos[0], pos[1], i, &test_pos, p_Level); if (!p_Level->Level[test_pos]) { p_set->last++; return 1; } else if (p_Level->Level[test_pos]->p_Object->Class == 2) { p_set->last++; return 1; } else { new_pos[0] = p_LiftI->Pos[0]; new_pos[1] = p_LiftI->Pos[1]; new_pos[2] = i; gl_Logical2Real(new_pos[0], new_pos[1], i, &test1_pos, p_Level); if (p_Level->Level[test_pos]->p_Object->Class == 13) { kom_svaz_meshe(p_LiftI->Index_Of_Game_Mesh, p_Level->Level[test_pos]->Index_Of_Game_Mesh); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, animend_Lift_End, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0, 0); } else { p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, p_Level->Level[test_pos]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], p_Level->Level[test_pos]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = p_Level->Level[test_pos]->Index_Of_Game_Mesh; } if (test_pos == p_Level->Actual_Item) p_Level->Actual_Item = test1_pos; if (p_Level->bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run); p_Level->Level[test1_pos] = p_Level->Level[test_pos]; p_Level->Level[test_pos] = 0; p_Level->Level[test1_pos]->Pos[0] = new_pos[0]; p_Level->Level[test1_pos]->Pos[1] = new_pos[1]; p_Level->Level[test1_pos]->Pos[2] = new_pos[2]; } } } } else return 0; // /\ spatnej vytah } return 1; } //------------------------------------------------------------------------------------------------ // najde prvni stenu v mape //------------------------------------------------------------------------------------------------ ITEMDESC *gl_Find_First_Wall(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 2) return p_Level->Level[i]; return NULL; } //------------------------------------------------------------------------------------------------ // prida steny pod vytah //------------------------------------------------------------------------------------------------ void gl_Add_Walls_Bellow_Lifts(LEVELINFO * p_Level) { int i, j, p1[3], p2[3], p3[3]; ITEMDESC *p_lift; int real; p_Level->pWall = gl_Find_First_Wall(p_Level); for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) { if (p_Level->Level[i]->p_Object->Class == 11) { p_lift = p_Level->Level[i]; gl_Real2Logical(p_lift->Connection[0], p1, p_Level); gl_Real2Logical(p_lift->Connection[1], p2, p_Level); gl_Real2Logical(i, p3, p_Level); if (((p1[2] > p2[2]) && (p3[2] == p1[2])) || ((p2[2] > p1[2]) && (p3[2] == p2[2]))) { int p; if (p1[2] > p2[2]) { p = p1[2]; p1[2] = p2[2]; p2[2] = p; } //for(j=p1[2]+1;jLevel[real] = p_Level->pWall; } p_lift->p_Back_Pack->item[4] = 1; } else if (p1[2] != p2[2]) { int p; if (p1[2] < p2[2]) { p = p1[2]; p1[2] = p2[2]; p2[2] = p; } for (j = 1; j < p2[2]; j += 2) { gl_Logical2Real(p1[0], p1[1], j, &real, p_Level); p_Level->Level[real] = p_Level->pWall; } p_lift->p_Back_Pack->item[4] = 0; } else p_lift->p_Back_Pack->item[4] = 0; //nainicializuj vytah gl_Real2Logical(i, p3, p_Level); p3[2]++; gl_Logical2Real(p3[0], p3[1], p3[2], &real, p_Level); // Ugly hack - pointer to int conversion p_lift->p_Back_Pack->item[2] = POINTER_TO_INT(p_Level->Level[real]); } } } void gl_Add_Walls_Bellow_LiftsH(LEVELINFO * p_Level) { int i, p1[3], p2[3]; ITEMDESC *p_lift; int real; DDA dda; p_Level->pWall = gl_Find_First_Wall(p_Level); for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 11) { p_lift = p_Level->Level[i]; gl_Real2Logical(p_lift->Connection[0], p1, p_Level); gl_Real2Logical(p_lift->Connection[1], p2, p_Level); if (p1[2] == p2[2]) { dda.x1 = p1[0]; dda.y1 = p1[1]; dda.x2 = p2[0]; dda.y2 = p2[1]; dda_First(&dda); do { gl_Logical2Real(dda.x, dda.y, p1[2] - 1, &real, p_Level); if ((p1[2] - 1) >= 0) { if (!p_Level->Level[real]) p_Level->Level[real] = p_Level->pWall; } else break; } while (dda_Next(&dda)); } } } void gl_Open_Door(ITEMDESC * p_DoorI, LEVELINFO * p_Level) { float pos[3]; int i, r = rand() % 2; lani_set(p_DoorI->Index_Of_Game_Mesh, 0, 0, &p_Level->TrashFlag, 0, 0, 10); p_DoorI->p_Back_Pack->item[1] = 1; p_DoorI->p_Back_Pack->item[0]++; kom_mesh_get_float(p_DoorI->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &i); if(p_DoorI->p_Object->Specific[r].Index != -1) ap_Play_Sound(0,0,0, pos, p_DoorI->p_Object->Specific[r].Index, NULL, &ad); else if(p_DoorI->p_Object->Specific[0].Index != -1) ap_Play_Sound(0,0,0, pos, p_DoorI->p_Object->Specific[0].Index, NULL, &ad); r = rand() % 3; if(p_DoorI->p_Object->Reserved[r].Index != -1) ap_Play_Sound(0,0,0, pos, p_DoorI->p_Object->Reserved[r].Index, NULL, &ad); else if(p_DoorI->p_Object->Reserved[0].Index != -1) ap_Play_Sound(0,0,0, pos, p_DoorI->p_Object->Reserved[0].Index, NULL, &ad); } //------------------------------------------------------------------------------------------------ // logika dveri //------------------------------------------------------------------------------------------------ int gl_Gate_Keeper(int Door, int *Item, LEVELINFO * p_Level) { int Real_Item; ITEMDESC *p_DoorI = p_Level->Level[Door]; OBJECTDESC *p_Real_ItemO; if (!p_DoorI) return 0; gl_Logical2Real(Item[0], Item[1], Item[2], &Real_Item, p_Level); p_Real_ItemO = p_Level->Level[Real_Item]->p_Object; // jestlize jsou dvere otevrene, tak muze projit if (p_DoorI->p_Back_Pack->item[1]) return 1; else { //na jeden pruchod a zavrene -> nelze prijit if ((p_DoorI->p_Object->SubClass == 22) && (p_DoorI->p_Back_Pack->item[0])) return 0; } if (!p_DoorI->p_Object->SubClass) { gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } if ((p_DoorI->p_Object->SubClass > 0) && (p_DoorI->p_Object->SubClass < 7)) { if ( (p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[p_DoorI-> p_Object->SubClass + 9]) || (((p_Real_ItemO->Class == 1) && (p_Real_ItemO->SubClass == p_DoorI->p_Object->SubClass - 1) ) || ((p_DoorI->p_Object->SubClass == 6) && (p_Real_ItemO->SubClass > 4) ) ) ) { gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } return 0; } if ((p_DoorI->p_Object->SubClass > 6) && (p_DoorI->p_Object->SubClass < 13)) { if ( (p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[p_DoorI-> p_Object->SubClass + 3]) || (((p_Real_ItemO->Class == 1) && (p_Real_ItemO->SubClass == p_DoorI->p_Object->SubClass - 7) ) || ((p_DoorI->p_Object->SubClass == 12) && (p_Real_ItemO->SubClass > 4) ) ) ) { gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } return 0; } if ((p_DoorI->p_Object->SubClass > 12) && (p_DoorI->p_Object->SubClass < 19)) { if (p_Real_ItemO->Class != 1) return 0; if ( (p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[p_Level-> Level[Door]->p_Object->SubClass - 3]) || (((p_Real_ItemO->Class == 1) && (p_Real_ItemO->SubClass == p_DoorI->p_Object->SubClass - 13) ) || ((p_DoorI->p_Object->SubClass == 18) && (p_Real_ItemO->SubClass > 4) ) ) ) { gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } return 0; } if ((p_DoorI->p_Object->SubClass == 19) || (p_DoorI->p_Object->SubClass == 20)) { int move[3]; gl_Get_Move(Item, p_DoorI->Pos, move); if (!move[0]) { if ((move[1] > 0) && (p_DoorI->Rotation != 2)) return 0; if ((move[1] < 0) && (p_DoorI->Rotation)) return 0; } else { if ((move[0] > 0) && (p_DoorI->Rotation != 3)) return 0; if ((move[0] < 0) && (p_DoorI->Rotation != 1)) return 0; } gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } if (p_DoorI->p_Object->SubClass == 21) { int move[3]; gl_Get_Move(Item, p_DoorI->Pos, move); if (move[0] && ((!p_DoorI->Rotation) || (p_DoorI->Rotation == 2) ) ) return 0; else if ((p_DoorI->Rotation == 1) || (p_DoorI->Rotation == 3)) return 0; gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } if (p_DoorI->p_Object->SubClass == 22) { if (p_DoorI->p_Back_Pack->item[0]) return 0; gl_Open_Door(p_DoorI, p_Level); p_DoorI->p_Back_Pack->item[0]++; p_DoorI->p_Back_Pack->item[1] = 1; return 1; } return 1; } int gl_Find_Top_With_Water(int *pWater, ITEMDESC * pItem, LEVELINFO * p_Level) { int i, iPos[3], r; (*pWater) = -1; if (!pItem) return -1; memcpy((void *) iPos, (void *) pItem->Pos, 3 * sizeof(int)); for (i = pItem->Pos[2] + 2; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(iPos[0], iPos[1], i, &r, p_Level); if (p_Level->Level[r]) return i; gl_Logical2Real(iPos[0], iPos[1], i - 1, &r, p_Level); if (p_Level->Level[r]) { if (p_Level->Level[r]->p_Object->Class != 12) { return i - 2; } else { (*pWater) = i - 1; if (pItem->p_Object->Class == 5 && pItem->p_Object->SubClass == 3) return i; else if ((i + 2) < p_Level->Size[2]) { gl_Logical2Real(iPos[0], iPos[1], i + 1, &r, p_Level); if (p_Level->Level[r]) return i; gl_Logical2Real(iPos[0], iPos[1], i + 2, &r, p_Level); if (p_Level->Level[r]) return i; return i + 2; } else return i; } } } return p_Level->Size[2] - 1; } void gl_Vyrob_Animaci(int move, int newL, int Water, int bWater, ITEMDESC * pItem, LEVELINFO * p_Level) { POINTERSTRUCTURE *pS; int real, new_real; p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(2, 0, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, 0.0f, (float) move, 0.0f, (move * 2) - 1); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, move * 2, 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, pItem->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], pItem->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = pItem->Index_Of_Game_Mesh; p_set->last++; gl_Logical2Real(pItem->Pos[0], pItem->Pos[1], pItem->Pos[2], &real, p_Level); gl_Logical2Real(pItem->Pos[0], pItem->Pos[1], newL, &new_real, p_Level); p_Level->Level[new_real] = p_Level->Level[real]; p_Level->Level[real] = 0; if (Water != -1 && bWater) { pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { int percent; gl_Logical2Real(p_Level->Level[new_real]->Pos[0], p_Level->Level[new_real]->Pos[1], Water, &real, p_Level); pS->p_Level = p_Level; pS->iParam = 50; pS->bParam = 1; pS->viParam2[0] = 0; pS->viParam2[1] = 0; pS->viParam2[2] = 1; pS->viParam1[0] = p_Level->Level[new_real]->Pos[0]; pS->viParam1[1] = p_Level->Level[new_real]->Pos[1]; pS->viParam1[2] = Water; percent = ((Water - p_Level->Level[new_real]->Pos[2]) * 100) / (newL - p_Level->Level[new_real]->Pos[2]); am_Set_Triger_Function(&p_set->animation[p_set->last - 1], anmend_Water, 2, real, reinterpret_cast(pS), percent, 0); } } p_Level->Level[new_real]->Pos[2] = newL; } int gl_Check_Anim_Pontonky(ITEMDESC * pItem, LEVELINFO * p_Level) { int real; int iPos[3]; if (!pItem) return 0; iPos[0] = pItem->Pos[0]; iPos[1] = pItem->Pos[1]; iPos[2] = pItem->Pos[2]; iPos[2]--; //musi pod ni byt voda gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class != 12) return 0; } else return 0; //nesmi pod ni byt bedna iPos[2]--; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) return 0; iPos[2] += 3; if (iPos[2] < p_Level->Size[2]) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) return 0; } iPos[2]++; if (iPos[2] < p_Level->Size[2]) { gl_Logical2Real(iPos[0], iPos[1], iPos[2], &real, p_Level); if (p_Level->Level[real]) return 0; } return 1; } int gl_Vynor_Pontonky(LEVELINFO * p_Level) { ITEMDESC *pItem; int c, i, r, v, Water, bWater; int ret = 0; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) { pItem = p_Level->Level[i]; if (pItem->p_Object->Class == 5 && pItem->p_Object->SubClass == 3 && p_Level->Square[i].bUnderWater) { c = gl_Count_Weight(pItem->Pos, p_Level); //pokud pontonka nese moc malou vahu, tak se vynori if (c < 3) { bWater = 1; gl_Logical2Real(pItem->Pos[0], pItem->Pos[1], pItem->Pos[2] + 2, &r, p_Level); if (pItem->Pos[2] + 2 < p_Level->Size[2]) if (p_Level->Level[r]) { v = gl_Find_Top_With_Water(&Water, p_Level->Level[r], p_Level); if (v != p_Level->Level[r]->Pos[2]) { gl_Vyrob_Animaci(v - p_Level->Level[r]->Pos[2], v, Water, bWater, p_Level->Level[r], p_Level); bWater = 0; ret = 1; } } v = gl_Find_Top_With_Water(&Water, pItem, p_Level); if (v != pItem->Pos[2]) { gl_Vyrob_Animaci(v - pItem->Pos[2], v, Water, bWater, pItem, p_Level); ret = 1; } } } else if (pItem->p_Object->Class == 5 && pItem->p_Object->SubClass == 3) { c = gl_Check_Anim_Pontonky(pItem, p_Level); if (!c && pItem->a_run) { //rani_rozvaz(pItem->a_run,pItem->Index_Of_Game_Mesh); rani_zrus(pItem->a_run); pItem->a_run = (size_ptr)NULL; kom_umisti_prvek(pItem->Index_Of_Game_Mesh, pItem->Pos[0], pItem->Pos[2], pItem->Pos[1], pItem->Rotation); } else if (c && !pItem->a_run) am_Start_Animaci_Pontonky(pItem); } } return ret; } void gl_Close_Door(ITEMDESC * pDoor, LEVELINFO * p_Level) { float pos[3]; int r; pDoor->p_Back_Pack->item[1] = 0; lani_set(pDoor->Index_Of_Game_Mesh, 0, 0, &p_Level->TrashFlag, 0, 10, 21); kom_mesh_get_float(pDoor->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); if(pDoor->p_Object->Specific[2].Index != -1) ap_Play_Sound(0,0,0, pos, pDoor->p_Object->Specific[2].Index, NULL, &ad); } //------------------------------------------------------------------------------------------------ // zkontroluje logicke zavislosti: teleporty, propadla, tlacitka,... //------------------------------------------------------------------------------------------------ int gl_Check_Logic_Dependences(LEVELINFO * p_Level) { int x, y, z, i, m; //int real_pos, test_pos, ret, real_p; int test_pos, ret, real_p; int pos[3]; int ret_value = 0; //int r; ITEMDESC *p_Action_ItemI; // nuluju flagy vytahu for (m = 0; m < p_Level->Count_Of_Action_Items; m++) { if (p_Level->Action_Item[m] == -1) break; p_Action_ItemI = p_Level->Level[p_Level->Action_Item[m]]; if (p_Action_ItemI) if (p_Action_ItemI->p_Object->Class == 11) p_Action_ItemI->p_Back_Pack->item[3] = 0; } for (m = 0; m < p_Level->Count_Of_Items; m++) { if (p_Level->Action_Item[m] == -1) { ret_value += gl_Vynor_Pontonky(p_Level); return ret_value; } p_Action_ItemI = p_Level->Level[p_Level->Action_Item[m]]; if (p_Action_ItemI && !p_Action_ItemI->bDestroed) { x = p_Action_ItemI->Pos[0]; y = p_Action_ItemI->Pos[1]; z = p_Action_ItemI->Pos[2]; // dvere if (p_Action_ItemI->p_Object->Class == 8) { if (((p_Action_ItemI->p_Object->SubClass > 6) && (p_Action_ItemI->p_Object->SubClass < 13)) || (p_Action_ItemI->p_Object->SubClass > 18)) { //zavri dvere gl_Logical2Real(x, y, z + 1, &test_pos, p_Level); if (!p_Level->Level[test_pos] && p_Action_ItemI->p_Back_Pack->item[1]) { gl_Close_Door(p_Action_ItemI, p_Level); //ret_value = 1; } } } //tlacitko if (p_Action_ItemI->p_Object->Class == 10) { gl_Logical2Real(x, y, z + 1, &test_pos, p_Level); if (p_Level->Level[test_pos]) ret_value += gl_Do_Button(p_Level->Action_Item[m], 1, p_Level); else ret_value += gl_Do_Button(p_Level->Action_Item[m], 0, p_Level); } // teleport if ((p_Action_ItemI->p_Object->Class == 9) && (!p_Action_ItemI->p_Object->SubClass)) { gl_Logical2Real(x, y, z + 1, &test_pos, p_Level); if (p_Level->Level[test_pos]) { ret = gl_Teleport_Item(p_Level->Action_Item[m], test_pos, p_Level); if (ret != -1) ret_value = 1; } } //exit if (p_Action_ItemI->p_Object->Class == 4) { gl_Logical2Real(x, y, z + 1, &real_p, p_Level); if (p_Level->Level[real_p]) if (p_Level->Level[real_p]->p_Object->Class == 1) { p_Level->bExit = 1; ret_value = 1; } } // vytah if ((p_Action_ItemI->p_Object->Class == 11) && (!p_Action_ItemI->p_Back_Pack->item[3])) { pos[0] = x; pos[1] = y; pos[2] = z; if (p_Action_ItemI->p_Object->SubClass != 3) ret_value += gl_Do_Lift(p_Level->Action_Item[m], pos, p_Level); } //propadlo if (p_Action_ItemI) if (p_Action_ItemI->p_Object->Class == 15) { gl_Logical2Real(x, y, z + 1, &real_p, p_Level); if (p_Level->Level[real_p]) { pos[0] = x; pos[1] = y; pos[2] = z + 1; // zjistim vahu sloupce na propadlu ret = gl_Count_Weight(pos, p_Level); if (ret > 1) { // musim otestovat, zda to neodporuje jinym pravidlum ret = 0; for (i = z; i > 0; i -= 2) { gl_Logical2Real(x, y, i, &test_pos, p_Level); if (p_Level->Level[test_pos]) if ((p_Level->Level[test_pos]->p_Object->Class == 1) || (p_Level->Level[test_pos]->p_Object->Class == 6)) ret--; } if (ret >= 0) { float fpos[3]; int rot, mat; mat = gl_Get_Mesh_Material(p_Level->Level[p_Level-> Action_Item[m]]->Index_Of_Game_Mesh); kom_mesh_get_float(p_Level->Level[p_Level->Action_Item[m]]-> Index_Of_Game_Mesh, &fpos[0], &fpos[1], &fpos[2], &rot); pos[0] = x; pos[1] = y; pos[2] = z; //r = rand() % 3; if (p_Action_ItemI->p_Object->Specific[rot].Index == -1) rot = 0; if(p_Action_ItemI->p_Object->Specific[rot].Index != -1) ap_Play_Sound(0,0,0, fpos, p_Action_ItemI->p_Object->Specific[rot].Index, NULL, &ad); gl_Destroy_Item(p_Level->Action_Item[m], 0, p_Level); gl_Do_Propadlo(fpos, p_Level, mat); gl_Throw_off(pos, p_Level); m = 0; ret_value = 1; } } } } } } ret_value += gl_Vynor_Pontonky(p_Level); return ret_value; } int gl_Can_Go_Into_Water(ITEMDESC * pItem) { if (pItem->p_Object->Class != 1) return 1; else if (pItem->p_Object->SubClass < 6 && pItem->p_Back_Pack->item[0]) return 1; else return 0; } int gl_Is_There_Beatle(int *iPos, ITEMDESC ** pItem, LEVELINFO * p_Level) { int i, c = 0; int real; for (i = iPos[2]; i < p_Level->Size[2]; i += 2) { gl_Logical2Real(iPos[0], iPos[1], i, &real, p_Level); if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class == 1) { *pItem = p_Level->Level[real]; return c; } if (p_Level->Level[real]->p_Object->Class == 2 || p_Level->Level[real]->p_Object->Class == 4 || p_Level->Level[real]->p_Object->Class == 17 || p_Level->Level[real]->p_Object->Class == 19) { *pItem = NULL; return c; } } else { *pItem = NULL; return c; } c++; } *pItem = NULL; return c; } int gl_Will_Go_Under_Water(int *iPos, int DontCountPos, int Plus, int *pVaha, LEVELINFO * p_Level) { int i, iPocetBeden = Plus, cPos[3]; char bUnderWater = 0; int real; if (pVaha) (*pVaha) = 0; for (i = iPos[2]; i > 0; i -= 2) { gl_Logical2Real(iPos[0], iPos[1], i, &real, p_Level); // mrknu se co je v prvni vrstve if (p_Level->Level[real]) { //brouka nepocitat if (p_Level->Level[real]->p_Object->Class != 1) { // jestlize je to zed a bedny sou ok, tak je to OK if (p_Level->Level[real]->p_Object->Class == 2 && iPocetBeden >= 0) return 0; //jestlize je to pontonka, tak zvaz vahu na ni (informativne) if (p_Level->Level[real]->p_Object->Class == 5 && p_Level->Level[real]->p_Object->SubClass == 3 && pVaha) { cPos[0] = iPos[0]; cPos[1] = iPos[1]; cPos[2] = i; (*pVaha) = gl_Count_Weight(cPos, p_Level); } // jestlize nejsu pod vodou tak pripoctu bednu //(Pokud to je prvni a nema se pocitat, tak ji nepocitam) if (DontCountPos != i && !bUnderWater) iPocetBeden++; // jestlize se jedna o pozici k nezapocteni a jsem pod vodou, tak // odecist, protoze ta bedna tam bude chybet if (DontCountPos == i && bUnderWater) iPocetBeden--; // jsem pod vodou, narazil jsem na neco a pocet beden je dostatecny // a dostal jsem se k bodu, kde sem vyhodil bednu if (bUnderWater && iPocetBeden >= 0 && i <= DontCountPos) return 0; } } else // jestlize jsu pod vodou a nic tam neni, odectu si jednu bednu if (bUnderWater) iPocetBeden--; // pokud mi dosli bedny, tak beruska pujde pod vodu if (iPocetBeden < 0) return 1; gl_Logical2Real(iPos[0], iPos[1], i - 1, &real, p_Level); //mrknu se na nultou vrstvu // - jestlize to neni voda a je to nad vodu tak ok // - jestlize je to pod vodou a neno to voda :) a pocet beden je dostatecny, tak OK if (p_Level->Level[real]) { if (p_Level->Level[real]->p_Object->Class != 12 && !bUnderWater) return 0; else { if (p_Level->Level[real]->p_Object->Class != 12 && bUnderWater && iPocetBeden >= 0) return 1; else bUnderWater = 1; } } } //dojel jsem na dno levelu a pocet beden je ok if (iPocetBeden < 0) return 1; else return 0; } int gl_Check_Detonation_Pack_Water_Rules(int *iPos, LEVELINFO * p_Level) { ITEMDESC *pItem = NULL; int pos[3], c; memcpy((void *) pos, (void *) iPos, 3 * sizeof(int)); //pos[2] += 2; c = gl_Is_There_Beatle(pos, &pItem, p_Level); if (!pItem) return 1; //nastav pozici pod berusku pos[2] += c * 2; if (gl_Will_Go_Under_Water(pos, iPos[2], 0, NULL, p_Level) && !gl_Can_Go_Into_Water(pItem)) return 0; return 1; } //------------------------------------------------------------------------------------------------ // use of detonation pack //------------------------------------------------------------------------------------------------ void gl_Throw_Detonation_Pack(long item, LEVELINFO * p_Level) { int pos[3], rot; float fpos[3]; int real_pos; OBJECTDESC *p_real_posO; ITEMDESC *p_itemI = p_Level->Level[item]; pos[0] = p_itemI->Pos[0]; pos[1] = p_itemI->Pos[1]; pos[2] = p_itemI->Pos[2]; pos[2] -= 2; if (!p_itemI->Rotation) pos[1]++; if (p_itemI->Rotation == 1) pos[0]++; if (p_itemI->Rotation == 2) pos[1]--; if (p_itemI->Rotation == 3) pos[0]--; if ((pos[0] < 0) || (pos[0] > (p_Level->Size[0] - 1))) return; if ((pos[1] < 0) || (pos[1] > (p_Level->Size[1] - 1))) return; if (pos[2] < 1) return; gl_Logical2Real(pos[0], pos[1], pos[2], &real_pos, p_Level); if (!p_Level->Level[real_pos]) return; p_real_posO = p_Level->Level[real_pos]->p_Object; if (!gl_Check_Detonation_Pack_Water_Rules(pos, p_Level)) return; if (p_real_posO->Class == 7 || p_real_posO->Class == 3 || p_real_posO->Class == 16 || p_real_posO->Class == 5 || p_real_posO->Class == 6) { kom_mesh_get_float(p_Level->Level[real_pos]->Index_Of_Game_Mesh, &fpos[0], &fpos[1], &fpos[2], &rot); gl_Destroy_Item(real_pos, 4, p_Level); p_Level->Level[real_pos] = 0; } else return; p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[4]--; gl_Throw_off(pos, p_Level); p_Level->Flip++; p_Level->status = 1; p_Level->bAllow_Key = 0; gl_Next_Queue_Set(p_Level); if (p_Level->Flip == 1) gl_Go_Animations(); rot = rand() % 5; ap_Play_Sound(0,0,0, fpos, rot + 14, NULL, &ad); } //------------------------------------------------------------------------------------------------ // kontrola pri odkladani predmetu //------------------------------------------------------------------------------------------------ int gl_Is_Drop_Item_Possible(int *p_Pos, LEVELINFO * p_Level) { int real_pos; int i; OBJECTDESC *p_real_posO; for (i = p_Pos[2]; i >= 0; i--) { gl_Logical2Real(p_Pos[0], p_Pos[1], i, &real_pos, p_Level); if (p_Level->Level[real_pos]) { p_real_posO = p_Level->Level[real_pos]->p_Object; if (p_real_posO->Class == 1 || p_real_posO->Class == 13 || p_real_posO->Class == 19) return 0; else if (p_real_posO->Class != 12) return 1; } } return 1; } //------------------------------------------------------------------------------------------------ // najde dno, na urcene pozici od urcene vysky //------------------------------------------------------------------------------------------------ int gl_Find_Bottom(int *p_Pos, int *bVoda, LEVELINFO * p_Level) { int real_pos; int i, bottom = p_Pos[2]; *bVoda = -1; for (i = p_Pos[2]; i >= 0; i -= 2) { gl_Logical2Real(p_Pos[0], p_Pos[1], i, &real_pos, p_Level); if (p_Level->Level[real_pos]) return bottom; gl_Logical2Real(p_Pos[0], p_Pos[1], i - 1, &real_pos, p_Level); if (p_Level->Level[real_pos]) { if (p_Level->Level[real_pos]->p_Object->Class != 12) { if (p_Level->Level[real_pos]->p_Object->Class != 8) return bottom - 2; else return bottom; } else *bVoda = bottom - 2; } bottom -= 2; } return -1; } char gl_Check_Mesh_Sim(int iMesh) { int i; for (i = 0; i < p_set_anim->last; i++) { if (p_set_anim->animation[i].p_run) { if (rani_je_mesh(p_set_anim->animation[i].p_run, iMesh)) return 1; } } for (i = 0; i < p_set->last; i++) { if (p_set->animation[i].p_run) { if (rani_je_mesh(p_set->animation[i].p_run, iMesh)) return 1; } } return 0; } //------------------------------------------------------------------------------------------------ // zpusti animace jednoho kroku //------------------------------------------------------------------------------------------------ void gl_Go_Animations(void) { int i, j; SIM_ANIMATION *p_anim; if (p_set_anim->bSetMesh) { kom_mesh_set_mesh(p_set_anim->iMesh, p_set_anim->iMeshID, p_set_anim->iRot); //kprintf(1, "Nastavuji mesh na rotaci %d a spoustim anim!", p_set_anim->iRot); } for (i = 0; i < 32; i++) { if (p_set_anim->animation[i].p_run) { p_anim = &p_set_anim->animation[i]; for (j = 0; j < 8; j++) { if (Level.Actual_Item != -1) { if ((p_anim->mesh[j] == Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh) && Level.bPosouvatKameru) { rani_privaz_kameru(p_anim->p_run); } } } } else if (i < p_set_anim->last) p_set_anim->animation[i].flag = 101; if (p_set_anim->animation[i].p_run && !p_set_anim->animation[i].bnext) { p_anim = &p_set_anim->animation[i]; if (!p_set_anim->animation[i].bconnected) rani_go(p_anim->p_run, 0, 0, 0); /*for(j=0;j<8;j++) if((p_anim->mesh[i] == Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh) && Level.bPosouvatKameru) { rani_privaz_kameru(p_anim->p_run); break; } */ /* else kprintf(1,"nespoustim animaci %d, protoze je privazana\n", p_anim->p_run);*/ for (j = 0; j < 2; j++) if (p_anim->tStart[j].pProc) { p_anim->tStart[j].pProc(p_anim->tStart[j].iParam[0], p_anim->tStart[j].iParam[1], reinterpret_cast(p_anim->tStart[j].pParam)); p_anim->tStart[j].pProc = NULL; } for (j = 0; j < 3; j++) if (p_anim->taMateral[j].pProc) { p_anim->taMateral[j].pProc(p_anim->taMateral[j].iParam[0], p_anim->taMateral[j].iParam[1], reinterpret_cast(p_anim->taMateral[j].pParam)); p_anim->taMateral[j].pProc = NULL; } } } //privaz meshe for (i = 0; i < p_set_anim->pMesh; i++) kom_svaz_meshe(p_set_anim->PrivazanyMesh[i].TopMesh, p_set_anim->PrivazanyMesh[i].LowMesh); for (i = 0; i < 6; i++) if (p_set_anim->_3dsAnim[i].mesh != -1) lani_set(p_set_anim->_3dsAnim[i].mesh, i, p_set_anim->_3dsAnim[i].c_anim, p_set_anim->_3dsAnim[i].p_flag, p_set_anim->_3dsAnim[i].flag, p_set_anim->_3dsAnim[i].start, p_set_anim->_3dsAnim[i].stop); } void gl_Rozvaz_Meshe(void) { int i; for (i = 0; i < p_set_anim->pMesh; i++) kom_rozvaz_mesh(p_set_anim->PrivazanyMesh[i].LowMesh); } //------------------------------------------------------------------------------------------------ // pokud nasatala udalost, spusti jeji funkci //------------------------------------------------------------------------------------------------ void gl_Do_Triger(SIM_ANIMATION * p_animation) { //POINTERSTRUCTURE *pStruct; int j; for (j = 0; j < 5; j++) if (p_animation->tTriger[j].pProc) if (p_animation->flag >= p_animation->tTriger[j].flag || p_animation->flag == -1) { //pStruct = (POINTERSTRUCTURE *) p_animation->tTriger[j].pParam; p_animation->tTriger[j].pProc(p_animation->tTriger[j].iParam[0], p_animation->tTriger[j].iParam[1], reinterpret_cast(p_animation->tTriger[j].pParam)); p_animation->tTriger[j].pProc = NULL; } for (j = 0; j < 3; j++) if (p_animation->taMateral[j].pProc && p_animation->taMateral[j].flag > -1) if (p_animation->flag >= p_animation->taMateral[j].flag || p_animation->flag == -1) { p_animation->taMateral[j].pProc(p_animation->taMateral[j].iParam[0], p_animation->taMateral[j].iParam[1], reinterpret_cast(p_animation->taMateral[j].pParam)); p_animation->taMateral[j].pProc = NULL; } } void gl_Add_Mesh(SIM_ANIMATION * p_animation, int mesh) { int i; for (i = 0; i < 8; i++) if (p_animation->mesh[i] == -1) { p_animation->mesh[i] = mesh; return; } } int gl_Is_Included_In(SIM_ANIMATION * p_animation, int mesh) { int i; for (i = 0; i < 8; i++) if (p_animation->mesh[i] == mesh) return 1; return 0; } SIM_ANIMATION *gl_Is_Included_In_AnimSet(ANIMATION_QUEUE_SET * p_aset, int mesh) { int j; for (j = 0; j < p_aset->last; j++) if (gl_Is_Included_In(&p_aset->animation[j], mesh)) return &p_aset->animation[j]; return NULL; } int gl_Include_Coincidence(SIM_ANIMATION * p_anim1, SIM_ANIMATION * p_anim2) { int i; for (i = 0; i < 8; i++) if (gl_Is_Included_In(p_anim2, p_anim1->mesh[i]) && p_anim1->mesh[i] != -1) return 1; return 0; } //------------------------------------------------------------------------------------------------ // vynuluje seznam animaci //------------------------------------------------------------------------------------------------ void gl_Zero_Queue(void) { int i, j; SIM_ANIMATION *p_animation; for (i = 0; i < 32; i++) { p_animation = &p_set_anim->animation[i]; p_animation->flag = 0; for (j = 0; j < 8; j++) p_animation->mesh[j] = -1; p_animation->p_anim = -1; p_animation->p_matrix = -1; p_animation->p_run = 0; p_animation->bnext = 0; p_animation->tStart[0].pProc = NULL; p_animation->tStart[1].pProc = NULL; p_animation->tTriger[0].pProc = NULL; p_animation->tTriger[1].pProc = NULL; p_animation->tTriger[2].pProc = NULL; p_animation->tTriger[3].pProc = NULL; p_animation->tTriger[4].pProc = NULL; p_animation->taMateral[0].pProc = NULL; p_animation->taMateral[1].pProc = NULL; p_animation->taMateral[2].pProc = NULL; p_animation->bconnected = 0; } p_set_anim->pMesh = 0; for (i = 0; i < 6; i++) p_set_anim->_3dsAnim[i].mesh = -1; p_set_anim->bSetMesh = 0; p_set_anim->iMeshID = 0; p_set_anim->iMesh = 0; p_set_anim->last = 0; } //------------------------------------------------------------------------------------------------ // zkontroluje, zda jsou animace hotovy //------------------------------------------------------------------------------------------------ int gl_Are_Animations_Done(LEVELINFO * p_Level) { int i, min = 101, flag; char bCheck_Result = p_Level->bCheck_Result; //char bCheck = p_Level->bCheck; gl_Are_Animations_Done_TEST: for (i = 0; i < p_set_anim->last; i++) { am_Animation_Status(&p_set_anim->animation[i], &am); gl_Do_Triger(&p_set_anim->animation[i]); flag = p_set_anim->animation[i].flag; if ((flag > -1) && (flag < min)) min = flag; } if (!bCheck_Result && (min >= 90) && (p_Level->Flip < 2) && (!p_Level->bTriger)) p_Level->bAllow_Key = 1; if (p_Level->bStone) p_Level->bAllow_Key = 0; if (min < 101) return 0; if (p_Level->Flip) { p_set_anim->last = 0; gl_Rozvaz_Meshe(); gl_Zero_Queue(); gl_Next_Anim_Queue_Set(p_Level); gl_Go_Animations(); p_Level->Flip--; goto gl_Are_Animations_Done_TEST; } return 1; } //------------------------------------------------------------------------------------------------ // set frame rate //------------------------------------------------------------------------------------------------ void gl_Set_Frame_Rate(void) { bSet_Frame_Rate = 1; } //------------------------------------------------------------------------------------------------ // Zero movement keys //------------------------------------------------------------------------------------------------ void gl_Zero_Key_Buffer(int *p_key, CONTROL_KEYS * p_keys) { p_key[p_keys->move_forward] = 0; p_key[p_keys->turn_back] = 0; p_key[p_keys->turn_left] = 0; p_key[p_keys->turn_right] = 0; } //------------------------------------------------------------------------------------------------ // Change destonation square which depends on Rotation //------------------------------------------------------------------------------------------------ void gl_Change_Destonation(LEVELINFO * p_Level, int *pos) { if (p_Level->Actual_Item == -1) return; switch (p_Level->Level[p_Level->Actual_Item]->Rotation) { case 0: pos[1]++; break; case 1: pos[0]++; break; case 2: pos[1]--; break; case 3: pos[0]--; break; } } //------------------------------------------------------------------------------------------------ // Returns index of object selected in inventory //------------------------------------------------------------------------------------------------ int gl_Inventory_Item_To_Object(LEVELINFO * p_Level, int Item, char bDec) { //int result = 0; int counter = 0; int act_count = 0; int i; OBJECTDESC *pObject; BACK_PACK *p_Back_Pack; if (p_Level->Actual_Item == -1) return 0; p_Back_Pack = p_Level->Level[p_Level->Actual_Item]->p_Back_Pack; while (counter <= Item) { if (act_count != 3 && act_count != 5) counter += p_Back_Pack->item[act_count]; act_count++; } act_count--; for (i = 0; i < p_Level->Count_Of_Objects; i++) { pObject = &p_Level->Object[i]; if ((pObject->Class == 13) && (pObject->SubClass == act_count)) { if (bDec) p_Back_Pack->item[act_count]--; break; } } return i; } //------------------------------------------------------------------------------------------------ // Returns index of object selected in inventory //------------------------------------------------------------------------------------------------ ITEMDESC *gl_Find_First_Destroed(LEVELINFO * p_Level, int Class, int SubClass) { int i; ITEMDESC Item; for (i = 0; i < p_Level->Count_Of_Items; i++) { Item = p_Level->Item[i]; if ((Item.bDestroed) && (Item.p_Object->Class == Class) && (Item.p_Object->SubClass == SubClass)) return &p_Level->Item[i]; } return NULL; } //------------------------------------------------------------------------------------------------ // fill key, time and create new frame //------------------------------------------------------------------------------------------------ int gl_Next_Demo_Frame(int Key, CONTROL_KEYS * p_control, char bOvladaniBerusek1, int *pos_o, int *pos_n, long item) { long eplased; if (Key == control.menu) return 1; Demo.Finish = timeGetTime(); eplased = demo_Eplased_Time(Demo.Start, Demo.Finish); if (bOvladaniBerusek1 && (Key == p_control->move_forward || Key == p_control->turn_back || Key == p_control->turn_left || Key == p_control->turn_right)) Demo.p_Last->Key = Level.Level[item]->Rotation + 100; else Demo.p_Last->Key = demo_Virual2Fuction(Key, p_control); Demo.p_Last->bOvladaniBerusek1 = bOvladaniBerusek1; Demo.p_Last->Time = eplased; if (pos_o) { Demo.p_Last->pos_o[0] = pos_o[0]; Demo.p_Last->pos_o[1] = pos_o[1]; Demo.p_Last->pos_o[2] = pos_o[2]; Demo.p_Last->pos_n[0] = pos_n[0]; Demo.p_Last->pos_n[1] = pos_n[1]; Demo.p_Last->pos_n[2] = pos_n[2]; } else { Demo.p_Last->pos_o[0] = -1; Demo.p_Last->pos_o[1] = -1; Demo.p_Last->pos_o[2] = -1; Demo.p_Last->pos_n[0] = -1; Demo.p_Last->pos_n[1] = -1; Demo.p_Last->pos_n[2] = -1; } if (demo_Create_Frame(&Demo) == NULL) return 0; return 1; } int gl_Rotation2Virtual(int initRot, int finishRot) { int rot = initRot - finishRot; float t[3], fr, fi, di; int s, ss; kam_pol_get((BOD *) t, &fr, &fi, &di); fr = fr / 90.0f; s = ftoi(fr); s = s % 4; if (s > 0) ss = 4 - s; else ss = abs(s); rot = 4 - (ss - finishRot); if (rot > 3) rot = rot % 4; else rot = abs(rot); //kprintf(1, "keyrot = %d, rot = %d", finishRot, rot); if (!rot) return control.move_forward; if (rot == 3) return control.turn_left; if (rot == 1) return control.turn_right; if (rot == 2) return control.turn_back; kprintf(1, "FUCK gl_Rotation2Virtual, int initRot = %d, int finishRot = %d, rot = %d", initRot, finishRot, rot); return 0; } int gl_Rotation2Rotation(int initRot, int finishRot) { int rot = initRot - finishRot; float t[3], fr, fi, di; int s, ss; kam_pol_get((BOD *) t, &fr, &fi, &di); fr = fr / 90.0f; s = ftoi(fr); s = s % 4; if (s > 0) ss = 4 - s; else ss = abs(s); rot = 4 - (ss - finishRot); if (rot > 3) rot = rot % 4; else rot = abs(rot); return rot; } //------------------------------------------------------------------------------------------------ // do next demo frame //------------------------------------------------------------------------------------------------ int gl_Do_Next_Demo_Frame(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { if (Demo.p_Last) { Demo.bOvladaniBerusek1 = Demo.p_Last->bOvladaniBerusek1; if (Demo.bOvladaniBerusek1 && Demo.p_Last->Key > 99) { if (Level.Flip && gl_Rotation2Virtual(Level.Level[Level.Actual_Item]->Rotation, Demo.p_Last->Key - 100) != Level.Level[Level.Actual_Item]->Rotation) return 0; key[gl_Rotation2Virtual(Level.Level[Level.Actual_Item]->Rotation, Demo.p_Last->Key - 100)] = 1; } else { if (Demo.p_Last->Key > 4 && Level.Flip) return 0; key[demo_Fuction2Virtual(Demo.p_Last->Key, &control)] = 1; } Demo.p_Last = Demo.p_Last->p_Next; } return 1; } //------------------------------------------------------------------------------------------------ // provede polozeni predmetu //------------------------------------------------------------------------------------------------ int gl_Drop_Item(int item, int *pos, LEVELINFO * p_Level) { DataHandle Data; int obj; int mesh; int new_pos[3], move[3]; int real_pos; ITEMDESC *p_real_posI; int Voda, vodapos[3]; POINTERSTRUCTURE *pS; int real; if (!gl_Is_Drop_Item_Possible(pos, p_Level)) return 0; gl_Logical2Real(pos[0], pos[1], pos[2], &real_pos, p_Level); obj = gl_Inventory_Item_To_Object(p_Level, item, 0); if (p_Level->Square[p_Level->Actual_Item].bUnderWater && !p_Level->Object[obj].SubClass && p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[0] < 2) return 0; obj = gl_Inventory_Item_To_Object(p_Level, item, 1); Data = kom_pridej_prvek_do_databaze(&(p_Level->Object[obj].Out_File)); if (Data == -1) { //MessageBox(Level.hWnd,"Error while adding item in databaze","Error",MB_OK); kprintf(1, "Error while adding item in databaze"); } mesh = kom_vloz_prvek_z_databaze(Data, pos[0], pos[2], pos[1], p_Level->Level[p_Level->Actual_Item]->Rotation, p_Level->Level[p_Level->Actual_Item]->p_Object->GUID); p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Count_of_Items--; new_pos[0] = pos[0]; new_pos[1] = pos[1]; new_pos[2] = gl_Find_Bottom(pos, &Voda, p_Level) + 2; gl_Get_Move(pos, new_pos, move); gl_Logical2Real(pos[0], pos[1], new_pos[2], &real_pos, p_Level); p_Level->Level[real_pos] = gl_Find_First_Destroed(p_Level, p_Level->Object[obj].Class, p_Level->Object[obj].SubClass); p_real_posI = p_Level->Level[real_pos]; p_real_posI->bDestroed = 0; p_real_posI->Index_Of_Game_Mesh = mesh; p_real_posI->Pos[0] = pos[0]; p_real_posI->Pos[1] = pos[1]; p_real_posI->Pos[2] = new_pos[2]; p_real_posI->Rotation = 0; if (move[2]) { int r = rand() % 2; BOD b(1, 1, 1); p_set->animation[p_set->last].p_anim = sim_vyrob_animaci(3, 3, 0); sim_vloz_pivot(p_set->animation[p_set->last].p_anim, 0.0f, 1.0f, 0.0f); sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 0, &b, 0, 0); if (r) sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 1, &b, (-1 * move[2]) * 20.0f, (-1 * move[2] * 2) - 1); else sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 1, &b, move[2] * 20.0f, (-1 * move[2] * 2) - 1); sim_vloz_klic_rotace(p_set->animation[p_set->last].p_anim, 2, &b, 0.0f, (-1 * move[2] * 2) + 4); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 0, 0.0f, 0.0f, 0.0f, 0); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 1, 0.0f, (float) (move[2] * 2), 0.0f, (-1 * move[2] * 2) - 1); sim_vloz_klic_posun(p_set->animation[p_set->last].p_anim, 2, 0.0f, (float) (move[2] * 2), 0.0f, (-1 * move[2] * 2) + 4); sim_interpoluj_animaci(p_set->animation[p_set->last].p_anim, (-1 * move[2]) * 2 + 5, 0); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(p_set->animation[p_set->last].p_anim, &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], mesh); //p_set->animation[p_set->last].mesh = mesh; if (new_pos[2] == 1 && gl_Check_Throw_off_Water(new_pos, new_pos[2], p_Level)) Voda = 0; if (Voda != -1) { pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); if (pS) { int percent, percent1; int x, y = pos[2] - new_pos[2]; Voda++; gl_Logical2Real(pos[0], pos[1], Voda, &real, p_Level); pS->p_Level = p_Level; pS->iParam = 1; pS->bParam = (pos[2] - Voda) / 2; pS->viParam2[0] = 1; pS->viParam2[1] = 0; pS->viParam2[2] = 0; vodapos[0] = pos[0]; vodapos[1] = pos[1]; vodapos[2] = Voda; memcpy((void *) pS->viParam1, (void *) vodapos, 3 * sizeof(int)); x = (int) floor(((pos[2] - (Voda + 1)) * 100) / (float) (pos[2] - new_pos[2])); y = (int) floor((((-1 * move[2] * 2) - 1) * 100) / (float) ((-1 * move[2] * 2) + 4)); am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Water, 0, real, reinterpret_cast(pS), (x * y) / 100, 1); percent = (x * y) / 100; x = (int) floor((100 / (float) (pos[2] - new_pos[2]))); percent1 = (x * y) / 100; am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Cakanec, 0, real, reinterpret_cast(pS), percent + percent1, 2); } } am_Set_Triger_Function(&p_set->animation[p_set->last], anmend_Item_Fall, 0, real_pos, reinterpret_cast(p_Level), (int) floor((float) (((-1 * move[2]) * 2 + 2) * 100) / (float) (((-1 * move[2]) * 2) + 5)), 0); rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Item_FallStartAnim, 0, real_pos, reinterpret_cast(p_Level)); p_set->last++; p_Level->Flip++; p_Level->status = 1; p_Level->bAllow_Key = 0; gl_Next_Queue_Set(p_Level); if (p_Level->Flip == 1) gl_Go_Animations(); } else { anmend_Item_Fall(0, real_pos, reinterpret_cast(p_Level)); anmend_Item_FallStartAnim(0, real_pos, reinterpret_cast(p_Level)); p_Level->status = 2; } return 1; } char gl_Get_Correspond_Rotation(int Side, char bDemo) { float t[3], fr, fi, di; int s, ss; kam_pol_get((BOD *) t, &fr, &fi, &di); fr = fr / 90.0f; s = ftoi(fr); s = s % 4; if (s > 0) ss = 4 - s; else ss = abs(s); ss += Side; if (ss > 3) ss -= 4; return ss; } //------------------------------------------------------------------------------------------------ // presune se na zadaneho brouka //------------------------------------------------------------------------------------------------ int gl_Moveto_Beatle(int btl, LEVELINFO * p_Level) { CAMERA_ANIMATION camera; int i = _3d_Is_There_Beetle(btl, p_Level); if (i == -1) return 0; if (p_Level->Beetle[i] != -1) { BOD b; float dist; int frame; int rot; int last_b; //p_camera->flag = 0; p_Level->Beetle_Index = i; last_b = Level.Actual_Item; p_Level->Actual_Item = gl_Select_Beatle(i, p_Level); if (p_Level->Actual_Item != -1 && last_b != Level.Actual_Item) gl_Select_BeatleFlek(p_Level->Level[p_Level->Actual_Item], p_Level); if (p_Level->Actual_Item == -1) return 0; if (p_Level->bPosouvatKameru) { kom_mesh_get_float(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, &b.x, &b.y, &b.z, &rot); kam_pol_get((BOD *) & camera.finish.Target, &camera.finish.r, &camera.finish.fi, &camera.finish.Distance); dist = vzdal_bodu_bod(&b, (BOD *) & camera.finish.Target); frame = (long) ceil(dist * 3); kam_pol_anim(&b, camera.finish.r, camera.finish.fi, camera.finish.Distance, &cam_flag, GK_REMOVE, frame, 1.0f); } } return 1; } int gl_Screen_Shot(int i) { char text[MAX_FILENAME]; FILE *f = NULL; do { if (snprintf(text, sizeof(text), "%s%s%04d.bmp", CurrentWorkingDirectory, DIR_SLASH_STRING"screenshot", i) >= (int) sizeof(text)) { break; } f = fopen(text, "r"); if (!f) break; i++; fclose(f); } while (f); lsi_Make_Screenshot(text); kprintf(1, "Saved screenshot to %s.", text); return i; } void gl_Init_Buttons(LEVELINFO * p_Level) { int i, pos[3]; int r; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->p_Object->Class == 10) { memcpy((void *) pos, (void *) p_Level->Level[i]->Pos, 3 * sizeof(int)); pos[2]++; gl_Logical2Real(pos[0], pos[1], pos[2], &r, p_Level); if (p_Level->Level[r]) p_Level->Level[i]->p_Back_Pack->item[0] = 1; else p_Level->Level[i]->p_Back_Pack->item[0] = 0; } } void gl_Flip(AUDIO_DATA * pad, LEVELINFO * p_Level, int *Frame_Rate_Counter, char *bCursor, int *Cursor_Time_Out, CAMERA_ANIMATION * p_camera, unsigned long *NoKeyCounter, char *bBeetleAdded, char *bLastSunuti, CAMERA_STRUCT * pGetCamera, char *no_Menu, int *act_item, int *iReturn, char demo, char *bOvladaniBerusek1) { float orientation[6]; if(timeGetTime() - p_Level->dwLastMusicCheck > 10000) { if(!ogg_playing() && (pad->Music_Gain > 0.05f) && (!p_Level->bExit) && karmin_aktivni) ap_Play_Song(0,1,pad); p_Level->dwLastMusicCheck = timeGetTime(); } (*Frame_Rate_Counter)++; if (bSet_Frame_Rate) { am.frame_per_quater = (float) (*Frame_Rate_Counter); bSet_Frame_Rate = 0; (*Frame_Rate_Counter) = 0; if(karmin_aktivni) as_Do_Ambient_Sounds(p_Level->Environment.id,pad,p_Level); if (*bCursor) { (*Cursor_Time_Out)++; if ((*Cursor_Time_Out) > 20) { (*bCursor) = 0; (*Cursor_Time_Out) = 0; sHint.bHint = 0; } } //zmena vetru if (!(rand() % 20)) am_Change_Wind(p_Level); } //ap_Count_Environment(p_ad,&Level); /* if(!p_camera->anim_type) camera_Animate_Jumping(p_camera); else camera_Animate(p_camera);*/ if (*NoKeyCounter && !(*bBeetleAdded) && !p_Level->status) { if (p_Level->Actual_Item != -1) if (am_Add_Beetle_Animation(p_Level->Level[p_Level->Actual_Item]-> Index_Of_Game_Mesh, p_Level, p_Level->Level[p_Level->Actual_Item]->Rotation, 0)) *bBeetleAdded = 1; *bLastSunuti = 0; } //zmen pozici posluchace podle kamery kam_get_float_ext(orientation, pGetCamera->Position); orientation[0] = -orientation[0]; orientation[1] = -orientation[1]; orientation[2] = -orientation[2]; adas_Set_Listener_Position(pGetCamera->Position); adas_Set_Listener_Orientation(orientation); am_Animate_Items(&am, p_Level); am_Animate_Beetles(p_Level); am_Do_Zhave_castice(p_Level); am_Do_Flares(p_Level); am_Do_Lifts(p_Level); am_Do_Water(p_Level); am_Do_Water_KolaB(p_Level); am_Do_Bubliny_Berusek(p_Level); am_Do_BublVybuchy(p_Level); am_Do_Exit_Efects(p_Level); am_Do_Exit_Sparks(p_Level); am_Do_TelCSparks(p_Level); am_Do_Rain(&p_Level->Rain); am_Do_RainB(&p_Level->StreetRain); am_Do_Snow(&p_Level->Snow); am_Do_Nature_Effects(p_Level); am_Do_BarelSparks(p_Level); am_Do_BeatleSmokes(p_Level); am_Obsluha_Koure_Brouku(p_Level); am_Do_BublSystemE(p_Level); am_Do_BublSystemC(p_Level); am_Do_Street_Lights(p_Level); am_Do_Swamp_Lights(p_Level); am_Do_Fairies(p_Level); am_Do_Star_Lights(p_Level); am_Do_StarFall(&Level); am_Do_CandleSparks(&Level); am_Do_CandleSmoke(&Level); spracuj_spravy(0); kom_klavesy_hra(); kom_kresli_level(); if (!*no_Menu) _3d_Draw_Menus(bCursor, Cursor_Time_Out, p_Level, *act_item, iReturn, demo); else flip(); if (*bCursor) *act_item = iReturn[0]; p_Level->bMenuButton = iReturn[1]; } void gl_Beetle_Exit(LEVELINFO * p_Level) { BOD b; float dist; int frame; int rot, iPos[3], i; CAMERA_ANIMATION camera; ANIMATION_QUEUE_SET *p_prev_set = gl_Get_Prev_Queue_SetA(2, p_Level); if (p_Level->Actual_Item == -1) return; if (p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek) { kom_flek_zrus(p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek); p_Level->Level[p_Level->Actual_Item]->Square.Flek.pFlek = 0; } memcpy((void *)iPos, (void *)p_Level->Level[p_Level->Actual_Item]->Pos, 3*sizeof(int)); iPos[2]--; gl_Logical2Real(iPos[0], iPos[1], iPos[2], &i, p_Level); if (p_prev_set->animation[1].p_run) { rani_pripoj_funkci(p_prev_set->animation[1].p_run, anmend_Exit, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[i]->Index_Of_Game_Mesh, reinterpret_cast(p_Level)); } else if (p_prev_set->animation[0].p_run) { rani_pripoj_funkci(p_prev_set->animation[0].p_run, anmend_Exit, p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[i]->Index_Of_Game_Mesh, reinterpret_cast(p_Level)); } else { anmend_Exit(p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level->Level[i]->Index_Of_Game_Mesh, reinterpret_cast(p_Level)); } am_Remove_Beetle_Animation(p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, p_Level); p_Level->Beetle[(int)p_Level->Beetle_Index] = -1; p_Level->Level[p_Level->Actual_Item]->bDestroed = 1; p_Level->Level[p_Level->Actual_Item] = 0; p_Level->Actual_Item = -1; p_Level->Actual_Item = gl_Find_Next_Beatle(0, p_Level); if (p_Level->Actual_Item == -1) p_Level->Level_Exit = 1; else { gl_Create_SelectionFlek(p_Level->Level[p_Level->Actual_Item], p_Level); if (p_Level->bPosouvatKameru) { kom_mesh_get_float(p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, &b.x, &b.y, &b.z, &rot); kam_pol_get((BOD *) & camera.finish.Target, &camera.finish.r, &camera.finish.fi, &camera.finish.Distance); dist = vzdal_bodu_bod(&b, (BOD *) & camera.finish.Target); frame = (long) ceil(dist * 2); kam_pol_anim(&b, camera.finish.r, camera.finish.fi, camera.finish.Distance, &cam_flag, GK_REMOVE, frame, 1.0f); } } p_Level->bExit = 0; } int gl_Get_Count_Of_Action_Items(LEVELINFO * p_Level) { int i, x = 0; for (i = 0; i < p_Level->Count_Of_Items; i++) if (p_Level->Action_Item[i] == -1) return x; else x++; return x; } void gl_Udelej_Krychlicku(int *p, int *iPos, LEVELINFO * p_Level, float r, float g, float b) { KOFOLOVA_CARA2 *pCara; float pos[3]; kom_get_fyz_souradnice(iPos[0], iPos[2], iPos[1], (BOD *) pos); pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] - 1; pCara->p1.y = pos[1]; pCara->p1.z = pos[2] - 1; pCara->p2.x = pos[0] + 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] - 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] + 1; pCara->p1.y = pos[1]; pCara->p1.z = pos[2] - 1; pCara->p2.x = pos[0] + 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] + 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] + 1; pCara->p1.y = pos[1]; pCara->p1.z = pos[2] + 1; pCara->p2.x = pos[0] - 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] + 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] - 1; pCara->p1.y = pos[1]; pCara->p1.z = pos[2] + 1; pCara->p2.x = pos[0] - 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] - 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] - 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] - 1; pCara->p2.x = pos[0] + 1; pCara->p2.y = pos[1] + 2; pCara->p2.z = pos[2] - 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] + 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] - 1; pCara->p2.x = pos[0] + 1; pCara->p2.y = pos[1] + 2; pCara->p2.z = pos[2] + 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] + 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] + 1; pCara->p2.x = pos[0] - 1; pCara->p2.y = pos[1] + 2; pCara->p2.z = pos[2] + 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] - 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] + 1; pCara->p2.x = pos[0] - 1; pCara->p2.y = pos[1] + 2; pCara->p2.z = pos[2] - 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] - 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] - 1; pCara->p2.x = pos[0] - 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] - 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] + 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] - 1; pCara->p2.x = pos[0] + 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] - 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] - 1; pCara->p1.y = pos[1] + 2; pCara->p1.z = pos[2] + 1; pCara->p2.x = pos[0] - 1; pCara->p2.y = pos[1]; pCara->p2.z = pos[2] + 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; pCara = &p_Level->pCara[(*p)]; pCara->p1.x = pos[0] + 1; pCara->p1.y = pos[1]; pCara->p1.z = pos[2] + 1; pCara->p2.x = pos[0] + 1; pCara->p2.y = pos[1] + 2; pCara->p2.z = pos[2] + 1; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; (*p)++; } void gl_kresli_Caru(KOFOLOVA_CARA2 * pCara, ITEMDESC * pItem, int i, LEVELINFO * p_Level, float r, float g, float b) { int iPos[3]; kom_get_fyz_souradnice(pItem->Pos[0], pItem->Pos[2], pItem->Pos[1], &pCara->p1); pCara->p1.y++; gl_Real2Logical(pItem->Connection[i], iPos, p_Level); kom_get_fyz_souradnice(iPos[0], iPos[2], iPos[1], &pCara->p2); pCara->p2.y++; pCara->b1.r = r; pCara->b1.g = g; pCara->b1.b = b; pCara->b2.r = r; pCara->b2.g = g; pCara->b2.b = b; } void gl_Vytvor_Seznam_Car(LEVELINFO * p_Level) { // KOFOLOVA_CARA2 *pCara; ITEMDESC *pItem; int i, x = gl_Get_Count_Of_Action_Items(p_Level); int p = 0, iPos[3]; if (p_Level->pCara) free((void *) p_Level->pCara); p_Level->pCara = (KOFOLOVA_CARA2 *) malloc(((x * 25) + 4) * sizeof(KOFOLOVA_CARA2)); if (!p_Level->pCara) return; for (i = 0; i < x; i++) if (p_Level->Level[p_Level->Action_Item[i]]) { pItem = p_Level->Level[p_Level->Action_Item[i]]; if (pItem->p_Object->Class == 9 || pItem->p_Object->Class == 10 || pItem->p_Object->Class == 11) { if (pItem->p_Object->Class == 10 && p_Level->Level[pItem->Connection[0]]) { gl_kresli_Caru(&p_Level->pCara[p], pItem, 0, p_Level, 0, 0, 1); p++; gl_Udelej_Krychlicku(&p, pItem->Pos, p_Level, 0, 0, 1); gl_Real2Logical(pItem->Connection[0], iPos, p_Level); gl_Udelej_Krychlicku(&p, iPos, p_Level, 0, 0, 1); } else if (pItem->p_Object->Class == 10 && p_Level->Level[pItem->Connection[1]]) { gl_kresli_Caru(&p_Level->pCara[p], pItem, 1, p_Level, 0, 0, 1); p++; gl_Udelej_Krychlicku(&p, pItem->Pos, p_Level, 0, 0, 1); gl_Real2Logical(pItem->Connection[1], iPos, p_Level); gl_Udelej_Krychlicku(&p, iPos, p_Level, 0, 0, 1); } else { float r = 0, g = 0, b = 0; if (pItem->p_Object->Class == 9) { r = 0; g = 0; b = 1; } if (pItem->p_Object->Class == 11) { if (!pItem->p_Object->SubClass) { r = 1; g = 1; b = 0; } else if (pItem->p_Object->SubClass == 1) { r = 1; g = 0; b = 0; } else { r = 0; g = 0; b = 1; } } if (p_Level->Action_Item[i] != pItem->Connection[0]) gl_kresli_Caru(&p_Level->pCara[p], pItem, 0, p_Level, r, g, b); else gl_kresli_Caru(&p_Level->pCara[p], pItem, 1, p_Level, r, g, b); p++; gl_Udelej_Krychlicku(&p, pItem->Pos, p_Level, r, g, b); if (p_Level->Action_Item[i] != pItem->Connection[0]) gl_Real2Logical(pItem->Connection[0], iPos, p_Level); else gl_Real2Logical(pItem->Connection[1], iPos, p_Level); gl_Udelej_Krychlicku(&p, iPos, p_Level, r, g, b); } } } kom_set_linelist((KOFOLOVA_CARA *) p_Level->pCara, p); } int gl_Beetle2VirtualKey(int Beetle, CONTROL_KEYS * p_control) { if (Beetle == 0) return p_control->beatle1; if (Beetle == 1) return p_control->beatle2; if (Beetle == 2) return p_control->beatle3; if (Beetle == 3) return p_control->beatle4; if (Beetle == 4) return p_control->beatle5; if (Beetle == 5) return p_control->beatle6; return 0; } int gl_Act_Item2VirtualKey(int Act_Item, CONTROL_KEYS * p_control) { if (Act_Item == 0) return p_control->item1; if (Act_Item == 1) return p_control->item2; if (Act_Item == 2) return p_control->item3; if (Act_Item == 3) return p_control->item4; return 0; } void gl_Start_Level_Environment(LEVELINFO * p_Level, AUDIO_DATA * p_ad) { WEATHERSTRUCT *p_Weather; NATUREEFFECTSTRUCT *pNE; int i, kvalita_castic; LEVEL_ENVIRONMENT *pEnv = kom_get_level_environment(); kvalita_castic = GetPrivateProfileInt("game", "kvalita_casticp", 0, ini_file); kvalita_castic++; p_Level->Rain.bRain = 0; p_Level->Snow.bSnow = 0; p_Level->Mist.bMist = 0; p_Level->Rain.bWaterCircles = 0; if (!pEnv) { kprintf(1, "kom_get_level_environment vratila NULL!!!"); ap_Load_Environment("default.env", p_Level, p_ad); return; } if (strlen(pEnv->cEnv)) ap_Load_Environment(pEnv->cEnv, p_Level, p_ad); else ap_Load_Environment("default.env", p_Level, p_ad); p_Level->bUnderWaterLevel = p_Level->Environment.bunderwater; if (!p_Level->iNSrart) p_Level->iFloorMaterial = ap_Load_Sound_List(p_ad, p_Level->Environment.extsoundf, 1); if (strlen(pEnv->cAnimEff)) lsi_Load_Level_Script(p_Level, pEnv->cAnimEff); for (i = 0; i < 3; i++) if (pEnv->Weather[i].bUsed) { switch (pEnv->Weather[i].iWeather) { case 1: { p_Level->Rain.bRain = 1; p_Weather = &pEnv->Weather[i]; am_Create_Rain(p_Level, &p_Level->Rain, p_Weather->fDist, (int) ceil(p_Weather->uiDensity / kvalita_castic), p_Weather->uiIntensity, p_Weather->fmaxDivergence, p_Weather->fSky); } break; case 2: { p_Level->Snow.bSnow = 1; p_Weather = &pEnv->Weather[i]; am_Create_Snow(p_Level, &p_Level->Snow, p_Weather->fDist, (int) ceil(p_Weather->uiDensity / kvalita_castic), p_Weather->uiIntensity, p_Weather->fmaxDivergence, p_Weather->fSky); } break; case 3: { p_Level->Mist.bMist = 1; p_Weather = &pEnv->Weather[i]; am_Create_Prizemni_Mlhu(p_Level, p_Weather->fDist, p_Weather->fSky); } break; } } for (i = 0; i < 10; i++) if (pEnv->NatureEffect[i].bUsed) { pNE = &pEnv->NatureEffect[i]; am_Create_Nature_Effect(p_Level, pNE->EffectID, pNE->fRadius, pNE->uiDensity, pNE->uiIntensity, pNE->fSky, pNE->fLowPlane); } am_Create_Water_Effect(p_Level); p_Level->iNSrart++; } void gl_Mesh_Click(LEVELINFO * p_Level, char demo, AUDIO_DATA * p_ad) { float pos[3]; int i, bmesh, btl, rot; int c = 0; bmesh = kom_get_mesh_mys(12); if (bmesh == -1) { kprintf(1, "gl_Mesh_Click - kom_get_mesh_mys vratil -1"); return; } for (i = 0; i < 6; i++) if (p_Level->BublSystem[i].mesh == bmesh) { btl = p_Level->Item[p_Level->BublSystem[i].iItem].p_Object->SubClass; if (!demo) gl_Next_Demo_Frame(gl_Beetle2VirtualKey(btl, &control), &control, 0, NULL, NULL, Level.Actual_Item); kom_zpruhlednovat_prvky_zmena_berusky(); kom_mesh_get_float(p_Level->Item[p_Level->BublSystem[i].iItem]. Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &rot); if(gl_Moveto_Beatle(btl, p_Level)) ap_Play_Sound(0,1,0, pos, gl_Choose_Wave_Index(23), NULL, p_ad); kprintf(1, "prepnito na berusku mesh = %d", bmesh); c++; } if (!c) kprintf(1, "nepodarilo se prepnout na berusku ... mesh = %d", bmesh); } int gl_CheckCamera(LEVELINFO * p_Level) { if (p_Level->bPosouvatKameru && p_Level->Flip) return 0; else return 1; } void gl_Resetini(LEVELINFO * p_Level, char *bOvladaniBerusek1) { p_Level->bPosouvatKameru = GetPrivateProfileInt("game", "posouvat_kameru", 0, ini_file); *bOvladaniBerusek1 = GetPrivateProfileInt("game", "ovladani", 0, ini_file); p_Level->bPohled_Berusky = GetPrivateProfileInt("game", "pohled_berusky", 0, ini_file); Bind_Keys(&control); gl_Get_PR_ScanCode(&p_ber->conf_p_key, &p_ber->conf_r_key); Load_ini(); kom_reload_ini(); ber_test_zrcadla(); } int gl_Change_Dir_To_Level(char *p_Level_Name) { if(chdir(SAVE_DIR)) return(FALSE); if(chdir(p_Level_Name)) return(FALSE); return(TRUE); } //------------------------------------------------------------------------------------------------ // Run level of selected number // return 1 = Level dokoncen uspesne // 2 = Level restart // 3 = Level nedokoncen uspesne //------------------------------------------------------------------------------------------------ int gl_Run_Level(char *p_Level_Name, char *p_Env_Name, AUDIO_DATA * p_ad, int iCPU) { int iKeyLine[3]; int iKeyCursor; int demo_key[POCET_KLAVES]; int *p_key; int Return; int pos_n[3]; int Frame_Rate_Counter; long _new; float orientation[6]; char bCursor; int Cursor_Time_Out; int act_item; int iReturn[2]; char bLastSunuti; unsigned long NoKeyCounter; char bBeetleAdded; CAMERA_STRUCT GetCamera; char bOvladaniBerusek1, bLastOvladaniBerusek1; char bVisibility; char bCameraIntro; char bHint; int iMenuAnimation = 0; char cLevelName[64]; char cDemoName[128]; LEVEL_ENVIRONMENT *pEnv; int iRestart = 0; char bRestart = 0; char bPause = 0; char no_Menu = 0; char bCamera; int cameraanim= -1; int bmpc = 0; DEMOKEYFRAME *p_Last; Level.iNSrart = 0; // camera.last_move = -1; Level.bInventory = GetPrivateProfileInt("game", "bInventory", 1, ini_file); Level.bTopLedge = GetPrivateProfileInt("game", "bTopLedge", 1, ini_file);; Level.Level_Exit = 0; Level.lCamera.Position[0] = 0; Level.lCamera.Position[1] = 0; Level.lCamera.Position[2] = 0; Level.lCamera.r = 0; Level.lCamera.fi = 0; Level.lCamera.Distance = 0; Level.iFloorMaterial = 0; PLAY_LEVEL_START: tools_Parse_Command_Line(p_Level_Name, cLevelName, cDemoName, &demo); ZeroMemory(&sKuk, sizeof(KUK_STATE)); _3d_Nahraj_Kuk(); PRCameraFlag = 0; ZeroMemory(&sHint, sizeof(HINT_STATE)); sKuk.bKUK = 0; // init values Frame_Rate_Counter = 0; /* position[0] = 0; position[1] = 0; position[2] = 0; */ orientation[0] = 0; orientation[1] = 1; orientation[2] = 0; orientation[3] = 0; orientation[4] = 0; orientation[5] = 1; /* p_pos[0] = 1; p_pos[1] = 1; p_pos[2] = 1; */ act_item = -1; /* top_item = -1; Active_Beetle = 0; */ iReturn[0] = 0; iReturn[1] = 0; // camera.flag = 0; // camera.bChange = 1; Level.bSikminaSound = 0; Level.bSunuti = 0; bLastSunuti = 0; Level.bVypniFlek = 0; NoKeyCounter = 0; bBeetleAdded = 1; Level.bTriger = 0; // bInitCameraSet = 0; // LastRotation = -1; cameraflag = 0; PRCameraFlag = 0; PRCameraFlagChange = 0; Level.bMenuButton = 0; Level.bMenuRunning = 0; Level.pCara = NULL; Level.bSikminaUpExeption = 0; bHint = 0; bCamera = 1; Level.bB1ExtraCameraRot = 0; Level.lLevel_Exitc = 2000; Level.StreetRain.bRain = 0; Level.StreetRain.bWaterCircles = 0; Level.bResetini = 0; Level.bSaveDemo = 0; Level.bUnderWaterLevel = 0; Level.iNumOfSteps = 0; Level.dwStartTime = 0; Level.dwPlayTime = 0; Level.bStoneSound = 0; Level.iCursor = 0; Level.iKursorAnimation = K_CHYBA; Level.iKursorMesh = K_CHYBA; Level.bRestart = 0; Level.iMessageBoxReturn = -1; Level.bCancelMenu = 0; Level.bReturnToMenu = 0; Level.bDemoSaveExeption = 0; Level.bGameResume = 0; iKeyCursor = 0; ZeroMemory(iKeyLine, 3 * sizeof(int)); am_Change_Wind(&Level); Level.bPosouvatKameru = GetPrivateProfileInt("game", "posouvat_kameru", 0, ini_file); bLastOvladaniBerusek1 = bOvladaniBerusek1 = GetPrivateProfileInt("game", "ovladani", 0, ini_file); bVisibility = GetPrivateProfileInt("game", "bugs_highlight", 0, ini_file); Level.bPohled_Berusky = GetPrivateProfileInt("game", "pohled_berusky", 0, ini_file); if (bRestart) bCameraIntro = 0; else bCameraIntro = GetPrivateProfileInt("game", "camera_intro", 0, ini_file); kprintf(1, "demo_Load..."); if (demo) { char Demo_File[255]; strcpy(Demo_File, SAVE_DIR); strcat(Demo_File, DIR_SLASH_STRING); strcat(Demo_File, cDemoName); if (!demo_Load(&Demo, Demo_File, &bOvladaniBerusek1, cLevelName, p_Env_Name)) { kprintf(1, "Chyba pri nahravani dema!"); return 2; } Demo.p_Last = Demo.p_First; } RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); Bind_Keys(&control); Load_ini(); Level.p_ad = &ad; Level.Base_Priority = iCPU; RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); //LEVEL LOAD////////////////////////////////////////////////// if (!strcmp(p_Env_Name, "LOAD_GAME")) { BUNKA_LEVELU_DISK *b_l_d; int isize; char ctext[MAX_FILENAME]; lsi_Get_Dir_Name(ctext, cLevelName); if(!gl_Change_Dir_To_Level(ctext)) return(-1); kprintf(1, "lsi_Create_Level_Raw..."); if (!lsi_Create_Level_Raw(cLevelName, &b_l_d, &isize)) { // MyMessageBox(hwnd_hry, "##error_title", "##level_load_error",""); return(-1); } kprintf(1, "kom_load_level..."); kom_load_level(cLevelName, 0, 0, b_l_d, isize); if(!gl_Change_Dir_To_Level(ctext)) { // MyMessageBox(hwnd_hry, "##error_title", "##level_load_error",""); return(-1); } kprintf(1, "free((void *) b_l_d);"); free((void *) b_l_d); } else { BUNKA_LEVELU_DISK *b_l_d; int isize; char ctext[MAX_FILENAME]; if (chdir(GAME_LEVEL_DIR)) return -1; lsi_Get_Dir_Name(ctext, cLevelName); if (chdir(ctext)) return -1; kprintf(1, "lsi_Create_Level_Raw..."); if (!lsi_Create_Level_Raw(cLevelName, &b_l_d, &isize)) return -1; strncpy(Level.cLoadedFrom, cLevelName, 256); kprintf(1, "kom_load_level..."); kom_load_level(cLevelName, 1, bRestart, b_l_d, isize); if (chdir(GAME_LEVEL_DIR)) return -1; lsi_Get_Dir_Name(ctext, cLevelName); if (chdir(ctext)) return -1; kprintf(1, "free((void *) b_l_d);"); free((void *) b_l_d); } RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kprintf(1, "lsi_Load_Items"); if (lsi_Load_Items(&Level) == FALSE) { kerror(1, "Unable to load items!"); return -1; } RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kprintf(1, "lsi_Load_Level"); Return = lsi_Load_Level(cLevelName, &Level); if (lsi_Load_Saved_Level(cLevelName, &Level) == -2) { Level.Level_Exit = 2; Level.lLevel_Exitc = 0; } strcpy(Level.cLevelName, cLevelName); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); if (Return == -1) { lsi_Release_Items(&Level); kerror(1, "Unable to load level %s!", Level.cLevelName); } if (Return > 0) { char text[100]; sprintf(text, "Unresolved GUIDs: %d", Return); kprintf(1, text); } if(export_level) { json_export_level(&Level); } kprintf(1,"gl_Set_Water_Marks, w_Create_Water_Boundaries, gl_Add_Walls_Bellow_Lifts..."); gl_Set_Water_Marks(&Level); w_Create_Water_Boundaries(); gl_Add_Walls_Bellow_Lifts(&Level); //gl_Add_Walls_Bellow_LiftsH(&Level); if (!am_Init(&am, &Level)) { lsi_Release_Level(&Level); lsi_Release_Items(&Level); kerror(1, "Unable to init animation module!"); return -1; } else am.p_ad = p_ad; RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kprintf(1, "fn_Set_Font..."); if (!fn_Set_Font(cFontDir[1])) kprintf(1, "Unable to set font!"); if (!fn_Load_Bitmaps()) kprintf(1, "Unable to load font bitmaps"); kprintf(1, "fn_Texture..."); fn_Texture(1); _3d_Load_Animations(); fn_Release_Font(1); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); am_Init_Zhave_Castice(&Level); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kprintf(1, "kom_post_init_level..."); kom_post_init_level(); kprintf(1, "kom_pridej_kurzor_do_levelu..."); Level.iKursorMesh = kom_pridej_kurzor_do_levelu(); if (Level.iKursorMesh == K_CHYBA) kprintf(1, "kom_pridej_kurzor_do_levelu == K_CHYBA"); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kprintf(1, "gl_Pripoj_Flek_k_Beruskam..."); gl_Pripoj_Flek_k_Beruskam(&Level); kprintf(1, "gl_Pripoj_Flek_k_Predmetum..."); gl_Pripoj_Flek_k_Predmetum(&Level); kprintf(1, "gl_Init_Buttons..."); gl_Init_Buttons(&Level); kprintf(1, "am_Create_Sparks_To_Exits..."); am_Create_Sparks_To_Exits(&Level); kprintf(1, "am_Start_Animace_Pontonek..."); am_Start_Animace_Pontonek(&Level); kprintf(1, "am_Start_Barels..."); am_Start_Barels(&Level); kprintf(1, "am_Create_Steps_System..."); am_Create_Steps_System(&Level); am_Start_Joint_Animations(); am_Create_Item_Lights(&Level); if (iActualScene == 5) am_Start_Voda_Kanal(); //am_Start_Voda_Akvarko(); kprintf(1, "gl_Start_Level_Environment..."); gl_Start_Level_Environment(&Level, p_ad); if (Level.bUnderWaterLevel) { kprintf(1, "gl_Set_Underwater_Level"); gl_Set_Underwater_Level(&Level); } kprintf(1, "gl_Set_Underwater_Level_Snorchl..."); gl_Set_Underwater_Level_Snorchl(&Level); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); //nastav uvodni visibility kprintf(1, "kom_zpruhlednovat_prvky..."); kom_zpruhlednovat_prvky(bVisibility); //load animacnich materialu kprintf(1, "kom_amat_mesh_get_num..."); Level.iMaterialb = kom_amat_mesh_get_num(); Level.pMaterialb = (MATERIAL_BUNKA_K *)mmalloc(Level.iMaterialb * sizeof(MATERIAL_BUNKA)); kom_amat_mesh_get_all((MATERIAL_BUNKA *)Level.pMaterialb); lsi_Bind_Materials2Items(&Level); kprintf(1, "gl_Find_Next_Beatle..."); am.frame_per_quater = 1; Level.Beetle_Index = -1; Level.Actual_Item = gl_Find_Next_Beatle(0, &Level); kprintf(1, "gl_Create_SelectionFlek..."); if (Level.Actual_Item != -1) gl_Create_SelectionFlek(Level.Level[Level.Actual_Item], &Level); adas_Set_Listener_Environment(Level.Environment.room); as_Start(Level.Environment.id,p_ad,&Level); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kam_get_float(orientation); adas_Set_Listener_Orientation(orientation); kprintf(1, "demo_Init..."); if (!demo) { if (demo_Init(&Demo) == NULL) { kerror(1, "Unable to create first demo frame"); } } RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); Level.status = 0; Level.bAllow_Key = 1; Level.bCheck = 0; Level.Level_Exit = 0; Level.bExit = 0; Level.Item_Lock = 0; Level.Throw_off = 0; Level.Move_Exeption = 0; Level.Actual_Qset = 0; Level.Actual_Anim_Qset = 0; Level.Flip = 0; kprintf(1, "gl_Next_Anim_Queue_Set..."); gl_Next_Anim_Queue_Set(&Level); gl_Next_Anim_Queue_Set(&Level); gl_Next_Anim_Queue_Set(&Level); gl_Zero_Queue(); gl_Next_Anim_Queue_Set(&Level); gl_Zero_Queue(); gl_Next_Anim_Queue_Set(&Level); gl_Zero_Queue(); gl_Next_Queue_Set(&Level); gl_Next_Queue_Set(&Level); bCursor = 0; Cursor_Time_Out = 21; if (demo) { if (demo == 1) Demo.dwTimeCounter = 0; } else Demo.Start = timeGetTime(); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); kprintf(1, "RunMenuLoadScreenRelease..."); RunMenuLoadScreenRelease(3); kprintf(1, "kom_get_level_environment, kam_3ds_nahraj_animaci..."); pEnv = kom_get_level_environment(); if (pEnv) { char file[MAX_FILENAME]; strcpy(file, GAME_DATA_DIR); strcat(file, DIR_SLASH_STRING); strcat(file, pEnv->cCam); cameraanim = kam_3ds_nahraj_animaci(pGDataDir, file); if (cameraanim != K_CHYBA) { kam_set_kino_screen(p_ber); kom_zpruhlednovac_off(); Level.bInventory = 0; Level.bTopLedge = 0; kam_start(cameraanim, &cameraflag, GK_REMOVE, 0, 0); } else cameraflag = -1; if (!bCameraIntro) { BOD p_p(0,10,0), p_t(0,0,0); // default camera values float p_roll = 0; if (kam_3ds_cti_klic(cameraanim, 1, &p_p, &p_t, &p_roll) != K_CHYBA) { kam_stop(); kam_3ds_set(&p_p, &p_t, p_roll); } kam_set_normal_screen(p_ber); kom_zpruhlednovac_on(); Level.bInventory = GetPrivateProfileInt("game", "bInventory", 1, ini_file); Level.bTopLedge = GetPrivateProfileInt("game", "bTopLedge", 1, ini_file); cameraflag = -1; } } bRestart = 0; Level.dwStartTime = timeGetTime(); kprintf(1, "ap_Play_Song..."); ogg_gain(p_ad->Music_Gain); ap_Play_Song(0,1,p_ad); Level.dwLastMusicCheck = timeGetTime(); kprintf(1, "ap_Play_Song DONE..."); // When playing a demo, we will look at `demo_key' for movement // keys, otherwise `key'. if (demo) { memset(demo_key, 0, sizeof(demo_key)); p_key = demo_key; } else p_key = key; p_Last = NULL; while (!Level.Level_Exit || Level.lLevel_Exitc > 0) { //brouk na exitu if (Level.bExit) gl_Beetle_Exit(&Level); if (!Level.bMenuRunning && !Level.Level_Exit) { if (key[K_F3] && !demo) { key[K_F3] = 0; if (cameraflag == -1) { WCHAR cText[128]; PRCameraFlag = 0; ZeroMemory(cText, 128); RunMenuLoadGameLoad2("Mmload_game_load3d.txt", Level.p_ad, &Level, &am, 1, cText); PRCameraFlag = 1; if (wcslen(cText)) { Level.Level_Exit = 4; Level.lLevel_Exitc = 0; //TODO <----------------------- cText = jmeno levelu na load ZeroMemory(Level.cLevelName, 64); lsi_Save_Exist(cText, Level.cLevelName); //WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, cText, wcslen(cText), Level.cLevelName, 63, NULL, NULL); } } } if (key[control.menu] && cameraflag == -1) { float fpos[3] = { 0, 0, 0 }; sHint.bHint = 0; key[control.menu] = 0; Level.bLastTopLedge = Level.bTopLedge; Level.bLInventory = Level.bInventory; Level.bInventory = 1; Level.bTopLedge = 1; _3d_Load_From_Sys_To_Video(107); fn_Load_Textures_From_RAM(); Level.bMenuRunning = 1; _3d_Start_Animation(14, NULL, &iMenuAnimation); ap_Play_Sound(0,1,0, fpos, gl_Choose_Wave_Index(23), NULL, p_ad); /*Level.Level_Exit = 2; Level.lLevel_Exitc = 0; */ } if (key[control.pause]) { key[control.pause] = 0; if (demo) { if (!bPause) bPause = 1; else bPause = 0; } } if (p_key[control.item_lock]) { p_key[control.item_lock] = 0; if (!demo) gl_Next_Demo_Frame(control.item_lock, &control, 0, NULL, NULL, Level.Actual_Item); if (Level.Item_Lock) Level.Item_Lock = 0; else Level.Item_Lock = 1; } if (key[control.next_song]) { key[control.next_song] = 0; ap_Stop_Song(&ad); } if (key[control.visibility]) { key[control.visibility] = 0; if (bVisibility) bVisibility = 0; else bVisibility = 1; kom_zpruhlednovat_prvky(bVisibility); } if (key[control.highlight]) { key[control.highlight] = 0; kom_zvyraznovac(); } if (key[control.hint]) { key[control.hint] = 0; if (bHint) { bHint = 0; kom_set_linelist(NULL, 0); free((void *) Level.pCara); Level.pCara = NULL; } else { gl_Vytvor_Seznam_Car(&Level); bHint = 1; } } if (key[control.disable_inventory]) { key[control.disable_inventory] = 0; if (Level.bInventory) { Level.bInventory = 0; WritePrivateProfileString("game", "bInventory", "0", ini_file); _3d_Cancel_Animations(&Level); } else { Level.bInventory = 1; WritePrivateProfileString("game", "bInventory", "1", ini_file); } } if (key[control.disable_top_ledge]) { key[control.disable_top_ledge] = 0; if (Level.bTopLedge) { WritePrivateProfileString("game", "bTopLedge", "0", ini_file); Level.bTopLedge = 0; _3d_Stop_Menu_Select(); } else { Level.bTopLedge = 1; WritePrivateProfileString("game", "bTopLedge", "1", ini_file); } } } //------------------------------------------------------------------------------------------- if ((Level.status == 5) || (Level.status == 3) || (Level.status == 1)) { if (gl_Are_Animations_Done(&Level)) Level.status--; //if(Level.status < 3) if (!Level.status) Level.bAllow_Key = 1; } if (Level.status == 4) { _gl_Throw_off: if (Level.Throw_off) { if (!gl_Throw_off(Level.Column, &Level)) { if (Level.bColumn || Level.bSecColumn) { if (gl_Analyse_Column(Level.Column, &Level)) { gl_Throw_off(Level.Column, &Level); Level.Throw_off = 1; Level.status = 4; if (!Level.Flip && p_set_anim->last) { gl_Go_Animations(); gl_Next_Queue_Set(&Level); Level.Flip++; } else if (p_set_anim->last) { gl_Next_Queue_Set(&Level); Level.Flip++; } } if (gl_Analyse_Column(Level.SecColumn, &Level)) { Level.SecColumn[2] += 2; gl_Throw_off(Level.SecColumn, &Level); Level.Throw_off = 1; Level.status = 4; if (!Level.Flip && p_set_anim->last) { gl_Go_Animations(); gl_Next_Queue_Set(&Level); Level.Flip++; } else if (p_set_anim->last) { gl_Next_Queue_Set(&Level); Level.Flip++; } } } if (Level.Flip) { Level.Throw_off = 0; Level.status = 5; } else { Level.Throw_off = 0; Level.status = 2; goto _Check_Logic_Dependences; } } else { Level.status--; Level.Flip++; gl_Next_Queue_Set(&Level); gl_Go_Animations(); } } else { Level.status = 2; goto _Check_Logic_Dependences; } } if (Level.status == 2) { _Check_Logic_Dependences: if (Level.Throw_off) { if (gl_Analyse_Column(Level.Column, &Level)) { Level.Throw_off = 1; Level.status = 4; goto _gl_Throw_off; } else Level.Throw_off = 0; } if (!Level.bCheck) { Level.bCheck = 0; if (!gl_Check_Logic_Dependences(&Level)) { Level.status = 0; Level.bAllow_Key = 1; } else { Level.status--; Level.Flip++; gl_Next_Queue_Set(&Level); gl_Go_Animations(); } } else { Level.bCheck = 0; if (Level.bCheck_Result) Level.status--; else { Level.status = 0; Level.bAllow_Key = 1; } } } //jestlize nastala udalost, proved ji /* if(Level.bTriger && !Level.status) { gl_Do_Game_Trigers(&tri, &Level, p_ad); Level.bTriger = 0; Level.bAllow_Key = 1; gl_Zero_Key_Buffer(p_key, &control); }*/ //------------------------------------------------------------------------------------------- if (key[control.screenshot]) { key[control.screenshot] = 0; bmpc = gl_Screen_Shot(bmpc); bmpc++; } //if(camera.bChange && cameraflag == -1 && !Level.bMenuRunning) //if(cameraflag == -1 && !Level.bMenuRunning && gl_CheckCamera(&Level)) if (cameraflag == -1 && !Level.bMenuRunning && !Level.Level_Exit) { if (key[control.camera_center]) { key[control.camera_center] = 0; camera_Center(&cameraflag, &Level, 2, 0, 0); } if (key[control.camera_fast_turn_right]) camera_Fast_Turn(control.camera_fast_turn_right, 0, &cameraflag, am.frame_per_quater); if (key[control.camera_fast_turn_left]) camera_Fast_Turn(control.camera_fast_turn_left, 1, &cameraflag, am.frame_per_quater); /* TODO? if (key[control.camera_zoom_in]) camera_Zoom(control.camera_zoom_in, 0, &cameraflag, am.frame_per_quater); if (key[control.camera_zoom_out]) camera_Zoom(control.camera_zoom_out, 1, &cameraflag, am.frame_per_quater); */ } //if(bCamera && cameraflag == -1 && !camera.flag) if (bCamera && cameraflag == -1) { kam_set_normal_screen(p_ber); Level.bInventory = GetPrivateProfileInt("game", "bInventory", 1, ini_file); Level.bTopLedge = GetPrivateProfileInt("game", "bTopLedge", 1, ini_file); kom_zpruhlednovac_on(); if (iRestart) camera_Center(&cameraflag, &Level, 15, 1, 1); else camera_Center(&cameraflag, &Level, 15, 1, 0); if (iActualLevel >= 200 && iActualLevel < 300 && !demo) RunMenuTutorial2("Mmtutor3D.txt", p_ad, &Level, &am); bCamera = 0; } //if(key[control.menu] && cameraflag != -1 && !camera.flag && bCamera) if (key[control.menu] && cameraflag != -1 && bCamera) { BOD p_p(0,10,0), p_t(0,0,0); // default camera values float p_roll = 0; key[control.menu] = 0; if (!demo) gl_Next_Demo_Frame(control.menu, &control, 0, NULL, NULL, Level.Actual_Item); cameraflag = -1; if (kam_3ds_cti_klic(cameraanim, 1, &p_p, &p_t, &p_roll) != K_CHYBA) { kam_stop(); kam_3ds_set(&p_p, &p_t, p_roll); } kam_set_normal_screen(p_ber); kom_zpruhlednovac_on(); Level.bInventory = GetPrivateProfileInt("game", "bInventory", 1, ini_file);; Level.bTopLedge = GetPrivateProfileInt("game", "bTopLedge", 1, ini_file);; if (iRestart) camera_Center(&cameraflag, &Level, 8, 1, 1); else camera_Center(&cameraflag, &Level, 8, 1, 0); if (iActualLevel >= 200 && iActualLevel < 300 && !demo) { PRCameraFlag = 0; RunMenuTutorial2("Mmtutor3D.txt", p_ad, &Level, &am); PRCameraFlag = 1; } bCamera = 0; } NoKeyCounter++; //if (Level.bAllow_Key && cameraflag == -1 && !camera.flag && !Level.bMenuRunning) if (Level.bAllow_Key && cameraflag == -1 && !Level.bMenuRunning && !Level.Level_Exit) { PRCameraFlag = 1; if (key[K_F2] && !demo) { key[K_F2] = 0; if (cameraflag == -1) { WCHAR cText[128]; sHint.bHint = 0; ZeroMemory(cText, 128); PRCameraFlag = 0; RunMenuLoadGameLoad2("Mmload_game_loads3d.txt", Level.p_ad, &Level, &am, 0, cText); PRCameraFlag = 1; if (wcslen(cText)) lsi_Save_Level(cText, &Level); } } if (key[K_F1]) { key[K_F1] = 0; if (cameraflag == -1) { sHint.bHint = 0; PRCameraFlag = 0; RunMenuHelp2("Mmhelp3D.txt", p_ad, &Level, &am); PRCameraFlag = 1; sHint.bHint = 0; } } // prehravani fast dema if (demo == 2 && !Level.Flip && !bPause) { if (!iKeyLine[iKeyCursor]) { if (!PRCameraFlagChange) { if (Demo.p_Last) p_Last = Demo.p_Last; if (demo_Create_Sequence(iKeyLine, 3, Demo.p_Last, &bOvladaniBerusek1, Level.Level[Level.Actual_Item]->Rotation, &control, &Demo, Level.Level[Level.Actual_Item]->Pos)) { demo_key[iKeyLine[0]] = 1; iKeyCursor = 1; } else { DEMOKEYFRAME *ret; // We're done playing the demo. demo = 0; // Prepare for recording new moves. if (p_Last) { Demo.p_Last = p_Last; Demo.Frame_Counter--; ret = demo_Create_Frame(&Demo); } else ret = demo_Init(&Demo); if (ret == NULL) kerror(1, "Unable to continue demo"); bOvladaniBerusek1 = bLastOvladaniBerusek1; p_key = key; //NENI TO OVLADANI BERUSKY } } } else if (!PRCameraFlagChange) { demo_key[iKeyLine[iKeyCursor]] = 1; iKeyCursor++; } } if (p_key[control.blow_detonation_pack]) { if (!demo) gl_Next_Demo_Frame(control.blow_detonation_pack, &control, 0, NULL, NULL, Level.Actual_Item); p_key[control.blow_detonation_pack] = 0; if ((Level.Level[Level.Actual_Item]->p_Back_Pack->item[4]) && (!Level.Item_Lock)) gl_Throw_Detonation_Pack(Level.Actual_Item, &Level); } if (key[control.restart] && !Level.Flip && !Level.status) { Level.bRestart = 1; Level.iMessageBoxReturn = -1; key[control.restart] = 0; Level.bMenuRunning = 1; Level.bCancelMenu = 1; /*Level.Level_Exit = 3; Level.lLevel_Exitc = 0; */ } if (p_key[control.next_beatle] && !Level.Flip && !Level.status) { BOD b; float dist; long frame; int rot; CAMERA_ANIMATION camera; int last_b; if (!demo) gl_Next_Demo_Frame(control.next_beatle, &control, 0, NULL, NULL, Level.Actual_Item); p_key[control.next_beatle] = 0; // camera.flag = 0; last_b = Level.Actual_Item; Level.Actual_Item = gl_Find_Next_Beatle(Level.Actual_Item, &Level); if (Level.Actual_Item != -1 && last_b != Level.Actual_Item) gl_Select_BeatleFlek(Level.Level[Level.Actual_Item], &Level); am_Add_Beetle_Animation(Level.Level[last_b]->Index_Of_Game_Mesh, &Level, Level.Level[last_b]->Rotation, 0); kom_zpruhlednovat_prvky_zmena_berusky(); if (Level.bPosouvatKameru) { kom_mesh_get_float(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &b.x, &b.y, &b.z, &rot); kam_pol_get((BOD *) & camera.finish.Target, &camera.finish.r, &camera.finish.fi, &camera.finish.Distance); dist = vzdal_bodu_bod(&b, (BOD *) & camera.finish.Target); frame = (long) ceil(dist * 2); kam_pol_anim(&b, camera.finish.r, camera.finish.fi, camera.finish.Distance, &cam_flag, GK_REMOVE, frame, 1.0f); } } if (p_key[control.move_forward]) { Level.lLastKeyCounter = NoKeyCounter; NoKeyCounter = 0; bBeetleAdded = 0; p_set->pMesh = 0; //kprintf(1,"K_NAHORU"); if (bOvladaniBerusek1) { int rot; rot = gl_Get_Correspond_Rotation(0, 0); if (!Level.Flip && Level.Level[Level.Actual_Item]->Rotation != rot) { kom_umisti_prvek(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[2], Level.Level[Level.Actual_Item]->Pos[1], rot); Level.Level[Level.Actual_Item]->Rotation = rot; am_Correct_Beetle_Animation(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &Level, Level.Level[Level.Actual_Item]->Rotation); Level.bB1ExtraCameraRot = 1; goto POSUN_DOPREDU; } else if (Level.Level[Level.Actual_Item]->Rotation == rot) { Level.bB1ExtraCameraRot = 0; goto POSUN_DOPREDU; } } else { int pos_o[3]; POSUN_DOPREDU: Level.bSetStep = 0; PRCameraFlagChange = 0; gl_Zero_Key_Buffer(p_key, &control); // camera.flag = 0; pos_o[0] = pos_n[0] = Level.Level[Level.Actual_Item]->Pos[0]; pos_o[1] = pos_n[1] = Level.Level[Level.Actual_Item]->Pos[1]; pos_o[2] = pos_n[2] = Level.Level[Level.Actual_Item]->Pos[2]; gl_Change_Destonation(&Level, pos_n); Level.bColumn = 0; Level.bSecColumn = 0; Level.Sikmina_Flag = 0; Level.bCheckDependencesNeeded = 0; Level.bExtraSoundSunuti = 0; Level.bSikminaDown = 0; if (gl_Is_Move_Possible(Level.Level[Level.Actual_Item]->Pos, pos_n, &Level)) { Level.bSikminaMoveExeption = 0; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[Level.Level[Level.Actual_Item]-> Rotation], &p_set->animation[p_set->last].flag); /*if(Level.bPosouvatKameru) rani_privaz_kameru(p_set->animation[p_set->last].p_run); */ /*if (!demo) gl_Next_Demo_Frame(control.move_forward, &control, bOvladaniBerusek1, pos_o, pos_n); */ Level.bStone = 0; Level.bDemoSaveExeption = 0; _new = gl_Move_Item(Level.Level[Level.Actual_Item]->Pos, pos_n, Level.Actual_Item, &Level); if ((_new > -1 || Level.bDemoSaveExeption) && !demo) { if (_new > -1) gl_Next_Demo_Frame(control.move_forward, &control, bOvladaniBerusek1, pos_o, pos_n, _new); else gl_Next_Demo_Frame(control.move_forward, &control, bOvladaniBerusek1, pos_o, pos_n, Level.Actual_Item); } if (_new > -1) { POINTERSTRUCTURE *pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); int i; Level.iNumOfSteps++; kom_flek_setflag(Level.SelectionFlek.pFlek, 1); if (Level.iKursorAnimation) { rani_zrus(Level.iKursorAnimation); Level.iKursorAnimation = (size_ptr)NULL; } kom_prvek_viditelnost(Level.iKursorMesh, 0); Level.bAllow_Key = 0; Level.Flip++; Level.Actual_Item = _new; Level.status = 5; /*if (!demo) gl_Next_Demo_Frame(control.move_forward, &control, bOvladaniBerusek1); */ if (p_set->animation[p_set->last].p_matrix == -1 && p_set->animation[p_set->last].p_run) { //na toto bacha .... nejsu si tim jistej! rani_zrus(p_set->animation[p_set->last].p_run); p_set->animation[p_set->last].p_run = 0; //---------------------------------------------------- p_set->last--; } else if (p_set->animation[p_set->last].p_run) { p_set->last++; } Level.Sikmina_FlagOld = Level.bSikminaSound; if (p_set->last == 1 && !Level.bSikminaSound) rani_pripoj_funkci(p_set->animation[0].p_run, anmend_Are_Animations_Done, 0, 0, reinterpret_cast(&Level)); //Level.bTriger = trig_Check_ifPos_Trigers(&tri, &Level); am_Remove_Beetle_Animation(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, &Level); gl_Set_3ds_Mesh(1, 0, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Rotation); if (Level.Flip == 1) Level.iWalkAnimation = rand() % 2; //privare 3ds animaci if (!Level.bSunuti) { /* if(Level.lLastKeyCounter > 1 || bLastSunuti) gl_Set_3ds_Mesh(1, 0, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Rotation);*/ gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0, Level.iWalkAnimation, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); } else { /* if(Level.lLastKeyCounter > 1 || !bLastSunuti) gl_Set_3ds_Mesh(1, 1, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Rotation);*/ gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0, 2, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); if (Level.bSikminaSound) { for (i = 0; i < Level.bSikminaSound; i++) if (!i && Level.bSikminaUp && !Level.bSikminaUpExeption) gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, i + 1, 2, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); else gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, i + 1, Level.iWalkAnimation, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); } } Level.bSikminaUpExeption = 0; gl_Connect_Animations(&Level); bLastSunuti = Level.bSunuti; Level.bSunuti = 0; Level.Level[Level.Actual_Item]->_3ds_flag = 0; if (pS) { pS->p_Level = &Level; pS->iParam = pos_n[2]; pS->bRCamera = 0; pS->viParam1[0] = Level.Actual_Item; pS->viParam1[1] = 0; pS->viParam1[2] = bLastSunuti; pS->viParam2[0] = Level.bExtraSoundSunuti; pS->bParam = Level.bSikminaSound; if (Level.bVypniFlek) { am_Set_Start_Function(&p_set->animation[0], anmend_StepsSikmina, pos_n[0], pos_n[1], reinterpret_cast(pS), 0); //am_Set_Triger_Function(&p_set->animation[0], am_Do_Step, 1, 0, (void *) &Level, 8, 3); //am_Set_Triger_Function(&p_set->animation[0], am_Do_Step, 1, 0, (void *) &Level, 62, 4); } else { am_Set_Start_Function(&p_set->animation[0], anmend_Steps, pos_n[0], pos_n[1], reinterpret_cast(pS), 0); am_Set_Triger_Function(&p_set->animation[0], am_Do_Step, 0, 0, reinterpret_cast(&Level), 8, 3); am_Set_Triger_Function(&p_set->animation[0], am_Do_Step, 0, 0, reinterpret_cast(&Level), 62, 4); } Level.bVypniFlek = 0; Level.bSikminaSound = 0; } gl_Next_Queue_Set(&Level); if (Level.Flip == 1) gl_Go_Animations(); else Level.status = 5; if (!Level.Throw_off) { Level.bCheck_Result = gl_Check_Logic_Dependences(&Level); if (Level.bCheck_Result) { gl_Next_Queue_Set(&Level); Level.Flip++; } Level.bCheck = 1; } else { bLastSunuti = 0; Level.bCheck = 0; Level.bCheck_Result = 1; } } else if (!Level.bStone) { if (p_set->animation[0].p_run && !Level.Throw_off) { rani_zrus(p_set->animation[0].p_run); p_set->animation[0].p_run = 0; } if (p_set->animation[0].p_matrix == -1 && Level.Throw_off && p_set->animation[0].p_run) { rani_zrus(p_set->animation[0].p_run); p_set->animation[0].p_run = 0; Level.Throw_off = 0; } if (Level.Throw_off) { Level.status = 1; Level.Flip++; gl_Next_Queue_Set(&Level); if (Level.Flip == 1) gl_Go_Animations(); Level.bAllow_Key = 0; } else { p_set->animation[0].flag = 0; p_set->last = 0; } if (Level.bCheckDependencesNeeded) Level.status = 5; } } } if (!demo) Demo.Start = timeGetTime(); } if (p_key[control.turn_back]) { POINTERSTRUCTURE *pS; Level.lLastKeyCounter = NoKeyCounter; NoKeyCounter = 0; bBeetleAdded = 0; // camera.flag = 0; if (!demo && !bOvladaniBerusek1) gl_Next_Demo_Frame(control.turn_back, &control, 0, NULL, NULL, Level.Actual_Item); Level.Sikmina_Flag = 0; if (bOvladaniBerusek1) { int rot = gl_Get_Correspond_Rotation(2, 0); if (!Level.Flip && Level.Level[Level.Actual_Item]->Rotation != rot) { kom_umisti_prvek(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[2], Level.Level[Level.Actual_Item]->Pos[1], rot); Level.Level[Level.Actual_Item]->Rotation = rot; am_Correct_Beetle_Animation(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &Level, Level.Level[Level.Actual_Item]->Rotation); Level.bB1ExtraCameraRot = 1; goto POSUN_DOPREDU; } else if (Level.Level[Level.Actual_Item]->Rotation == rot) goto POSUN_DOPREDU; } else if ((Level.bSikminaMoveExeption && !Level.Flip) || !Level.bSikminaMoveExeption) { gl_Zero_Key_Buffer(p_key, &control); Level.bSikminaMoveExeption = 0; pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); pos_n[0] = Level.Level[Level.Actual_Item]->Pos[0]; pos_n[1] = Level.Level[Level.Actual_Item]->Pos[1]; pos_n[2] = Level.Level[Level.Actual_Item]->Pos[2]; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[5], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; p_set->last++; p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[5], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; p_set->animation[p_set->last].bnext = 1; rani_next_animace(p_set->animation[p_set->last - 1].p_run, p_set->animation[p_set->last].p_run, 0, 0, 0); p_set->last++; rani_pripoj_funkci(p_set->animation[1].p_run, anmend_Are_Animations_Done, 0, 0, reinterpret_cast(&Level)); gl_Set_3ds_Mesh(1, 0, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Rotation); Level.Level[Level.Actual_Item]->Rotation += 2; if (Level.Level[Level.Actual_Item]->Rotation > 3) Level.Level[Level.Actual_Item]->Rotation = Level.Level[Level.Actual_Item]->Rotation - 4; Level.Flip++; //if(Level.Flip == 1) am_Remove_Beetle_Animation(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &Level); //privare 3ds animaci gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0, Level.iWalkAnimation, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 1, Level.iWalkAnimation, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); Level.Level[Level.Actual_Item]->_3ds_flag = 0; if (pS) { pS->p_Level = &Level; pS->iParam = Level.Level[Level.Actual_Item]->Pos[2]; pS->bParam = 1; if (Level.bPohled_Berusky) pS->bRCamera = 3; else pS->bRCamera = 0; pS->viParam1[0] = Level.Actual_Item; pS->viParam1[1] = 1; pS->viParam1[2] = 0; am_Set_Start_Function(&p_set->animation[0], anmend_Steps, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[1], reinterpret_cast(pS), 0); } Level.status = 5; Level.bAllow_Key = 0; Level.bCheck_Result = 0; gl_Next_Queue_Set(&Level); if (Level.Flip == 1) gl_Go_Animations(); } if (!demo) Demo.Start = timeGetTime(); } if (p_key[control.turn_left]) { POINTERSTRUCTURE *pS; Level.Sikmina_Flag = 0; Level.lLastKeyCounter = NoKeyCounter; NoKeyCounter = 0; bBeetleAdded = 0; if (!demo && !bOvladaniBerusek1) gl_Next_Demo_Frame(control.turn_left, &control, 0, NULL, NULL, Level.Actual_Item); // camera.flag = 0; if (bOvladaniBerusek1) { int rot = gl_Get_Correspond_Rotation(3, 0); if (!Level.Flip && Level.Level[Level.Actual_Item]->Rotation != rot) { kom_umisti_prvek(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[2], Level.Level[Level.Actual_Item]->Pos[1], rot); Level.Level[Level.Actual_Item]->Rotation = rot; am_Correct_Beetle_Animation(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, &Level, Level.Level[Level.Actual_Item]->Rotation); Level.bB1ExtraCameraRot = 1; goto POSUN_DOPREDU; } else if (Level.Level[Level.Actual_Item]->Rotation == rot) goto POSUN_DOPREDU; } else if ((Level.bSikminaMoveExeption && !Level.Flip) || !Level.bSikminaMoveExeption) { gl_Zero_Key_Buffer(p_key, &control); Level.bSikminaMoveExeption = 0; pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); pos_n[0] = Level.Level[Level.Actual_Item]->Pos[0]; pos_n[1] = Level.Level[Level.Actual_Item]->Pos[1]; pos_n[2] = Level.Level[Level.Actual_Item]->Pos[2]; assert(!p_set->last); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[5], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Are_Animations_Done, 0, 0, reinterpret_cast(&Level)); gl_Set_3ds_Mesh(1, 0, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Rotation); Level.Level[Level.Actual_Item]->Rotation--; if (Level.Level[Level.Actual_Item]->Rotation < 0) Level.Level[Level.Actual_Item]->Rotation = 3; Level.Flip++; //if(Level.Flip == 1) am_Remove_Beetle_Animation(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &Level); //privare 3ds animaci gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0, Level.iWalkAnimation, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); Level.Level[Level.Actual_Item]->_3ds_flag = 0; if (pS) { pS->p_Level = &Level; pS->iParam = Level.Level[Level.Actual_Item]->Pos[2]; pS->bParam = 0; if (Level.bPohled_Berusky) pS->bRCamera = 2; else pS->bRCamera = 0; pS->viParam1[0] = Level.Actual_Item; pS->viParam1[1] = 0; pS->viParam1[2] = 0; am_Set_Start_Function(&p_set->animation[0], anmend_Steps, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[1], reinterpret_cast(pS), 0); } p_set->last++; Level.status = 5; Level.bAllow_Key = 0; Level.bCheck_Result = 0; gl_Next_Queue_Set(&Level); if (Level.Flip == 1) gl_Go_Animations(); } if (!demo) Demo.Start = timeGetTime(); } if (p_key[control.turn_right]) { POINTERSTRUCTURE *pS; Level.lLastKeyCounter = NoKeyCounter; NoKeyCounter = 0; bBeetleAdded = 0; Level.Sikmina_Flag = 0; if (!demo && !bOvladaniBerusek1) gl_Next_Demo_Frame(control.turn_right, &control, 0, NULL, NULL, Level.Actual_Item); // camera.flag = 0; if (bOvladaniBerusek1) { int rot = gl_Get_Correspond_Rotation(1, 0); if (!Level.Flip && Level.Level[Level.Actual_Item]->Rotation != rot) { kom_umisti_prvek(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[2], Level.Level[Level.Actual_Item]->Pos[1], rot); Level.Level[Level.Actual_Item]->Rotation = rot; am_Correct_Beetle_Animation(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &Level, Level.Level[Level.Actual_Item]->Rotation); Level.bB1ExtraCameraRot = 1; goto POSUN_DOPREDU; } else if (Level.Level[Level.Actual_Item]->Rotation == rot) goto POSUN_DOPREDU; } else if ((Level.bSikminaMoveExeption && !Level.Flip) || !Level.bSikminaMoveExeption) { gl_Zero_Key_Buffer(p_key, &control); Level.bSikminaMoveExeption = 0; pS = (POINTERSTRUCTURE *) malloc(sizeof(POINTERSTRUCTURE)); pos_n[0] = Level.Level[Level.Actual_Item]->Pos[0]; pos_n[1] = Level.Level[Level.Actual_Item]->Pos[1]; pos_n[2] = Level.Level[Level.Actual_Item]->Pos[2]; assert(!p_set->last); p_set->animation[p_set->last].p_run = rani_aktivuj_cekej(am.sim_anim[4], &p_set->animation[p_set->last].flag); p_set->animation[p_set->last].p_matrix = rani_privaz_mesh(p_set->animation[p_set->last].p_run, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0); gl_Add_Mesh(&p_set->animation[p_set->last], Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh); //p_set->animation[p_set->last].mesh = Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh; rani_pripoj_funkci(p_set->animation[p_set->last].p_run, anmend_Are_Animations_Done, 0, 0, reinterpret_cast(&Level)); gl_Set_3ds_Mesh(1, 0, Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, Level.Level[Level.Actual_Item]->Rotation); Level.Level[Level.Actual_Item]->Rotation++; if (Level.Level[Level.Actual_Item]->Rotation > 3) Level.Level[Level.Actual_Item]->Rotation = 0; Level.Flip++; //if(Level.Flip == 1) am_Remove_Beetle_Animation(Level.Level[Level.Actual_Item]-> Index_Of_Game_Mesh, &Level); //privare 3ds animaci gl_Set_3ds_Anim(Level.Level[Level.Actual_Item]->Index_Of_Game_Mesh, 0, Level.iWalkAnimation, &Level.Level[Level.Actual_Item]->_3ds_flag, 0, 0, 0); Level.Level[Level.Actual_Item]->_3ds_flag = 0; if (pS) { pS->p_Level = &Level; pS->iParam = Level.Level[Level.Actual_Item]->Pos[2]; pS->bParam = 0; if (Level.bPohled_Berusky) pS->bRCamera = 1; else pS->bRCamera = 0; pS->viParam1[0] = Level.Actual_Item; pS->viParam1[1] = 0; pS->viParam1[2] = 0; am_Set_Start_Function(&p_set->animation[0], anmend_Steps, Level.Level[Level.Actual_Item]->Pos[0], Level.Level[Level.Actual_Item]->Pos[1], reinterpret_cast(pS), 0); } p_set->last++; Level.status = 5; Level.bAllow_Key = 0; Level.bCheck_Result = 0; gl_Next_Queue_Set(&Level); if (Level.Flip == 1) gl_Go_Animations(); } if (!demo) Demo.Start = timeGetTime(); } //vyber brouka horkou klavesou if (((p_key[control.beatle1]) || (p_key[control.beatle2]) || (p_key[control.beatle3]) || (p_key[control.beatle4]) || (p_key[control.beatle5]) || (p_key[control.beatle6])) && !Level.Flip) { int btl = -1; if (p_key[control.beatle1]) { if (!demo) gl_Next_Demo_Frame(control.beatle1, &control, 0, NULL, NULL, Level.Actual_Item); btl = 0; p_key[control.beatle1] = 0; } else if (p_key[control.beatle2]) { if (!demo) gl_Next_Demo_Frame(control.beatle2, &control, 0, NULL, NULL, Level.Actual_Item); btl = 1; p_key[control.beatle2] = 0; } else if (p_key[control.beatle3]) { if (!demo) gl_Next_Demo_Frame(control.beatle3, &control, 0, NULL, NULL, Level.Actual_Item); btl = 2; p_key[control.beatle3] = 0; } else if (p_key[control.beatle4]) { if (!demo) gl_Next_Demo_Frame(control.beatle4, &control, 0, NULL, NULL, Level.Actual_Item); btl = 3; p_key[control.beatle4] = 0; } else if (p_key[control.beatle5]) { if (!demo) gl_Next_Demo_Frame(control.beatle5, &control, 0, NULL, NULL, Level.Actual_Item); btl = 4; p_key[control.beatle5] = 0; } else if (p_key[control.beatle6]) { if (!demo) gl_Next_Demo_Frame(control.beatle6, &control, 0, NULL, NULL, Level.Actual_Item); btl = 5; p_key[control.beatle6] = 0; } kom_zpruhlednovat_prvky_zmena_berusky(); gl_Moveto_Beatle(btl, &Level); } // click if (mi.t2 && !demo) { _3d_Display_Hint(&Level); mi.t2 = 0; } if (Level.bMenuButton && Level.bTopLedge && mi.t1) { float fpos[3] = { 0, 0, 0 }; Level.bLastTopLedge = Level.bTopLedge; Level.bLInventory = Level.bInventory; sHint.bHint = 0; Level.bInventory = 1; Level.bTopLedge = 1; _3d_Load_From_Sys_To_Video(107); fn_Load_Textures_From_RAM(); Level.bMenuRunning = 1; _3d_Start_Animation(14, NULL, &iMenuAnimation); ap_Play_Sound(0,1,0, fpos, gl_Choose_Wave_Index(23), NULL, p_ad); } if (mi.t1 && !demo) { float cx, cy; char btlchange = 0; float fpos[3] = { 0, 0, 0 }; int btl; btl = _3d_Check_Beatle_Select(); if (btl != -1 && Level.bTopLedge && !Level.Flip && !Level.status) { if (!demo) gl_Next_Demo_Frame(gl_Beetle2VirtualKey(btl, &control), &control, 0, NULL, NULL, Level.Actual_Item); kom_zpruhlednovat_prvky_zmena_berusky(); if(gl_Moveto_Beatle(btl, &Level)) ap_Play_Sound(0,1,0, fpos, gl_Choose_Wave_Index(23), NULL, p_ad); btlchange = 1; } if (!btlchange && !Level.Flip && !Level.status) gl_Mesh_Click(&Level, demo, p_ad); cx = (float) mi.x + _3dCur.iaddx; cy = (float) mi.y + _3dCur.iaddy; if (cx > 745 * scale_back_factor_x() && cx < 809 * scale_back_factor_x() && cy > 42 * scale_back_factor_y() && cy < 106 * scale_back_factor_y() && Level.bTopLedge) { sHint.bHint = 0; PRCameraFlag = 0; RunMenuHelp2("Mmhelp3D.txt", p_ad, &Level, &am); PRCameraFlag = 1; sHint.bHint = 0; } } mi.t1 = 0; } else if (Level.bMenuRunning) PRCameraFlag = 0; if (mi.t1 && (Level.bRestart || Level.bReturnToMenu)) { if (Level.bRestart && Level.iMessageBoxReturn != -1) { if (!Level.iMessageBoxReturn) { Level.bRestart = 0; Level.iMessageBoxReturn = -1; if (Level.bCancelMenu) Level.bMenuRunning = 0; } else { Level.bRestart = 0; Level.iMessageBoxReturn = -1; Level.Level_Exit = 3; Level.lLevel_Exitc = 0; Level.bMenuRunning = 0; if (!Level.bCancelMenu) _3d_Cancel_Menu(&Level); } } if (Level.bReturnToMenu && Level.iMessageBoxReturn != -1) { if (!Level.iMessageBoxReturn) { Level.bReturnToMenu = 0; Level.iMessageBoxReturn = -1; if (Level.bCancelMenu) Level.bMenuRunning = 0; } else { Level.bReturnToMenu = 0; Level.iMessageBoxReturn = -1; Level.Level_Exit = 2; Level.lLevel_Exitc = 0; Level.bMenuRunning = 0; if (!Level.bCancelMenu) _3d_Cancel_Menu(&Level); } } mi.t1 = 0; } if (iMenuAnimation) { iMenuAnimation = 0; Level.bMenuRunning = 2; _3d_Run_Cibule(); } if (PRCameraFlagChange == 2) PRCameraFlagChange = 0; if (!Level.status) NoKeyCounter++; if (Level.bResetini) { Level.bResetini = 0; gl_Resetini(&Level, &bOvladaniBerusek1); } Level.bGameResume = 0; gl_Flip(p_ad, &Level, &Frame_Rate_Counter, &bCursor, &Cursor_Time_Out, NULL, &NoKeyCounter, &bBeetleAdded, &bLastSunuti, &GetCamera, &no_Menu, &act_item, iReturn, demo, &bOvladaniBerusek1); if (Level.Level_Exit) Level.lLevel_Exitc -= ber.TimeLastFrame; if (MenuCheckBossExit()) { Level.Level_Exit = 5; Level.lLevel_Exitc = 0; gl_Kofola_End(0); } /*if(MenuCheckSuccessExit()) { Level.Level_Exit = 1; Level.lLevel_Exitc = 0; }*/ /* bmpc++; gl_Screen_Shot(bmpc);*/ } //--------------------------------------------------------------------------------------------------- demo = 0; Level.dwPlayTime += timeGetTime() - Level.dwStartTime; kprintf(1, "kam_pol_get..."); kam_pol_get((BOD *) & Level.lCamera.Position, &Level.lCamera.r, &Level.lCamera.fi, &Level.lCamera.Distance); kprintf(1, "Save Demo?"); if (Level.bSaveDemo) { WCHAR cText[128]; ZeroMemory(cText, 128); if (RunMenuLoadGameLoad2("Mmload_game_loads3d.txt", Level.p_ad, &Level, &am, 2, cText)) if (wcslen(cText)) demo_SaveWC(&Demo, cText, bOvladaniBerusek1, cLevelName, p_Env_Name); } // lsi_Save_Level(Level.cLevelName, &Level); kprintf(1, "RunMenuLevelStats2"); if (Level.Level_Exit == 1) RunMenuLevelStats2("Mmstats3D.txt", p_ad, &Level, &am); kprintf(1, "lsi_Get_Save_Info"); if (Level.Level_Exit == 4) lsi_Get_Save_Info(Level.cLevelName, &iActualLevel, &iActualScene); if (Level.Level_Exit == 3 || Level.Level_Exit == 4) { kprintf(1, "RunMenuLoadScreen2"); RunMenuLoadScreen2(); kprintf(1, "RunMenuLoadScreenInitBar"); RunMenuLoadScreenInitBar(14); } //kprintf(1,"demo_Release"); kprintf(1, "am_Do_Street_Lights_Release"); am_Do_Street_Lights_Release(&Level); kprintf(1, "am_Do_Swamp_Lights_Release"); am_Do_Swamp_Lights_Release(&Level); kprintf(1, "am_Do_Star_Lights_Release"); am_Do_Star_Lights_Release(&Level); kprintf(1, "adas_Release_Source"); adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); kprintf(1, "adas_Is_OGG_Stream_Playing"); if (Level.Level_Exit != 5) if(ogg_playing()) { float f = p_ad->Music_Gain; while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); } } kprintf(1, "ap_Stop_Song"); ap_Stop_Song(&ad); kprintf(1, "demo_Release"); demo_Release(&Demo); kprintf(1, "adas_Set_Listener_Environment"); adas_Set_Listener_Environment(EAX_ENVIRONMENT_GENERIC); kprintf(1, "am_Stop_Beetle_Animations"); am_Stop_Beetle_Animations(&Level); kprintf(1, "am_Release_Animate_Items"); am_Release_Animate_Items(&am, &Level); kprintf(1, "am_Release"); am_Release(&am, &Level); kprintf(1, "free((void *) Level.pMaterialb)"); free((void *) Level.pMaterialb); kprintf(1, "w_Release_Water_Boundaries"); w_Release_Water_Boundaries(); kprintf(1, "am_Release_Steps"); am_Release_Steps(&Level); kprintf(1, "lsi_Release_Level"); lsi_Release_Level(&Level); kprintf(1, "lsi_Release_Items"); lsi_Release_Items(&Level); kprintf(1, "fn_Release_3d_Textures_Full"); fn_Release_3d_Textures_Full(); kprintf(1, "_3d_Release_Kuk"); _3d_Release_Kuk(); kprintf(1, "kom_zpruhlednovat_prvky"); kom_zpruhlednovat_prvky(0); kprintf(1, "kom_zrus_level"); if (Level.Level_Exit == 3) kom_zrus_level(1); else kom_zrus_level(0); if (Level.Level_Exit == 3 || Level.Level_Exit == 4) { kprintf(1, "RunMenuLoadScreenAddProgress"); RunMenuLoadScreenAddProgress(-1); kprintf(1, "RunMenuLoadScreenDrawProgress"); RunMenuLoadScreenDrawProgress(-1, -1); } iRestart++; if (Level.Level_Exit == 3) { kprintf(1, "goto PLAY_LEVEL_START "); bRestart = 1; //kom_prvnotni_init();RUN_LEVEL if (!strcmp(p_Env_Name, "LOAD_GAME")) { strcpy(p_Env_Name, "RUN_LEVEL"); strcpy(Level.cLevelName, Level.cLoadedFrom); strcpy(p_Level_Name, Level.cLevelName); } goto PLAY_LEVEL_START; } if (Level.Level_Exit == 4) { strcpy(p_Level_Name, Level.cLevelName); strcat(p_Level_Name, ".lv6"); strcpy(p_Env_Name, "LOAD_GAME"); iRestart = 0; //kom_prvnotni_init(); kprintf(1, "goto PLAY_LEVEL_START "); goto PLAY_LEVEL_START; } Return = Level.Level_Exit; kprintf(1, "adas_Release_Loaded_Data"); adas_Release_Loaded_Data(); kprintf(1, "ap_Load_Sound_List"); ap_Load_Sound_List(p_ad, "basicset.dat", 0); if (Level.Level_Exit == 3 || Level.Level_Exit == 4) { kprintf(1, "RunMenuLoadScreenRelease"); RunMenuLoadScreenRelease(3); } adas_Set_Listener_Environment(EAX_ENVIRONMENT_GENERIC); // BossKey exit if (Level.Level_Exit == 5) exit(0); return Return; } void gl_Kofola_Minimalize(void) { Level.bGameResume = 0; kprintf(1, "game suspended"); adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); if(ogg_playing()) ap_Stop_Song(&ad); adas_Set_Listener_Environment(EAX_ENVIRONMENT_GENERIC); } void gl_Kofola_Maximalize(void) { Level.bGameResume = 1; kprintf(1, "game resumed"); // ap_Play_Song(0,1,&ad); // as_Start(Level.Environment.id, &ad, &Level); // adas_Set_Listener_Environment(Level.Environment.room); } int gl_Allow_Key(int iScanCode) { int i = demo_Virual2Fuction(iScanCode, &control); if (!demo) return 1; if (i >= 10 && i <= 24) return 1; if (i >= 38 && i <= 42) return 1; if (i >= 44 && i <= 47) return 1; //komatova vyjimka if (iScanCode == K_PLUS || iScanCode == K_MINUS) return 1; return 0; } void gl_Kofola_End(int InMenu) { if (!InMenu) { kprintf(1, "am_Do_Street_Lights_Release"); am_Do_Street_Lights_Release(&Level); kprintf(1, "am_Do_Swamp_Lights_Release"); am_Do_Swamp_Lights_Release(&Level); kprintf(1, "am_Do_Star_Lights_Release"); am_Do_Star_Lights_Release(&Level); kprintf(1, "adas_Release_Source"); kprintf(1, "demo_Release"); demo_Release(&Demo); kprintf(1, "adas_Set_Listener_Environment"); adas_Set_Listener_Environment(EAX_ENVIRONMENT_GENERIC); kprintf(1, "am_Stop_Beetle_Animations"); am_Stop_Beetle_Animations(&Level); kprintf(1, "am_Release_Animate_Items"); am_Release_Animate_Items(&am, &Level); kprintf(1, "am_Release"); am_Release(&am, &Level); kprintf(1, "free((void *) Level.pMaterialb)"); free((void *) Level.pMaterialb); kprintf(1, "w_Release_Water_Boundaries"); w_Release_Water_Boundaries(); kprintf(1, "am_Release_Steps"); am_Release_Steps(&Level); kprintf(1, "lsi_Release_Level"); lsi_Release_Level(&Level); kprintf(1, "lsi_Release_Items"); lsi_Release_Items(&Level); kprintf(1, "fn_Release_3d_Textures_Full"); fn_Release_3d_Textures_Full(); kprintf(1, "_3d_Release_Kuk"); _3d_Release_Kuk(); kprintf(1, "kom_zpruhlednovat_prvky"); kom_zpruhlednovat_prvky(0); kprintf(1, "kom_zrus_level"); kom_zrus_level(0); //kprintf(1, "adas_Release_Loaded_Data"); //adas_Release_Loaded_Data(); kprintf(1, "_3d_Release_Hints"); _3d_Release_Hints(pHintTexture, 26); kprintf(1, "_3d_Release"); _3d_Release(); } else { ddxRelease(); FreeDirectDraw(); } //kprintf(1, "release FONT"); //fn_Release_Font(); adas_Set_Listener_Environment(EAX_ENVIRONMENT_GENERIC); adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); kprintf(1, "ap_Stop_Song"); ap_Stop_Song(&ad); kprintf(1, "gi_Release_Sound_Engine"); gi_Release_Sound_Engine(); kprintf(1, "ap_Release_Play_List"); ap_Release_Play_List(&ad); kprintf(1, "ap_Release_Material_List"); ap_Release_Material_List(&ad); kprintf(1, "ap_Release"); ap_Release(&ad); // ShowWindow(hwnd_hry, SW_MAXIMIZE); spracuj_spravy(0); ShowCursor(TRUE); spracuj_spravy(0); exit(0); } berusky2-0.12/src/kofola/audio_plug-in.cpp0000644000175000017500000004515513674426075015455 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.2 //------------------------------------------------------------------------------------------------ #include #include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "adas.h" #include "audio_plug-in.h" #include "Object.h" #include "Tools.h" extern char pSndDir[MAX_FILENAME]; //------------------------------------------------------------------------------------------------ // Init //------------------------------------------------------------------------------------------------ void ap_Init(AUDIO_DATA * p_ad) { int i; p_ad->bAudio = 0; p_ad->Music_Gain = 1.0f; p_ad->p_Play_List = 0; p_ad->p_Material = 0; p_ad->Size_of_Play_List = 0; p_ad->Size_of_Material_List = 0; p_ad->Sound_Gain = 1.0f; p_ad->p_Source = (_SOURCE *) malloc((p_ad->Max_Sources) * sizeof(_SOURCE)); if (!p_ad->p_Source) { kprintf(1, "Unable to allocate memory for active source database"); return; } for (i = 0; i < p_ad->Max_Sources; i++) { p_ad->p_Source[i].Source = -1; p_ad->p_Source[i].flag = 1; } } //------------------------------------------------------------------------------------------------ // Release //------------------------------------------------------------------------------------------------ void ap_Release(AUDIO_DATA * p_ad) { free((void *) p_ad->p_Source); } //------------------------------------------------------------------------------------------------ // Load sample from the sound directory //------------------------------------------------------------------------------------------------ int ap_Load_Sample(int iCount, char *cFile) { char *pMem; long size; char filename[MAX_FILENAME]; FILE *file; if (!cFile) return(FALSE); construct_path(filename, MAX_FILENAME, 2, pSndDir, cFile); file = fopen(filename, "rb"); if (!file) { kprintf(1, "%s: %s", filename, strerror(errno)); return(FALSE); } fseek(file, 0, SEEK_END); size = ftell(file); fseek(file, 0, SEEK_SET); pMem = (char *) mmalloc(sizeof(*pMem) * size); if (fread(pMem, sizeof(*pMem), size, file) != (size_t) size) { kprintf(1, "Cannot read %s: %s", filename, strerror(errno)); fclose(file); return(FALSE); } fclose(file); return((!iCount) ? adas_Load_FirstMemory("index.dat", pMem, size, cFile): adas_Load_NextMemory(pMem, size, cFile)); } //------------------------------------------------------------------------------------------------ // Loads sample List //------------------------------------------------------------------------------------------------ int ap_Load_Sound_List(AUDIO_DATA * p_ad, char *cFile, int iStart) { FILE *file; char text[MAX_FILENAME]; int c = iStart; int iMaterial = 0; if (chdir(p_ber->dir.sound_dir)) { kprintf(1, "Cannot change directory to %s", p_ber->dir.sound_dir); return 0; } if (!strlen(cFile)) return 0; construct_path(text, MAX_FILENAME, 2, pSndDir, cFile); file = fopen(text, "r"); if (!file) { kprintf(1, "Play list file not found"); return 0; } if(fgets(text, 255, file)) { iMaterial = atoi(text); while (!feof(file)) { memset(text, 0, 256); if(!fgets(text, 255, file) || !text[0]) break; newline_cut(text); if(!ap_Load_Sample(c, text)) { // Loading failed - stop it break; } c++; } } fclose(file); return iMaterial; } //------------------------------------------------------------------------------------------------ // loades play list //------------------------------------------------------------------------------------------------ int ap_Load_Play_List(char *p_File_Name, AUDIO_DATA * p_ad) { FILE *file = 0; char text[30]; int i; if (p_ad->p_Play_List) return 0; if (chdir(p_ber->dir.music_dir)) { kprintf(1, "Cannot change directory to %s", p_ber->dir.music_dir); return 0; } file = fopen(p_File_Name, "r"); if (!file) { MyMessageBox(NULL, "##error_title", "##play_list_error", ""); kprintf(1, "Play list file not found"); return 0; } if (fgets(text, 30, file) == NULL) { kprintf(1, "Cannot read play list file"); MyMessageBox(NULL, "##error_title", "##play_list_error", ""); return 0; } p_ad->Size_of_Play_List = atoi(text); p_ad->p_Play_List = (PLAY_LIST_ITEM *) malloc((p_ad->Size_of_Play_List) * sizeof(PLAY_LIST_ITEM)); if (!p_ad->p_Play_List) { kprintf(1, "Unable to allocate memory for play list"); MyMessageBox(NULL, "##error_title", "##play_list_error", ""); return 0; } for (i = 0; i < p_ad->Size_of_Play_List; i++) { char *p_name = p_ad->p_Play_List[i].Song_Name; if (fgets(p_name, 30, file) == NULL) { kprintf(1, "Cannot read play list file"); MyMessageBox(NULL, "##error_title", "##play_list_error", ""); return 0; } newline_cut(p_name); } fclose(file); return 1; } //------------------------------------------------------------------------------------------------ // Releases play list //------------------------------------------------------------------------------------------------ void ap_Release_Play_List(AUDIO_DATA * p_ad) { free((void *) p_ad->p_Play_List); p_ad->p_Play_List = 0; p_ad->Size_of_Play_List = 0; } //------------------------------------------------------------------------------------------------ // Playes ogg song //------------------------------------------------------------------------------------------------ int ap_Play_Song(int Index, char Random, AUDIO_DATA * p_ad) { // char text[256]; char song_name[256]; int song = 0; FILE *file; int c = 0; if (!p_ad->bAudio) return 1; if (p_ad->Music_Gain < 0.05f) return 1; CHOOSE_SONG: if (Random) song = (rand() % (p_ad->Size_of_Play_List - 12)) + 12; else song = Index; strcpy(song_name, p_ber->dir.music_dir); strcat(song_name, DIR_SLASH_STRING); strcat(song_name, p_ad->p_Play_List[song].Song_Name); file = fopen(song_name, "r"); if (!file) { if (Random) { c++; if (c > 10) return 0; goto CHOOSE_SONG; } } else fclose(file); ogg_open(song_name, p_ad->Music_Gain); if (!ogg_playback()) return 0; return 1; /* adas_Reset_Last_Error(); adas_OGG_Open_Stream(song_name); if (adas_Get_Last_Error(text,256)) { MessageBox(p_ad->hWnd,text,"Error",MB_OK); kprintf(1,"%s",text); return 0; } else { float pos[3] = {0.0f,0.0f,0.0f}; adas_OGG_Set_Pitch(1.0f); adas_OGG_Set_Source_Relative(1); adas_OGG_Set_Position(pos); adas_OGG_Set_Velocity(pos); adas_Reset_Last_Error(); adas_OGG_Play_Stream(); if (adas_Get_Last_Error(text,256)) { MessageBox(p_ad->hWnd,text,"Error",MB_OK); kprintf(1,text); return 0; } else return 1; }*/ } //------------------------------------------------------------------------------------------------ // Playes ogg song //------------------------------------------------------------------------------------------------ int ap_Setup_and_Play_Song(int Index, char Random, AUDIO_DATA * p_ad) { /* int flag = 0; char text[256]; char song_name[256]; int song = 0; if (!p_ad->bAudio) return 1; if (p_ad->Music_Gain < 0.05f) return 1; if (Random) while(song < 2) song = rand()%p_ad->Size_of_Play_List; else song = Index; strcpy(song_name, p_ad->Music_Dir); strcat(song_name, "\\"); strcat(song_name, p_ad->p_Play_List[song].Song_Name); adas_Reset_Last_Error(); adas_OGG_Open_Stream(song_name); if (adas_Get_Last_Error(text,256)) { MessageBox(p_ad->hWnd,text,"Error",MB_OK); kprintf(1,"%s",text); return 0; } else { float pos[3] = {0.0f,0.0f,0.0f}; adas_OGG_Set_Gain(p_ad->Music_Gain); adas_OGG_Set_Pitch(1.0f); adas_OGG_Set_Source_Relative(1); adas_OGG_Set_Position(pos); adas_OGG_Set_Velocity(pos); adas_Reset_Last_Error(); adas_OGG_Setup_Stream(&flag); if (adas_Get_Last_Error(text,256)) { MessageBox(p_ad->hWnd,text,"Error",MB_OK); kprintf(1,text); return 0; } else { while(!flag) Sleep(100); return 1; } }*/ return 1; } //------------------------------------------------------------------------------------------------ // stops ogg song //------------------------------------------------------------------------------------------------ void ap_Stop_Song(AUDIO_DATA * p_ad) { if (!p_ad->bAudio) return; ogg_release(); /*adas_OGG_Stop_Stream(); adas_OGG_Close_Stream(); */ } //------------------------------------------------------------------------------------------------ // Plays sound //------------------------------------------------------------------------------------------------ int ap_Play_Sound(int Type, char Relative, char bAmbient, float *p_Pos, int Wave_Index, EAX_DATA * p_eax, AUDIO_DATA * p_ad) { char text[MAX_FILENAME]; ADAS_SOUND_SOURCE_DATA ssd; int source; void *p_callback = 0; if (!karmin_aktivni) return -1; if (!p_ad->bAudio) return -1; if (bAmbient) { if (p_ad->Ambient_Gain < 0.05f) return -1; ssd.Gain = p_ad->Ambient_Gain; } else { if (p_ad->Sound_Gain < 0.05f) return -1; ssd.Gain = p_ad->Sound_Gain; } ssd.Owner = -1; ssd.Pitch = 1.0f; ssd.Pos[0] = p_Pos[0]; ssd.Pos[1] = p_Pos[1]; ssd.Pos[2] = p_Pos[2]; ssd.Type = Type; ssd.Velocity[0] = 0.0f; ssd.Velocity[1] = 0.0f; ssd.Velocity[2] = 0.0f; ssd.Wave_Index = Wave_Index; ssd.Source_Relative = Relative; ssd.Bounding_Object.Type = UNDEFINED_VALUE; if (p_eax) { ssd.Obstruction = p_eax->Obstruction; ssd.ObstructionLF = p_eax->ObstructionLF; ssd.out_air_absorbtion = p_eax->out_air_absorbtion; ssd.out_room = p_eax->out_room; ssd.out_room_rolloff = p_eax->out_room_rolloff; ssd.out_roomHF = p_eax->out_roomHF; ssd.wall_occlusion = p_eax->wall_occlusion; ssd.wall_occlusion_room = p_eax->wall_occlusion_room; ssd.wall_occlusionLF = p_eax->wall_occlusionLF; } else { ssd.Obstruction = UNDEFINED_VALUE; ssd.ObstructionLF = (float) UNDEFINED_VALUE; ssd.out_air_absorbtion = (float) UNDEFINED_VALUE; ssd.out_room = UNDEFINED_VALUE; ssd.out_room_rolloff = (float) UNDEFINED_VALUE; ssd.out_roomHF = UNDEFINED_VALUE; ssd.wall_occlusion = UNDEFINED_VALUE; ssd.wall_occlusion_room = (float) UNDEFINED_VALUE; ssd.wall_occlusionLF = (float) UNDEFINED_VALUE; } adas_Reset_Last_Error(); source = adas_Create_Source(&ssd, &p_callback); if (adas_Get_Last_Error(text, MAX_FILENAME)) { //MessageBox(p_ad->hWnd,text,"Error",MB_OK); kprintf(1, text); } else if ((source != -1) && !Relative) { // je to takovy cudny, ze zvuky s relativni pozici se nepocitaji, ale // zatim to nevadi. Uvidime, jestli to tak pujde dal. Jestli, musim // pridat priznak p_ad->p_Source[source].Source = source; p_ad->p_Source[source].flag = 1; *(char **) p_callback = &p_ad->p_Source[source].flag; } else if (p_callback) *(char **) p_callback = NULL; return source; } //------------------------------------------------------------------------------------------------ // translates real position of object to logical(square map) posiiton //------------------------------------------------------------------------------------------------ void ap_Translate_Position(float *p_real, int *p_log) { p_log[0] = (int) floor(p_real[0] / 2.0f); p_log[2] = (int) floor(p_real[1] / 2.0f); p_log[1] = (int) floor(p_real[2] / 2.0f); } //------------------------------------------------------------------------------------------------ // makes normal vertor //------------------------------------------------------------------------------------------------ void ap_Normal_Vector(float *v) { float size = (float) sqrt((v[0]) * (v[0]) + (v[1]) * (v[1]) + (v[2]) * (v[2])); if (size == 0) return; v[0] /= size; v[1] /= size; v[2] /= size; } //------------------------------------------------------------------------------------------------ // count environment //------------------------------------------------------------------------------------------------ void ap_Count_Environment(AUDIO_DATA * p_ad, void *p_Level) { int i; float s_pos[3], l_pos[3], v[3], size; int sl_pos[3], lp[3], material; char end, t_end; long m_pos; LEVELINFO *p_L = (LEVELINFO *) p_Level; for (i = 0; i < p_ad->Max_Sources; i++) { if (p_ad->p_Source[i].Source != -1) { if (!p_ad->p_Source[i].flag) { p_ad->p_Source[i].Source = -1; } else { adas_Get_Source_Position(p_ad->p_Source[i].Source, s_pos); adas_Get_Listener_Position(l_pos); v[0] = l_pos[0] - s_pos[0]; v[1] = l_pos[1] - s_pos[1]; v[2] = l_pos[2] - s_pos[2]; // jestlize je vzdalenist vetsi nez 15, nema smysl pokracovat, // protoze okluze se tejne vzhledem ke vzdalenosti neprojevi size = (float) sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); if (size > 15) continue; ap_Translate_Position(s_pos, sl_pos); if (sl_pos[0] > (p_L->Size[0] - 1) || sl_pos[0] < 0 || sl_pos[1] > (p_L->Size[1] - 1) || sl_pos[1] < 0 || sl_pos[2] > (p_L->Size[2] - 1) || sl_pos[2] < 0) continue; ap_Normal_Vector(v); lp[0] = sl_pos[0]; lp[1] = sl_pos[1]; lp[2] = sl_pos[2]; t_end = 0; while (!t_end) { end = 0; //posun o kosticku while (!end) { s_pos[0] += 0.1f * v[0]; s_pos[1] += 0.1f * v[1]; s_pos[2] += 0.1f * v[2]; ap_Translate_Position(s_pos, sl_pos); if (lp[0] != sl_pos[0] || lp[1] != sl_pos[1] || lp[2] != sl_pos[2]) end = 1; } lp[0] = sl_pos[0]; lp[1] = sl_pos[1]; lp[2] = sl_pos[2]; if (sl_pos[0] > (p_L->Size[0] - 1) || sl_pos[0] < 0 || sl_pos[1] > (p_L->Size[1] - 1) || sl_pos[1] < 0 || sl_pos[2] > (p_L->Size[2] - 1) || sl_pos[2] < 0) { /* adas_Set_Source_Obstruction(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_ad->p_Source[i].Source, EAXBUFFER_DEFAULTOBSTRUCTION); adas_Set_Source_ObstructionLF(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_ad->p_Source[i].Source, EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO); */ t_end = 1; break; } m_pos = sl_pos[0] + sl_pos[1] * p_L->Size[0] + sl_pos[2] * p_L->Size[0] * p_L->Size[1]; if (p_L->Level[m_pos]) break; } if (!t_end) { if (p_L->Level[m_pos]) { material = p_L->Level[m_pos]->p_Object->Material - 1; if (material > 0) { material--; /* adas_Set_Source_Obstruction(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_ad->p_Source[i].Source, p_ad->p_Material[material].Obstruction); adas_Set_Source_ObstructionLF(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_ad->p_Source[i].Source, p_ad->p_Material[material].ObstructionLF); */ } } else { /* adas_Set_Source_Obstruction(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_ad->p_Source[i].Source, EAXBUFFER_DEFAULTOBSTRUCTION); adas_Set_Source_ObstructionLF(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, p_ad->p_Source[i].Source, EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO); */ } } } } } } //------------------------------------------------------------------------------------------------ // loades material list //------------------------------------------------------------------------------------------------ int ap_Load_Material_List(char *p_File_Name, AUDIO_DATA * p_ad) { FILE *file = 0; FILE *Material_file = 0; char text[30] = "", filename[MAX_FILENAME]; int i; if (p_ad->p_Material) return 0; construct_path(filename, MAX_FILENAME, 2, pSndDir, p_File_Name); file = fopen(filename, "r"); if (!file) { //MessageBox(p_ad->hWnd,"Material list file not found","Error", MB_OK); MyMessageBox(NULL, "##error_title", "##material_list_error", ""); kprintf(1, "Material list file not found"); return 0; } if (!fgets(text, 30, file)) { MyMessageBox(NULL, "##error_title", "##material_list_error", ""); kprintf(1, "Cannot read material list file"); fclose(file); return 0; } p_ad->Size_of_Material_List = atoi(text); p_ad->p_Material = (MATERIAL_LIST_ITEM *) malloc((p_ad->Size_of_Material_List) * sizeof(MATERIAL_LIST_ITEM)); if (!p_ad->p_Material) { //MessageBox(p_ad->hWnd,"Unable to allocate memory for material list","Error",MB_OK); kprintf(1, "Unable to allocate memory for material list"); MyMessageBox(NULL, "##error_title", "##material_list_error", ""); return 0; } for (i = 0; i < p_ad->Size_of_Material_List; i++) { if(!fgets(text, 30, file)) break; newline_cut(text); construct_path(filename, MAX_FILENAME, 2, pSndDir, text); Material_file = fopen(filename, "rb"); if (!Material_file) { //MessageBox(p_ad->hWnd,error,"Error", MB_OK); kprintf(1, "%s not found", text); } else { size_t ret = fread(&p_ad->p_Material[i], sizeof(MATERIAL_LIST_ITEM), 1, Material_file); fclose(Material_file); if (ret != 1) kprintf(1, "cannot read %s", text); } } fclose(file); return 1; } //------------------------------------------------------------------------------------------------ // Releases materail list //------------------------------------------------------------------------------------------------ void ap_Release_Material_List(AUDIO_DATA * p_ad) { free((void *) p_ad->p_Material); p_ad->p_Material = 0; p_ad->Size_of_Material_List = 0; } //------------------------------------------------------------------------------------------------ // load environment //------------------------------------------------------------------------------------------------ int ap_Load_Environment(char *p_Env_Name, void *p_Level, AUDIO_DATA * p_ad) { char filename[MAX_FILENAME]; FILE *file; LEVELINFO *p_L = (LEVELINFO *) p_Level; construct_path(filename, MAX_FILENAME, 2, pSndDir, p_Env_Name); file = fopen(filename, "rb"); if (file) { size_t ret = fread(&p_L->Environment, sizeof(ENVIRONMENT), 1, file); fclose(file); if (ret != 1) { kprintf(1, "cannot read %s", filename); return 0; } return 1; } else { kprintf(1, "%s not found", filename); return 0; } } berusky2-0.12/src/kofola/load_level.cpp0000644000175000017500000017050013674426075015020 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.6 //------------------------------------------------------------------------------------------------ #include #include #include #include #include #include #include "3d_all.h" #include "Berusky_universal.h" #include "load_level.h" #include "game_logic.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "trigers.h" #include "grammar.h" #include "menu_script.h" #include "animationk.h" #include "profiles.h" #ifdef LINUX #include #include #endif #define VELIKOST_STREPIN 2.0f #define VELIKOST_STREPIN_K 20.0f #define VELIKOST_STREPINPR 2.5f #define VELIKOST_STREPINKAM 4.5f #define VELIKOST_STREPINJIS 7.0f #define VELIKOST_STREPINV1 15.0f #define VELIKOST_STREPINL 3.0f #define randf() ((float)rand()) extern int Xresolution; extern int Yresolution; extern int iActualScene; extern int iActualLevel; extern PLAYER_PROFILE pPlayerProfile; #define RWBUFF_VEL 60000 int lsi_file_copy(char *p_src, char *p_out) { FILE *in, *out; char *p_buffer; int nc; in = fopen(p_src, "rb"); if (!in) return (FALSE); out = fopen(p_out, "wb"); if (!out) { fclose(in); return (FALSE); } p_buffer = (char *) malloc(RWBUFF_VEL); // mtest(p_buffer); while ((nc = fread(p_buffer, 1, RWBUFF_VEL, in))) { fwrite(p_buffer, 1, nc, out); } free(p_buffer); fclose(in); fclose(out); return (TRUE); } //------------------------------------------------------------------------------------------------ // Find Object with selected GUID and returns it's index //------------------------------------------------------------------------------------------------ int lsi_Find_Object(int Guid, LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Count_Of_Objects; i++) if (p_Level->Object[i].GUID == Guid) return i; return -1; } //------------------------------------------------------------------------------------------------ // Find Object with selected GUID and returns it's index //------------------------------------------------------------------------------------------------ int lsi_Find_Wall_Object(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Count_Of_Objects; i++) if (p_Level->Object[i].Class == 2) return i; return -1; } char lsi_Create_Explosions(LEVELINFO * p_Level, int PocetCastic) { int i, j; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 20; i++) { p_Level->Exploze[i].Sizeof = PocetCastic; p_Level->Exploze[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->Exploze[i].pCastice) return 0; pSystem = &p_Level->Exploze[i]; p_Level->Exploze[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.x = rand() & 0x1 ? randf() : -randf(); pSystem->pCastice[j].p.y = randf() * 1.25f + 0.5f; pSystem->pCastice[j].p.z = rand() & 0x1 ? randf() : -randf(); pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPIN * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPIN * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPIN * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPIN * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = ((randf() / (float) (RAND_MAX)) + v * v) * _3DKOREKCE; pSystem->pCastice[j].g = 0.15f; pSystem->pCastice[j].utlum = 4.0f * v; pSystem->pCastice[j].vaha = 1.3f * v * _3DKOREKCE; pSystem->pCastice[j].barva = randf() / ((float) RAND_MAX); bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); vektor_norm(&pSystem->pCastice[j].p); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; } } return 1; } char lsi_Create_Krompac(LEVELINFO * p_Level, int PocetCastic) { int i, j; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 10; i++) { p_Level->Krompac[i].Sizeof = PocetCastic; p_Level->Krompac[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->Krompac[i].pCastice) return 0; pSystem = &p_Level->Krompac[i]; p_Level->Krompac[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.x = (rand() & 0x1 ? randf() : -randf()) * 0.25f; pSystem->pCastice[j].p.y = randf() * 0.1f + 2.05f; pSystem->pCastice[j].p.z = (rand() & 0x1 ? randf() : -randf()) * 0.25f; pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPIN_K * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPIN_K * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPIN_K * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPIN_K * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = ((randf() / (float) (RAND_MAX)) + v * v) * _3DKOREKCE; pSystem->pCastice[j].g = 0.15f; pSystem->pCastice[j].utlum = 4.0f * v; pSystem->pCastice[j].vaha = 1.3f * v * _3DKOREKCE; pSystem->pCastice[j].barva = randf() / ((float) RAND_MAX); bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); vektor_norm(&pSystem->pCastice[j].p); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; } } return 1; } char lsi_Create_Jiskry(LEVELINFO * p_Level, int PocetCastic) { int i, j; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 20; i++) { p_Level->Jiskra[i].Sizeof = PocetCastic; p_Level->Jiskra[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->Jiskra[i].pCastice) return 0; pSystem = &p_Level->Jiskra[i]; p_Level->Jiskra[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.x = rand() & 0x1 ? randf() : -randf(); pSystem->pCastice[j].p.y = randf() * 1.25f + 0.5f; pSystem->pCastice[j].p.z = rand() & 0x1 ? randf() : -randf(); pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPINJIS * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPINJIS * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPINJIS * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPINJIS * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = ((randf() / (float) (RAND_MAX)) + v * v) * _3DKOREKCE; pSystem->pCastice[j].g = 0.15f; pSystem->pCastice[j].utlum = 4.0f * v; pSystem->pCastice[j].vaha = (1.3f * v) * _3DKOREKCE; pSystem->pCastice[j].barva = 1.0f; bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); vektor_norm(&pSystem->pCastice[j].p); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; } } return 1; } char lsi_Create_Trap_Doors(LEVELINFO * p_Level, int PocetCastic) { int i, j; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 20; i++) { p_Level->Propadla[i].Sizeof = PocetCastic; p_Level->Propadla[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->Propadla[i].pCastice) return 0; pSystem = &p_Level->Propadla[i]; p_Level->Propadla[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.x = rand() & 0x1 ? randf() : -randf(); pSystem->pCastice[j].p.y = randf() * (-1.5f); pSystem->pCastice[j].p.z = rand() & 0x1 ? randf() : -randf(); pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPINPR * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPINPR * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPINPR * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPINPR * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = (0.01f) * _3DKOREKCE; pSystem->pCastice[j].g = 0.15f; pSystem->pCastice[j].utlum = v; pSystem->pCastice[j].vaha = v * 0.25f * _3DKOREKCE; pSystem->pCastice[j].barva = 1.0f; bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); vektor_norm(&pSystem->pCastice[j].p); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; } } return 1; } char lsi_Create_Rocks(LEVELINFO * p_Level, int PocetCastic) { int i, j; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 20; i++) { p_Level->Kamen[i].Sizeof = PocetCastic; p_Level->Kamen[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->Kamen[i].pCastice) return 0; pSystem = &p_Level->Kamen[i]; p_Level->Kamen[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.x = (rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX; pSystem->pCastice[j].p.y = ((rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX); if (pSystem->pCastice[j].p.y > 2) pSystem->pCastice[j].p.y = 2; pSystem->pCastice[j].p.z = (rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX; pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPINKAM * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPINKAM * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPINKAM * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPINKAM * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = (v * 0.05f) * _3DKOREKCE; pSystem->pCastice[j].g = 0.05f; pSystem->pCastice[j].utlum = v; pSystem->pCastice[j].vaha = (v * 0.25f) * _3DKOREKCE; pSystem->pCastice[j].barva = 1.0f; bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; vektor_norm(&pSystem->pCastice[j].dir); } } return 1; } char lsi_Create_Prach(LEVELINFO * p_Level, int PocetCastic) { int i, j; SYSTEMFLEKCASTIC *pSystem; for (i = 0; i < 20; i++) { p_Level->Prach[i].Sizeof = PocetCastic; p_Level->Prach[i].pCastice = (PAR_FLEK *) malloc(PocetCastic * sizeof(PAR_FLEK)); if (!p_Level->Prach[i].pCastice) return 0; pSystem = &p_Level->Prach[i]; p_Level->Prach[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.x = 0; pSystem->pCastice[j].p.y = -1; pSystem->pCastice[j].p.z = 0; pSystem->pCastice[j].nx.x = 1; pSystem->pCastice[j].nx.y = 0; pSystem->pCastice[j].nx.z = 0; pSystem->pCastice[j].ny.x = 0; pSystem->pCastice[j].ny.y = 0; pSystem->pCastice[j].ny.z = 1; pSystem->pCastice[j].rychlost_x = 1.0f; pSystem->pCastice[j].rychlost_y = 1.0f; pSystem->pCastice[j].utlum_x = 20.0f; pSystem->pCastice[j].utlum_y = 20.0f; pSystem->pCastice[j].r = pSystem->pCastice[j].g = pSystem->pCastice[j].b = 0.0f + randf() / (float) (RAND_MAX); pSystem->pCastice[j].a = 1.0f; pSystem->pCastice[j].dr = pSystem->pCastice[j].dg = pSystem->pCastice[j].db = pSystem->pCastice[j].r; pSystem->pCastice[j].da = -7.0f; pSystem->pCastice[j].ka = 0.0f; } } return 1; } char lsi_Create_Vodni_Cakance1(LEVELINFO * p_Level, int PocetCastic) { int i, j, rosa; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 10; i++) { p_Level->VodniCakanec1[i].Sizeof = PocetCastic; p_Level->VodniCakanec1[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->VodniCakanec1[i].pCastice) return 0; pSystem = &p_Level->VodniCakanec1[i]; p_Level->VodniCakanec1[i].flag = -1; for (j = 0; j < PocetCastic; j++) { rosa = rand() % 2; if (!rosa) { rosa = rand() % 2; if (!rosa) pSystem->pCastice[j].p.x = -1.1f; else pSystem->pCastice[j].p.x = 1.1f; pSystem->pCastice[j].p.z = (rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX; } else { rosa = rand() % 2; if (!rosa) pSystem->pCastice[j].p.z = -1.1f; else pSystem->pCastice[j].p.z = 1.1f; pSystem->pCastice[j].p.x = (rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX; } pSystem->pCastice[j].p.y = (randf() / (float) RAND_MAX) * 2.0f + 2.0f; pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = (((randf() / (float) (RAND_MAX)) * v) * 8.0f) * _3DKOREKCE; if (pSystem->pCastice[j].rychlost < (0.1f) * _3DKOREKCE) pSystem->pCastice[j].rychlost = (0.1f) * _3DKOREKCE; pSystem->pCastice[j].g = 0.25f; pSystem->pCastice[j].utlum = ((2 * v) * 0.75f) * 5.0f; pSystem->pCastice[j].vaha = (((v) * 0.75f) * 6.0f) * _3DKOREKCE; pSystem->pCastice[j].barva = 1; bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; vektor_norm(&pSystem->pCastice[j].dir); pSystem->pCastice[j].p.y = 0.1f; } } return 1; } char lsi_Create_Vodni_Cakance2(LEVELINFO * p_Level, int PocetCastic) { int i, j; float bu, bv, v; SYSTEMCASTIC *pSystem; for (i = 0; i < 10; i++) { p_Level->VodniCakanec2[i].Sizeof = PocetCastic; p_Level->VodniCakanec2[i].pCastice = (PAR_STREPINA *) malloc(PocetCastic * sizeof(PAR_STREPINA)); if (!p_Level->VodniCakanec2[i].pCastice) return 0; pSystem = &p_Level->VodniCakanec2[i]; p_Level->VodniCakanec2[i].flag = -1; for (j = 0; j < PocetCastic; j++) { pSystem->pCastice[j].p.z = ((rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX) / 5.0f; pSystem->pCastice[j].p.x = ((rand() & 0x1 ? randf() : -randf()) / (float) RAND_MAX) / 5.0f; pSystem->pCastice[j].p.y = (randf() / (float) RAND_MAX) * 2.0f + 2.0f; pSystem->pCastice[j].vel1 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); pSystem->pCastice[j].vel2 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); pSystem->pCastice[j].vel3 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); pSystem->pCastice[j].vel4 = randf() / (VELIKOST_STREPINV1 * (float) RAND_MAX); v = (pSystem->pCastice[j].vel1 + pSystem->pCastice[j].vel2 + pSystem->pCastice[j].vel3 + pSystem->pCastice[j].vel4) / 2.0f; pSystem->pCastice[j].rychlost = (((randf() / (float) (RAND_MAX)) * v) * 8.0f) * _3DKOREKCE; if (pSystem->pCastice[j].rychlost < (0.1f) * _3DKOREKCE) pSystem->pCastice[j].rychlost = (0.1f) * _3DKOREKCE; pSystem->pCastice[j].g = 0.25f; pSystem->pCastice[j].utlum = ((2 * v) * 0.75f) * 5.0f; pSystem->pCastice[j].vaha = (((v) * 0.75f) * 6.0f) * _3DKOREKCE; pSystem->pCastice[j].barva = 1; bu = randf() / (float) (RAND_MAX); bv = randf() / (float) (RAND_MAX); pSystem->pCastice[j].u1 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v1 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u2 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v2 = bv - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u3 = bu - randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v3 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].u4 = bu + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].v4 = bv + randf() / (2 * (float)RAND_MAX); pSystem->pCastice[j].dir = pSystem->pCastice[j].p; vektor_norm(&pSystem->pCastice[j].dir); pSystem->pCastice[j].p.y = 0.1f; } } return 1; } void lsi_Load_Level_Script(LEVELINFO * p_Level, char *cFile) { int i, mesh; TRIGER_STRUCTURE ts; GAME_TRIGER gt; GRAMMAR gr; if (chdir(DATA_DIR)) return; gr_Load_Grammar("lsc_grammar.txt", &gr); if (chdir(GAME_DATA_DIR)) return; ts.LastStr = 0; ts.sizeofT = 0; ts.pTriger = NULL; trig_Load_Triger(cFile, >, &gr, &ts); for (i = 0; i < gt.lastcommand; i++) switch (gt.command[i].iCommand) { case 1: { if (gt.command[i].LastParam > 0 && gt.command[i].Parametr[0].Type == 2) { mesh = kom_pridej_mesh_do_levelu(ts.StrTable[gt.command[i].Parametr[0]. Value]); if (mesh != K_CHYBA) lani_set(mesh, 0, 0, &p_Level->TrashFlag, GK_LOOP, 0, 0); } } break; case 3: { float pos[3]; int iStart; int iPause; if (gt.command[i].LastParam > 0) { memcpy(&iStart, >.command[i].Parametr[0].Value, sizeof(int)); memcpy(&iPause, >.command[i].Parametr[1].Value, sizeof(int)); memcpy(&pos[0], >.command[i].Parametr[2].Value, sizeof(float)); memcpy(&pos[1], >.command[i].Parametr[3].Value, sizeof(float)); memcpy(&pos[2], >.command[i].Parametr[4].Value, sizeof(float)); am_Create_Street_Light(p_Level, iStart, iPause, pos); } } break; case 4: { float pos[3]; float radius; if (gt.command[i].LastParam > 0) { memcpy(&radius, >.command[i].Parametr[0].Value, sizeof(float)); memcpy(&pos[0], >.command[i].Parametr[1].Value, sizeof(float)); memcpy(&pos[1], >.command[i].Parametr[2].Value, sizeof(float)); memcpy(&pos[2], >.command[i].Parametr[3].Value, sizeof(float)); am_Create_Water_CirclesB(p_Level, &p_Level->StreetRain, radius, 0, 500, 0.25, pos); } } break; case 2: //Natureeffect { if (gt.command[i].LastParam > 0) { switch (gt.command[i].Parametr[0].Value) { case 0: { float pos[3]; memcpy(&pos[0], >.command[i].Parametr[1].Value, sizeof(float)); memcpy(&pos[1], >.command[i].Parametr[2].Value, sizeof(float)); memcpy(&pos[2], >.command[i].Parametr[3].Value, sizeof(float)); am_Create_BublSystem_Effect1(pos, p_Level, 750); } break; case 1: { float pos[3]; memcpy(&pos[0], >.command[i].Parametr[1].Value, sizeof(float)); memcpy(&pos[1], >.command[i].Parametr[2].Value, sizeof(float)); memcpy(&pos[2], >.command[i].Parametr[3].Value, sizeof(float)); am_Create_BublSystem_Effect2(pos, p_Level, 25, 50.0f); } break; case 2: { float pos[3]; memcpy(&pos[0], >.command[i].Parametr[1].Value, sizeof(float)); memcpy(&pos[1], >.command[i].Parametr[2].Value, sizeof(float)); memcpy(&pos[2], >.command[i].Parametr[3].Value, sizeof(float)); am_Create_BublSystem_Effect2(pos, p_Level, 25, 21.0f); } break; } } } break; case 5: case 6: { RECT r; if (gt.command[i].LastParam > 0) { memcpy(&r.left, >.command[i].Parametr[0].Value, sizeof(int)); memcpy(&r.top, >.command[i].Parametr[1].Value, sizeof(int)); memcpy(&r.right, >.command[i].Parametr[2].Value, sizeof(int)); memcpy(&r.bottom, >.command[i].Parametr[3].Value, sizeof(int)); if (gt.command[i].iCommand == 5) am_Gen_Swamp_Lights(p_Level, &r); else am_Create_Fairies(p_Level, &r); } } break; case 7: { char text[MAX_FILENAME]; int iVal, j; if (gt.command[i].LastParam > 0) { memcpy(&iVal, >.command[i].Parametr[0].Value, sizeof(int)); for (j = 0; j < iVal; j++) { sprintf(text, "f-vyrez%d", j); am_Start_Gen_Animation(text, p_Level); } } } break; case 8: case 9: { float rect[6]; if (gt.command[i].LastParam > 0) { memcpy(&rect[0], >.command[i].Parametr[0].Value, sizeof(float)); memcpy(&rect[1], >.command[i].Parametr[1].Value, sizeof(float)); memcpy(&rect[2], >.command[i].Parametr[2].Value, sizeof(float)); memcpy(&rect[3], >.command[i].Parametr[3].Value, sizeof(float)); memcpy(&rect[4], >.command[i].Parametr[4].Value, sizeof(float)); memcpy(&rect[5], >.command[i].Parametr[5].Value, sizeof(float)); if (gt.command[i].iCommand == 8) am_Gen_Star_Lights(p_Level, rect); else am_Create_Falling_Stars(p_Level, rect); } } break; case 10: { if (gt.command[i].LastParam > 0) { float pos[3]; memcpy(&pos[0], >.command[i].Parametr[0].Value, sizeof(float)); memcpy(&pos[1], >.command[i].Parametr[1].Value, sizeof(float)); memcpy(&pos[2], >.command[i].Parametr[2].Value, sizeof(float)); am_Create_CandleSystem(pos, p_Level); am_Create_CandleSmokeSystem(pos, p_Level); } } break; case 11: { char text[MAX_FILENAME]; int iVal, j; if (gt.command[i].LastParam > 0) { memcpy(&iVal, >.command[i].Parametr[0].Value, sizeof(int)); for (j = 1; j < iVal; j++) { sprintf(text, "kytka%d", j); am_Start_Gen_Animation(text, p_Level); } } } break; } } int lsi_Create_Level_Raw(char *p_Level_Name, BUNKA_LEVELU_DISK ** b_l_d, int *size) { LEVEL_HEADER l_h; char text[MAX_FILENAME + 1]; char filename[MAX_FILENAME]; FILE *file; kprintf(1, "Tvorba raw struktury pro komata..."); if (getcwd(text, MAX_FILENAME) == NULL) { kprintf(1, "Cannot get current directory"); return 0; } kprintf(1, "_getcwd = %s", text); strcpy(filename, p_Level_Name); file = fopen(filename, "rb"); if (!file) { kprintf(1, "Unable to load level '%s', guessing level name...", filename); strcat(filename, KONCOVKA_LEVELU); file = fopen(filename, "rb"); if (!file) { kprintf(1, "Unable to load level '%s'.", filename); return 0; } kprintf(1, "Going with '%s' level name", filename); } if (fread(&l_h, sizeof(LEVEL_HEADER), 1, file) != 1) { fclose(file); kprintf(1, "Unable to load level '%s'.", filename); return 0; } (*size) = l_h.x * l_h.y * l_h.z * 2; (*b_l_d) = (BUNKA_LEVELU_DISK *) mmalloc((*size) * sizeof(BUNKA_LEVELU_DISK)); if (fread((*b_l_d), sizeof(BUNKA_LEVELU_DISK), (*size), file) != (size_t) (*size)) { free(*b_l_d); fclose(file); kprintf(1, "Unable to load level '%s'.", filename); return 0; } fclose(file); if (chdir(text)) return 0; return 1; } //------------------------------------------------------------------------------------------------ // Loads level into memory //------------------------------------------------------------------------------------------------ int lsi_Load_Level(char *p_Level_Name, LEVELINFO * p_Level) { char text[256]; char filename[MAX_FILENAME]; FILE *file; int Vazba1, Vazba2, Rotation; int i, Guid, errors = 0, error; LEVEL_HEADER l_h; int x, y, z, pointer, act_pointer, ani_pointer; int kvalita_castic, kvalita_casticv; BUNKA_LEVELU_DISK b_l_d; int Next_Beetle = 0; char bVybusniny = 0; char bPodlaha = 0; char bKamen = 0; char bVoda = 0; char bNeviditelnaZed; p_Level->Sub_Svetla = 0; ZeroMemory(&b_l_d, sizeof(b_l_d)); for (i = 0; i < 6; i++) { p_Level->Beetle[i] = -1; p_Level->BeetleAnim[i].Mesh = -1; p_Level->BeetleAnim[i].Flag = -1; p_Level->BeatleSmoke[i].iItem = -1; p_Level->BeatleSmoke[i].iStepc = 0; ZeroMemory(&p_Level->BeatleSmoke[i].sStopy, sizeof(SYSTEMKOUROVYCHCASTIC)); p_Level->BeatleSmoke[i].sStopy.System = (size_ptr)NULL; p_Level->BeetleAnim[i].iAnimCount = 0; p_Level->BeetleAnim[i].iEffect = 0; p_Level->BeetleAnim[i].iEffectCounter = 0; p_Level->BeetleAnim[i].dwTime = timeGetTime(); } if (getcwd(text, 255) == NULL) { kprintf(1, "Unable to get current directory"); return -1; } kprintf(1, "Loading level from %s ...", text); kvalita_castic = GetPrivateProfileInt("game", "kvalita_castic", 0, ini_file); kvalita_castic++; kvalita_casticv = GetPrivateProfileInt("game", "kvalita_casticv", 0, ini_file); kvalita_casticv++; p_Level->KvalitaCastic = kvalita_castic; p_Level->KvalitaCasticV = kvalita_casticv; strcpy(filename, p_Level_Name); file = fopen(filename, "rb"); if (!file) { kprintf(1, "Unable to load level '%s', guessing level name...", filename); strcat(filename, KONCOVKA_LEVELU); file = fopen(filename, "rb"); if (!file) { kprintf(1, "Unable to load level '%s'.", filename); return(-1); } kprintf(1, "Going with '%s' level name", filename); } if (fread(&l_h, sizeof(LEVEL_HEADER), 1, file) != 1) { fclose(file); kprintf(1, "Unable to load level '%s'.", filename); return 0; } p_Level->Size[0] = l_h.x; p_Level->Size[1] = l_h.z; p_Level->Size[2] = l_h.y * 2; p_Level->Size_of_Level = l_h.x * l_h.y * l_h.z * 2; l_h.y *= 2; kom_init_level(&l_h); memcpy((void *) &p_Level->LevelHeader, (void *) &l_h, sizeof(LEVEL_HEADER)); p_Level->Count_Of_Items = l_h.prvku; p_Level->Level = (ITEMDESC **) mmalloc((p_Level->Size_of_Level) * sizeof(ITEMDESC *)); p_Level->Square = (SQUAREINFO *) mmalloc((p_Level->Size_of_Level) * sizeof(SQUAREINFO)); for (i = 0; i < p_Level->Size_of_Level; i++) p_Level->Square[i].bUnderWater = -1; p_Level->Item = (ITEMDESC *) mmalloc((p_Level->Count_Of_Items) * sizeof(ITEMDESC)); for (i = 0; i < p_Level->Count_Of_Items; i++) p_Level->Item[i].hSvetlo = -1; p_Level->Action_Item = (long *) mmalloc((p_Level->Count_Of_Items) * sizeof(long) * 2); p_Level->Count_Of_Action_Items = p_Level->Count_Of_Items * 2; p_Level->Anim_Item = (long *) mmalloc((p_Level->Count_Of_Items) * sizeof(long)); p_Level->pSquare = (SQUAREDESC *) mmalloc(p_Level->Size[0] * p_Level->Size[1] * sizeof(SQUAREDESC)); for (i = 0; i < (p_Level->Size[0] * p_Level->Size[1]); i++) { p_Level->pSquare[i].iUroven = 0; p_Level->pSquare[i].Flek.pFlek = 0; } for (i = 0; i < 10; i++) { p_Level->VodniCakanec1[i].pCastice = NULL; p_Level->VodniCakanec2[i].pCastice = NULL; p_Level->NatureESystem[i].pSystem = (size_ptr)NULL; } for (i = 0; i < 10; i++) p_Level->Krompac[i].pCastice = NULL; for (i = 0; i < 20; i++) { p_Level->Exploze[i].pCastice = NULL; p_Level->Propadla[i].pCastice = NULL; p_Level->Kamen[i].pCastice = NULL; p_Level->Jiskra[i].pCastice = NULL; p_Level->Prach[i].pCastice = NULL; p_Level->Flare[i].pFlare = 0; p_Level->Flare[i].hSvetlo = -1; } for (i = 0; i < 6; i++) { p_Level->BublSystem[i].iItem = -1; p_Level->BublSystem[i].mesh = -1; } pointer = 0; act_pointer = 0; ani_pointer = 0; x = 0; y = 0; z = 0; for (i = 0; i < p_Level->Size_of_Level; i++) { #ifdef _DEBUG assert(fread(&b_l_d, sizeof(b_l_d), 1, file) == 1); #else fread(&b_l_d, sizeof(b_l_d), 1, file); #endif Guid = b_l_d.guid; Rotation = b_l_d.Rotace; Vazba1 = b_l_d.Vazba1; Vazba2 = b_l_d.Vazba2; if (Guid) { kprintf(1, "lsi_Find_Object(GUID = %d)", Guid); error = lsi_Find_Object(Guid, p_Level); bNeviditelnaZed = 0; // jestlize je to neviditelna zed, tak ji preved na zed if (error != -1) if (p_Level->Object[error].Class == 21) { error = lsi_Find_Wall_Object(p_Level); bNeviditelnaZed = 1; } if (error == -1) { errors++; p_Level->Level[i] = 0; kprintf(1, "nerozlustil jsem guid %d", Guid); } else { if (!bNeviditelnaZed) { p_Level->Item[pointer].Index_Of_Game_Mesh = kom_pridej_prvek_levelu(&b_l_d, x, z, y); kom_umisti_prvek(p_Level->Item[pointer].Index_Of_Game_Mesh, x, z, y, Rotation); } else p_Level->Item[pointer].Index_Of_Game_Mesh = 0; kprintf(1, "pridavam prvek %d ...", pointer); p_Level->Item[pointer].p_Object = &p_Level->Object[error]; p_Level->Item[pointer].Connection[0] = Vazba1; p_Level->Item[pointer].Connection[1] = Vazba2; p_Level->Item[pointer].Rotation = Rotation; p_Level->Item[pointer].Pos[0] = x; p_Level->Item[pointer].Pos[1] = y; p_Level->Item[pointer].Pos[2] = z; p_Level->Item[pointer].bDestroed = 0; p_Level->Item[pointer].a_run = 0; p_Level->Item[pointer].a_flag = -1; p_Level->Item[pointer].iItem = pointer; p_Level->Item[pointer].Square.iUroven = 0; p_Level->Item[pointer].Square.Flek.pFlek = 0; p_Level->Item[pointer].Square.pExtFlek = NULL; p_Level->Level[i] = &p_Level->Item[pointer]; if (p_Level->Item[pointer].p_Object->Class == 13) { p_Level->Anim_Item[ani_pointer] = pointer; ani_pointer++; } if ((p_Level->Item[pointer].p_Object->Class == 6) || ((p_Level->Item[pointer].p_Object->Class == 13) && (p_Level->Item[pointer].p_Object->SubClass == 4))) bVybusniny = 1; if (p_Level->Item[pointer].p_Object->Class == 15) bPodlaha = 1; if (p_Level->Item[pointer].p_Object->Class == 7) bKamen = 1; if (p_Level->Item[pointer].p_Object->Class == 12) { kom_mesh_set_no_test(p_Level->Item[pointer].Index_Of_Game_Mesh); bVoda = 1; } if (((p_Level->Item[pointer].p_Object->Class > 7) && (p_Level->Item[pointer].p_Object->Class < 12)) || (p_Level->Item[pointer].p_Object->Class == 4) || (p_Level->Item[pointer].p_Object->Class == 15)) { if (p_Level->Item[pointer].p_Object->Class != 11) { p_Level->Action_Item[act_pointer] = i; act_pointer++; } else { p_Level->Action_Item[act_pointer] = p_Level->Item[pointer].Connection[0]; act_pointer++; p_Level->Action_Item[act_pointer] = p_Level->Item[pointer].Connection[1]; act_pointer++; } } if (p_Level->Item[pointer].p_Object->Class == 1) { p_Level->Beetle[Next_Beetle] = p_Level->Item[pointer].p_Object->SubClass; p_Level->BeetleAnim[Next_Beetle].Mesh = p_Level->Item[pointer].Index_Of_Game_Mesh; p_Level->BeetleAnim[Next_Beetle].iRot = p_Level->Item[pointer].Rotation; p_Level->BublSystem[Next_Beetle].iItem = pointer; p_Level->BublSystem[Next_Beetle].mesh = p_Level->Item[pointer].Index_Of_Game_Mesh; ZeroMemory(&p_Level->BeatleSmoke[Next_Beetle], sizeof(BEATLE_SMOKE_SYSTEM)); p_Level->BeatleSmoke[Next_Beetle].dwExpTime = 4000; p_Level->BeatleSmoke[Next_Beetle].dwRealTime = (int) ceil((randf() / (float) RAND_MAX) * 600.0f); p_Level->BeatleSmoke[Next_Beetle].iItem = pointer; // kom_mesh_set_mesh(p_Level->BeetleAnim[Next_Beetle].Mesh, 2, p_Level->Item[pointer].Rotation); Next_Beetle++; } if ((p_Level->Item[pointer].p_Object->Class == 1) || (p_Level->Item[pointer].p_Object->Class == 11) || (p_Level->Item[pointer].p_Object->Class == 8) || (p_Level->Item[pointer].p_Object->Class == 10)) { int m; p_Level->Item[pointer].p_Back_Pack = (BACK_PACK *) malloc(sizeof(BACK_PACK)); for (m = 0; m < 16; m++) p_Level->Item[pointer].p_Back_Pack->item[m] = 0; p_Level->Item[pointer].p_Back_Pack->Count_of_Items = 0; p_Level->Item[pointer].p_Back_Pack->Max_Items = 4; p_Level->Item[pointer].p_Back_Pack->Strength = 2; } pointer++; } } else p_Level->Level[i] = 0; x++; if (x > (p_Level->Size[0] - 1)) { x = 0; y++; if (y > (p_Level->Size[1] - 1)) { y = 0; z++; } } } fclose(file); p_Level->Action_Item[act_pointer] = -1; p_Level->Anim_Item[ani_pointer] = -1; if (!lsi_Create_Krompac(p_Level, (int) ceil(250 / kvalita_castic))) kprintf(1, "Nepodarilo ze vytvorit vsechny krompace!"); if (bVybusniny) { if (!lsi_Create_Explosions(p_Level, (int) ceil(500 / kvalita_castic))) kprintf(1, "Nepodarilo ze vytvorit vsechny vybuchy!"); if (!lsi_Create_Jiskry(p_Level, (int) ceil(20 / kvalita_castic))) kprintf(1, "Nepodarilo ze vytvorit vsechny jistry!"); } if (bPodlaha) if (!lsi_Create_Trap_Doors(p_Level, (int) ceil(15 / kvalita_castic))) kprintf(1, "Nepodarilo ze vytvorit vsechny propadla!"); if (bKamen) if (!lsi_Create_Rocks(p_Level, (int) ceil(1000 / kvalita_castic))) kprintf(1, "Nepodarilo ze vytvorit vsechny kameny!"); if (bVoda) { if (!lsi_Create_Vodni_Cakance1(p_Level, (int) ceil(5000 / kvalita_casticv))) kprintf(1, "Nepodarilo ze vytvorit vsechny kameny!"); if (!lsi_Create_Vodni_Cakance2(p_Level, (int) ceil(5000 / kvalita_casticv))) kprintf(1, "Nepodarilo ze vytvorit vsechny kameny!"); } if (!lsi_Create_Prach(p_Level, 1)) kprintf(1, "Nepodarilo ze vytvorit vsechen prach :) !"); return errors; } //------------------------------------------------------------------------------------------------ // Release Level from memory //------------------------------------------------------------------------------------------------ void lsi_Release_Level(LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Count_Of_Items; i++) { if (p_Level->Level[i]) { if ((p_Level->Level[i]->p_Object->Class == 1) || (p_Level->Level[i]->p_Object->Class == 11) || (p_Level->Level[i]->p_Object->Class == 8) || (p_Level->Level[i]->p_Object->Class == 10)) { kprintf(1, "free(p_Level->Level[%d]->p_Back_Pack);", i); free(p_Level->Level[i]->p_Back_Pack); } } } kprintf(1, "free (Item, Level, Square, Action_Item, Anim_Item, pSquare"); free((void *) p_Level->Item); free((void *) p_Level->Level); free((void *) p_Level->Square); free((void *) p_Level->Action_Item); free((void *) p_Level->Anim_Item); free((void *) p_Level->pSquare); for (i = 0; i < 10; i++) if (p_Level->Krompac[i].pCastice) { kprintf(1, "free p_Level->Krompac[%d].pCastice", i); free((void *) p_Level->Krompac[i].pCastice); } for (i = 0; i < 20; i++) { if (p_Level->Exploze[i].pCastice) { kprintf(1, "free p_Level->Exploze[%d].pCastice", i); free((void *) p_Level->Exploze[i].pCastice); } if (p_Level->Jiskra[i].pCastice) { kprintf(1, "free p_Level->Jiskra[%d].pCastice", i); free((void *) p_Level->Jiskra[i].pCastice); } if (p_Level->Propadla[i].pCastice) { kprintf(1, "free p_Level->Propadla[%d].pCastice", i); free((void *) p_Level->Propadla[i].pCastice); } if (p_Level->Kamen[i].pCastice) { kprintf(1, "free p_Level->Kamen[%d].pCastice", i); free((void *) p_Level->Kamen[i].pCastice); } if (p_Level->Prach[i].pCastice) { kprintf(1, "free p_Level->Prach[%d].pCastice", i); free((void *) p_Level->Prach[i].pCastice); } } /* for(i=0;i<6;i++) if(p_Level->BeatleSmoke[i].sStopy.System) { par_zrus(p_Level->BeatleSmoke[i].sStopy.System); free((void *) p_Level->BeatleSmoke[i].sStopy.pCastice); }*/ for (i = 0; i < 10; i++) { if (p_Level->VodniCakanec1[i].pCastice) { kprintf(1, "free p_Level->VodniCakanec1[%d].pCastice", i); free((void *) p_Level->VodniCakanec1[i].pCastice); } if (p_Level->VodniCakanec2[i].pCastice) { kprintf(1, "free p_Level->VodniCakanec2[%d].pCastice", i); free((void *) p_Level->VodniCakanec2[i].pCastice); } if (p_Level->NatureESystem[i].pSystem) { kprintf(1, "free p_Level->NatureESystem[%d].pSystem", i); par_zrus(p_Level->NatureESystem[i].pSystem); kprintf(1, " free (pCastice, hHnizdo, pivot, dir, ny, nx"); free((void *) p_Level->NatureESystem[i].pCastice); free((void *) p_Level->NatureESystem[i].hHnizdo); free((void *) p_Level->NatureESystem[i].pivot); free((void *) p_Level->NatureESystem[i].dir); free((void *) p_Level->NatureESystem[i].ny); free((void *) p_Level->NatureESystem[i].nx); } if (p_Level->KourUst[i].System) { kprintf(1, "par_zrus p_Level->KourUst[%d].pSystem", i); par_zrus(p_Level->KourUst[i].System); } } if (p_Level->pCara) { kprintf(1, "free((void *) p_Level->pCara)"); free((void *) p_Level->pCara); } if (p_Level->Rain.bRain) { kprintf(1, "p_Level->Rain.pSystem"); par_zrus(p_Level->Rain.pSystem); kprintf(1, " free (hHnizdo, pivot, pCastice"); free((void *) p_Level->Rain.hHnizdo); free((void *) p_Level->Rain.pivot); free((void *) p_Level->Rain.pCastice); p_Level->Rain.bRain = 0; } if (p_Level->Rain.bWaterCircles) { kprintf(1, "p_Level->Rain.pWSystem"); par_zrus(p_Level->Rain.pWSystem); kprintf(1, " free (hWHnizdo, Wpivot, Wpos, pWCastice"); free((void *) p_Level->Rain.hWHnizdo); free((void *) p_Level->Rain.Wpivot); free((void *) p_Level->Rain.Wpos); free((void *) p_Level->Rain.pWCastice); p_Level->Rain.bWaterCircles = 0; } memset((void *) &p_Level->Rain, 0, sizeof(p_Level->Rain)); if (p_Level->StreetRain.bWaterCircles) { kprintf(1, "p_Level->StreetRain.pWSystem"); par_zrus(p_Level->StreetRain.pWSystem); kprintf(1, " free (hWHnizdo, Wpivot, Wpos, pWCastice"); free((void *) p_Level->StreetRain.hWHnizdo); free((void *) p_Level->StreetRain.Wpivot); free((void *) p_Level->StreetRain.Wpos); free((void *) p_Level->StreetRain.pWCastice); p_Level->StreetRain.bWaterCircles = 0; } memset((void *) &p_Level->StreetRain, 0, sizeof(p_Level->StreetRain)); if (p_Level->Snow.bSnow) { kprintf(1, "p_Level->Snow.pSystem"); par_zrus(p_Level->Snow.pSystem); kprintf(1, " free (hHnizdo, pivot, pCastice"); free((void *) p_Level->Snow.hHnizdo); free((void *) p_Level->Snow.pivot); free((void *) p_Level->Snow.pCastice); p_Level->Snow.bSnow = 0; } memset((void *) &p_Level->Snow, 0, sizeof(p_Level->Snow)); if (p_Level->Mist.bMist) { kprintf(1, "edl_svetlo_zrus ,p_Level->Mist.hSvetlo = %d", p_Level->Mist.hSvetlo); edl_svetlo_zrus(p_Level->Mist.hSvetlo); p_Level->Mist.bMist = 0; } } void lsi_Get_Dir_Name(char *cText, char *cLevel) { cText[0] = 0; char *c = strstr(cLevel, "."); if (c) { int length = c - cLevel; strncpy(cText, cLevel, length); cText[length] = 0; } else { strcpy(cText, cLevel); } } void lsi_copy_save(char *cMask, LEVELINFO * p_Level) { char dir[MAX_FILENAME + 1]; char cLevelMask[MAX_FILENAME]; char csrc[MAX_FILENAME + 1]; char cout[MAX_FILENAME + 1]; int ret; strcpy(dir, GAME_LEVEL_DIR); lsi_Get_Dir_Name(cLevelMask, p_Level->cLoadedFrom); sprintf(cout, "%s%s", cMask, ".b2l"); ret = snprintf(csrc, sizeof(csrc), "%s%c%s%c%s%s", dir, DIR_SLASH, cLevelMask, DIR_SLASH, cLevelMask, ".b2l"); assert(ret < (int) sizeof(csrc)); lsi_file_copy(csrc, cout); sprintf(cout, "%s%s", cMask, ".b2t"); ret = snprintf(csrc, sizeof(csrc), "%s%c%s%c%s%s", dir, DIR_SLASH, cLevelMask, DIR_SLASH, cLevelMask, ".b2t"); assert(ret < (int) sizeof(csrc)); lsi_file_copy(csrc, cout); sprintf(cout, "%s%s", cMask, ".bpr"); ret = snprintf(csrc, sizeof(csrc), "%s%c%s%c%s%s", dir, DIR_SLASH, cLevelMask, DIR_SLASH, cLevelMask, ".bpr"); assert(ret < (int) sizeof(csrc)); lsi_file_copy(csrc, cout); sprintf(cout, "%s%s", cMask, ".lv6"); ret = snprintf(csrc, sizeof(csrc), "%s%c%s%c%s%s", dir, DIR_SLASH, cLevelMask, DIR_SLASH, cLevelMask, ".lv6"); assert(ret < (int) sizeof(csrc)); lsi_file_copy(csrc, cout); sprintf(cout, "%s%s", cMask, ".ply"); ret = snprintf(csrc, sizeof(csrc), "%s%c%s%c%s%s", dir, DIR_SLASH, cLevelMask, DIR_SLASH, cLevelMask, ".ply"); assert(ret < (int) sizeof(csrc)); lsi_file_copy(csrc, cout); } int lsi_Get_Save_Info(char *p_Level_Name, int *pActLevel, int *pActScene) { FILE *file; char text[256]; PLAYER_PROFILE pPlayer; LEVEL_HEADER l_h; WCHAR wTmp[32]; char cTmp[256+1]; int ver; if (chdir(SAVE_DIR) || chdir(p_Level_Name)) return 0; sprintf(text, "%s.lvc", p_Level_Name); file = fopen(text, "rb"); if (!file) return 0; if (fread(&pPlayer, sizeof(PLAYER_PROFILE), 1, file) != 1 || fread(wTmp, 32 * sizeof(WCHAR), 1, file) != 1 || fread(&ver, sizeof(int), 1, file) != 1 || fread(cTmp, (256+1) * sizeof(char), 1, file) != 1 || fread(&l_h, sizeof(LEVEL_HEADER), 1, file) != 1) { fclose(file); return 0; } *pActLevel = l_h.rezerved[0]; *pActScene = l_h.rezerved[1]; fclose(file); return 1; } #ifdef WINDOWS int lsi_Save_Exist(WCHAR * wName, char *cFile) { FILE *file; long Done, error; struct _finddata_t Data; char cwd[MAX_FILENAME+1]; char text[MAX_FILENAME+1]; PLAYER_PROFILE pPlayer; WCHAR wTmp[32]; Done = _findfirst("*",&Data); error = Done; while(error != -1) { if(error != -1) { getcwd(cwd,MAX_FILENAME); chdir(Data.name); sprintf(text,"%s.lvc", Data.name); file = fopen(text, "rb"); if(file) { fread(&pPlayer, sizeof(PLAYER_PROFILE), 1, file); fread(wTmp, 32 * sizeof(WCHAR), 1, file); fclose(file); if(!wcscmp(pPlayer.cName, pPlayerProfile.cName) && !wcscmp(wTmp, wName)) { chdir(cwd); strcpy(cFile, Data.name); _findclose(Done); return 1; } } chdir(cwd); error = _findnext(Done,&Data); } } _findclose(Done); return 0; } void delete_dir(char *p_Level_Name) { long Done, error; struct _finddata_t Data; if(chdir(p_Level_Name) == -1) return; Done = _findfirst("*.*",&Data); error = Done; while(error != -1) { if(error != -1) { if(!(Data.attrib & _A_SUBDIR)) remove(Data.name); error = _findnext(Done,&Data); } } _findclose(Done); chdir(".."); rmdir(p_Level_Name); } #endif #ifdef LINUX int lsi_Save_Exist(WCHAR * wName, char *cFile) { struct dirent **namelist; char cwd[MAX_FILENAME+1]; int i; file_filter_mask("*"); int c = scandir(".", &namelist, &file_filter, alphasort); if (c < 0) { return 0; } if (getcwd(cwd,MAX_FILENAME) == NULL) return 0; int ret = false; for(i = 0; i < c; i++) { char text[MAX_FILENAME+1]; if(chdir(namelist[i]->d_name)) { kwarning(1, "Unable to chdir(%s)", namelist[i]->d_name); continue; } sprintf(text,"%s.lvc", namelist[i]->d_name); FILE *file = fopen(text, "rb"); if(file) { PLAYER_PROFILE pPlayer; WCHAR wTmp[32]; if (fread(&pPlayer, sizeof(PLAYER_PROFILE), 1, file) != 1 || fread(wTmp, 32 * sizeof(WCHAR), 1, file) != 1) { fclose(file); return 0; } fclose(file); if(!wcscmp(pPlayer.cName, pPlayerProfile.cName) && !wcscmp(wTmp, wName)) { strcpy(cFile, namelist[i]->d_name); ret = true; break; } } if(chdir(cwd)) { kwarning(1, "Unable to chdir(%s)", cwd); break; } } if(chdir(cwd)) { kwarning(1, "Unable to chdir(%s)", cwd); ret = false; } for(i = 0; i < c; i++) free(namelist[i]); free(namelist); return ret; } void delete_dir(char *p_Level_Name) { struct dirent **namelist; int i; if(chdir(p_Level_Name) == -1) return; file_filter_mask("*"); int c = scandir(".", &namelist, &file_filter, alphasort); if (c < 0) { return; } for(i = 0; i < c; i++) { remove(namelist[i]->d_name); free(namelist[i]); } free(namelist); if (chdir("..")) return; rmdir(p_Level_Name); } #endif void lsi_Save_Level(WCHAR * pwc_Level_Name, LEVELINFO * p_Level) { FILE *file; int i; char p_Level_Name[MAX_FILENAME]; char buffer[MAX_FILENAME]; BUNKA_LEVELU_DISK b_l_d; DWORD time; char pom[128]; char pom2[128]; int ver = SAVE_VER; ZeroMemory(p_Level_Name, MAX_FILENAME); if (chdir(SAVE_DIR)) return; _strdate(pom); for(i=0;i<(signed)strlen(pom);i++) if(pom[i] == '/') pom[i] = '_'; _strtime(pom2); for(i=0;i<(signed)strlen(pom2);i++) if(pom2[i] == ':') pom2[i] = '_'; sprintf(p_Level_Name, "save_[%s]_[%s]", pom, pom2); kprintf(1, "Saving level as %s", p_Level_Name); if(lsi_Save_Exist(pwc_Level_Name, p_Level_Name)) delete_dir(p_Level_Name); #ifdef WINDOWS mkdir(p_Level_Name); #else mkdir(p_Level_Name, DEFAULT_DIR_MASK); #endif if (chdir(p_Level_Name)) return; lsi_copy_save(p_Level_Name, p_Level); if (snprintf(buffer, sizeof(buffer), "%s.lvc", p_Level_Name) >= (int) sizeof(buffer)) return; file = fopen(buffer, "wb"); if(!file) return; fwrite(&pPlayerProfile, sizeof(PLAYER_PROFILE), 1, file); //zapis jmeno level fwrite(pwc_Level_Name, 32 * sizeof(WCHAR), 1, file); fwrite(&ver, sizeof(int), 1, file); fwrite(p_Level->cLoadedFrom, (256+1)*sizeof(char), 1, file); p_Level->LevelHeader.rezerved[0] = iActualLevel; p_Level->LevelHeader.rezerved[1] = iActualScene; //zapis hlavicku fwrite(&p_Level->LevelHeader, sizeof(LEVEL_HEADER), 1, file); //zapis cas a kroky time = p_Level->dwPlayTime + (timeGetTime() - p_Level->dwStartTime); fwrite(&time, sizeof(DWORD), 1, file); fwrite(&p_Level->iNumOfSteps, sizeof(int), 1, file); //zapis itemy for(i=0;iCount_Of_Items;i++) { ZeroMemory(&b_l_d, sizeof(BUNKA_LEVELU_DISK)); b_l_d.guid = p_Level->Item[i].p_Object->GUID; b_l_d.mesh = p_Level->Item[i].Index_Of_Game_Mesh; b_l_d.Rotace = p_Level->Item[i].Rotation; b_l_d.Vazba1 = p_Level->Item[i].Connection[0]; b_l_d.Vazba2 = p_Level->Item[i].Connection[1]; b_l_d.rez[0] = p_Level->Item[i].bDestroed; b_l_d.rez[1] = p_Level->Item[i].Pos[0]; b_l_d.rez[2] = p_Level->Item[i].Pos[1]; b_l_d.rez[3] = p_Level->Item[i].Pos[2]; fwrite(&b_l_d, sizeof(BUNKA_LEVELU_DISK), 1, file); } //zapis back_packy for(i=0;iCount_Of_Items;i++) if(p_Level->Item[i].p_Back_Pack) fwrite(p_Level->Item[i].p_Back_Pack, sizeof(BACK_PACK), 1, file); //ulozi spodni patro fleku fwrite(p_Level->pSquare, sizeof(SQUAREDESC), p_Level->Size[0] * p_Level->Size[1], file); //ulozi flaky privazane k prvkum for(i=0;iCount_Of_Items;i++) fwrite(&p_Level->Item[i].Square, sizeof(SQUAREDESC), 1, file); fclose(file); } int lsi_fint_item(int mesh, LEVELINFO * p_Level) { int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->Index_Of_Game_Mesh == mesh) return i; return -1; } void lsi_Add_Prifile(PLAYER_PROFILE * pProfile) { int i; for (i = 0; i < 20; i++) if (!pPlayerProfile.cScene[i]) pPlayerProfile.cScene[i] = pProfile->cScene[i]; for (i = 0; i < 20; i++) if (!pPlayerProfile.cMovie[i]) pPlayerProfile.cMovie[i] = pProfile->cMovie[i]; for (i = 0; i < 600; i++) if (!pPlayerProfile.cLevel[i]) pPlayerProfile.cLevel[i] = pProfile->cLevel[i]; } void lsi_Destroy_Beetle(LEVELINFO * p_Level, int GUID, int mesh) { int obj, i; if (GUID < 1000 || GUID > 1999) return; am_Remove_Beetle_Animation(mesh, p_Level); obj = lsi_Find_Object(GUID, p_Level); if (obj == -1) return; for (i = 0; i < 6; i++) if (p_Level->Beetle[i] == p_Level->Object[obj].SubClass) { p_Level->Beetle[i] = -1; p_Level->BublSystem[i].iItem = -1; p_Level->BublSystem[i].bOn = 0; p_Level->BublSystem[i].mesh = -1; //p_Level->BeatleSmoke[i].iItem = -1; return; } } //------------------------------------------------------------------------------------------------ // Loads level into memory //------------------------------------------------------------------------------------------------ int lsi_Load_Saved_Level(char *p_Level_Name, LEVELINFO * p_Level) { int real; char ctext[MAX_FILENAME]; FILE *file; int i, j; LEVEL_HEADER l_h; BUNKA_LEVELU_DISK b_l_d; PLAYER_PROFILE pProfile; FLEK_K *pFlek; WCHAR pwc_Level_Name[32]; int ver; ZeroMemory(&b_l_d, sizeof(b_l_d)); lsi_Get_Dir_Name(ctext, p_Level_Name); strcat(ctext, ".lvc"); file = fopen(ctext, "rb"); if (!file) { kprintf(1, "Level change file %s not present", ctext); return -1; } if (fread(&pProfile, sizeof(PLAYER_PROFILE), 1, file) != 1 || fread(pwc_Level_Name, 32 * sizeof(WCHAR), 1, file) != 1 || fread(&ver, sizeof(int), 1, file) != 1) { kprintf(1, "Cannot read level change file %s", ctext); fclose(file); return -2; } lsi_Add_Prifile(&pProfile); if (ver != SAVE_VER) { kprintf(1, "Save version mismatch! Level %s", p_Level_Name); fclose(file); return -2; } if (fread(p_Level->cLoadedFrom, (256+1)*sizeof(char), 1, file) != 1 || fread(&l_h, sizeof(LEVEL_HEADER), 1, file) != 1 || fread(&p_Level->dwPlayTime, sizeof(DWORD), 1, file) != 1 || fread(&p_Level->iNumOfSteps, sizeof(int), 1, file) != 1) { kprintf(1, "Cannot read level change file %s", ctext); fclose(file); return -2; } memset(p_Level->Level, 0, sizeof(p_Level->Level[0])*p_Level->Size_of_Level); iActualLevel = l_h.rezerved[0]; iActualScene = l_h.rezerved[1]; for (i = 0; i < p_Level->Count_Of_Items; i++) { if (fread(&b_l_d, sizeof(b_l_d), 1, file) != 1) { kprintf(1, "Cannot read level change file %s", ctext); fclose(file); return -2; } /* p_Level->Size[0] = x p_Level->Size[1] = y p_Level->Size[2] = z */ if((b_l_d.rez[1] < 0 || b_l_d.rez[1] > p_Level->Size[0]) || (b_l_d.rez[2] < 0 || b_l_d.rez[2] > p_Level->Size[1]) || (b_l_d.rez[3] < 0 || b_l_d.rez[3] > p_Level->Size[2])) { // The saved game is broken - item is ot of the bound. Cancel level loading kprintf(1, "Save version mismatch! Level %s", p_Level_Name); fclose(file); return -2; } if (b_l_d.rez[0]) { lsi_Destroy_Beetle(p_Level, b_l_d.guid, b_l_d.mesh); kom_zrus_prvek(b_l_d.mesh); gl_Logical2Real(b_l_d.rez[1], b_l_d.rez[2], b_l_d.rez[3], &real, p_Level); if (b_l_d.guid >= 13000 && b_l_d.guid < 14000) am_Remove_Animate_itemB(i, p_Level); p_Level->Item[i].bDestroed = 1; } else { p_Level->Item[i].Index_Of_Game_Mesh = b_l_d.mesh; p_Level->Item[i].Connection[0] = b_l_d.Vazba1; p_Level->Item[i].Connection[1] = b_l_d.Vazba2; p_Level->Item[i].Rotation = b_l_d.Rotace; p_Level->Item[i].Pos[0] = b_l_d.rez[1]; p_Level->Item[i].Pos[1] = b_l_d.rez[2]; p_Level->Item[i].Pos[2] = b_l_d.rez[3]; p_Level->Item[i].bDestroed = 0; kom_umisti_prvek(b_l_d.mesh, b_l_d.rez[1], b_l_d.rez[3], b_l_d.rez[2], b_l_d.Rotace); if (p_Level->Item[i].p_Object->Class == 1) for (j = 0; j < 6; j++) if (p_Level->BeetleAnim[j].Mesh == b_l_d.mesh) p_Level->BeetleAnim[j].iRot = b_l_d.Rotace; gl_Logical2Real(b_l_d.rez[1], b_l_d.rez[2], b_l_d.rez[3], &real, p_Level); p_Level->Level[real] = &p_Level->Item[i]; } } for (i = 0; i < p_Level->Count_Of_Items; i++) { if (p_Level->Item[i].p_Back_Pack) { if (fread(p_Level->Item[i].p_Back_Pack, sizeof(BACK_PACK), 1, file) != 1) { kprintf(1, "Cannot read level change file %s", ctext); fclose(file); return -2; } } } //ulozi spodni patro fleku if (fread(p_Level->pSquare, sizeof(SQUAREDESC), p_Level->Size[0] * p_Level->Size[1], file) != (size_t) (p_Level->Size[0] * p_Level->Size[1])) { kprintf(1, "Cannot read level change file %s", ctext); fclose(file); return -2; } for (i = 0; i < p_Level->Size[0] * p_Level->Size[1]; i++) { p_Level->pSquare[i].pExtFlek = NULL; if (p_Level->pSquare[i].Flek.pFlek) { pFlek = &p_Level->pSquare[i].Flek; pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, p_Level->pSquare[i].iUroven, pFlek->Material); } } //ulozi flaky privazane k prvkum for (i = 0; i < p_Level->Count_Of_Items; i++) { if (fread(&p_Level->Item[i].Square, sizeof(SQUAREDESC), 1, file) != 1) { kprintf(1, "Cannot read level change file %s", ctext); fclose(file); return -2; } p_Level->Item[i].Square.pExtFlek = NULL; } for (i = 0; i < p_Level->Count_Of_Items; i++) if (p_Level->Item[i].Square.Flek.pFlek && p_Level->Item[i].p_Object->Class != 1 && p_Level->Item[i].p_Object->Class != 13) { pFlek = &p_Level->Item[i].Square.Flek; pFlek->pFlek = kom_flek_pridej(pFlek->Flag, (BOD *) & pFlek->pos, (BOD *) & pFlek->nx, (BOD *) & pFlek->nz, pFlek->dx, pFlek->dy, pFlek->Rotation, p_Level->Item[i].Square.iUroven, pFlek->Material); } fclose(file); return 1; } //------------------------------------------------------------------------------------------------ // pripoji k predmetu material //------------------------------------------------------------------------------------------------ char lsi_Bind_Material(LEVELINFO * p_Level, ITEMDESC * pItem) { int i, mh; for (i = 0; i < p_Level->iMaterialb; i++) { mh = kom_amat_get_kontejner(pItem->Index_Of_Game_Mesh); if (p_Level->pMaterialb[i].handle_meshe == mh) { pItem->mMaterial = &p_Level->pMaterialb[i]; return 1; } } kprintfl(1, "Nepodarilo se nabindovat maretial k prvku %d", pItem->p_Object->GUID); return 0; } //------------------------------------------------------------------------------------------------ // pripoji k predmetum materialy //------------------------------------------------------------------------------------------------ void lsi_Bind_Materials2Items(LEVELINFO * p_Level) { int i; OBJECTDESC *pObj; ITEMDESC *pItem; for (i = 0; i < p_Level->Count_Of_Items; i++) { pObj = p_Level->Item[i].p_Object; pItem = &p_Level->Item[i]; if (pObj->MatEvent[0].cType || pObj->MatEvent[1].cType || pObj->MatEvent[2].cType) if (lsi_Bind_Material(p_Level, pItem)) { pItem->bMatEvent[0] = 0; pItem->bMatEvent[1] = 0; pItem->bMatEvent[2] = 0; continue; } pItem->bMatEvent[0] = 1; pItem->bMatEvent[1] = 1; pItem->bMatEvent[2] = 1; pItem->mMaterial = NULL; } } void lsi_Make_Screenshot(char *pFile) { int width, height, depth, pitch; size_t size; GLenum format; unsigned char *pixels, *flipped; SDL_Surface *p_surf; p_ber->p_age->graph_get()->get(&width, &height, &depth); if (depth == 32) format = GL_RGBA; else if (depth == 24) format = GL_RGB; else assert(0); pitch = width * (depth/8); size = pitch * height; // Read the pixels pixels = (unsigned char *) mmalloc(size); glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, pixels); // We need to invert the pixels vertically because that is how BMP // files are stored. flipped = (unsigned char *) mmalloc(size); for (int i = 0; i < height; i++) { memcpy(flipped + size - ((i + 1) * pitch), pixels + (i * pitch), pitch); } free(pixels); // Create an SDL surface from the pixels p_surf = SDL_CreateRGBSurfaceFrom(flipped, width, height, depth, pitch, #if SDL_BYTEORDER == SDL_BIG_ENDIAN 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff #else 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 #endif ); // Save the BMP file if (SDL_SaveBMP(p_surf, pFile)) kprintf(1, "Cannot save screenshot to %s", pFile); SDL_FreeSurface(p_surf); free(flipped); } berusky2-0.12/src/kofola/volume.h0000644000175000017500000000033513674426075013664 00000000000000#ifndef __VOLUME_ #define __VOLUME_ BOOL amdInitialize(HWND hwnd); void amdUninitialize(); BOOL amdGetMasterVolumeControl(); BOOL amdGetMasterVolumeValue(float *dwVal); BOOL amdSetMasterVolumeValue(float dwVal); #endif berusky2-0.12/src/kofola/3D_menus.cpp0000644000175000017500000014336113674766375014406 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.1 //------------------------------------------------------------------------------------------------ #include #include #include #include "font.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_light.h" #include "3D_graphic.h" #include "Object.h" #include "menu_script.h" #include "controls.h" #include "2D_graphic.h" #include "Menu2.h" #include "animationk.h" #include "3D_menus.h" #include "load_level.h" #include "menu_def.h" extern ANIMATION_MODULE am; extern AUDIO_DATA ad; extern _3D_DATA _3dd; extern G_KONFIG ber; extern _3D_CURSOR _3dCur; extern B2_FONT b2_3d_font; extern int cameraflag; HINT_STATE sHint; KUK_STATE sKuk; EDIT_TEXT sIndikace[3]; extern char pBmpDir[MAX_FILENAME]; extern char p3DMDir[MAX_FILENAME]; extern char pDataDir[MAX_FILENAME]; typedef struct { float vfLocation[4]; int iTexture; int iNextFrame; int iTimeToNextFrame; char cCleanDrawLine; float fScale; } _3D_ANIMATION_FRAME; typedef struct __3D_ANIMATION { _3D_ANIMATION_FRAME _3dFrame[32]; int iLastFrame; int iActFrame; int iTimeCounter; char bStop; int iID; int *pFlag; struct __3D_ANIMATION *pNext; struct __3D_ANIMATION *pPrevious; } _3D_ANIMATION; typedef struct __3D_DRAW_LIST { float vfLocation[4]; int iTexture; int iOwnerID; struct __3D_DRAW_LIST *pNext; struct __3D_DRAW_LIST *pPrevious; } _3D_DRAW_LIST; typedef struct { _3D_ANIMATION _3DAnimation[32]; _3D_DRAW_LIST *pFDrawList; _3D_DRAW_LIST *pLDrawList; _3D_ANIMATION *pFAnimation; _3D_ANIMATION *pLAnimation; int iLastID; char bMenuButton; int iMenuButtonID; char bItem; int iInvIndex; int iItemIndex; int iItemID; int iCibuleID; char bLastMenuItem; int iLastMenuItemID; int iLastIsIn; } _3D_ANIMATION_STRUCTURE; _3D_ANIMATION_STRUCTURE _3DAnimationStruct; extern AUDIO_DATA ad; HINT_TEXTURE pHintTexture[26]; HINT_TEXTURE pMessageTexture[8]; #define HINT_SCALE 1.0f //888888888888888888888888888888888888888888 //extern int menu_texture; //888888888888888888888888888888888888888888 void _3d_Stop_Animation(int iID, char cCleanDrawLine); void _3d_RemoveIDFromDrawList(int iID); void _3d_Obsluha_Game_Menu(char *bCursor, int *Cursor_Time_Out, LEVELINFO * p_Level, int demo); void _3d_Start_Settings(void); void _3d_Draw_Hint(void); void _3d_Draw_Indikace(LEVELINFO * p_Level); int gl_Inventory_Item_To_Object(LEVELINFO * p_Level, int Item, char bDec); void _3d_CleanDrawList(void) { _3D_DRAW_LIST *pDrawList = _3DAnimationStruct.pFDrawList; _3D_DRAW_LIST *pNDrawList; if (!pDrawList) return; _3DAnimationStruct.pLDrawList = NULL; while (pDrawList) { pNDrawList = pDrawList->pNext; free((void *) pDrawList); pDrawList = pNDrawList; } _3DAnimationStruct.pFDrawList = NULL; } void _3d_CleanAnimationList(void) { _3D_ANIMATION *pAnim = _3DAnimationStruct.pFAnimation; _3D_ANIMATION *pNAnim; if (!pAnim) return; _3DAnimationStruct.pLAnimation = NULL; while (pAnim) { pNAnim = pAnim->pNext; if (pAnim->pFlag) *pAnim->pFlag = 1; _3d_RemoveIDFromDrawList(pAnim->iID); free((void *) pAnim); pAnim = pNAnim; } _3DAnimationStruct.pFAnimation = NULL; } void _3d_RemoveDrawListItem(_3D_DRAW_LIST * pItem) { if (!pItem->pPrevious) _3DAnimationStruct.pFDrawList = pItem->pNext; else pItem->pPrevious->pNext = pItem->pNext; if (!pItem->pNext) _3DAnimationStruct.pLDrawList = pItem->pPrevious; else pItem->pNext->pPrevious = pItem->pPrevious; free((void *) pItem); } void _3d_AddItemToDrawList(_3D_ANIMATION_FRAME * pFrame, int iOwnerID) { _3D_DRAW_LIST *pLDrawList = _3DAnimationStruct.pLDrawList; _3D_DRAW_LIST *pDrawList = (_3D_DRAW_LIST *) mmalloc(sizeof(_3D_DRAW_LIST)); if (!pLDrawList) { _3DAnimationStruct.pFDrawList = pDrawList; _3DAnimationStruct.pLDrawList = pDrawList; pDrawList->pPrevious = NULL; } else { pDrawList->pPrevious = pLDrawList; pLDrawList->pNext = pDrawList; } // kprintf(1, "%d - pridano do draw listu ....", pFrame->iTexture); pDrawList->iOwnerID = iOwnerID; pDrawList->iTexture = pFrame->iTexture; memcpy((void *) pDrawList->vfLocation, (void *) pFrame->vfLocation, 4 * sizeof(float)); pDrawList->pNext = NULL; _3DAnimationStruct.pLDrawList = pDrawList; } void _3d_RemoveIDFromDrawList(int iID) { _3D_DRAW_LIST *pItem = _3DAnimationStruct.pFDrawList; _3D_DRAW_LIST *pNextItem; while (pItem) { pNextItem = pItem->pNext; if (pItem->iOwnerID == iID) _3d_RemoveDrawListItem(pItem); pItem = pNextItem; } } //------------------------------------------------------------------------------------------------ // provede animaci //------------------------------------------------------------------------------------------------ void _3d_Animation(_3D_ANIMATION * p3DAnim, int iTime) { _3D_ANIMATION_DRAW: if (iTime >= 0) { if (p3DAnim->_3dFrame[p3DAnim->iActFrame].cCleanDrawLine) _3d_RemoveIDFromDrawList(p3DAnim->iID); if (p3DAnim->_3dFrame[p3DAnim->iActFrame].iNextFrame == -1) { p3DAnim->bStop = 1; return; } iTime -= p3DAnim->_3dFrame[p3DAnim->iActFrame].iTimeToNextFrame; p3DAnim->iActFrame = p3DAnim->_3dFrame[p3DAnim->iActFrame].iNextFrame; } while (iTime > 0) { if (p3DAnim->_3dFrame[p3DAnim->iActFrame].iNextFrame == -1) { _3d_AddItemToDrawList(&p3DAnim->_3dFrame[p3DAnim->iActFrame], p3DAnim->iID); p3DAnim->bStop = 1; break; } iTime -= p3DAnim->_3dFrame[p3DAnim->iActFrame].iTimeToNextFrame; if (iTime > (p3DAnim->_3dFrame[p3DAnim->_3dFrame[p3DAnim->iActFrame].iNextFrame].iTimeToNextFrame / 2.0f)) { _3d_AddItemToDrawList(&p3DAnim->_3dFrame[p3DAnim->iActFrame], p3DAnim->iID); p3DAnim->iActFrame = p3DAnim->_3dFrame[p3DAnim->iActFrame].iNextFrame; } else if (!p3DAnim->_3dFrame[p3DAnim->iActFrame].iTimeToNextFrame) break; } iTime = 0; _3d_AddItemToDrawList(&p3DAnim->_3dFrame[p3DAnim->iActFrame], p3DAnim->iID); if (!p3DAnim->_3dFrame[p3DAnim->iActFrame].iTimeToNextFrame) goto _3D_ANIMATION_DRAW; if (p3DAnim->_3dFrame[p3DAnim->iActFrame].iNextFrame == -1) { _3d_AddItemToDrawList(&p3DAnim->_3dFrame[p3DAnim->iActFrame], p3DAnim->iID); p3DAnim->bStop = 1; return; } } int _3d_Start_Animation(int iIndex, float *vfLocation, int *pFlag) { int i; _3D_ANIMATION *pL3DAnim = _3DAnimationStruct.pLAnimation; _3D_ANIMATION *p3DAnim = (_3D_ANIMATION *) mmalloc(sizeof(_3D_ANIMATION)); memcpy((void *) p3DAnim, (void *) &_3DAnimationStruct._3DAnimation[iIndex], sizeof(_3D_ANIMATION)); if (!pL3DAnim) { _3DAnimationStruct.pFAnimation = p3DAnim; _3DAnimationStruct.pLAnimation = p3DAnim; p3DAnim->pPrevious = NULL; } else { p3DAnim->pPrevious = pL3DAnim; pL3DAnim->pNext = p3DAnim; } p3DAnim->bStop = 0; p3DAnim->iID = _3DAnimationStruct.iLastID; _3DAnimationStruct.iLastID++; p3DAnim->iActFrame = 0; p3DAnim->iTimeCounter = 0; p3DAnim->pNext = NULL; p3DAnim->pFlag = pFlag; _3DAnimationStruct.pLAnimation = p3DAnim; if (vfLocation) { for (i = 0; i < p3DAnim->iLastFrame; i++) { memcpy((void *) p3DAnim->_3dFrame[i].vfLocation, (void *) vfLocation, 4 * sizeof(float)); } } _3d_Animation(p3DAnim, -1); return 1; } void _3d_Stop_Animation(int iID, char cCleanDrawLine) { _3D_ANIMATION *p3DAnim = _3DAnimationStruct.pFAnimation; if (!p3DAnim) return; while (p3DAnim) { if (p3DAnim->iID == iID) { if (cCleanDrawLine) _3d_RemoveIDFromDrawList(iID); if (!p3DAnim->pPrevious) _3DAnimationStruct.pFAnimation = p3DAnim->pNext; else p3DAnim->pPrevious->pNext = p3DAnim->pNext; if (!p3DAnim->pNext) _3DAnimationStruct.pLAnimation = p3DAnim->pPrevious; else p3DAnim->pNext->pPrevious = p3DAnim->pPrevious; if (p3DAnim->pFlag) *p3DAnim->pFlag = 1; free((void *) p3DAnim); return; } p3DAnim = p3DAnim->pNext; } } void _3d_Draw_3DAnimations(void) { _3D_DRAW_LIST *pItem = _3DAnimationStruct.pFDrawList; if (!pItem) return; while (pItem) { float p[4]; p[0] = pItem->vfLocation[0] * scale_back_factor_x(); p[1] = pItem->vfLocation[1] * scale_back_factor_y(); p[2] = pItem->vfLocation[2] * scale_back_factor_x(); p[3] = pItem->vfLocation[3] * scale_back_factor_y(); _3d_Draw_Box(pItem->iTexture, p); pItem = pItem->pNext; } } //------------------------------------------------------------------------------------------------ // provede animace //------------------------------------------------------------------------------------------------ void _3d_AnimationEvent(void) { _3D_ANIMATION_STRUCTURE *p3DAnimationStruct = &_3DAnimationStruct; _3D_ANIMATION *p3DAnim = p3DAnimationStruct->pFAnimation; _3D_ANIMATION *p3DNAnim; DWORD e = ber.TimeLastFrame; while (p3DAnim) { p3DAnim->iTimeCounter += e; p3DNAnim = p3DAnim->pNext; if (p3DAnim->bStop) { _3d_Stop_Animation(p3DAnim->iID, p3DAnim->_3dFrame[p3DAnim->iLastFrame - 1].cCleanDrawLine); } else { if (p3DAnim->iTimeCounter > p3DAnim->_3dFrame[p3DAnim->iActFrame].iTimeToNextFrame) { _3d_Animation(p3DAnim, p3DAnim->iTimeCounter); p3DAnim->iTimeCounter = 0; } } p3DAnim = p3DNAnim; } } //------------------------------------------------------------------------------------------------ // naparsuje radek animace //------------------------------------------------------------------------------------------------ void Parse_3DAnimLine(FILE * file, _3D_ANIMATION_FRAME * pFrame) { char text[MAX_FILENAME], expression[MAX_FILENAME]; int p = 0, r = 0; if(!fgets(text, MAX_FILENAME, file)) return; while (p != -1) { p = Find_Next_Expresion(text, p, expression); if (p != -1) switch (r) { case 1: pFrame->iTexture = atoi(expression); break; case 2: case 3: case 4: case 5: pFrame->vfLocation[r - 2] = (float) atof(expression); break; case 6: pFrame->iTimeToNextFrame = atoi(expression); break; case 7: pFrame->iNextFrame = atoi(expression); break; case 8: pFrame->cCleanDrawLine = (char) atoi(expression); break; case 9: pFrame->fScale = (float) atof(expression); break; } r++; } } void _3d_Add_To_OpenMenuAnim(_3D_ANIMATION * p3DAnim) { int i; p3DAnim->_3dFrame[p3DAnim->iLastFrame - 1].iNextFrame = p3DAnim->iLastFrame; for (i = 16; i < 22; i++) { p3DAnim->_3dFrame[p3DAnim->iLastFrame].cCleanDrawLine = 0; p3DAnim->_3dFrame[p3DAnim->iLastFrame].fScale = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].fScale; p3DAnim->_3dFrame[p3DAnim->iLastFrame].iNextFrame = p3DAnim->iLastFrame + 1; p3DAnim->_3dFrame[p3DAnim->iLastFrame].iTexture = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].iTexture; p3DAnim->_3dFrame[p3DAnim->iLastFrame].iTimeToNextFrame = 0; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[0] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[0]; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[1] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[1]; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[2] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[2]; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[3] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[3]; p3DAnim->iLastFrame++; } p3DAnim->_3dFrame[p3DAnim->iLastFrame].cCleanDrawLine = 0; p3DAnim->_3dFrame[p3DAnim->iLastFrame].fScale = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].fScale; p3DAnim->_3dFrame[p3DAnim->iLastFrame].iNextFrame = -1; p3DAnim->_3dFrame[p3DAnim->iLastFrame].iTexture = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].iTexture; p3DAnim->_3dFrame[p3DAnim->iLastFrame].iTimeToNextFrame = 50; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[0] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[0]; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[1] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[1]; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[2] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[2]; p3DAnim->_3dFrame[p3DAnim->iLastFrame].vfLocation[3] = _3DAnimationStruct._3DAnimation[i]._3dFrame[0].vfLocation[3]; p3DAnim->iLastFrame++; } void _3d_Load_Animations(void) { _3D_ANIMATION_FRAME *pFrame; _3D_ANIMATION *p3DAnim; FILE *pFile = NULL, *pListFile = NULL; char text[MAX_FILENAME]; char filename[MAX_FILENAME]; int i = 0, j; construct_path(filename, MAX_FILENAME, 2, pDataDir, "3DAnimations.dat"); pListFile = fopen(filename, "r"); if (pListFile) { while (!feof(pListFile)) { if (!fgets(text, MAX_FILENAME, pListFile) || !text[0]) break; else newline_cut(text); construct_path(filename, MAX_FILENAME, 2, pDataDir, text); pFile = fopen(filename, "r"); if (pFile) { p3DAnim = &_3DAnimationStruct._3DAnimation[i]; j = 0; while (!feof(pFile)) { pFrame = &p3DAnim->_3dFrame[j]; Parse_3DAnimLine(pFile, pFrame); if (i >= 16 && i < 23) { float dx; pFrame->iTexture += MENU_ANIMATION_CORECTION; dx = ((pFrame->vfLocation[2] - pFrame->vfLocation[0]) - (_3dd.p_sysramtexture[pFrame->iTexture].tx * pFrame->fScale)) / 2.0f; pFrame->vfLocation[0] += dx; pFrame->vfLocation[2] = pFrame->vfLocation[0] + (_3dd.p_sysramtexture[pFrame->iTexture].x * pFrame->fScale); pFrame->vfLocation[3] = pFrame->vfLocation[1] + _3dd.p_sysramtexture[pFrame->iTexture].y * pFrame->fScale; } j++; } p3DAnim->bStop = 0; p3DAnim->iActFrame = 0; p3DAnim->iLastFrame = j - 1; p3DAnim->iID = i; i++; fclose(pFile); strcpy(text, ""); } else kprintf(1, "Nenalezen 3danimacni soubor %s", text); } _3d_Add_To_OpenMenuAnim(&_3DAnimationStruct._3DAnimation[14]); fclose(pListFile); } else { kprintf(1, "Nenalezen soubor se seznamem 3d animaci!"); } _3DAnimationStruct.pFDrawList = NULL; _3DAnimationStruct.pLDrawList = NULL; _3DAnimationStruct.pFAnimation = NULL; _3DAnimationStruct.pLAnimation = NULL; _3DAnimationStruct.bMenuButton = 0; _3DAnimationStruct.bItem = 0; _3DAnimationStruct.iItemID = -1; _3DAnimationStruct.iItemIndex = -1; _3DAnimationStruct.iInvIndex = -1; _3DAnimationStruct.iCibuleID = -1; _3DAnimationStruct.bLastMenuItem = 0; _3DAnimationStruct.iLastMenuItemID = -1; _3DAnimationStruct.iLastIsIn = -1; } void _3d_Draw_Item(float *pos, int iBackPack, int iItem, LEVELINFO * p_Level, char bAnimate) { if (p_Level->Actual_Item == -1) return; if (bAnimate) { if (!iBackPack) iBackPack += p_Level->Level[p_Level->Actual_Item]->p_Object->SubClass; else iBackPack += 4; if (_3DAnimationStruct.bItem && _3DAnimationStruct.iItemIndex == iBackPack && _3DAnimationStruct.iInvIndex == iItem) return; else if (_3DAnimationStruct.bItem && (_3DAnimationStruct.iItemIndex != iBackPack || _3DAnimationStruct.iInvIndex != iItem)) _3d_Stop_Animation(_3DAnimationStruct.iItemID, 1); _3d_Start_Animation(iBackPack + 1, pos, NULL); _3DAnimationStruct.iItemID = _3DAnimationStruct.iLastID - 1; _3DAnimationStruct.iItemIndex = iBackPack; _3DAnimationStruct.iInvIndex = iItem; _3DAnimationStruct.bItem = 1; } else switch (iBackPack) { case 0: _3d_Draw_Box(26 + (6 * p_Level->Level[p_Level->Actual_Item]->p_Object->SubClass), pos); break; case 4: _3d_Draw_Box(56, pos); break; case 7: _3d_Draw_Box(68, pos); break; case 8: _3d_Draw_Box(62, pos); break; } } void _3d_Animate_Item(float *pos, int iItem, LEVELINFO * p_Level) { int m = 0; int i; for (i = 0; i < 16; i++) { if (i != 3 && i != 5) m += p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[i]; if (m > iItem) break; } _3d_Draw_Item(pos, i, iItem, p_Level, 1); } //------------------------------------------------------------------------------------------------ // kresli inventorar //------------------------------------------------------------------------------------------------ int _3d_Draw_Invertory(LEVELINFO * p_Level, int act_item, char bCursor) { char bAnimated = 0; float pos[4]; int ret = -1, i, c, m = 0; _3d_Draw_Inventory(); if (p_Level->Actual_Item == -1) return ret; for (i = 0; i < 16; i++) if (i != 3 && i != 5) for (c = 0; c < p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[i]; c++) { switch (m) { case 0: pos[0] = 68 * scale_back_factor_x(); pos[1] = 696 * scale_back_factor_y(); pos[2] = 100 * scale_back_factor_x(); pos[3] = 728 * scale_back_factor_y(); _3d_Draw_Item(pos, i, act_item, p_Level, 0); m++; break; case 1: pos[0] = 114 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 146 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Draw_Item(pos, i, act_item, p_Level, 0); m++; break; case 2: pos[0] = 167 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 199 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Draw_Item(pos, i, act_item, p_Level, 0); m++; break; case 3: pos[0] = 221 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 254 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Draw_Item(pos, i, act_item, p_Level, 0); m++; break; } } m = 0; if (bCursor) { for (i = 0; i < 16; i++) if (i != 3 && i != 5) m += p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->item[i]; if (m > 0) if ((mi.x >= 67 * scale_back_factor_x()) && (mi.x <= 101 * scale_back_factor_x()) && (mi.y >= 696 * scale_back_factor_y()) && (mi.y <= 728 * scale_back_factor_y())) { bAnimated = 1; pos[0] = 68 * scale_back_factor_x(); pos[1] = 696 * scale_back_factor_y(); pos[2] = 100 * scale_back_factor_x(); pos[3] = 728 * scale_back_factor_y(); _3d_Animate_Item(pos, 0, p_Level); if (mi.t1) ret = 0; _3d_Display_Hint_Inventory(p_Level, p_Level->Level[p_Level->Actual_Item], 0, 68, 696); } if (m > 1) if ((mi.x >= 114 * scale_back_factor_x()) && (mi.x <= 146 * scale_back_factor_x()) && (mi.y >= 725 * scale_back_factor_y()) && (mi.y <= 759 * scale_back_factor_y())) { bAnimated = 1; pos[0] = 114 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 146 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Animate_Item(pos, 1, p_Level); if (mi.t1) ret = 1; _3d_Display_Hint_Inventory(p_Level, p_Level->Level[p_Level->Actual_Item], 1, 114, 726); } if (m > 2) if ((mi.x >= 167 * scale_back_factor_x()) && (mi.x <= 199 * scale_back_factor_x()) && (mi.y >= 725 * scale_back_factor_y()) && (mi.y <= 759 * scale_back_factor_y())) { bAnimated = 1; pos[0] = 167 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 199 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Animate_Item(pos, 2, p_Level); if (mi.t1) ret = 2; _3d_Display_Hint_Inventory(p_Level, p_Level->Level[p_Level->Actual_Item], 2, 167, 726); } if (m > 3) if ((mi.x >= 221 * scale_back_factor_x()) && (mi.x <= 254 * scale_back_factor_x()) && (mi.y >= 725 * scale_back_factor_y()) && (mi.y <= 759 * scale_back_factor_y())) { bAnimated = 1; pos[0] = 221 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 254 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Animate_Item(pos, 3, p_Level); if (mi.t1) ret = 3; _3d_Display_Hint_Inventory(p_Level, p_Level->Level[p_Level->Actual_Item], 3, 221, 726); } } else { if (!act_item) { bAnimated = 1; pos[0] = 68 * scale_back_factor_x(); pos[1] = 696 * scale_back_factor_y(); pos[2] = 100 * scale_back_factor_x(); pos[3] = 728 * scale_back_factor_y(); _3d_Animate_Item(pos, 0, p_Level); } if (act_item == 1) { bAnimated = 1; pos[0] = 114 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 146 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Animate_Item(pos, 1, p_Level); } if (act_item == 2) { bAnimated = 1; pos[0] = 167 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 199 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Animate_Item(pos, 2, p_Level); } if (act_item == 3) { bAnimated = 1; pos[0] = 221 * scale_back_factor_x(); pos[1] = 726 * scale_back_factor_y(); pos[2] = 254 * scale_back_factor_x(); pos[3] = 758 * scale_back_factor_y(); _3d_Animate_Item(pos, 3, p_Level); } } if (!bAnimated && _3DAnimationStruct.bItem) { _3DAnimationStruct.bItem = 0; _3d_Stop_Animation(_3DAnimationStruct.iItemID, 1); _3DAnimationStruct.iItemID = -1; _3DAnimationStruct.iItemIndex = -1; sHint.bHint = 0; } return ret; } //------------------------------------------------------------------------------------------------ // spocte vzdalenost dvou bodu //------------------------------------------------------------------------------------------------ float _3d_Count_Distance(float *a, float *b) { return ((float) sqrt((b[0] - a[0]) * (b[0] - a[0]) + (b[1] - a[1]) * (b[1] - a[1]))); } void _3d_Stop_Menu_Select(void) { if (_3DAnimationStruct.bMenuButton) { _3DAnimationStruct.bMenuButton = 0; _3d_Stop_Animation(_3DAnimationStruct.iMenuButtonID, 1); } } int _3d_Check_Menu_Select(char bCursor, LEVELINFO * p_Level) { if (p_Level->bMenuRunning) return 0; if ((mi.x >= 960 * scale_back_factor_x()) && (mi.x <= 1019 * scale_back_factor_x()) && (mi.y >= 95 * scale_back_factor_y()) && (mi.y <= 111 * scale_back_factor_y()) && bCursor) { if (!_3DAnimationStruct.bMenuButton) { _3DAnimationStruct.bMenuButton = 1; _3d_Start_Animation(0, NULL, NULL); _3DAnimationStruct.iMenuButtonID = _3DAnimationStruct.iLastID - 1; } return 1; } else { if (_3DAnimationStruct.bMenuButton) { _3DAnimationStruct.bMenuButton = 0; _3d_Stop_Animation(_3DAnimationStruct.iMenuButtonID, 1); } return 0; } } //------------------------------------------------------------------------------------------------ // zkontroluje, zda je oznacen nejakej brouk //------------------------------------------------------------------------------------------------ int _3d_Check_Beatle_Select(void) { float c[2], m[2]; m[0] = (float) mi.x; m[1] = (float) mi.y; c[0] = 194 * scale_back_factor_x(); c[1] = 57 * scale_back_factor_y(); if (_3d_Count_Distance(c, m) <= 32 * scale_back_factor_x()) return 0; c[0] = 279 * scale_back_factor_x(); c[1] = 58 * scale_back_factor_y(); if (_3d_Count_Distance(c, m) <= 32 * scale_back_factor_x()) return 1; c[0] = 439 * scale_back_factor_x(); c[1] = 88 * scale_back_factor_y(); if (_3d_Count_Distance(c, m) <= 32 * scale_back_factor_x()) return 2; c[0] = 529 * scale_back_factor_x(); c[1] = 89 * scale_back_factor_y(); if (_3d_Count_Distance(c, m) <= 32 * scale_back_factor_x()) return 3; c[0] = 617 * scale_back_factor_x(); c[1] = 88 * scale_back_factor_y(); if (_3d_Count_Distance(c, m) <= 32 * scale_back_factor_x()) return 4; c[0] = 777 * scale_back_factor_x(); c[1] = 74 * scale_back_factor_y(); if (_3d_Count_Distance(c, m) <= 32 * scale_back_factor_x()) return 5; return -1; } int _3d_Is_There_Beetle(int SubClass, LEVELINFO * p_Level) { int i; for (i = 0; i < 6; i++) if (p_Level->Beetle[i] == SubClass) return i; return -1; } int _3d_Is_Selected(int SubClass, LEVELINFO * p_Level) { if (p_Level->Beetle[(int)p_Level->Beetle_Index] == SubClass) return 1; else return 0; } //------------------------------------------------------------------------------------------------ // draws top ledge //------------------------------------------------------------------------------------------------ void _3d_Draw_Top_Ledge(LEVELINFO * p_Level, char bCursor) { float cx, cy; float pos[4]; cx = (float) mi.x + _3dCur.iaddx; cy = (float) mi.y + _3dCur.iaddy; //zluta beruska pos[0] = 162 * scale_back_factor_x(); pos[1] = 25 * scale_back_factor_y(); pos[2] = 226 * scale_back_factor_x(); pos[3] = 89 * scale_back_factor_y(); if (_3d_Is_Selected(0, p_Level)) _3d_Draw_Box(6, pos); else if (_3d_Is_There_Beetle(0, p_Level) == -1) _3d_Draw_Box(4, pos); else _3d_Draw_Box(5, pos); //hneda beruska pos[0] = 247 * scale_back_factor_x(); pos[1] = 26 * scale_back_factor_y(); pos[2] = 311 * scale_back_factor_x(); pos[3] = 90 * scale_back_factor_y(); if (_3d_Is_Selected(1, p_Level)) _3d_Draw_Box(9, pos); else if (_3d_Is_There_Beetle(1, p_Level) == -1) _3d_Draw_Box(7, pos); else _3d_Draw_Box(8, pos); //cervena beruska pos[0] = 407 * scale_back_factor_x(); pos[1] = 56 * scale_back_factor_y(); pos[2] = 471 * scale_back_factor_x(); pos[3] = 120 * scale_back_factor_y(); if (_3d_Is_Selected(2, p_Level)) _3d_Draw_Box(12, pos); else if (_3d_Is_There_Beetle(2, p_Level) == -1) _3d_Draw_Box(10, pos); else _3d_Draw_Box(11, pos); //modra beruska pos[0] = 497 * scale_back_factor_x(); pos[1] = 57 * scale_back_factor_y(); pos[2] = 561 * scale_back_factor_x(); pos[3] = 121 * scale_back_factor_y(); if (_3d_Is_Selected(3, p_Level)) _3d_Draw_Box(15, pos); else if (_3d_Is_There_Beetle(3, p_Level) == -1) _3d_Draw_Box(13, pos); else _3d_Draw_Box(14, pos); //zelena beruska pos[0] = 585 * scale_back_factor_x(); pos[1] = 56 * scale_back_factor_y(); pos[2] = 649 * scale_back_factor_x(); pos[3] = 120 * scale_back_factor_y(); if (_3d_Is_Selected(4, p_Level)) _3d_Draw_Box(18, pos); else if (_3d_Is_There_Beetle(4, p_Level) == -1) _3d_Draw_Box(16, pos); else _3d_Draw_Box(17, pos); //vodomerka beruska pos[0] = 745 * scale_back_factor_x(); pos[1] = 42 * scale_back_factor_y(); pos[2] = 809 * scale_back_factor_x(); pos[3] = 106 * scale_back_factor_y(); if (cx > pos[0] && cx < pos[2] && cy > pos[1] && cy < pos[3] && !p_Level->bMenuRunning) _3d_Draw_Box(21, pos); else _3d_Draw_Box(20, pos); } void _3d_Draw_Top_Ledge(void) { float pos[4]; pos[0] = 0; pos[1] = 0; pos[2] = 1024 * scale_back_factor_x(); pos[3] = 128 * scale_back_factor_y(); _3d_Draw_Box(1, pos); pos[0] = 0; pos[1] = 128 * scale_back_factor_y(); pos[2] = 1024 * scale_back_factor_x(); pos[3] = 192 * scale_back_factor_y(); _3d_Draw_Box(2, pos); pos[0] = 896 * scale_back_factor_x(); pos[1] = 192 * scale_back_factor_y(); pos[2] = 1024 * scale_back_factor_x(); pos[3] = 320 * scale_back_factor_y(); _3d_Draw_Box(3, pos); pos[0] = 960 * scale_back_factor_x(); pos[1] = 320 * scale_back_factor_y(); pos[2] = 1024 * scale_back_factor_x(); pos[3] = 352 * scale_back_factor_y(); _3d_Draw_Box(104, pos); } void _3d_Draw_Inventory(void) { float pos[4]; pos[0] = 0; pos[1] = 704 * scale_back_factor_y(); pos[2] = 256 * scale_back_factor_x(); pos[3] = 768 * scale_back_factor_y(); _3d_Draw_Box(22, pos); pos[0] = 256 * scale_back_factor_x(); pos[1] = 704 * scale_back_factor_y(); pos[2] = 288 * scale_back_factor_x(); pos[3] = 768 * scale_back_factor_y(); _3d_Draw_Box(105, pos); pos[0] = 0; pos[1] = 671 * scale_back_factor_y(); pos[2] = 128 * scale_back_factor_x(); pos[3] = 704 * scale_back_factor_y(); _3d_Draw_Box(23, pos); pos[0] = 128 * scale_back_factor_x(); pos[1] = 671 * scale_back_factor_y(); pos[2] = 160 * scale_back_factor_x(); pos[3] = 704 * scale_back_factor_y(); _3d_Draw_Box(24, pos); pos[0] = 0; pos[1] = 607 * scale_back_factor_y(); pos[2] = 32 * scale_back_factor_x(); pos[3] = 671 * scale_back_factor_y(); _3d_Draw_Box(106, pos); } void _3d_Draw_MenusB(LEVELINFO * p_Level, int act_item, char *bCursor, int bTutor, int bTText, int ty) { float pos[4]; if (p_Level->bTopLedge) { _3d_Draw_Top_Ledge(); _3d_Draw_Top_Ledge(p_Level, *bCursor); } if (p_Level->bInventory) { _3d_Draw_Invertory(p_Level, act_item, *bCursor); } _3d_AnimationEvent(); _3d_Draw_3DAnimations(); if (bTutor) { _3d_Set_Smooth(); pos[0] = 10 * scale_back_factor_x(); pos[1] = 200 * scale_back_factor_y(); pos[2] = 1034 * scale_back_factor_x(); pos[3] = (ty * scale_back_factor_y()); glBindTexture(GL_TEXTURE_2D, bTText); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); _3d_Set_Mask(); } } void _3d_Start_Kuk(void) { sKuk.y = randf() * (640 * scale_back_factor_y()); sKuk.x = (float) SCREEN_XRES; sKuk.bKUK = 1; sKuk.iState = 0; sKuk.Speed = 600.0f; sKuk.dwTCounter = 0; } void _3d_Process_Kuk(void) { float pos[4]; float f = sKuk.Speed * (ber.TimeLastFrame / 1000.0f); switch (sKuk.iState) { case 0: sKuk.x -= f; if (sKuk.x < (SCREEN_XRES - (128 * scale_back_factor_x()))) { sKuk.x = (SCREEN_XRES - (128 * scale_back_factor_x())); sKuk.iState = 1; } break; case 1: sKuk.dwTCounter += ber.TimeLastFrame; if (sKuk.dwTCounter > 1000) sKuk.iState = 2; break; case 2: sKuk.x += f; if (sKuk.x > SCREEN_XRES) { sKuk.bKUK = 0; sKuk.iState = 3; } break; } pos[0] = sKuk.x; pos[1] = sKuk.y; pos[2] = sKuk.x + (128 * scale_back_factor_x()); pos[3] = sKuk.y + (128 * scale_back_factor_y()); //kprintf(1, "%f, %f, %f, %f", pos[0], pos[1], pos[2], pos[3]); glBindTexture(GL_TEXTURE_2D, sKuk.text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); } //------------------------------------------------------------------------------------------------ // draws all 3d menus in game to the surface //------------------------------------------------------------------------------------------------ void _3d_Draw_Menus(char *bCursor, int *Cursor_Time_Out, LEVELINFO * p_Level, int act_item, int *p_Return, int demo) { float pos[4]; if ((mi.dx || mi.dy) && cameraflag == -1) { (*bCursor) = 1; (*Cursor_Time_Out) = 0; mi.dx = 0; mi.dy = 0; } _3d_Begin_Draw(); if (p_Level->bTopLedge) { _3d_Draw_Top_Ledge(); _3d_Draw_Top_Ledge(p_Level, *bCursor); p_Return[1] = _3d_Check_Menu_Select(*bCursor, p_Level); if (p_Return[1]) { (*bCursor) = 1; (*Cursor_Time_Out) = 0; } } if (p_Level->bInventory) { p_Return[0] = _3d_Draw_Invertory(p_Level, act_item, *bCursor); if (p_Level->bMenuRunning == 2 && !p_Level->bRestart && !p_Level->bReturnToMenu) _3d_Obsluha_Game_Menu(bCursor, Cursor_Time_Out, p_Level, demo); _3d_AnimationEvent(); } else p_Return[0] = -1; _3d_Draw_3DAnimations(); _3d_Draw_Indikace(p_Level); if (!sKuk.bKUK) { if (!(rand() % 100000)) _3d_Start_Kuk(); } else if (sKuk.bKUK) _3d_Process_Kuk(); if (sHint.bHint) { _3d_Set_Smooth(); _3d_Draw_Hint(); sHint.dwTCounter += ber.TimeLastFrame; if (sHint.dwTCounter > 5000) sHint.bHint = 0; } if (p_Level->bRestart) { (*bCursor) = 1; (*Cursor_Time_Out) = 0; p_Level->iMessageBoxReturn = _3d_Draw_MessageBox(4); } if (p_Level->bReturnToMenu) { (*bCursor) = 1; (*Cursor_Time_Out) = 0; p_Level->iMessageBoxReturn = _3d_Draw_MessageBox(6); } if (*bCursor) { if (!p_Level->iCursor) { pos[0] = (float) mi.x + _3dCur.iaddx; pos[1] = (float) mi.y + _3dCur.iaddy; pos[2] = (float) mi.x + _3dCur.idx + _3dCur.iaddx; pos[3] = (float) mi.y + _3dCur.idy + _3dCur.iaddy; } else { pos[0] = (float) mi.x; pos[1] = (float) mi.y; pos[2] = (float) mi.x + 32; pos[3] = (float) mi.y + 32; } _3d_Set_Smooth(); _3d_Draw_Box(p_Level->iCursor, pos); } _3d_End_Draw(); flip(); return; } void _3d_Run_Cibule(void) { _3d_Start_Animation(15, NULL, NULL); _3DAnimationStruct.iCibuleID = _3DAnimationStruct.iLastID - 1; } int _3d_Animete_Menu_Item(int iAnimation, int IsInID) { if (mi.t1) { _3d_Stop_Animation(_3DAnimationStruct.iLastMenuItemID, 1); mi.t1 = 0; return 1; } else if (_3DAnimationStruct.bLastMenuItem) { if (_3DAnimationStruct.iLastIsIn == IsInID) return 0; else { _3d_Stop_Animation(_3DAnimationStruct.iLastMenuItemID, 1); _3d_RemoveIDFromDrawList(_3DAnimationStruct.iLastMenuItemID); _3d_Start_Animation(iAnimation, NULL, NULL); _3DAnimationStruct.bLastMenuItem = 1; _3DAnimationStruct.iLastMenuItemID = _3DAnimationStruct.iLastID - 1; return 0; } } else { _3d_Start_Animation(iAnimation, NULL, NULL); _3DAnimationStruct.bLastMenuItem = 1; _3DAnimationStruct.iLastMenuItemID = _3DAnimationStruct.iLastID - 1; return 0; } return 0; } void _3d_Cancel_Menu(LEVELINFO * p_Level) { if (_3DAnimationStruct.bLastMenuItem) { _3d_Stop_Animation(_3DAnimationStruct.iLastMenuItemID, 1); _3DAnimationStruct.iLastMenuItemID = -1; _3DAnimationStruct.bLastMenuItem = 0; } _3d_CleanAnimationList(); _3d_CleanDrawList(); p_Level->bMenuRunning = 0; _3d_Release_From_Video(107); fn_Release_3d_Textures(); p_Level->bInventory = p_Level->bLInventory; p_Level->bTopLedge = p_Level->bLastTopLedge; } void _3d_Cancel_Animations(LEVELINFO * p_Level) { if (_3DAnimationStruct.bLastMenuItem) { _3d_Stop_Animation(_3DAnimationStruct.iLastMenuItemID, 1); _3DAnimationStruct.iLastMenuItemID = -1; _3DAnimationStruct.bLastMenuItem = 0; } _3d_CleanAnimationList(); _3d_CleanDrawList(); } int _3d_HitRect(int iAnimation) { _3D_ANIMATION *p_an = &_3DAnimationStruct._3DAnimation[iAnimation]; if (mi.x > p_an->_3dFrame[0].vfLocation[0] * scale_back_factor_x() && mi.x < p_an->_3dFrame[0].vfLocation[0] * scale_back_factor_x() + (_3dd.p_sysramtexture[p_an->_3dFrame[0].iTexture].tx * scale_back_factor_x() * p_an->_3dFrame[0].fScale) && mi.y > p_an->_3dFrame[0].vfLocation[1] * scale_back_factor_y() && mi.y < p_an->_3dFrame[0].vfLocation[1] * scale_back_factor_y() + (_3dd.p_sysramtexture[p_an->_3dFrame[0].iTexture].ty * scale_back_factor_y() * p_an->_3dFrame[0].fScale)) return 1; else return 0; } void _3d_Obsluha_Game_Menu(char *bCursor, int *Cursor_Time_Out, LEVELINFO * p_Level, int demo) { int bIsIn = 0; (*bCursor) = 1; (*Cursor_Time_Out) = 0; spracuj_spravy(0); if (key[K_ESC]) { key[K_ESC] = 0; _3d_Cancel_Menu(p_Level); return; } //mainmenu if (_3d_HitRect(16)) { bIsIn = 1; if (_3d_Animete_Menu_Item(16, 1)) { float pos[3] = { 0, 0, 0 }; int rnd = rand() % 3; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); p_Level->bReturnToMenu = 1; p_Level->iMessageBoxReturn = -1; p_Level->bCancelMenu = 0; } _3DAnimationStruct.iLastIsIn = 1; return; } //restart level if (_3d_HitRect(17)) { bIsIn = 1; if (_3d_Animete_Menu_Item(17, 2)) { float pos[3] = { 0, 0, 0 }; int rnd = rand() % 3; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); p_Level->bRestart = 1; p_Level->iMessageBoxReturn = -1; p_Level->bCancelMenu = 0; } _3DAnimationStruct.iLastIsIn = 2; return; } //settings if (_3d_HitRect(18)) { bIsIn = 1; if (_3d_Animete_Menu_Item(18, 4)) { int rnd = rand() % 3; float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); RunMenuSettings2("Mmsettings3D.txt", NULL, p_Level, &am); } _3DAnimationStruct.iLastIsIn = 4; return; } //record demo if (_3d_HitRect(19) && !demo) { bIsIn = 1; if (_3d_Animete_Menu_Item(19, 5)) { int rnd = rand() % 3; float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); p_Level->bSaveDemo = 1; _3d_Cancel_Menu(p_Level); } _3DAnimationStruct.iLastIsIn = 5; return; } if (_3d_HitRect(20)) { bIsIn = 1; if (_3d_Animete_Menu_Item(20, 6)) { float pos[3] = { 0, 0, 0 }; int rnd = rand() % 3; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); _3d_Cancel_Menu(p_Level); } _3DAnimationStruct.iLastIsIn = 6; return; } //loadgame if (_3d_HitRect(21) && !demo) { bIsIn = 1; if (_3d_Animete_Menu_Item(21, 7)) { WCHAR cText[128]; float pos[3] = { 0, 0, 0 }; int rnd = rand() % 3; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); ZeroMemory(cText, 128); RunMenuLoadGameLoad2("Mmload_game_load3d.txt", NULL, p_Level, &am, 1, cText); if (wcslen(cText)) { _3d_Cancel_Menu(p_Level); p_Level->Level_Exit = 4; p_Level->lLevel_Exitc = 0; //TODO <----------------------- cText = jmeno levelu na load ZeroMemory(p_Level->cLevelName, 64); lsi_Save_Exist(cText, p_Level->cLevelName); //WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, cText, wcslen(cText), p_Level->cLevelName, 63, NULL, NULL); } } _3DAnimationStruct.iLastIsIn = 7; return; } //savegame if (_3d_HitRect(22) && !demo) { bIsIn = 1; if (_3d_Animete_Menu_Item(22, 8)) { WCHAR cText[128]; float pos[3] = { 0, 0, 0 }; int rnd = rand() % 3; ap_Play_Sound(0,1,0, pos, rnd + 23, NULL, &ad); ZeroMemory(cText, 128); RunMenuLoadGameLoad2("Mmload_game_loads3d.txt", p_Level->p_ad, p_Level, &am, 0, cText); if (wcslen(cText)) lsi_Save_Level(cText, p_Level); } _3DAnimationStruct.iLastIsIn = 8; return; } if (!bIsIn && _3DAnimationStruct.bLastMenuItem) { _3d_Stop_Animation(_3DAnimationStruct.iLastMenuItemID, 1); _3d_RemoveIDFromDrawList(_3DAnimationStruct.iLastMenuItemID); _3DAnimationStruct.iLastMenuItemID = -1; _3DAnimationStruct.bLastMenuItem = 0; } } void _3d_Start_Settings(void) { ddxLoadBitmap("settings.png", pBmpDir); } int _3d_BackPack2Hint(int idx) { switch (idx) { case 0: return 20; case 3: return 21; case 5: return 22; case 4: return 23; case 7: return 24; case 8: return 25; } kprintf(1, "_3d_BackPack2Hint vraci -1"); return -1; } int _3d_Mesh2Hint(LEVELINFO * p_Level, int mesh) { OBJECTDESC *pObj; int i; for (i = 0; i < p_Level->Size_of_Level; i++) if (p_Level->Level[i]) if (p_Level->Level[i]->Index_Of_Game_Mesh == mesh) { pObj = p_Level->Level[i]->p_Object; if (pObj->Class == 2) return 1; if (pObj->Class == 19) return 2; if (pObj->Class == 1) return 3; if (pObj->Class == 4) return 4; if (pObj->Class == 5 && pObj->SubClass == 1) return 5; if (pObj->Class == 5 && !pObj->SubClass) return 6; if (pObj->Class == 5 && pObj->SubClass == 3) return 7; if (pObj->Class == 6 && !pObj->SubClass) return 8; if (pObj->Class == 6 && pObj->SubClass) return 9; if (pObj->Class == 7) return 10; if (pObj->Class == 9 && !pObj->SubClass) return 11; if (pObj->Class == 9 && pObj->SubClass) return 12; if (pObj->Class == 10) return 13; if (pObj->Class == 11 && !pObj->SubClass) return 14; if (pObj->Class == 11 && pObj->SubClass == 1) return 15; if (pObj->Class == 11 && pObj->SubClass == 3) return 16; if (pObj->Class == 12) return 17; if (pObj->Class == 15) return 18; if (pObj->Class == 16) return 19; if (pObj->Class == 13 && !pObj->SubClass) return 20; if (pObj->Class == 13 && pObj->SubClass == 3) return 21; if (pObj->Class == 13 && pObj->SubClass == 5) return 22; if (pObj->Class == 13 && pObj->SubClass == 4) return 23; if (pObj->Class == 13 && pObj->SubClass == 7) return 24; if (pObj->Class == 13 && pObj->SubClass == 8) return 25; kprintf(1, "Nenalezena Trida: Class == %d, Sub == %d", pObj->Class, pObj->SubClass); return -1; } kprintf(1, "Nenalezen Prvek : mesh == %d", mesh); return -1; } void _3d_Draw_Hint(void) { float pos[4]; pos[0] = sHint.x - (6 * scale_back_factor_x()); pos[1] = sHint.y - (6 * scale_back_factor_y()); pos[2] = (sHint.x - (6 * scale_back_factor_x())) + (((pHintTexture[sHint.iHint].tx + 12) * HINT_SCALE) * scale_back_factor_x()); pos[3] = (sHint.y - (6 * scale_back_factor_y())) + (((pHintTexture[sHint.iHint].ty + 12) * HINT_SCALE) * scale_back_factor_y()); glBindTexture(GL_TEXTURE_2D, pHintTexture[0].text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); pos[0] = sHint.x; pos[1] = sHint.y; pos[2] = sHint.x + (pHintTexture[sHint.iHint].x * HINT_SCALE * scale_back_factor_x()); pos[3] = sHint.y + (pHintTexture[sHint.iHint].y * HINT_SCALE * scale_back_factor_y()); glBindTexture(GL_TEXTURE_2D, pHintTexture[sHint.iHint].text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); } void _3d_Display_Hint(LEVELINFO * p_Level) { int iHint; int bmesh = kom_get_mesh_mys(12); if (bmesh == -1) { kprintf(1, "Hint = kom_get_mesh_mys() == -1"); return; } iHint = _3d_Mesh2Hint(p_Level, bmesh); if (iHint == -1) { kprintf(1, "Hint = _3d_Mesh2Hint() == -1"); return; } sHint.iHint = iHint; sHint.x = (float) mi.x + _3dCur.idx + _3dCur.iaddx; sHint.y = (float) mi.y + _3dCur.idy + _3dCur.iaddy; if (sHint.y + (pHintTexture[sHint.iHint].ty * HINT_SCALE * scale_back_factor_y()) > SCREEN_YRES - 25) sHint.y = (float)(SCREEN_YRES - (pHintTexture[sHint.iHint].ty * HINT_SCALE * scale_back_factor_y()) - 25); if (sHint.x + (pHintTexture[sHint.iHint].tx * HINT_SCALE * scale_back_factor_x()) > SCREEN_XRES - 25) sHint.x = (float) (SCREEN_XRES - (pHintTexture[sHint.iHint].tx * HINT_SCALE * scale_back_factor_x()) - 25); sHint.bHint = 1; sHint.dwTCounter = 0; } void _3d_Display_Hint_Inventory(LEVELINFO * p_Level, ITEMDESC * pItem, int idx, int x, int y) { int obj; int iHint; obj = gl_Inventory_Item_To_Object(p_Level, idx, 0); if (obj >= p_Level->Count_Of_Objects) { kprintf(1, "nepodarilo se prelozit index inventoraze na objekt!"); return; } iHint = _3d_BackPack2Hint(p_Level->Object[obj].SubClass); if (iHint == -1) return; sHint.iHint = iHint; sHint.x = x * scale_back_factor_x(); sHint.y = (y - 32) * scale_back_factor_y(); if (sHint.x + (pHintTexture[sHint.iHint].tx * HINT_SCALE * scale_back_factor_x()) > SCREEN_XRES - 25) sHint.x =(float) (SCREEN_XRES - (pHintTexture[sHint.iHint].tx * HINT_SCALE * scale_back_factor_x()) - 25); sHint.bHint = 1; sHint.dwTCounter = 0; } void _3d_Nahraj_Kuk(void) { txt_trida(TEXT_MENU); kom_set_default_text_config(0, 0, 1, 0, 0, 1); txt_nahraj_texturu_z_func(p3DMDir, "brouk1.png", &sKuk.text, 0, 1, NULL, bmp_nahraj); kom_ret_default_text_config(); } void _3d_Release_Kuk(void) { txt_zrus_texturu(&sKuk.text); } void _3d_Draw_Indikace(LEVELINFO * p_Level) { float pos[4]; if (p_Level->bSaveDemo) { pos[0] = 960 * scale_back_factor_x(); pos[1] = 704 * scale_back_factor_y(); pos[2] = 1024 * scale_back_factor_x(); pos[3] = 768 * scale_back_factor_y(); glBindTexture(GL_TEXTURE_2D, sIndikace[0].text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); } if (p_Level->Item_Lock) { pos[0] = 896 * scale_back_factor_x(); pos[1] = 704 * scale_back_factor_y(); pos[2] = 960 * scale_back_factor_x(); pos[3] = 768 * scale_back_factor_y(); glBindTexture(GL_TEXTURE_2D, sIndikace[2].text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); } if (p_Level->Actual_Item == -1) return; if (p_Level->Level[p_Level->Actual_Item]->p_Back_Pack->Strength > 2) { pos[0] = 832 * scale_back_factor_x(); pos[1] = 704 * scale_back_factor_y(); pos[2] = 896 * scale_back_factor_x(); pos[3] = 768 * scale_back_factor_y(); glBindTexture(GL_TEXTURE_2D, sIndikace[1].text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); } } int _3d_Draw_MessageBox(int iMessage) { int ret = 0; float pos[4]; float x = (1024 - (pMessageTexture[iMessage].tx + 12)) / 2.0f; float y = (768 - ((pMessageTexture[iMessage].ty * 3) + 12)) / 2.0f; float dx; float dy; float f; pos[0] = (x - 6) * scale_back_factor_x(); pos[1] = (y - 6) * scale_back_factor_y(); pos[2] = (x - 6) * scale_back_factor_x() + (((pMessageTexture[iMessage].tx + 12) * HINT_SCALE) * scale_back_factor_x()); pos[3] = (y - 6) * scale_back_factor_y() + ((((pMessageTexture[iMessage].ty * 3) + 12) * HINT_SCALE) * scale_back_factor_y()); dx = (pMessageTexture[iMessage].tx + 12) / 2.0f; dy = pMessageTexture[iMessage].ty * 2.0f; glBindTexture(GL_TEXTURE_2D, pHintTexture[0].text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); pos[0] = x * scale_back_factor_x(); pos[1] = y * scale_back_factor_y(); pos[2] = (x + (pMessageTexture[iMessage].x * HINT_SCALE)) * scale_back_factor_x(); pos[3] = (y + (pMessageTexture[iMessage].y * HINT_SCALE)) * scale_back_factor_y(); glBindTexture(GL_TEXTURE_2D, pMessageTexture[iMessage].text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); f = x + dx - pMessageTexture[0].tx - 10; pos[0] = f * scale_back_factor_x(); pos[1] = (y + dy) * scale_back_factor_y(); pos[2] = (f + (pMessageTexture[0].x * HINT_SCALE)) * scale_back_factor_x(); pos[3] = (y + dy + (pMessageTexture[0].y * HINT_SCALE)) * scale_back_factor_y(); ret = -1; if (mi.x >= pos[0] && mi.x <= pos[0] + (pMessageTexture[1].tx * scale_back_factor_x()) && mi.y >= pos[1] && mi.y <= pos[1] + (pMessageTexture[1].ty * scale_back_factor_y())) { glBindTexture(GL_TEXTURE_2D, pMessageTexture[1].text.text); ret = 1; } else glBindTexture(GL_TEXTURE_2D, pMessageTexture[0].text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); f = x + dx + 10; pos[0] = f * scale_back_factor_x(); pos[1] = (y + dy) * scale_back_factor_y(); pos[2] = (f + (pMessageTexture[2].x * HINT_SCALE)) * scale_back_factor_x(); pos[3] = (y + dy + (pMessageTexture[2].y * HINT_SCALE)) * scale_back_factor_y(); if (mi.x >= pos[0] && mi.x <= pos[0] + (pMessageTexture[1].tx * scale_back_factor_x()) && mi.y >= pos[1] && mi.y <= pos[1] + (pMessageTexture[1].ty * scale_back_factor_y())) { glBindTexture(GL_TEXTURE_2D, pMessageTexture[3].text.text); ret = 0; } else glBindTexture(GL_TEXTURE_2D, pMessageTexture[2].text.text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(pos[0], pos[1]); glTexCoord2d(0, 0); glVertex2d(pos[0], pos[3]); glTexCoord2d(1, 1); glVertex2d(pos[2], pos[1]); glTexCoord2d(1, 0); glVertex2d(pos[2], pos[3]); glEnd(); if (key[K_ESC]) { key[K_ESC] = 0; mi.t1 = 1; ret = 0; } if (key[K_ENTER]) { key[K_ENTER] = 0; mi.t1 = 1; ret = 1; } return ret; } berusky2-0.12/src/kofola/game_init.h0000644000175000017500000000040013674426075014302 00000000000000#ifndef _GAMEINIT_ #define _GAMEINIT_ #include #include "audio_plug-in.h" void gi_Init_Sound_Engine(AUDIO_DATA *p_ad); void gi_Release_Sound_Engine(void); //int gi_EnumDisplaySettings(DEVMODE *pdevmode); void gi_Set_Win_Version(void); #endif berusky2-0.12/src/kofola/level_environment.h0000644000175000017500000000120113674426075016101 00000000000000#ifndef __LEVEL_ENVIRONMENT_H__ #define __LEVEL_ENVIRONMENT_H__ typedef struct { char bUsed; int iWeather; unsigned int uiDensity; unsigned int uiIntensity; float fmaxDivergence; float fDist; float fSky; int iReserved[10]; } WEATHERSTRUCT; typedef struct { char bUsed; int EffectID; float fRadius; unsigned int uiDensity; unsigned int uiIntensity; float fSky; float fLowPlane; int iReserved[10]; } NATUREEFFECTSTRUCT; typedef struct { NATUREEFFECTSTRUCT NatureEffect[10]; WEATHERSTRUCT Weather[3]; char cCam[32]; char cEnv[32]; char cAnimEff[32]; int Reserved[92]; } LEVEL_ENVIRONMENT; #endif berusky2-0.12/src/kofola/menu_script.h0000644000175000017500000000211513674426075014703 00000000000000#ifndef __MENU_SCRIPT_ #define __MENU_SCRIPT_ #include "menu_def.h" #define COM_UNKNOWN -1 #define COM_NOCOMMAND 0 #define COM_DRAW 1 #define COM_FLIP 2 #define COM_ONABOVE 3 #define COM_ONCLICK 4 #define COM_RANDOMANIMATION 5 #define COM_RUNLEVEL 6 #define COM_COMICS 7 #define COM_BINDSOUND 8 #define COM_LOADTEXTURES 9 #define COM_INITOPENGL 10 #define COM_RELEASEOPENGL 11 #define COM_RUNANIMATION 12 #define COM_BINDEXITANIMATION 13 #define COM_BINDANIMATION 14 #define COM_CREATEBUTTON 15 #define COM_SETRECT 16 int Find_Next_Expresion(char *p_Command, int start, char *p_Expresion); void Parse_Line(FILE * file, int *result, int res_size, char *comfile1, char *comfile2); void Parse_AnimLine(FILE * file, int *result, int res_size); void Parse_ScenarioLine(FILE * file, int *result, int res_size, char *comfile1, char *comfile2); void Parse_LineT(char *ftext, int *result, int res_size, char *comfile1, char *comfile2); void LoadMenuScript(char *p_File_Name, CMD_LINE * res, int *lastcmd); void LoadAnimationMenuScript(CMD_LINE * res, int i, int *lastanm); #endif berusky2-0.12/src/kofola/game_main.h0000644000175000017500000000016513674426075014273 00000000000000#ifndef __GAME_MAIN__ #define __GAME_MAIN__ // spusti hru int winmain_Game_Run(char *p_Level_Name); #endif berusky2-0.12/src/kofola/load_level.h0000644000175000017500000000145613674426075014470 00000000000000#ifndef __LOAD_ #define __LOAD_ #include "Object.h" // nahraje level int lsi_Load_Level(char *p_Level_Name, LEVELINFO * p_Level); // release levelu void lsi_Release_Level(LEVELINFO * p_Level); // pripoji k predmetum materialy void lsi_Bind_Materials2Items(LEVELINFO * p_Level); void lsi_Make_Screenshot(char *pFile); void lsi_Save_Level(WCHAR * pwc_Level_Name, LEVELINFO * p_Level); int lsi_Load_Saved_Level(char *p_Level_Name, LEVELINFO * p_Level); void lsi_Load_Level_Script(LEVELINFO * p_Level, char *cFile); int lsi_Get_Save_Info(char *p_Level_Name, int *pActLevel, int *pActScene); void lsi_Get_Dir_Name(char *cText, char *cLevel); int lsi_Save_Exist(WCHAR * wName, char *cFile); int lsi_Create_Level_Raw(char *p_Level_Name, BUNKA_LEVELU_DISK ** b_l_d, int *size); #endif berusky2-0.12/src/kofola/profiles.cpp0000644000175000017500000001563113676421436014536 00000000000000#include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #ifdef LINUX #include #include #endif #include "profiles.h" PLAYER_PROFILE pPlayerProfile; void pr_DiscToProfile(PLAYER_PROFILE_DISC * disc, PLAYER_PROFILE * prof) { prof->iVer = disc->iVer; memcpy(prof->cScene, disc->cScene, sizeof(disc->cScene)); memcpy(prof->cMovie, disc->cMovie, sizeof(disc->cMovie)); memcpy(prof->cLevel, disc->cLevel, sizeof(disc->cLevel)); memcpy(prof->Reserved, disc->Reserved, sizeof(disc->Reserved)); wchar_windows_to_linux(disc->cName, PLAYER_NAME_LENGTH, prof->cName); } void pr_ProfileToDisc(PLAYER_PROFILE * prof, PLAYER_PROFILE_DISC * disc) { disc->iVer = prof->iVer; memcpy(disc->cScene, prof->cScene, sizeof(disc->cScene)); memcpy(disc->cMovie, prof->cMovie, sizeof(disc->cMovie)); memcpy(disc->cLevel, prof->cLevel, sizeof(disc->cLevel)); memcpy(disc->Reserved, prof->Reserved, sizeof(disc->Reserved)); wchar_linux_to_windows(prof->cName, PLAYER_NAME_LENGTH, disc->cName); } int pr_GetPlayerName(char *cFile, WCHAR * cName) { FILE *file; PLAYER_PROFILE_DISC Profile; file = fopen(cFile, "rb"); if (!file) return 0; if (!fread(&Profile, sizeof(PLAYER_PROFILE_DISC), 1, file)) { fclose(file); return 0; } if (Profile.iVer != PROFILE_VER) { fclose(file); return 0; } fclose(file); wchar_windows_to_linux(Profile.cName, PLAYER_NAME_LENGTH, cName); return 1; } int pr_FindFreeFileName(char *cFile) { int i = 0; char text[256]; FILE *f = NULL; do { if (snprintf(text, sizeof(text), "%04d.prf", i) >= (int) sizeof(text)) break; f = fopen(text, "r"); if (!f) break; i++; fclose(f); } while (f); strcpy(cFile, text); return i; } // Returns 0 on success, a positive value if the name is a duplicate, // or a negative value if some other error occured. int pr_CreateProfile(WCHAR * cPlayerName) { char cFile[MAX_FILENAME]; FILE *file; PLAYER_PROFILE_DISC Profile; char dir[MAX_FILENAME]; struct dirent **profiles; int n_profiles; ZeroMemory(cFile, sizeof(cFile)); ZeroMemory(&Profile, sizeof(PLAYER_PROFILE_DISC)); strcpy(dir, PROFILE_DIR); if (chdir(dir)) { kprintf(1, "Cannot change directory to %s", dir); return -1; } // Check if this name already exists. file_filter_mask("*.prf"); n_profiles = scandir(".", &profiles, &file_filter, alphasort); if (n_profiles >= 0) { int duplicate = 0; for (int i = 0; i < n_profiles; i++) { WCHAR check_name[PLAYER_NAME_LENGTH] = { 0 }; if (!duplicate && pr_GetPlayerName(profiles[i]->d_name, check_name) && !wcscmp(cPlayerName, check_name)) duplicate = 1; free(profiles[i]); } free(profiles); if (duplicate) return 1; } pr_FindFreeFileName(cFile); if (getcwd(dir, MAX_FILENAME) == NULL) { kprintf(1, "Cannot get current directory"); return -1; } kprintf(1, "pr_CreateProfile adr = %s", dir); file = fopen(cFile, "wb"); if (!file) { kprintf(1, "Nejde vytvorit profil %s", cFile); return -1; } Profile.iVer = PROFILE_VER; wchar_linux_to_windows(cPlayerName, PLAYER_NAME_LENGTH, Profile.cName); //tyto sceny povazovat za zapocate Profile.cScene[0] = 1; //Tutorial Profile.cScene[1] = 1; //Pokoj // ALFA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /*Profile.cScene[2] = 1; Profile.cScene[3] = 1; Profile.cScene[4] = 1; Profile.cScene[5] = 1; Profile.cScene[6] = 1; Profile.cScene[7] = 1; Profile.cScene[8] = 1; Profile.cScene[9] = 1; */ // ALFA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Detska scena Profile.cScene[10] = 1; Profile.cMovie[10] = 1; Profile.cScene[11] = 1; Profile.cMovie[11] = 1; Profile.cScene[12] = 1; Profile.cMovie[12] = 1; /*for(i=0;i<33;i++) Profile.cLevel[i] = 1; */ if (!fwrite(&Profile, sizeof(PLAYER_PROFILE_DISC), 1, file)) { kprintf(1, "!fwrite"); fclose(file); return -1; } fclose(file); memcpy(&pPlayerProfile, &Profile, sizeof(PLAYER_PROFILE_DISC)); WritePrivateProfileString("game", "last_profile", cFile, ini_file); return 0; } int pr_ReadProfile(char *cFileName, PLAYER_PROFILE * pProfile) { PLAYER_PROFILE_DISC disc; char dir[MAX_FILENAME]; FILE *file; ZeroMemory(&disc, sizeof(PLAYER_PROFILE_DISC)); if (chdir(PROFILE_DIR)) return 0; strcpy(dir, cFileName); { char ddir[MAX_FILENAME]; if (getcwd(ddir, MAX_FILENAME) == NULL) return 0; kprintf(1, "pr_ReadProfile adr = %s", ddir); } file = fopen(dir, "rb"); if (!file) return 0; if (!fread(&disc, sizeof(PLAYER_PROFILE_DISC), 1, file)) { fclose(file); return 0; } pr_DiscToProfile(&disc, pProfile); if (pProfile->iVer != PROFILE_VER) { fclose(file); return 0; } fclose(file); WritePrivateProfileString("game", "last_profile", cFileName, ini_file); return 1; } #ifdef LINUX int pr_FindFileToProfile(WCHAR * wName, char *cFile) { struct dirent **namelist; int ret = FALSE; int i; file_filter_mask("*.prf"); int c = scandir(".", &namelist, &file_filter, alphasort); if (c < 0) { return 0; } for(i = 0; i < c; i++) { FILE *file = fopen(namelist[i]->d_name, "rb"); if(file) { PLAYER_PROFILE_DISC tmp; if (fread(&tmp, sizeof(tmp), 1, file) != 1) { fclose(file); return 0; } fclose(file); PLAYER_PROFILE Profile; pr_DiscToProfile(&tmp, &Profile); if(!wcscmp(Profile.cName, wName)) { strcpy(cFile, namelist[i]->d_name); ret = TRUE; break; } } } for(i = 0; i < c; i++) { free(namelist[i]); } free(namelist); return ret; } #endif #ifdef WINDOWS int pr_FindFileToProfile(WCHAR * wName, char *cFile) { PLAYER_PROFILE Profile; FILE *file; long Done, error; struct _finddata_t Data; Done = _findfirst("*.prf",&Data); error = Done; while(error != -1) { if(error != -1) { file = fopen(Data.name, "rb"); if(file) { fread(&Profile, sizeof(PLAYER_PROFILE), 1, file); fclose(file); if(!wcscmp(Profile.cName, wName)) { strcpy(cFile, Data.name); _findclose(Done); return 1; } } error = _findnext(Done,&Data); } } _findclose(Done); return 0; } #endif int pr_SaveProfile(PLAYER_PROFILE * pProfile) { char cFile[MAX_FILENAME]; FILE *file; char dir[MAX_FILENAME]; ZeroMemory(cFile, sizeof(cFile)); strcpy(dir, PROFILE_DIR); if (chdir(dir)) return 0; if (!pr_FindFileToProfile(pProfile->cName, cFile)) return 0; if (getcwd(dir, MAX_FILENAME) == NULL) return 0; kprintf(1, "pr_SaveProfile adr = %s", dir); file = fopen(cFile, "wb"); if (!file) return 0; PLAYER_PROFILE_DISC tmp; pr_ProfileToDisc(pProfile, &tmp); if (!fwrite(&tmp, sizeof(PLAYER_PROFILE_DISC), 1, file)) { fclose(file); return 0; } fclose(file); return 1; } berusky2-0.12/src/kofola/setup.cpp0000644000175000017500000003363113674426075014055 00000000000000#include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Setup.h" SETUP setup; void Save_ini(void) { char text[256]; setup.kvalita_castic = setup.kvalita_casticp = setup.kvalita_casticv; setup.text_detail_light = setup.text_detail; WritePrivateProfileString("game", "camera_type", itoa(setup.camera_type, text, 10), ini_file); WritePrivateProfileString("game", "fullscreen", itoa(setup.fullscreen, text, 10), ini_file); WritePrivateProfileString("game", "ditering", itoa(setup.ditering, text, 10), ini_file); WritePrivateProfileString("game", "ovladani", itoa(setup.ovladani, text, 10), ini_file); WritePrivateProfileString("game", "posouvat_kameru", itoa(setup.posouvat_kameru, text, 10), ini_file); WritePrivateProfileString("game", "mirror_effects", itoa(setup.mirror_effects, text, 10), ini_file); sprintf(text, "%f", setup.p_kamera_alfa); WritePrivateProfileString("game", "p_kamera_alfa", text, ini_file); sprintf(text, "%f", setup.p_kamera_radius); WritePrivateProfileString("game", "p_kamera_radius", text, ini_file); WritePrivateProfileString("game", "cursor", setup.cursor, ini_file); WritePrivateProfileString("game", "camera_intro", itoa(setup.camera_intro, text, 10), ini_file); sprintf(text, "%f", setup.ovladani_rohy_rychlost); WritePrivateProfileString("game", "ovladani_rohy_rychlost", text, ini_file); WritePrivateProfileString("game", "bugs_highlight", itoa(setup.bugs_highlight, text, 10), ini_file); WritePrivateProfileString("game", "items_highlight", itoa(setup.items_highlight, text, 10), ini_file); WritePrivateProfileString("game", "ovladani_rohy", itoa(setup.ovladani_rohy, text, 10), ini_file); WritePrivateProfileString("game", "ovladani_rohy_default", itoa(setup.ovladani_rohy_default, text, 10), ini_file); WritePrivateProfileString("game", "ovladani_rohy_smer", itoa(setup.ovladani_rohy_smer, text, 10), ini_file); WritePrivateProfileString("game", "ovladani_pr_posun", itoa(setup.ovladani_pr_posun, text, 10), ini_file); WritePrivateProfileString("game", "animace_okoli", itoa(setup.animace_okoli, text, 10), ini_file); WritePrivateProfileString("textures", "text_detail_light", itoa(setup.text_detail_light, text, 10), ini_file); WritePrivateProfileString("textures", "text_mip_mapping", itoa(setup.text_mip_mapping, text, 10), ini_file); WritePrivateProfileString("textures", "text_mip_filtr", itoa(setup.text_mip_filtr, text, 10), ini_file); WritePrivateProfileString("textures", "text_ans", itoa(setup.text_ans, text, 10), ini_file); WritePrivateProfileString("textures", "text_ans_level", text, ini_file); sprintf(text, "%f", setup.text_ostrost); WritePrivateProfileString("textures", "text_ostrost", text, ini_file); WritePrivateProfileString("textures", "text_ans_stupen", itoa(setup.text_ans_stupen, text, 10), ini_file); WritePrivateProfileString("soundengine", "channels", itoa(setup.channels, text, 10), ini_file); WritePrivateProfileString("soundengine", "pre_load", itoa(setup.pre_load, text, 10), ini_file); WritePrivateProfileString("soundengine", "soundvolume", itoa(setup.soundvolume, text, 10), ini_file); WritePrivateProfileString("soundengine", "musicvolume", itoa(setup.musicvolume, text, 10), ini_file); WritePrivateProfileString("soundengine", "ambientvolume", itoa(setup.ambientvolume, text, 10), ini_file); WritePrivateProfileString("controls", "move_forward", itoa(setup.key[1], text, 10), ini_file); WritePrivateProfileString("controls", "turn_back", itoa(setup.key[2], text, 10), ini_file); WritePrivateProfileString("controls", "turn_left", itoa(setup.key[3], text, 10), ini_file); WritePrivateProfileString("controls", "turn_right", itoa(setup.key[4], text, 10), ini_file); WritePrivateProfileString("controls", "next_beatle", itoa(setup.key[5], text, 10), ini_file); WritePrivateProfileString("controls", "beatle1", itoa(setup.key[6], text, 10), ini_file); WritePrivateProfileString("controls", "beatle2", itoa(setup.key[7], text, 10), ini_file); WritePrivateProfileString("controls", "beatle3", itoa(setup.key[8], text, 10), ini_file); WritePrivateProfileString("controls", "beatle4", itoa(setup.key[9], text, 10), ini_file); WritePrivateProfileString("controls", "beatle5", itoa(setup.key[10], text, 10), ini_file); WritePrivateProfileString("controls", "camera_rotation", itoa(setup.key[12], text, 10), ini_file); WritePrivateProfileString("controls", "camera_move", itoa(setup.key[13], text, 10), ini_file); WritePrivateProfileString("controls", "camera_zoom_in", itoa(setup.key[14], text, 10), ini_file); WritePrivateProfileString("controls", "camera_zoom_out", itoa(setup.key[15], text, 10), ini_file); WritePrivateProfileString("controls", "camera_fast_turn_left", itoa(setup.key[16], text, 10), ini_file); WritePrivateProfileString("controls", "camera_fast_turn_right", itoa(setup.key[17], text, 10), ini_file); WritePrivateProfileString("controls", "camera_center", itoa(setup.key[18], text, 10), ini_file); WritePrivateProfileString("controls", "menu", itoa(setup.key[20], text, 10), ini_file); WritePrivateProfileString("controls", "restart", itoa(setup.key[21], text, 10), ini_file); WritePrivateProfileString("controls", "item_lock", itoa(setup.key[22], text, 10), ini_file); //WritePrivateProfileString("controls","blow_detonation_pack",itoa(setup.key[23],text,10),ini_file); WritePrivateProfileString("controls", "next_song", itoa(setup.key[23], text, 10), ini_file); WritePrivateProfileString("controls", "disable_inventory", itoa(setup.key[24], text, 10), ini_file); WritePrivateProfileString("controls", "disable_top_ledge", itoa(setup.key[25], text, 10), ini_file); WritePrivateProfileString("controls", "screenshot", itoa(setup.key[26], text, 10), ini_file); WritePrivateProfileString("controls", "visibility", itoa(setup.key[27], text, 10), ini_file); WritePrivateProfileString("controls", "highlight", itoa(setup.key[28], text, 10), ini_file); WritePrivateProfileString("controls", "hint", itoa(setup.key[29], text, 10), ini_file); WritePrivateProfileString("controls", "pause", itoa(setup.key[30], text, 10), ini_file); } void Load_ini(void) { char text[256]; setup.no_sound = GetPrivateProfileInt("game", "no_sound", 0, ini_file); setup.camera_type = GetPrivateProfileInt("game", "camera_type", 0, ini_file); setup.fullscreen = GetPrivateProfileInt("game", "fullscreen", 0, ini_file); setup.ditering = GetPrivateProfileInt("game", "ditering", 0, ini_file); setup.kvalita_castic = GetPrivateProfileInt("game", "kvalita_castic", 0, ini_file); setup.kvalita_casticv = GetPrivateProfileInt("game", "kvalita_casticv", 0, ini_file); setup.kvalita_casticp = GetPrivateProfileInt("game", "kvalita_casticp", 0, ini_file); setup.ovladani = GetPrivateProfileInt("game", "ovladani", 0, ini_file); setup.posouvat_kameru = GetPrivateProfileInt("game", "posouvat_kameru", 0, ini_file); setup.extra_light_vertex = GetPrivateProfileInt("game", "extra_light_vertex", 0, ini_file); setup.mirror_effects = GetPrivateProfileInt("game", "mirror_effects", 0, ini_file); GetPrivateProfileString("game", "p_kamera_alfa", "0.35", text, 256, ini_file); setup.p_kamera_alfa = (float) atof(text); GetPrivateProfileString("game", "p_kamera_radius", "3.0", text, 256, ini_file); setup.p_kamera_radius = (float) atof(text); GetPrivateProfileString("game", "cursor", "cursor", setup.cursor, 32, ini_file); GetPrivateProfileString("game", "ovladani_rohy_rychlost", "0.5", text, 256, ini_file); setup.ovladani_rohy_rychlost = (float) atof(text); setup.bugs_highlight = GetPrivateProfileInt("game", "bugs_highlight", 0, ini_file); setup.items_highlight = GetPrivateProfileInt("game", "items_highlight", 0, ini_file); setup.ovladani_rohy = GetPrivateProfileInt("game", "ovladani_rohy", 0, ini_file); setup.ovladani_rohy_default = GetPrivateProfileInt("game", "ovladani_rohy_default", 0, ini_file); setup.ovladani_rohy_smer = GetPrivateProfileInt("game", "ovladani_rohy_smer", 0, ini_file); setup.ovladani_pr_posun = GetPrivateProfileInt("game", "ovladani_pr_posun", 0, ini_file); setup.animace_okoli = GetPrivateProfileInt("game", "animace_okoli", 1, ini_file); setup.camera_intro = GetPrivateProfileInt("game", "camera_intro", 0, ini_file); setup.text_detail = GetPrivateProfileInt("textures", "text_detail", 0, ini_file); setup.text_detail_light = GetPrivateProfileInt("textures", "text_detail_light", 0, ini_file); setup.text_mip_mapping = GetPrivateProfileInt("textures", "text_mip_mapping", 0, ini_file); setup.text_mip_filtr = GetPrivateProfileInt("textures", "text_mip_filtr", 0, ini_file); setup.text_ans = GetPrivateProfileInt("textures", "text_ans", 0, ini_file); setup.text_ans_stupen = GetPrivateProfileInt("textures", "text_ans_stupen", 0, ini_file); GetPrivateProfileString("textures", "text_ostrost", "1", text, 256, ini_file); setup.text_ostrost = (float) atof(text); setup.channels = GetPrivateProfileInt("soundengine", "channels", 0, ini_file); setup.pre_load = GetPrivateProfileInt("soundengine", "pre_load", 0, ini_file); setup.soundvolume = GetPrivateProfileInt("soundengine", "soundvolume", 0, ini_file); setup.musicvolume = GetPrivateProfileInt("soundengine", "musicvolume", 0, ini_file); setup.ambientvolume = GetPrivateProfileInt("soundengine", "ambientvolume", 0, ini_file); setup.key[0] = -1; setup.key[1] = GetPrivateProfileInt("controls", "move_forward", 0, ini_file); setup.key[2] = GetPrivateProfileInt("controls", "turn_back", 0, ini_file); setup.key[3] = GetPrivateProfileInt("controls", "turn_left", 0, ini_file); setup.key[4] = GetPrivateProfileInt("controls", "turn_right", 0, ini_file); setup.key[5] = GetPrivateProfileInt("controls", "next_beatle", 0, ini_file); setup.key[6] = GetPrivateProfileInt("controls", "beatle1", 0, ini_file); setup.key[7] = GetPrivateProfileInt("controls", "beatle2", 0, ini_file); setup.key[8] = GetPrivateProfileInt("controls", "beatle3", 0, ini_file); setup.key[9] = GetPrivateProfileInt("controls", "beatle4", 0, ini_file); setup.key[10] = GetPrivateProfileInt("controls", "beatle5", 0, ini_file); setup.key[11] = -1; setup.key[12] = GetPrivateProfileInt("controls", "camera_rotation", 0, ini_file); setup.key[13] = GetPrivateProfileInt("controls", "camera_move", 0, ini_file); setup.key[14] = GetPrivateProfileInt("controls", "camera_zoom_in", 0, ini_file); setup.key[15] = GetPrivateProfileInt("controls", "camera_zoom_out", 0, ini_file); setup.key[16] = GetPrivateProfileInt("controls", "camera_fast_turn_left", 0, ini_file); setup.key[17] = GetPrivateProfileInt("controls", "camera_fast_turn_right", 0, ini_file); setup.key[18] = GetPrivateProfileInt("controls", "camera_center", 0, ini_file); setup.key[19] = -1; setup.key[20] = GetPrivateProfileInt("controls", "menu", 0, ini_file); setup.key[21] = GetPrivateProfileInt("controls", "restart", 0, ini_file); setup.key[22] = GetPrivateProfileInt("controls", "item_lock", 0, ini_file); //setup.key[23] = GetPrivateProfileInt("controls", "blow_detonation_pack",0,ini_file); setup.key[23] = GetPrivateProfileInt("controls", "next_song", 0, ini_file); setup.key[24] = GetPrivateProfileInt("controls", "disable_inventory", 0, ini_file); setup.key[25] = GetPrivateProfileInt("controls", "disable_top_ledge", 0, ini_file); setup.key[26] = GetPrivateProfileInt("controls", "screenshot", 0, ini_file); setup.key[27] = GetPrivateProfileInt("controls", "visibility", 0, ini_file); setup.key[28] = GetPrivateProfileInt("controls", "highlight", 0, ini_file); setup.key[29] = GetPrivateProfileInt("controls", "hint", 0, ini_file); setup.key[30] = GetPrivateProfileInt("controls", "pause", 0, ini_file); setup.key[31] = -1; setup.debug_vypisy = GetPrivateProfileInt("debug", "debug_vypisy", 0, ini_file); setup.debug_light = GetPrivateProfileInt("debug", "debug_light", 0, ini_file); setup.debug_fps = GetPrivateProfileInt("debug", "debug_fps", 0, ini_file); setup.debug_draty = GetPrivateProfileInt("debug", "debug_draty", 0, ini_file); setup.debug_kamery = GetPrivateProfileInt("debug", "debug_kamery", 0, ini_file); GetPrivateProfileString("files", "system_material_1", "", setup.sada[0], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_2", "", setup.sada[1], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_3", "", setup.sada[2], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_4", "", setup.sada[3], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_5", "", setup.sada[4], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_6", "", setup.sada[5], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_7", "", setup.sada[6], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_8", "", setup.sada[7], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_9", "", setup.sada[8], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_10", "", setup.sada[9], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_11", "", setup.sada[10], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_12", "", setup.sada[11], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_13", "", setup.sada[12], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_14", "", setup.sada[13], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_15", "", setup.sada[14], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_16", "", setup.sada[15], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_17", "", setup.sada[16], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_18", "", setup.sada[17], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_19", "", setup.sada[18], MAX_FILENAME, ini_file); GetPrivateProfileString("files", "system_material_20", "", setup.sada[19], MAX_FILENAME, ini_file); } berusky2-0.12/src/kofola/Menu2.h0000644000175000017500000000227313674426075013346 00000000000000#ifndef __MENU2_ #define __MENU2_ #include "Object.h" #include "animationk.h" void RunMenuSettings2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); int RunMenuLoadGameLoad2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am, char bLoad, WCHAR * cText); void RunMenuHelp2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); void RunMenuLevelStats2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); void RunMenuTutorial2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); void RunMenuHelp2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); void RunMenuLevelStats2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); void RunMenuTutorial2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am); void RunMenuLoadScreen2(void); void RunMenuLoadScreenRelease(int iCount); void RunMenuLoadScreenInitBar(int iNumOfItems); void RunMenuLoadScreenAddProgress(float fPercent); void RunMenuLoadScreenDrawProgress(int x, int y); #endif berusky2-0.12/src/kofola/Demo.h0000644000175000017500000000476013674426075013247 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.1 //------------------------------------------------------------------------------------------------ #ifndef _DEMO_ #define _DEMO_ #include #include "Bind.h" #include "Di.h" #define DEMO_HIVERSION 1 #define DEMO_LOVERSION 1 typedef struct _DEMOKEYFRAME { char Key; // key, that was pressed long Time; // time to next key struct _DEMOKEYFRAME *p_Next; // pointer to next DEMOKEYFRAME int bOvladaniBerusek1; int pos_o[3]; int pos_n[3]; } DEMOKEYFRAME; typedef struct { DEMOKEYFRAME *p_First; // pointer to first DEMOKEYFRAME DEMOKEYFRAME *p_Last; // pointer to first DEMOKEYFRAME long Frame_Counter; // stores number of created DEMOKEYFRAMEs+1 DWORD Start; // start time DWORD Finish; // finist time TIMER_ID Timer_ID; // Timer ID for next frame int bOvladaniBerusek1; long dwTimeCounter; } DEMOSTRUCTURE; typedef struct { int iHiVer; int iLoVer; WCHAR cPlayerName[32]; WCHAR cFileName[64]; int iDemoID; int bOvladaniBerusek1; char cLevelName[32]; int iLoadedLevel; int iReserved[100]; int iLevel; int iScene; } DEMOFILEHEADER; // init demo saving DEMOKEYFRAME *demo_Init(DEMOSTRUCTURE * p_Demo); // add new demo key frame into the line DEMOKEYFRAME *demo_Create_Frame(DEMOSTRUCTURE * p_Demo); // Release demo key frame line void demo_Release(DEMOSTRUCTURE * p_Demo); // count eplaset time in millisecods DWORD demo_Eplased_Time(DWORD Start, DWORD Finish); // save demo int demo_Save(DEMOSTRUCTURE * p_Demo, char *p_File_Name, char Ovladani, char *cLevelName); // load demo int demo_Load(DEMOSTRUCTURE * p_Demo, char *p_File_Name, char *bOvladani, char *cLevel_Name, char *cLoadedSignature); int demo_Virual2Fuction(int iVirtualKey, CONTROL_KEYS * p_keys); int demo_Fuction2Virtual(int iFunctionKey, CONTROL_KEYS * p_keys); int demo_Create_Sequence(int *pKeyLine, int iKLSize, DEMOKEYFRAME * pFrame, char *pBerusky1, int Rotation, CONTROL_KEYS * p_cont, DEMOSTRUCTURE * pDemo, int *pos_a); int demo_Check_Owner(WCHAR * wPlayer, char *cDemo, WCHAR * wDemoName); int demo_SaveWC(DEMOSTRUCTURE * p_Demo, WCHAR * wcName, char Ovladani, char *cLevelName, char *cLoadSignature); int demo_Exist(WCHAR * wName, char *cFile); void demo_Set_Scene_Level(char *cDemo, int *pScene, int *pLevel); #endif berusky2-0.12/src/kofola/Dda.h0000644000175000017500000000100613674426075013041 00000000000000//------------------------------------------------------------------------------------------------ // 1.0.0 //------------------------------------------------------------------------------------------------ #ifndef __DDA_ #define __DDA_ typedef struct { int x, y, x1, x2, y1, y2; float plus; float realy, realx; int main_axe; } DDA; // prvni krok dda primky void dda_First(DDA * dda); // dalsi krok dda primky int dda_Next(DDA * dda); // krok zpet int dda_Prev(DDA * dda); #endif berusky2-0.12/src/kofola/trigers.h0000644000175000017500000000224713674426075014040 00000000000000#ifndef __TRIGERS_ #define __TRIGERS_ #include "Object.h" #include "grammar.h" typedef struct { COMMAND command[256]; //prikazy int lastcommand; //posledni prikaz int actualcommnad; //aktualne provadeny prekaz } GAME_TRIGER; typedef struct { char StrTable[256][256]; //tabulka retezcu int LastStr; //posledni string GAME_TRIGER *pTriger; //ukazatel na pole trigru int sizeofT; //pocet polozek v poli } TRIGER_STRUCTURE; char trig_Load_Trigers(char *pLevel, char *pFile, TRIGER_STRUCTURE * pTStruct, GRAMMAR * pGr); char trig_Load_Triger(char *pFile, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct); char trig_Check_ifPos_Trigers(TRIGER_STRUCTURE * pTStruct, LEVELINFO * pLevel); int trig_Find_Triger(TRIGER_STRUCTURE * pTStruct, LEVELINFO * pLevel); void trig_Do_Triger_Command(COMMAND * pCommand, int *flag); void trig_Parse_Line(char *pLine, COMMAND * pCommand, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct); void trig_Parse_LineU(WCHAR * pLine, COMMAND * pCommand, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct); #endif berusky2-0.12/src/kofola/animationk.h0000644000175000017500000001575513674426075014523 00000000000000#ifndef __ANIMATION_INCLUDE_ #define __ANIMATION_INCLUDE_ #include "2D_graphic.h" typedef struct { void *pParam; size_ptr iParam[2]; END_FUNKCE pProc; int flag; } ANIM_TRIGER; typedef struct { int flag; RunHandle p_run; int p_matrix; int p_anim; int mesh[8]; char bnext; ANIM_TRIGER tStart[2]; ANIM_TRIGER tTriger[5]; ANIM_TRIGER taMateral[3]; char bconnected; } SIM_ANIMATION; typedef struct { int sim_anim[110]; SIM_ANIMATION *p_animation; int Size_of_Anim; //HWND hWnd; AUDIO_DATA *p_ad; float frame_per_quater; } ANIMATION_MODULE; //init animation module int am_Init(ANIMATION_MODULE * p_am, LEVELINFO * p_Level); // release animation module void am_Release(ANIMATION_MODULE * p_am, LEVELINFO * p_Level); // get animaton status int am_Animation_Status(SIM_ANIMATION * p_animation, ANIMATION_MODULE * p_am); void am_Set_Start_Function(SIM_ANIMATION * p_animation, END_FUNKCE pStartf, size_ptr iParam1, size_ptr iParam2, size_ptr pParam, int index); void am_Set_Triger_Function(SIM_ANIMATION * p_animation, END_FUNKCE pTrigerf, size_ptr iParam1, size_ptr iParam2, size_ptr pParam, int flag, int index); void am_Set_aMaterial_Function(SIM_ANIMATION * p_animation, int i, END_FUNKCE taMateral, size_ptr iParam1, size_ptr iParam2, size_ptr pParam, int flag); void am_Animate_Items(ANIMATION_MODULE * p_am, LEVELINFO * p_Level); void am_Remove_Animate_item(long item, LEVELINFO * p_Level); void am_Remove_Animate_itemB(int iItem, LEVELINFO * p_Level); void am_Add_Animate_Item(long item, LEVELINFO * p_Level); void am_Add_Animate_ItemB(int iItem, LEVELINFO * p_Level); void am_Release_Animate_Items(ANIMATION_MODULE * p_am, LEVELINFO * p_Level); void am_Stop_Beetle_Animations(LEVELINFO * p_Level); void am_Set_aMaterial_Trigers(SIM_ANIMATION * p_animation, ITEMDESC * p_Item, LEVELINFO * p_Level); void am_Animate_Beetles(LEVELINFO * p_Level); void am_Remove_Beetle_Animation(int mesh, LEVELINFO * p_Level); int am_Add_Beetle_Animation(int mesh, LEVELINFO * p_Level, int iRot, char bExeption); void am_Init_Zhave_Castice(LEVELINFO * p_Level); void am_Do_Zhave_castice(LEVELINFO * p_Level); void am_Release_Zhave_castice(SYSTEMZHAVYCHCASTIC * pSystem); void am_Release_Kourove_Castice(SYSTEMKOUROVYCHCASTIC * pSystem); void am_Change_Wind(LEVELINFO * p_Level); void am_Do_Flares(LEVELINFO * p_Level); void am_Do_Lifts(LEVELINFO * p_Level); int am_Kola_na_Vode(float *pos, int VyskaSloupce, int VyskaPadu, int predmet, LEVELINFO * p_Level); void am_Do_Water(LEVELINFO * p_Level); void am_Do_Vodni_Cakanec1(float *pos, int vyska, int Predmet, LEVELINFO * p_Level); void am_Do_Vodni_Cakanec2(float *pos, int VyskaPadu, int predmet, LEVELINFO * p_Level); void am_Do_Lift_VParticles(float *pos, int mesh, LEVELINFO * p_Level); void am_Do_Water_KolaB(LEVELINFO * p_Level); int am_Kola_na_VodeB(float *pos, int Beruska, int mesh, int infinity, LEVELINFO * p_Level); void am_Do_Bubliny_Berusek(LEVELINFO * p_Level); void am_Do_Vybuch_Bublin(int *iPos, float *fPos, LEVELINFO * p_Level); void am_Do_BublVybuchy(LEVELINFO * p_Level); void am_Do_Exit(int Bmesh, int Emesh, LEVELINFO * p_Level); void am_Do_Exit_Efects(LEVELINFO * p_Level); void am_Create_Sparks_To_Exits(LEVELINFO * p_Level); void am_Do_Exit_Sparks(LEVELINFO * p_Level); void am_Do_TelCSparks(LEVELINFO * p_Level); void am_TurnOn_The_Teleport(ITEMDESC * pTel, LEVELINFO * p_Level); void am_TurnOff_The_Teleport(ITEMDESC * pTel, LEVELINFO * p_Level); int am_Create_Rain(LEVELINFO * p_Level, RAINSYSTEM * pRain, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence, float fSky); void am_Do_Rain(RAINSYSTEM * pRain); int am_Create_Snow(LEVELINFO * p_Level, SNOWSYSTEM * pSnow, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence, float fSky); void am_Do_Snow(SNOWSYSTEM * pSnow); int am_Create_Nature_Effect(LEVELINFO * p_Level, int iEffectID, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fSky, float fLowPlane); void am_Do_Nature_Effects(LEVELINFO * p_Level); void am_Create_Water_Effect(LEVELINFO * p_Level); void am_Create_Prizemni_Mlhu(LEVELINFO * p_Level, float fDensity, float fHeight); void am_Start_Animace_Pontonek(LEVELINFO * p_Level); void am_Start_Animaci_Pontonky(ITEMDESC * pItem); void am_Start_Barels(LEVELINFO * p_Level); void am_Do_BarelSparks(LEVELINFO * p_Level); void am_Release_BarelSparks(LEVELINFO * p_Level, ITEMDESC * pBarel); void am_Do_BeatleSmokes(LEVELINFO * p_Level); void am_Obsluha_Koure_Brouku(LEVELINFO * p_Level); void am_Create_Steps_System(LEVELINFO * p_Level); void am_Set_Step(int iFoot, LEVELINFO * p_Level); void am_Release_Steps(LEVELINFO * p_Level); void am_Zero_Step(LEVELINFO * p_Level); void am_Do_Step(size_ptr param, size_ptr param2, size_ptr p_param); void am_Destroy_Steps(ITEMDESC * pItem, LEVELINFO * p_Level); void am_Do_BublSystemE(LEVELINFO * p_Level); void am_Create_BublSystem_Effect1(float *pos, LEVELINFO * p_Level, int iSize); void am_Create_BublSystem_Effect2(float *pos, LEVELINFO * p_Level, int iSize, float yPlane); void am_Do_BublSystemC(LEVELINFO * p_Level); void am_Start_Joint_Animations(void); void am_Create_Street_Light(LEVELINFO * p_Level, int iStart, int iPause, float *pos); void am_Do_Street_Lights(LEVELINFO * p_Level); void am_Do_Street_Lights_Release(LEVELINFO * p_Level); void am_Do_RainB(RAINSYSTEM * pRain); int am_Create_Water_CirclesB(LEVELINFO * p_Level, RAINSYSTEM * pRain, float fRadius, unsigned int uiDensity, unsigned int uiIntensity, float fmaxDivergence, float *rPos); void am_Flip(LEVELINFO * p_Level, ANIMATION_MODULE * p_am, char bAll, RECT_LINE * rline, int rsize, int bTutor, int bTText, int ty); void am_FlipA(LEVELINFO * p_Level, ANIMATION_MODULE * p_am, char bAll, RECT_LINE * rline, int rsize, int bTutor, int bTText, int ty); void am_Start_Gen_Animation(char *cMesh, LEVELINFO * p_Level); void am_Create_Swamp_Light(LEVELINFO * p_Level, int iStart, int iPause, float *pos); void am_Do_Swamp_Lights(LEVELINFO * p_Level); void am_Do_Swamp_Lights_Release(LEVELINFO * p_Level); void am_Gen_Swamp_Lights(LEVELINFO * p_Level, RECT * r); int am_Create_Fairies(LEVELINFO * p_Level, RECT * r); void am_Do_Fairies(LEVELINFO * p_Level); void am_Do_Star_Lights_Release(LEVELINFO * p_Level); void am_Gen_Star_Lights(LEVELINFO * p_Level, float *pos); void am_Do_Star_Lights(LEVELINFO * p_Level); void am_Do_StarFall(LEVELINFO * p_Level); int am_Create_Falling_Stars(LEVELINFO * p_Level, float *r); int am_Create_CandleSystem(float *pos, LEVELINFO * p_Level); void am_Do_CandleSparks(LEVELINFO * p_Level); int am_Create_CandleSmokeSystem(float *pos, LEVELINFO * p_Level); void am_Do_CandleSmoke(LEVELINFO * p_Level); void am_Start_Voda_Kanal(void); void am_Correct_Beetle_Animation(int mesh, LEVELINFO * p_Level, int rot); void am_Set_Beetle_Switching(LEVELINFO * p_Level, int mesh, int bSwitch); void am_Create_Item_Lights(LEVELINFO * p_Level); void am_Start_Voda_Akvarko(void); #endif berusky2-0.12/src/kofola/secure.h0000644000175000017500000000013413674426075013640 00000000000000#ifndef _SECURE__ #define _SECURE__ int Expire(HWND hWnd); int DefCert(HWND hWnd); #endif berusky2-0.12/src/kofola/Menu.h0000644000175000017500000000071713674426075013265 00000000000000#ifndef __MENU_ #define __MENU_ void RunMenu(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu); int RunLevel(HWND hWnd, AUDIO_DATA * p_ad, int cpu, char *lvl, char *env); void GetRunMenuNewGameSceneLoadGame(char *cscene, char *cscenemap, char *csceneanim, char *cscenelevel, int *iLevelStart, int *iNumOfLevels, int *xTV, int *yTV, char *bTutorial, int *xBack, int *yBack); void RunMenuCinemax(void); void RunMenuDrawDemoEndScreen(void); #endif berusky2-0.12/src/kofola/config_types.h0000644000175000017500000000033513674426075015046 00000000000000#ifndef __CONFIG_TYPES_H__ #define __CONFIG_TYPES_H__ /* these are filled in by configure */ typedef int16_t ogg_int16_t; typedef int32_t ogg_int32_t; typedef u_int32_t ogg_uint32_t; typedef int64_t ogg_int64_t; #endif berusky2-0.12/src/kofola/water.cpp0000644000175000017500000002112013674426075014025 00000000000000#include "game_logic.h" #include "water.h" #include "Berusky3d_kofola_interface.h" WATER_STRUCT wsWater; extern LEVELINFO Level; int w_Check_Oclussion(int x, int y, int z) { int real; int xs = x - 1; int ys = y - 1; int i, j, c = 0; if (ys < 0 || ys + 2 > Level.Size[1] || xs < 0 || xs + 2 > Level.Size[0]) return 1; for (i = xs; i < xs + 3; i++) for (j = ys; j < ys + 3; j++) { gl_Logical2Real(i, j, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2) c++; } if (c > 1) return 1; else return 0; } int w_Check_Oclussion_Vertical(int x, int y, int z) { int real; int ys = y - 1; int j, c = 0; if (ys < 0 || ys + 3 > Level.Size[1]) return 1; for (j = ys; j < ys + 3; j++) { gl_Logical2Real(x, j, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2) c++; } if (c > 1) return 1; else return 0; } int w_Check_Oclussion_Horizontal(int x, int y, int z) { int real; int xs = x - 1; int i, c = 0; if (xs < 0 || xs + 3 > Level.Size[0]) return 1; for (i = xs; i < xs + 3; i++) { gl_Logical2Real(i, y, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2) c++; } if (c > 1) return 1; else return 0; } int w_Find_Top(int x, int y, int z) { int real; int i; for (i = y; i < Level.Size[1]; i++) { gl_Logical2Real(x, i, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2 && w_Check_Oclussion(x, i, z)) return i - 1; } return Level.Size[1] - 1; } int w_Find_Bottom(int x, int y, int z) { int real; int i; for (i = y; i >= 0; i--) { gl_Logical2Real(x, i, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2 && w_Check_Oclussion(x, i, z)) return i + 1; } return 0; } int w_Find_Left(int x, int y, int z) { int real; int i; for (i = x; i >= 0; i--) { gl_Logical2Real(i, y, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2 && w_Check_Oclussion(i, y, z)) return i + 1; } return 0; } int w_Find_Right(int x, int y, int z) { int real; int i; for (i = x; i < Level.Size[0]; i++) { gl_Logical2Real(i, y, z + 1, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 2 && w_Check_Oclussion(i, y, z)) return i - 1; } return Level.Size[0] - 1; } float w_Count_Size(WATER_BOUNDARY * pBoundary) { return (pBoundary->Top - pBoundary->Bottom) * (pBoundary->Right - pBoundary->Left); } float w_Count_Aspect_Ratio(WATER_BOUNDARY * pBoundary) { float a, b; a = pBoundary->Top - pBoundary->Bottom; b = pBoundary->Right - pBoundary->Left; if (a > b) return b / a; else return a / b; } void w_Add_Boundary(int Top, int Left, int Bottom, int Right, int Height) { float fTop, fLeft, fBottom, fRight, fHeight; BOD b; WATER_BOUNDARY *pBoundary = wsWater.pFirst; if (Left == -1) return; kom_get_fyz_souradnice(Left, 0, Top, &b); fTop = b.z + 1; fLeft = b.x - 1; kom_get_fyz_souradnice(Right, Height, Bottom, &b); fBottom = b.z - 1; fRight = b.x + 1; fHeight = b.y; while (pBoundary) { if (pBoundary->Top == fTop && pBoundary->Left == fLeft && pBoundary->Bottom == fBottom && pBoundary->Right == fRight && pBoundary->Height == fHeight) return; pBoundary = pBoundary->pNext; } pBoundary = (WATER_BOUNDARY *) malloc(sizeof(WATER_BOUNDARY)); pBoundary->Top = fTop; pBoundary->Left = fLeft; pBoundary->Bottom = fBottom; pBoundary->Right = fRight; pBoundary->Height = fHeight; pBoundary->pNext = NULL; pBoundary->Size = w_Count_Size(pBoundary); pBoundary->AspectRatio = w_Count_Aspect_Ratio(pBoundary); wsWater.iCount++; if (!wsWater.pFirst) { wsWater.pFirst = pBoundary; wsWater.pLast = pBoundary; return; } wsWater.pLast->pNext = pBoundary; wsWater.pLast = pBoundary; } void w_Construct_Boundary(int x, int y, int z) { int Top, Left = -1, Bottom, Right = Level.Size[0] + 1, nLeft, nRight; int i; Top = w_Find_Top(x, y, z); Bottom = w_Find_Bottom(x, y, z); for (i = Bottom; i <= Top; i++) { nLeft = w_Find_Left(x, i, z); nRight = w_Find_Right(x, i, z); if (nLeft > Left) Left = nLeft; if (nRight < Right) Right = nRight; } w_Add_Boundary(Top, Left, Bottom, Right, z); } void w_Create_Water_Boundaries(void) { int real; int i, j, k; wsWater.iCount = 0; wsWater.pFirst = NULL; wsWater.pLast = NULL; for (i = 0; i < Level.Size[2]; i += 2) for (j = 0; j < Level.Size[0]; j++) for (k = 0; k < Level.Size[1]; k++) { gl_Logical2Real(j, k, i, &real, &Level); if (Level.Level[real]) if (Level.Level[real]->p_Object->Class == 12) w_Construct_Boundary(j, k, i); } return; } void w_Release_Water_Boundaries(void) { WATER_BOUNDARY *pBoundary = wsWater.pFirst; WATER_BOUNDARY *pLBoundary; while (pBoundary) { pLBoundary = pBoundary; pBoundary = pBoundary->pNext; kprintf(1, "free((void *) pLBoundary)"); free((void *) pLBoundary); } wsWater.iCount = 0; wsWater.pFirst = NULL; wsWater.pLast = NULL; } void w_Choose_Random_Boundary(WATER_BOUNDARY * pBoundary, float fx, float fy, float fz) { int iBoundary; int iCount = 0; WATER_BOUNDARY *pTBoundary = wsWater.pFirst; while (pTBoundary) { if (fx >= pTBoundary->Left && fx <= pTBoundary->Right && fy >= pTBoundary->Bottom && fy <= pTBoundary->Top && fz >= pTBoundary->Height - 0.25f && fz <= pTBoundary->Height + 0.25f) iCount++; pTBoundary = pTBoundary->pNext; } if (!iCount) return; iBoundary = rand() % iCount; iCount = 0; pTBoundary = wsWater.pFirst; while (pTBoundary) { if (iCount == iBoundary) { pBoundary->Bottom = pTBoundary->Bottom; pBoundary->Top = pTBoundary->Top; pBoundary->Right = pTBoundary->Right; pBoundary->Left = pTBoundary->Left; return; } iCount++; pTBoundary = pTBoundary->pNext; } } void w_Choose_Max_Size_Boundary(WATER_BOUNDARY * pBoundary, float fx, float fy, float fz) { int iBoundary = -1; int iCount = 0; float max_size = 0; WATER_BOUNDARY *pTBoundary = wsWater.pFirst; while (pTBoundary) { if (fx >= pTBoundary->Left && fx <= pTBoundary->Right && fy >= pTBoundary->Bottom && fy <= pTBoundary->Top && fz >= pTBoundary->Height - 0.25f && fz <= pTBoundary->Height + 0.25f && pTBoundary->Size > max_size) { iBoundary = iCount; max_size = pTBoundary->Size; } iCount++; pTBoundary = pTBoundary->pNext; } if (!iCount) return; iCount = 0; pTBoundary = wsWater.pFirst; while (pTBoundary) { if (iCount == iBoundary) { pBoundary->Bottom = pTBoundary->Bottom; pBoundary->Top = pTBoundary->Top; pBoundary->Right = pTBoundary->Right; pBoundary->Left = pTBoundary->Left; return; } iCount++; pTBoundary = pTBoundary->pNext; } } void w_Choose_Size_Heuristics_Boundary(WATER_BOUNDARY * pBoundary, float fx, float fy, float fz) { int iBoundary = -1; int iCount = 0; float max_size = 0; WATER_BOUNDARY *pTBoundary = wsWater.pFirst; while (pTBoundary) { if (fx >= pTBoundary->Left && fx <= pTBoundary->Right && fy >= pTBoundary->Bottom && fy <= pTBoundary->Top && fz >= pTBoundary->Height - 0.25f && fz <= pTBoundary->Height + 0.25f && pTBoundary->Size * pTBoundary->AspectRatio > max_size) { iBoundary = iCount; max_size = pTBoundary->Size * pTBoundary->AspectRatio; } iCount++; pTBoundary = pTBoundary->pNext; } if (!iCount) return; iCount = 0; pTBoundary = wsWater.pFirst; while (pTBoundary) { if (iCount == iBoundary) { pBoundary->Bottom = pTBoundary->Bottom; pBoundary->Top = pTBoundary->Top; pBoundary->Right = pTBoundary->Right; pBoundary->Left = pTBoundary->Left; return; } iCount++; pTBoundary = pTBoundary->pNext; } } void w_Choose_Best_Boundary(WATER_BOUNDARY * pBoundary, float fx, float fy, float fz, int Method) { switch (Method) { case WATER_BOUNDARY_METHOD_RANDOM: w_Choose_Random_Boundary(pBoundary, fx, fy, fz); break; case WATER_BOUNDARY_METHOD_MAX_SIZE: w_Choose_Max_Size_Boundary(pBoundary, fx, fy, fz); break; case WATER_BOUNDARY_METHOD_SIZE_HEURISTICS: w_Choose_Size_Heuristics_Boundary(pBoundary, fx, fy, fz); break; } } berusky2-0.12/src/kofola/Bind.cpp0000644000175000017500000001137613674426075013573 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include "3d_all.h" #include "Bind.h" //------------------------------------------------------------------------------------------------ // nabinduje klavesy //------------------------------------------------------------------------------------------------ void Bind_Keys(CONTROL_KEYS * p_keys) { p_keys->camera_fast_turn_left = GetPrivateProfileInt("controls", "camera_fast_turn_left", 255, ini_file); p_keys->camera_fast_turn_right = GetPrivateProfileInt("controls", "camera_fast_turn_right", 255, ini_file); p_keys->camera_move_back = GetPrivateProfileInt("controls", "camera_move_back", 255, ini_file); p_keys->camera_move_forward = GetPrivateProfileInt("controls", "camera_move_forward", 255, ini_file); p_keys->camera_move_left = GetPrivateProfileInt("controls", "camera_move_left", 255, ini_file); p_keys->camera_move_right = GetPrivateProfileInt("controls", "camera_move_right", 255, ini_file); p_keys->camera_turn_down = GetPrivateProfileInt("controls", "camera_turn_down", 255, ini_file); p_keys->camera_turn_left = GetPrivateProfileInt("controls", "camera_turn_left", 255, ini_file); p_keys->camera_turn_right = GetPrivateProfileInt("controls", "camera_turn_right", 255, ini_file); p_keys->camera_turn_up = GetPrivateProfileInt("controls", "camera_turn_up", 255, ini_file); p_keys->camera_zoom_in = GetPrivateProfileInt("controls", "camera_zoom_in", 255, ini_file); p_keys->camera_zoom_out = GetPrivateProfileInt("controls", "camera_zoom_out", 255, ini_file); p_keys->camera_center = GetPrivateProfileInt("controls", "camera_center", 255, ini_file); p_keys->inventory = GetPrivateProfileInt("controls", "inventory", 255, ini_file); p_keys->inventory_cancel = GetPrivateProfileInt("controls", "inventory_cancel", 255, ini_file); p_keys->inventory_left = GetPrivateProfileInt("controls", "inventory_left", 255, ini_file); p_keys->inventory_right = GetPrivateProfileInt("controls", "inventory_right", 255, ini_file); p_keys->inventory_select = GetPrivateProfileInt("controls", "inventory_select", 255, ini_file); p_keys->menu = GetPrivateProfileInt("controls", "menu", 255, ini_file); p_keys->move_forward = GetPrivateProfileInt("controls", "move_forward", 255, ini_file); p_keys->next_beatle = GetPrivateProfileInt("controls", "next_beatle", 255, ini_file); p_keys->turn_back = GetPrivateProfileInt("controls", "turn_back", 255, ini_file); p_keys->turn_left = GetPrivateProfileInt("controls", "turn_left", 255, ini_file); p_keys->turn_right = GetPrivateProfileInt("controls", "turn_right", 255, ini_file); p_keys->item_lock = GetPrivateProfileInt("controls", "item_lock", 255, ini_file); p_keys->blow_detonation_pack = GetPrivateProfileInt("controls", "blow_detonation_pack", 255, ini_file); p_keys->beatle1 = GetPrivateProfileInt("controls", "beatle1", 255, ini_file); p_keys->beatle2 = GetPrivateProfileInt("controls", "beatle2", 255, ini_file); p_keys->beatle3 = GetPrivateProfileInt("controls", "beatle3", 255, ini_file); p_keys->beatle4 = GetPrivateProfileInt("controls", "beatle4", 255, ini_file); p_keys->beatle5 = GetPrivateProfileInt("controls", "beatle5", 255, ini_file); p_keys->beatle6 = GetPrivateProfileInt("controls", "beatle6", 255, ini_file); p_keys->item1 = GetPrivateProfileInt("controls", "item1", 255, ini_file); p_keys->item2 = GetPrivateProfileInt("controls", "item2", 255, ini_file); p_keys->item3 = GetPrivateProfileInt("controls", "item3", 255, ini_file); p_keys->item4 = GetPrivateProfileInt("controls", "item4", 255, ini_file); p_keys->next_song = GetPrivateProfileInt("controls", "next_song", 255, ini_file); p_keys->disable_inventory = GetPrivateProfileInt("controls", "disable_inventory", 255, ini_file); p_keys->disable_top_ledge = GetPrivateProfileInt("controls", "disable_top_ledge", 255, ini_file); p_keys->screenshot = GetPrivateProfileInt("controls", "screenshot", 255, ini_file); p_keys->visibility = GetPrivateProfileInt("controls", "visibility", 255, ini_file); p_keys->hint = GetPrivateProfileInt("controls", "hint", 255, ini_file); p_keys->camera_move = GetPrivateProfileInt("controls", "camera_move", 255, ini_file); p_keys->camera_rotation = GetPrivateProfileInt("controls", "camera_rotation", 255, ini_file); p_keys->restart = GetPrivateProfileInt("controls", "restart", 255, ini_file); p_keys->highlight = GetPrivateProfileInt("controls", "highlight", 255, ini_file); p_keys->pause = GetPrivateProfileInt("controls", "pause", 255, ini_file); } berusky2-0.12/src/kofola/font3d.h0000644000175000017500000000353113674426075013553 00000000000000//------------------------------------------------------------------------------------------------ // 1.0.0 //------------------------------------------------------------------------------------------------ #ifndef __FONT_ #define __FONT_ #include #include "trigers.h" #include "3D_graphic.h" #include "3d_all.h" #include "Berusky_universal.h" #define FONT_MAX_BMP 16 typedef struct _B2_FONT { int iBitmap[FONT_MAX_BMP]; char dir[FILENAME_MAX]; GRAMMAR gr; TRIGER_STRUCTURE ts; GAME_TRIGER gt; EDIT_TEXT tex[FONT_MAX_BMP]; EDIT_TEXT_KONFIG konf[FONT_MAX_BMP]; WCHAR *pTBuffer; FILE *file; COLORREF tcolor; int iYPlus; int iXPlus; int *pTTable; int iMaxCharValue; } B2_FONT; int fn2_Set_Font(char *cDir); void fn2_Release_Font(void); void fn2_Release_3d_Textures_Full(void); void fn2_Release_3d_Textures(void); void fn2_Release_3d_Textures_RAM(void); void fn2_Load_Textures_From_RAM(void); int fn2_Load_Bitmaps(void); void fn2_Test(int hdc); void fn2_Test2(int hdc); void fn2_Texture(int iSection); HDC fn2_CreateDC(HDC hdc, int x, int y, int _2dd_idx); int fn2_Gen_Menu(void); int fn2_Gen_Menu_Text(int iSection, int hdc, char *cText, int *i1, int *i2); void fn2_Convert_Rect(char *cFile, int xmax, int ymax); void fn2_Draw_Draw_Frames(void); void fn2_Draw_Message(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXmax, int *iYmax); void fn2_Draw_MessageA(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cText, int iSection, int *iXmax, int *iYmax); void fn2_Draw_MessageRECT(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXmax, int *iYmax, RECT * pR); //int fn2_DC2Tex(HDC hdc, int xr, int yr, int turn, int texture); #endif berusky2-0.12/src/kofola/3d_math.cpp0000644000175000017500000000643613674426075014237 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------------------------ // Make normal 3D vector (axe Y is static) //------------------------------------------------------------------------------------------------ void Normal_Vector(float *Vector, float *vResult) { vResult[0] = -1 * Vector[2]; vResult[1] = Vector[1]; vResult[2] = Vector[0]; } //------------------------------------------------------------------------------------------------ // Calculate inverse vector //------------------------------------------------------------------------------------------------ void Inverse_Vector(float *Vector, float *vResult, unsigned int uiDimension) { unsigned int i; for (i = 0; i < uiDimension; i++) vResult[i] = Vector[i] * -1; } //------------------------------------------------------------------------------------------------ // Calculate length of 3D vector //------------------------------------------------------------------------------------------------ float Vector_Length(float *Vector) { return (float) sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1] + Vector[2] * Vector[2]); } //------------------------------------------------------------------------------------------------ // Normalize 3D vector //------------------------------------------------------------------------------------------------ float Normalize_Vector(float *Vector) { float size = Vector_Length(Vector); if (size == 0) return 0.0f; Vector[0] /= size; Vector[1] /= size; Vector[2] /= size; return size; } //------------------------------------------------------------------------------------------------ // Add two 3D vectors //------------------------------------------------------------------------------------------------ void Add_Vector(float *Vector1, float *Vector2, float *vResult) { vResult[0] = Vector1[0] + Vector2[0]; vResult[1] = Vector1[1] + Vector2[1]; vResult[2] = Vector1[2] + Vector2[2]; } //------------------------------------------------------------------------------------------------ // Sub two 3D vectors //------------------------------------------------------------------------------------------------ void Sub_Vector(float *Vector1, float *Vector2, float *vResult) { vResult[0] = Vector1[0] - Vector2[0]; vResult[1] = Vector1[1] - Vector2[1]; vResult[2] = Vector1[2] - Vector2[2]; } //------------------------------------------------------------------------------------------------ // Multiple 3D vector with constant //------------------------------------------------------------------------------------------------ void Multiple_Vector(float *Vector, float Const) { Vector[0] *= Const; Vector[1] *= Const; Vector[2] *= Const; } //------------------------------------------------------------------------------------------------ // Make 3D vector //------------------------------------------------------------------------------------------------ void Make_Vector(float *Point1, float *Point2, float *vResult) { vResult[0] = Point2[0] - Point1[0]; vResult[1] = Point2[1] - Point1[1]; vResult[2] = Point2[2] - Point1[2]; } berusky2-0.12/src/kofola/square_cut.h0000644000175000017500000000047013674426075014530 00000000000000#ifndef __SQUARE_CUT_ #define __SQUARE_CUT_ typedef struct { int top; int bottom; int left; int right; } SQUARE; typedef struct { char vertikal; char horizontal; } OHODNOCENI; void OrezCtverec(SQUARE * pCtverec, SQUARE * pOblast); char OhodnotCtverec(SQUARE * pCtverec, SQUARE * pOblast); #endif berusky2-0.12/src/kofola/audio_plug-in.h0000644000175000017500000000407113674426075015112 00000000000000#ifndef _AUDIOPLUGIN_ #define _AUDIOPLUGIN_ #include #ifdef __cplusplus extern "C" { #endif // __cplusplus typedef struct { char Song_Name[30]; } PLAY_LIST_ITEM; typedef struct { int32_t Obstruction; float ObstructionLF; } MATERIAL_LIST_ITEM; typedef struct { int Source; char flag; } _SOURCE; typedef struct { long Obstruction; float ObstructionLF; long wall_occlusion; float wall_occlusionLF; float wall_occlusion_room; long out_room; long out_roomHF; float out_room_rolloff; float out_air_absorbtion; } EAX_DATA; typedef struct { char bAudio; float Music_Gain; float Sound_Gain; float Ambient_Gain; PLAY_LIST_ITEM *p_Play_List; MATERIAL_LIST_ITEM *p_Material; int Size_of_Play_List; int Size_of_Material_List; int Max_Sources; _SOURCE *p_Source; EAX_DATA Eax; //HWND hWnd; } AUDIO_DATA; // Init void ap_Init(AUDIO_DATA * p_ad); // Release void ap_Release(AUDIO_DATA * p_ad); // loades play list int ap_Load_Play_List(char *p_File_Name, AUDIO_DATA * p_ad); // Releases play list void ap_Release_Play_List(AUDIO_DATA * p_ad); // playes ogg song int ap_Play_Song(int Index, char Random, AUDIO_DATA * p_ad); int ap_Setup_and_Play_Song(int Index, char Random, AUDIO_DATA * p_ad); // stops ogg song void ap_Stop_Song(AUDIO_DATA * p_ad); // Plays sound int ap_Play_Sound(int Type, char Relative, char bAmbient, float *p_Pos, int Wave_Index, EAX_DATA * p_eax, AUDIO_DATA * p_ad); // Releases materail list void ap_Release_Material_List(AUDIO_DATA * p_ad); // loades material list int ap_Load_Material_List(char *p_File_Name, AUDIO_DATA * p_ad); // count environment void ap_Count_Environment(AUDIO_DATA * p_ad, void *p_Level); // load environment int ap_Load_Environment(char *p_Env_Name, void *p_Level, AUDIO_DATA * p_ad); int ap_Load_Sound_List(AUDIO_DATA * p_ad, char *cFile, int iStart); #ifdef __cplusplus } #endif // __cplusplus #endif berusky2-0.12/src/kofola/Comics.cpp0000644000175000017500000001473613674426075014137 00000000000000#include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "menu_script.h" #include "2D_graphic.h" #include "game_init.h" typedef struct { int iPicture; int iTimeToNextPicture; int xPos; int yPos; } COMICS_PICTURE; #define DARKEN_ADD -200 static char bCimicsEnd; static int iActualBmp; static TIMER_ID uiTimerID; static COMICS_PICTURE cmcs_Picture[64]; /*static MCI_DGV_OPEN_PARMS mciOpen; static MCI_DGV_WINDOW_PARMS mciWindow; static DWORD wDeviceID = 0; static DWORD wError;*/ extern char pBmpDir[MAX_FILENAME]; void cmcs_Draw(int iIndex, int xPos, int yPos) { /* BitBlt(_2dd.hDC, xPos, yPos, _2dd.bitmap[iIndex].bitmap.bmWidth, _2dd.bitmap[iIndex].bitmap.bmHeight, _2dd.bitmap[iIndex].bitmapDC,0,0,SRCCOPY); */ } void cmcs_Read_Line(char *pLine, COMICS_PICTURE * pPicture) { int p = 0; char expression[MAX_FILENAME]; p = Find_Next_Expresion(pLine, p, expression); pPicture->xPos = atoi(expression); p = Find_Next_Expresion(pLine, p, expression); pPicture->yPos = atoi(expression); p = Find_Next_Expresion(pLine, p, expression); pPicture->iTimeToNextPicture = atoi(expression); } void cmcs_Next_Picture(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { COMICS_PICTURE *pPicture = &cmcs_Picture[iActualBmp]; KillTimer(NULL, uiTimerID); if (pPicture->iPicture == -1) { bCimicsEnd = 1; return; } if (!pPicture->iTimeToNextPicture) { cmcs_Draw(pPicture->iPicture, pPicture->xPos, pPicture->yPos); iActualBmp++; pPicture = &cmcs_Picture[iActualBmp]; } cmcs_Draw(pPicture->iPicture, pPicture->xPos, pPicture->yPos); uiTimerID = SetTimer(NULL, 0, pPicture->iTimeToNextPicture, (TIMERPROC) cmcs_Next_Picture); iActualBmp++; } void cmcs_Start_Comics(char *cFile, HWND hWnd, AUDIO_DATA * p_ad, char bMusic) { int i; char text[MAX_FILENAME] = ""; FILE *file; bCimicsEnd = 0; iActualBmp = 0; file = fopen(cFile, "r"); if (!file) return; for (i = 0; i < 64; i++) cmcs_Picture[i].iPicture = -1; while (strcmp(text, "LOAD_END")) { if (fgets(text, MAX_FILENAME, file) == NULL) return; newline_cut(text); if (!strcmp(text, "LOAD_END")) break; i = ddxLoadBitmap(text, pBmpDir); } i = 0; while (strcmp(text, "COMICS_END")) { if (fgets(text, MAX_FILENAME, file) == NULL) return; newline_cut(text); cmcs_Read_Line(text, &cmcs_Picture[i]); cmcs_Picture[i].iPicture = i + 1; i++; } fclose(file); if(bMusic) if (p_ad->bAudio && p_ad->Music_Gain >= 0.05f) ap_Setup_and_Play_Song(1,0, p_ad); cmcs_Draw(0, 0, 0); cmcs_Draw(cmcs_Picture[0].iPicture, cmcs_Picture[0].xPos, cmcs_Picture[0].yPos); uiTimerID = SetTimer(NULL, 0, (UINT) cmcs_Picture[0].iTimeToNextPicture, (TIMERPROC) cmcs_Next_Picture); iActualBmp++; while (!bCimicsEnd) { spracuj_spravy(0); if (key[K_ESC]) { key[K_ESC] = 0; bCimicsEnd = 1; } Sleep(10); } if(bMusic) if(ogg_playing()) ap_Stop_Song(p_ad); KillTimer(NULL, uiTimerID); // TODO // _2D_Release() } void cmcs_Play_Intro(char *cFile, HWND hWnd, AUDIO_DATA * p_ad) { if (chdir(DATA_DIR)) return; cmcs_Start_Comics("gamelogo.txt", hWnd, p_ad, 0); } /*DWORD cmcs_Play_Movie(DWORD wDevID, DWORD dwFrom, DWORD dwTo) { MCI_DGV_PLAY_PARMS mciPlay; // play parameters DWORD dwFlags = 0; // Check dwFrom. If it is != 0 then set parameters and flags. if (dwFrom){ mciPlay.dwFrom = dwFrom; // set parameter dwFlags |= MCI_FROM; // set flag to validate member } // Check dwTo. If it is != 0 then set parameters and flags. if (dwTo){ mciPlay.dwTo = dwTo; // set parameter dwFlags |= MCI_TO; // set flag to validate member } // Send the MCI_PLAY command and return the result. return mciSendCommand(wDevID, MCI_PLAY, dwFlags, (DWORD)(LPVOID)&mciPlay); } */ /*void cmcs_Stop_Video(void) { mciSendCommand(wDeviceID, MCI_STOP, 0, 0); mciSendCommand(wDeviceID, MCI_CLOSE, 0, 0); }*/ void cmcs_Game_Down(void) { /* ShowCursor(FALSE); spracuj_spravy(0); ShowWindow(hWnd,SW_SHOW); spracuj_spravy(0); SetForegroundWindow(hWnd); spracuj_spravy(0); SetFocus(hWnd); spracuj_spravy(0); mciSendString("open digitalvideo", NULL, 0, NULL); */ } void cmcs_Game_Up(void) { /* mciSendString("close digitalvideo", NULL, 0, NULL); ShowCursor(TRUE); spracuj_spravy(0); ShowWindow(hWnd,SW_SHOW); spracuj_spravy(0); ShowWindow(hWnd,SW_MAXIMIZE); spracuj_spravy(0); */ } void cmcs_Play_Video(char *pFile, long dwVideoTime, AUDIO_DATA * p_ad) { /* int done = 0; long counter = 0; char lpstrFile[256]; GetPrivateProfileString("files","bitmap_dir","/",lpstrFile,256,ini_file); working_file_translate(lpstrFile,256); chdir(lpstrFile); sprintf(lpstrFile, "open %s type mpegvideo alias anakreonvideo style overlapped", pFile, hWnd); done = mciSendString(lpstrFile,0,0,0); if(done) { mciGetErrorString(done, lpstrFile, 256); kprintf(1,"%s", lpstrFile); } done = mciSendString("break anakreonvideo on 27", 0, 0, 0); wsprintf(lpstrFile, "put %s %s %s", "anakreonvideo", "destination at 0 0 1024 768", ""); done = mciSendString(lpstrFile,0,0,0); wsprintf(lpstrFile, "put %s %s %s", "anakreonvideo", "window client at 0 0 1024 768", ""); done = mciSendString(lpstrFile,0,0,0); wsprintf(lpstrFile, "put %s %s %s", "anakreonvideo", "window client at 0 0 1024 768", ""); done = mciSendString(lpstrFile,0,0,0); done = mciSendString("window anakreonvideo state show", 0, 0, 0); if(done) { mciGetErrorString(done, lpstrFile, 256); kprintf(1,"%s", lpstrFile); } //ShowWindow(hWnd,SW_MINIMIZE); spracuj_spravy(0); wsprintf(lpstrFile, "setaudio %s %s %s", "anakreonvideo", "volume to 250", ""); done = mciSendString(lpstrFile,0,0,0); done = mciSendString("play anakreonvideo from 0 wait fullscreen",0,0,hWnd); if(done) { mciGetErrorString(done, lpstrFile, 256); kprintf(1,"%s", lpstrFile); } mciSendString("stop anakreonvideo",0,0,0); mciSendString("close anakreonvideo",0,0,0); */ } void cmcs_Start_Picture(int Index, long time, AUDIO_DATA * p_ad, char bMusic) { long timecnt = 0; char bCimicsEnd = 0; cmcs_Draw(Index, 0, 0); while (!bCimicsEnd) { spracuj_spravy(0); if (key[K_ESC]) { key[K_ESC] = 0; bCimicsEnd = 1; } Sleep(10); timecnt += 10; if (timecnt > time) bCimicsEnd = 1; } if(bMusic) if(ogg_playing()) ap_Stop_Song(p_ad); } berusky2-0.12/src/kofola/square_cut.cpp0000644000175000017500000000772413674426075015074 00000000000000#include "square_cut.h" void OhodnotVrchol(int x, int y, SQUARE * pOblast, OHODNOCENI * pOhodnot) { if (x < pOblast->left) pOhodnot->horizontal = -1; else if (x > pOblast->right) pOhodnot->horizontal = 1; else pOhodnot->horizontal = 0; if (y < pOblast->top) pOhodnot->vertikal = -1; else if (y > pOblast->bottom) pOhodnot->vertikal = 1; else pOhodnot->vertikal = 0; return; } void KorigujSouracniciX(int *x, SQUARE * pOblast, OHODNOCENI * pOhodnot) { if (pOhodnot->horizontal == -1) *x = pOblast->left; else if (pOhodnot->horizontal == 1) *x = pOblast->right; } void KorigujSouracniciY(int *y, SQUARE * pOblast, OHODNOCENI * pOhodnot) { if (pOhodnot->vertikal == -1) *y = pOblast->top; else if (pOhodnot->vertikal == 1) *y = pOblast->bottom; } void OrezCtverec(SQUARE * pCtverec, SQUARE * pOblast) { OHODNOCENI TopLeft; OHODNOCENI BottomRight; OhodnotVrchol(pCtverec->left, pCtverec->top, pOblast, &TopLeft); OhodnotVrchol(pCtverec->right, pCtverec->bottom, pOblast, &BottomRight); KorigujSouracniciX(&pCtverec->left, pOblast, &TopLeft); KorigujSouracniciX(&pCtverec->right, pOblast, &BottomRight); KorigujSouracniciY(&pCtverec->top, pOblast, &TopLeft); KorigujSouracniciY(&pCtverec->bottom, pOblast, &BottomRight); } char OhodnotCtverec(SQUARE * pCtverec, SQUARE * pOblast) { OHODNOCENI TopLeft; OHODNOCENI BottomRight; OHODNOCENI TopRight; OHODNOCENI BottomLeft; OhodnotVrchol(pCtverec->left, pCtverec->top, pOblast, &TopLeft); OhodnotVrchol(pCtverec->right, pCtverec->top, pOblast, &TopRight); OhodnotVrchol(pCtverec->right, pCtverec->bottom, pOblast, &BottomRight); OhodnotVrchol(pCtverec->left, pCtverec->bottom, pOblast, &BottomLeft); //jeden a vice vrcholu v oblasti if ((!TopLeft.horizontal && !TopLeft.vertikal) || (!BottomRight.horizontal && !BottomRight.vertikal) || (!TopRight.horizontal && !TopRight.vertikal) || (!BottomLeft.horizontal && !BottomLeft.vertikal)) return 1; else //horizontalni protnuti oblasti if (!TopLeft.vertikal && !TopRight.vertikal && !BottomRight.vertikal && !BottomLeft.vertikal && TopLeft.horizontal == -1 && BottomLeft.horizontal == -1 && TopRight.horizontal == 1 && BottomRight.horizontal == 1) return 1; else //vertikalni protnuti oblasti if (TopLeft.vertikal == -1 && TopRight.vertikal == -1 && BottomRight.vertikal == 1 && BottomLeft.vertikal == 1 && !TopLeft.horizontal && !BottomLeft.horizontal && !TopRight.horizontal && !BottomRight.horizontal) return 1; else //oblast je ve ctverci if (TopLeft.horizontal == -1 && TopLeft.vertikal == -1 && TopRight.horizontal == 1 && TopRight.vertikal == -1 && BottomLeft.horizontal == -1 && BottomLeft.vertikal == 1 && BottomRight.horizontal == 1 && BottomRight.vertikal == 1) return 1; else //oblast prekryva kurzor zhora if (TopLeft.horizontal == -1 && TopLeft.vertikal == -1 && TopRight.horizontal == 1 && TopRight.vertikal == -1 && BottomLeft.horizontal == -1 && !BottomLeft.vertikal && BottomRight.horizontal == 1 && !BottomRight.vertikal) return 1; else //oblast prekryva kurzor ze spoda if (TopLeft.horizontal == -1 && !TopLeft.vertikal && TopRight.horizontal == 1 && !TopRight.vertikal && BottomLeft.horizontal == -1 && BottomLeft.vertikal == 1 && BottomRight.horizontal == 1 && BottomRight.vertikal == 1) return 1; else //oblast prekryva kurzor z leva if (TopLeft.horizontal == -1 && TopLeft.vertikal == -1 && !TopRight.horizontal && TopRight.vertikal == -1 && BottomLeft.horizontal == -1 && BottomLeft.vertikal == 1 && !BottomRight.horizontal && BottomRight.vertikal == 1) return 1; else //oblast prekryva kurzor z prava if (!TopLeft.horizontal && TopLeft.vertikal == -1 && TopRight.horizontal == 1 && TopRight.vertikal == -1 && !BottomLeft.horizontal && BottomLeft.vertikal == 1 && BottomRight.horizontal == 1 && BottomRight.vertikal == 1) return 1; return 0; } berusky2-0.12/src/kofola/Init.cpp0000644000175000017500000000470713674426075013622 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.2 //------------------------------------------------------------------------------------------------ #include #include #include #include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "init.h" //------------------------------------------------------------------------------------------------ // Load items into memory //------------------------------------------------------------------------------------------------ int lsi_Load_Items(LEVELINFO * p_Level) { char dir[MAX_FILENAME], odir[MAX_FILENAME]; struct dirent **files; int Count, m; SECONDDATADESC sec; if (getcwd(odir, MAX_FILENAME) == NULL) return 0; strcpy(dir, PRVKY_DIR); if (chdir(dir)) return 0; file_filter_mask("*.itm"); Count = scandir(dir, &files, &file_filter, NULL); if (Count < 0) { /* GCC warns when we don't check the return value of chdir(). For some reason, casting to (void) doesn't work. */ if (chdir(odir)) return 0; return 0; } p_Level->Count_Of_Objects = Count; p_Level->Object = (OBJECTDESC *) mmalloc(Count * sizeof(OBJECTDESC)); for (m = 0; m < Count; m++) { char filename[MAX_FILENAME]; FILE *file; strncpy(filename, files[m]->d_name, MAX_FILENAME - 1); free(files[m]); file = fopen(filename, "rb"); if (file) { if (fread(p_Level->Object + m, sizeof(OBJECTDESC), 1, file) != 1) { kprintf(1, "Unable to read file %s: %s", filename, strerror(errno)); continue; } fseek(file, 1000, SEEK_SET); if (fread(&sec, sizeof(SECONDDATADESC), 1, file) != 1) { kprintf(1, "Unable to read file %s: %s", filename, strerror(errno)); continue; } p_Level->Object[m].Out_File = sec; fclose(file); } else { //MessageBox(p_Level->hWnd,text,"Warning",MB_OK); kprintf(1, "Unable to open file %s: %s", filename, strerror(errno)); } } free(files); if (chdir(odir)) return 0; return 1; } //------------------------------------------------------------------------------------------------ // Releas items from memory //------------------------------------------------------------------------------------------------ void lsi_Release_Items(LEVELINFO * p_Level) { free((void *) p_Level->Object); } berusky2-0.12/src/kofola/Command.h0000644000175000017500000000021713674426075013732 00000000000000#ifndef __COMMAND_ #define __COMMAND_ void menucommand_Draw(HDC hdc, int *com, int layer); void menucommand_DrawT(HDC hdc, int *com); #endif berusky2-0.12/src/kofola/Tools.cpp0000644000175000017500000001402513674426075014011 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.1 //------------------------------------------------------------------------------------------------ #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" extern char cFontDir[5][64]; void tools_Parse_Command_Line(char *pCommnad, char *pLevel, char *pDemo, char *demo) { int i; for (i = 0; i < (int) strlen(pCommnad); i++) if (pCommnad[i] == ' ') break; if (i > 0) { strncpy(pLevel, pCommnad, i); pLevel[i] = '\0'; } if (i < (int) strlen(pCommnad)) { if (!strncmp((const char *) &pCommnad[i + 1], "np:", 3)) *demo = 1; else if (!strncmp((const char *) &pCommnad[i + 1], "fp:", 3)) *demo = 2; else *demo = 0; strcpy(pDemo, (const char *) &pCommnad[i + 4]); } else { /* This allows 18 chars for abbreviated month name. Should be more than enough in any locale. */ char timestamp[40]; time_t date = time(NULL); struct tm *unpacked_date = localtime(&date); size_t ret = strftime(timestamp, sizeof(timestamp), "[%b_%d_%Y]_[%H_%M_%S]", unpacked_date); assert(ret); *demo = 0; sprintf(pDemo, "[%s]_%s.dem", pLevel, timestamp); //strcpy(pDemo, "Demo.dem"); } } void GetText(char *Buffer, char *mask, char *text) { char *wcChar = strstr(Buffer, mask); char *wcEnter = NULL; if (!wcChar) return; wcChar += 2 + strlen(mask); wcEnter = strstr(wcChar, "\n"); if (!wcEnter) return; wcEnter--; strncpy(text, wcChar, wcEnter - wcChar); } void MyMessageBox(HWND hWnd, char *ctagtitle, char *ctagtext, char *addtext) { char filename[MAX_FILENAME]; char Text[1024]; char Caption[1024]; char *buffer; FILE *file; long size; if (!ctagtitle || !ctagtext) return; construct_path(filename, MAX_FILENAME, 3, cFontDir[2], BITMAP_DIR, "messages.txt"); file = fopen(filename, "rb"); if (!file) return; fseek(file, 0, SEEK_END); size = ftell(file); fseek(file, 0, SEEK_SET); buffer = (char *) mmalloc(sizeof(*buffer) * size); if (fread(buffer, sizeof(*buffer), size, file) != (size_t) size) { fclose(file); return; } memset(Text, 0, 1024 * sizeof(char)); memset(Caption, 0, 1024 * sizeof(char)); GetText(buffer, ctagtext, Text); GetText(buffer, ctagtitle, Caption); free(buffer); strcat(Caption, addtext); //MessageBox(hWnd, (LPCTSTR) Text, (LPCTSTR) Caption, MB_OK); kprintf(TRUE, Text); fclose(file); } static int translation_table[KEYNUM]; char * Key2String(int k, char *text) { #ifdef LINUX static int translation_table_init = TRUE; if(translation_table_init) { translation_table_init = FALSE; translation_table[K_ESC] = 1; // ESC translation_table[K_1] = 2; // 1 translation_table[K_2] = 3; // 2 translation_table[K_3] = 4; // 3 translation_table[K_4] = 5; // 4 translation_table[K_5] = 6; // 5 translation_table[K_6] = 7; // 6 translation_table[K_7] = 8; // 7 translation_table[K_8] = 9; // 8 translation_table[K_9] = 10; // 9 translation_table[K_0] = 11; // 0 translation_table[K_MINUS] = 12; // - translation_table[K_PLUS] = 13; // + translation_table[K_BKSP] = 14; // BACKSPACE translation_table[K_TAB] = 15; // TAB translation_table[K_Q] = 16; translation_table[K_W] = 17; translation_table[K_E] = 18; translation_table[K_R] = 19; translation_table[K_T] = 20; translation_table[K_Y] = 21; translation_table[K_U] = 22; translation_table[K_I] = 23; translation_table[K_O] = 24; translation_table[K_P] = 25; translation_table[K_BRACKET_L] = 26; // [ translation_table[K_BRACKET_R] = 27; // ] translation_table[K_ENTER] = 28; translation_table[K_CTRL] = 29; translation_table[SDLK_LCTRL] = 29; translation_table[K_A] = 30; translation_table[K_S] = 31; translation_table[K_D] = 32; translation_table[K_F] = 33; translation_table[K_G] = 34; translation_table[K_H] = 35; translation_table[K_J] = 36; translation_table[K_K] = 37; translation_table[K_L] = 38; translation_table[K_SEMICOL] = 39; translation_table[K_QUOTE] = 40; //translation_table[K_TILDA] = 41; translation_table[SDLK_LSHIFT] = 42; translation_table[SDLK_BACKSLASH] = 43; translation_table[K_Z] = 44; translation_table[K_X] = 45; translation_table[K_C] = 46; translation_table[K_V] = 47; translation_table[K_B] = 48; translation_table[K_N] = 49; translation_table[K_M] = 50; translation_table[SDLK_COMMA] = 51; translation_table[SDLK_PERIOD] = 52; translation_table[SDLK_SLASH] = 53; translation_table[SDLK_RSHIFT] = 54; translation_table[SDLK_PRINT] = 55; translation_table[SDLK_LALT] = 56; translation_table[SDLK_SPACE] = 57; translation_table[SDLK_CAPSLOCK] = 58; translation_table[K_F1] = 59; translation_table[K_F2] = 60; translation_table[K_F3] = 61; translation_table[K_F4] = 62; translation_table[K_F5] = 63; translation_table[K_F6] = 64; translation_table[K_F7] = 65; translation_table[K_F8] = 66; translation_table[K_F9] = 67; translation_table[K_F10] = 68; translation_table[K_F11] = 87; translation_table[K_F12] = 88; translation_table[SDLK_NUMLOCK] = 69; translation_table[SDLK_SCROLLOCK] = 70; translation_table[SDLK_HOME] = 71; translation_table[SDLK_UP] = 72; translation_table[SDLK_PAGEUP] = 73; translation_table[SDLK_KP_MINUS] = 74; translation_table[SDLK_LEFT] = 75; translation_table[SDLK_KP5] = 76; translation_table[SDLK_RIGHT] = 77; translation_table[SDLK_KP_PLUS] = 78; translation_table[SDLK_END] = 79; translation_table[SDLK_DOWN] = 80; translation_table[SDLK_PAGEDOWN] = 81; translation_table[SDLK_INSERT] = 82; translation_table[SDLK_DELETE] = 83; translation_table[SDLK_RCTRL] = 84; } k = translation_table[k]; #endif sprintf(text, "##control_k_%d", k); return(text); } berusky2-0.12/src/kofola/Menu.cpp0000644000175000017500000066122713676425214013625 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include #include #include #include #include "config.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "game_logic.h" #include "menu_script.h" #include "Command.h" #include "3D_graphic.h" #include "2D_graphic.h" #include "Menu.h" #include "Comics.h" #include "credits.h" #include "font.h" #include "controls.h" #include "menu_def.h" #include "Setup.h" #include "profiles.h" #include "3D_menus.h" #include "Demo.h" #include "load_level.h" #include "Menu.h" #include "Menu2.h" #include "menu_def.h" #include "Tools.h" #ifdef LINUX #include #include #include #include #include #endif #define HDC2DD -1 #define RES_NUM 200 extern SETUP setup; extern _3D_CURSOR _3dCur; extern char pBmpDir[MAX_FILENAME]; extern char pDataDir[MAX_FILENAME]; extern PLAYER_PROFILE pPlayerProfile; extern HINT_TEXTURE pHintTexture[26]; extern char cFontDir[5][64]; typedef struct __2D_HINT { int x; int y; int iSurface; int iBSurface; char bUsed; } _2D_HINT; typedef struct { CMD_LINE *cmd; int iWave; char bStop; } ANIMATION; extern HW_KONFIG hwconf; MOUSE_INFO dim; static ANIMATION anm[32]; static DWORD timercnt = 0; static DWORD timercntframe = 0; static DWORD dwLTime; static char cRestartMainMenu; char cBrutalRestart = 0; int CompositDC; int FontDC; int BackDC; int iCompositDC, iFontDC, iBackDC; static char bBackDC = 0; int iActualScene = 0; int iActualLevel = 0; static char bNewScene = 0; static _2D_HINT _2d_hint; extern RECT_LINE rline; //extern int gi_EnumDisplaySettings(DEVMODE *pdevmode); void RunMenuSceneMap(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu, char *cSceneBmp, char *cSceneAnim, int iScene, int iLevelStart, int iNumOfLevels, char *cLevelList, int xTV, int yTV, char bLoadGame, char *cSaveFile, char bTutorial, int xBack, int yBack); void RunMenuStartGame(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu); int RunMenuComix(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int iScene); void DrawClock(int *iClock, int i); int FillComboProfiles(COMBO_CONTROL * p_co, int *iSel); int LoadClock(int *iClock); void RunMenuCibron(char *cBmp); CMD_LINE *GetCMD(CMD_LINE * cmp, CMD_LINE * pres) { int i; for (i = 0; i < RES_NUM; i++) if (!strcmp(cmp->cParam[1], pres[i].cParam[0])) return &pres[i]; return NULL; } int CheckScenePresence(int iScene) { char t[256]; sprintf(t, "scene%d", iScene); return GetPrivateProfileInt("Internet", t, 0, ini_file); } //------------------------------------------------------------------------------------------------ // zastavi vsechny animace //------------------------------------------------------------------------------------------------ void StopAll(void) { int i; for (i = 0; i < 32; i++) if (anm[i].cmd) anm[i].bStop = 1; } //------------------------------------------------------------------------------------------------ // zastavi animaci //------------------------------------------------------------------------------------------------ void Stop(CMD_LINE * cmd) { int i; if (cmd->iAnim[0][0] == -1) return; for (i = 0; i < 32; i++) if (cmd == anm[i].cmd) { if (cmd->bEndActivate[0] && cmd->pCmdLine) { cmd->pCmdLine[(int)cmd->bEndActivate[0]].bActive = 1; cmd->bActive = 0; } if (cmd->bEndActivate[1] && cmd->pCmdLine) { cmd->pCmdLine[(int)cmd->bEndActivate[1]].bActive = 1; cmd->bActive = 0; } anm[i].bStop = 1; return; } } int NextStep(CMD_LINE * cmd) { if ((rand() % 100) < 60) return cmd->iAnim[cmd->iLastfrm][11]; else return cmd->iAnim[cmd->iLastfrm][11 + rand() % (cmd->iAnim[cmd->iLastfrm][17])]; } void DrawFrame(CMD_LINE * cmd, AUDIO_DATA * p_ad) { if (cmd->iAnim[cmd->iLastfrm][10] == 2) { float p[3] = { 0, 0, 0 }; //kprintf(1, "Play"); if(karmin_aktivni) ap_Play_Sound(0, 1, 0, p, 147 + (rand()%2), NULL, p_ad); } if (!cmd->iLayer) { if (cmd->iAnim[cmd->iLastfrm][6] >= 0) { RECT r; ddxBitBlt(CompositDC, cmd->iAnim[cmd->iLastfrm][2] + cmd->iAnim[cmd->iLastfrm][6], cmd->iAnim[cmd->iLastfrm][3] + cmd->iAnim[cmd->iLastfrm][7], cmd->iAnim[cmd->iLastfrm][8], cmd->iAnim[cmd->iLastfrm][9], cmd->iAnim[cmd->iLastfrm][1], cmd->iAnim[cmd->iLastfrm][6], cmd->iAnim[cmd->iLastfrm][7]); r.left = cmd->iAnim[cmd->iLastfrm][2] + cmd->iAnim[cmd->iLastfrm][6]; r.top = cmd->iAnim[cmd->iLastfrm][3] + cmd->iAnim[cmd->iLastfrm][7]; r.right = cmd->iAnim[cmd->iLastfrm][8]; r.bottom = cmd->iAnim[cmd->iLastfrm][9]; ddxAddRectItem(&rline, r, 1); } else ddxDrawSurface(CompositDC, cmd->iAnim[cmd->iLastfrm], 1); } else if (cmd->iLayer == 10) ddxDrawSurfaceColorKey(CompositDC, cmd->iAnim[cmd->iLastfrm], 1, TRANSCOLOR); else ddxDrawSurface(FontDC, cmd->iAnim[cmd->iLastfrm], 3); } //------------------------------------------------------------------------------------------------ // provede animaci //------------------------------------------------------------------------------------------------ void Animation(CMD_LINE * cmd, int time, AUDIO_DATA * p_ad) { ANIMATION_DRAW: while (time > 0) { if (cmd->iAnim[cmd->iLastfrm][5] == -1) { Stop(cmd); break; } time -= cmd->iAnim[cmd->iLastfrm][4]; if (time > (cmd->iAnim[cmd->iAnim[cmd->iLastfrm][5]][4] / 2.0f)) { if (cmd->iAnim[cmd->iLastfrm][11] >= 0) cmd->iAnim[cmd->iLastfrm][5] = NextStep(cmd); if (cmd->iAnim[cmd->iLastfrm][10] > 0) DrawFrame(cmd, p_ad); cmd->iLastfrm = cmd->iAnim[cmd->iLastfrm][5]; } } //---------------------------------------------------------------------- DrawFrame(cmd, p_ad); if (!cmd->iAnim[cmd->iLastfrm][4]) { if (cmd->iAnim[cmd->iLastfrm][11] >= 0) cmd->iAnim[cmd->iLastfrm][5] = NextStep(cmd); cmd->iLastfrm = cmd->iAnim[cmd->iLastfrm][5]; goto ANIMATION_DRAW; } if (cmd->iAnim[cmd->iLastfrm][5] == -1) { Stop(cmd); return; } if (cmd->iAnim[cmd->iLastfrm][11] >= 0) cmd->iAnim[cmd->iLastfrm][5] = NextStep(cmd); cmd->iLastfrm = cmd->iAnim[cmd->iLastfrm][5]; } int RectCross(RECT_LINE * p_rl, int idx) { int c = 0; int i; RECT *dr = &p_rl->rect[idx].rect; for (i = 0; i < rline.rlast; i++) if (i != idx) if (co_Rect_Hit(p_rl->rect[i].rect, dr->left, dr->top) || co_Rect_Hit(p_rl->rect[i].rect, dr->right, dr->top) || co_Rect_Hit(p_rl->rect[i].rect, dr->left, dr->bottom) || co_Rect_Hit(p_rl->rect[i].rect, dr->right, dr->bottom)) c++; return 0; } //------------------------------------------------------------------------------------------------ // provede animace //------------------------------------------------------------------------------------------------ void AnimationEvent(DWORD dwTime, AUDIO_DATA * p_ad) { DRAW_RECT *dr; int i; char bAnim = 0; DWORD e; e = abs((int)(dwLTime - dwTime)); for (i = 0; i < 32; i++) if (anm[i].cmd) { if (anm[i].bStop) { anm[i].cmd->iLastfrm = 1; anm[i].cmd->iCounter = 0; if (anm[i].iWave > -1) { //kprintf(1, "%d", anm[i].iWave); adas_Release_Source(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, anm[i].iWave); } anm[i].iWave = -1; anm[i].cmd = NULL; } else { anm[i].cmd->iCounter += e; if (anm[i].cmd->iCounter >= anm[i].cmd->iAnim[anm[i].cmd->iLastfrm][4]) { Animation(anm[i].cmd, anm[i].cmd->iCounter, p_ad); anm[i].cmd->iCounter = 0; bAnim = 1; } } } //prenos kreslenych dat; if (bAnim || rline.rlast) { if (bBackDC) { for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddxTransparentBlt(BackDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, FontDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, TRANSCOLOR); } for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddxTransparentBlt(CompositDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, BackDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, TRANSCOLOR); } } else { for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddxTransparentBlt(CompositDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, FontDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, TRANSCOLOR); } } for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddxTransparentBltDisplay(dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, CompositDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, TRANSCOLOR); } ddxUpdateMouse(); DisplayFrame(); bAnim = 1; } timercntframe += e; if(!bAnim && (dim.dx || dim.dy) && timercntframe > 9) { timercntframe = 0; DisplayFrame(); } dwLTime = dwTime; timercnt += e; _2d_Clear_RectLine(&rline); } void InitRandomJumps(CMD_LINE * cmd) { int i; for (i = 0; i < 200; i++) if (cmd->iAnim[i][11] >= 0) cmd->iAnim[i][5] = cmd->iAnim[i][11 + rand() % (cmd->iAnim[i][17])]; } int FindAnimation(CMD_LINE * cmd) { int i; for (i = 0; i < 32; i++) if (anm[i].cmd == cmd) return 1; return 0; } //------------------------------------------------------------------------------------------------ // prida animaci //------------------------------------------------------------------------------------------------ int AddAnimation(CMD_LINE * cmd, AUDIO_DATA * p_ad, char bOnlyOnes, char bButton) { int i, r; float pos[3] = { 0.0f, 0.0f, 1.0f }; if (!bButton) return -1; if (cmd->iAnim[0][0] == -1) return -1; for (i = 0; i < 32; i++) if (!anm[i].cmd) { if (bOnlyOnes && FindAnimation(cmd)) return -1; InitRandomJumps(cmd); anm[i].cmd = cmd; anm[i].bStop = 0; anm[i].iWave = -1; Animation(anm[i].cmd, 0, p_ad); if (cmd->iParam[0] == COM_RANDOMANIMATION) { r = rand() % 3; if (cmd->iParam[r + 2] < 0) { if (cmd->iParam[2] >= 0) { adas_Get_Listener_Position(pos); if(karmin_aktivni) ap_Play_Sound(0,1,0,pos,cmd->iParam[2], NULL, p_ad); } } else { adas_Get_Listener_Position(pos); if(karmin_aktivni) ap_Play_Sound(0,1,0,pos,cmd->iParam[r+2], NULL, p_ad); } } return i; } else if (!strcmp(cmd->cParam[1], anm[i].cmd->cParam[0]) && !anm[i].bStop) return -1; return -1; } int ChooseBidedExitAnimation(CMD_LINE * cmd, int Index, AUDIO_DATA * p_ad) { int id[RES_NUM]; int i, c = 0; for (i = Index; i < RES_NUM; i++) if (cmd[i].iParam[0] == COM_BINDEXITANIMATION) { id[c] = i; c++; if (c > RES_NUM - 1) break; } else if (cmd[i].iParam[0] != COM_BINDANIMATION) break; if (c) return id[rand() % c]; else return -1; } int ChooseBidedAnimation(CMD_LINE * cmd, int Index, AUDIO_DATA * p_ad) { int id[RES_NUM]; int i, c = 0; for (i = Index; i < RES_NUM; i++) if (cmd[i].iParam[0] == COM_BINDANIMATION) { id[c] = i; c++; if (c > RES_NUM - 1) break; } else if (cmd[i].iParam[0] != COM_BINDEXITANIMATION) break; if (c) return id[rand() % c]; else return -1; } void ZeroAnimations(void) { int i; for (i = 0; i < 32; i++) { anm[i].bStop = 0; anm[i].iWave = -1; anm[i].cmd = NULL; } } void FreeAnimations(CMD_LINE * cmd, int csize) { int i, j; for (i = 0; i < csize; i++) { for (j = 0; j < 32; j++) { if (anm[j].cmd) { if (anm[j].cmd == &cmd[i]) { anm[j].cmd->iLastfrm = 1; anm[j].cmd->iCounter = 0; anm[j].iWave = -1; anm[j].cmd = NULL; } } } } } //------------------------------------------------------------------------------------------------ // prida animaci //------------------------------------------------------------------------------------------------ void CheckAnimation(CMD_LINE * cmd, AUDIO_DATA * p_ad) { int i; for (i = 0; i < 32; i++) { if (anm[i].cmd) { if (!strcmp(cmd->cParam[1], anm[i].cmd->cParam[0])) { Stop(anm[i].cmd); return; } } } } void StretchAnimation(RECT * rStart, RECT * rFinish, int iSurface, int iSpeed, AUDIO_DATA * p_ad) { DWORD dwS, dwF, dwE; char done = 0; int max = 0; int i; int p[4]; //{left, top, right, bottom} float s[4]; RECT rBmp; RECT rDraw; p[0] = rFinish->left - rStart->left; p[1] = rFinish->top - rStart->top; p[2] = rFinish->right - rStart->right; p[3] = rFinish->bottom - rStart->bottom; for (i = 0; i < 4; i++) if (abs(p[i]) > max) max = abs(p[i]); for (i = 0; i < 4; i++) s[i] = p[i] / (float) max; StopAll(); rBmp.left = 0; rBmp.top = 0; rBmp.right = ddxGetWidth(iSurface); rBmp.bottom = ddxGetHight(iSurface); memcpy(&rDraw, rStart, sizeof(RECT)); dwS = timeGetTime(); while (!done) { ddxStretchBltDisplay(&rDraw, iSurface, &rBmp); DisplayFrame(); dwF = timeGetTime(); dwE = dwF - dwS; rDraw.left = rStart->left + ftoi((s[0] * dwE) / (float) iSpeed); rDraw.top = rStart->top + ftoi((s[1] * dwE) / (float) iSpeed); rDraw.right = rStart->right + ftoi((s[2] * dwE) / (float) iSpeed); rDraw.bottom = rStart->bottom + ftoi((s[3] * dwE) / (float) iSpeed); //kprintf(1, "rDraw.left, rFinish->left: [%d, %d]", rDraw.left, rFinish->left); if (rDraw.left <= rFinish->left && p[0]) { rDraw.left = rFinish->left; done = 1; } //kprintf(1, "rDraw.top, rFinish->top: [%d, %d]", rDraw.top, rFinish->top); if (rDraw.top <= rFinish->top && p[1]) { rDraw.top = rFinish->top; done = 1; } //kprintf(1, "rDraw.right, rFinish->right: [%d, %d]", rDraw.right, rFinish->right); if (rDraw.right >= rFinish->right && p[2]) { rDraw.right = rFinish->right; done = 1; } //kprintf(1, "rDraw.bottom, rFinish->bottom: [%d, %d]", rDraw.bottom, rFinish->bottom); if (rDraw.bottom >= rFinish->bottom && p[3]) { rDraw.bottom = rFinish->bottom; done = 1; } spracuj_spravy(0); ddxUpdateMouse(); ddxRestore(p_ad); } ddxStretchBltDisplay(rFinish, iSurface, &rBmp); DisplayFrame(); ddxStretchBltDisplay(rFinish, iSurface, &rBmp); } //------------------------------------------------------------------------------------------------ // spusti nahodny zvuk podle zadani //------------------------------------------------------------------------------------------------ int mPlaySound(CMD_LINE * cmd, AUDIO_DATA * p_ad, int type) { float pos[3] = { 0.0f, 0.0f, 1.0f }; int r = rand() % 4, ret = -1; if (cmd->iParam[r + 1] < 0) { if (cmd->iParam[1] >= 0) { adas_Get_Listener_Position(pos); if(karmin_aktivni) ret = ap_Play_Sound(type,1,0,pos,cmd->iParam[1], NULL, p_ad); } } else { adas_Get_Listener_Position(pos); if(karmin_aktivni) ret = ap_Play_Sound(type,1,0,pos,cmd->iParam[r+1], NULL, p_ad); } return ret; } void GetSceneParam(int iScene, int *iStartLevel, int *iNumOfLevels) { switch (iScene) { case 1: *iStartLevel = 0; *iNumOfLevels = 11; return; case 2: *iStartLevel = 11; *iNumOfLevels = 10; return; case 3: *iStartLevel = 21; *iNumOfLevels = 12; return; case 4: *iStartLevel = 33; *iNumOfLevels = 10; return; case 5: *iStartLevel = 43; *iNumOfLevels = 10; return; case 6: *iStartLevel = 53; *iNumOfLevels = 10; return; case 7: *iStartLevel = 63; *iNumOfLevels = 10; return; case 8: *iStartLevel = 73; *iNumOfLevels = 12; return; case 9: *iStartLevel = 85; *iNumOfLevels = 10; return; } } int SceneDone(void) { int i; int iStartLevel = 0; int iNumOfLevels = 0; GetSceneParam(iActualScene, &iStartLevel, &iNumOfLevels); for (i = iStartLevel; i < iStartLevel + iNumOfLevels; i++) if (!pPlayerProfile.cLevel[i]) return 0; return 1; } //------------------------------------------------------------------------------------------------ // spusti level //------------------------------------------------------------------------------------------------ int RunLevel(HWND hWnd, AUDIO_DATA * p_ad, int cpu, char *lvl, char *env) { int ret; TIMER_ID Timer_ID; char cenv[64]; float f = p_ad->Music_Gain; strcpy(cenv, env); if(ogg_playing()) { while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); } ap_Stop_Song(p_ad); } ddxRelease(); FreeDirectDraw(); { RunMenuLoadScreen2(); RunMenuLoadScreenInitBar(15); RunMenuLoadScreenAddProgress(-1); RunMenuLoadScreenDrawProgress(-1, -1); _3d_Init(); _3d_Load_List("3d_load.dat"); _3d_Gen_Hints(pHintTexture, 26); RunMenuLoadScreenAddProgress(-1); _3d_Load_Indikace(); Timer_ID = SetTimer(NULL, 0, 250, (TIMERPROC) gl_Set_Frame_Rate); adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); ret = gl_Run_Level(lvl, cenv, p_ad, cpu); if (ret == 1) pPlayerProfile.cLevel[iActualLevel] = 1; else if (ret == -1) RunMenuLoadScreenRelease(3); kprintf(1, "KillTimer"); KillTimer(NULL, Timer_ID); kprintf(1, "_3d_Release_Hints"); _3d_Release_Hints(pHintTexture, 26); kprintf(1, "_3d_Release"); _3d_Release(); spracuj_spravy(0); spracuj_spravy(0); } ddxInit(); spracuj_spravy(0); InitDirectDraw(); spracuj_spravy(0); ddxLoadList("2d_load.dat", 0); spracuj_spravy(0); iCompositDC = ddxFindFreeSurface(); CompositDC = ddxCreateSurface(1024, 768, iCompositDC); iFontDC = ddxFindFreeSurface(); FontDC = ddxCreateSurface(1024, 768, iFontDC); iBackDC = ddxFindFreeSurface(); BackDC = ddxCreateSurface(1024, 768, iBackDC); spracuj_spravy(0); ZeroAnimations(); bNewScene = 0; //pokud se jedna o herni scenu if (iActualScene > 0 && iActualScene < 10) if (SceneDone() && !pPlayerProfile.cMovie[iActualScene]) { PLAYER_PROFILE pProfile; pPlayerProfile.cMovie[iActualScene] = 1; pr_SaveProfile(&pPlayerProfile); if (iActualScene < 9) { memcpy(&pProfile, &pPlayerProfile, sizeof(PLAYER_PROFILE)); pProfile.cScene[iActualScene + 1] = 1; pr_SaveProfile(&pProfile); } ogg_gain(p_ad->Music_Gain); RunMenuComix("menu_comix.txt", NULL, p_ad, iActualScene); if (iActualScene < 9) bNewScene = 1; if (iActualScene == 9) { cr_Credits(NULL, p_ad); cRestartMainMenu = 1; bNewScene = 1; iActualScene = 0; } } else { ap_Play_Song(0,0,p_ad); //adas_OGG_Set_Priority(cpu); } else { ap_Play_Song(0,0,p_ad); //adas_OGG_Set_Priority(cpu); } cBrutalRestart = 1; return ret; } void CreateFontAnimations(CMD_LINE * res, int *lastcmd) { int lcmd = *lastcmd; char text[MAX_FILENAME]; RECT r = {0, 0, 0, 0 }; int i; int sidx1, sidx2; int y; for (i = 0; i < lcmd; i++) if (res[i].iParam[0] == COM_SETRECT) { r.left = res[i].iParam[1]; r.top = res[i].iParam[2]; r.right = res[i].iParam[3]; r.bottom = res[i].iParam[4]; } y = r.top; for (i = 0; i < lcmd; i++) if (res[i].iParam[0] == COM_CREATEBUTTON) if (fn_Gen_Menu_Text(0, HDC2DD, res[i].cParam[0], &sidx1, &sidx2) != -1) if (sidx1 != -1 && sidx2 != -1) { int ii; int oy = res[i].iParam[2]; //int x = r.left + ftoi((r.right - r.left - _2dd.bitmap[sidx1].bitmap.bmWidth) / (float)2.0f); int x = r.left + ftoi((r.right - r.left - ddxGetWidth(sidx1)) / (float) 2.0f); if (res[i].iParam[1] != -1) { oy = res[i].iParam[2]; y = oy; x = res[i].iParam[1]; } else { oy = res[i].iParam[2]; y = oy; } y += ddxGetHight(sidx1); //OnAbove(16,661,100,748, quit_game.txt, NO_EXEPTION) sprintf(text, "OnAbove(%d,%d,%d,%d, NO_EXEPTION, NO_EXEPTION)", x, oy, x + ddxGetWidth(sidx1), y); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].uiTimerID = 0; res[*lastcmd].iLastfrm = 1; res[*lastcmd].iCounter = 0; /* (0, 123, 0, 640, 0, 1) (1, 124, 0, 640, 25, 2) (2, 124, 0, 640, 25, -1) */ res[*lastcmd].iAnim[0][0] = 0; res[*lastcmd].iAnim[0][1] = sidx1; res[*lastcmd].iAnim[0][2] = x; res[*lastcmd].iAnim[0][3] = oy; res[*lastcmd].iAnim[0][4] = 0; res[*lastcmd].iAnim[0][5] = 1; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[0][ii] = -1; x = r.left + ftoi((r.right - r.left - ddxGetWidth(sidx2)) / (float) 2.0f); if (res[i].iParam[1] != -1) x = res[i].iParam[1]; res[*lastcmd].iAnim[1][0] = 1; res[*lastcmd].iAnim[1][1] = sidx2; res[*lastcmd].iAnim[1][2] = x; res[*lastcmd].iAnim[1][3] = oy; res[*lastcmd].iAnim[1][4] = 50; res[*lastcmd].iAnim[1][5] = 2; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[1][ii] = -1; res[*lastcmd].iAnim[2][0] = 2; res[*lastcmd].iAnim[2][1] = sidx2; res[*lastcmd].iAnim[2][2] = x; res[*lastcmd].iAnim[2][3] = oy; res[*lastcmd].iAnim[2][4] = 50; res[*lastcmd].iAnim[2][5] = -1; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[2][ii] = -1; res[*lastcmd].iLayer = 1; (*lastcmd)++; //Draw(1,0,0) sprintf(text, "Draw(%d,%d,%d)", sidx1, x, oy); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; //OnClick(16,661,100,748, quit_gamec.txt, EXIT) sprintf(text, "OnClick(%d,%d,%d,%d, NO_EXEPTION, %s)", x, oy, x + ddxGetWidth(sidx1), y, res[i].cParam[1]); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; //BindSound(54,55,56,-1) strcpy(text, "BindSound(54,55,56,-1)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 0; (*lastcmd)++; } } void SetTab(int iTab, int iLTab, CONTROL_LIST_ITEM * p_list, int lsize, int *hdcTab) { int i; if (iLTab > -1) { ddxBitBlt(hdcTab[iLTab], 0, 0, TAB_XRES, TAB_YRES, HDC2DD, TAB_X, TAB_Y); } for (i = 0; i < lsize; i++) if ((p_list + i)->iTab == iTab && !(p_list + i)->bDisabled) (p_list + i)->bActive = 1; else if ((p_list + i)->iTab != -1) (p_list + i)->bActive = 0; ddxBitBltDisplay(TAB_X, TAB_Y, TAB_XRES, TAB_YRES, hdcTab[iTab], 0, 0); DisplayFrame(); } void CharMenuCheckMultyKyes(LIST_VIEW_CONTROL * p_li, int iKey) { int y; int i; RECT r; for (i = 0; i < p_li->listnum; i++) if (i != p_li->cSelected && p_li->piValue[i].iValue == iKey) { y = i * 30; r.left = 550; r.top = y + 2; r.right = r.left + (ddxGetWidth(p_li->bDCn) - 550); r.bottom = r.top + 28; ddxFillRect(p_li->bDCn, &r, 0); ddxFillRect(p_li->bDCs, &r, 0); char tmp[200]; co_List_Add_String(p_li, i, 550, Key2String(255, tmp), 255, 0); } } void SetCharMenu(LIST_VIEW_CONTROL * p_li) { char text[128]; int y = p_li->cSelected * 30; // int xs = p_li->rectList.top + TAB_Y + y - p_li->dx; int xp = 0; int xt = 0; int i; int iCursor = 0; RECT r; if (!p_li->cSelected || p_li->cSelected == 11 || p_li->cSelected == 19) return; r.left = 550; r.top = y + 2; r.right = r.left + (ddxGetWidth(p_li->bDCn) - 550); r.bottom = r.top + 28; ddxFillRect(p_li->bDCn, &r, 0); ddxFillRect(p_li->bDCs, &r, 0); if (y - p_li->dx < 0) xp = (y - p_li->dx) * -1; if ((p_li->rectList.top + TAB_Y + y - p_li->dx + 30) > p_li->rectList.bottom + TAB_Y) xt = (p_li->rectList.top + TAB_Y + y - p_li->dx + 30) - (p_li->rectList.bottom + TAB_Y); ddxBitBlt(HDC2DD, p_li->rectList.left + TAB_X, p_li->rectList.top + TAB_Y + y - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, y + xp); r.top = p_li->rectList.top + TAB_Y + y - p_li->dx + xp - 2; r.left = 665; r.right = r.left + 220; r.bottom = r.top + 27; DisplayFrame(); while (!key[0]) { Sleep(10); spracuj_spravy(0); ddxUpdateMouse(); if (key[K_F1] || key[K_F2] || key[K_F3] || key[K_F10] || key[K_PLUS] || key[K_MINUS]) { key[0] = 0; key[K_F1] = 0; key[K_F2] = 0; key[K_F3] = 0; key[K_F10] = 0; key[K_PLUS] = 0; key[K_MINUS] = 0; } if (iCursor < 100) ddxFillRectDisplay(&r, RGB(63, 122, 163)); else if (iCursor > 99 && iCursor < 200) ddxFillRectDisplay(&r, 0); else { iCursor = 0; ddxFillRectDisplay(&r, 0); } iCursor += 4; //if(dim.dx || dim.dy) DisplayFrame(); } key[0] = 0; for (i = 0; i < POCET_KLAVES; i++) if (key[i]) { Key2String(i,text); key[i] = 0; break; } co_List_Add_String(p_li, p_li->cSelected, 550, text, i, 0); CharMenuCheckMultyKyes(p_li, i); ddxBitBlt(HDC2DD, p_li->rectList.left + TAB_X, p_li->rectList.top + TAB_Y, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); ddxBitBlt(HDC2DD, p_li->rectList.left + TAB_X, p_li->rectList.top + TAB_Y + y - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, y + xp); DisplayFrame(); } void SetMenuSettings(CONTROL_LIST_ITEM * citem, int *hdcTabUse) { float f; int i; if (hdcTabUse[0]) { setup.posouvat_kameru = co_Check_Get_State(citem, CLIST_ITEMC, 1); setup.ovladani = co_Check_Get_State(citem, CLIST_ITEMC, 2); setup.bugs_highlight = co_Check_Get_State(citem, CLIST_ITEMC, 10); setup.items_highlight = co_Check_Get_State(citem, CLIST_ITEMC, 11); setup.ovladani_rohy = co_Check_Get_State(citem, CLIST_ITEMC, 12); setup.camera_intro = co_Check_Get_State(citem, CLIST_ITEMC, 16); i = co_Check_Get_State(citem, CLIST_ITEMC, 13); if (i) setup.ovladani_rohy_default = 0; else setup.ovladani_rohy_default = 1; setup.ovladani_rohy_smer = co_Check_Get_State(citem, CLIST_ITEMC, 15); //setup.ovladani_pr_posun = co_Check_Get_State(citem, CLIST_ITEMC, 16); setup.ovladani_rohy_rychlost = co_Progres_Get(citem, CLIST_ITEMC, 0) / 10.0f; setup.p_kamera_radius = co_Progres_Get(citem, CLIST_ITEMC, 1) / 2.0f; } if (hdcTabUse[1]) { setup.kvalita_casticv = co_Combo_Get_Sel(citem, CLIST_ITEMC, 5); setup.text_mip_mapping = co_Combo_Get_Sel(citem, CLIST_ITEMC, 8); i = co_Combo_Drop_Get_Sel(citem, CLIST_ITEMC, 0, &f); if (!i) setup.text_ans = 0; else { setup.text_ans = 1; setup.text_ans_stupen = i; } setup.ditering = co_Check_Get_State(citem, CLIST_ITEMC, 7); setup.mirror_effects = co_Check_Get_State(citem, CLIST_ITEMC, 4); setup.animace_okoli = co_Check_Get_State(citem, CLIST_ITEMC, 8); setup.fullscreen = co_Check_Get_State(citem, CLIST_ITEMC, 5); co_Combo_Drop_Get_Sel(citem, CLIST_ITEMC, 10, &setup.text_ostrost); } if (hdcTabUse[2]) { setup.soundvolume = co_Progres_Get(citem, CLIST_ITEMC, 4); setup.ambientvolume = co_Progres_Get(citem, CLIST_ITEMC, 5); setup.musicvolume = co_Progres_Get(citem, CLIST_ITEMC, 6); } if (hdcTabUse[3]) { setup.key[1] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 1); setup.key[2] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 2); setup.key[3] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 3); setup.key[4] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 4); setup.key[5] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 5); setup.key[6] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 6); setup.key[7] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 7); setup.key[8] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 8); setup.key[9] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 9); setup.key[10] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 10); setup.key[12] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 12); setup.key[13] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 13); setup.key[14] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 14); setup.key[15] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 15); setup.key[16] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 16); setup.key[17] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 17); setup.key[18] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 18); setup.key[20] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 20); setup.key[21] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 21); setup.key[22] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 22); setup.key[23] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 23); setup.key[24] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 24); setup.key[25] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 25); setup.key[26] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 26); setup.key[27] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 27); setup.key[28] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 28); setup.key[29] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 29); setup.key[30] = co_List_Get_Value(citem, CLIST_ITEMC, 0, 30); } } void SetMenuSettingsS(CONTROL_LIST_ITEM * citem, int *hdcTabUse) { if (hdcTabUse[2]) { setup.soundvolume = co_Progres_Get(citem, CLIST_ITEMC, 4); setup.ambientvolume = co_Progres_Get(citem, CLIST_ITEMC, 5); setup.musicvolume = co_Progres_Get(citem, CLIST_ITEMC, 6); } } void ControlFullScreenCallback(void *p_control) { GRAPH3D *p_grf = (p_ber->p_age)->graph_get(); p_grf->fullscreen_toggle(); } void InitTab3d(CONTROL_LIST_ITEM * citem, int *hdcTab) { int i; int iClock; iClock = ddxLoadBitmap("clock1-1.png", pBmpDir); ddxResizeCursorBack(iClock); DrawClock(&iClock, 0); co_Set_Text_Right(hdcTab[1], "##settings_texture_filterig", 0, 285, 57); citem[18].p_combo = co_Create_Combo(hdcTab[1], 300, 50, 100, 8); citem[18].iTab = 1; co_Combo_Add_StringWC(citem[18].p_combo, "##settings_texture_filterig_linear"); co_Combo_Add_StringWC(citem[18].p_combo, "##settings_texture_mip_mapping"); co_Combo_Set_Params(citem[18].p_combo, 2); co_Combo_Set_Sel(hdcTab[1], citem[18].p_combo, setup.text_mip_mapping); co_Set_Text_Right(hdcTab[1], "##settings_anisotropic_filtering", 0, 285, 97); citem[27].p_combod = co_Create_Combo_Drop(hdcTab[1], 300, 90, 0); citem[27].iTab = 1; co_Combo_Drop_Add_StringWC(citem[27].p_combod, "##settings_lights_turnoff", 0.0f); co_Combo_Drop_Add_String(citem[27].p_combod, "2", 2.0f); co_Combo_Drop_Add_String(citem[27].p_combod, "4", 4.0f); co_Combo_Drop_Add_String(citem[27].p_combod, "8", 8.0f); co_Combo_Drop_Add_String(citem[27].p_combod, "16", 16.0f); co_Combo_Drop_Add_String(citem[27].p_combod, "32", 32.0f); if (!setup.text_ans) co_Combo_Drop_Set_Sel(hdcTab[1], citem[27].p_combod, 0); else co_Combo_Drop_Set_Sel(hdcTab[1], citem[27].p_combod, setup.text_ans_stupen); co_Set_Text_Right(hdcTab[1], "##settings_sharpness", 0, 285, 137); citem[42].p_combod = co_Create_Combo_Drop(hdcTab[1], 300, 130, 10); citem[42].iTab = 1; co_Combo_Drop_Add_String(citem[42].p_combod, "-3.0", -3.0f); co_Combo_Drop_Add_String(citem[42].p_combod, "-2.75", -2.75f); co_Combo_Drop_Add_String(citem[42].p_combod, "-2.5", -2.5f); co_Combo_Drop_Add_String(citem[42].p_combod, "-2.25", -2.25f); co_Combo_Drop_Add_String(citem[42].p_combod, "-2.0", -2.0f); co_Combo_Drop_Add_String(citem[42].p_combod, "-1.75", -1.75f); co_Combo_Drop_Add_String(citem[42].p_combod, "-1.5", -1.5f); co_Combo_Drop_Add_String(citem[42].p_combod, "-1.25", -1.25f); co_Combo_Drop_Add_String(citem[42].p_combod, "-1.0", -1.0f); co_Combo_Drop_Add_String(citem[42].p_combod, "-0.75", -0.75f); co_Combo_Drop_Add_String(citem[42].p_combod, "-0.5", -0.5f); co_Combo_Drop_Add_String(citem[42].p_combod, "-0.25", -0.25f); co_Combo_Drop_Add_String(citem[42].p_combod, "0.0", 0.0f); co_Combo_Drop_Add_String(citem[42].p_combod, "+0.25", 0.25f); co_Combo_Drop_Add_String(citem[42].p_combod, "+0.5", 0.5f); co_Combo_Drop_Add_String(citem[42].p_combod, "+0.75", 0.75f); co_Combo_Drop_Add_String(citem[42].p_combod, "+1.0", 1.0f); co_Combo_Drop_Add_String(citem[42].p_combod, "+1.25", 1.25f); co_Combo_Drop_Add_String(citem[42].p_combod, "+1.5", 1.5f); co_Combo_Drop_Add_String(citem[42].p_combod, "+1.75", 1.75f); co_Combo_Drop_Add_String(citem[42].p_combod, "+2.0", 2.0f); co_Combo_Drop_Add_String(citem[42].p_combod, "+2.25", 2.25f); co_Combo_Drop_Add_String(citem[42].p_combod, "+2.5", 2.5f); co_Combo_Drop_Add_String(citem[42].p_combod, "+2.75", 2.75f); co_Combo_Drop_Add_String(citem[42].p_combod, "+3.0", 3.0f); i = ftoi(((setup.text_ostrost + 3) * 100) / 25.0f); if (i > 24) i = 24; co_Combo_Drop_Set_Sel(hdcTab[1], citem[42].p_combod, i); citem[29].p_check = co_Create_CheckBox(hdcTab[1], 300, 180, "##settings_dithering", 0, 7); citem[29].iTab = 1; co_Check_Set_State(citem[29].p_check, hdcTab[1], setup.ditering, 1); citem[11].p_check = co_Create_CheckBox(hdcTab[1], 300, 220, "##settings_draw_mirror", 0, 4); citem[11].iTab = 1; co_Check_Set_State(citem[11].p_check, hdcTab[1], setup.mirror_effects, 1); citem[30].p_check = co_Create_CheckBox(hdcTab[1], 300, 260, "##settings_animations", 0, 8); citem[30].iTab = 1; co_Check_Set_State(citem[30].p_check, hdcTab[1], setup.animace_okoli, 1); citem[12].p_check = co_Create_CheckBox(hdcTab[1], 300, 300, "##settings_fullscreen", 0, 5, ControlFullScreenCallback); citem[12].iTab = 1; co_Check_Set_State(citem[12].p_check, hdcTab[1], setup.fullscreen, 1); ddxSetCursor(0); DisplayFrame(); DisplayFrame(); ddxResizeCursorBack(0); ddxSetCursorSurface(0); ddxSetCursor(1); DisplayFrame(); DisplayFrame(); ddxReleaseBitmap(iClock); } void InitTabSound(CONTROL_LIST_ITEM * citem, int *hdcTab) { co_Set_Text_Right(hdcTab[2], "##settings_sound", 0, 260, 50); citem[21].p_prog = co_Create_Progres(hdcTab[2], 310, 50, 0, 100, 4); citem[21].iTab = 2; co_Progres_Set(citem[21].p_prog, hdcTab[2], setup.soundvolume); co_Set_Text_Right(hdcTab[2], "##settings_ambient", 0, 260, 85); citem[22].p_prog = co_Create_Progres(hdcTab[2], 310, 85, 0, 100, 5); citem[22].iTab = 2; co_Progres_Set(citem[22].p_prog, hdcTab[2], setup.ambientvolume); co_Set_Text_Right(hdcTab[2], "##settings_music", 0, 260, 120); citem[23].p_prog = co_Create_Progres(hdcTab[2], 310, 120, 0, 100, 6); citem[23].iTab = 2; co_Progres_Set(citem[23].p_prog, hdcTab[2], setup.musicvolume); } void InitTabControls(CONTROL_LIST_ITEM * citem, int *hdcTab) { char ctext[MAX_FILENAME]; int iClock; iClock = ddxLoadBitmap("clock1-1.png", pBmpDir); ddxResizeCursorBack(iClock); DrawClock(&iClock, 0); citem[24].p_list = co_Create_List(hdcTab[3], 25, 50, 800, 580, 0, 31, 0); citem[24].iTab = 3; co_List_Add_String(citem[24].p_list, 0, 2, "##control_beatle", 0, 1); co_List_Add_String(citem[24].p_list, 1, 2, "##control_forward", 0, 0); co_List_Add_String(citem[24].p_list, 2, 2, "##control_back", 0, 0); co_List_Add_String(citem[24].p_list, 3, 2, "##control_left", 0, 0); co_List_Add_String(citem[24].p_list, 4, 2, "##control_right", 0, 0); co_List_Add_String(citem[24].p_list, 5, 2, "##control_nextb", 0, 0); co_List_Add_String(citem[24].p_list, 6, 2, "##control_b1", 0, 0); co_List_Add_String(citem[24].p_list, 7, 2, "##control_b2", 0, 0); co_List_Add_String(citem[24].p_list, 8, 2, "##control_b3", 0, 0); co_List_Add_String(citem[24].p_list, 9, 2, "##control_b4", 0, 0); co_List_Add_String(citem[24].p_list, 10, 2, "##control_b5", 0, 0); co_List_Add_String(citem[24].p_list, 11, 2, "##control_camera", 0, 1); co_List_Add_String(citem[24].p_list, 12, 2, "##control_crotation", 0, 0); co_List_Add_String(citem[24].p_list, 13, 2, "##control_cmove", 0, 0); co_List_Add_String(citem[24].p_list, 14, 2, "##control_czoomin", 0, 0); co_List_Add_String(citem[24].p_list, 15, 2, "##control_czoomout", 0, 0); co_List_Add_String(citem[24].p_list, 16, 2, "##control_cfastleft", 0, 0); co_List_Add_String(citem[24].p_list, 17, 2, "##control_cfastright", 0, 0); co_List_Add_String(citem[24].p_list, 18, 2, "##control_ccamera", 0, 0); co_List_Add_String(citem[24].p_list, 19, 2, "##control_game", 0, 1); co_List_Add_String(citem[24].p_list, 20, 2, "##control_gmenu", 0, 0); co_List_Add_String(citem[24].p_list, 21, 2, "##control_grestart", 0, 0); co_List_Add_String(citem[24].p_list, 22, 2, "##control_ginventory", 0, 0); //co_List_Add_String(citem[24].p_list, 23, 2, "##control_gusepack", 0, 0); co_List_Add_String(citem[24].p_list, 23, 2, "##control_gnexttrack", 0, 0); co_List_Add_String(citem[24].p_list, 24, 2, "##control_gturnoffi", 0, 0); co_List_Add_String(citem[24].p_list, 25, 2, "##control_gturnofft", 0, 0); co_List_Add_String(citem[24].p_list, 26, 2, "##control_gscreenshot", 0, 0); co_List_Add_String(citem[24].p_list, 27, 2, "##control_gtransparent", 0, 0); co_List_Add_String(citem[24].p_list, 28, 2, "##control_ghighlight", 0, 0); co_List_Add_String(citem[24].p_list, 29, 2, "##control_gdrawconn", 0, 0); co_List_Add_String(citem[24].p_list, 30, 2, "##control_pause", 0, 0); Key2String(setup.key[1], ctext); co_List_Add_String(citem[24].p_list, 1, 550, ctext, setup.key[1], 0); Key2String(setup.key[2], ctext); co_List_Add_String(citem[24].p_list, 2, 550, ctext, setup.key[2], 0); Key2String(setup.key[3], ctext); co_List_Add_String(citem[24].p_list, 3, 550, ctext, setup.key[3], 0); Key2String(setup.key[4], ctext); co_List_Add_String(citem[24].p_list, 4, 550, ctext, setup.key[4], 0); Key2String(setup.key[5], ctext); co_List_Add_String(citem[24].p_list, 5, 550, ctext, setup.key[5], 0); Key2String(setup.key[6], ctext); co_List_Add_String(citem[24].p_list, 6, 550, ctext, setup.key[6], 0); Key2String(setup.key[7], ctext); co_List_Add_String(citem[24].p_list, 7, 550, ctext, setup.key[7], 0); Key2String(setup.key[8], ctext); co_List_Add_String(citem[24].p_list, 8, 550, ctext, setup.key[8], 0); Key2String(setup.key[9], ctext); co_List_Add_String(citem[24].p_list, 9, 550, ctext, setup.key[9], 0); Key2String(setup.key[10], ctext); co_List_Add_String(citem[24].p_list, 10, 550, ctext, setup.key[10], 0); Key2String(setup.key[12], ctext); co_List_Add_String(citem[24].p_list, 12, 550, ctext, setup.key[12], 0); Key2String(setup.key[13], ctext); co_List_Add_String(citem[24].p_list, 13, 550, ctext, setup.key[13], 0); Key2String(setup.key[14], ctext); co_List_Add_String(citem[24].p_list, 14, 550, ctext, setup.key[14], 0); Key2String(setup.key[15], ctext); co_List_Add_String(citem[24].p_list, 15, 550, ctext, setup.key[15], 0); Key2String(setup.key[16], ctext); co_List_Add_String(citem[24].p_list, 16, 550, ctext, setup.key[16], 0); Key2String(setup.key[17], ctext); co_List_Add_String(citem[24].p_list, 17, 550, ctext, setup.key[17], 0); Key2String(setup.key[18], ctext); co_List_Add_String(citem[24].p_list, 18, 550, ctext, setup.key[18], 0); Key2String(setup.key[20], ctext); co_List_Add_String(citem[24].p_list, 20, 550, ctext, setup.key[20], 0); Key2String(setup.key[21], ctext); co_List_Add_String(citem[24].p_list, 21, 550, ctext, setup.key[21], 0); Key2String(setup.key[22], ctext); co_List_Add_String(citem[24].p_list, 22, 550, ctext, setup.key[22], 0); //Key2String(setup.key[23], ctext); //co_List_Add_String(citem[24].p_list, 23, 550, ctext, setup.key[23], 0); Key2String(setup.key[23], ctext); co_List_Add_String(citem[24].p_list, 23, 550, ctext, setup.key[23], 0); Key2String(setup.key[24], ctext); co_List_Add_String(citem[24].p_list, 24, 550, ctext, setup.key[24], 0); Key2String(setup.key[25], ctext); co_List_Add_String(citem[24].p_list, 25, 550, ctext, setup.key[25], 0); Key2String(setup.key[26], ctext); co_List_Add_String(citem[24].p_list, 26, 550, ctext, setup.key[26], 0); Key2String(setup.key[27], ctext); co_List_Add_String(citem[24].p_list, 27, 550, ctext, setup.key[27], 0); Key2String(setup.key[28], ctext); co_List_Add_String(citem[24].p_list, 28, 550, ctext, setup.key[28], 0); Key2String(setup.key[29], ctext); co_List_Add_String(citem[24].p_list, 29, 550, ctext, setup.key[29], 0); Key2String(setup.key[30], ctext); co_List_Add_String(citem[24].p_list, 30, 550, ctext, setup.key[30], 0); co_List_Redraw(hdcTab[3], citem[24].p_list, 0); ddxSetCursor(0); DisplayFrame(); DisplayFrame(); ddxResizeCursorBack(0); ddxSetCursorSurface(0); ddxSetCursor(1); DisplayFrame(); DisplayFrame(); ddxReleaseBitmap(iClock); } void DrawMenu(int *p_idx, int *p_hdcBT, CMD_LINE *res, int lastcmd) { int i, c = 0, lastanm; // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: { if (!c) { *p_hdcBT = ddxCreateSurface(ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), ddxFindFreeSurface()); ddxBitBlt(*p_hdcBT, 0, 0, ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), HDC2DD, res[i].iParam[2], res[i].iParam[3]); ddxTransparentBlt(BackDC, res[i].iParam[2], res[i].iParam[3], ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), res[i].iParam[1], 0, 0, ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), TRANSCOLOR); *p_idx = i; } else { ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); } c++; } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } } void RunMenuSettings(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu) { DWORD dwEplased = 0, dwStart, dwStop; int ActiveTab = 0; int hdcTab[TAB_NUM]; int hdcTabUse[TAB_NUM]; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; int iClock[12]; int lastcmd, lastanm, i; char dir[MAX_FILENAME]; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; for (i = 0; i < 12; i++) iClock[i] = -1; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); Load_ini(); ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); ddxCleareSurface(CompositDC); LoadClock(iClock); if (iClock[0] != -1) { ddxResizeCursorBack(iClock[0]); DrawClock(iClock, 0); } ActiveTab = 0; ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); fn_Set_Font(cFontDir[2]); fn_Load_Bitmaps(); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][11] = -1; res[bind].iAnim[lastcmd][0] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; DrawClock(iClock, 1); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { ddxDrawSurface(BackDC, res[i].iParam, 2); } else { ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } DrawClock(iClock, 2); for (i = 0; i < TAB_NUM; i++) { hdcTab[i] = ddxCreateSurface(TAB_XRES, TAB_YRES, ddxFindFreeSurface()); if (hdcTab[i]) { ddxBitBlt(hdcTab[i], 0, 0, TAB_XRES, TAB_YRES, BackDC, TAB_X, TAB_Y); } hdcTabUse[i] = 0; } DrawClock(iClock, 3); if (co_Load_Graphic(0)) { DrawClock(iClock, 4); citem[0].bActive = 0; citem[1].bActive = 0; citem[2].bActive = 1; citem[3].p_check = co_Create_CheckBox(hdcTab[0], 25, 50, "##settings_camera_mov", 0, 1); co_Check_Set_State(citem[3].p_check, hdcTab[0], setup.posouvat_kameru, 1); citem[3].bActive = 1; citem[4].p_check = co_Create_CheckBox(hdcTab[0], 25, 80, "##settings_b1_control", 0, 2); co_Check_Set_State(citem[4].p_check, hdcTab[0], setup.ovladani, 1); citem[4].bActive = 1; citem[45].p_check = co_Create_CheckBox(hdcTab[0], 25, 110, "##settings_beathe_vis_at_start", 0, 10); co_Check_Set_State(citem[45].p_check, hdcTab[0], setup.bugs_highlight, 1); citem[45].bActive = 1; citem[46].p_check = co_Create_CheckBox(hdcTab[0], 25, 140, "##settings_items_vis_at_start", 0, 11); co_Check_Set_State(citem[46].p_check, hdcTab[0], setup.items_highlight, 1); citem[46].bActive = 1; citem[51].p_check = co_Create_CheckBox(hdcTab[0], 25, 200, "##settings_camera_intro", 0, 16); co_Check_Set_State(citem[51].p_check, hdcTab[0], setup.camera_intro, 1); citem[51].bActive = 1; citem[47].p_check = co_Create_CheckBox(hdcTab[0], 25, 230, "##settings_camera_rect", 0, 12); co_Check_Set_State(citem[47].p_check, hdcTab[0], setup.ovladani_rohy, 1); citem[47].bActive = 1; citem[48].p_check = co_Create_CheckBox(hdcTab[0], 25, 260, "##settings_implicit_move", 0, 13); if (setup.ovladani_rohy_default) co_Check_Set_State(citem[48].p_check, hdcTab[0], 0, 1); else co_Check_Set_State(citem[48].p_check, hdcTab[0], 1, 1); DrawClock(iClock, 5); citem[48].bActive = 1; citem[49].p_check = co_Create_CheckBox(hdcTab[0], 25, 290, "##settings_imlicit_rot", 0, 14); if (setup.ovladani_rohy_default) co_Check_Set_State(citem[49].p_check, hdcTab[0], 1, 1); else co_Check_Set_State(citem[49].p_check, hdcTab[0], 0, 1); citem[49].bActive = 1; citem[50].p_check = co_Create_CheckBox(hdcTab[0], 25, 320, "##settings_camera_swap", 0, 15); co_Check_Set_State(citem[50].p_check, hdcTab[0], setup.ovladani_rohy_smer, 1); citem[50].bActive = 1; co_Set_Text_Right(hdcTab[0], "##setings_camera_speed", 0, 450, 390); citem[52].p_prog = co_Create_Progres(hdcTab[0], 500, 387, 0, 10, 0); co_Progres_Set(citem[52].p_prog, hdcTab[0], ftoi(setup.ovladani_rohy_rychlost * 10)); citem[52].bActive = 1; co_Set_Text_Right(hdcTab[0], "##settings_trans_radius", 0, 450, 425); citem[7].p_prog = co_Create_Progres(hdcTab[0], 500, 412, 1, 20, 1); co_Progres_Set(citem[7].p_prog, hdcTab[0], ftoi(setup.p_kamera_radius * 2)); citem[7].bActive = 1; if (!setup.ovladani_rohy) { co_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 13); co_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 14); co_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 15); co_Progres_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 0, 1, hdcTab[0]); } DrawClock(iClock, 6); ddxBitBltDisplay(0, 0, 1024, 768, BackDC, 0, 0); SetTab(0, -1, citem, CLIST_ITEMC, hdcTab); if (!setup.ovladani_rohy) { co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 13); co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 14); co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 15); co_Progres_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0, 0, HDC2DD); } DrawClock(iClock, 7); ddxCleareSurface(BackDC); hdcTabUse[0] = 1; ddxSetCursor(0); DisplayFrame(); DisplayFrame(); ddxResizeCursorBack(0); ddxSetCursorSurface(0); ddxSetCursor(1); DisplayFrame(); DisplayFrame(); for (i = 0; i < 12; i++) { if (iClock[i] != -1) { ddxReleaseBitmap(iClock[i]); iClock[i] = -1; } } } for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) { for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawDisplay(res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 3, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[i].iAnim[0], 3); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[anbind].iAnim[0], 3); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } } } dim.dx = 0; dim.dy = 0; } co_Handle_Controls(citem, CLIST_ITEMC, dim.x - TAB_X, dim.y - TAB_Y, HDC2DD, TAB_X, TAB_Y); if(co_Progres_Changed(citem, CLIST_ITEMC, 4)) p_ad->Sound_Gain = co_Progres_Get(citem, CLIST_ITEMC, 4) / 100.0f; if (co_Progres_Changed(citem, CLIST_ITEMC, 6)) { float f = co_Progres_Get(citem, CLIST_ITEMC, 6) / 100.0f; ogg_gain(f); p_ad->Music_Gain = f; if (f >= 0.05f && !ogg_playing()) { p_ad->Music_Gain = f; ap_Play_Song(0,0,p_ad); } } //stlacil leve tlacitko if (dim.t1 && !click) { int iCheck = -1; LIST_VIEW_CONTROL *p_li; if (co_List_Get_Clck(citem, CLIST_ITEMC, 0, &p_li) == 1) { float pos[3] = { 0, 0, 0 }; if(karmin_aktivni) ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, p_ad); SetCharMenu(p_li); } iCheck = co_Check_Get_State_Change(citem, CLIST_ITEMC, 12); if (iCheck != -1) { if (!iCheck) { co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 13); co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 14); co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 15); //co_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 16); co_Progres_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0, 1, HDC2DD); } else { co_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 13); co_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 14); co_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 15); //co_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 16); co_Progres_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0); } } if (ActiveTab == 0 && !citem[49].bDisabled) { iCheck = co_Check_Get_State_Change(citem, CLIST_ITEMC, 13); if (iCheck != -1 && iCheck == 1) co_Check_Set_State(citem[49].p_check, HDC2DD, 0, 1); else if (iCheck != -1 && !iCheck) co_Check_Set_State(citem[49].p_check, HDC2DD, 1, 1); iCheck = co_Check_Get_State_Change(citem, CLIST_ITEMC, 14); if (iCheck != -1 && iCheck == 1) co_Check_Set_State(citem[48].p_check, HDC2DD, 0, 1); else if (iCheck != -1 && !iCheck) co_Check_Set_State(citem[48].p_check, HDC2DD, 1, 1); } //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "OK")) { float pos[3] = { 0, 0, 0 }; if(karmin_aktivni) ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, p_ad); SetMenuSettings(citem, hdcTabUse); Save_ini(); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "EXIT")) { float pos[3] = { 0, 0, 0 }; if(karmin_aktivni) ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, p_ad); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "GAME") && ActiveTab) { SetTab(0, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 0; hdcTabUse[0]++; } if (!strcmp(res[resid].cParam[1], "3D") && ActiveTab != 1) { if (!hdcTabUse[1]) InitTab3d(citem, hdcTab); SetTab(1, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 1; hdcTabUse[1]++; } if (!strcmp(res[resid].cParam[1], "SOUND") && ActiveTab != 2) { if (!hdcTabUse[2]) InitTabSound(citem, hdcTab); SetTab(2, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 2; hdcTabUse[2]++; } if (!strcmp(res[resid].cParam[1], "CONTROLS") && ActiveTab != 3) { if (!hdcTabUse[3]) InitTabControls(citem, hdcTab); SetTab(3, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 3; hdcTabUse[3]++; } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_RANDOMANIMATION) { if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); ddxCleareSurface(CompositDC); SetMenuSettingsS(citem, hdcTabUse); Save_ini(); fn_Release_Font(1); StopAll(); co_Handle_Release(citem, CLIST_ITEMC); co_Release_Graphic(); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } void RunStretchAnimation(char *cScene, int x, int y, AUDIO_DATA * p_ad) { int idx; RECT r; RECT s = {0, 0, 1024, 768}; idx = ddxLoadBitmap(cScene, pBmpDir); if (idx < 0) return; r.left = x; r.top = y; r.right = r.left + ddxGetWidth(180); r.bottom = r.top + ddxGetHight(180); StretchAnimation(&r, &s, idx, 1, p_ad); ddxReleaseBitmap(idx); } void RunMenuNewGameSceneActivate(CMD_LINE * res) { int i; for (i = 1; i < 10; i++) { if (pPlayerProfile.cScene[i]) { res[i + 8].bActive = 1; res[i + 17].bActive = 1; ddxDrawSurface(BackDC, res[i + 8].iAnim[0], 2); if (i > 1) ddxDrawSurface(BackDC, res[i - 1].iAnim[6], 2); } } } void GetRunMenuNewGameSceneLoadGame(char *cscene, char *cscenemap, char *csceneanim, char *cscenelevel, int *iLevelStart, int *iNumOfLevels, int *xTV, int *yTV, char *bTutorial, int *xBack, int *yBack) { *bTutorial = 0; switch (iActualScene) { case 0: *iLevelStart = 200; *iNumOfLevels = 20; *xTV = 0; *yTV = 0; *bTutorial = 1; *xBack = 975; *yBack = 7; break; case 1: *iLevelStart = 0; *iNumOfLevels = 11; *xTV = 919; *yTV = 677; *xBack = 713; *yBack = 679; break; case 2: *iLevelStart = 11; *iNumOfLevels = 10; *xTV = 916; *yTV = 8; *xBack = 971; *yBack = 703; break; case 3: *iLevelStart = 21; *iNumOfLevels = 12; *xTV = 918; *yTV = 7; *xBack = 973; *yBack = 413; break; case 4: *iLevelStart = 33; *iNumOfLevels = 10; *xTV = 197; *yTV = 9; *xBack = 8; *yBack = 16; break; case 5: *iLevelStart = 43; *iNumOfLevels = 10; *xTV = 918; *yTV = 9; *xBack = 976; *yBack = 309; break; case 6: *iLevelStart = 53; *iNumOfLevels = 10; *xTV = 920; *yTV = 8; *xBack = 967; *yBack = 211; break; case 7: *iLevelStart = 63; *iNumOfLevels = 10; *xTV = 11; *yTV = 6; *xBack = 8; *yBack = 279; break; case 8: *iLevelStart = 73; *iNumOfLevels = 12; *xTV = 15; *yTV = 677; *xBack = 12; *yBack = 490; break; case 9: *iLevelStart = 85; *iNumOfLevels = 10; *xTV = 918; *yTV = 7; *xBack = 971; *yBack = 338; break; case 10: *iLevelStart = 300; *iNumOfLevels = 15; *xTV = 920; *yTV = 5; *xBack = 706; *yBack = 6; break; case 11: *iLevelStart = 315; *iNumOfLevels = 15; *xTV = 920; *yTV = 5; *xBack = 750; *yBack = 5; break; case 12: *iLevelStart = 330; *iNumOfLevels = 15; *xTV = 920; *yTV = 7; *xBack = 973; *yBack = 229; break; } sprintf(cscenemap, "scene%d_map.png", iActualScene); sprintf(csceneanim, "scene%d_anim", iActualScene); sprintf(cscenelevel, "scene%d_levels.txt", iActualScene); sprintf(cscene, "Mmnew_game_scene%d_map.txt", iActualScene); } void RunMenuNewGameSceneLoadGame(HWND hWnd, AUDIO_DATA * p_ad, int cpu, char bLoadGame, char *cSaveFile) { char cscene[64] = ""; char cscenemap[64] = ""; char csceneanim[64] = ""; char cscenelevel[64] = ""; int iLevelStart = 0; int iNumOfLevels = 0; int xTV = 0; int yTV = 0; int xBack = 0; int yBack = 0; char bTutorial = 0; GetRunMenuNewGameSceneLoadGame(cscene, cscenemap, csceneanim, cscenelevel, &iLevelStart, &iNumOfLevels, &xTV, &yTV, &bTutorial, &xBack, &yBack); RunMenuSceneMap(cscene, NULL, p_ad, cpu, cscenemap, csceneanim, iActualScene, iLevelStart, iNumOfLevels, cscenelevel, xTV, yTV, 1, cSaveFile, bTutorial, 0, 0); } void RunMenuNewGameScene(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu, char bLoadGame, char *cSaveFile, char bNewGame) { DWORD dwEplased = 0, dwStart, dwStop; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; bBackDC = 0; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); if (!pPlayerProfile.cMovie[0] && bNewGame) { pPlayerProfile.cMovie[0] = 1; pr_SaveProfile(&pPlayerProfile); RunMenuComix("menu_comix.txt", NULL, p_ad, 0); } ////////////////////////////LOAD GAME if (bLoadGame) { if (lsi_Get_Save_Info(cSaveFile, &iActualLevel, &iActualScene)) { RunMenuNewGameSceneLoadGame(NULL, p_ad, cpu, bLoadGame, cSaveFile); bLoadGame = 0; if (!iActualScene) { free((void *) res); return; } } ////////////////////////////LOAD GAME } else if (!iActualScene) { RunMenuSceneMap("Mmnew_game_scene0_map.txt", NULL, p_ad, cpu, "scene0_map.png", "scene0_anim", 0, 200, 20, "scene0_levels.txt", 0, 0, 0, NULL, 1, 975, 7); bLoadGame = 0; if (!iActualScene) { free((void *) res); return; } } else if (iActualScene == 10) { RunMenuSceneMap("Mmnew_game_scene10_map.txt", NULL, p_ad, cpu, "scene10_map.png", "scene10_anim", 10, 300, 15, "scene10_levels.txt", 920, 2, 0, NULL, 0, 706, 6); bLoadGame = 0; if (iActualScene == 10) { free((void *) res); return; } } else if (iActualScene == 11) { RunMenuSceneMap("Mmnew_game_scene11_map.txt", NULL, p_ad, cpu, "scene11_map.png", "scene11_anim", 11, 315, 15, "scene11_levels.txt", 920, 2, 0, NULL, 0, 750, 5); bLoadGame = 0; if (iActualScene == 11) { free((void *) res); return; } } else if (iActualScene == 12) { RunMenuSceneMap("Mmnew_game_scene12_map.txt", NULL, p_ad, cpu, "scene12_map.png", "scene12_anim", 12, 330, 15, "scene12_levels.txt", 920, 7, 0, NULL, 0, 973, 229); bLoadGame = 0; if (iActualScene == 12) { free((void *) res); return; } } ddxCleareSurface(CompositDC); ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].pCmdLine = res; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: //ddxDrawDisplay(res[i].iParam, 0); ddxDrawSurface(BackDC, res[i].iParam, 0); break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } RunMenuNewGameSceneActivate(res); ddxBitBltDisplay(0, 0, 1024, 768, BackDC, 0, 0); ddxCleareSurface(BackDC); //DisplayFrame(); BEGIN_MENU_NEWGAMESCENE: //NOVA CESTA //////////////////////////////////////////////////////////////////////////////////// if (bNewScene) { bNewScene = 0; // 1 = prvni animace way1_2 /*res[1].bEndActivate[0] = 10; //prvni OnAbove res[1].bEndActivate[1] = 19; //prvni OnClick res[1].bActive = 1; *///aktivace // 1 = prvni animace way1_2 res[iActualScene].bEndActivate[0] = 10 + (iActualScene - 1); //prvni OnAbove res[iActualScene].bEndActivate[1] = 19 + (iActualScene - 1); //prvni OnClick res[iActualScene].bActive = 1; //aktivace pPlayerProfile.cScene[iActualScene + 1] = 1; pr_SaveProfile(&pPlayerProfile); } //aktivace tlacitka zpet res[27].bActive = 1; res[28].bActive = 1; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION && res[i].bActive) { int iWave = AddAnimation(&res[i], p_ad, 0, 1); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); dwLTime = timeGetTime(); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE && res[i].bActive) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { ddxDrawDisplay(res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[anbind].iLayer) { ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } dim.dx = 0; dim.dy = 0; } } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK && res[i].bActive) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { key[K_ESC] = 1; cRestartMainMenu = 1; //break; } if (!strcmp(res[resid].cParam[1], "SCENE1")) { iActualScene = 1; RunStretchAnimation("scene1_map.png", 0, 129, p_ad); RunMenuSceneMap("Mmnew_game_scene1_map.txt", NULL, p_ad, cpu, "scene1_map.png", "scene1_anim", 1, 0, 11, "scene1_levels.txt", 919, 677, 0, NULL, 0, 713, 679); } if (!strcmp(res[resid].cParam[1], "SCENE2")) { iActualScene = 2; RunStretchAnimation("scene2_map.png", 215, 0, p_ad); RunMenuSceneMap("Mmnew_game_scene2_map.txt", NULL, p_ad, cpu, "scene2_map.png", "scene2_anim", 2, 11, 10, "scene2_levels.txt", 916, 8, 0, NULL, 0, 971, 703); } if (!strcmp(res[resid].cParam[1], "SCENE3")) { iActualScene = 3; RunStretchAnimation("scene3_map.png", 177, 248, p_ad); RunMenuSceneMap("Mmnew_game_scene3_map.txt", NULL, p_ad, cpu, "scene3_map.png", "scene3_anim", 3, 21, 12, "scene3_levels.txt", 918, 7, 0, NULL, 0, 973, 413); } if (!strcmp(res[resid].cParam[1], "SCENE4")) { iActualScene = 4; RunStretchAnimation("scene4_map.png", 444, 64, p_ad); RunMenuSceneMap("Mmnew_game_scene4_map.txt", NULL, p_ad, cpu, "scene4_map.png", "scene4_anim", 4, 33, 10, "scene4_levels.txt", 197, 9, 0, NULL, 0, 8, 16); } if (!strcmp(res[resid].cParam[1], "SCENE5")) { iActualScene = 5; RunStretchAnimation("scene5_map.png", 465, 386, p_ad); RunMenuSceneMap("Mmnew_game_scene5_map.txt", NULL, p_ad, cpu, "scene5_map.png", "scene5_anim", 5, 43, 10, "scene5_levels.txt", 918, 9, 0, NULL, 0, 976, 309); } if (!strcmp(res[resid].cParam[1], "SCENE6")) { iActualScene = 6; RunStretchAnimation("scene6_map.png", 37, 495, p_ad); RunMenuSceneMap("Mmnew_game_scene6_map.txt", NULL, p_ad, cpu, "scene6_map.png", "scene6_anim", 6, 53, 10, "scene6_levels.txt", 920, 8, 0, NULL, 0, 967, 211); } if (!strcmp(res[resid].cParam[1], "SCENE7")) { iActualScene = 7; RunStretchAnimation("scene7_map.png", 616, 638, p_ad); RunMenuSceneMap("Mmnew_game_scene7_map.txt", NULL, p_ad, cpu, "scene7_map.png", "scene7_anim", 7, 63, 10, "scene7_levels.txt", 11, 6, 0, NULL, 0, 8, 279); } if (!strcmp(res[resid].cParam[1], "SCENE8")) { iActualScene = 8; RunStretchAnimation("scene8_map.png", 836, 469, p_ad); RunMenuSceneMap("Mmnew_game_scene8_map.txt", NULL, p_ad, cpu, "scene8_map.png", "scene8_anim", 8, 73, 12, "scene8_levels.txt", 15, 677, 0, NULL, 0, 12, 490); } if (!strcmp(res[resid].cParam[1], "SCENE9")) { iActualScene = 9; RunStretchAnimation("scene9_map.png", 836, 49, p_ad); RunMenuSceneMap("Mmnew_game_scene9_map.txt", NULL, p_ad, cpu, "scene9_map.png", "scene9_anim", 9, 85, 10, "scene9_levels.txt", 918, 7, 0, NULL, 0, 971, 338); } resid = -1; if (!iActualScene) key[K_ESC] = 1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); ddxCleareSurface(CompositDC); cRestartMainMenu = 1; key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } void LoadSceneMap(int *pBmp, char *cSceneBmp, char *cSceneAnim, int iScene, int *iClock) { int i; char text[MAX_FILENAME]; pBmp[0] = ddxLoadBitmap(cSceneBmp, pBmpDir); for (i = 1; i < 6; i++) { sprintf(text, "%s%d.png", cSceneAnim, i); pBmp[i] = ddxLoadBitmap(text, pBmpDir); DrawClock(iClock, i); } switch (iScene) { case 1: case 2: case 3: case 4: case 7: pBmp[6] = ddxLoadBitmap("level_green.png", pBmpDir); pBmp[7] = ddxLoadBitmap("level_ok_green.png", pBmpDir); pBmp[8] = ddxLoadBitmap("b1_green.png", pBmpDir); pBmp[9] = ddxLoadBitmap("b2_green.png", pBmpDir); pBmp[10] = ddxLoadBitmap("level_green_l.png", pBmpDir); pBmp[11] = ddxLoadBitmap("level_ok_green_l.png", pBmpDir); break; case 5: case 8: pBmp[6] = ddxLoadBitmap("level_brown.png", pBmpDir); pBmp[7] = ddxLoadBitmap("level_ok_brown.png", pBmpDir); pBmp[8] = ddxLoadBitmap("b1_brown.png", pBmpDir); pBmp[9] = ddxLoadBitmap("b2_brown.png", pBmpDir); pBmp[10] = ddxLoadBitmap("level_brown_l.png", pBmpDir); pBmp[11] = ddxLoadBitmap("level_ok_brown_l.png", pBmpDir); break; case 0: pBmp[6] = ddxLoadBitmap("level_tutorial.png", pBmpDir); pBmp[7] = ddxLoadBitmap("level_ok_tutorial.png", pBmpDir); pBmp[8] = ddxLoadBitmap("b1_blue.png", pBmpDir); pBmp[9] = ddxLoadBitmap("b2_blue.png", pBmpDir); pBmp[10] = ddxLoadBitmap("level_tutorial_l.png", pBmpDir); pBmp[11] = ddxLoadBitmap("level_ok_tutorial_l.png", pBmpDir); break; case 6: case 9: case 10: case 11: pBmp[6] = ddxLoadBitmap("level_blue.png", pBmpDir); pBmp[7] = ddxLoadBitmap("level_ok_blue.png", pBmpDir); pBmp[8] = ddxLoadBitmap("b1_blue.png", pBmpDir); pBmp[9] = ddxLoadBitmap("b2_blue.png", pBmpDir); pBmp[10] = ddxLoadBitmap("level_blue_l.png", pBmpDir); pBmp[11] = ddxLoadBitmap("level_ok_blue_l.png", pBmpDir); break; case 12: pBmp[6] = ddxLoadBitmap("level_yellow.png", pBmpDir); pBmp[7] = ddxLoadBitmap("level_ok_yellow.png", pBmpDir); pBmp[8] = ddxLoadBitmap("b1_yellow.png", pBmpDir); pBmp[9] = ddxLoadBitmap("b2_yellow.png", pBmpDir); pBmp[10] = ddxLoadBitmap("level_yellow_l.png", pBmpDir); pBmp[11] = ddxLoadBitmap("level_ok_yellow_l.png", pBmpDir); break; } DrawClock(iClock, 6); } void DrawLevelHint(int x, int y, int iLevel) { int idx; char text[MAX_FILENAME]; sprintf(text, "t_%d.png", iLevel - 200); idx = ddxLoadBitmap(text, pBmpDir); if (idx == -1) return; ddxBitBlt(FontDC, x, y, ddxGetWidth(idx), ddxGetHight(idx), idx, 0, 0); ddxTransparentBlt(BackDC, x, y, ddxGetWidth(idx), ddxGetHight(idx), idx, 0, 0, ddxGetWidth(idx), ddxGetHight(idx), TRANSCOLOR); ddxReleaseBitmap(idx); } void CreateLevelButton(int x, int y, CMD_LINE * res, int *lastcmd, int *pBmp, char *cMessage, char bDone, int iDificulty, char bTuturial, int iLevel) { int ii; char text[1024]; //Draw(1,0,0) sprintf(text, "Draw(%d,%d,%d)", pBmp[6 + bDone], x, y); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; /*if(bTuturial) DrawLevelHint(x + ddxGetWidth(pBmp[6+bDone]), y, iLevel); */ //OnAbove(16,661,100,748, NO_EXEPTION, NO_EXEPTION) sprintf(text, "OnAbove(%d,%d,%d,%d, %s, NO_EXEPTION)", x, y, x + ddxGetWidth(pBmp[6 + bDone]), y + ddxGetHight(pBmp[6 + bDone]), cMessage); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; res[*lastcmd].uiTimerID = 0; res[*lastcmd].iLastfrm = 1; res[*lastcmd].iCounter = 0; res[*lastcmd].iAnim[0][0] = 0; res[*lastcmd].iAnim[0][1] = pBmp[6 + bDone]; res[*lastcmd].iAnim[0][2] = x; res[*lastcmd].iAnim[0][3] = y; res[*lastcmd].iAnim[0][4] = 0; res[*lastcmd].iAnim[0][5] = 1; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[0][ii] = -1; res[*lastcmd].iAnim[1][0] = 1; res[*lastcmd].iAnim[1][1] = pBmp[10 + bDone]; res[*lastcmd].iAnim[1][2] = x; res[*lastcmd].iAnim[1][3] = y; res[*lastcmd].iAnim[1][4] = 50; res[*lastcmd].iAnim[1][5] = 2; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[1][ii] = -1; res[*lastcmd].iAnim[2][0] = 2; res[*lastcmd].iAnim[2][1] = pBmp[10 + bDone]; res[*lastcmd].iAnim[2][2] = x; res[*lastcmd].iAnim[2][3] = y; res[*lastcmd].iAnim[2][4] = 50; res[*lastcmd].iAnim[2][5] = -1; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[2][ii] = -1; res[*lastcmd].iLayer = 1; (*lastcmd)++; if (!bTuturial) { if (!iDificulty) { //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize6.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; } else if (iDificulty == 1) { //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize7.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize8.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; } else if (iDificulty == 2) { //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize9.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; } else if (iDificulty == 3) { //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize10.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; } else { //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize11.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; //BindAnimation(118, -1, -1, -1, televize5.txt, televize.txt) sprintf(text, "BindAnimation(118, -1, -1, -1, televize12.txt, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; } //BindExitAnimation(114,115,116,117, televize.txt) sprintf(text, "BindExitAnimation(114,115,116,117, televize.txt)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); (*lastcmd)++; } /* else { //OnAbove(16,661,100,748, NO_EXEPTION, NO_EXEPTION) sprintf(text,"OnAbove(%d,%d,%d,%d, %s, NO_EXEPTION)", x, y, x + ddxGetWidth(pBmp[6+bDone]), y + ddxGetHight(pBmp[6+bDone]), cMessage); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; }*/ //OnClick(16,661,100,748, quit_gamec.txt, EXIT) sprintf(text, "OnClick(%d,%d,%d,%d, NO_EXEPTION, %s)", x, y, x + ddxGetWidth(pBmp[6 + bDone]), y + ddxGetHight(pBmp[6 + bDone]), cMessage); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; //BindSound(54,55,56,-1) strcpy(text, "BindSound(54,55,56,-1)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 0; (*lastcmd)++; } void CreateLevelButtons(CMD_LINE * res, int *lastcmd, int *pBmp, int iScene, int iLevelStart, int iNumOfLevels, char *cLevelList, char bTutorial) { char text[MAX_FILENAME]; int r[4]; int i; FILE *file; construct_path(text, MAX_FILENAME, 2, pDataDir, cLevelList); file = fopen(text, "r"); if (!file) return; for (i = iLevelStart; i < iLevelStart + iNumOfLevels; i++) { Parse_AnimLine(file, r, 4); if (bTutorial && i != iLevelStart) if (!pPlayerProfile.cLevel[i - 1]) break; CreateLevelButton(r[1], r[2], res, lastcmd, pBmp, itoa(r[0], text, 10), pPlayerProfile.cLevel[i], r[3], bTutorial, i); } fclose(file); } int LoadTV(void) { int c = 0, i = -1; char text[MAX_FILENAME]; FILE *file; construct_path(text, MAX_FILENAME, 2, pBmpDir, "tvload.txt"); file = fopen(text, "r"); if (!file) return -1; while (!feof(file)) { memset(text, 0, MAX_FILENAME); if (fgets(text, MAX_FILENAME, file) && text[0]) { newline_cut(text); if (!c) i = ddxLoadBitmap(text, pBmpDir); else ddxLoadBitmap(text, pBmpDir); c++; } } fclose(file); return i; } void CorrectTV(CMD_LINE * res, int iAnim, int iLast, int x, int y, int idx, int iScene) { int tvcoridx = -1; int i, d; switch (iScene) { case 5: case 8: tvcoridx = ddxLoadBitmap("tvcor_brown.png", pBmpDir); break; case 0: case 6: case 9: case 10: case 11: tvcoridx = ddxLoadBitmap("tvcor_blue.png", pBmpDir); break; case 12: tvcoridx = ddxLoadBitmap("tvcor_yellow.png", pBmpDir); break; } for (i = 0; i < iLast; i++) { res[iAnim].iAnim[i][2] = x; res[iAnim].iAnim[i][3] = y; res[iAnim].iAnim[i][1] += (idx - 250); d = res[iAnim].iAnim[i][1]; if (tvcoridx != -1 && res[iAnim].iAnim[i][0] != -1) ddxTransparentBlt(d, 0, 0, ddxGetWidth(d), ddxGetHight(d), tvcoridx, 0, 0, ddxGetWidth(tvcoridx), ddxGetHight(tvcoridx), TRANSCOLOR); //kprintf(1, "tv corrected to %d", res[iAnim].iAnim[i][1]); } if (tvcoridx != -1) ddxReleaseBitmap(tvcoridx); } void CreateBackButton(CMD_LINE * res, int *lastcmd, int sidx1, int sidx2, int xBack, int yBack) { int lcmd = *lastcmd; int i, ii; for (i = 0; i < lcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { res[i].uiTimerID = 0; res[i].iLastfrm = 1; res[i].iCounter = 0; /* (0, 123, 0, 640, 0, 1) (1, 124, 0, 640, 25, 2) (2, 124, 0, 640, 25, -1) */ res[i].iAnim[0][0] = 0; res[i].iAnim[0][1] = sidx1; res[i].iAnim[0][2] = xBack; res[i].iAnim[0][3] = yBack; res[i].iAnim[0][4] = 0; res[i].iAnim[0][5] = 1; for (ii = 6; ii < 13; ii++) res[i].iAnim[0][ii] = -1; res[i].iAnim[1][0] = 1; res[i].iAnim[1][1] = sidx2; res[i].iAnim[1][2] = xBack; res[i].iAnim[1][3] = yBack; res[i].iAnim[1][4] = 50; res[i].iAnim[1][5] = 2; for (ii = 6; ii < 13; ii++) res[i].iAnim[1][ii] = -1; res[i].iAnim[2][0] = 2; res[i].iAnim[2][1] = sidx2; res[i].iAnim[2][2] = xBack; res[i].iAnim[2][3] = yBack; res[i].iAnim[2][4] = 50; res[i].iAnim[2][5] = -1; for (ii = 6; ii < 13; ii++) res[i].iAnim[2][ii] = -1; res[i].iLayer = 0; return; } } void DrawClock(int *iClock, int i) { if (iClock[i] == -1) return; spracuj_spravy(0); ddxSetCursorSurface(iClock[i]); ddxUpdateMouse(); DisplayFrame(); } int LoadClock(int *iClock) { int c = 0, i = -1, t; char text[MAX_FILENAME]; FILE *file; construct_path(text, MAX_FILENAME, 2, pBmpDir, "loadclock.txt"); file = fopen(text, "r"); if (!file) return -1; while (!feof(file)) { ZeroMemory(text, MAX_FILENAME); if (!fgets(text, MAX_FILENAME, file) || !text[0]) break; newline_cut(text); if (!c) { i = ddxLoadBitmap(text, pBmpDir); iClock[c] = i; } else { t = ddxLoadBitmap(text, pBmpDir); iClock[c] = t; } c++; } fclose(file); return i; } /*void MenuInitHint(char bTutorial) { if(bTutorial) _2d_hint.iSurface = ddxLoadBitmap("hint_frame.png", pBmpDir); else _2d_hint.iSurface = -1; _2d_hint.iBSurface = -1; } void DrawHint(int x, int y) { RECT r; if(_2d_hint.iSurface == -1) return; _2d_hint.iBSurface = ddxCreateSurface(ddxGetWidth(_2d_hint.iSurface), ddxGetHight(_2d_hint.iSurface), ddxFindFreeSurface()); if(_2d_hint.iBSurface == -1) return; if(x + ddxGetWidth(_2d_hint.iSurface) > 1014) x = 1014 - ddxGetWidth(_2d_hint.iSurface); _2d_hint.x = x; _2d_hint.y = y; ddxBitBlt(_2d_hint.iBSurface, 0, 0, ddxGetWidth(_2d_hint.iBSurface), ddxGetHight(_2d_hint.iBSurface), HDC2DD, x, y); ddxBitBlt(CompositDC, x, y, ddxGetWidth(_2d_hint.iSurface), ddxGetHight(_2d_hint.iSurface), _2d_hint.iSurface, 0, 0); ddxBitBltDisplay(x, y, ddxGetWidth(_2d_hint.iSurface), ddxGetHight(_2d_hint.iSurface), _2d_hint.iSurface, 0, 0); r.left = x; r.top = y; r.right = ddxGetWidth(_2d_hint.iSurface); r.bottom = ddxGetHight(_2d_hint.iSurface); _2d_Add_RectItem(&rline, r, 2); _2d_hint.bUsed = 1; } void SetHintRect(void) { RECT r; if(!_2d_hint.bUsed) return; r.left = _2d_hint.x; r.top = _2d_hint.y; r.right = ddxGetWidth(_2d_hint.iSurface); r.bottom = ddxGetHight(_2d_hint.iSurface); _2d_Add_RectItem(&rline, r, 2); } void UpdateHintBackup(void) { if(!_2d_hint.bUsed) return; if(_2d_hint.iSurface == -1) return; ddxBitBlt(CompositDC, _2d_hint.x, _2d_hint.y, ddxGetWidth(_2d_hint.iSurface), ddxGetHight(_2d_hint.iSurface), _2d_hint.iSurface, 0, 0); } void ReleaseHint(char bFull, char bRestore) { if(_2d_hint.iSurface != -1 && bFull) { ddxReleaseBitmap(_2d_hint.iSurface); _2d_hint.iSurface = -1; } if(_2d_hint.iBSurface != -1) { if(bRestore) { RECT r; r.left = _2d_hint.x; r.top = _2d_hint.y; r.right = r.left + ddxGetWidth(_2d_hint.iBSurface); r.bottom = r.top + ddxGetHight(_2d_hint.iBSurface); ddxFillRect(CompositDC, &r, RGB(255, 0, 255)); ddxBitBltDisplay(_2d_hint.x, _2d_hint.y, ddxGetWidth(_2d_hint.iBSurface), ddxGetHight(_2d_hint.iBSurface), _2d_hint.iBSurface, 0, 0); } ddxReleaseBitmap(_2d_hint.iBSurface); _2d_hint.iBSurface = -1; } _2d_hint.bUsed = 0; } */ void RunMenuSceneMap(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu, char *cSceneBmp, char *cSceneAnim, int iScene, int iLevelStart, int iNumOfLevels, char *cLevelList, int xTV, int yTV, char bLoadGame, char *cSaveFile, char bTutorial, int xBack, int yBack) { DWORD dwEplased = 0, dwStart, dwStop; FILE *file; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int iBmp[12]; int iTV = -1; int iClock[12]; int cc = 0; char cscenemap[64]; char csceneanim[64]; char csrriptname[64]; char cscenelevels[64]; char bReload = 0; char dir[MAX_FILENAME]; char filename[MAX_FILENAME]; ZeroMemory(&_2d_hint, sizeof(_2D_HINT)); for (i = 0; i < 12; i++) iClock[i] = -1; pPlayerProfile.cScene[iScene] = 1; pr_SaveProfile(&pPlayerProfile); ////////////////////////////LOAD GAME///////////////////////////////////////// if (bLoadGame) { sprintf(dir, "%s.lv6", cSaveFile); if (RunLevel(NULL, p_ad, cpu, dir, "LOAD_GAME") == 1) { pPlayerProfile.cLevel[iActualLevel] = 1; pr_SaveProfile(&pPlayerProfile); } for (i = 0; i < 32; i++) anm[i].cmd = NULL; //TODO - pokud se jedna o tutorial, detskou ci custom, tak to crushne .... proc? } ////////////////////////////LOAD GAME///////////////////////////////////////// if (!bLoadGame) { LoadClock(iClock); if (iClock[0] != -1) { ddxResizeCursorBack(iClock[0]); DrawClock(iClock, 0); } } for (i = 0; i < 12; i++) iBmp[i] = -1; bBackDC = 0; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); BRUTAL_RESTART_SCENE_MAP_MENU: bReload = 1; bBackDC = 0; _2d_Clear_RectLine(&rline); ddxSetFlip(TRUE); cc = 0; iTV = -1; anmid = -1; resid = -1; anbind = -1; ZeroMemory(res, RES_NUM * sizeof(CMD_LINE)); GetRunMenuNewGameSceneLoadGame(csrriptname, cscenemap, csceneanim, cscenelevels, &iLevelStart, &iNumOfLevels, &xTV, &yTV, &bTutorial, &xBack, &yBack); LoadSceneMap(iBmp, cscenemap, csceneanim, iActualScene, iClock); ddxCleareSurface(CompositDC); ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].pCmdLine = res; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } //natadhe skript menu LoadMenuScript(csrriptname, res, &lastcmd); DrawClock(iClock, 7); in = 0; ddxBitBlt(BackDC, 0, 0, 1024, 768, iBmp[0], 0, 0); CreateLevelButtons(res, &lastcmd, iBmp, iActualScene, iLevelStart, iNumOfLevels, cscenelevels, bTutorial); DrawClock(iClock, 8); if (!bTutorial) { iTV = LoadTV(); if (iTV == -1) kprintf(1, "Saaakra ... neporalo se nahrat bmpka televize"); } DrawClock(iClock, 9); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) ddxDrawSurface(BackDC, res[i].iParam, 0); else { ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove construct_path(filename, MAX_FILENAME, 2, pDataDir, res[i].cParam[0]); file = fopen(filename, "r"); if (file) { while (1) { Parse_AnimLine(file, res[i].iAnim[lastanm], 18); if (!cc) res[i].iAnim[lastanm][1] = iBmp[res[i].iAnim[lastanm][1]]; if (feof(file)) break; else lastanm++; } if (!cc) res[i].iLayer = 10; else if (!bTutorial) CorrectTV(res, i, lastanm, xTV, yTV, iTV, iActualScene); fclose(file); } cc++; break; } } DrawClock(iClock, 10); CreateBackButton(res, &lastcmd, iBmp[8], iBmp[9], xBack, yBack); // MenuInitHint(bTutorial); ddxResizeCursorBack(0); ddxSetCursorSurface(0); for (i = 0; i < 12; i++) if (iClock[i] != -1) { ddxReleaseBitmap(iClock[i]); iClock[i] = -1; } ddxBitBltDisplay(0, 0, 1024, 768, BackDC, 0, 0); ddxCleareSurface(BackDC); //BEGIN_MENU_NEWGAMESCENE: for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { if (res[lastabv].iAnim[0][0] != -1) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { ddxDrawDisplay(res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } // ReleaseHint(0, 1); } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); /* if(bTutorial) DrawHint(res[lastabv].iAnim[0][2], res[lastabv].iAnim[0][3] - 35);*/ } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (res[i].iAnim[0][0] != -1) { if (!res[i].iLayer) { ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[anbind].iLayer) { ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); // ReleaseHint(0, 1); } //dim.dx = 0; //dim.dy = 0; } } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { key[K_ESC] = 1; cRestartMainMenu = 1; //break; } else { char cLevel[MAX_FILENAME]; iActualLevel = iLevelStart + atoi(res[resid].cParam[1]) - 1; // ReleaseHint(1, 0); kprintf(1, "Kliknuto na level : %s", res[resid].cParam[1]); sprintf(cLevel, "level%d.lv6", iActualLevel); if (RunLevel(NULL, p_ad, cpu, cLevel, "RUN_LEVEL") == 1) { pPlayerProfile.cLevel[iActualLevel] = 1; pr_SaveProfile(&pPlayerProfile); } for (i = 0; i < 32; i++) anm[i].cmd = NULL; bReload = 0; if (bNewScene) key[K_ESC] = 1; else goto BRUTAL_RESTART_SCENE_MAP_MENU; } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); StopAll(); if (bReload) { for (i = 0; i < 12; i++) ddxReleaseBitmap(iBmp[i]); if (!bTutorial) for (i = iTV; i < iTV + 91; i++) ddxReleaseBitmap(i); } ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); ddxCleareSurface(CompositDC); cRestartMainMenu = 1; key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } void RunMenuDuplicate(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu) { DWORD dwEplased = 0, dwStart, dwStop; RECT r; int idx = 0; int hdcBT = 0; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; int lastcmd, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int iNadpisDC = -1; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); //kprintf(1, "bitblt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); //kprintf(1, "load"); in = 0; fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); //kprintf(1, "fn_Set_Font"); CreateFontAnimations(res, &lastcmd); DrawMenu(&idx, &hdcBT, res, lastcmd); r.left = 299; r.top = 209; r.right = 743; r.bottom = 359; co_Set_Text_Center(BackDC, "##menu_duplicate", 0, r); iNadpisDC = ddxCreateSurface(r.right - r.left, r.bottom - r.top, ddxFindFreeSurface()); ddxBitBlt(iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), BackDC, r.left, r.top); fn_Release_Font(1); BEGIN_MENU_DUPLICATE: bBackDC = 1; ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); DisplayFrame(); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); ddxDrawDisplay(res[lastabv].iAnim[0], 0); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[i].iAnim[0]); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[anbind].iAnim[0]); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } //co_Handle_Controls(citem, CLIST_ITEMC, mi.x, mi.y); //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (cBrutalRestart || !strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "OK")) key[K_ESC] = 1; if (!cBrutalRestart) { for (i = 0; i < lastcmd; i++) { switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iParam); } else { ddxDrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; } } ddxTransparentBltDisplay(r.left, r.top, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), TRANSCOLOR); ddxTransparentBlt(BackDC, r.left, r.top, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), TRANSCOLOR); } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } /*spracuj_spravy(0); ddxUpdateMouse(); if(dim.dx || dim.dy) DisplayFrame(); */ dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: //BitBltU(FontDC, 0, 0, 1024, 768, NULL, 0, 0, WHITENESS); ddxCleareSurface(FontDC); //TransparentBltU(_2dd.hDC, 0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, RGB(255, 0, 255)); if (!cBrutalRestart) ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); //BitBltU(BackDC, 0, 0, 1024, 768, NULL, 0, 0, WHITENESS); ddxCleareSurface(BackDC); bBackDC = 0; /*BitBlt(_2dd.hDC, res[idx].iParam[2], res[idx].iParam[3], _2dd.bitmap[res[idx].iParam[1]].bitmap.bmWidth, _2dd.bitmap[res[idx].iParam[1]].bitmap.bmHeight, hdcBT, 0, 0, SRCCOPY); */ if (!cBrutalRestart) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxTransparentBlt(BackDC, res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), res[idx].iParam[1], 0, 0, ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), TRANSCOLOR); ddxReleaseBitmap(hdcBT); ddxReleaseBitmap(iNadpisDC); } ddxCleareSurface(CompositDC); //fn_Release_Font(); //co_Handle_Release(citem, CLIST_ITEMC); //co_Release_Graphic(); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } int RunMenuNewGame(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu) { DWORD dwEplased = 0, dwStart, dwStop; int c = 0; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; // FILE *file; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; char bDone = 0; int inumofitems = 0; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); bBackDC = 0; ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); //kprintf(1, "bitblt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return 1; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; START: fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); CreateFontAnimations(res, &lastcmd); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: { if (!c) { RECT rr; ddxTransparentBlt(BackDC, res[i].iParam[2], res[i].iParam[3], ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), res[i].iParam[1], 0, 0, ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), TRANSCOLOR); rr.left = res[i].iParam[2]; rr.top = res[i].iParam[3]; rr.right = ddxGetWidth(res[i].iParam[1]); rr.bottom = ddxGetHight(res[i].iParam[1]); _2d_Add_RectItem(&rline, rr, 0); } else ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); c++; } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } if (co_Load_Graphic(1)) { int xx, sel = -1; RECT r; r.left = 299; r.top = 209; r.right = 743; r.bottom = 359; co_Set_Text_Center(BackDC, "##mainmenu_player_name", 0, r); r.top = 359; r.bottom = 509; co_Set_Text_Center(BackDC, "##mainmenu_new_player_name", 0, r); fn_Release_Font(1); fn_Set_Font(cFontDir[2]); fn_Load_Bitmaps(); citem[0].p_edit = co_Create_Edit(BackDC, 360, 470, 0); citem[0].bActive = 1; citem[1].p_combo = co_Create_Combo(BackDC, 360, 320, 100, 0); citem[1].bActive = 1; xx = FillComboProfiles(citem[1].p_combo, &sel); if (xx > 5) co_Combo_Set_Params(citem[1].p_combo, 5); else co_Combo_Set_Params(citem[1].p_combo, xx); kprintf(1, "set_sel %d", sel); co_Combo_Set_Sel(BackDC, citem[1].p_combo, sel); inumofitems = xx; if (!inumofitems) citem[0].p_edit->bActive = 1; } ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); bBackDC = 1; BEGIN_MENU_NEWGAME: for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!bDone) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) { for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { ddxDrawDisplay(res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } } } dim.dx = 0; dim.dy = 0; } co_Handle_Controls(citem, CLIST_ITEMC, dim.x, dim.y, BackDC, 0, 0); //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_ONCLICK) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } } } dim.t1 = 0; } //provedeni akce po animaci menu if (click || key[K_ENTER]) if (!anm[anmid].cmd || key[K_ENTER]) { click = 0; if (key[K_ENTER]) goto MENU_ENTER; if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { bDone = 1; } if (!strcmp(res[resid].cParam[1], "OK")) { int c; WCHAR *pName; MENU_ENTER: c = 0; pName = co_Edit_Get_Text(citem[0].p_edit); key[K_ENTER] = 0; if (!wcslen(pName)) { int iComboActSel = co_Combo_Get_Sel_Not_Opend(citem, CLIST_ITEMC, 0); kprintf(1, "%d", iComboActSel); if (iComboActSel != -1) { if (citem[1].p_combo->pItem) { if (citem[1].p_combo->pItem[iComboActSel].text) { if (pr_ReadProfile(citem[1].p_combo->pItem[iComboActSel].text, &pPlayerProfile)) { WritePrivateProfileString("game", "last_profile",citem[1].p_combo->pItem[iComboActSel].text, ini_file); c++; } } } } } else { int ret = pr_CreateProfile(pName); if (ret > 0) { ddxCleareSurface(FontDC); FreeAnimations(res, RES_NUM); RunMenuDuplicate("Mmduplicate.txt", hWnd, p_ad, cpu); ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); co_Handle_Release(citem, CLIST_ITEMC); co_Release_Graphic(); goto START; } else if (ret == 0) c++; } if (c) { iActualScene = 1; bDone = 1; } } resid = -1; if (bDone) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: ddxCleareSurface(FontDC); ddxCleareSurface(CompositDC); bBackDC = 0; ddxCleareSurface(BackDC); fn_Release_Font(1); co_Handle_Release(citem, CLIST_ITEMC); co_Release_Graphic(); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); return 0; } char check_profile(char *p_name) { WCHAR wc[128]; MultiByteToWideChar(CP_ACP, 0, p_name, strlen(p_name) + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!wcscmp(pPlayerProfile.cName, wc)) return 1; else return 0; } int compare(const void *arg1, const void *arg2) { LIST_ITEM_ *pP1 = (LIST_ITEM_ *) arg1; LIST_ITEM_ *pP2 = (LIST_ITEM_ *) arg2; return pP2->timespamp - pP1->timespamp; } #ifdef LINUX int FillStringList(char *cmask, LIST_ITEM_ ** list, int *isize) { struct dirent **namelist; int i; struct stat sb; file_filter_mask(cmask); int c = scandir(".", &namelist, &file_filter, alphasort); if (c < 0) { (*isize) = 0; return 0; } (*list) = (LIST_ITEM_ *) mmalloc(c * sizeof(LIST_ITEM_)); for(i = 0; i < c; i++) { strcpy((*list)[i].text, namelist[i]->d_name); (*list)[i].timespamp = !stat(namelist[i]->d_name, &sb) ? sb.st_mtime : 0; free(namelist[i]); } free(namelist); qsort((*list), c, sizeof(LIST_ITEM_), compare); (*isize) = c; return c; } #endif int FillComboProfiles(COMBO_CONTROL * p_co, int *iSel) { int retsel = 0; char cprofile[MAX_FILENAME]; char dir[MAX_FILENAME]; WCHAR wName[MAX_FILENAME]; PLAYER_PROFILE Profile; int c = 0; int x = 0; LIST_ITEM_ *list; int isize; strcpy(dir, PROFILE_DIR); if (chdir(dir)) return 0; GetPrivateProfileString("game", "last_profile", "/", cprofile, MAX_FILENAME, ini_file); FillStringList("*.prf", &list, &isize); if (!isize) return 0; for (c = 0; c < isize; c++) { ZeroMemory(wName, MAX_FILENAME * sizeof(WCHAR)); if (pr_GetPlayerName(list[c].text, wName)) { co_Combo_Add_StringWC2(p_co, wName, list[c].text); if ((*iSel) == -1) //new game -> nastavit profil, kterej byl hran naposed { if (!strcmp(cprofile, list[c].text)) { retsel = x; pr_ReadProfile(list[c].text, &Profile); } } if (!x) pr_ReadProfile(list[c].text, &Profile); x++; } } memcpy(&pPlayerProfile, &Profile, sizeof(PLAYER_PROFILE)); *iSel = retsel; if ((*iSel) < 0) (*iSel) = 0; free((void *) list); return x; } int check_Save_Owner(char *cDir, WCHAR * wFileName) { char text[MAX_FILENAME]; FILE *file; PLAYER_PROFILE pProfile; LEVEL_HEADER l_h; char dir[MAX_FILENAME + 1]; WCHAR wdir[256 + 1]; int ver; if (getcwd(dir, MAX_FILENAME) == NULL) return 0; if (chdir(cDir)) return 0; ZeroMemory(&pProfile, sizeof(PLAYER_PROFILE)); strcpy(text, cDir); strcat(text, ".lvc"); file = fopen(text, "rb"); if (!file) { /* GCC warns when we don't check the return value of chdir(). For some reason, casting to (void) doesn't work. */ if (chdir(dir)) return 0; return 0; } if (fread(&pProfile, sizeof(PLAYER_PROFILE), 1, file) != 1 || fread(wFileName, 32 * sizeof(WCHAR), 1, file) != 1 || fread(&ver, sizeof(int), 1, file) != 1) { fclose(file); return 0; } if (ver != SAVE_VER) { fclose(file); return 0; } if (fread(wdir, (256 + 1) * sizeof(WCHAR), 1, file) != 1 || fread(&l_h, sizeof(LEVEL_HEADER), 1, file) != 1) { fclose(file); return 0; } fclose(file); if (chdir(dir)) return 0; if (wcscmp(pPlayerProfile.cName, pProfile.cName)) return 0; return 1; } int FillListLoad(LIST_VIEW_CONTROL * p_li, char *mask, char bAdd, int LoadGame) { WCHAR wFile[MAX_FILENAME]; int x = 0; int c = 0; LIST_ITEM_ *list; int isize; if (chdir(SAVE_DIR)) return 0; FillStringList(mask, &list, &isize); if (!isize) return 0; for (c = 0; c < isize; c++) { ZeroMemory(wFile, MAX_FILENAME * sizeof(WCHAR)); if (!LoadGame) { if (!demo_Check_Owner(pPlayerProfile.cName, list[c].text, wFile)) continue; } else if (!check_Save_Owner(list[c].text, wFile)) continue; if (bAdd) co_List_Add_StringWC2(p_li, x, 2, wFile, list[c].text, x, 0); x++; } free((void *) list); return x; } void CreateLevelCommandLine(char *cLevel, char *cLine) { sprintf(cLine, "%s.lv6 fp:%s", cLevel, cLevel); } // Remove a file or directory recursively. int RecursiveRemove(char *cFile) { struct stat sb; if (lstat(cFile, &sb)) return 1; if (S_ISDIR(sb.st_mode)) { DIR *dir; struct dirent *ent; int ret = 0; int errno_save; char old_dir[MAX_FILENAME]; // It's a directory; remove each of it's files recursively. if (!getcwd(old_dir, MAX_FILENAME) || chdir(cFile)) return 1; dir = opendir("."); if (!dir) return 1; errno = 0; while ((ent = readdir(dir))) { if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) continue; ret = RecursiveRemove(ent->d_name); if (ret) break; errno = 0; } ret = chdir(old_dir) || ret; errno_save = errno; if (closedir(dir)) return 1; errno = errno_save; if (ret) return ret; if (errno) return 1; // We've emptied out the directory; now unlink it. if (rmdir(cFile)) return 1; } else { // It's not a directory; unlink it. if (unlink(cFile)) return 1; } return 0; } void RunMenuConfirmDelete(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu, char *cSaveFile) { DWORD dwEplased = 0, dwStart, dwStop; RECT r; int idx = 0; int hdcBT = 0; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; int lastcmd, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int iNadpisDC = -1; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); //kprintf(1, "bitblt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); //kprintf(1, "load"); in = 0; fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); //kprintf(1, "fn_Set_Font"); CreateFontAnimations(res, &lastcmd); DrawMenu(&idx, &hdcBT, res, lastcmd); r.left = 299; r.top = 209; r.right = 743; r.bottom = 359; co_Set_Text_Center(BackDC, "##menu_delete", 0, r); iNadpisDC = ddxCreateSurface(r.right - r.left, r.bottom - r.top, ddxFindFreeSurface()); ddxBitBlt(iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), BackDC, r.left, r.top); fn_Release_Font(1); BEGIN_MENU_DELETE: bBackDC = 1; ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); DisplayFrame(); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); ddxDrawDisplay(res[lastabv].iAnim[0], 0); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[i].iAnim[0]); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[anbind].iAnim[0]); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } //co_Handle_Controls(citem, CLIST_ITEMC, mi.x, mi.y); //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) key[K_ESC] = 1; if (!strcmp(res[resid].cParam[1], "OK")) { char dir[MAX_FILENAME]; key[K_ESC] = 1; if (!getcwd(dir, MAX_FILENAME) || chdir(SAVE_DIR)) goto __QUIT; RecursiveRemove(cSaveFile); if (chdir(dir)) goto __QUIT; } if (cBrutalRestart) key[K_ESC] = 1; if (!cBrutalRestart) { for (i = 0; i < lastcmd; i++) { switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iParam); } else { ddxDrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; } } ddxTransparentBltDisplay(r.left, r.top, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), TRANSCOLOR); ddxTransparentBlt(BackDC, r.left, r.top, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), TRANSCOLOR); } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } /*spracuj_spravy(0); ddxUpdateMouse(); if(dim.dx || dim.dy) DisplayFrame(); */ dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: //BitBltU(FontDC, 0, 0, 1024, 768, NULL, 0, 0, WHITENESS); ddxCleareSurface(FontDC); //TransparentBltU(_2dd.hDC, 0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, RGB(255, 0, 255)); if (!cBrutalRestart) ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); //BitBltU(BackDC, 0, 0, 1024, 768, NULL, 0, 0, WHITENESS); ddxCleareSurface(BackDC); bBackDC = 0; /*BitBlt(_2dd.hDC, res[idx].iParam[2], res[idx].iParam[3], _2dd.bitmap[res[idx].iParam[1]].bitmap.bmWidth, _2dd.bitmap[res[idx].iParam[1]].bitmap.bmHeight, hdcBT, 0, 0, SRCCOPY); */ if (!cBrutalRestart) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxTransparentBlt(BackDC, res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), res[idx].iParam[1], 0, 0, ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), TRANSCOLOR); ddxReleaseBitmap(hdcBT); ddxReleaseBitmap(iNadpisDC); } ddxCleareSurface(CompositDC); //fn_Release_Font(); //co_Handle_Release(citem, CLIST_ITEMC); //co_Release_Graphic(); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } int RunMenuLoadGameLoad(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu, int LoadGame) { DWORD dwEplased = 0, dwStart, dwStop; int idx = 0; int hdcBT = 0; RECT r; LIST_VIEW_CONTROL *p_li; PLAYER_PROFILE pOldProfile; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; int lastcmd, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int xx; //int sel = 0; int loaded = 0; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); ddxCleareSurface(FontDC); bBackDC = 0; memcpy(&pOldProfile, &pPlayerProfile, sizeof(PLAYER_PROFILE)); //kprintf(1, "bitblt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return 0; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); //kprintf(1, "load"); in = 0; BEGIN_MENU: fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); //kprintf(1, "fn_Set_Font"); CreateFontAnimations(res, &lastcmd); //fn_Release_Font(); //kprintf(1, "CreateFontAnimations"); DrawMenu(&idx, &hdcBT, res, lastcmd); //co_Load_Graphic(1); //co_List_Redraw(Ltmp1DC, llcitem[1].p_list, 0); if (!co_Load_Graphic(1)) assert(0); r.left = 299; r.top = 209; r.right = 743; r.bottom = 359; if (LoadGame) co_Set_Text_Center(BackDC, "##menu_loadgame", 0, r); else co_Set_Text_Center(BackDC, "##menu_playdemo", 0, r); fn_Release_Font(1); fn_Set_Font(cFontDir[2]); fn_Load_Bitmaps(); /* citem[0].p_combo = co_Create_Combo(BackDC, 360, 320, 100, 0); citem[0].bActive = 1; xx = FillComboProfiles(citem[0].p_combo, &sel); if(xx > 5) co_Combo_Set_Params(citem[0].p_combo, 5); else co_Combo_Set_Params(citem[0].p_combo, xx); co_Combo_Set_Sel(BackDC, citem[0].p_combo, sel);*/ if (LoadGame) xx = FillListLoad(NULL, "*", 0, LoadGame); else xx = FillListLoad(NULL, "*.dem", 0, LoadGame); if (xx < 7) xx = 7; citem[1].p_list = co_Create_List(BackDC, 360, 320, 320, 200, 0, xx, 1); FillListLoad(citem[1].p_list, "*", 1, LoadGame); co_List_Redraw(BackDC, citem[1].p_list, 0); citem[1].bActive = 1; fn_Release_Font(1); bBackDC = 1; ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawDisplay(res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[i].iAnim[0]); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[anbind].iAnim[0]); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } co_Handle_Controls(citem, CLIST_ITEMC, dim.x, dim.y, BackDC, 0, 0); //////////////LOAD LEVEL/DEMO /////////////////////////////////////////////////// if (co_List_Get_Dbclck(citem, CLIST_ITEMC, 0, &p_li) == 1) { if (p_li->piValue[p_li->cSelected].cValue) if (strlen(p_li->piValue[p_li->cSelected].cValue)) { //citem[0].bActive = 0; citem[1].bActive = 0; loaded = 1; if (LoadGame) //LOAD GAME { //fn_Release_Font(1); StopAll(); RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 1, p_li->piValue[p_li->cSelected].cValue, 0); //fn_Set_Font("font_system.pak"); //fn_Load_Bitmaps(); key[K_ESC] = 1; } else //LOAD DEMO { char ctext[MAX_FILENAME]; CreateLevelCommandLine(p_li->piValue[p_li->cSelected].cValue, ctext); demo_Set_Scene_Level(p_li->piValue[p_li->cSelected].cValue, &iActualScene, &iActualLevel); RunLevel(NULL, p_ad, cpu, ctext, "LOAD_DEMO"); for (i = 0; i < 32; i++) anm[i].cmd = NULL; key[K_ESC] = 1; } p_li->bDblClck = 0; p_li->bClck = 0; } } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_ONCLICK) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "CANCEL")) { memcpy(&pPlayerProfile, &pOldProfile, sizeof(PLAYER_PROFILE)); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "EXIT")) key[K_ESC] = 1; if (p_li->cClckSel != -1 && p_li->piValue[p_li->cClckSel].cValue && strlen(p_li->piValue[p_li->cClckSel].cValue)) { if (!strcmp(res[resid].cParam[1], "OK")) { citem[0].bActive = 0; citem[1].bActive = 0; loaded = 1; if (LoadGame) //LOAD GAME { //fn_Release_Font(1); StopAll(); RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 1, p_li->piValue[p_li->cClckSel].cValue, 0); //fn_Set_Font("font_system.pak"); //fn_Load_Bitmaps(); key[K_ESC] = 1; } else //LOAD DEMO { char ctext[MAX_FILENAME]; CreateLevelCommandLine(p_li->piValue[p_li->cClckSel].cValue, ctext); demo_Set_Scene_Level(p_li->piValue[p_li->cClckSel].cValue, &iActualScene, &iActualLevel); RunLevel(NULL, p_ad, cpu, ctext, "LOAD_DEMO"); for (i = 0; i < 32; i++) anm[i].cmd = NULL; key[K_ESC] = 1; } p_li->bDblClck = 0; p_li->bClck = 0; } else if (!strcmp(res[resid].cParam[1], "DELETE")) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxReleaseBitmap(hdcBT); ddxCleareSurface(FontDC); FreeAnimations(res, RES_NUM); RunMenuConfirmDelete("Mmdelete_conf.txt", NULL, p_ad, cpu, p_li->piValue[p_li->cClckSel].cValue); ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); co_Handle_Release(citem, CLIST_ITEMC); co_Release_Graphic(); goto BEGIN_MENU; } } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: if (!cBrutalRestart) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxTransparentBlt(BackDC, res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), res[idx].iParam[1], 0, 0, ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), TRANSCOLOR); ddxReleaseBitmap(hdcBT); ddxCleareSurface(FontDC); co_Handle_Release(citem, CLIST_ITEMC); co_Release_Graphic(); } key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); return loaded; } void RunMenuLoadGame(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu) { DWORD dwEplased = 0, dwStart, dwStop; RECT r; int idx = 0; int hdcBT = 0; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; int lastcmd, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int iNadpisDC = -1; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); //kprintf(1, "bitblt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); //kprintf(1, "load"); in = 0; fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); //kprintf(1, "fn_Set_Font"); CreateFontAnimations(res, &lastcmd); DrawMenu(&idx, &hdcBT, res, lastcmd); r.left = 299; r.top = 209; r.right = 743; r.bottom = 359; co_Set_Text_Center(BackDC, "##menu_lgametitle", 0, r); iNadpisDC = ddxCreateSurface(r.right - r.left, r.bottom - r.top, ddxFindFreeSurface()); ddxBitBlt(iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), BackDC, r.left, r.top); fn_Release_Font(1); BEGIN_MENU_LOAD: bBackDC = 1; ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); DisplayFrame(); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); ddxDrawDisplay(res[lastabv].iAnim[0], 0); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[i].iAnim[0]); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[anbind].iAnim[0]); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } //co_Handle_Controls(citem, CLIST_ITEMC, mi.x, mi.y); //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { int do_load = 0; click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { key[K_ESC] = 1; //break; } if (!strcmp(res[resid].cParam[1], "LOAD_GAME_LOAD")) do_load = 2; else if (!strcmp(res[resid].cParam[1], "LOAD_GAME_DEMO")) do_load = 1; if (do_load && !RunMenuLoadGameLoad("Mmload_game_load.txt", NULL, p_ad, cpu, do_load - 1)) { // Redraw the menu. ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxReleaseBitmap(hdcBT); DrawMenu(&idx, &hdcBT, res, lastcmd); } if (cBrutalRestart) key[K_ESC] = 1; if (!cBrutalRestart) { for (i = 0; i < lastcmd; i++) { switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iParam); } else { ddxDrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; } } ddxTransparentBltDisplay(r.left, r.top, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), TRANSCOLOR); ddxTransparentBlt(BackDC, r.left, r.top, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), iNadpisDC, 0, 0, ddxGetWidth(iNadpisDC), ddxGetHight(iNadpisDC), TRANSCOLOR); } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } /*spracuj_spravy(0); ddxUpdateMouse(); if(dim.dx || dim.dy) DisplayFrame(); */ dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: //BitBltU(FontDC, 0, 0, 1024, 768, NULL, 0, 0, WHITENESS); ddxCleareSurface(FontDC); //TransparentBltU(_2dd.hDC, 0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, RGB(255, 0, 255)); if (!cBrutalRestart) ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); //BitBltU(BackDC, 0, 0, 1024, 768, NULL, 0, 0, WHITENESS); ddxCleareSurface(BackDC); bBackDC = 0; /*BitBlt(_2dd.hDC, res[idx].iParam[2], res[idx].iParam[3], _2dd.bitmap[res[idx].iParam[1]].bitmap.bmWidth, _2dd.bitmap[res[idx].iParam[1]].bitmap.bmHeight, hdcBT, 0, 0, SRCCOPY); */ if (!cBrutalRestart) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxTransparentBlt(BackDC, res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), res[idx].iParam[1], 0, 0, ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), TRANSCOLOR); ddxReleaseBitmap(hdcBT); ddxReleaseBitmap(iNadpisDC); } ddxCleareSurface(CompositDC); //fn_Release_Font(); //co_Handle_Release(citem, CLIST_ITEMC); //co_Release_Graphic(); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } void RunMenuCibron(char *cBmp) { int idx = ddxCreateSurface(1024, 768, ddxFindFreeSurface()); int cib; if (idx == -1) return; ddxBitBlt(idx, 0, 0, 1024, 768, HDC2DD, 0, 0); cib = ddxLoadBitmap(cBmp, pBmpDir); if (cib == -1) { ddxReleaseBitmap(idx); return; } ddxBitBltDisplay(0, 0, 1024, 768, cib, 0, 0); DisplayFrame(); while (!key[0] && !dim.t1 && !dim.t2) { spracuj_spravy(0); ddxUpdateMouse(); DisplayFrame(); Sleep(10); } dim.tf1 = 0; dim.tf2 = 0; dim.t1 = 0; dim.t2 = 0; memset(key, 0, POCET_KLAVES * sizeof(int)); ddxBitBlt(HDC2DD, 0, 0, 1024, 768, idx, 0, 0); ddxReleaseBitmap(idx); ddxReleaseBitmap(cib); } void RunMenuCinemax(void) { int c = 0; int cib; cib = ddxLoadBitmap("cinemax.png", pBmpDir); if (cib == -1) return; ddxSetCursor(0); ddxSetFlip(0); ddxBitBltDisplay(0, 0, 1024, 768, cib, 0, 0); DisplayFrame(); ddxBitBltDisplay(0, 0, 1024, 768, cib, 0, 0); while (!key[0] && !dim.t1 && !dim.t2) { Sleep(10); c += 10; if (c > 1000) break; } dim.tf1 = 0; dim.tf2 = 0; dim.t1 = 0; dim.t2 = 0; memset(key, 0, POCET_KLAVES * sizeof(int)); ddxReleaseBitmap(cib); ddxSetCursor(1); ddxSetFlip(1); } void RunMenuDrawVersion(int iSurface) { co_Set_Text_RightWC(HDC2DD, VERSION, 0, 1024, 0); co_Set_Text_RightWC(iSurface, VERSION, 0, 1024, 0); } void RunMenuDrawDemoEndScreen(void) { int idx; ddxSetFlip(1); key[0] = 0; idx = ddxLoadBitmap("final_screen.png", pBmpDir); if (idx == -1) return; ddxSetCursor(1); ddxBitBltDisplay(0, 0, 1024, 768, idx, 0, 0); ddxSetFlip(0); while (!key[0] && !mi.t1 && !mi.t2) { Sleep(25); spracuj_spravy(1); ddxUpdateMouse(); if (mi.dx || mi.dy) DisplayFrame(); } ddxReleaseBitmap(idx); ddxSetCursor(0); } //------------------------------------------------------------------------------------------------ // spusti menu //------------------------------------------------------------------------------------------------ void RunMenu(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu) { DWORD dwEplased = 0, dwStart, dwStop; char bStop = 1; int lastcmd, lastanm, i, j; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int cStartCount = 0; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); RUN_MENU_BRUTAL_RESTART: ZeroAnimations(); bNewScene = 0; cRestartMainMenu = 0; if (cBrutalRestart) { fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); for (i = 0; i < 32; i++) anm[i].cmd = NULL; cRestartMainMenu = 1; } ZeroMemory(res, RES_NUM * sizeof(CMD_LINE)); if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); if (!cBrutalRestart) { iCompositDC = ddxFindFreeSurface(); CompositDC = ddxCreateSurface(1024, 768, iCompositDC); iFontDC = ddxFindFreeSurface(); FontDC = ddxCreateSurface(1024, 768, iFontDC); iBackDC = ddxFindFreeSurface(); BackDC = ddxCreateSurface(1024, 768, iBackDC); } cBrutalRestart = 0; for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; CreateFontAnimations(res, &lastcmd); fn_Release_Font(1); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove fn_Set_Font(cFontDir[2]); fn_Load_Bitmaps(); ddxSetFlip(0); for (j = 0; j < 2; j++) { for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) ddxDrawDisplay(res[i].iParam, 0); else { ddxDrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove if (!j) LoadAnimationMenuScript(res, i, &lastanm); break; } } RunMenuDrawVersion(res[0].iParam[1]); DisplayFrame(); } fn_Release_Font(1); ddxSetFlip(1); BEGIN_MENU: if (bStop || cRestartMainMenu) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); kprintf(1, "COM_RUNANIMATION = %d, iWAVE = %d", i, iWave); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } if (!cStartCount) { int idx = ddxCreateSurface(1024, 768, ddxFindFreeSurface()); ddxBitBlt(idx, 0, 0, 1024, 768, HDC2DD, 0, 0); if (RunMenuNewGame("Mmnew_game.txt", NULL, p_ad, cpu)) { //ddxReleaseBitmap(idx); goto RUN_MENU_BRUTAL_RESTART; } ddxBitBltDisplay(0, 0, 1024, 768, idx, 0, 0); for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (res[i].iLayer) ddxDrawSurface(FontDC, res[i].iParam, 3); break; } } ddxReleaseBitmap(idx); cStartCount = 1; } cRestartMainMenu = 0; dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; // posledni animace -> co bezi? in = 0; bStop = 1; spracuj_spravy(0); dwEplased = 0; while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { // There's already running one - stop it Stop(&res[lastabv]); // Draw frame 0 -> clear the animation from screen if (!res[lastabv].iLayer) { ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); ddxDrawDisplay(res[lastabv].iAnim[0], 0); } else { ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; // set last animation AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); ddxDrawDisplay(res[i].iAnim[0], 0); } else { ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); //menucommand_Draw(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); ddxDrawDisplay(res[anbind].iAnim[0], 0); } else { ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); //menucommand_Draw(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; if (!strcmp(res[resid].cParam[1], "NEW_GAME") || !strcmp(res[resid].cParam[1], "LOAD_GAME") || !strcmp(res[resid].cParam[1], "PLAYER_NAME")) bStop = 0; if (bStop) StopAll(); if (!strcmp(res[resid].cParam[1], "CIBRA")) { StopAll(); RunMenuCibron("cibra.png"); click = 0; } if (!strcmp(res[resid].cParam[1], "EXIT")) key[K_ESC] = 1; if (!strcmp(res[resid].cParam[1], "PLAYER_NAME")) { if (RunMenuNewGame("Mmnew_game.txt", NULL, p_ad, cpu)) goto RUN_MENU_BRUTAL_RESTART; bStop = 1; } if (!strcmp(res[resid].cParam[1], "CREDITS")) { StopAll(); bStop = 1; if (cr_Credits(NULL, p_ad)) goto RUN_MENU_BRUTAL_RESTART; } if (!strcmp(res[resid].cParam[1], "NEW_GAME")) { //RunMenuNewGame("Mmnew_game.txt", hWnd, p_ad, cpu); RunMenuStartGame("Mmstart_game.txt", NULL, p_ad, cpu); if (cBrutalRestart) goto RUN_MENU_BRUTAL_RESTART; } if (!strcmp(res[resid].cParam[1], "LOAD_GAME")) { RunMenuLoadGame("Mmload_game.txt", NULL, p_ad, cpu); if (cBrutalRestart) goto RUN_MENU_BRUTAL_RESTART; } if (!strcmp(res[resid].cParam[1], "SETTINGS")) { RunMenuSettings("Mmsettings.txt", NULL, p_ad, cpu); if (cBrutalRestart) goto RUN_MENU_BRUTAL_RESTART; cRestartMainMenu = 1; } if (bStop || cRestartMainMenu) StopAll(); for (i = 0; i < lastcmd; i++) { switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { if (bStop || cRestartMainMenu) ddxDrawSurface(BackDC, res[i].iParam, 0); } else { ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; } } if (cRestartMainMenu || bStop) { ddxBitBltDisplay(0, 0, 1024, 768, BackDC, 0, 0); ddxCleareSurface(BackDC); } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_RANDOMANIMATION) { if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: for(i=0;i= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); ddxDrawDisplay(res[lastabv].iAnim[0], 0); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[i].iAnim[0]); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[anbind].iAnim[0]); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { key[K_ESC] = 1; //break; } if (!strcmp(res[resid].cParam[1], "EASY")) { StopAll(); bBackDC = 0; iActualScene = 10; RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 0, NULL, 0); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "NORMAL")) { StopAll(); bBackDC = 0; iActualScene = 11; RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 0, NULL, 0); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "HARD")) { StopAll(); bBackDC = 0; iActualScene = 12; RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 0, NULL, 0); key[K_ESC] = 1; } if (!cRestartMainMenu) for (i = 0; i < lastcmd; i++) { switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iParam); } else { //menucommand_DrawT(_2dd.hDC, res[i].iParam); ddxDrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); //menucommand_DrawT(BackDC, res[i].iParam); ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); //menucommand_Draw(FontDC, res[i].iParam, 3); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; } } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: ddxCleareSurface(FontDC); if (!cRestartMainMenu) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); ddxTransparentBlt(BackDC, res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), res[idx].iParam[1], 0, 0, ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), TRANSCOLOR); } //BRUTAL_RELEASE .... nenicit if (!cBrutalRestart) ddxReleaseBitmap(hdcBT); ddxCleareSurface(CompositDC); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } void RunMenuStartGame(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int cpu) { DWORD dwEplased = 0, dwStart, dwStop; int c = 0; int idx = 0; int hdcBT = 0; CONTROL_LIST_ITEM citem[CLIST_ITEMC]; // FILE *file; int lastcmd, lastanm, i; //CMD_LINE res[RES_NUM]; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); ddxCleareSurface(BackDC); ddxBitBlt(BackDC, 0, 0, ddxGetWidth(BackDC), ddxGetHight(BackDC), FontDC, 0, 0); ddxCleareSurface(FontDC); //kprintf(1, "bitblt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM)); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); //kprintf(1, "load"); in = 0; fn_Set_Font(cFontDir[0]); fn_Load_Bitmaps(); //kprintf(1, "fn_Set_Font"); CreateFontAnimations(res, &lastcmd); fn_Release_Font(1); //kprintf(1, "CreateFontAnimations"); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: { if (!c) { hdcBT = ddxCreateSurface(ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), ddxFindFreeSurface()); ddxBitBlt(hdcBT, 0, 0, ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), HDC2DD, res[i].iParam[2], res[i].iParam[3]); ddxTransparentBlt(BackDC, res[i].iParam[2], res[i].iParam[3], ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), res[i].iParam[1], 0, 0, ddxGetWidth(res[i].iParam[1]), ddxGetHight(res[i].iParam[1]), TRANSCOLOR); idx = i; } else { ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); } c++; } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } BEGIN_MENU_NEWGAME: bBackDC = 1; ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); DisplayFrame(); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { dwStart = timeGetTime(); //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { //menucommand_Draw(_2dd.hDC, res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); ddxDrawDisplay(res[lastabv].iAnim[0], 0); } else { //menucommand_DrawT(_2dd.hDC, res[lastabv].iAnim[0]); ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, res[lastabv].iAnim[0], 3); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iAnim[0], 0); ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[i].iAnim[0]); ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[i].iAnim[0]); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[anbind].iAnim[0], 0); ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { //menucommand_DrawT(_2dd.hDC, res[anbind].iAnim[0]); ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); //menucommand_DrawT(FontDC, res[anbind].iAnim[0]); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } dim.dx = 0; dim.dy = 0; } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { key[K_ESC] = 1; //break; } if (!strcmp(res[resid].cParam[1], "NEW_GAME")) { iActualScene = 1; StopAll(); RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 0, NULL, 1); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "CHILD_SCENE")) { RunMenuChildGame("Mmstart_child_game.txt", NULL, p_ad, cpu); if (cRestartMainMenu) { StopAll(); key[K_ESC] = 1; } } if (!strcmp(res[resid].cParam[1], "TUTORIAL")) { StopAll(); bBackDC = 0; iActualScene = 0; RunMenuNewGameScene("Mmnew_game_scene.txt", NULL, p_ad, cpu, 0, NULL, 0); key[K_ESC] = 1; } if (!cRestartMainMenu) for (i = 0; i < lastcmd; i++) { switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { //menucommand_Draw(_2dd.hDC, res[i].iParam); } else { ddxDrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; } } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; spracuj_spravy(0); ddxUpdateMouse(); AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } ddxRestore(p_ad); } __QUIT: ddxCleareSurface(FontDC); if (!cRestartMainMenu) ddxTransparentBltDisplay(0, 0, 1024, 768, BackDC, 0, 0, 1024, 768, TRANSCOLOR); ddxCleareSurface(BackDC); bBackDC = 0; if (!cRestartMainMenu) { ddxBitBltDisplay(res[idx].iParam[2], res[idx].iParam[3], ddxGetWidth(res[idx].iParam[1]), ddxGetHight(res[idx].iParam[1]), hdcBT, 0, 0); } //BRUTAL_RELEASE .... nenicit if (!cBrutalRestart) ddxReleaseBitmap(hdcBT); ddxCleareSurface(CompositDC); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); } int LoadCList(char *cFile, int *p_count, int *p_bmp, int *iClock, char *cDir) { int c = 0, i = -1, t; char text[MAX_FILENAME]; FILE *file; construct_path(text, MAX_FILENAME, 2, pBmpDir, cFile); file = fopen(text, "r"); if (!file) return -1; while (!feof(file)) { memset(text, 0, 256); if (fgets(text, 256, file) && text[0]) { newline_cut(text); if (!c) { i = ddxLoadBitmap(text, cDir); p_bmp[c] = i; } else { t = ddxLoadBitmap(text, cDir); p_bmp[c] = t; } DrawClock(iClock, 0); c++; } } fclose(file); (*p_count) = c; return i; } int GetComixTime(int iScene) { char text[MAX_FILENAME]; int i; FILE *file; construct_path(text, MAX_FILENAME, 2, pDataDir, "comix_times.txt"); file = fopen(text, "r"); if (!file) return 1000; text[0] = '\0'; for (i = 0; i < iScene + 1; i++) { char *ret = fgets(text, MAX_FILENAME, file); assert(ret); } fclose(file); return atoi(text); } int RunMenuComixB(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int iScene) { DWORD dwEplased = 0, dwStart = 0, dwStop = 0; FILE *file; int lastcmd, lastanm, i, j; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; int cc = 0; int iTVBmp = -1; int iTVTBmp = -1; int iTVBut = -1; int iComix = -1; char ccomix[64]; int y = 0; int iSongTime = 1000; int ccc; int iClock; char dir[MAX_FILENAME]; char filename[MAX_FILENAME]; iClock = ddxLoadBitmap("clock1-1.png", pBmpDir); ddxResizeCursorBack(iClock); DrawClock(&iClock, 0); if(ogg_playing()) { float f; f = p_ad->Music_Gain; while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); } ap_Stop_Song(p_ad); } Sleep(1000); bBackDC = 0; res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); _2d_Clear_RectLine(&rline); ddxSetFlip(TRUE); cc = 0; anmid = -1; resid = -1; anbind = -1; ddxCleareSurface(CompositDC); ddxCleareSurface(FontDC); DrawClock(&iClock, 0); iTVBmp = ddxLoadBitmap("televize.png", pBmpDir); iTVTBmp = ddxLoadBitmap("televizet.png", pBmpDir); DrawClock(&iClock, 0); iTVBut = LoadCList("telload.txt", &ccc, &ccc, &ccc, pBmpDir); sprintf(ccomix, "comix%d.png", iScene); iComix = ddxLoadBitmap(ccomix, pBmpDir); if (iTVBmp == -1 || iTVBut == -1 || iComix == -1 || iTVTBmp == -1) { kerror(1, "Unable to load comix graphics! (iTVBmp == %d, iTVBut == %d, iComix == %d, iTVTBmp == %d)", iTVBmp,iTVBut,iComix,iTVTBmp); } for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][0] = -1; res[bind].iAnim[lastcmd][11] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].pCmdLine = res; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return 0; } strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; //kerekce televize res[0].iParam[1] = iTVBmp; //korekce animace komixu; //strcpy(res[1].cParam[0], ccomix); DrawClock(&iClock, 0); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) ddxDrawSurface(BackDC, res[i].iParam, 0); else { ddxDrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iParam, 3); } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: construct_path(filename, MAX_FILENAME, 2, pDataDir, res[i].cParam[0]); file = fopen(filename, "r"); if (file) { while (!feof(file)) { Parse_AnimLine(file, res[i].iAnim[lastanm], 18); lastanm++; } fclose(file); for (j = 0; j < lastanm; j++) res[i].iAnim[j][1] += iTVBut; } cc++; break; } } DrawClock(&iClock, 0); ddxSetCursor(0); DisplayFrame(); DisplayFrame(); ddxResizeCursorBack(0); ddxSetCursorSurface(0); ddxSetCursor(1); DisplayFrame(); DisplayFrame(); ddxReleaseBitmap(iClock); ddxBitBltDisplay(0, 0, 1024, 768, BackDC, 0, 0); ddxCleareSurface(BackDC); ddxTransparentBlt(FontDC, 0, 0, 1024, 768, iTVTBmp, 0, 0, 1024, 768, TRANSCOLOR); _2d_Clear_RectLine(&rline); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation(&res[i], p_ad, 0, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound(&res[i + 1], p_ad, 2); } } dim.t1 = 0; dim.t2 = 0; dim.dx = 0; dim.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); if(ogg_playing()) ap_Stop_Song(p_ad); iSongTime = GetComixTime(iScene); ap_Play_Song(iScene+1,0, p_ad); dwLTime = timeGetTime(); ddxSetFlip(FALSE); dwStart = timeGetTime(); while (!key[K_ESC]) { //pohnul mysi if (dim.dx || dim.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { if (res[lastabv].iAnim[0][0] != -1) { Stop(&res[lastabv]); if (!res[lastabv].iLayer) { ddxDrawDisplay(res[lastabv].iAnim[0], 0); ddxDrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[lastabv].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } } CheckAnimation(&res[i], p_ad); lastabv = i; AddAnimation(&res[i], p_ad, 0, 1); in = 1; bind = ChooseBidedAnimation(res, i + 1, p_ad); if (bind != -1) { CheckAnimation(&res[bind], p_ad); AddAnimation(&res[bind], p_ad, 1, 1); anbind = bind; mPlaySound(&res[bind], p_ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop(&res[i]); if (res[i].iAnim[0][0] != -1) { if (!res[i].iLayer) { ddxDrawDisplay(res[i].iAnim[0], 0); ddxDrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[i].iAnim[0], 3); } } bind = ChooseBidedExitAnimation(res, i + 1, p_ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop(&res[anbind]); if (!res[anbind].iLayer) { ddxDrawDisplay(res[anbind].iAnim[0], 0); ddxDrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddxDrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddxDrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation(&res[bind], p_ad, 1, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound(&res[bind], p_ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } } //stlacil leve tlacitko if (dim.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((dim.x >= res[i].iParam[1]) && (dim.x <= res[i].iParam[3]) && (dim.y >= res[i].iParam[2]) && (dim.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation(&res[i], p_ad, 0, 1); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound(&res[i + 1], p_ad, 1); resid = i; click = 1; anmid = 31; } } dim.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { key[K_ESC] = 1; cRestartMainMenu = 1; } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation(&res[i], p_ad); AddAnimation(&res[i], p_ad, 0, 0); } } //dwStop = timeGetTime(); //dwEplased += dwStop - dwLTime; //dwStart = timeGetTime(); spracuj_spravy(0); ddxUpdateMouse(); { RECT rr; rr.left = 124; rr.top = 161; rr.right = 700; rr.bottom = 549; y = (int) ftoi((dwEplased * (ddxGetHight(iComix) - 550)) / (float) iSongTime); if (y >= ddxGetHight(iComix) - 550) key[K_ESC] = 1; ddxBitBlt(CompositDC, 124, 161, ddxGetWidth(iComix), 549, iComix, 0, y); _2d_Add_RectItem(&rline, rr, 0); } AnimationEvent(dwStop, p_ad); if (dim.tf1) { dim.t1 = 1; dim.tf1 = 0; } if (dim.tf2) { dim.t2 = 1; dim.tf2 = 0; } dwStop = timeGetTime(); dwEplased = dwStop - dwStart; //kprintf(1, "%d", dwEplased); ddxRestore(p_ad); } __QUIT: //kprintf(1, "%d", dwEplased); adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); StopAll(); ddxReleaseBitmap(iTVBmp); ddxReleaseBitmap(iTVTBmp); for (i = iTVBut; i < iTVBut + 9; i++) ddxReleaseBitmap(i); ddxReleaseBitmap(iComix); ddxCleareSurface(FontDC); ddxCleareSurface(BackDC); ddxCleareSurface(CompositDC); key[K_ESC] = 0; FreeAnimations(res, RES_NUM); free((void *) res); if(ogg_playing()) ap_Stop_Song(p_ad); ap_Play_Song(0, 0, p_ad); ddxSetFlip(TRUE); return 0; } int RunMenuComix(char *p_File_Name, HWND hWnd, AUDIO_DATA * p_ad, int iScene) { DWORD dwEplased = 0, dwStart, dwStop; //int iComix = -1; char ccomix[64]; int iSongTime = 1000; int bmpc = 0; int iClock; int idx = -1; int lidx = -1; int bmp[64]; int i; cCheckMusicExeption = 1; for (i = 0; i < 64; i++) bmp[i] = -1; ddxSetFlip(0); iClock = ddxLoadBitmap("clock1-1.png", pBmpDir); ddxResizeCursorBack(iClock); DrawClock(&iClock, 0); if(ogg_playing()) { float f; f = p_ad->Music_Gain; while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); } ap_Stop_Song(p_ad); } ddxSetFlip(0); DrawClock(&iClock, 0); sprintf(ccomix, "comix%d.txt", iScene); LoadCList(ccomix, &bmpc, bmp, &iClock, pBmpDir); DrawClock(&iClock, 0); ddxSetCursor(0); DisplayFrame(); DisplayFrame(); ddxResizeCursorBack(0); ddxSetCursorSurface(0); ddxSetCursor(1); DisplayFrame(); DisplayFrame(); ddxReleaseBitmap(iClock); ddxSetCursor(0); spracuj_spravy(0); if (ogg_playing()) ap_Stop_Song(p_ad); iSongTime = GetComixTime(iScene); ap_Play_Song(iScene+1,0, p_ad); dwStart = timeGetTime(); while (!key[K_ESC]) { spracuj_spravy(0); dwStop = timeGetTime(); dwEplased = dwStop - dwStart; if (dwEplased >= (unsigned) iSongTime) break; lidx = idx; idx = (int) floor((dwEplased * bmpc) / (float) iSongTime); if (lidx != idx) { lidx = idx; if (idx >= 0 && idx < 64) if (bmp[idx] != -1) { ddxBitBltDisplay(0, 0, 1024, 768, bmp[idx], 0, 0); DisplayFrame(); } else break; else break; } if (key[K_SPACE]) { key[K_SPACE] = 0; do { dwStart -= 1000; dwEplased = dwStop - dwStart; idx = (int) floor((dwEplased * bmpc) / (float) iSongTime); } while (idx == lidx); dwStart -= ftoi(iSongTime / (float) bmpc); } ddxRestore(p_ad); } adas_Release_Source(-1, ALL_TYPES, UNDEFINED_VALUE); adas_Release_Source(ALL_SOUND_SOURCES, ALL_TYPES,UNDEFINED_VALUE); key[K_ESC] = 0; for (i = 0; i < 64; i++) if (bmp[i] != -1) ddxReleaseBitmap(bmp[i]); if(ogg_playing()) { float f; f = p_ad->Music_Gain; while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); } ap_Stop_Song(p_ad); } Sleep(1000); ap_Play_Song(0, 0, p_ad); ddxCleareSurfaceColorDisplay(0); DisplayFrame(); ddxCleareSurfaceColorDisplay(0); ddxSetFlip(1); ddxSetCursor(1); cCheckMusicExeption = 0; return 0; } char MenuCheckBossExit(void) { spracuj_spravy(0); if ((key[K_SHIFT] || key[K_SHFT_P]) && key[K_F11]) return 1; else return 0; } char MenuCheckSuccessExit(void) { spracuj_spravy(0); if (key[K_CTRL] && key[K_E]) return 1; else return 0; } berusky2-0.12/src/kofola/controls3d.cpp0000644000175000017500000025525313674766375015027 00000000000000#include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_kofola2d.h" #include "controls3d.h" #include "2D_graphic.h" #include "font3d.h" #include "menu_def.h" //#include "2ddx.h" extern B2_FONT b2_3d_font; extern char pControlsDir[MAX_FILENAME]; extern HDC BackDC; static char bBlockList = 0; static char bExclusive = 0; extern RECT_LINE rline; #define HDC2DD -1 static HDC_EDIT_CONTROL2 hdcED; static HDC_COMBO_CONTROL2 hdcCO; static HDC_LIST_CONTROL2 hdcLI; static HDC_BUTTON_CONTROL2 hdcBU; static HDC_CHECKBOX_CONTROL2 hdcCH; static HDC_PROGRES_CONTROL2 hdcPR; static HDC_FRAME_CONTROL2 hdcFR; void co2_Del_Combo_List(COMBO_CONTROL2 * p_co, int hdc, int xcor, int ycor); int co_Handle_Edit_Key_Filter(void); WCHAR co_ToUnicode(int wScanCode); void co2_Draw_Disable(int hdc, int xcor, int ycor, int x, int y, int dx, int dy) { ddx2TransparentBlt(hdc, x + xcor, y + ycor, dx, dy, hdcCH.hdcGray, 0, 0, TRANSCOLOR); } int co2_Release_Bitmap(HDC_INFO2 * pdcinfo) { if (!pdcinfo) return 1; return 1; } int co2_Load_Graphic(int combo_var) { if (!combo_var) { hdcCO.hdcCombo = ddx2LoadBitmap("combo.png", pControlsDir); hdcCO.hdcComboEnd = ddx2LoadBitmap("combo_end.png", pControlsDir); hdcCO.hdcComboMid = ddx2LoadBitmap("combo_mid.png", pControlsDir); } else { hdcCO.hdcCombo = ddx2LoadBitmap("combo_l.png", pControlsDir); hdcCO.hdcComboEnd = ddx2LoadBitmap("combo_end_l.png", pControlsDir); hdcCO.hdcComboMid = ddx2LoadBitmap("combo_mid_l.png", pControlsDir); } hdcCO.hdcComboUp = ddx2LoadBitmap("combo_up.png", pControlsDir); hdcCO.hdcComboDown = ddx2LoadBitmap("combo_down.png", pControlsDir); hdcCO.hdcComboDrop = ddx2LoadBitmap("combo_drop.png", pControlsDir); hdcCO.hdcComboMover = ddx2LoadBitmap("combo_mover.png", pControlsDir); hdcCO.hdcComboMoverb = ddx2LoadBitmap("combo_moverb.png", pControlsDir); hdcED.hdcEdit = ddx2LoadBitmap("edit.png", pControlsDir); hdcLI.hdcListDown = ddx2LoadBitmap("list_down.png", pControlsDir); hdcLI.hdcListMover = ddx2LoadBitmap("list_mover.png", pControlsDir); hdcLI.hdcListUp = ddx2LoadBitmap("list_up.png", pControlsDir); hdcLI.hdcListTop = ddx2LoadBitmap("list_top.png", pControlsDir); hdcLI.hdcListBottom = ddx2LoadBitmap("list_bottom.png", pControlsDir); hdcLI.hdcListLeft = ddx2LoadBitmap("list_left.png", pControlsDir); hdcLI.hdcListRight = ddx2LoadBitmap("list_right.png", pControlsDir); hdcLI.hdcListTL = ddx2LoadBitmap("list_tl.png", pControlsDir); hdcLI.hdcListTR = ddx2LoadBitmap("list_tr.png", pControlsDir); hdcLI.hdcListBL = ddx2LoadBitmap("list_bl.png", pControlsDir); hdcLI.hdcListBR = ddx2LoadBitmap("list_br.png", pControlsDir); hdcBU.hdcButtonL = ddx2LoadBitmap("button_l.png", pControlsDir); hdcBU.hdcButtonS = ddx2LoadBitmap("button_s.png", pControlsDir); hdcCH.hdcCheck = ddx2LoadBitmap("checkbox.png", pControlsDir); hdcCH.hdcGray = ddx2LoadBitmap("gray.png", pControlsDir); hdcPR.hdcLine = ddx2LoadBitmap("progres_line.png", pControlsDir); hdcPR.hdcMover = ddx2LoadBitmap("progres_mover.png", pControlsDir); hdcFR.hdcFrame = ddx2LoadBitmap("frame.png", pControlsDir); return 1; } int co2_Release_Graphic(void) { ddx2ReleaseBitmap(hdcCO.hdcCombo); ddx2ReleaseBitmap(hdcCO.hdcComboEnd); ddx2ReleaseBitmap(hdcCO.hdcComboMid); ddx2ReleaseBitmap(hdcCO.hdcComboDown); ddx2ReleaseBitmap(hdcCO.hdcComboUp); ddx2ReleaseBitmap(hdcCO.hdcComboDrop); ddx2ReleaseBitmap(hdcCO.hdcComboMover); ddx2ReleaseBitmap(hdcCO.hdcComboMoverb); ddx2ReleaseBitmap(hdcED.hdcEdit); ddx2ReleaseBitmap(hdcLI.hdcListDown); ddx2ReleaseBitmap(hdcLI.hdcListMover); ddx2ReleaseBitmap(hdcLI.hdcListUp); ddx2ReleaseBitmap(hdcLI.hdcListTop); ddx2ReleaseBitmap(hdcLI.hdcListBottom); ddx2ReleaseBitmap(hdcLI.hdcListLeft); ddx2ReleaseBitmap(hdcLI.hdcListRight); ddx2ReleaseBitmap(hdcLI.hdcListTL); ddx2ReleaseBitmap(hdcLI.hdcListTR); ddx2ReleaseBitmap(hdcLI.hdcListBL); ddx2ReleaseBitmap(hdcLI.hdcListBR); ddx2ReleaseBitmap(hdcBU.hdcButtonL); ddx2ReleaseBitmap(hdcBU.hdcButtonS); ddx2ReleaseBitmap(hdcCH.hdcCheck); ddx2ReleaseBitmap(hdcPR.hdcLine); ddx2ReleaseBitmap(hdcPR.hdcMover); ddx2ReleaseBitmap(hdcFR.hdcFrame); ddx2ReleaseBitmap(hdcCH.hdcGray); return 1; } void co2_Combo_Draw(int hdc, COMBO_CONTROL2 * p_co, int xcor, int ycor) { int c = 0; int x = p_co->x; int y = p_co->y; int maxlisthight = p_co->ListMaxHight; int ax = p_co->x, ay = p_co->y, ly; //------------------------------------------------------- EDIT BOX ---------------------------------------------- if (p_co->bEdit) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcCombo), hdcCO.hdcCombo, 0, 0); } p_co->coEditRect.top = p_co->y; p_co->coEditRect.bottom = p_co->y + ddx2GetHeight(hdcCO.hdcCombo); p_co->coEditRect.left = p_co->x; p_co->coEditRect.right = p_co->x + ddx2GetWidth(hdcCO.hdcCombo); p_co->WidthR = ddx2GetWidth(hdcCO.hdcCombo); //------------------------------------------------------- EDIT BOX ---------------------------------------------- //------------------------------------------------------- EDIT BOX DOWN BUTTON ---------------------------------- p_co->coDownRect.top = p_co->y; p_co->coDownRect.bottom = p_co->y + ddx2GetHeight(hdcCO.hdcCombo); p_co->coDownRect.left = p_co->x; p_co->coDownRect.right = p_co->x + ddx2GetWidth(hdcCO.hdcCombo); //------------------------------------------------------- EDIT BOX DOWN BUTTON ---------------------------------- ay += ddx2GetHeight(hdcCO.hdcCombo); ax = p_co->x; ly = ay; //------------------------------------------------------- EDIT BOX LIST BOX ------------------------------------- while (ay < ly + maxlisthight) { if (p_co->bList) { ddx2BitBlt(hdc, ax + xcor, ay + ycor, ddx2GetWidth(hdcCO.hdcComboMid), ddx2GetHeight(hdcCO.hdcComboMid), hdcCO.hdcComboMid, 0, 0); if (p_co->pItem) { ddx2TransparentBlt(hdc, ax + xcor + 5, ay + ycor + 3, ddx2GetWidth(p_co->pItem[c].Norm), ddx2GetHeight(p_co->pItem[c].Norm), p_co->pItem[c].Norm, 0, 0, TRANSCOLOR); } } c++; ay += ddx2GetHeight(hdcCO.hdcComboMid); } if (p_co->bList) { ddx2BitBlt(hdc, ax + xcor, ay + ycor, ddx2GetWidth(hdcCO.hdcComboEnd), ddx2GetHeight(hdcCO.hdcComboEnd), hdcCO.hdcComboEnd, 0, 0); } p_co->ListMaxHightR = ay + ddx2GetHeight(hdcCO.hdcComboEnd) - ly; if (p_co->CounfOfItems > p_co->CounfOfItemsL) { ddx2BitBlt(hdc, x + ddx2GetWidth(hdcCO.hdcCombo) + xcor - 4 - ddx2GetWidth(hdcCO.hdcComboUp), y + ycor + ddx2GetHeight(hdcCO.hdcCombo), ddx2GetWidth(hdcCO.hdcComboUp), ddx2GetHeight(hdcCO.hdcComboUp), hdcCO.hdcComboUp, 0, 0); ddx2BitBlt(hdc, x + ddx2GetWidth(hdcCO.hdcCombo) + xcor - 4 - ddx2GetWidth(hdcCO.hdcComboDown), ay + ddx2GetHeight(hdcCO.hdcComboEnd) + ycor - ddx2GetHeight(hdcCO.hdcComboDown) - 4, ddx2GetWidth(hdcCO.hdcComboDown), ddx2GetHeight(hdcCO.hdcComboDown), hdcCO.hdcComboDown, 0, 0); p_co->coLDown.top = ay + ddx2GetHeight(hdcCO.hdcComboEnd) + ycor - ddx2GetHeight(hdcCO.hdcComboDown) - 4; p_co->coLDown.bottom = p_co->coLDown.top + ddx2GetHeight(hdcCO.hdcComboDown); p_co->coLDown.left = x + ddx2GetWidth(hdcCO.hdcCombo) + xcor - 4 - ddx2GetWidth(hdcCO.hdcComboDown); p_co->coLDown.right = p_co->coLDown.left + ddx2GetWidth(hdcCO.hdcComboDown); p_co->coLUp.top = y + ycor + ddx2GetHeight(hdcCO.hdcCombo); p_co->coLUp.bottom = p_co->coLUp.top + ddx2GetHeight(hdcCO.hdcComboUp); p_co->coLUp.left = x + ddx2GetWidth(hdcCO.hdcCombo) + xcor - 4 - ddx2GetWidth(hdcCO.hdcComboDown); p_co->coLUp.right = p_co->coLUp.left + ddx2GetWidth(hdcCO.hdcComboUp); p_co->coLMov.top = p_co->coLUp.bottom + 1; p_co->coLMov.bottom = p_co->coLDown.top + 1; p_co->coLMov.left = p_co->coLUp.left; p_co->coLMov.right = p_co->coLMov.left + ddx2GetWidth(hdcCO.hdcComboMover); ddx2BitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddx2GetWidth(hdcCO.hdcComboMover), ddx2GetHeight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); p_co->xmstart = p_co->coLMov.top; p_co->xm = p_co->coLDown.top - p_co->coLMov.top - ddx2GetHeight(hdcCO.hdcComboMover); p_co->xmp = p_co->coLMov.top + (int) floor(ddx2GetHeight(hdcCO.hdcComboMover) / 2.0f); p_co->xmstart += (int) floor(ddx2GetHeight(hdcCO.hdcComboMover) / 2.0f); p_co->coLMovA.top = p_co->coLUp.bottom + 1; p_co->coLMovA.bottom = p_co->coLDown.top - 1; p_co->coLMovA.left = p_co->coLMov.left; p_co->coLMovA.right = p_co->coLMov.right; } else { p_co->coLDown.top = -1; p_co->coLDown.bottom = -1; p_co->coLDown.left = -1; p_co->coLDown.right = -1; p_co->coLUp.top = -1; p_co->coLUp.bottom = -1; p_co->coLUp.left = -1; p_co->coLUp.right = -1; p_co->coLMov.top = -1; p_co->coLMov.bottom = -1; p_co->coLMov.left = -1; p_co->coLMov.right = -1; p_co->coLMovA.top = -1; p_co->coLMovA.bottom = -1; p_co->coLMovA.left = -1; p_co->coLMovA.right = -1; } //------------------------------------------------------- EDIT BOX LIST BOX ------------------------------------- } void co2_Combo_Draw_List(int hdc, COMBO_CONTROL2 * p_co, int xcor, int ycor, char bDel) { int c = 0 + p_co->SSelected; int maxlisthight = p_co->ListMaxHight; int ax = p_co->x, ay = p_co->y, ly; if (p_co->CSelected == p_co->Selected) return; ay += ddx2GetHeight(hdcCO.hdcCombo); ly = ay; if (bDel) co2_Del_Combo_List(p_co, hdc, xcor, ycor); while (ay < ly + maxlisthight) { if (p_co->bList) { if (c == p_co->CSelected && c != p_co->Selected) { if (p_co->pItem) { ddx2TransparentBlt(hdc, ax + xcor + 5, ay + ycor + 3, ddx2GetWidth(p_co->pItem[c].Sel), ddx2GetHeight(p_co->pItem[c].Sel), p_co->pItem[c].Sel, 0, 0, TRANSCOLOR); } } else { if (p_co->pItem) { ddx2TransparentBlt(hdc, ax + xcor + 5, ay + ycor + 3, ddx2GetWidth(p_co->pItem[c].Norm), ddx2GetHeight(p_co->pItem[c].Norm), p_co->pItem[c].Norm, 0, 0, TRANSCOLOR); } } } c++; ay += ddx2GetHeight(hdcCO.hdcComboMid); } } int co2_Combo_Hit2Sel(COMBO_CONTROL2 * p_co, int x, int y) { int ay = p_co->y + ddx2GetHeight(hdcCO.hdcCombo); return (int) floor((y - ay) / (float) ddx2GetHeight(hdcCO.hdcComboMid)); } void co2_Release_Edit(CONTROL_EDIT2 * p_ed) { ddx2ReleaseBitmap(p_ed->bDC); free((void *) p_ed); } void co2_Release_Combo(COMBO_CONTROL2 * p_co) { int i; bBlockList = 0; if (p_co->pItem) { for (i = 0; i < p_co->CounfOfItems; i++) { ddx2ReleaseBitmap(p_co->pItem[i].Norm); ddx2ReleaseBitmap(p_co->pItem[i].Sel); } free((void *) p_co->pItem); } if (p_co->pBDC) { ddx2ReleaseBitmap(*p_co->pBDC); free((void *) p_co->pBDC); } free((void *) p_co); } COMBO_CONTROL2 *co2_Create_Combo(int hdc, int x, int y, int maxlisthight, int id) { COMBO_CONTROL2 *p_co = NULL; p_co = (COMBO_CONTROL2 *) malloc(sizeof(COMBO_CONTROL2)); if (!p_co) return 0; ZeroMemory(p_co, sizeof(COMBO_CONTROL2)); p_co->comboID = id; p_co->x = x; p_co->y = y; p_co->Hight = ddx2GetWidth(hdcCO.hdcCombo); p_co->Width = ddx2GetHeight(hdcCO.hdcCombo); p_co->ListMaxHight = maxlisthight; p_co->bEdit = 1; p_co->bList = 0; p_co->pBDC = NULL; p_co->Selected = -1; p_co->CSelected = -1; p_co->SSelected = 0; p_co->pItem = NULL; p_co->CounfOfItems = 0; p_co->xm = 0; p_co->xmstart = 0; p_co->bIn = 0; p_co->OSelected = -1; co2_Combo_Draw(hdc, p_co, 0, 0); return p_co; } void co2_Release_Combo_Drop(COMBO_DROP_CONTROL2 * p_co) { int i; bBlockList = 0; if (p_co->pItem) { for (i = 0; i < p_co->CounfOfItems; i++) { ddx2ReleaseBitmap(p_co->pItem[i].Norm); ddx2ReleaseBitmap(p_co->pItem[i].Sel); } free((void *) p_co->pItem); } free((void *) p_co); } COMBO_DROP_CONTROL2 *co2_Create_Combo_Drop(int hdc, int x, int y, int id) { int ax, ay; COMBO_DROP_CONTROL2 *p_co = NULL; p_co = (COMBO_DROP_CONTROL2 *) malloc(sizeof(COMBO_DROP_CONTROL2)); if (!p_co) return 0; ZeroMemory(p_co, sizeof(COMBO_DROP_CONTROL2)); p_co->CounfOfItems = 0; p_co->dropID = id; p_co->pItem = NULL; p_co->Selected = -1; p_co->x = x; p_co->y = y; ddx2BitBlt(hdc, x, y, ddx2GetWidth(hdcCO.hdcComboDrop), ddx2GetHeight(hdcCO.hdcComboDrop), hdcCO.hdcComboDrop, 0, 0); ax = x + ddx2GetWidth(hdcCO.hdcComboDrop); ay = y + ddx2GetHeight(hdcCO.hdcComboDrop); p_co->coLUp.top = y + 5; p_co->coLUp.bottom = ay - 5; p_co->coLUp.left = ax - 20; p_co->coLUp.right = ax - 2; p_co->coLDown.top = y + 5; p_co->coLDown.bottom = ay - 5; p_co->coLDown.left = ax - 39; p_co->coLDown.right = ax - 21; return p_co; } int co2_Combo_Drop_Add_String(COMBO_DROP_CONTROL2 * p_co, char *text, float fValue) { int tx, ty; WCHAR wc[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM2 *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM2)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddx2CreateSurface(ddx2GetWidth(hdcCO.hdcComboDrop) - 20, ddx2GetHeight(hdcCO.hdcComboMid), ddx2FindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddx2CreateSurface(ddx2GetWidth(hdcCO.hdcComboDrop) - 20, ddx2GetHeight(hdcCO.hdcComboMid), ddx2FindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); p_co->pItem[p_co->CounfOfItems - 1].fValue = fValue; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn2_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, 0, &tx, &ty); fn2_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, 1, &tx, &ty); return 1; } int co2_Combo_Drop_Set_Sel(int hdc, COMBO_DROP_CONTROL2 * p_co, int i) { p_co->Selected = i; ddx2BitBlt(hdc, p_co->x, p_co->y, ddx2GetWidth(hdcCO.hdcComboDrop), ddx2GetHeight(hdcCO.hdcComboDrop), hdcCO.hdcComboDrop, 0, 0); if (p_co->pItem) { ddx2TransparentBlt(hdc, p_co->x + 5, p_co->y + 7, ddx2GetWidth(p_co->pItem[p_co->Selected].Norm), ddx2GetHeight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, TRANSCOLOR); } return 1; } int co2_Combo_Drop_Set_String(int hdc, COMBO_DROP_CONTROL2 * p_co, int xcor, int ycor) { if (p_co->Selected < 0) return 0; ddx2BitBlt(hdc, p_co->x + xcor, p_co->y + ycor, ddx2GetWidth(hdcCO.hdcComboDrop), ddx2GetHeight(hdcCO.hdcComboDrop), hdcCO.hdcComboDrop, 0, 0); if (p_co->pItem) { ddx2TransparentBlt(hdc, p_co->x + xcor + 5, p_co->y + ycor + 7, ddx2GetWidth(p_co->pItem[p_co->Selected].Norm), ddx2GetHeight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, TRANSCOLOR); } return 1; } int co2_Combo_Drop_Get_Sel(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, float *pf) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combod) if ((p_list + i)->p_combod->dropID == id) { if ((p_list + i)->p_combod->pItem && (p_list + i)->p_combod->Selected > -1) *pf = (p_list + i)->p_combod->pItem[(p_list + i)->p_combod->Selected].fValue; return (p_list + i)->p_combod->Selected; } return -1; } int co2_Combo_Add_String(COMBO_CONTROL2 * p_co, char *text) { int tx, ty; WCHAR wc[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM2 *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM2)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddx2CreateSurface(ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcComboMid), ddx2FindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddx2CreateSurface(ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcComboMid), ddx2FindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn2_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, 0, &tx, &ty); fn2_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, 1, &tx, &ty); return 1; } int co2_Combo_Add_StringWC(COMBO_CONTROL2 * p_co, char *text) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM2 *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM2)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddx2CreateSurface(ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcComboMid), ddx2FindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddx2CreateSurface(ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcComboMid), ddx2FindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 0, &tx, &ty); fn2_Draw_Message(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 1, &tx, &ty); return 1; } int co2_Combo_Set_String(int hdc, COMBO_CONTROL2 * p_co, int xcor, int ycor) { if (p_co->Selected < 0) return 0; ddx2BitBlt(hdc, p_co->x + xcor, p_co->y + ycor, ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcCombo), hdcCO.hdcCombo, 0, 0); if (p_co->pItem) { ddx2TransparentBlt(hdc, p_co->x + xcor + 5, p_co->y + ycor + 7, ddx2GetWidth(p_co->pItem[p_co->Selected].Norm), ddx2GetHeight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, TRANSCOLOR); } return 1; } int co2_Combo_Set_Sel(int hdc, COMBO_CONTROL2 * p_co, int i) { assert(i >= 0); p_co->Selected = i; p_co->OSelected = i; ddx2BitBlt(hdc, p_co->x, p_co->y, ddx2GetWidth(hdcCO.hdcCombo), ddx2GetHeight(hdcCO.hdcCombo), hdcCO.hdcCombo, 0, 0); if (p_co->pItem) { ddx2TransparentBlt(hdc, p_co->x + 5, p_co->y + 7, ddx2GetWidth(p_co->pItem[p_co->Selected].Norm), ddx2GetHeight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, TRANSCOLOR); } return 1; } int co2_Combo_Get_Sel(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combo) if ((p_list + i)->p_combo->comboID == id) return (p_list + i)->p_combo->Selected; return -1; } int co2_Combo_Get_Sel_Not_Opend(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combo) if ((p_list + i)->p_combo->comboID == id && !(p_list + i)->p_combo->bList) return (p_list + i)->p_combo->Selected; return -1; } int co2_Combo_Set_Params(COMBO_CONTROL2 * p_co, int itemnum) { p_co->ListMaxHight = itemnum * ddx2GetHeight(hdcCO.hdcComboMid); p_co->CounfOfItemsL = itemnum; return 1; } int co2_Combo_Open(int hdc, COMBO_CONTROL2 * p_co, int xcor, int ycor) { int *pDCI; if (p_co->bList) return 1; bBlockList = 1; p_co->pBDC = (int *) malloc(sizeof(int)); if (!p_co->pBDC) return 0; if (p_co->CounfOfItems > p_co->CounfOfItemsL) p_co->ListMaxHightR = (p_co->CounfOfItemsL * 25) + ddx2GetHeight(hdcCO.hdcComboEnd); else p_co->ListMaxHightR = (p_co->CounfOfItems * 25) + ddx2GetHeight(hdcCO.hdcComboEnd); *p_co->pBDC = ddx2CreateSurface(p_co->WidthR, p_co->ListMaxHightR, ddx2FindFreeSurface()); pDCI = p_co->pBDC; if (!pDCI) { free((void *) p_co->pBDC); return 0; } ddx2BitBlt(*pDCI, 0, 0, ddx2GetWidth(*pDCI), ddx2GetHeight(*pDCI), hdc, p_co->x + xcor, p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor); p_co->CSelected = -1; p_co->Selected = -1; p_co->bList = 1; p_co->bEdit = 0; co2_Combo_Draw(hdc, p_co, xcor, ycor); p_co->coListRect.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo); p_co->coListRect.bottom = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + p_co->ListMaxHightR; p_co->coListRect.left = p_co->x; if (p_co->CounfOfItems > p_co->CounfOfItemsL) p_co->coListRect.right = p_co->x + ddx2GetWidth(hdcCO.hdcComboMid) - 2 - ddx2GetWidth(hdcCO.hdcComboUp); else p_co->coListRect.right = p_co->x + ddx2GetWidth(hdcCO.hdcComboMid) - 2; p_co->bEdit = 1; return 1; } int co2_Combo_Close(int hdc, COMBO_CONTROL2 * p_co, int xcor, int ycor) { if (!p_co->bList) return 1; bBlockList = 0; p_co->SSelected = 0; p_co->bList = 0; ddx2BitBlt(hdc, p_co->x + xcor, ycor + p_co->y + ddx2GetHeight(hdcCO.hdcCombo), ddx2GetWidth(*p_co->pBDC), ddx2GetHeight(*p_co->pBDC), *p_co->pBDC, 0, 0); ddx2ReleaseBitmap(*p_co->pBDC); free((void *) p_co->pBDC); p_co->pBDC = NULL; mi.t1 = 0; mi.dt1 = 0; return 1; } WCHAR *co2_Edit_Get_Text(CONTROL_EDIT2 * p_ed) { if (!p_ed) return NULL; else return p_ed->wtext; } void co2_Edit_Set_Text(CONTROL_EDIT2 * p_ed, WCHAR * cText, char bRedraw, int hdc, int xcor, int ycor) { int xt, yt; if (!p_ed) return; if (!cText) return; p_ed->pTime = timeGetTime(); wcscpy(p_ed->wtext, cText); if (bRedraw) { ddx2BitBlt(hdc, p_ed->rect.left + xcor, p_ed->rect.top + ycor, ddx2GetWidth(hdcED.hdcEdit), ddx2GetHeight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); ddx2CleareSurface(p_ed->bDC); fn2_Draw_MessageA(p_ed->bDC, 0, 3, &b2_3d_font.gt, &b2_3d_font.ts, p_ed->wtext, 0, &xt, &yt); ddx2TransparentBlt(hdc, p_ed->rect.left + 5 + xcor, p_ed->rect.top + 4 + xcor, p_ed->rect.right - p_ed->rect.left - 10, p_ed->rect.bottom - p_ed->rect.top - 8, p_ed->bDC, 0, 0, TRANSCOLOR); } } CONTROL_EDIT2 *co2_Create_Edit(int hdc, int x, int y, int editID) { CONTROL_EDIT2 *p_ed = NULL; p_ed = (CONTROL_EDIT2 *) malloc(sizeof(CONTROL_EDIT2)); if (!p_ed) return 0; ZeroMemory(p_ed, sizeof(CONTROL_EDIT2)); p_ed->x = x; p_ed->y = y; p_ed->tx = 0; p_ed->bcActive = 0; p_ed->bActive = 0; p_ed->rect.left = x; p_ed->rect.top = y; p_ed->rect.right = x + ddx2GetWidth(hdcED.hdcEdit); p_ed->rect.bottom = y + ddx2GetHeight(hdcED.hdcEdit); ddx2BitBlt(hdc, x, y, ddx2GetWidth(hdcED.hdcEdit), ddx2GetHeight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); ddx2BitBlt(HDC2DD, x, y, ddx2GetWidth(hdcED.hdcEdit), ddx2GetHeight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); p_ed->bDC = ddx2CreateSurface(ddx2GetWidth(hdcED.hdcEdit) + 25, ddx2GetHeight(hdcED.hdcEdit), ddx2FindFreeSurface()); return p_ed; } void co2_Release_Button(BUTTON_CONTROL2 * p_bu) { ddx2ReleaseBitmap(p_bu->dc); free((void *) p_bu); } BUTTON_CONTROL2 *co2_Create_Button(int hdc, int x, int y, int type, char *text, int isection, int buttonID) { WCHAR wc[128]; WCHAR ws[128]; int bmpx = 0, bmpy = 0; int bmpDC = 0; int cx, cy; int tx, ty; int tmpDC; BUTTON_CONTROL2 *p_bu = NULL; p_bu = (BUTTON_CONTROL2 *) malloc(sizeof(BUTTON_CONTROL2)); if (!p_bu) return 0; ZeroMemory(p_bu, sizeof(BUTTON_CONTROL2)); p_bu->ButtonID = buttonID; p_bu->bActivated = 0; p_bu->x = x; p_bu->y = y; switch (type) { case BUTTON_LARGE: bmpx = ddx2GetWidth(hdcBU.hdcButtonL); bmpy = ddx2GetHeight(hdcBU.hdcButtonL); bmpDC = hdcBU.hdcButtonL; p_bu->dc = ddx2CreateSurface(bmpx, bmpy, ddx2FindFreeSurface()); p_bu->Rect.bottom = y + bmpy; p_bu->Rect.right = x + bmpx; break; case BUTTON_SMALL: bmpx = ddx2GetWidth(hdcBU.hdcButtonS); bmpy = ddx2GetHeight(hdcBU.hdcButtonS); bmpDC = hdcBU.hdcButtonS; p_bu->dc = ddx2CreateSurface(bmpx, bmpy, ddx2FindFreeSurface()); p_bu->Rect.bottom = y + bmpy; p_bu->Rect.right = x + bmpx; break; default: assert(0); } p_bu->type = type; p_bu->Rect.top = y; p_bu->Rect.left = x; ddx2BitBlt(p_bu->dc, 0, 0, bmpx, bmpy, bmpDC, 0, 0); tmpDC = ddx2CreateSurface(bmpx, bmpy, ddx2FindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(tmpDC, 0, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, isection, &tx, &ty); cx = ftoi(((p_bu->Rect.right - p_bu->Rect.left) - tx) / 2.0f); cy = ftoi(((p_bu->Rect.bottom - p_bu->Rect.top) - ty) / 2.0f); ddx2TransparentBlt(p_bu->dc, cx, cy, tx, ty, tmpDC, 0, 0, TRANSCOLOR); ddx2ReleaseBitmap(tmpDC); ddx2BitBlt(hdc, p_bu->Rect.left, p_bu->Rect.top, ddx2GetWidth(p_bu->dc), ddx2GetHeight(p_bu->dc), p_bu->dc, 0, 0); return p_bu; } int co2_Check_Set_State(CHECKBOX_CONTROL2 * p_ch, int hdc, int state, char bDraw) { int x = 0, y = 0; int bmpx; int bmpDC; bmpx = ddx2GetWidth(hdcCH.hdcCheck); bmpDC = hdcCH.hdcCheck; if (hdc == HDC2DD) { x = TAB_X; y = TAB_Y; } p_ch->bChecked = state; if (p_ch->bChecked) { if (bDraw) { ddx2TransparentBlt(hdc, p_ch->Rect.left + x, p_ch->Rect.top + y, bmpx, 20, bmpDC, 0, 25, RGB(237, 77, 0)); } p_ch->bChange = 1; } else { if (bDraw) { ddx2TransparentBlt(hdc, p_ch->Rect.left + x, p_ch->Rect.top + y, bmpx, 20, bmpDC, 0, 1, RGB(237, 77, 0)); } p_ch->bChange = 1; } if (p_ch->iDC != -1) ddx2BitBlt(p_ch->iDC, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, hdc, p_ch->x + x, p_ch->y + y); return 1; } int co2_Check_Get_State_Change(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id && (p_list + i)->p_check->bChange) { (p_list + i)->p_check->bChange = 0; return (p_list + i)->p_check->bChecked; } return -1; } void co2_Check_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { CHECKBOX_CONTROL2 *p_ch; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id) { p_ch = (p_list + i)->p_check; (p_list + i)->bActive = 0; (p_list + i)->bDisabled = 1; ddx2TransparentBlt(hdc, p_ch->RectFull.left + xcor, p_ch->RectFull.top + ycor, p_ch->RectFull.right, p_ch->RectFull.bottom, hdcCH.hdcGray, 0, 0, TRANSCOLOR); return; } return; } void co2_Check_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { CHECKBOX_CONTROL2 *p_ch; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id) { p_ch = (p_list + i)->p_check; (p_list + i)->bActive = 1; (p_list + i)->bDisabled = 0; if (p_ch->iDC != -1) ddx2BitBlt(hdc, p_ch->RectFull.left + xcor, p_ch->RectFull.top + ycor, p_ch->RectFull.right, p_ch->RectFull.bottom, p_ch->iDC, 0, 0); return; } return; } void co2_Release_CheckBox(CHECKBOX_CONTROL2 * p_ch) { if (p_ch->iDC != -1) ddx2ReleaseBitmap(p_ch->iDC); free((void *) p_ch); } CHECKBOX_CONTROL2 *co2_Create_CheckBox(int hdc, int x, int y, char *text, int isection, int checkID, CONTROL_CALLBACK p_callback, void *p_callback_data) { WCHAR wc[128]; WCHAR ws[128]; int bmpx; int bmpDC; int tx, ty; CHECKBOX_CONTROL2 *p_ch = NULL; p_ch = (CHECKBOX_CONTROL2 *) mmalloc(sizeof(CHECKBOX_CONTROL2)); p_ch->checkID = checkID; bmpx = ddx2GetWidth(hdcCH.hdcCheck); bmpDC = hdcCH.hdcCheck; p_ch->Rect.bottom = y + 24; p_ch->Rect.right = x + bmpx; p_ch->Rect.top = y; p_ch->Rect.left = x; p_ch->x = x; p_ch->y = y; p_ch->p_callback = p_callback; p_ch->p_callback_data = p_callback_data; ddx2TransparentBlt(hdc, x, y, bmpx, 20, bmpDC, 0, 1, RGB(237, 77, 0)); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(hdc, x + 30, y, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, isection, &tx, &ty); p_ch->RectFull.left = x; p_ch->RectFull.top = y; p_ch->RectFull.right = 30 + tx - p_ch->RectFull.left; p_ch->RectFull.bottom = ty - p_ch->RectFull.top; p_ch->iDC = ddx2CreateSurface(p_ch->RectFull.right, p_ch->RectFull.bottom, ddx2FindFreeSurface()); return p_ch; } int co2_Progres_Set(PROGRES_CONTROL2 * p_pr, int hdc, int i) { int dd = p_pr->max - p_pr->min; int md = p_pr->rectProgres.right - p_pr->rectProgres.left; float in = md / (float) dd; int x = p_pr->rectProgres.left + ftoi((i - p_pr->min) * in); ddx2BitBlt(hdc, p_pr->rectMover.left, p_pr->rectMover.top, ddx2GetWidth(p_pr->bDC), ddx2GetHeight(p_pr->bDC), p_pr->bDC, 0, 0); p_pr->pos = x; p_pr->rectMover.left = p_pr->pos - p_pr->cor; p_pr->rectMover.right = p_pr->rectMover.left + ddx2GetWidth(hdcPR.hdcMover); ddx2BitBlt(p_pr->bDC, 0, 0, ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), hdc, p_pr->rectMover.left, p_pr->rectMover.top); ddx2TransparentBlt(hdc, p_pr->rectMover.left, p_pr->rectMover.top, ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), hdcPR.hdcMover, 0, 0, RGB(237, 77, 0)); return 1; } void co2_Progres_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id, char bSave, int shdc) { PROGRES_CONTROL2 *p_pr; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_prog) if ((p_list + i)->p_prog->progID == id) { p_pr = (p_list + i)->p_prog; (p_list + i)->bActive = 0; (p_list + i)->bDisabled = 1; if (bSave) ddx2BitBlt(p_pr->iDC, 0, 0, p_pr->RectFull.right, p_pr->RectFull.bottom, shdc, p_pr->RectFull.left + xcor, p_pr->RectFull.top + ycor); ddx2TransparentBlt(hdc, p_pr->RectFull.left + xcor, p_pr->RectFull.top + ycor, p_pr->RectFull.right, p_pr->RectFull.bottom, hdcCH.hdcGray, 0, 0, TRANSCOLOR); return; } return; } void co2_Progres_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { PROGRES_CONTROL2 *p_pr; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_prog) if ((p_list + i)->p_prog->progID == id) { p_pr = (p_list + i)->p_prog; (p_list + i)->bActive = 1; (p_list + i)->bDisabled = 0; if (p_pr->iDC != -1) ddx2BitBlt(hdc, p_pr->RectFull.left + xcor, p_pr->RectFull.top + ycor, p_pr->RectFull.right, p_pr->RectFull.bottom, p_pr->iDC, 0, 0); return; } return; } int co2_Progres_Get(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_prog) if ((p_list + i)->p_prog->progID == id) { PROGRES_CONTROL2 *p_pr = (p_list + i)->p_prog; int dd = p_pr->max - p_pr->min; int md = p_pr->rectProgres.right - p_pr->rectProgres.left; float out = dd / (float) md; int x = p_pr->min + ftoi((p_pr->pos - p_pr->rectProgres.left) * out); return x; } return 0; } int co2_Progres_Changed(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_prog) { if ((p_list + i)->p_prog->progID == id) { if ((p_list + i)->p_prog->bChange) return 1; else return 0; } } } return 0; } void co2_Release_Progres(PROGRES_CONTROL2 * p_pr) { ddx2ReleaseBitmap(p_pr->bDC); free((void *) p_pr); } PROGRES_CONTROL2 *co2_Create_Progres(int hdc, int x, int y, int min, int max, int progID) { int bmpx, bmpy, yp; int bmpDC; PROGRES_CONTROL2 *p_pr = NULL; p_pr = (PROGRES_CONTROL2 *) malloc(sizeof(PROGRES_CONTROL2)); if (!p_pr) return 0; ZeroMemory(p_pr, sizeof(PROGRES_CONTROL2)); p_pr->bChange = 0; p_pr->bIn = 0; p_pr->progID = progID; p_pr->min = min; p_pr->max = max; p_pr->x = x; p_pr->y = y; p_pr->cor = ftoi(ddx2GetWidth(hdcPR.hdcMover) / 2.0f); p_pr->pos = x; p_pr->bExclusive = 0; bmpx = ddx2GetWidth(hdcPR.hdcLine); bmpy = ddx2GetHeight(hdcPR.hdcMover); bmpDC = hdcPR.hdcLine; yp = ftoi(bmpy / 2.0f); p_pr->rectMover.top = y; p_pr->rectMover.left = x; p_pr->rectMover.right = x + ddx2GetWidth(hdcPR.hdcMover); p_pr->rectMover.bottom = y + bmpy; p_pr->rectProgres.top = y; p_pr->rectProgres.left = x; p_pr->rectProgres.bottom = p_pr->rectMover.bottom; p_pr->rectProgres.right = x + bmpx; ddx2BitBlt(hdc, x, y + yp, bmpx, ddx2GetHeight(hdcPR.hdcLine), bmpDC, 0, 0); p_pr->bDC = ddx2CreateSurface(ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), ddx2FindFreeSurface()); ddx2BitBlt(p_pr->bDC, 0, 0, ddx2GetWidth(hdcPR.hdcMover), bmpy, hdc, x, y); ddx2TransparentBlt(hdc, x, y, ddx2GetWidth(hdcPR.hdcMover), bmpy, hdcPR.hdcMover, 0, 0, RGB(237, 77, 0)); p_pr->RectFull.left = x - yp - 300; p_pr->RectFull.top = y; p_pr->RectFull.right = bmpx + yp + 300; p_pr->RectFull.bottom = bmpy; p_pr->iDC = ddx2CreateSurface(p_pr->RectFull.right, p_pr->RectFull.bottom, ddx2FindFreeSurface()); return p_pr; } int co2_Set_Text(int hdc, int x, int y, char *text, int isection) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(hdc, x, y, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, isection, &tx, &ty); return 1; } int co2_Set_TextWC(int hdc, int x, int y, char *text, int isection) { int tx, ty; WCHAR wc[128]; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn2_Draw_MessageA(hdc, x, y, &b2_3d_font.gt, &b2_3d_font.ts, wc, isection, &tx, &ty); return 1; } int co2_Set_Text_Formated_Rect(int hdc, int x, int y, char *text, int isection, RECT * pR) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_MessageRECT(hdc, x, y, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, isection, &tx, &ty, pR); return ty; } int co2_Set_Text_Center(int hdc, char *text, int isection, RECT r) { int xp, yp; int tx, ty; WCHAR wc[128]; WCHAR ws[128]; int h; h = ddx2CreateSurface(600, 100, ddx2FindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(h, 0, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, isection, &tx, &ty); xp = ftoi(((r.right - r.left) - tx) / 2.0f); yp = ftoi(((r.bottom - r.top) - ty) / 2.0f); ddx2TransparentBlt(hdc, r.left + xp, r.top + yp, tx, ty, h, 0, 0, TRANSCOLOR); ddx2TransparentBltDisplay(r.left + xp, r.top + yp, tx, ty, h, 0, 0, tx, ty, TRANSCOLOR); ddx2ReleaseBitmap(h); return 1; } int co2_Set_Text_Right(int hdc, char *text, int isection, int x, int y) { int xp; int tx, ty; WCHAR wc[128]; WCHAR ws[128]; int h; h = ddx2CreateSurface(600, 100, ddx2FindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn2_Draw_Message(h, 0, 0, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, isection, &tx, &ty); xp = x - tx; ddx2TransparentBlt(hdc, xp, y, tx, ty, h, 0, 0, TRANSCOLOR); ddx2ReleaseBitmap(h); return 1; } void co2_Draw_Line(int x1, int y1, int x2, int y2, COLORREF color, HDC hdc) { /* HPEN LastPen; HPEN MePen; MePen = CreatePen(PS_SOLID,1,color); LastPen = (HPEN)SelectObject(hdc,MePen); MoveToEx(hdc,x1, y1, NULL); LineTo(hdc,x2, y2); SelectObject(hdc,LastPen); DeleteObject(MePen); */ } void co2_Draw_Lines(HDC hdc, int xr, int yr, COLORREF color) { int i; for (i = 35; i < yr; i += 35) co2_Draw_Line(0, i, xr, i, color, hdc); } int co2_List_Delete_Item(LIST_VIEW_CONTROL2 * p_li, char **cValue) { int i; RECT r; if (!p_li->bSelection) return 0; if (p_li->cClckSel == -1) return 0; if (p_li->cClckSel >= p_li->listnum) return 0; if (!p_li->cText[p_li->cClckSel]) return 0; if (cValue) (*cValue) = strdup(p_li->cText[p_li->cClckSel]); free((void *) p_li->cText[p_li->cClckSel]); free((void *) p_li->pwText[p_li->cClckSel]); for (i = p_li->cClckSel + 1; i < p_li->listnum; i++) { p_li->piValue[i - 1] = p_li->piValue[i]; p_li->cText[i - 1] = p_li->cText[i]; p_li->pwText[i - 1] = p_li->pwText[i]; } p_li->pwText[p_li->listnum - 1] = NULL; p_li->cText[p_li->listnum - 1] = NULL; p_li->piValue[p_li->listnum - 1] = 0; i = p_li->cClckSel * 30; ddx2BitBlt(p_li->bDCn, 0, i, ddx2GetWidth(p_li->bDCn), ddx2GetHeight(p_li->bDCn) - (i + 30), p_li->bDCn, 0, i + 30); ddx2BitBlt(p_li->bDCs, 0, i, ddx2GetWidth(p_li->bDCn), ddx2GetHeight(p_li->bDCn) - (i + 30), p_li->bDCs, 0, i + 30); r.left = 0; r.right = ddx2GetWidth(p_li->bDCn); r.bottom = ddx2GetHeight(p_li->bDCn); r.top = r.bottom - 30; ddx2FillRect(p_li->bDCn, &r, 0); ddx2FillRect(p_li->bDCs, &r, 0); if (ddx2GetHeight(p_li->bDCn) - 30 > p_li->rectList.bottom - p_li->rectList.top) { int ds, dn; ds = p_li->bDCs; dn = p_li->bDCn; p_li->bDCn = ddx2CreateSurface(ddx2GetWidth(dn), ddx2GetHeight(dn) - 30, ddx2FindFreeSurface()); p_li->bDCs = ddx2CreateSurface(ddx2GetWidth(ds), ddx2GetHeight(ds) - 30, ddx2FindFreeSurface()); ddx2BitBlt(p_li->bDCn, 0, 0, ddx2GetWidth(p_li->bDCn), ddx2GetHeight(p_li->bDCn), dn, 0, 0); ddx2BitBlt(p_li->bDCs, 0, 0, ddx2GetWidth(p_li->bDCs), ddx2GetHeight(p_li->bDCs), ds, 0, 0); ddx2ReleaseBitmap(dn); ddx2ReleaseBitmap(ds); p_li->listnum--; } p_li->cClckSel = -1; return 1; } int co2_List_Add_String(LIST_VIEW_CONTROL2 * p_li, int index, int x, char *text, int iValue, char bSelected) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; if (p_li->piValue) p_li->piValue[index] = iValue; MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!bSelected) fn2_Draw_Message(p_li->bDCn, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 0, &tx, &ty); else fn2_Draw_Message(p_li->bDCn, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 1, &tx, &ty); fn2_Draw_Message(p_li->bDCs, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, ws, 1, &tx, &ty); if (p_li->pwText[index]) { free((void *) p_li->pwText[index]); p_li->pwText[index] = NULL; } p_li->pwText[index] = wcsdup(wc); if (p_li->cText[index]) { free((void *) p_li->cText[index]); p_li->cText[index] = NULL; } p_li->cText[index] = strdup(text); return 1; } int co2_List_Add_StringWC(LIST_VIEW_CONTROL2 * p_li, int index, int x, char *text, int iValue, char bSelected) { int tx, ty; WCHAR wc[128]; if (p_li->piValue) p_li->piValue[index] = iValue; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!bSelected) fn2_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, 0, &tx, &ty); else fn2_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, 1, &tx, &ty); fn2_Draw_MessageA(p_li->bDCs, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, 1, &tx, &ty); if (p_li->pwText[index]) { free((void *) p_li->pwText[index]); p_li->pwText[index] = NULL; } p_li->pwText[index] = wcsdup(wc); if (p_li->cText[index]) { free((void *) p_li->cText[index]); p_li->cText[index] = NULL; } p_li->cText[index] = strdup(text); return 1; } int co2_List_Add_StringWC2(LIST_VIEW_CONTROL2 * p_li, int index, int x, WCHAR * wc, char *text, int iValue, char bSelected) { int tx, ty; if (p_li->piValue) p_li->piValue[index] = iValue; if (!bSelected) fn2_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, 0, &tx, &ty); else fn2_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, 1, &tx, &ty); fn2_Draw_MessageA(p_li->bDCs, x, (index * 30) + 2, &b2_3d_font.gt, &b2_3d_font.ts, wc, 1, &tx, &ty); if (p_li->pwText[index]) { free((void *) p_li->pwText[index]); p_li->pwText[index] = NULL; } p_li->pwText[index] = wcsdup(wc); if (p_li->cText[index]) { free((void *) p_li->cText[index]); p_li->cText[index] = NULL; } p_li->cText[index] = strdup(text); return 1; } int co2_List_Redraw(int hdc, LIST_VIEW_CONTROL2 * p_li, int y) { if (y + (p_li->rectList.bottom - p_li->rectList.top) > ddx2GetHeight(p_li->bDCn)) y = ddx2GetHeight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); if (y < 0) y = 0; ddx2BitBlt(hdc, p_li->rectList.left, p_li->rectList.top, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, y); return y; } int co2_List_View_Redraw(int hdc, LIST_VIEW2_CONTROL2 * p_li, int y) { ddx2BitBlt(hdc, p_li->rectList.left, p_li->rectList.top, ddx2GetWidth(p_li->bDC), p_li->rectList.bottom - p_li->rectList.top, p_li->bDC, 0, y); return 1; } void co2_Release_List(LIST_VIEW_CONTROL2 * p_li) { int i; ddx2ReleaseBitmap(p_li->bDCm); ddx2ReleaseBitmap(p_li->bDCn); ddx2ReleaseBitmap(p_li->bDCs); if (p_li->piValue) free((void *) p_li->piValue); if (p_li->pwText) for (i = 0; i < p_li->listnum; i++) if (p_li->pwText[i]) free((void *) p_li->pwText[i]); if (p_li->cText) for (i = 0; i < p_li->listnum; i++) if (p_li->cText[i]) free((void *) p_li->cText[i]); free((void *) p_li->pwText); free((void *) p_li->cText); free((void *) p_li); } void co2_Release_List_View(LIST_VIEW2_CONTROL2 * p_li) { ddx2ReleaseBitmap(p_li->bDCm); ddx2ReleaseBitmap(p_li->bDC); free((void *) p_li); } int co2_Get_List_View_DC(LIST_VIEW2_CONTROL2 * p_li) { if (!p_li) return -1; else return p_li->bDC; } LIST_VIEW_CONTROL2 *co2_Create_List(int hdc, int x, int y, int width, int hight, int id, int numofitems, char bSelection) { int ax, ay, lx, ly; LIST_VIEW_CONTROL2 *p_li = NULL; p_li = (LIST_VIEW_CONTROL2 *) malloc(sizeof(LIST_VIEW_CONTROL2)); if (!p_li) return 0; p_li->piValue = (int *) malloc(numofitems * sizeof(int)); p_li->pwText = (WCHAR **) malloc(numofitems * sizeof(WCHAR *)); p_li->cText = (char **) malloc(numofitems * sizeof(char *)); p_li->bClck = 0; p_li->bDblClck = 0; p_li->pTime = timeGetTime(); p_li->Pushc = 0; p_li->listnum = numofitems; p_li->dx = 0; p_li->bIn = 0; p_li->bInE = 0; p_li->x = x; p_li->y = y; p_li->mpos = 0; p_li->listID = id; p_li->rectList.top = y + ddx2GetHeight(hdcLI.hdcListTop); p_li->rectList.left = x + ddx2GetWidth(hdcLI.hdcListLeft); p_li->rectList.bottom = y + hight - ddx2GetHeight(hdcLI.hdcListBottom); p_li->rectList.right = x + width - ddx2GetWidth(hdcLI.hdcListRight) - ddx2GetWidth(hdcLI.hdcListUp); p_li->cClckSel = -1; p_li->bSelection = bSelection; if (p_li->pwText) ZeroMemory(p_li->pwText, numofitems * sizeof(WCHAR *)); if (p_li->cText) ZeroMemory(p_li->cText, numofitems * sizeof(char *)); ax = x; ay = y; ddx2BitBlt(hdc, x, y, ddx2GetWidth(hdcLI.hdcListTL), ddx2GetHeight(hdcLI.hdcListTL), hdcLI.hdcListTL, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListTL); lx = ax; while (ax - lx < width - ddx2GetWidth(hdcLI.hdcListTop)) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcLI.hdcListTop), ddx2GetHeight(hdcLI.hdcListTop), hdcLI.hdcListTop, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListTop); } ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListTop), ay, ddx2GetWidth(hdcLI.hdcListTop), ddx2GetHeight(hdcLI.hdcListTop), hdcLI.hdcListTop, 0, 0); ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListTR), ay, ddx2GetWidth(hdcLI.hdcListTR), ddx2GetHeight(hdcLI.hdcListTR), hdcLI.hdcListTR, 0, 0); ay += ddx2GetHeight(hdcLI.hdcListTop); ly = ay; ax = x; while (ay - ly < hight - ddx2GetHeight(hdcLI.hdcListLeft)) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcLI.hdcListLeft), ddx2GetHeight(hdcLI.hdcListLeft), hdcLI.hdcListLeft, 0, 0); ddx2BitBlt(hdc, ax + width - ddx2GetWidth(hdcLI.hdcListRight), ay, ddx2GetWidth(hdcLI.hdcListRight), ddx2GetHeight(hdcLI.hdcListRight), hdcLI.hdcListRight, 0, 0); ay += ddx2GetHeight(hdcLI.hdcListLeft); } ddx2BitBlt(hdc, ax, y + hight - ddx2GetHeight(hdcLI.hdcListLeft), ddx2GetWidth(hdcLI.hdcListLeft), ddx2GetHeight(hdcLI.hdcListLeft), hdcLI.hdcListLeft, 0, 0); ddx2BitBlt(hdc, ax + width - ddx2GetWidth(hdcLI.hdcListRight), y + hight - ddx2GetHeight(hdcLI.hdcListRight), ddx2GetWidth(hdcLI.hdcListRight), ddx2GetHeight(hdcLI.hdcListRight), hdcLI.hdcListRight, 0, 0); ay = y + hight - ddx2GetHeight(hdcLI.hdcListBottom); ax = x; ddx2BitBlt(hdc, x, ay, ddx2GetWidth(hdcLI.hdcListBL), ddx2GetHeight(hdcLI.hdcListBL), hdcLI.hdcListBL, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListBL); lx = ax; while (ax - lx < width - ddx2GetWidth(hdcLI.hdcListBottom)) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcLI.hdcListBottom), ddx2GetHeight(hdcLI.hdcListBottom), hdcLI.hdcListBottom, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListBottom); } ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBottom), ay, ddx2GetWidth(hdcLI.hdcListBottom), ddx2GetHeight(hdcLI.hdcListBottom), hdcLI.hdcListBottom, 0, 0); ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR), ay, ddx2GetWidth(hdcLI.hdcListBR), ddx2GetHeight(hdcLI.hdcListBR), hdcLI.hdcListBR, 0, 0); p_li->rectUp.top = y + ddx2GetHeight(hdcLI.hdcListTop); p_li->rectUp.bottom = p_li->rectUp.top + ddx2GetHeight(hdcLI.hdcListUp); p_li->rectUp.left = x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcLI.hdcListUp); p_li->rectUp.right = p_li->rectUp.left + ddx2GetWidth(hdcLI.hdcListUp); ddx2TransparentBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcLI.hdcListUp), y + ddx2GetHeight(hdcLI.hdcListTop), ddx2GetWidth(hdcLI.hdcListUp), ddx2GetHeight(hdcLI.hdcListUp), hdcLI.hdcListUp, 0, 0, RGB(238, 77, 0)); p_li->rectDown.top = y + hight - ddx2GetHeight(hdcLI.hdcListBR) - ddx2GetHeight(hdcLI.hdcListDown); p_li->rectDown.bottom = p_li->rectDown.top + ddx2GetHeight(hdcLI.hdcListUp); p_li->rectDown.left = x + width - ddx2GetWidth(hdcLI.hdcListTR) - ddx2GetWidth(hdcLI.hdcListUp); p_li->rectDown.right = p_li->rectDown.left + ddx2GetWidth(hdcLI.hdcListUp); ddx2TransparentBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListTR) - ddx2GetWidth(hdcLI.hdcListUp), y + hight - ddx2GetHeight(hdcLI.hdcListBR) - ddx2GetHeight(hdcLI.hdcListDown), ddx2GetWidth(hdcLI.hdcListDown), ddx2GetHeight(hdcLI.hdcListDown), hdcLI.hdcListDown, 0, 0, RGB(238, 77, 0)); p_li->bDCm = ddx2CreateSurface(ddx2GetWidth(hdcCH.hdcCheck), 24, ddx2FindFreeSurface()); ddx2BitBlt(p_li->bDCm, 0, 0, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcCH.hdcCheck) - 2, y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp)); ddx2TransparentBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcCH.hdcCheck) - 2, y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp), ddx2GetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, RGB(237, 77, 0)); p_li->rectMover.top = y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp); p_li->rectMover.bottom = p_li->rectMover.top + 24; p_li->rectMover.left = x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcCH.hdcCheck) - 2; p_li->rectMover.right = p_li->rectMover.left + ddx2GetWidth(hdcCH.hdcCheck); p_li->bDCn = ddx2CreateSurface(p_li->rectList.right - p_li->rectList.left, numofitems * 30, ddx2FindFreeSurface()); ddx2CleareSurfaceColor(p_li->bDCn, 0); p_li->bDCs = ddx2CreateSurface(p_li->rectList.right - p_li->rectList.left, numofitems * 30, ddx2FindFreeSurface()); ddx2CleareSurfaceColor(p_li->bDCs, 0); ddx2BitBlt(hdc, x + ddx2GetWidth(hdcLI.hdcListLeft), y + ddx2GetHeight(hdcLI.hdcListTop), ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, 0); p_li->mpos = p_li->mpmin = y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp) + 12; p_li->mpmax = y + hight - ddx2GetHeight(hdcLI.hdcListBottom) - ddx2GetHeight(hdcLI.hdcListDown) - 12; p_li->rectMoverA.left = p_li->rectMover.left; p_li->rectMoverA.right = p_li->rectMover.right; p_li->rectMoverA.top = y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp) + 12; p_li->rectMoverA.bottom = y + hight - ddx2GetHeight(hdcLI.hdcListBottom) - ddx2GetHeight(hdcLI.hdcListDown) - 12; return p_li; } void co2_Set_List_View_List_Pos(LIST_VIEW2_CONTROL2 * p_li, int y, int hdc, int xcor, int ycor) { int dcm, mm, pos; dcm = ddx2GetHeight(p_li->bDC) - (p_li->rectList.bottom - p_li->rectList.top); mm = p_li->mpmax - p_li->mpmin; if (y > dcm) y = dcm; pos = p_li->mpmin + ftoi((mm * y) / (float) dcm); if (pos > p_li->mpmax) pos = p_li->mpmax; else if (pos < p_li->mpmin) pos = p_li->mpmin; p_li->mpos = pos; p_li->dx = y; ddx2BitBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), p_li->bDCm, 0, 0); p_li->rectMover.top = p_li->mpos - 12; p_li->rectMover.bottom = p_li->mpos + 12; ddx2BitBlt(p_li->bDCm, 0, 0, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor); ddx2TransparentBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddx2GetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, RGB(237, 77, 0)); ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDC), p_li->rectList.bottom - p_li->rectList.top, p_li->bDC, 0, y); } LIST_VIEW2_CONTROL2 *co2_Create_List_View(int hdc, int x, int y, int width, int hight, int id, int iViewHeight) { int ax, ay, lx, ly; LIST_VIEW2_CONTROL2 *p_li = NULL; p_li = (LIST_VIEW2_CONTROL2 *) malloc(sizeof(LIST_VIEW2_CONTROL2)); if (!p_li) return 0; p_li->bIn = 0; p_li->bInE = 0; p_li->iViewHeight = iViewHeight; p_li->dx = 0; p_li->x = x; p_li->y = y; p_li->mpos = 0; p_li->listID = id; p_li->rectList.top = y + ddx2GetHeight(hdcLI.hdcListTop); p_li->rectList.left = x + ddx2GetWidth(hdcLI.hdcListLeft); p_li->rectList.bottom = y + hight - ddx2GetHeight(hdcLI.hdcListBottom); p_li->rectList.right = x + width - ddx2GetWidth(hdcLI.hdcListRight) - ddx2GetWidth(hdcLI.hdcListUp); ax = x; ay = y; ddx2BitBlt(hdc, x, y, ddx2GetWidth(hdcLI.hdcListTL), ddx2GetHeight(hdcLI.hdcListTL), hdcLI.hdcListTL, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListTL); lx = ax; while (ax - lx < width - ddx2GetWidth(hdcLI.hdcListTop)) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcLI.hdcListTop), ddx2GetHeight(hdcLI.hdcListTop), hdcLI.hdcListTop, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListTop); } ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListTop), ay, ddx2GetWidth(hdcLI.hdcListTop), ddx2GetHeight(hdcLI.hdcListTop), hdcLI.hdcListTop, 0, 0); ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListTR), ay, ddx2GetWidth(hdcLI.hdcListTR), ddx2GetHeight(hdcLI.hdcListTR), hdcLI.hdcListTR, 0, 0); ay += ddx2GetHeight(hdcLI.hdcListTop); ly = ay; ax = x; while (ay - ly < hight - ddx2GetHeight(hdcLI.hdcListLeft)) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcLI.hdcListLeft), ddx2GetHeight(hdcLI.hdcListLeft), hdcLI.hdcListLeft, 0, 0); ddx2BitBlt(hdc, ax + width - ddx2GetWidth(hdcLI.hdcListRight), ay, ddx2GetWidth(hdcLI.hdcListRight), ddx2GetHeight(hdcLI.hdcListRight), hdcLI.hdcListRight, 0, 0); ay += ddx2GetHeight(hdcLI.hdcListLeft); } ddx2BitBlt(hdc, ax, y + hight - ddx2GetHeight(hdcLI.hdcListLeft), ddx2GetWidth(hdcLI.hdcListLeft), ddx2GetHeight(hdcLI.hdcListLeft), hdcLI.hdcListLeft, 0, 0); ddx2BitBlt(hdc, ax + width - ddx2GetWidth(hdcLI.hdcListRight), y + hight - ddx2GetHeight(hdcLI.hdcListRight), ddx2GetWidth(hdcLI.hdcListRight), ddx2GetHeight(hdcLI.hdcListRight), hdcLI.hdcListRight, 0, 0); ay = y + hight - ddx2GetHeight(hdcLI.hdcListBottom); ax = x; ddx2BitBlt(hdc, x, ay, ddx2GetWidth(hdcLI.hdcListBL), ddx2GetHeight(hdcLI.hdcListBL), hdcLI.hdcListBL, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListBL); lx = ax; while (ax - lx < width - ddx2GetWidth(hdcLI.hdcListBottom)) { ddx2BitBlt(hdc, ax, ay, ddx2GetWidth(hdcLI.hdcListBottom), ddx2GetHeight(hdcLI.hdcListBottom), hdcLI.hdcListBottom, 0, 0); ax += ddx2GetWidth(hdcLI.hdcListBottom); } ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBottom), ay, ddx2GetWidth(hdcLI.hdcListBottom), ddx2GetHeight(hdcLI.hdcListBottom), hdcLI.hdcListBottom, 0, 0); ddx2BitBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR), ay, ddx2GetWidth(hdcLI.hdcListBR), ddx2GetHeight(hdcLI.hdcListBR), hdcLI.hdcListBR, 0, 0); p_li->rectUp.top = y + ddx2GetHeight(hdcLI.hdcListTop); p_li->rectUp.bottom = p_li->rectUp.top + ddx2GetHeight(hdcLI.hdcListUp); p_li->rectUp.left = x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcLI.hdcListUp); p_li->rectUp.right = p_li->rectUp.left + ddx2GetWidth(hdcLI.hdcListUp); ddx2TransparentBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcLI.hdcListUp), y + ddx2GetHeight(hdcLI.hdcListTop), ddx2GetWidth(hdcLI.hdcListUp), ddx2GetHeight(hdcLI.hdcListUp), hdcLI.hdcListUp, 0, 0, RGB(238, 77, 0)); p_li->rectDown.top = y + hight - ddx2GetHeight(hdcLI.hdcListBR) - ddx2GetHeight(hdcLI.hdcListDown); p_li->rectDown.bottom = p_li->rectDown.top + ddx2GetHeight(hdcLI.hdcListUp); p_li->rectDown.left = x + width - ddx2GetWidth(hdcLI.hdcListTR) - ddx2GetWidth(hdcLI.hdcListUp); p_li->rectDown.right = p_li->rectDown.left + ddx2GetWidth(hdcLI.hdcListUp); ddx2TransparentBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListTR) - ddx2GetWidth(hdcLI.hdcListUp), y + hight - ddx2GetHeight(hdcLI.hdcListBR) - ddx2GetHeight(hdcLI.hdcListDown), ddx2GetWidth(hdcLI.hdcListDown), ddx2GetHeight(hdcLI.hdcListDown), hdcLI.hdcListDown, 0, 0, RGB(238, 77, 0)); p_li->bDCm = ddx2CreateSurface(ddx2GetWidth(hdcCH.hdcCheck), 24, ddx2FindFreeSurface()); ddx2BitBlt(p_li->bDCm, 0, 0, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcCH.hdcCheck) - 2, y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp)); ddx2TransparentBlt(hdc, x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcCH.hdcCheck), y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp), ddx2GetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, RGB(237, 77, 0)); p_li->rectMover.top = y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp); p_li->rectMover.bottom = p_li->rectMover.top + 24; p_li->rectMover.left = x + width - ddx2GetWidth(hdcLI.hdcListBR) - ddx2GetWidth(hdcCH.hdcCheck); p_li->rectMover.right = p_li->rectMover.left + ddx2GetWidth(hdcCH.hdcCheck); p_li->bDC = ddx2CreateSurface(p_li->rectList.right - p_li->rectList.left, iViewHeight, ddx2FindFreeSurface()); ddx2CleareSurfaceColor(p_li->bDC, 0); ddx2BitBlt(hdc, x + ddx2GetWidth(hdcLI.hdcListLeft), y + ddx2GetHeight(hdcLI.hdcListTop), ddx2GetWidth(p_li->bDC), p_li->rectList.bottom - p_li->rectList.top, p_li->bDC, 0, 0); p_li->mpos = p_li->mpmin = y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp) + 12; p_li->mpmax = y + hight - ddx2GetHeight(hdcLI.hdcListBottom) - ddx2GetHeight(hdcLI.hdcListDown) - 12; p_li->rectMoverA.left = p_li->rectMover.left; p_li->rectMoverA.right = p_li->rectMover.right; p_li->rectMoverA.top = y + ddx2GetHeight(hdcLI.hdcListTop) + ddx2GetHeight(hdcLI.hdcListUp) + 12; p_li->rectMoverA.bottom = y + hight - ddx2GetHeight(hdcLI.hdcListBottom) - ddx2GetHeight(hdcLI.hdcListDown) - 12; return p_li; } int co2_Rect_Hit(RECT rect, int x, int y) { if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) return 1; else return 0; } void co2_Del_Combo_List(COMBO_CONTROL2 * p_co, int hdc, int xcor, int ycor) { int y = ycor + p_co->y + ddx2GetHeight(hdcCO.hdcCombo); int i; for (i = 0; i < p_co->CounfOfItemsL; i++) { ddx2BitBlt(hdc, p_co->x + xcor, y, p_co->coListRect.right - p_co->coListRect.left - 2, ddx2GetHeight(hdcCO.hdcComboMid), hdcCO.hdcComboMid, 0, 0); y += ddx2GetHeight(hdcCO.hdcComboMid); } } int co2_Handle_Combo_Drop(COMBO_DROP_CONTROL2 * p_co, char bFocus, int x, int y, int hdc, int xcor, int ycor) { int c = 0; if (mi.t1) if (co2_Rect_Hit(p_co->coLUp, x, y)) { p_co->Selected--; if (p_co->Selected < 0) p_co->Selected = 0; co2_Combo_Drop_Set_String(hdc, p_co, xcor, ycor); c++; } if (mi.t1) if (co2_Rect_Hit(p_co->coLDown, x, y)) { p_co->Selected++; if (p_co->Selected >= p_co->CounfOfItems) p_co->Selected = p_co->CounfOfItems - 1; co2_Combo_Drop_Set_String(hdc, p_co, xcor, ycor); c++; } return c; } int co2_Handle_Combo(COMBO_CONTROL2 * p_co, char bFocus, int x, int y, int hdc, int xcor, int ycor, char b_list) { int c = 0; RECT r; if (mi.t1 && b_list && !p_co->bList) return 0; if (!mi.dt1) p_co->bIn = 0; if (mi.t1 || mi.dt1) { if (co2_Rect_Hit(p_co->coLMovA, x + xcor, y + ycor) && p_co->bList) { int ym; int ymcor; int ymx; int i; COMBO2_HADLE_MOVER: ym = (y + ycor - p_co->xmstart); ymcor = (int) floor(ddx2GetHeight(hdcCO.hdcComboMover) / 2.0f); ymx = p_co->xm; if (ym < 0) ym = 0; if (ym > ymx) ym = ymx; i = ftoi(((p_co->CounfOfItems - p_co->CounfOfItemsL) * ym) / (float) ymx); p_co->SSelected = i; p_co->CSelected = p_co->Selected - 1; co2_Combo_Draw_List(hdc, p_co, xcor, ycor, 1); r.left = p_co->x + xcor; r.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddx2GetHeight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); if (ym + p_co->xmstart - ymcor != p_co->coLMov.top) { int t, b; t = ym + p_co->xmstart - ymcor; b = p_co->coLMov.top + ddx2GetHeight(hdcCO.hdcComboMover); ddx2BitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddx2GetWidth(hdcCO.hdcComboMoverb), ddx2GetHeight(hdcCO.hdcComboMoverb), hdcCO.hdcComboMoverb, 0, 0); ddx2BitBlt(hdc, p_co->coLMov.left, t, ddx2GetWidth(hdcCO.hdcComboMover), ddx2GetHeight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); p_co->coLMov.top = t; p_co->coLMov.bottom = b; } p_co->bIn = 1; c++; return c; } else if (mi.dt1 && p_co->bIn) { goto COMBO2_HADLE_MOVER; } } if (mi.t1) { if (co2_Rect_Hit(p_co->coLUp, x + xcor, y + ycor) && p_co->bList) { int ymcor = (int) floor(ddx2GetHeight(hdcCO.hdcComboMover) / 2.0f); int t, b; int ny; p_co->SSelected--; if (p_co->SSelected < 0) p_co->SSelected = 0; p_co->CSelected = p_co->Selected - 1; co2_Del_Combo_List(p_co, hdc, xcor, ycor); co2_Combo_Draw_List(hdc, p_co, xcor, ycor, 0); ny = ftoi((p_co->xm / (float) (p_co->CounfOfItems - p_co->CounfOfItemsL)) * p_co->SSelected); t = ny + p_co->xmstart - ymcor; b = p_co->coLMov.top + ddx2GetHeight(hdcCO.hdcComboMover); ddx2BitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddx2GetWidth(hdcCO.hdcComboMoverb), ddx2GetHeight(hdcCO.hdcComboMoverb), hdcCO.hdcComboMoverb, 0, 0); ddx2BitBlt(hdc, p_co->coLMov.left, t, ddx2GetWidth(hdcCO.hdcComboMover), ddx2GetHeight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); p_co->coLMov.top = t; p_co->coLMov.bottom = b; c++; } } if (mi.t1) { if (co2_Rect_Hit(p_co->coLDown, x + xcor, y + ycor) && p_co->bList) { int ymcor = (int) floor(ddx2GetHeight(hdcCO.hdcComboMover) / 2.0f); int t, b; int ny; p_co->SSelected++; if (p_co->SSelected > p_co->CounfOfItems - p_co->CounfOfItemsL) p_co->SSelected = p_co->CounfOfItems - p_co->CounfOfItemsL; p_co->CSelected = p_co->Selected - 1; co2_Del_Combo_List(p_co, hdc, xcor, ycor); co2_Combo_Draw_List(hdc, p_co, xcor, ycor, 0); ny = ftoi((p_co->xm / (float) (p_co->CounfOfItems - p_co->CounfOfItemsL)) * p_co->SSelected); t = ny + p_co->xmstart - ymcor; b = p_co->coLMov.top + ddx2GetHeight(hdcCO.hdcComboMover); ddx2BitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddx2GetWidth(hdcCO.hdcComboMoverb), ddx2GetHeight(hdcCO.hdcComboMoverb), hdcCO.hdcComboMoverb, 0, 0); ddx2BitBlt(hdc, p_co->coLMov.left, t, ddx2GetWidth(hdcCO.hdcComboMover), ddx2GetHeight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); p_co->coLMov.top = t; p_co->coLMov.bottom = b; c++; } } if (mi.t1) { if (co2_Rect_Hit(p_co->coDownRect, x, y)) { r.left = p_co->x + xcor; r.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddx2GetHeight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); if (p_co->bList) { co2_Combo_Close(hdc, p_co, xcor, ycor); p_co->Selected = p_co->OSelected; } else { p_co->OSelected = p_co->Selected; co2_Combo_Open(hdc, p_co, xcor, ycor); } r.left = p_co->x + xcor; r.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddx2GetHeight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); c++; } } if (co2_Rect_Hit(p_co->coListRect, x, y) && p_co->bList) { c++; p_co->CSelected = p_co->SSelected + co2_Combo_Hit2Sel(p_co, x, y); if (!mi.t1 && p_co->bList) { co2_Combo_Draw_List(hdc, p_co, xcor, ycor, 0); p_co->Selected = p_co->CSelected; } else if (mi.t1 && p_co->bList) { p_co->OSelected = p_co->Selected = p_co->CSelected; co2_Combo_Set_String(hdc, p_co, xcor, ycor); co2_Combo_Close(hdc, p_co, xcor, ycor); } } else if (!mi.t1 && p_co->bList) { c++; p_co->CSelected = -1; co2_Combo_Draw_List(hdc, p_co, xcor, ycor, 0); p_co->Selected = -1; } if (mi.t1) { if (!c && bFocus) { r.left = p_co->x + xcor; r.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddx2GetHeight(hdcCO.hdcComboEnd); co2_Combo_Close(hdc, p_co, xcor, ycor); p_co->Selected = p_co->OSelected; r.left = p_co->x + xcor; r.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddx2GetHeight(hdcCO.hdcComboEnd); } } r.left = p_co->x + xcor; r.top = p_co->y + ddx2GetHeight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddx2GetHeight(hdcCO.hdcComboEnd); r.left = p_co->x + xcor; r.top = p_co->y + ycor; r.right = ddx2GetWidth(hdcCO.hdcCombo); r.bottom = ddx2GetHeight(hdcCO.hdcCombo); return c; } int co2_Handle_Button(BUTTON_CONTROL2 * p_bu, int x, int y) { if (co2_Rect_Hit(p_bu->Rect, x, y)) { p_bu->bActivated = 1; return 1; } return 0; } int co2_Handle_Checkbox(CHECKBOX_CONTROL2 * p_ch, int x, int y) { int bmpx; int bmpDC; if (co2_Rect_Hit(p_ch->Rect, x, y)) { bmpx = ddx2GetWidth(hdcCH.hdcCheck); bmpDC = hdcCH.hdcCheck; if (!p_ch->bChecked) { p_ch->bChecked = 1; ddx2TransparentBltDisplay(p_ch->Rect.left + TAB_X, p_ch->Rect.top + TAB_Y, bmpx, 20, bmpDC, 0, 25, bmpx, 20, RGB(237, 77, 0)); p_ch->bChange = 1; if (p_ch->iDC != -1) ddx2BitBlt(p_ch->iDC, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, HDC2DD, p_ch->x + TAB_X, p_ch->y + TAB_Y); } else { p_ch->bChecked = 0; ddx2TransparentBltDisplay(p_ch->Rect.left + TAB_X, p_ch->Rect.top + TAB_Y, bmpx, 20, bmpDC, 0, 1, bmpx, 20, RGB(237, 77, 0)); p_ch->bChange = 1; if (p_ch->iDC != -1) ddx2BitBlt(p_ch->iDC, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, HDC2DD, p_ch->x + TAB_X, p_ch->y + TAB_Y); } if(p_ch->p_callback) p_ch->p_callback(p_ch); return 1; } p_ch->bChange = 0; return 0; } int co2_Handle_Progres(PROGRES_CONTROL2 * p_pr, int x, int y) { if (bExclusive && !p_pr->bExclusive) return 0; if (mi.t1 || mi.dt1) if (co2_Rect_Hit(p_pr->rectProgres, x, y)) { if (p_pr->pos == x) return 1; ddx2BitBltDisplay(p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y, ddx2GetWidth(p_pr->bDC), ddx2GetHeight(p_pr->bDC), p_pr->bDC, 0, 0); p_pr->rectMover.left = x - p_pr->cor; p_pr->rectMover.right = (x - p_pr->cor) + ddx2GetWidth(hdcPR.hdcMover); ddx2BitBlt(p_pr->bDC, 0, 0, ddx2GetWidth(p_pr->bDC), ddx2GetHeight(p_pr->bDC), HDC2DD, p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y); ddx2TransparentBltDisplay(p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y, ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), hdcPR.hdcMover, 0, 0, ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), RGB(237, 77, 0)); p_pr->pos = x; p_pr->bIn = 1; p_pr->bChange = 1; p_pr->bExclusive = 1; bExclusive = 1; return 1; } if (p_pr->bIn && mi.dt1) { if (x >= p_pr->rectProgres.right) x = p_pr->rectProgres.right; if (x <= p_pr->rectProgres.left) x = p_pr->rectProgres.left; if (p_pr->pos == x) return 1; p_pr->pos = x; ddx2BitBltDisplay(p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y, ddx2GetWidth(p_pr->bDC), ddx2GetHeight(p_pr->bDC), p_pr->bDC, 0, 0); p_pr->rectMover.left = x - p_pr->cor; p_pr->rectMover.right = (x - p_pr->cor) + ddx2GetWidth(hdcPR.hdcMover); ddx2BitBlt(p_pr->bDC, 0, 0, ddx2GetWidth(p_pr->bDC), ddx2GetHeight(p_pr->bDC), HDC2DD, p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y); ddx2TransparentBltDisplay(p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y, ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), hdcPR.hdcMover, 0, 0, ddx2GetWidth(hdcPR.hdcMover), ddx2GetHeight(hdcPR.hdcMover), RGB(237, 77, 0)); //p_pr->bIn = 0; p_pr->bChange = 1; p_pr->bExclusive = 1; bExclusive = 1; return 1; } if (!mi.dt1) { p_pr->bIn = 0; p_pr->bExclusive = 0; bExclusive = 0; } p_pr->bChange = 0; return 0; } int co2_List_Get_Dbclck(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, LIST_VIEW_CONTROL2 ** p_li) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_list && (p_list + i)->bActive) { *p_li = (p_list + i)->p_list; return (p_list + i)->p_list->bDblClck; } return -1; } int co2_List_Get_Clck(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, LIST_VIEW_CONTROL2 ** p_li) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_list && (p_list + i)->bActive) { *p_li = (p_list + i)->p_list; return (p_list + i)->p_list->bClck; } return -1; } int co2_List_Get_Value(CONTROL_LIST_ITEM2 * p_list, int lsize, int id, int index) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_list) return (p_list + i)->p_list->piValue[index]; return -1; } void co2_get_XP_XT(LIST_VIEW_CONTROL2 * p_li, int i, int *p_xp, int *p_xt, int ycor) { //int xs = p_li->rectList.top + ycor + (i * 30) - p_li->dx; int xp = 0; int xt = 0; if (mi.t1) p_li->cSelected = i; if ((i * 30) - p_li->dx < 0) xp = ((i * 30) - p_li->dx) * -1; if ((p_li->rectList.top + ycor + (i * 30) - p_li->dx + 30) > p_li->rectList.bottom + ycor) xt = (p_li->rectList.top + ycor + (i * 30) - p_li->dx + 30) - (p_li->rectList.bottom + ycor); *p_xp = xp; *p_xt = xt; return; } int co2_Handle_List(LIST_VIEW_CONTROL2 * p_li, int x, int y, int hdc, int xcor, int ycor) { int xp = 0; int xt = 0; DWORD t = timeGetTime(); if (bBlockList) return 0; if (mi.dt1 && p_li->bIn > 0) { if (y < p_li->mpmin) y = p_li->mpmin; if (y > p_li->mpmax) y = p_li->mpmax; p_li->bIn = 0; goto HANDLE_LISTVIEW; } if (!mi.dt1) p_li->bIn = 0; if (p_li->Pushc < 2) if (t - p_li->pTime > 1000) { p_li->pTime = t; p_li->Pushc = 0; p_li->cSelected = -1; p_li->bClck = 0; p_li->bDblClck = 0; } if (co2_Rect_Hit(p_li->rectList, x, y)) { int i = (int) floor((p_li->dx + (y - p_li->rectList.top)) / 30.0f); if (mi.t1) { p_li->bClck++; p_li->Pushc++; } if (i < 0 || i > p_li->listnum) { ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); p_li->Selected = -1; p_li->Pushc = 0; p_li->pTime = t; if (mi.t1) { p_li->cSelected = -1; p_li->cClckSel = -1; } } else if (i != p_li->Selected) { if (mi.t1) p_li->cSelected = i; co2_get_XP_XT(p_li, i, &xp, &xt, ycor); ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); p_li->Selected = i; ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (i * 30) - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (i * 30) + xp); if (p_li->cClckSel != -1 && p_li->bSelection) { co2_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } } else if (mi.t1) { if (p_li->Pushc > 1) { if (p_li->cSelected == i) p_li->bDblClck = 1; p_li->Pushc = 0; p_li->pTime = t; } else p_li->cSelected = i; if (p_li->Pushc == 1) p_li->bClck = 1; p_li->cClckSel = i; if (p_li->bSelection) { ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); co2_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } } } else if (p_li->Selected != -1) { p_li->Selected = -1; ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); if (p_li->cClckSel != -1 && p_li->bSelection) { co2_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } } if (mi.t1) if (co2_Rect_Hit(p_li->rectUp, x, y)) { float dcm = (float) ddx2GetHeight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); float c = (p_li->rectMoverA.bottom - p_li->rectMoverA.top) / dcm; y = p_li->mpos - ftoi(30 * c); p_li->bInE = -1; p_li->bIn = -1; goto HANDLE_LISTVIEW; } if (mi.t1) if (co2_Rect_Hit(p_li->rectDown, x, y)) { float dcm = (float) ddx2GetHeight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); float c = (p_li->rectMoverA.bottom - p_li->rectMoverA.top) / dcm; y = p_li->mpos + ftoi(30 * c); p_li->bInE = -1; p_li->bIn = -1; goto HANDLE_LISTVIEW; } if (mi.t1 || mi.dt1) if (co2_Rect_Hit(p_li->rectMoverA, x, y)) { int dcm, mm, pm, pos; HANDLE_LISTVIEW: if (y > p_li->mpmax) y = p_li->mpmax; else if (y < p_li->mpmin) y = p_li->mpmin; if (p_li->mpos == y) { p_li->bIn++; return 1; } p_li->mpos = y; ddx2BitBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), p_li->bDCm, 0, 0); p_li->rectMover.top = p_li->mpos - 12; p_li->rectMover.bottom = p_li->mpos + 12; ddx2BitBlt(p_li->bDCm, 0, 0, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor); ddx2TransparentBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddx2GetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, RGB(237, 77, 0)); dcm = ddx2GetHeight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); mm = p_li->mpmax - p_li->mpmin; pm = p_li->mpos - p_li->mpmin; pos = ftoi((pm * dcm) / (float) mm); if (p_li->mpos == p_li->mpmax) pos = ddx2GetHeight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); if (p_li->mpos == p_li->mpmin) pos = 0; p_li->dx = pos; ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, pos); if (p_li->cClckSel != -1 && p_li->bSelection) { co2_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } p_li->bIn++; p_li->bInE++; return 1; } if (key[K_DEL]) { char *cfile = NULL; key[K_DEL] = 0; if (co2_List_Delete_Item(p_li, &cfile)) { p_li->dx = co2_List_Redraw(hdc, p_li, p_li->dx); co_delete(cfile); } if (cfile) free((void *) cfile); } return 0; } int co2_Handle_List_View(LIST_VIEW2_CONTROL2 * p_li, int x, int y, int hdc, int xcor, int ycor) { if (bBlockList) return 0; if ((mi.t1 && co2_Rect_Hit(p_li->rectUp, x, y)) || key[K_PLUS] || key[K_NAHORU]) { p_li->bIn = -1; p_li->bInE = -1; key[K_PLUS] = 0; key[K_NAHORU] = 0; p_li->dx -= 30; if (p_li->dx < 0) p_li->dx = 0; co2_Set_List_View_List_Pos(p_li, p_li->dx, hdc, xcor, ycor); return 1; } if ((mi.t1 && co2_Rect_Hit(p_li->rectDown, x, y)) || key[K_MINUS] || key[K_DOLU]) { p_li->bIn = -1; p_li->bInE = -1; key[K_MINUS] = 0; key[K_DOLU] = 0; p_li->dx += 30; if (p_li->dx > ddx2GetHeight(p_li->bDC) - (p_li->rectList.bottom - p_li->rectList.top)) p_li->dx = ddx2GetHeight(p_li->bDC) - (p_li->rectList.bottom - p_li->rectList.top); co2_Set_List_View_List_Pos(p_li, p_li->dx, hdc, xcor, ycor); return 1; } if (mi.t1 || mi.dt1) if (co2_Rect_Hit(p_li->rectMoverA, x, y)) { int dcm, mm, pm, pos; HANDLE_LISTVIEW: if (y > p_li->mpmax) y = p_li->mpmax; else if (y < p_li->mpmin) y = p_li->mpmin; if (p_li->mpos == y) { p_li->bIn++; return 1; } p_li->mpos = y; ddx2BitBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), p_li->bDCm, 0, 0); p_li->rectMover.top = p_li->mpos - 12; p_li->rectMover.bottom = p_li->mpos + 12; ddx2BitBlt(p_li->bDCm, 0, 0, ddx2GetWidth(p_li->bDCm), ddx2GetHeight(p_li->bDCm), hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor); ddx2TransparentBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddx2GetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, RGB(237, 77, 0)); dcm = ddx2GetHeight(p_li->bDC) - (p_li->rectList.bottom - p_li->rectList.top); mm = p_li->mpmax - p_li->mpmin; pm = p_li->mpos - p_li->mpmin; pos = ftoi((pm * dcm) / (float) mm); if (p_li->mpos == p_li->mpmax) pos = ddx2GetHeight(p_li->bDC) - (p_li->rectList.bottom - p_li->rectList.top); if (p_li->mpos == p_li->mpmin) pos = 0; p_li->dx = pos; ddx2BitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddx2GetWidth(p_li->bDC), p_li->rectList.bottom - p_li->rectList.top, p_li->bDC, 0, pos); p_li->bIn++; p_li->bInE++; return 1; } if (mi.dt1 && p_li->bIn > 0) { if (y < p_li->mpmin) y = p_li->mpmin; if (y > p_li->mpmax) y = p_li->mpmax; p_li->bIn = 0; goto HANDLE_LISTVIEW; } if (!mi.dt1) p_li->bIn = 0; return 0; } int co2_Is_Button_Activated(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_button) if ((p_list + i)->p_button->ButtonID == id && (p_list + i)->p_button->bActivated) return 1; return 0; } int co2_Check_Get_State(CONTROL_LIST_ITEM2 * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id) return (p_list + i)->p_check->bChecked; return 0; } int co2_Handle_wsclen(CONTROL_EDIT2 * p_ed) { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] == 95) { if (wcslen(p_ed->wtext) > 29) return 1; if (p_ed->tx > p_ed->rect.right - p_ed->rect.left - 30) return 1; } else { if (wcslen(p_ed->wtext) > 30) return 1; if (p_ed->tx > p_ed->rect.right - p_ed->rect.left - 30) return 1; } return 0; } int co2_Handle_Edit(CONTROL_EDIT2 * p_ed, int x, int y, int hdc, int xcor, int ycor) { DWORD t = timeGetTime(); if (mi.t1) { if (co2_Rect_Hit(p_ed->rect, x, y)) { if (!p_ed->bActive) { p_ed->pTime = t; p_ed->bcActive = 0; } p_ed->bActive = 1; return 1; } else { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] == 95) p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->bActive = 0; goto co2_HANDLE_DRAW; return 0; } } if (p_ed->bActive) { if (key[0] && key_pressed) { int xt, yt; WCHAR wt[3]; int size; if (co_Handle_Edit_Key_Filter() || (co2_Handle_wsclen(p_ed) && !key[K_BKSP])) { memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } wt[0] = wt[1] = wt[2] = 0; size = MultiByteToWideChar(CP_ACP, 0, (char *) &key_pressed, 1, wt, sizeof(wt) / sizeof(wt[0])); if(size > 1) { // we have got some unsupported character - ignore it memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } wt[0] = co_ToUnicode(key_pressed); if (!wt[0]) { memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } if (wt[0] == '_') { memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } if (key[K_ENTER]) { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] == 95) p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->bActive = 0; goto co2_HANDLE_DRAW; } if (key[K_BKSP]) { if (wcslen(p_ed->wtext)) { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] != 95) p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; else if (wcslen(p_ed->wtext) > 1) { p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->wtext[wcslen(p_ed->wtext) - 1] = 95; } else { p_ed->wtext[0] = 95; p_ed->wtext[1] = 0; } } } else { if (!wcslen(p_ed->wtext)) wcscat(p_ed->wtext, wt); else if (p_ed->wtext[wcslen(p_ed->wtext) - 1] != 95) wcscat(p_ed->wtext, wt); else { p_ed->wtext[wcslen(p_ed->wtext) - 1] = wt[0]; p_ed->wtext[wcslen(p_ed->wtext)] = 95; p_ed->wtext[wcslen(p_ed->wtext)] = 0; } } co2_HANDLE_DRAW: ddx2BitBlt(hdc, p_ed->rect.left + xcor, p_ed->rect.top + ycor, ddx2GetWidth(hdcED.hdcEdit), ddx2GetHeight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); ddx2CleareSurface(p_ed->bDC); fn2_Draw_MessageA(p_ed->bDC, 0, 3, &b2_3d_font.gt, &b2_3d_font.ts, p_ed->wtext, 0, &xt, &yt); ddx2TransparentBlt(hdc, p_ed->rect.left + 5 + xcor, p_ed->rect.top + 4 + xcor, p_ed->rect.right - p_ed->rect.left - 10, p_ed->rect.bottom - p_ed->rect.top - 8, p_ed->bDC, 0, 0, TRANSCOLOR); p_ed->tx = xt; memset(key, 0, POCET_KLAVES * sizeof(int)); } } if (t - p_ed->pTime > 500 && p_ed->bActive) { p_ed->pTime = t; if (!p_ed->bcActive) { char t[32]; WCHAR wt[32]; int xt, yt; p_ed->bcActive = 1; strcpy(t, "_"); MultiByteToWideChar(CP_ACP, 0, t, strlen(t) + 1, wt, sizeof(wt) / sizeof(wt[0])); if (!wcslen(p_ed->wtext)) wcscat(p_ed->wtext, wt); else if (p_ed->wtext[wcslen(p_ed->wtext) - 1] != 95) wcscat(p_ed->wtext, wt); fn2_Draw_MessageA(p_ed->bDC, 0, 3, &b2_3d_font.gt, &b2_3d_font.ts, p_ed->wtext, 0, &xt, &yt); ddx2TransparentBlt(hdc, p_ed->rect.left + 5 + xcor, p_ed->rect.top + 4 + ycor, p_ed->rect.right - p_ed->rect.left - 10, p_ed->rect.bottom - p_ed->rect.top - 8, p_ed->bDC, 0, 0, TRANSCOLOR); p_ed->tx = xt; } else { int xt, yt; p_ed->bcActive = 0; p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; ddx2BitBlt(hdc, p_ed->rect.left + xcor, p_ed->rect.top + ycor, ddx2GetWidth(hdcED.hdcEdit), ddx2GetHeight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); ddx2CleareSurface(p_ed->bDC); fn2_Draw_MessageA(p_ed->bDC, 0, 3, &b2_3d_font.gt, &b2_3d_font.ts, p_ed->wtext, 0, &xt, &yt); ddx2TransparentBlt(hdc, p_ed->rect.left + 5 + xcor, p_ed->rect.top + 4 + xcor, p_ed->rect.right - p_ed->rect.left - 10, p_ed->rect.bottom - p_ed->rect.top - 8, p_ed->bDC, 0, 0, TRANSCOLOR); p_ed->tx = xt; } } return 1; } char co2_Check_Open_Combo(CONTROL_LIST_ITEM2 * p_list, int lsize) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combo && (p_list + i)->bActive) if ((p_list + i)->p_combo->bList) return 1; return 0; } void co2_Handle_Controls(CONTROL_LIST_ITEM2 * p_list, int lsize, int x, int y, int hdc, int xcor, int ycor) { char c = co2_Check_Open_Combo(p_list, lsize); int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_list_v && (p_list + i)->bActive) { if (!co2_Handle_List_View((p_list + i)->p_list_v, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if ((p_list + i)->p_combo && (p_list + i)->bActive) { if (!co2_Handle_Combo((p_list + i)->p_combo, (p_list + i)->bFocus, x, y, hdc, xcor, ycor, c) && (p_list + i)->bFocus) (p_list + i)->bFocus = 0; else (p_list + i)->bFocus = 1; } if (mi.t1) if ((p_list + i)->p_combod && (p_list + i)->bActive) { if (!co2_Handle_Combo_Drop((p_list + i)->p_combod, (p_list + i)->bFocus, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else (p_list + i)->bFocus = 1; } if (mi.t1) if ((p_list + i)->p_button && (p_list + i)->bActive) { int xx = x, yy = y; if ((p_list + i)->iTab == -1) { xx += TAB_X; yy += TAB_Y; } if (!co2_Handle_Button((p_list + i)->p_button, xx, yy)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if (mi.t1) if ((p_list + i)->p_check && (p_list + i)->bActive) { if (!co2_Handle_Checkbox((p_list + i)->p_check, x, y)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } //if(mi.t1 || mi.dt1) if ((p_list + i)->p_prog && (p_list + i)->bActive) { if (!co2_Handle_Progres((p_list + i)->p_prog, x, y)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if ((p_list + i)->p_list && (p_list + i)->bActive) { if (!co2_Handle_List((p_list + i)->p_list, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if ((p_list + i)->p_edit && (p_list + i)->bActive) { if (!co2_Handle_Edit((p_list + i)->p_edit, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } } } void co2_Handle_Release(CONTROL_LIST_ITEM2 * p_list, int lsize) { int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_combo) co2_Release_Combo((p_list + i)->p_combo); if ((p_list + i)->p_button) co2_Release_Button((p_list + i)->p_button); if ((p_list + i)->p_check) co2_Release_CheckBox((p_list + i)->p_check); if ((p_list + i)->p_prog) co2_Release_Progres((p_list + i)->p_prog); if ((p_list + i)->p_list) co2_Release_List((p_list + i)->p_list); if ((p_list + i)->p_edit) co2_Release_Edit((p_list + i)->p_edit); if ((p_list + i)->p_combod) co2_Release_Combo_Drop((p_list + i)->p_combod); if ((p_list + i)->p_list_v) co2_Release_List_View((p_list + i)->p_list_v); } } berusky2-0.12/src/kofola/Setup.h0000644000175000017500000000255013674426075013456 00000000000000#ifndef __SETUP_ #define __SETUP_ #define POCETLISTU 8 #define POCETKLAVES 128 #define POCETAKTICNICHKLAVES 40 typedef struct { char no_sound; char camera_type; char fullscreen; char ditering; char text_detail; //Texture-level - Uroven detailu textur (0 = max) char text_detail_light; //Uroven detailu textur lightmap (0 = max) char text_mip_mapping; //Generovat pro startu mip-mapy + jejich povoleni TF char text_mip_filtr; //Filtr mip-map 0 - linearni/1 - trilinearni TF char channels; long pre_load; char soundvolume; char musicvolume; char ambientvolume; int key[POCETKLAVES]; char debug_vypisy; char debug_light; char kvalita_castic; char kvalita_casticv; char kvalita_casticp; char ovladani; char debug_fps; char debug_draty; char sada[20][MAX_FILENAME]; char posouvat_kameru; char extra_light_vertex; float text_ostrost; float p_kamera_alfa; float p_kamera_radius; char cursor[32]; char mirror_effects; char debug_kamery; char text_ans; int text_ans_stupen; int bugs_highlight; int items_highlight; int ovladani_rohy; int ovladani_rohy_default; int ovladani_rohy_smer; float ovladani_rohy_rychlost; int ovladani_pr_posun; int animace_okoli; char camera_intro; } SETUP; void Load_ini(void); void Save_ini(void); extern SETUP setup; #endif berusky2-0.12/src/kofola/Demo.cpp0000644000175000017500000004127313674426075013602 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include #include #include #include #include #include #include "3d_all.h" #include "Demo.h" #include "Bind.h" #include "Berusky3d_kofola_interface.h" #include "Berusky_universal.h" #include "profiles.h" extern PLAYER_PROFILE pPlayerProfile; extern int iActualLevel; extern int iActualScene; void demo_Set_Scene_Level(char *cDemo, int *pScene, int *pLevel) { char odir[MAX_FILENAME + 1]; FILE *file; DEMOFILEHEADER FileHeader; if (getcwd(odir, MAX_FILENAME) == NULL) return; if (chdir(SAVE_DIR)) return; file = fopen(cDemo, "rb"); if (!file) { /* GCC warns when we don't check the return value of chdir(). For some reason, casting to (void) doesn't work. */ if (chdir(odir)) return; return; } if (fread(&FileHeader, sizeof(DEMOFILEHEADER), 1, file) != 1) { fclose(file); return; } fclose(file); (*pScene) = FileHeader.iScene; (*pLevel) = FileHeader.iLevel; /* GCC warns when we don't check the return value of chdir(). For some reason, casting to (void) doesn't work. */ if (chdir(odir)) return; } int demo_Check_Owner(WCHAR * wPlayer, char *cDemo, WCHAR * wDemoName) { WCHAR wc[128]; char text[256]; DEMOFILEHEADER FileHeader; FILE *file; file = fopen(cDemo, "rb"); if (!file) return 0; if (fread(&FileHeader, sizeof(DEMOFILEHEADER), 1, file) != 1) { fclose(file); return 0; } fclose(file); if(FileHeader.iDemoID != 123456789 || FileHeader.iHiVer != DEMO_HIVERSION || FileHeader.iLoVer != DEMO_LOVERSION) return 0; strcpy(text, "ANAKREON_DEMO_ANAKREON"); MultiByteToWideChar(CP_ACP, 0, text, strlen(text)+1, wc, sizeof(wc)/sizeof(wc[0])); if(!wcscmp(wc, FileHeader.cPlayerName)) { wcscpy(wDemoName, FileHeader.cFileName); return 1; } if(wcscmp(wPlayer, FileHeader.cPlayerName)) return 0; else { wcscpy(wDemoName, FileHeader.cFileName); return 1; } return 0; } //------------------------------------------------------------------------------------------------ // init demo saving //------------------------------------------------------------------------------------------------ DEMOKEYFRAME *demo_Init(DEMOSTRUCTURE * p_Demo) { p_Demo->Frame_Counter = 0; p_Demo->p_First = (DEMOKEYFRAME *) mmalloc(sizeof(DEMOKEYFRAME)); p_Demo->p_Last = p_Demo->p_First; return p_Demo->p_First; } //------------------------------------------------------------------------------------------------ // Release demo key frame line //------------------------------------------------------------------------------------------------ void demo_Release(DEMOSTRUCTURE * p_Demo) { DEMOKEYFRAME *p_Frame, *p_Next; p_Frame = p_Demo->p_First; while(p_Frame) { p_Next = p_Frame->p_Next; kprintf(1, "Release Demo Frame Vkey = %d", p_Frame->Key); free((void *) p_Frame); p_Frame = p_Next; } p_Demo->p_First = NULL; } //------------------------------------------------------------------------------------------------ // add new demo key frame into the line //------------------------------------------------------------------------------------------------ DEMOKEYFRAME *demo_Create_Frame(DEMOSTRUCTURE * p_Demo) { p_Demo->p_Last->p_Next = NULL; p_Demo->p_Last->p_Next = (DEMOKEYFRAME *) mmalloc(sizeof(DEMOKEYFRAME)); p_Demo->Frame_Counter++; p_Demo->p_Last = p_Demo->p_Last->p_Next; p_Demo->p_Last->p_Next = NULL; p_Demo->Start = timeGetTime(); return p_Demo->p_Last; } //------------------------------------------------------------------------------------------------ // count eplaset time in millisecods //------------------------------------------------------------------------------------------------ DWORD demo_Eplased_Time(DWORD Start, DWORD Finish) { DWORD epl = Finish - Start; return epl; } //------------------------------------------------------------------------------------------------ // save demo //------------------------------------------------------------------------------------------------ int demo_Save(DEMOSTRUCTURE * p_Demo, char *p_File_Name, char Ovladani, char *cLevelName) { DEMOFILEHEADER FileHeader; FILE *file; int i; DEMOKEYFRAME *p_Frame; file = fopen(p_File_Name, "wb"); if (!file) return 0; ZeroMemory(&FileHeader, sizeof(FileHeader)); FileHeader.iHiVer = DEMO_HIVERSION; FileHeader.iLoVer = DEMO_LOVERSION; FileHeader.bOvladaniBerusek1 = Ovladani; strcpy(FileHeader.cLevelName, cLevelName); FileHeader.iDemoID = 123456789; FileHeader.iLevel = iActualLevel; FileHeader.iScene = iActualScene; fwrite(&FileHeader, sizeof(DEMOFILEHEADER), 1, file); fwrite(p_Demo, sizeof(DEMOSTRUCTURE), 1, file); p_Frame = p_Demo->p_First; for (i = 0; i < p_Demo->Frame_Counter; i++) { fwrite(p_Frame, sizeof(DEMOKEYFRAME), 1, file); p_Frame = p_Frame->p_Next; } fclose(file); return 1; } int demo_Exist(WCHAR * wName, char *cFile) { DEMOFILEHEADER FileHeader; DIR *dir; struct dirent *ent; int errno_save; dir = opendir("."); if (!dir) return 1; errno = 0; while ((ent = readdir(dir))) { char *name = ent->d_name; FILE *file; if (strcmp(name + strlen(name) - 4, ".dem")) { errno = 0; continue; } file = fopen(name, "rb"); if (!file) { errno = 0; continue; } if (fread(&FileHeader, sizeof(DEMOFILEHEADER), 1, file) != 1) { fclose(file); closedir(dir); return 1; } fclose(file); if (!wcscmp(FileHeader.cFileName, wName) && !wcscmp(FileHeader.cPlayerName, pPlayerProfile.cName)) { strcpy(cFile, name); closedir(dir); return 1; } // Reset `errno' for the next time around. errno = 0; } errno_save = errno; closedir(dir); return !!errno_save; } int demo_SaveWC(DEMOSTRUCTURE * p_Demo, WCHAR * wcName, char Ovladani, char *cLevelName, char *cLoadSignature) { char cFile[1024]; char pom[128]; char pom2[128]; DEMOFILEHEADER FileHeader; FILE *file; int i; DEMOKEYFRAME *p_Frame; _strdate(pom); for (i = 0; i < (signed) strlen(pom); i++) if (pom[i] == '/') pom[i] = '_'; _strtime(pom2); for (i = 0; i < (signed) strlen(pom2); i++) if (pom2[i] == ':') pom2[i] = '_'; sprintf(cFile, "demo_[%s]_[%s].dem", pom, pom2); if (chdir(SAVE_DIR)) return 0; //strcat(cText, DIR_SLASH_STRING); //strcat(cText, cFile); demo_Exist(wcName, cFile); file = fopen(cFile, "wb"); if (!file) return 0; ZeroMemory(&FileHeader, sizeof(FileHeader)); FileHeader.iHiVer = DEMO_HIVERSION; FileHeader.iLoVer = DEMO_LOVERSION; FileHeader.bOvladaniBerusek1 = Ovladani; wcscpy(FileHeader.cPlayerName, pPlayerProfile.cName); wcscpy(FileHeader.cFileName, wcName); strcpy(FileHeader.cLevelName, cLevelName); FileHeader.iDemoID = 123456789; FileHeader.iLevel = iActualLevel; FileHeader.iScene = iActualScene; if (!strcmp(cLoadSignature, "LOAD_GAME")) FileHeader.iLoadedLevel = 1; else FileHeader.iLoadedLevel = 0; fwrite(&FileHeader, sizeof(DEMOFILEHEADER), 1, file); fwrite(p_Demo, sizeof(DEMOSTRUCTURE), 1, file); p_Frame = p_Demo->p_First; for (i = 0; i < p_Demo->Frame_Counter; i++) { fwrite(p_Frame, sizeof(DEMOKEYFRAME), 1, file); p_Frame = p_Frame->p_Next; } fclose(file); return 1; } //------------------------------------------------------------------------------------------------ // load demo //------------------------------------------------------------------------------------------------ int demo_Load(DEMOSTRUCTURE * p_Demo, char *p_File_Name, char *bOvladani, char *cLevel_Name, char *cLoadedSignature) { DEMOFILEHEADER FileHeader; FILE *file; int i; DEMOKEYFRAME *p_Frame; DEMOKEYFRAME *p_Last; file = fopen(p_File_Name, "rb"); if (!file) { kprintf(1, "Demo file not found"); return 0; } if (fread(&FileHeader, sizeof(DEMOFILEHEADER), 1, file) != 1) { kprintf(1, "Cannot read %s", p_File_Name); fclose(file); return 0; } if (FileHeader.iDemoID != 123456789 || FileHeader.iHiVer != DEMO_HIVERSION || FileHeader.iLoVer != DEMO_LOVERSION) { kprintf(1, "Demo Version mismatch! - Expected: v%d.%d - File v%d.%d", DEMO_HIVERSION, DEMO_LOVERSION, FileHeader.iHiVer, FileHeader.iLoVer); fclose(file); return 0; } iActualLevel = FileHeader.iLevel; iActualScene = FileHeader.iScene; *bOvladani = FileHeader.bOvladaniBerusek1; strcpy(cLevel_Name, FileHeader.cLevelName); if (FileHeader.iLoadedLevel) strcpy(cLoadedSignature, "LOAD_GAME"); if (fread(p_Demo, sizeof(DEMOSTRUCTURE), 1, file) != 1) { kprintf(1, "Cannot read %s", p_File_Name); fclose(file); return 0; } p_Demo->bOvladaniBerusek1 = FileHeader.bOvladaniBerusek1; p_Demo->p_First = p_Demo->p_Last = NULL; for (i = 0; i < p_Demo->Frame_Counter; i++) { p_Frame = (DEMOKEYFRAME *) mmalloc(sizeof(DEMOKEYFRAME)); if (fread(p_Frame, sizeof(DEMOKEYFRAME), 1, file) != 1) { kprintf(1, "Cannot read %s", p_File_Name); fclose(file); demo_Release(p_Demo); free(p_Frame); return 0; } if (i == 0) p_Demo->p_First = p_Frame; else p_Last->p_Next = p_Frame; p_Last = p_Frame; p_Last->p_Next = NULL; } fclose(file); return 1; } int demo_Virual2Fuction(int iVirtualKey, CONTROL_KEYS * p_keys) { if (iVirtualKey == p_keys->move_forward) return 1; if (iVirtualKey == p_keys->turn_back) return 2; if (iVirtualKey == p_keys->turn_left) return 3; if (iVirtualKey == p_keys->turn_right) return 4; if (iVirtualKey == p_keys->next_beatle) return 5; /*if(iVirtualKey == p_keys->inventory) return 6; if(iVirtualKey == p_keys->inventory_select) return 7; if(iVirtualKey == p_keys->inventory_left) return 8; if(iVirtualKey == p_keys->inventory_right) return 9; if(iVirtualKey == p_keys->inventory_cancel) return 10; if(iVirtualKey == p_keys->camera_move_left) return 11; if(iVirtualKey == p_keys->camera_move_right) return 12; if(iVirtualKey == p_keys->camera_move_forward) return 13; if(iVirtualKey == p_keys->camera_move_back) return 14; */ if (iVirtualKey == p_keys->camera_zoom_in) return 15; if (iVirtualKey == p_keys->camera_zoom_out) return 16; /*if(iVirtualKey == p_keys->camera_turn_left) return 17; if(iVirtualKey == p_keys->camera_turn_right) return 18; if(iVirtualKey == p_keys->camera_turn_up) return 19; if(iVirtualKey == p_keys->camera_turn_down) return 20; */ if (iVirtualKey == p_keys->camera_fast_turn_left) return 21; if (iVirtualKey == p_keys->camera_fast_turn_right) return 22; if (iVirtualKey == p_keys->camera_center) return 23; if (iVirtualKey == p_keys->menu) return 24; if (iVirtualKey == p_keys->item_lock) return 25; if (iVirtualKey == p_keys->blow_detonation_pack) return 26; if (iVirtualKey == p_keys->beatle1) return 27; if (iVirtualKey == p_keys->beatle2) return 28; if (iVirtualKey == p_keys->beatle3) return 29; if (iVirtualKey == p_keys->beatle4) return 30; if (iVirtualKey == p_keys->beatle5) return 31; if (iVirtualKey == p_keys->beatle6) return 32; /*if(iVirtualKey == p_keys->item1) return 33; if(iVirtualKey == p_keys->item2) return 34; if(iVirtualKey == p_keys->item3) return 35; if(iVirtualKey == p_keys->item4) return 36; */ if (iVirtualKey == p_keys->next_song) return 37; if (iVirtualKey == p_keys->disable_inventory) return 38; if (iVirtualKey == p_keys->disable_top_ledge) return 39; if (iVirtualKey == p_keys->screenshot) return 40; if (iVirtualKey == p_keys->visibility) return 41; if (iVirtualKey == p_keys->hint) return 42; if (iVirtualKey == p_keys->restart) return 43; if (iVirtualKey == p_keys->highlight) return 44; if (iVirtualKey == p_keys->camera_move) return 45; if (iVirtualKey == p_keys->camera_rotation) return 46; if (iVirtualKey == p_keys->pause) return 47; return 0; } int demo_Fuction2Virtual(int iFunctionKey, CONTROL_KEYS * p_keys) { switch (iFunctionKey) { case 1: return p_keys->move_forward; case 2: return p_keys->turn_back; case 3: return p_keys->turn_left; case 4: return p_keys->turn_right; case 5: return p_keys->next_beatle; case 6: return p_keys->inventory; case 7: return p_keys->inventory_select; case 8: return p_keys->inventory_left; case 9: return p_keys->inventory_right; case 10: return p_keys->inventory_cancel; case 11: return p_keys->camera_move_left; case 12: return p_keys->camera_move_right; case 13: return p_keys->camera_move_forward; case 14: return p_keys->camera_move_back; case 15: return p_keys->camera_zoom_in; case 16: return p_keys->camera_zoom_out; case 17: return p_keys->camera_turn_left; case 18: return p_keys->camera_turn_right; case 19: return p_keys->camera_turn_up; case 20: return p_keys->camera_turn_down; case 21: return p_keys->camera_fast_turn_left; case 22: return p_keys->camera_fast_turn_right; case 23: return p_keys->camera_center; case 24: return p_keys->menu; case 25: return p_keys->item_lock; case 26: return p_keys->blow_detonation_pack; case 27: return p_keys->beatle1; case 28: return p_keys->beatle2; case 29: return p_keys->beatle3; case 30: return p_keys->beatle4; case 31: return p_keys->beatle5; case 32: return p_keys->beatle6; case 33: return p_keys->item1; case 34: return p_keys->item2; case 35: return p_keys->item3; case 36: return p_keys->item4; case 37: return p_keys->next_song; case 38: return p_keys->disable_inventory; case 39: return p_keys->disable_top_ledge; case 40: return p_keys->screenshot; case 41: return p_keys->visibility; case 42: return p_keys->hint; case 43: return p_keys->restart; case 44: return p_keys->highlight; case 45: return p_keys->camera_move; case 46: return p_keys->camera_rotation; case 47: return p_keys->pause; default: return 0; } } int demo_Get_Move(int *pos_o, int *pos_n) { int x = pos_o[0] - pos_n[0]; int y = pos_o[1] - pos_n[1]; if (x < 0) return 1; else if (x > 0) return 3; else if (y < 0) return 0; else return 2; } int demo_Rotation(int initRot, int finishRot) { int rot = initRot - finishRot; float t[3], fr, fi, di; int s, ss; kam_pol_get((BOD *) t, &fr, &fi, &di); fr = fr / 90.0f; s = ftoi(fr); s = s % 4; if (s > 0) ss = 4 - s; else ss = abs(s); rot = 4 - (ss - finishRot); if (rot > 3) rot = rot % 4; else rot = abs(rot); //kprintf(1, "keyrot = %d, rot = %d", finishRot, rot); return rot; } int demo_Create_Sequence(int *pKeyLine, int iKLSize, DEMOKEYFRAME * pFrame, char *pBerusky1, int Rotation, CONTROL_KEYS * p_cont, DEMOSTRUCTURE * pDemo, int *pos_a) { int i, c = 0; if (!pFrame) return 0; for (i = 0; i < 3; i++) if (pFrame->pos_n[i] != -1) c++; for (i = 0; i < 3; i++) if (pFrame->pos_o[i] != -1) c++; ZeroMemory(pKeyLine, iKLSize * sizeof(int)); //nejedna se o pokus o pohyb if (!c) { pKeyLine[0] = demo_Fuction2Virtual(pFrame->Key, p_cont); pDemo->p_Last = pFrame->p_Next; return 1; } if (pFrame->bOvladaniBerusek1) { int rot = demo_Rotation(Rotation, demo_Get_Move(pFrame->pos_o, pFrame->pos_n)); *pBerusky1 = 1; if (!rot) pKeyLine[0] = p_cont->move_forward; else if (rot == 1) pKeyLine[0] = p_cont->turn_right; else if (rot == 2) pKeyLine[0] = p_cont->turn_back; else pKeyLine[0] = p_cont->turn_left; pDemo->p_Last = pFrame->p_Next; } else { int move = demo_Get_Move(pFrame->pos_o, pFrame->pos_n); int rot = Rotation - move; *pBerusky1 = 0; if (!rot) pKeyLine[0] = p_cont->move_forward; else if (abs(rot) == 2) { pKeyLine[0] = p_cont->turn_back; pKeyLine[1] = p_cont->move_forward; } else if (Rotation - 1 == move || (!Rotation && move == 3)) { pKeyLine[0] = p_cont->turn_left; pKeyLine[1] = p_cont->move_forward; } else { pKeyLine[0] = p_cont->turn_right; pKeyLine[1] = p_cont->move_forward; } pDemo->p_Last = pFrame->p_Next; } return 1; } berusky2-0.12/src/kofola/controls.cpp0000644000175000017500000026662313674766375014603 00000000000000#include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "controls.h" #include "2D_graphic.h" #include "font.h" #include "menu_def.h" //#include "2ddx.h" #define HDC2DD -1 extern B2_FONT b2_2d_font; extern char pControlsDir[MAX_FILENAME]; extern HDC BackDC; static char bBlockList = 0; static char bExclusive = 0; extern RECT_LINE rline; extern MOUSE_INFO dim; HDC_EDIT_CONTROL hdcED; HDC_COMBO_CONTROL hdcCO; HDC_LIST_CONTROL hdcLI; HDC_BUTTON_CONTROL hdcBU; HDC_CHECKBOX_CONTROL hdcCH; HDC_PROGRES_CONTROL hdcPR; HDC_FRAME_CONTROL hdcFR; void co_Del_Combo_List(COMBO_CONTROL * p_co, int hdc, int xcor, int ycor); int co_Load_Graphic(int combo_var) { if (!combo_var) { hdcCO.hdcCombo = ddxLoadBitmap("combo.png", pControlsDir); hdcCO.hdcComboEnd = ddxLoadBitmap("combo_end.png", pControlsDir); hdcCO.hdcComboMid = ddxLoadBitmap("combo_mid.png", pControlsDir); } else { hdcCO.hdcCombo = ddxLoadBitmap("combo_l.png", pControlsDir); hdcCO.hdcComboEnd = ddxLoadBitmap("combo_end_l.png", pControlsDir); hdcCO.hdcComboMid = ddxLoadBitmap("combo_mid_l.png", pControlsDir); } hdcCO.hdcComboUp = ddxLoadBitmap("combo_up.png", pControlsDir); hdcCO.hdcComboDown = ddxLoadBitmap("combo_down.png", pControlsDir); hdcCO.hdcComboDrop = ddxLoadBitmap("combo_drop.png", pControlsDir); hdcCO.hdcComboMover = ddxLoadBitmap("combo_mover.png", pControlsDir); hdcCO.hdcComboMoverb = ddxLoadBitmap("combo_moverb.png", pControlsDir); if (!combo_var) hdcED.hdcEdit = ddxLoadBitmap("edit.png", pControlsDir); else hdcED.hdcEdit = ddxLoadBitmap("edit_l.png", pControlsDir); hdcLI.hdcListDown = ddxLoadBitmap("list_down.png", pControlsDir); hdcLI.hdcListMover = ddxLoadBitmap("list_mover.png", pControlsDir); hdcLI.hdcListUp = ddxLoadBitmap("list_up.png", pControlsDir); hdcLI.hdcListTop = ddxLoadBitmap("list_top.png", pControlsDir); hdcLI.hdcListBottom = ddxLoadBitmap("list_bottom.png", pControlsDir); hdcLI.hdcListLeft = ddxLoadBitmap("list_left.png", pControlsDir); hdcLI.hdcListRight = ddxLoadBitmap("list_right.png", pControlsDir); hdcLI.hdcListTL = ddxLoadBitmap("list_tl.png", pControlsDir); hdcLI.hdcListTR = ddxLoadBitmap("list_tr.png", pControlsDir); hdcLI.hdcListBL = ddxLoadBitmap("list_bl.png", pControlsDir); hdcLI.hdcListBR = ddxLoadBitmap("list_br.png", pControlsDir); hdcBU.hdcButtonL = ddxLoadBitmap("button_l.png", pControlsDir); hdcBU.hdcButtonS = ddxLoadBitmap("button_s.png", pControlsDir); hdcCH.hdcCheck = ddxLoadBitmap("checkbox.png", pControlsDir); hdcCH.hdcGray = ddxLoadBitmap("gray.png", pControlsDir); hdcPR.hdcLine = ddxLoadBitmap("progres_line.png", pControlsDir); hdcPR.hdcMover = ddxLoadBitmap("progres_mover.png", pControlsDir); hdcFR.hdcFrame = ddxLoadBitmap("frame.png", pControlsDir); bBlockList = 0; bExclusive = 0; return 1; } int co_Release_Graphic(void) { ddxReleaseBitmap(hdcCO.hdcCombo); ddxReleaseBitmap(hdcCO.hdcComboEnd); ddxReleaseBitmap(hdcCO.hdcComboMid); ddxReleaseBitmap(hdcCO.hdcComboDown); ddxReleaseBitmap(hdcCO.hdcComboUp); ddxReleaseBitmap(hdcCO.hdcComboDrop); ddxReleaseBitmap(hdcCO.hdcComboMover); ddxReleaseBitmap(hdcCO.hdcComboMoverb); zero_memory(&hdcCO,sizeof(hdcCO)); ddxReleaseBitmap(hdcED.hdcEdit); zero_memory(&hdcED,sizeof(hdcED)); ddxReleaseBitmap(hdcLI.hdcListDown); ddxReleaseBitmap(hdcLI.hdcListMover); ddxReleaseBitmap(hdcLI.hdcListUp); ddxReleaseBitmap(hdcLI.hdcListTop); ddxReleaseBitmap(hdcLI.hdcListBottom); ddxReleaseBitmap(hdcLI.hdcListLeft); ddxReleaseBitmap(hdcLI.hdcListRight); ddxReleaseBitmap(hdcLI.hdcListTL); ddxReleaseBitmap(hdcLI.hdcListTR); ddxReleaseBitmap(hdcLI.hdcListBL); ddxReleaseBitmap(hdcLI.hdcListBR); zero_memory(&hdcLI,sizeof(hdcLI)); ddxReleaseBitmap(hdcBU.hdcButtonL); ddxReleaseBitmap(hdcBU.hdcButtonS); zero_memory(&hdcBU, sizeof(hdcBU)); ddxReleaseBitmap(hdcCH.hdcCheck); ddxReleaseBitmap(hdcCH.hdcGray); zero_memory(&hdcCH,sizeof(hdcCH)); ddxReleaseBitmap(hdcPR.hdcLine); ddxReleaseBitmap(hdcPR.hdcMover); zero_memory(&hdcPR,sizeof(hdcPR)); ddxReleaseBitmap(hdcFR.hdcFrame); zero_memory(&hdcFR,sizeof(hdcFR)); return 1; } void co_Combo_Draw(int hdc, COMBO_CONTROL * p_co, int xcor, int ycor) { int i; int c = 0; int x = p_co->x; int y = p_co->y; // int width = p_co->Width; // int hight = p_co->Hight; int maxlisthight = p_co->ListMaxHight; int ax = p_co->x, ay = p_co->y, ly; //------------------------------------------------------- EDIT BOX ---------------------------------------------- if (p_co->bEdit) { ddxBitBlt(hdc, ax, ay, ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcCombo), hdcCO.hdcCombo, 0, 0); } p_co->coEditRect.top = p_co->y; p_co->coEditRect.bottom = p_co->y + ddxGetHight(hdcCO.hdcCombo); p_co->coEditRect.left = p_co->x; p_co->coEditRect.right = p_co->x + ddxGetWidth(hdcCO.hdcCombo); p_co->WidthR = ddxGetWidth(hdcCO.hdcCombo); //------------------------------------------------------- EDIT BOX ---------------------------------------------- //------------------------------------------------------- EDIT BOX DOWN BUTTON ---------------------------------- /*p_co->coDownRect.top = p_co->coEditRect.top+5; p_co->coDownRect.bottom = p_co->coEditRect.bottom - 5; p_co->coDownRect.left = p_co->coEditRect.right - 28; p_co->coDownRect.right = p_co->coEditRect.right - 5; */ p_co->coDownRect.top = p_co->y; p_co->coDownRect.bottom = p_co->y + ddxGetHight(hdcCO.hdcCombo); p_co->coDownRect.left = p_co->x; p_co->coDownRect.right = p_co->x + ddxGetWidth(hdcCO.hdcCombo); //------------------------------------------------------- EDIT BOX DOWN BUTTON ---------------------------------- ay += ddxGetHight(hdcCO.hdcCombo); ax = p_co->x; ly = ay; //------------------------------------------------------- EDIT BOX LIST BOX ------------------------------------- ddxSetFlip(0); for (i = 0; i < 2; i++) { ay = ly; c = 0; while (ay < ly + maxlisthight) { if (p_co->bList) { ddxBitBlt(hdc, ax + xcor, ay + ycor, ddxGetWidth(hdcCO.hdcComboMid), ddxGetHight(hdcCO.hdcComboMid), hdcCO.hdcComboMid, 0, 0); if(p_co->pItem) ddxTransparentBlt(hdc, ax + xcor + 5, ay + ycor + 3, ddxGetWidth(p_co->pItem[c].Norm), ddxGetHight(p_co->pItem[c].Norm), p_co->pItem[c].Norm, 0, 0, ddxGetWidth(p_co->pItem[c].Norm), ddxGetHight(p_co->pItem[c].Norm), TRANSCOLOR); } c++; ay += ddxGetHight(hdcCO.hdcComboMid); } if (!i) DisplayFrame(); } ddxSetFlip(1); if (p_co->bList) { ddxBitBlt(hdc, ax + xcor, ay + ycor, ddxGetWidth(hdcCO.hdcComboEnd), ddxGetHight(hdcCO.hdcComboEnd), hdcCO.hdcComboEnd, 0, 0); } p_co->ListMaxHightR = ay + ddxGetHight(hdcCO.hdcComboEnd) - ly; if (p_co->CounfOfItems > p_co->CounfOfItemsL) { ddxBitBlt(hdc, x + ddxGetWidth(hdcCO.hdcCombo) + xcor - 4 - ddxGetWidth(hdcCO.hdcComboUp), y + ycor + ddxGetHight(hdcCO.hdcCombo), ddxGetWidth(hdcCO.hdcComboUp), ddxGetHight(hdcCO.hdcComboUp), hdcCO.hdcComboUp, 0, 0); ddxBitBlt(hdc, x + ddxGetWidth(hdcCO.hdcCombo) + xcor - 4 - ddxGetWidth(hdcCO.hdcComboDown), ay + ddxGetHight(hdcCO.hdcComboEnd) + ycor - ddxGetHight(hdcCO.hdcComboDown) - 4, ddxGetWidth(hdcCO.hdcComboDown), ddxGetHight(hdcCO.hdcComboDown), hdcCO.hdcComboDown, 0, 0); p_co->coLDown.top = ay + ddxGetHight(hdcCO.hdcComboEnd) + ycor - ddxGetHight(hdcCO.hdcComboDown) - 4; p_co->coLDown.bottom = p_co->coLDown.top + ddxGetHight(hdcCO.hdcComboDown); p_co->coLDown.left = x + ddxGetWidth(hdcCO.hdcCombo) + xcor - 4 - ddxGetWidth(hdcCO.hdcComboDown); p_co->coLDown.right = p_co->coLDown.left + ddxGetWidth(hdcCO.hdcComboDown); p_co->coLUp.top = y + ycor + ddxGetHight(hdcCO.hdcCombo); p_co->coLUp.bottom = p_co->coLUp.top + ddxGetHight(hdcCO.hdcComboUp); p_co->coLUp.left = x + ddxGetWidth(hdcCO.hdcCombo) + xcor - 4 - ddxGetWidth(hdcCO.hdcComboDown); p_co->coLUp.right = p_co->coLUp.left + ddxGetWidth(hdcCO.hdcComboUp); p_co->coLMov.top = p_co->coLUp.bottom + 1; p_co->coLMov.bottom = p_co->coLDown.top + 1; p_co->coLMov.left = p_co->coLUp.left; p_co->coLMov.right = p_co->coLMov.left + ddxGetWidth(hdcCO.hdcComboMover); ddxBitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddxGetWidth(hdcCO.hdcComboMover), ddxGetHight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); p_co->xmstart = p_co->coLMov.top; p_co->xm = p_co->coLDown.top - p_co->coLMov.top - ddxGetHight(hdcCO.hdcComboMover); p_co->xmp = p_co->coLMov.top + (int) floor(ddxGetHight(hdcCO.hdcComboMover) / 2.0f); p_co->xmstart += (int) floor(ddxGetHight(hdcCO.hdcComboMover) / 2.0f); p_co->coLMovA.top = p_co->coLUp.bottom + 1; p_co->coLMovA.bottom = p_co->coLDown.top - 1; p_co->coLMovA.left = p_co->coLMov.left; p_co->coLMovA.right = p_co->coLMov.right; } else { p_co->coLDown.top = -1; p_co->coLDown.bottom = -1; p_co->coLDown.left = -1; p_co->coLDown.right = -1; p_co->coLUp.top = -1; p_co->coLUp.bottom = -1; p_co->coLUp.left = -1; p_co->coLUp.right = -1; p_co->coLMov.top = -1; p_co->coLMov.bottom = -1; p_co->coLMov.left = -1; p_co->coLMov.right = -1; p_co->coLMovA.top = -1; p_co->coLMovA.bottom = -1; p_co->coLMovA.left = -1; p_co->coLMovA.right = -1; } //------------------------------------------------------- EDIT BOX LIST BOX ------------------------------------- } void co_Combo_Draw_List(int hdc, COMBO_CONTROL * p_co, int xcor, int ycor, char bDel) { int i; int c = 0 + p_co->SSelected; int maxlisthight = p_co->ListMaxHight; int ax = p_co->x, ay = p_co->y, ly; if (p_co->CSelected == p_co->Selected) return; ay += ddxGetHight(hdcCO.hdcCombo); ly = ay; ddxSetFlip(0); for (i = 0; i < 2; i++) { c = p_co->SSelected; ay = ly; if (bDel) co_Del_Combo_List(p_co, hdc, xcor, ycor); while (ay < ly + maxlisthight) { if (p_co->bList) { if (c == p_co->CSelected && c != p_co->Selected) { if (p_co->pItem) { ddxTransparentBlt(hdc, ax + xcor + 5, ay + ycor + 3, ddxGetWidth(p_co->pItem[c].Sel), ddxGetHight(p_co->pItem[c].Sel), p_co->pItem[c].Sel, 0, 0, ddxGetWidth(p_co->pItem[c].Sel), ddxGetHight(p_co->pItem[c].Sel), TRANSCOLOR); } } else { if (p_co->pItem) { ddxTransparentBlt(hdc, ax + xcor + 5, ay + ycor + 3, ddxGetWidth(p_co->pItem[c].Norm), ddxGetHight(p_co->pItem[c].Norm), p_co->pItem[c].Norm, 0, 0, ddxGetWidth(p_co->pItem[c].Norm), ddxGetHight(p_co->pItem[c].Norm), TRANSCOLOR); } } } c++; ay += ddxGetHight(hdcCO.hdcComboMid); } if (!i) DisplayFrame(); } ddxSetFlip(1); } int co_Combo_Hit2Sel(COMBO_CONTROL * p_co, int x, int y) { int ay = p_co->y + ddxGetHight(hdcCO.hdcCombo); return (int) floor((y - ay) / (float) ddxGetHight(hdcCO.hdcComboMid)); } void co_Release_Edit(CONTROL_EDIT * p_ed) { ddxReleaseBitmap(p_ed->bDC); free((void *) p_ed); } void co_Release_Combo(COMBO_CONTROL * p_co) { int i; bBlockList = 0; if (p_co->pItem) { for (i = 0; i < p_co->CounfOfItems; i++) { //co_Release_Bitmap(&p_co->pItem[i].Norm); ddxReleaseBitmap(p_co->pItem[i].Norm); //co_Release_Bitmap(&p_co->pItem[i].Sel); ddxReleaseBitmap(p_co->pItem[i].Sel); } free((void *) p_co->pItem); } if (p_co->pBDC) { //co_Release_Bitmap(p_co->pBDC); ddxReleaseBitmap(*p_co->pBDC); free((void *) p_co->pBDC); } free((void *) p_co); } COMBO_CONTROL *co_Create_Combo(int hdc, int x, int y, int maxlisthight, int id) { COMBO_CONTROL *p_co = (COMBO_CONTROL *) mmalloc(sizeof(COMBO_CONTROL)); p_co->comboID = id; p_co->x = x; p_co->y = y; p_co->Hight = ddxGetWidth(hdcCO.hdcCombo); p_co->Width = ddxGetHight(hdcCO.hdcCombo); p_co->ListMaxHight = maxlisthight; p_co->bEdit = 1; p_co->bList = 0; p_co->pBDC = NULL; p_co->Selected = -1; p_co->CSelected = -1; p_co->SSelected = 0; p_co->OSelected = -1; p_co->pItem = NULL; p_co->CounfOfItems = 0; p_co->xm = 0; p_co->xmstart = 0; p_co->bIn = 0; co_Combo_Draw(hdc, p_co, 0, 0); return p_co; } void co_Release_Combo_Drop(COMBO_DROP_CONTROL * p_co) { int i; bBlockList = 0; if (p_co->pItem) { for (i = 0; i < p_co->CounfOfItems; i++) { //co_Release_Bitmap(&p_co->pItem[i].Norm); ddxReleaseBitmap(p_co->pItem[i].Norm); //co_Release_Bitmap(&p_co->pItem[i].Sel); ddxReleaseBitmap(p_co->pItem[i].Sel); } free((void *) p_co->pItem); } free((void *) p_co); } COMBO_DROP_CONTROL *co_Create_Combo_Drop(int hdc, int x, int y, int id) { int ax, ay; COMBO_DROP_CONTROL *p_co = NULL; p_co = (COMBO_DROP_CONTROL *) malloc(sizeof(COMBO_DROP_CONTROL)); if (!p_co) return 0; ZeroMemory(p_co, sizeof(COMBO_DROP_CONTROL)); p_co->CounfOfItems = 0; p_co->dropID = id; p_co->pItem = NULL; p_co->Selected = -1; p_co->x = x; p_co->y = y; /* BitBlt(hdc, x, y, _2dd.bitmap[hdcCO.hdcComboDrop].bitmap.bmWidth, _2dd.bitmap[hdcCO.hdcComboDrop].bitmap.bmHeight, _2dd.bitmap[hdcCO.hdcComboDrop].bitmapDC, 0, 0, SRCCOPY);*/ ddxBitBlt(hdc, x, y, ddxGetWidth(hdcCO.hdcComboDrop), ddxGetHight(hdcCO.hdcComboDrop), hdcCO.hdcComboDrop, 0, 0); ax = x + ddxGetWidth(hdcCO.hdcComboDrop); ay = y + ddxGetHight(hdcCO.hdcComboDrop); p_co->coLUp.top = y + 5; p_co->coLUp.bottom = ay - 5; p_co->coLUp.left = ax - 20; p_co->coLUp.right = ax - 2; p_co->coLDown.top = y + 5; p_co->coLDown.bottom = ay - 5; p_co->coLDown.left = ax - 39; p_co->coLDown.right = ax - 21; return p_co; } int co_Combo_Drop_Add_String(COMBO_DROP_CONTROL * p_co, char *text, float fValue) { int tx, ty; WCHAR wc[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddxCreateSurface(ddxGetWidth(hdcCO.hdcComboDrop) - 20, ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddxCreateSurface(ddxGetWidth(hdcCO.hdcComboDrop) - 20, ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); p_co->pItem[p_co->CounfOfItems - 1].fValue = fValue; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, 0, &tx, &ty); fn_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); return 1; } int co_Combo_Drop_Add_StringWC(COMBO_DROP_CONTROL * p_co, char *text, float fValue) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddxCreateSurface(ddxGetWidth(hdcCO.hdcComboDrop) - 20, ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddxCreateSurface(ddxGetWidth(hdcCO.hdcComboDrop) - 20, ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); p_co->pItem[p_co->CounfOfItems - 1].fValue = fValue; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 0, &tx, &ty); fn_Draw_Message(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 1, &tx, &ty); return 1; } int co_Combo_Drop_Set_Sel(int hdc, COMBO_DROP_CONTROL * p_co, int i) { p_co->Selected = i; /* BitBlt(hdc, p_co->x, p_co->y, _2dd.bitmap[hdcCO.hdcComboDrop].bitmap.bmWidth, _2dd.bitmap[hdcCO.hdcComboDrop].bitmap.bmHeight, _2dd.bitmap[hdcCO.hdcComboDrop].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, p_co->x, p_co->y, ddxGetWidth(hdcCO.hdcComboDrop), ddxGetHight(hdcCO.hdcComboDrop), hdcCO.hdcComboDrop, 0, 0); if (p_co->pItem) { /*TransparentBltU(hdc, p_co->x + 5, p_co->y + 7, p_co->pItem[p_co->Selected].Norm.x, p_co->pItem[p_co->Selected].Norm.y, p_co->pItem[p_co->Selected].Norm.hdc, 0, 0, p_co->pItem[p_co->Selected].Norm.x, p_co->pItem[p_co->Selected].Norm.y, TRANSCOLOR); */ ddxTransparentBlt(hdc, p_co->x + 5, p_co->y + 7, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), TRANSCOLOR); } return 1; } int co_Combo_Drop_Set_String(int hdc, COMBO_DROP_CONTROL * p_co, int xcor, int ycor) { int i; if (p_co->Selected < 0) return 0; ddxSetFlip(0); for (i = 0; i < 2; i++) { ddxBitBlt(hdc, p_co->x + xcor, p_co->y + ycor, ddxGetWidth(hdcCO.hdcComboDrop), ddxGetHight(hdcCO.hdcComboDrop), hdcCO.hdcComboDrop, 0, 0); if (p_co->pItem) ddxTransparentBlt(hdc, p_co->x + xcor + 5, p_co->y + ycor + 7, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), TRANSCOLOR); if (!i) DisplayFrame(); } ddxSetFlip(1); return 1; } int co_Combo_Drop_Get_Sel(CONTROL_LIST_ITEM * p_list, int lsize, int id, float *pf) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combod) if ((p_list + i)->p_combod->dropID == id) { if ((p_list + i)->p_combod->pItem && (p_list + i)->p_combod->Selected > -1) *pf = (p_list + i)->p_combod->pItem[(p_list + i)->p_combod->Selected].fValue; return (p_list + i)->p_combod->Selected; } return -1; } int co_Combo_Add_String(COMBO_CONTROL * p_co, char *text) { int tx, ty; WCHAR wc[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddxCreateSurface(ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddxCreateSurface(ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, 0, &tx, &ty); fn_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); return 1; } int co_Combo_Add_StringWC2(COMBO_CONTROL * p_co, WCHAR * wc, char *text) { int tx, ty; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddxCreateSurface(ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddxCreateSurface(ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); fn_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, 0, &tx, &ty); fn_Draw_MessageA(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); return 1; } int co_Combo_Add_StringWC(COMBO_CONTROL * p_co, char *text) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; p_co->CounfOfItems++; p_co->pItem = (COMBO_ITEM *) realloc(p_co->pItem, p_co->CounfOfItems * sizeof(COMBO_ITEM)); if (!p_co->pItem) return 0; p_co->pItem[p_co->CounfOfItems - 1].Norm = ddxCreateSurface(ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); p_co->pItem[p_co->CounfOfItems - 1].Sel = ddxCreateSurface(ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcComboMid), ddxFindFreeSurface()); strcpy(p_co->pItem[p_co->CounfOfItems - 1].text, text); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(p_co->pItem[p_co->CounfOfItems - 1].Norm, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 0, &tx, &ty); fn_Draw_Message(p_co->pItem[p_co->CounfOfItems - 1].Sel, 2, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 1, &tx, &ty); return 1; } int co_Combo_Set_String(int hdc, COMBO_CONTROL * p_co, int xcor, int ycor) { if (p_co->Selected < 0) return 0; /*BitBlt(hdc, p_co->x + xcor, p_co->y + ycor, _2dd.bitmap[hdcCO.hdcCombo].bitmap.bmWidth, _2dd.bitmap[hdcCO.hdcCombo].bitmap.bmHeight, _2dd.bitmap[hdcCO.hdcCombo].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, p_co->x + xcor, p_co->y + ycor, ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcCombo), hdcCO.hdcCombo, 0, 0); if (p_co->pItem) { /*TransparentBltU(hdc, p_co->x + xcor + 5, p_co->y + ycor + 7, p_co->pItem[p_co->Selected].Norm.x, p_co->pItem[p_co->Selected].Norm.y, p_co->pItem[p_co->Selected].Norm.hdc, 0, 0, p_co->pItem[p_co->Selected].Norm.x, p_co->pItem[p_co->Selected].Norm.y, TRANSCOLOR); */ ddxTransparentBlt(hdc, p_co->x + xcor + 5, p_co->y + ycor + 7, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), TRANSCOLOR); } return 1; } int co_Combo_Set_Sel(int hdc, COMBO_CONTROL * p_co, int i) { int xp = 0; int yp = 0; p_co->Selected = i; p_co->OSelected = i; if (hdc == HDC2DD) { xp = TAB_X; yp = TAB_Y; } ddxBitBlt(hdc, p_co->x + xp, p_co->y + yp, ddxGetWidth(hdcCO.hdcCombo), ddxGetHight(hdcCO.hdcCombo), hdcCO.hdcCombo, 0, 0); if (p_co->pItem) ddxTransparentBlt(hdc, p_co->x + 5 + xp, p_co->y + 7 + yp, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), p_co->pItem[p_co->Selected].Norm, 0, 0, ddxGetWidth(p_co->pItem[p_co->Selected].Norm), ddxGetHight(p_co->pItem[p_co->Selected].Norm), TRANSCOLOR); return 1; } int co_Combo_Get_Sel(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combo) if ((p_list + i)->p_combo->comboID == id) return (p_list + i)->p_combo->Selected; return -1; } int co_Combo_Get_Sel_Not_Opend(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combo) if ((p_list + i)->p_combo->comboID == id && !(p_list + i)->p_combo->bList) return (p_list + i)->p_combo->Selected; return -1; } int co_Combo_Set_Params(COMBO_CONTROL * p_co, int itemnum) { p_co->ListMaxHight = itemnum * ddxGetHight(hdcCO.hdcComboMid); p_co->CounfOfItemsL = itemnum; return 1; } int co_Combo_Open(int hdc, COMBO_CONTROL * p_co, int xcor, int ycor) { int *pDCI; if (p_co->bList) return 1; bBlockList = 1; p_co->pBDC = (int *) malloc(sizeof(int)); if (!p_co->pBDC) return 0; //p_co->ListMaxHightR = (p_co->CounfOfItems * 35) + _2dd.bitmap[hdcCO.hdcComboEnd].bitmap.bmHeight; if (p_co->CounfOfItems > p_co->CounfOfItemsL) p_co->ListMaxHightR = (p_co->CounfOfItemsL * 25) + ddxGetHight(hdcCO.hdcComboEnd); else p_co->ListMaxHightR = (p_co->CounfOfItems * 25) + ddxGetHight(hdcCO.hdcComboEnd); // kprintf(1, "p_co->CounfOfItems = %d, p_co->ListMaxHightR = %d", p_co->CounfOfItems, p_co->ListMaxHightR); //co_CreateDC(hdc, p_co->WidthR, p_co->ListMaxHightR, p_co->pBDC); *p_co->pBDC = ddxCreateSurface(p_co->WidthR, p_co->ListMaxHightR, ddxFindFreeSurface()); pDCI = p_co->pBDC; if (!pDCI) { free((void *) p_co->pBDC); return 0; } /*BitBlt(pDCI->hdc, 0, 0, pDCI->x, pDCI->y, hdc, p_co->x + xcor, p_co->y + _2dd.bitmap[hdcCO.hdcCombo].bitmap.bmHeight + ycor, SRCCOPY); */ ddxBitBlt(*pDCI, 0, 0, ddxGetWidth(*pDCI), ddxGetHight(*pDCI), hdc, p_co->x + xcor, p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor); p_co->CSelected = -1; p_co->Selected = -1; p_co->bList = 1; p_co->bEdit = 0; co_Combo_Draw(hdc, p_co, xcor, ycor); p_co->coListRect.top = p_co->y + ddxGetHight(hdcCO.hdcCombo); p_co->coListRect.bottom = p_co->y + ddxGetHight(hdcCO.hdcCombo) + p_co->ListMaxHightR; p_co->coListRect.left = p_co->x; if (p_co->CounfOfItems > p_co->CounfOfItemsL) p_co->coListRect.right = p_co->x + ddxGetWidth(hdcCO.hdcComboMid) - 2 - ddxGetWidth(hdcCO.hdcComboUp); else p_co->coListRect.right = p_co->x + ddxGetWidth(hdcCO.hdcComboMid) - 2; p_co->bEdit = 1; return 1; } int co_Combo_Close(int hdc, COMBO_CONTROL * p_co, int xcor, int ycor) { if (!p_co->bList) return 1; bBlockList = 0; p_co->SSelected = 0; p_co->bList = 0; ddxBitBlt(hdc, p_co->x + xcor, ycor + p_co->y + ddxGetHight(hdcCO.hdcCombo), ddxGetWidth(*p_co->pBDC), ddxGetHight(*p_co->pBDC), *p_co->pBDC, 0, 0); //co_Release_Bitmap(p_co->pBDC); ddxReleaseBitmap(*p_co->pBDC); free((void *) p_co->pBDC); p_co->pBDC = NULL; dim.t1 = 0; dim.dt1 = 0; return 1; } WCHAR *co_Edit_Get_Text(CONTROL_EDIT * p_ed) { if (!p_ed) return NULL; else return p_ed->wtext; } CONTROL_EDIT *co_Create_Edit(int hdc, int x, int y, int editID) { CONTROL_EDIT *p_ed = NULL; p_ed = (CONTROL_EDIT *) malloc(sizeof(CONTROL_EDIT)); if (!p_ed) return 0; ZeroMemory(p_ed, sizeof(CONTROL_EDIT)); p_ed->x = x; p_ed->y = y; p_ed->tx = 0; p_ed->bcActive = 0; p_ed->bActive = 0; p_ed->rect.left = x; p_ed->rect.top = y; p_ed->rect.right = x + ddxGetWidth(hdcED.hdcEdit); p_ed->rect.bottom = y + ddxGetHight(hdcED.hdcEdit); ddxBitBlt(hdc, x, y, ddxGetWidth(hdcED.hdcEdit), ddxGetHight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); p_ed->bDC = ddxCreateSurface(ddxGetWidth(hdcED.hdcEdit) + 25, ddxGetHight(hdcED.hdcEdit), ddxFindFreeSurface()); return p_ed; } void co_Release_Button(BUTTON_CONTROL * p_bu) { //co_Release_Bitmap(&p_bu->dc); ddxReleaseBitmap(p_bu->dc); free((void *) p_bu); } BUTTON_CONTROL *co_Create_Button(int hdc, int x, int y, int type, char *text, int isection, int buttonID) { WCHAR wc[128]; WCHAR ws[128]; int bmpx = 0, bmpy = 0; int bmpDC = 0; int cx, cy; int tx, ty; int tmpDC; BUTTON_CONTROL *p_bu = NULL; p_bu = (BUTTON_CONTROL *) malloc(sizeof(BUTTON_CONTROL)); if (!p_bu) return 0; ZeroMemory(p_bu, sizeof(BUTTON_CONTROL)); p_bu->ButtonID = buttonID; p_bu->bActivated = 0; p_bu->x = x; p_bu->y = y; switch (type) { case BUTTON_LARGE: bmpx = ddxGetWidth(hdcBU.hdcButtonL); bmpy = ddxGetHight(hdcBU.hdcButtonL); bmpDC = hdcBU.hdcButtonL; p_bu->dc = ddxCreateSurface(bmpx, bmpy, ddxFindFreeSurface()); p_bu->Rect.bottom = y + bmpy; p_bu->Rect.right = x + bmpx; break; case BUTTON_SMALL: bmpx = ddxGetWidth(hdcBU.hdcButtonS); bmpy = ddxGetHight(hdcBU.hdcButtonS); bmpDC = hdcBU.hdcButtonS; p_bu->dc = ddxCreateSurface(bmpx, bmpy, ddxFindFreeSurface()); p_bu->Rect.bottom = y + bmpy; p_bu->Rect.right = x + bmpx; break; default: assert(0); } p_bu->type = type; p_bu->Rect.top = y; p_bu->Rect.left = x; ddxBitBlt(p_bu->dc, 0, 0, bmpx, bmpy, bmpDC, 0, 0); tmpDC = ddxCreateSurface(bmpx, bmpy, ddxFindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(tmpDC, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, isection, &tx, &ty); cx = ftoi(((p_bu->Rect.right - p_bu->Rect.left) - tx) / 2.0f); cy = ftoi(((p_bu->Rect.bottom - p_bu->Rect.top) - ty) / 2.0f); ddxTransparentBlt(p_bu->dc, cx, cy, tx, ty, tmpDC, 0, 0, tx, ty, TRANSCOLOR); ddxReleaseBitmap(tmpDC); ddxBitBlt(hdc, p_bu->Rect.left, p_bu->Rect.top, ddxGetWidth(p_bu->dc), ddxGetHight(p_bu->dc), p_bu->dc, 0, 0); return p_bu; } int co_Check_Set_State(CHECKBOX_CONTROL * p_ch, int hdc, int state, char bDraw) { int x = 0, y = 0; int bmpx = ddxGetWidth(hdcCH.hdcCheck); int bmpDC; bmpDC = hdcCH.hdcCheck; p_ch->bChecked = state; if (hdc == HDC2DD) { x = TAB_X; y = TAB_Y; } if (p_ch->bChecked) { if (bDraw) { ddxTransparentBlt(hdc, p_ch->Rect.left + x, p_ch->Rect.top + y, bmpx, 20, bmpDC, 0, 25, bmpx, 20, RGB(237, 77, 0)); } p_ch->bChange = 1; } else { if (bDraw) { ddxTransparentBlt(hdc, p_ch->Rect.left + x, p_ch->Rect.top + y, bmpx, 20, bmpDC, 0, 1, bmpx, 20, RGB(237, 77, 0)); } p_ch->bChange = 1; } if (p_ch->iDC != -1) ddxBitBlt(p_ch->iDC, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, hdc, p_ch->x + x, p_ch->y + y); return 1; } void co_Release_CheckBox(CHECKBOX_CONTROL * p_ch) { if (p_ch->iDC != -1) ddxReleaseBitmap(p_ch->iDC); free((void *) p_ch); } CHECKBOX_CONTROL *co_Create_CheckBox(int hdc, int x, int y, char *text, int isection, int checkID, CONTROL_CALLBACK p_callback, void *p_callback_data) { WCHAR wc[128]; WCHAR ws[128]; int bmpx; int bmpDC; int tx, ty; CHECKBOX_CONTROL *p_ch = NULL; p_ch = (CHECKBOX_CONTROL *) mmalloc(sizeof(CHECKBOX_CONTROL)); p_ch->checkID = checkID; bmpx = ddxGetWidth(hdcCH.hdcCheck); bmpDC = hdcCH.hdcCheck; p_ch->Rect.bottom = y + 20; p_ch->Rect.right = x + bmpx; p_ch->Rect.top = y; p_ch->Rect.left = x; p_ch->x = x; p_ch->y = y; p_ch->bChecked = 0; p_ch->iDC = -1; p_ch->p_callback = p_callback; p_ch->p_callback_data = p_callback_data; ddxTransparentBlt(hdc, x, y, bmpx, 20, bmpDC, 0, 1, bmpx, 20, RGB(237, 77, 0)); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); if(fn_Draw_Message(hdc, x + 30, y + 3, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, isection, &tx, &ty)) { p_ch->RectFull.left = x; p_ch->RectFull.top = y; p_ch->RectFull.right = 30 + tx - p_ch->RectFull.left; p_ch->RectFull.bottom = ty - p_ch->RectFull.top; p_ch->iDC = ddxCreateSurface(p_ch->RectFull.right, p_ch->RectFull.bottom, ddxFindFreeSurface()); } return p_ch; } int co_Progres_Set(PROGRES_CONTROL * p_pr, int hdc, int i) { int dd = p_pr->max - p_pr->min; int md = p_pr->rectProgres.right - p_pr->rectProgres.left; float in = md / (float) dd; int x = p_pr->rectProgres.left + ftoi((i - p_pr->min) * in); //int yp; //BitBlt(hdc, p_pr->rectMover.left, p_pr->rectMover.top, p_pr->bDC.x, p_pr->bDC.y, p_pr->bDC.hdc, 0, 0, SRCCOPY); ddxBitBlt(hdc, p_pr->rectMover.left, p_pr->rectMover.top, ddxGetWidth(p_pr->bDC), ddxGetHight(p_pr->bDC), p_pr->bDC, 0, 0); p_pr->pos = x; p_pr->rectMover.left = p_pr->pos - p_pr->cor; p_pr->rectMover.right = p_pr->rectMover.left + ddxGetWidth(hdcPR.hdcMover); // yp = ftoi(ddxGetHight(hdcPR.hdcMover) / 2.0f); /*BitBlt(p_pr->bDC.hdc, 0, 0, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmWidth, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmHeight, hdc, p_pr->rectMover.left, p_pr->rectMover.top, SRCCOPY); */ ddxBitBlt(p_pr->bDC, 0, 0, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), hdc, p_pr->rectMover.left, p_pr->rectMover.top); /*BitBlt(hdc, p_pr->rectMover.left, p_pr->rectMover.top, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmWidth, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmHeight, _2dd.bitmap[hdcPR.hdcMover].bitmapDC, 0, 0, SRCCOPY); */ ddxTransparentBlt(hdc, p_pr->rectMover.left, p_pr->rectMover.top, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), hdcPR.hdcMover, 0, 0, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), RGB(237, 77, 0)); return 1; } int co_Progres_Get(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_prog) if ((p_list + i)->p_prog->progID == id) { PROGRES_CONTROL *p_pr = (p_list + i)->p_prog; int dd = p_pr->max - p_pr->min; int md = p_pr->rectProgres.right - p_pr->rectProgres.left; float out = dd / (float) md; int x = p_pr->min + ftoi((p_pr->pos - p_pr->rectProgres.left) * out); return x; } return 0; } int co_Progres_Changed(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_prog) { if ((p_list + i)->p_prog->progID == id) { if ((p_list + i)->p_prog->bChange) return 1; else return 0; } } } return 0; } void co_Progres_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id, char bSave, int shdc) { PROGRES_CONTROL *p_pr; int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_prog) { if ((p_list + i)->p_prog->progID == id) { p_pr = (p_list + i)->p_prog; (p_list + i)->bActive = 0; (p_list + i)->bDisabled = 1; if (bSave) ddxBitBlt(p_pr->iDC, 0, 0, p_pr->RectFull.right, p_pr->RectFull.bottom, shdc, p_pr->RectFull.left + xcor, p_pr->RectFull.top + ycor); ddxTransparentBlt(hdc, p_pr->RectFull.left + xcor, p_pr->RectFull.top + ycor, p_pr->RectFull.right, p_pr->RectFull.bottom, hdcCH.hdcGray, 0, 0, p_pr->RectFull.right, p_pr->RectFull.bottom, TRANSCOLOR); return; } } } return; } void co_Progres_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id) { PROGRES_CONTROL *p_pr; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_prog) if ((p_list + i)->p_prog->progID == id) { p_pr = (p_list + i)->p_prog; (p_list + i)->bActive = 1; (p_list + i)->bDisabled = 0; if (p_pr->iDC != -1) ddxBitBlt(hdc, p_pr->RectFull.left + xcor, p_pr->RectFull.top + ycor, p_pr->RectFull.right, p_pr->RectFull.bottom, p_pr->iDC, 0, 0); return; } return; } void co_Release_Progres(PROGRES_CONTROL * p_pr) { //co_Release_Bitmap(&p_pr->bDC); ddxReleaseBitmap(p_pr->iDC); ddxReleaseBitmap(p_pr->bDC); free((void *) p_pr); } PROGRES_CONTROL *co_Create_Progres(int hdc, int x, int y, int min, int max, int progID) { int bmpx, bmpy, yp; int bmpDC; PROGRES_CONTROL *p_pr = NULL; p_pr = (PROGRES_CONTROL *) malloc(sizeof(PROGRES_CONTROL)); if (!p_pr) return 0; ZeroMemory(p_pr, sizeof(PROGRES_CONTROL)); p_pr->bChange = 0; p_pr->bIn = 0; p_pr->progID = progID; p_pr->min = min; p_pr->max = max; p_pr->x = x; p_pr->y = y; p_pr->cor = ftoi(ddxGetWidth(hdcPR.hdcMover) / 2.0f); p_pr->pos = x; p_pr->bExclusive = 0; bmpx = ddxGetWidth(hdcPR.hdcLine); bmpy = ddxGetHight(hdcPR.hdcMover); bmpDC = hdcPR.hdcLine; yp = ftoi(bmpy / 2.0f); p_pr->rectMover.top = y; p_pr->rectMover.left = x; p_pr->rectMover.right = x + ddxGetWidth(hdcPR.hdcMover); p_pr->rectMover.bottom = y + bmpy; p_pr->rectProgres.top = y; p_pr->rectProgres.left = x; p_pr->rectProgres.bottom = p_pr->rectMover.bottom; p_pr->rectProgres.right = x + bmpx; //BitBlt(hdc, x, y+yp, bmpx, _2dd.bitmap[hdcPR.hdcLine].bitmap.bmHeight, bmpDC, 0, 0, SRCCOPY); ddxBitBlt(hdc, x, y + yp, bmpx, ddxGetHight(hdcPR.hdcLine), bmpDC, 0, 0); //co_CreateDC(hdc, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmWidth, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmHeight, &p_pr->bDC); p_pr->bDC = ddxCreateSurface(ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), ddxFindFreeSurface()); //BitBlt(p_pr->bDC.hdc, 0, 0, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmWidth, bmpy, hdc, x, y, SRCCOPY); ddxBitBlt(p_pr->bDC, 0, 0, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), hdc, x, y); //BitBlt(hdc, x, y, _2dd.bitmap[hdcPR.hdcMover].bitmap.bmWidth, bmpy, _2dd.bitmap[hdcPR.hdcMover].bitmapDC, 0, 0, SRCCOPY); ddxTransparentBlt(hdc, x, y, ddxGetWidth(hdcPR.hdcMover), bmpy, hdcPR.hdcMover, 0, 0, ddxGetWidth(hdcPR.hdcMover), bmpy, RGB(237, 77, 0)); p_pr->RectFull.left = x - yp - 300; p_pr->RectFull.top = y; p_pr->RectFull.right = bmpx + yp + 300; p_pr->RectFull.bottom = bmpy; p_pr->iDC = ddxCreateSurface(p_pr->RectFull.right, p_pr->RectFull.bottom, ddxFindFreeSurface()); return p_pr; } int co_Set_Text(int hdc, int x, int y, char *text, int isection) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(hdc, x, y, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, isection, &tx, &ty); return 1; } int co_Set_Text_Center(int hdc, char *text, int isection, RECT r) { int xp, yp; int tx, ty; WCHAR wc[128]; WCHAR ws[128]; int h; h = ddxCreateSurface(600, 100, ddxFindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(h, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, isection, &tx, &ty); xp = ftoi(((r.right - r.left) - tx) / 2.0f); yp = ftoi(((r.bottom - r.top) - ty) / 2.0f); ddxTransparentBlt(hdc, r.left + xp, r.top + yp, tx, ty, h, 0, 0, tx, ty, TRANSCOLOR); ddxReleaseBitmap(h); return 1; } int co_Set_Text_Right(int hdc, char *text, int isection, int x, int y) { int xp; int tx, ty; WCHAR wc[128]; WCHAR ws[128]; int h; h = ddxCreateSurface(600, 100, ddxFindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(h, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, isection, &tx, &ty); xp = x - tx; ddxTransparentBlt(hdc, xp, y, tx, ty, h, 0, 0, tx, ty, TRANSCOLOR); ddxReleaseBitmap(h); return 1; } int co_Set_Text_RightWC(int hdc, char *text, int isection, int x, int y) { int xp; int tx, ty; WCHAR wc[128]; int h; h = ddxCreateSurface(600, 100, ddxFindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn_Draw_MessageA(h, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, isection, &tx, &ty); xp = x - tx; ddxTransparentBlt(hdc, xp, y, tx, ty, h, 0, 0, tx, ty, TRANSCOLOR); ddxReleaseBitmap(h); return 1; } int co_List_Delete_Item(LIST_VIEW_CONTROL * p_li, char **cValue) { int i; RECT r; if (p_li->cClckSel == -1) return 0; if (p_li->cClckSel >= p_li->listnum) return 0; if (!p_li->piValue[p_li->cClckSel].cValue && !p_li->piValue[p_li->cClckSel].wcValue) return 0; if (cValue) (*cValue) = strdup(p_li->piValue[p_li->cClckSel].cValue); free((void *) p_li->piValue[p_li->cClckSel].cValue); free((void *) p_li->piValue[p_li->cClckSel].wcValue); for (i = p_li->cClckSel + 1; i < p_li->listnum; i++) { p_li->piValue[i - 1].cValue = p_li->piValue[i].cValue; p_li->piValue[i - 1].wcValue = p_li->piValue[i].wcValue; p_li->piValue[i - 1].iValue = p_li->piValue[i].iValue; } p_li->piValue[p_li->listnum - 1].cValue = NULL; p_li->piValue[p_li->listnum - 1].wcValue = NULL; p_li->piValue[p_li->listnum - 1].iValue = 0; i = p_li->cClckSel * 30; ddxBitBlt(p_li->bDCn, 0, i, ddxGetWidth(p_li->bDCn), ddxGetHight(p_li->bDCn) - (i + 30), p_li->bDCn, 0, i + 30); ddxBitBlt(p_li->bDCs, 0, i, ddxGetWidth(p_li->bDCn), ddxGetHight(p_li->bDCn) - (i + 30), p_li->bDCs, 0, i + 30); r.left = 0; r.right = ddxGetWidth(p_li->bDCn); r.bottom = ddxGetHight(p_li->bDCn); r.top = r.bottom - 30; ddxFillRect(p_li->bDCn, &r, 0); ddxFillRect(p_li->bDCs, &r, 0); if (ddxGetHight(p_li->bDCn) - 30 > p_li->rectList.bottom - p_li->rectList.top) { int ds, dn; ds = p_li->bDCs; dn = p_li->bDCn; p_li->bDCn = ddxCreateSurface(ddxGetWidth(dn), ddxGetHight(dn) - 30, ddxFindFreeSurface()); p_li->bDCs = ddxCreateSurface(ddxGetWidth(ds), ddxGetHight(ds) - 30, ddxFindFreeSurface()); ddxBitBlt(p_li->bDCn, 0, 0, ddxGetWidth(p_li->bDCn), ddxGetHight(p_li->bDCn), dn, 0, 0); ddxBitBlt(p_li->bDCs, 0, 0, ddxGetWidth(p_li->bDCs), ddxGetHight(p_li->bDCs), ds, 0, 0); ddxReleaseBitmap(dn); ddxReleaseBitmap(ds); p_li->listnum--; } p_li->cClckSel = -1; return 1; } int co_List_Add_String(LIST_VIEW_CONTROL * p_li, int index, int x, char *text, int iValue, char bSelected) { int tx, ty; WCHAR wc[128]; WCHAR ws[128]; if (p_li->piValue) { p_li->piValue[index].iValue = iValue; if (p_li->piValue[index].cValue) { free((void *) p_li->piValue[index].cValue); p_li->piValue[index].cValue = NULL; } p_li->piValue[index].cValue = strdup(text); p_li->piValue[index].wcValue = NULL; } MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!bSelected) fn_Draw_Message(p_li->bDCn, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 0, &tx, &ty); else fn_Draw_Message(p_li->bDCn, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 1, &tx, &ty); fn_Draw_Message(p_li->bDCs, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 1, &tx, &ty); return 1; } int co_List_Add_StringWC(LIST_VIEW_CONTROL * p_li, int index, int x, char *text, int iValue, char bSelected) { int tx, ty; WCHAR wc[128]; if (p_li->piValue) { p_li->piValue[index].iValue = iValue; if (p_li->piValue[index].cValue) { free((void *) p_li->piValue[index].cValue); p_li->piValue[index].cValue = NULL; } p_li->piValue[index].cValue = strdup(text); p_li->piValue[index].wcValue = NULL; } MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!bSelected) fn_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, 0, &tx, &ty); else fn_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); fn_Draw_MessageA(p_li->bDCs, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); return 1; } int co_List_Add_StringWC2(LIST_VIEW_CONTROL * p_li, int index, int x, WCHAR * wc, char *text, int iValue, char bSelected) { int tx, ty; if (p_li->piValue) { p_li->piValue[index].iValue = iValue; if (p_li->piValue[index].cValue) { free((void *) p_li->piValue[index].cValue); p_li->piValue[index].cValue = NULL; } p_li->piValue[index].cValue = strdup(text); p_li->piValue[index].wcValue = NULL; } if (!bSelected) fn_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, 0, &tx, &ty); else fn_Draw_MessageA(p_li->bDCn, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); fn_Draw_MessageA(p_li->bDCs, x, (index * 30) + 2, &b2_2d_font.gt, &b2_2d_font.ts, wc, 1, &tx, &ty); return 1; } int co_List_Redraw(int hdc, LIST_VIEW_CONTROL * p_li, int y) { /*BitBlt(hdc, p_li->rectList.left, p_li->rectList.top, p_li->bDCn.x, p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn.hdc, 0, y, SRCCOPY); */ if (y + (p_li->rectList.bottom - p_li->rectList.top) > ddxGetHight(p_li->bDCn)) y = ddxGetHight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); if (y < 0) y = 0; ddxBitBlt(hdc, p_li->rectList.left, p_li->rectList.top, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, y); return y; } void co_Cleare_List(LIST_VIEW_CONTROL * p_li, int numofitems, int hdc, int xcor, int ycor) { int i; ddxReleaseBitmap(p_li->bDCn); ddxReleaseBitmap(p_li->bDCs); if (p_li->piValue) { for (i = 0; i < p_li->listnum; i++) { if (p_li->piValue[i].cValue) free((void *) p_li->piValue[i].cValue); if (p_li->piValue[i].wcValue) free((void *) p_li->piValue[i].wcValue); } free((void *) p_li->piValue); p_li->piValue = NULL; p_li->piValue = (LIST_VIEW_ITEM *) malloc(numofitems * sizeof(LIST_VIEW_ITEM)); ZeroMemory(p_li->piValue, numofitems * sizeof(LIST_VIEW_ITEM)); } p_li->bClck = 0; p_li->bDblClck = 0; p_li->bClck = 0; p_li->Pushc = 0; p_li->listnum = numofitems; p_li->dx = 0; p_li->bIn = 0; p_li->bInE = 0; p_li->mpos = p_li->mpmin; p_li->bDCn = ddxCreateSurface(p_li->rectList.right - p_li->rectList.left, numofitems * 30, ddxFindFreeSurface()); ddxCleareSurfaceColor(p_li->bDCn, 0); p_li->bDCs = ddxCreateSurface(p_li->rectList.right - p_li->rectList.left, numofitems * 30, ddxFindFreeSurface()); ddxCleareSurfaceColor(p_li->bDCs, 0); ddxBitBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), p_li->bDCm, 0, 0); p_li->rectMover.top = p_li->mpos - 12; p_li->rectMover.bottom = p_li->mpos + 12; ddxBitBlt(p_li->bDCm, 0, 0, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor); ddxTransparentBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddxGetWidth(hdcCH.hdcCheck), 24, hdcCH.hdcCheck, 0, 0, ddxGetWidth(hdcCH.hdcCheck), 24, RGB(237, 77, 0)); } void co_Release_List(LIST_VIEW_CONTROL * p_li) { int i; //co_Release_Bitmap(&p_li->bDCm); ddxReleaseBitmap(p_li->bDCm); //co_Release_Bitmap(&p_li->bDCn); ddxReleaseBitmap(p_li->bDCn); //co_Release_Bitmap(&p_li->bDCs); ddxReleaseBitmap(p_li->bDCs); if (p_li->piValue) { for (i = 0; i < p_li->listnum; i++) { if (p_li->piValue[i].cValue) free((void *) p_li->piValue[i].cValue); if (p_li->piValue[i].wcValue) free((void *) p_li->piValue[i].wcValue); } free((void *) p_li->piValue); } free((void *) p_li); } LIST_VIEW_CONTROL *co_Create_List(int hdc, int x, int y, int width, int hight, int id, int numofitems, int bSelection) { int ax, ay, lx, ly; LIST_VIEW_CONTROL *p_li = NULL; p_li = (LIST_VIEW_CONTROL *) malloc(sizeof(LIST_VIEW_CONTROL)); //kprintf(1, "alokuji %d bytu", sizeof(LIST_VIEW_CONTROL)); if (!p_li) return 0; p_li->piValue = (LIST_VIEW_ITEM *) malloc(numofitems * sizeof(LIST_VIEW_ITEM)); ZeroMemory(p_li->piValue, numofitems * sizeof(LIST_VIEW_ITEM)); //kprintf(1, "alokuji %d bytu", numofitems * sizeof(LIST_VIEW_ITEM)); p_li->bClck = 0; p_li->bDblClck = 0; p_li->bClck = 0; p_li->pTime = timeGetTime(); p_li->cClckSel = -1; p_li->Pushc = 0; p_li->listnum = numofitems; p_li->dx = 0; p_li->bIn = 0; p_li->bInE = 0; p_li->x = x; p_li->y = y; p_li->mpos = 0; p_li->listID = id; p_li->rectList.top = y + ddxGetHight(hdcLI.hdcListTop); p_li->rectList.left = x + ddxGetWidth(hdcLI.hdcListLeft); p_li->rectList.bottom = y + hight - ddxGetHight(hdcLI.hdcListBottom); p_li->rectList.right = x + width - ddxGetWidth(hdcLI.hdcListRight) - ddxGetWidth(hdcLI.hdcListUp); p_li->bSelection = bSelection; ax = x; ay = y; /*BitBlt(hdc, x, y, _2dd.bitmap[hdcLI.hdcListTL].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListTL].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListTL].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x, y, ddxGetWidth(hdcLI.hdcListTL), ddxGetHight(hdcLI.hdcListTL), hdcLI.hdcListTL, 0, 0); ax += ddxGetWidth(hdcLI.hdcListTL); lx = ax; while (ax - lx < width - ddxGetWidth(hdcLI.hdcListTop)) { /*BitBlt(hdc, ax, ay, _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListTop].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, ax, ay, ddxGetWidth(hdcLI.hdcListTop), ddxGetHight(hdcLI.hdcListTop), hdcLI.hdcListTop, 0, 0); ax += ddxGetWidth(hdcLI.hdcListTop); } /*BitBlt(hdc, x + width - _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmWidth, ay, _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListTop].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListTop), ay, ddxGetWidth(hdcLI.hdcListTop), ddxGetHight(hdcLI.hdcListTop), hdcLI.hdcListTop, 0, 0); /*BitBlt(hdc, x + width - _2dd.bitmap[hdcLI.hdcListTR].bitmap.bmWidth, ay, _2dd.bitmap[hdcLI.hdcListTR].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListTR].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListTR].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListTR), ay, ddxGetWidth(hdcLI.hdcListTR), ddxGetHight(hdcLI.hdcListTR), hdcLI.hdcListTR, 0, 0); ay += ddxGetHight(hdcLI.hdcListTop); ly = ay; ax = x; while (ay - ly < hight - ddxGetHight(hdcLI.hdcListLeft)) { /*BitBlt(hdc, ax, ay, _2dd.bitmap[hdcLI.hdcListLeft].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListLeft].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListLeft].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, ax, ay, ddxGetWidth(hdcLI.hdcListLeft), ddxGetHight(hdcLI.hdcListLeft), hdcLI.hdcListLeft, 0, 0); /*BitBlt(hdc, ax + width - _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmWidth, ay, _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListRight].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, ax + width - ddxGetWidth(hdcLI.hdcListRight), ay, ddxGetWidth(hdcLI.hdcListRight), ddxGetHight(hdcLI.hdcListRight), hdcLI.hdcListRight, 0, 0); ay += ddxGetHight(hdcLI.hdcListLeft); } /*BitBlt(hdc, ax, y + hight - _2dd.bitmap[hdcLI.hdcListLeft].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListLeft].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListLeft].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListLeft].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, ax, y + hight - ddxGetHight(hdcLI.hdcListLeft), ddxGetWidth(hdcLI.hdcListLeft), ddxGetHight(hdcLI.hdcListLeft), hdcLI.hdcListLeft, 0, 0); /*BitBlt(hdc, ax + width - _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmWidth, y + hight - _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListRight].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListRight].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, ax + width - ddxGetWidth(hdcLI.hdcListRight), y + hight - ddxGetHight(hdcLI.hdcListRight), ddxGetWidth(hdcLI.hdcListRight), ddxGetHight(hdcLI.hdcListRight), hdcLI.hdcListRight, 0, 0); ay = y + hight - ddxGetHight(hdcLI.hdcListBottom); ax = x; /*BitBlt(hdc, x, ay, _2dd.bitmap[hdcLI.hdcListBL].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListBL].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListBL].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x, ay, ddxGetWidth(hdcLI.hdcListBL), ddxGetHight(hdcLI.hdcListBL), hdcLI.hdcListBL, 0, 0); ax += ddxGetWidth(hdcLI.hdcListBL); lx = ax; while (ax - lx < width - ddxGetWidth(hdcLI.hdcListBottom)) { /*BitBlt(hdc, ax, ay, _2dd.bitmap[hdcLI.hdcListBottom].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListBottom].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListBottom].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, ax, ay, ddxGetWidth(hdcLI.hdcListBottom), ddxGetHight(hdcLI.hdcListBottom), hdcLI.hdcListBottom, 0, 0); ax += ddxGetWidth(hdcLI.hdcListBottom); } /*BitBlt(hdc, x + width - _2dd.bitmap[hdcLI.hdcListBottom].bitmap.bmWidth, ay, _2dd.bitmap[hdcLI.hdcListBottom].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListBottom].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListBottom].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListBottom), ay, ddxGetWidth(hdcLI.hdcListBottom), ddxGetHight(hdcLI.hdcListBottom), hdcLI.hdcListBottom, 0, 0); /*BitBlt(hdc, x + width - _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmWidth, ay, _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListBR].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListBR), ay, ddxGetWidth(hdcLI.hdcListBR), ddxGetHight(hdcLI.hdcListBR), hdcLI.hdcListBR, 0, 0); p_li->rectUp.top = y + ddxGetHight(hdcLI.hdcListTop); p_li->rectUp.bottom = p_li->rectUp.top + ddxGetHight(hdcLI.hdcListUp); p_li->rectUp.left = x + width - ddxGetWidth(hdcLI.hdcListBR) - ddxGetWidth(hdcLI.hdcListUp); p_li->rectUp.right = p_li->rectUp.left + ddxGetWidth(hdcLI.hdcListUp); /*TransparentBltU(hdc, x + width - _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmWidth - _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmWidth, y + _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListUp].bitmapDC, 0, 0, _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmHeight, RGB(238, 77, 0)); */ ddxTransparentBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListBR) - ddxGetWidth(hdcLI.hdcListUp), y + ddxGetHight(hdcLI.hdcListTop), ddxGetWidth(hdcLI.hdcListUp), ddxGetHight(hdcLI.hdcListUp), hdcLI.hdcListUp, 0, 0, ddxGetWidth(hdcLI.hdcListUp), ddxGetHight(hdcLI.hdcListUp), RGB(238, 77, 0)); p_li->rectDown.top = y + hight - ddxGetHight(hdcLI.hdcListBR) - ddxGetHight(hdcLI.hdcListDown); p_li->rectDown.bottom = p_li->rectDown.top + ddxGetHight(hdcLI.hdcListUp); p_li->rectDown.left = x + width - ddxGetWidth(hdcLI.hdcListTR) - ddxGetWidth(hdcLI.hdcListUp); p_li->rectDown.right = p_li->rectDown.left + ddxGetWidth(hdcLI.hdcListUp); /*TransparentBltU(hdc, x + width - _2dd.bitmap[hdcLI.hdcListTR].bitmap.bmWidth - _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmWidth, y + hight - _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmWidth - _2dd.bitmap[hdcLI.hdcListDown].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListDown].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListDown].bitmap.bmHeight, _2dd.bitmap[hdcLI.hdcListDown].bitmapDC, 0, 0, _2dd.bitmap[hdcLI.hdcListDown].bitmap.bmWidth, _2dd.bitmap[hdcLI.hdcListDown].bitmap.bmHeight, RGB(238, 77, 0)); */ ddxTransparentBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListTR) - ddxGetWidth(hdcLI.hdcListUp), y + hight - ddxGetHight(hdcLI.hdcListBR) - ddxGetHight(hdcLI.hdcListDown), ddxGetWidth(hdcLI.hdcListDown), ddxGetHight(hdcLI.hdcListDown), hdcLI.hdcListDown, 0, 0, ddxGetWidth(hdcLI.hdcListDown), ddxGetHight(hdcLI.hdcListDown), RGB(238, 77, 0)); //co_CreateDC(hdc, _2dd.bitmap[hdcCH.hdcCheck].bitmap.bmWidth, 24, &p_li->bDCm); p_li->bDCm = ddxCreateSurface(ddxGetWidth(hdcCH.hdcCheck), 20, ddxFindFreeSurface()); /*BitBlt(p_li->bDCm.hdc, 0, 0, p_li->bDCm.x, p_li->bDCm.y, hdc, x + width - _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmWidth - _2dd.bitmap[hdcCH.hdcCheck].bitmap.bmWidth - 2, y + _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmHeight + _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmHeight, SRCCOPY); */ ddxBitBlt(p_li->bDCm, 0, 0, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), hdc, x + width - ddxGetWidth(hdcLI.hdcListBR) - ddxGetWidth(hdcCH.hdcCheck) - 2, y + ddxGetHight(hdcLI.hdcListTop) + ddxGetHight(hdcLI.hdcListUp)); /*TransparentBltU(hdc, x + width - _2dd.bitmap[hdcLI.hdcListBR].bitmap.bmWidth - _2dd.bitmap[hdcCH.hdcCheck].bitmap.bmWidth - 2, y + _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmHeight + _2dd.bitmap[hdcLI.hdcListUp].bitmap.bmHeight, _2dd.bitmap[hdcCH.hdcCheck].bitmap.bmWidth, 24, _2dd.bitmap[hdcCH.hdcCheck].bitmapDC, 0, 0, _2dd.bitmap[hdcCH.hdcCheck].bitmap.bmWidth, 24, RGB(237, 77, 0)); */ ddxTransparentBlt(hdc, x + width - ddxGetWidth(hdcLI.hdcListBR) - ddxGetWidth(hdcCH.hdcCheck), y + ddxGetHight(hdcLI.hdcListTop) + ddxGetHight(hdcLI.hdcListUp), ddxGetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, ddxGetWidth(hdcCH.hdcCheck), 20, RGB(237, 77, 0)); p_li->rectMover.top = y + ddxGetHight(hdcLI.hdcListTop) + ddxGetHight(hdcLI.hdcListUp); p_li->rectMover.bottom = p_li->rectMover.top + 24; p_li->rectMover.left = x + width - ddxGetWidth(hdcLI.hdcListBR) - ddxGetWidth(hdcCH.hdcCheck); p_li->rectMover.right = p_li->rectMover.left + ddxGetWidth(hdcCH.hdcCheck); //co_CreateDC(hdc, p_li->rectList.right - p_li->rectList.left, numofitems * 30, &p_li->bDCn); p_li->bDCn = ddxCreateSurface(p_li->rectList.right - p_li->rectList.left, numofitems * 30, ddxFindFreeSurface()); ddxCleareSurfaceColor(p_li->bDCn, 0); //co_CreateDC(hdc, p_li->rectList.right - p_li->rectList.left, numofitems * 35, &p_li->bDCs); p_li->bDCs = ddxCreateSurface(p_li->rectList.right - p_li->rectList.left, numofitems * 30, ddxFindFreeSurface()); ddxCleareSurfaceColor(p_li->bDCs, 0); /*BitBlt(hdc, x + _2dd.bitmap[hdcLI.hdcListLeft].bitmap.bmWidth, y + _2dd.bitmap[hdcLI.hdcListTop].bitmap.bmHeight, p_li->bDCn.x, p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn.hdc, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, x + ddxGetWidth(hdcLI.hdcListLeft), y + ddxGetHight(hdcLI.hdcListTop), ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, 0); p_li->mpos = p_li->mpmin = y + ddxGetHight(hdcLI.hdcListTop) + ddxGetHight(hdcLI.hdcListUp) + 12; p_li->mpmax = y + hight - ddxGetHight(hdcLI.hdcListBottom) - ddxGetHight(hdcLI.hdcListDown) - 12; p_li->rectMoverA.left = p_li->rectMover.left; p_li->rectMoverA.right = p_li->rectMover.right; p_li->rectMoverA.top = y + ddxGetHight(hdcLI.hdcListTop) + ddxGetHight(hdcLI.hdcListUp) + 12; p_li->rectMoverA.bottom = y + hight - ddxGetHight(hdcLI.hdcListBottom) - ddxGetHight(hdcLI.hdcListDown) - 12; return p_li; } int co_Rect_Hit(RECT rect, int x, int y) { if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) return 1; else return 0; } void co_Del_Combo_List(COMBO_CONTROL * p_co, int hdc, int xcor, int ycor) { int y = ycor + p_co->y + ddxGetHight(hdcCO.hdcCombo); int i; for (i = 0; i < p_co->CounfOfItemsL; i++) { /*BitBlt(hdc, p_co->x + xcor, y, p_co->coListRect.right - p_co->coListRect.left - 2, _2dd.bitmap[hdcCO.hdcComboMid].bitmap.bmHeight, _2dd.bitmap[hdcCO.hdcComboMid].bitmapDC, 0, 0, SRCCOPY); */ ddxBitBlt(hdc, p_co->x + xcor, y, p_co->coListRect.right - p_co->coListRect.left - 2, ddxGetHight(hdcCO.hdcComboMid), hdcCO.hdcComboMid, 0, 0); y += ddxGetHight(hdcCO.hdcComboMid); } } int co_Handle_Combo_Drop(COMBO_DROP_CONTROL * p_co, char bFocus, int x, int y, int hdc, int xcor, int ycor) { int c = 0; if (dim.t1) if (co_Rect_Hit(p_co->coLUp, x, y)) { p_co->Selected--; if (p_co->Selected < 0) p_co->Selected = 0; co_Combo_Drop_Set_String(hdc, p_co, xcor, ycor); c++; } if (dim.t1) if (co_Rect_Hit(p_co->coLDown, x, y)) { p_co->Selected++; if (p_co->Selected >= p_co->CounfOfItems) p_co->Selected = p_co->CounfOfItems - 1; co_Combo_Drop_Set_String(hdc, p_co, xcor, ycor); c++; } return c; } int co_Handle_Combo(COMBO_CONTROL * p_co, char bFocus, int x, int y, int hdc, int xcor, int ycor, char b_list) { int c = 0; RECT r; if(dim.t1 && b_list && !p_co->bList) return 0; if(!dim.dt1) p_co->bIn = 0; if(dim.t1 || dim.dt1) { if(co_Rect_Hit(p_co->coLMovA, x+xcor, y+ycor) && p_co->bList) { int ym; int ymcor; int ymx; int i; COMBO_HADLE_MOVER: ym = (y + ycor - p_co->xmstart); ymcor = (int)floor(ddxGetHight(hdcCO.hdcComboMover) / 2.0f); ymx = p_co->xm; if(ym < 0) ym = 0; if(ym > ymx) ym = ymx; i = ftoi(((p_co->CounfOfItems - p_co->CounfOfItemsL) * ym) / (float)ymx); p_co->SSelected = i; p_co->CSelected = p_co->Selected - 1; co_Combo_Draw_List(hdc, p_co, xcor, ycor, 1); r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); if(ym + p_co->xmstart - ymcor != p_co->coLMov.top) { int t,b; t = ym + p_co->xmstart - ymcor; b = p_co->coLMov.top + ddxGetHight(hdcCO.hdcComboMover); ddxSetFlip(0); for(i=0;i<2;i++) { ddxBitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddxGetWidth(hdcCO.hdcComboMoverb), ddxGetHight(hdcCO.hdcComboMoverb), hdcCO.hdcComboMoverb, 0, 0); ddxBitBlt(hdc, p_co->coLMov.left, t, ddxGetWidth(hdcCO.hdcComboMover), ddxGetHight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); if(!i) DisplayFrame(); } p_co->coLMov.top = t; p_co->coLMov.bottom = b; ddxSetFlip(1); } p_co->bIn = 1; c++; return c; } else { if(dim.dt1 && p_co->bIn) goto COMBO_HADLE_MOVER; else p_co->bIn = 0; } } if(dim.t1) { if(co_Rect_Hit(p_co->coLUp, x+xcor, y+ycor) && p_co->bList) { int ymcor = (int)floor(ddxGetHight(hdcCO.hdcComboMover) / 2.0f); int t,b; int ny, i; p_co->SSelected--; if(p_co->SSelected < 0) p_co->SSelected = 0; p_co->CSelected = p_co->Selected - 1; //co_Del_Combo_List(p_co, hdc, xcor, ycor); co_Combo_Draw_List(hdc, p_co, xcor, ycor, 1); r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); ny = ftoi((p_co->xm / (float)(p_co->CounfOfItems - p_co->CounfOfItemsL)) * p_co->SSelected); t = ny + p_co->xmstart - ymcor; b = p_co->coLMov.top + ddxGetHight(hdcCO.hdcComboMover); ddxSetFlip(0); for(i=0;i<2;i++) { ddxBitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddxGetWidth(hdcCO.hdcComboMoverb), ddxGetHight(hdcCO.hdcComboMoverb), hdcCO.hdcComboMoverb, 0, 0); ddxBitBlt(hdc, p_co->coLMov.left, t, ddxGetWidth(hdcCO.hdcComboMover), ddxGetHight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); if(!i) DisplayFrame(); } p_co->coLMov.top = t; p_co->coLMov.bottom = b; ddxSetFlip(1); c++; return c; } } if(dim.t1) { if(co_Rect_Hit(p_co->coLDown, x+xcor, y+ycor) && p_co->bList) { int ymcor = (int)floor(ddxGetHight(hdcCO.hdcComboMover) / 2.0f); int t,b; int ny, i; p_co->SSelected++; if(p_co->SSelected > p_co->CounfOfItems - p_co->CounfOfItemsL) p_co->SSelected = p_co->CounfOfItems - p_co->CounfOfItemsL; p_co->CSelected = p_co->Selected - 1; //co_Del_Combo_List(p_co, hdc,xcor, ycor); co_Combo_Draw_List(hdc, p_co, xcor, ycor, 1); r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); ny = ftoi((p_co->xm / (float)(p_co->CounfOfItems - p_co->CounfOfItemsL)) * p_co->SSelected); t = ny + p_co->xmstart - ymcor; b = p_co->coLMov.top + ddxGetHight(hdcCO.hdcComboMover); ddxSetFlip(0); for(i=0;i<2;i++) { ddxBitBlt(hdc, p_co->coLMov.left, p_co->coLMov.top, ddxGetWidth(hdcCO.hdcComboMoverb), ddxGetHight(hdcCO.hdcComboMoverb), hdcCO.hdcComboMoverb, 0, 0); ddxBitBlt(hdc, p_co->coLMov.left, t, ddxGetWidth(hdcCO.hdcComboMover), ddxGetHight(hdcCO.hdcComboMover), hdcCO.hdcComboMover, 0, 0); if(!i) DisplayFrame(); } p_co->coLMov.top = t; p_co->coLMov.bottom = b; ddxSetFlip(1); c++; return c; } } if(dim.t1) { if(co_Rect_Hit(p_co->coDownRect, x, y)) { /*r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHightR; _2d_Add_RectItem(&rline, r, 1); */ if(p_co->bList) { p_co->Selected = p_co->OSelected; co_Combo_Close(hdc, p_co, xcor, ycor); } else { p_co->OSelected = p_co->Selected; co_Combo_Open(hdc, p_co, xcor, ycor); } r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); c++; } } if(co_Rect_Hit(p_co->coListRect, x, y) && p_co->bList) { c++; p_co->CSelected = p_co->SSelected + co_Combo_Hit2Sel(p_co, x, y); if(!dim.t1 && p_co->bList) { co_Combo_Draw_List(hdc, p_co, xcor, ycor, 0); p_co->Selected = p_co->CSelected; } else if(dim.t1 && p_co->bList) { p_co->OSelected = p_co->Selected = p_co->CSelected; co_Combo_Set_String(hdc, p_co, xcor, ycor); co_Combo_Close(hdc, p_co, xcor, ycor); r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); } } else if(!dim.t1 && p_co->bList) { c++; p_co->CSelected = -1; co_Combo_Draw_List(hdc, p_co, xcor, ycor, 0); p_co->Selected = -1; r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); } if(dim.t1) if(!c && bFocus) { co_Combo_Close(hdc, p_co, xcor, ycor); p_co->Selected = p_co->OSelected; r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem(&rline, r, 1); } if(bFocus) { if(p_co->bList) { r.left = p_co->x + xcor; r.top = p_co->y + ddxGetHight(hdcCO.hdcCombo) + ycor; r.right = p_co->WidthR; r.bottom = p_co->ListMaxHight + ddxGetHight(hdcCO.hdcComboEnd); _2d_Add_RectItem_IfNPresent(&rline, r, 1); } r.left = p_co->x + xcor; r.top = p_co->y + ycor; r.right = ddxGetWidth(hdcCO.hdcCombo); r.bottom = ddxGetHight(hdcCO.hdcCombo); _2d_Add_RectItem_IfNPresent(&rline, r, 1); } return c; } int co_Handle_Button(BUTTON_CONTROL * p_bu, int x, int y) { if (co_Rect_Hit(p_bu->Rect, x, y)) { p_bu->bActivated = 1; return 1; } return 0; } int co_Handle_Checkbox(CHECKBOX_CONTROL * p_ch, int x, int y) { RECT r; int bmpx; int bmpDC; if(co_Rect_Hit(p_ch->Rect, x, y)) { bmpx = ddxGetWidth(hdcCH.hdcCheck); bmpDC = hdcCH.hdcCheck; if(!p_ch->bChecked) { p_ch->bChecked = 1; ddxTransparentBltDisplay(p_ch->Rect.left + TAB_X, p_ch->Rect.top + TAB_Y, bmpx, 20, bmpDC, 0, 25, bmpx, 20, RGB(237, 77, 0)); p_ch->bChange = 1; r.left = p_ch->Rect.left + TAB_X; r.top = p_ch->Rect.top + TAB_Y; r.right = bmpx; r.bottom = 20; _2d_Add_RectItem(&rline, r, 1); if(p_ch->iDC != -1) { ddxBitBlt(p_ch->iDC, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, HDC2DD, p_ch->x + TAB_X, p_ch->y + TAB_Y); } } else { p_ch->bChecked = 0; ddxTransparentBltDisplay(p_ch->Rect.left + TAB_X, p_ch->Rect.top + TAB_Y, bmpx, 20, bmpDC, 0, 1, bmpx, 20, RGB(237, 77, 0)); p_ch->bChange = 1; r.left = p_ch->Rect.left + TAB_X; r.top = p_ch->Rect.top + TAB_Y; r.right = bmpx; r.bottom = 20; _2d_Add_RectItem(&rline, r, 1); if(p_ch->iDC != -1) ddxBitBlt(p_ch->iDC, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, HDC2DD, p_ch->x + TAB_X, p_ch->y + TAB_Y); } if(p_ch->p_callback) p_ch->p_callback(p_ch); return 1; } p_ch->bChange = 0; return 0; } int co_Handle_Progres(PROGRES_CONTROL * p_pr, int x, int y) { int i; if (bExclusive && !p_pr->bExclusive) return 0; if (dim.t1 || dim.dt1) if (co_Rect_Hit(p_pr->rectProgres, x, y)) { int rl; //int rr; int c; if (p_pr->pos == x) return 1; rl = p_pr->rectMover.left; //rr = p_pr->rectMover.right; p_pr->rectMover.left = x - p_pr->cor; p_pr->rectMover.right = (x - p_pr->cor) + ddxGetWidth(hdcPR.hdcMover); ddxSetFlip(0); if (!ddxGetMode()) c = 2; else c = 1; for (i = 0; i < c; i++) { ddxBitBltDisplay(rl + TAB_X, p_pr->rectMover.top + TAB_Y, ddxGetWidth(p_pr->bDC), ddxGetHight(p_pr->bDC), p_pr->bDC, 0, 0); if (i || c == 1) ddxBitBlt(p_pr->bDC, 0, 0, ddxGetWidth(p_pr->bDC), ddxGetHight(p_pr->bDC), HDC2DD, p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y); ddxTransparentBltDisplay(p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), hdcPR.hdcMover, 0, 0, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), RGB(237, 77, 0)); if (!i) DisplayFrame(); } ddxSetFlip(1); p_pr->pos = x; p_pr->bIn = 1; p_pr->bChange = 1; p_pr->bExclusive = 1; bExclusive = 1; return 1; } if (p_pr->bIn && dim.dt1) { int rl; //int rr; int c; /*if(y > p_pr->rectProgres.bottom || y < p_pr->rectProgres.top) { p_pr->bIn = 0; return 0; } */ if (x >= p_pr->rectProgres.right) x = p_pr->rectProgres.right; if (x <= p_pr->rectProgres.left) x = p_pr->rectProgres.left; if (p_pr->pos == x) return 1; p_pr->pos = x; rl = p_pr->rectMover.left; //rr = p_pr->rectMover.right; p_pr->rectMover.left = x - p_pr->cor; p_pr->rectMover.right = (x - p_pr->cor) + ddxGetWidth(hdcPR.hdcMover); ddxSetFlip(0); if (!ddxGetMode()) c = 2; else c = 1; for (i = 0; i < c; i++) { ddxBitBltDisplay(rl + TAB_X, p_pr->rectMover.top + TAB_Y, ddxGetWidth(p_pr->bDC), ddxGetHight(p_pr->bDC), p_pr->bDC, 0, 0); if (i || c == 1) ddxBitBlt(p_pr->bDC, 0, 0, ddxGetWidth(p_pr->bDC), ddxGetHight(p_pr->bDC), HDC2DD, p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y); ddxTransparentBltDisplay(p_pr->rectMover.left + TAB_X, p_pr->rectMover.top + TAB_Y, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), hdcPR.hdcMover, 0, 0, ddxGetWidth(hdcPR.hdcMover), ddxGetHight(hdcPR.hdcMover), RGB(237, 77, 0)); if (!i) DisplayFrame(); } ddxSetFlip(1); p_pr->bIn = 1; p_pr->bChange = 1; p_pr->bExclusive = 1; bExclusive = 1; return 1; } if (!dim.dt1) { p_pr->bExclusive = 0; bExclusive = 0; p_pr->bIn = 0; } p_pr->bChange = 0; return 0; } int co_List_Get_Dbclck(CONTROL_LIST_ITEM * p_list, int lsize, int id, LIST_VIEW_CONTROL ** p_li) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_list && (p_list + i)->bActive) { *p_li = (p_list + i)->p_list; return (p_list + i)->p_list->bDblClck; } return -1; } int co_List_Get_Clck(CONTROL_LIST_ITEM * p_list, int lsize, int id, LIST_VIEW_CONTROL ** p_li) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_list && (p_list + i)->bActive) { *p_li = (p_list + i)->p_list; return (p_list + i)->p_list->bClck; } return -1; } int co_List_Get_Value(CONTROL_LIST_ITEM * p_list, int lsize, int id, int index) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_list) return (p_list + i)->p_list->piValue[index].iValue; return -1; } void co_get_XP_XT(LIST_VIEW_CONTROL * p_li, int i, int *p_xp, int *p_xt, int ycor) { // int xs = p_li->rectList.top + ycor + (i * 30) - p_li->dx; int xp = 0; int xt = 0; if (dim.t1) p_li->cSelected = i; if ((i * 30) - p_li->dx < 0) xp = ((i * 30) - p_li->dx) * -1; if ((p_li->rectList.top + ycor + (i * 30) - p_li->dx + 30) > p_li->rectList.bottom + ycor) xt = (p_li->rectList.top + ycor + (i * 30) - p_li->dx + 30) - (p_li->rectList.bottom + ycor); *p_xp = xp; *p_xt = xt; return; } void co_delete(char *cfile) { /* char olddir[MAX_FILENAME+1]; char dir[MAX_FILENAME+1]; char *c; long Done, error; struct _finddata_t Data; if(!cfile) return; c =strstr(cfile, "."); _getcwd(olddir, MAX_FILENAME); GetPrivateProfileString("install","save_dir","/",dir,MAX_FILENAME,ini_file); working_file_translate(dir,256); chdir((dir)); if(c) // ma to tecku v filu, tak je to demo, jinak je to save (dir) remove(cfile); else { chdir((cfile)); Done = _findfirst("*.*",&Data); error = Done; while(error != -1) { if(error != -1) if(!(Data.attrib & _A_SUBDIR)) remove(Data.name); error = _findnext(Done,&Data); } _findclose(Done); chdir((dir)); rmdir(cfile); } chdir((olddir)); */ } int co_Handle_List(LIST_VIEW_CONTROL * p_li, int x, int y, int hdc, int xcor, int ycor) { int xp = 0; int xt = 0; int c = 0; RECT r; DWORD t = timeGetTime(); if(bBlockList) return 0; r.left = p_li->rectList.left + xcor; r.top = p_li->rectList.top + ycor; r.right = ddxGetWidth(p_li->bDCn); r.bottom = p_li->rectList.bottom - p_li->rectList.top; _2d_Add_RectItem_IfNPresent(&rline, r, 1); r.left = p_li->rectMoverA.left + xcor; r.top = p_li->rectMoverA.top + ycor - 12; r.right = p_li->rectMoverA.right - p_li->rectMoverA.left; r.bottom = p_li->rectMoverA.bottom - p_li->rectMoverA.top + 24; _2d_Add_RectItem_IfNPresent(&rline, r, 1); if(dim.dt1 && p_li->bIn > 0) { if(y < p_li->mpmin) y = p_li->mpmin; if(y > p_li->mpmax) y = p_li->mpmax; p_li->bIn = 0; goto HANDLE_LISTVIEW; } if(!dim.dt1) p_li->bIn = 0; if(p_li->Pushc < 2) if(t - p_li->pTime > 1000) { p_li->pTime = t; p_li->Pushc = 0; p_li->cSelected = -1; p_li->bClck = 0; p_li->bDblClck = 0; } if(co_Rect_Hit(p_li->rectList, x, y)) { int i = (int)floor((p_li->dx + (y - p_li->rectList.top)) / 30.0f); if(dim.t1) { p_li->bClck++; p_li->Pushc++; } if(i < 0 || i > p_li->listnum) { ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); p_li->Selected = -1; p_li->Pushc = 0; p_li->pTime = t; if(dim.t1) { p_li->cSelected = -1; p_li->cClckSel = -1; } c++; } else if(i != p_li->Selected) { co_get_XP_XT(p_li, i, &xp, &xt, ycor); ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); p_li->Selected = i; ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (i * 30) - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (i * 30) + xp); if(p_li->cClckSel != -1 && p_li->bSelection) { co_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } c++; } else if(dim.t1) { if(p_li->Pushc > 1) { if(p_li->cSelected == i) p_li->bDblClck = 1; p_li->Pushc = 0; p_li->pTime = t; } else p_li->cSelected = i; if(p_li->Pushc == 1) p_li->bClck = 1; p_li->cClckSel = i; if(p_li->bSelection) { ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); co_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } } } else if(p_li->Selected != -1) { p_li->Selected = -1; ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); if(p_li->cClckSel != -1 && p_li->bSelection) { co_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } c++; } if(dim.t1) if(co_Rect_Hit(p_li->rectUp, x, y)) { float dcm = (float)ddxGetHight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); float c = (p_li->rectMoverA.bottom - p_li->rectMoverA.top) / dcm; y = p_li->mpos - ftoi(30 * c); p_li->bInE = -1; p_li->bIn = -1; goto HANDLE_LISTVIEW; } if(dim.t1) if(co_Rect_Hit(p_li->rectDown, x, y)) { float dcm = (float)ddxGetHight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); float c = (p_li->rectMoverA.bottom - p_li->rectMoverA.top) / dcm; y = p_li->mpos + ftoi(30 * c); p_li->bInE = -1; p_li->bIn = -1; goto HANDLE_LISTVIEW; } if(dim.t1 || dim.dt1) if(co_Rect_Hit(p_li->rectMoverA, x, y)) { int dcm, mm, pm, pos; int rt, j; //int rb; HANDLE_LISTVIEW: if(y > p_li->mpmax) y = p_li->mpmax; else if(y < p_li->mpmin) y = p_li->mpmin; if(p_li->mpos == y) { p_li->bIn++; return 1; } p_li->mpos = y; rt = p_li->rectMover.top; //rb = p_li->rectMover.bottom; p_li->rectMover.top = p_li->mpos - 12; p_li->rectMover.bottom = p_li->mpos + 12; if(hdc == HDC2DD) { int c; ddxSetFlip(0); if(!ddxGetMode()) c = 2; else c = 1; for(j=0;jrectMover.left + xcor, rt + ycor, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), p_li->bDCm, 0, 0); if(j) ddxBitBlt(p_li->bDCm, 0, 0, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor); ddxTransparentBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddxGetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, ddxGetWidth(hdcCH.hdcCheck), 20, RGB(237, 77, 0)); if(!j) DisplayFrame(); } ddxSetFlip(1); } else { ddxBitBlt(hdc, p_li->rectMover.left + xcor, rt + ycor, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), p_li->bDCm, 0, 0); ddxBitBlt(p_li->bDCm, 0, 0, ddxGetWidth(p_li->bDCm), ddxGetHight(p_li->bDCm), hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor); ddxTransparentBlt(hdc, p_li->rectMover.left + xcor, p_li->rectMover.top + ycor, ddxGetWidth(hdcCH.hdcCheck), 20, hdcCH.hdcCheck, 0, 49, ddxGetWidth(hdcCH.hdcCheck), 20, RGB(237, 77, 0)); } dcm = ddxGetHight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); mm = p_li->mpmax - p_li->mpmin; pm = p_li->mpos - p_li->mpmin; pos = ftoi((pm * dcm) / (float)mm); if(p_li->mpos == p_li->mpmax) pos = ddxGetHight(p_li->bDCn) - (p_li->rectList.bottom - p_li->rectList.top); if(p_li->mpos == p_li->mpmin) pos = 0; p_li->dx = pos; ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor, ddxGetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, pos); if(p_li->cClckSel != -1 && p_li->bSelection) { co_get_XP_XT(p_li, p_li->cClckSel, &xp, &xt, ycor); ddxBitBlt(hdc, p_li->rectList.left + xcor, p_li->rectList.top + ycor + (p_li->cClckSel * 30) - p_li->dx + xp, ddxGetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, (p_li->cClckSel * 30) + xp); } p_li->bIn++; p_li->bInE++; return 1; } if(key[K_DEL]) { char *cfile = NULL; key[K_DEL] = 0; if(co_List_Delete_Item(p_li, &cfile)) { p_li->dx = co_List_Redraw(hdc, p_li, p_li->dx); co_delete(cfile); } if(cfile) free((void *) cfile); } return c; } int co_Is_Button_Activated(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_button) if ((p_list + i)->p_button->ButtonID == id && (p_list + i)->p_button->bActivated) return 1; return 0; } int co_Check_Get_State(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id) return (p_list + i)->p_check->bChecked; return 0; } int co_Check_Get_State_Change(CONTROL_LIST_ITEM * p_list, int lsize, int id) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id && (p_list + i)->p_check->bChange) { (p_list + i)->p_check->bChange = 0; return (p_list + i)->p_check->bChecked; } return -1; } void co_Check_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id) { CHECKBOX_CONTROL *p_ch; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id) { p_ch = (p_list + i)->p_check; (p_list + i)->bActive = 0; (p_list + i)->bDisabled = 1; ddxTransparentBlt(hdc, p_ch->RectFull.left + xcor, p_ch->RectFull.top + ycor, p_ch->RectFull.right, p_ch->RectFull.bottom, hdcCH.hdcGray, 0, 0, p_ch->RectFull.right, p_ch->RectFull.bottom, TRANSCOLOR); return; } return; } void co_Check_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id) { CHECKBOX_CONTROL *p_ch; int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_check) if ((p_list + i)->p_check->checkID == id) { p_ch = (p_list + i)->p_check; (p_list + i)->bActive = 1; (p_list + i)->bDisabled = 0; if (p_ch->iDC != -1) ddxBitBlt(hdc, p_ch->RectFull.left + xcor, p_ch->RectFull.top + ycor, p_ch->RectFull.right, p_ch->RectFull.bottom, p_ch->iDC, 0, 0); return; } return; } int co_Handle_Edit_Key_Filter(void) { // char k[256]; int c = 0, i; //GetKeyboardState(k); if (isprint(key_pressed)) return 0; if (key[K_ESC]) c++; if (key[K_PTRSCR]) c++; if (key[K_DEL]) c++; if (key[K_INS]) c++; if (key[K_PGDN]) c++; if (key[K_PGUP]) c++; if (key[K_TAB]) c++; /* if(k[VK_LCONTROL]&0x80) c++; if(k[VK_RCONTROL]&0x80) c++; if(k[VK_LMENU]&0x80) c++; if(k[VK_RMENU]&0x80) c++; */ if (key[K_TAB]) c++; if (key[K_CTRL]) c++; if (key[K_PTRSCR]) c++; if (key[K_ALT]) c++; for (i = 59; i < 84; i++) if (key[i]) c++; if (key[K_F11]) c++; if (key[K_F12]) c++; return c; } int co_Handle_wsclen(CONTROL_EDIT * p_ed) { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] == 95) { if (wcslen(p_ed->wtext) > 29) return 1; if (p_ed->tx > p_ed->rect.right - p_ed->rect.left - 30) return 1; } else { if (wcslen(p_ed->wtext) > 30) return 1; if (p_ed->tx > p_ed->rect.right - p_ed->rect.left - 30) return 1; } return 0; } int draw_edit(CONTROL_EDIT * p_ed, int x, int y, int hdc, int xcor, int ycor) { RECT r; int xt, yt; ddxBitBlt(hdc, p_ed->rect.left + xcor, p_ed->rect.top + ycor, ddxGetWidth(hdcED.hdcEdit), ddxGetHight(hdcED.hdcEdit), hdcED.hdcEdit, 0, 0); ddxCleareSurface(p_ed->bDC); fn_Draw_MessageA(p_ed->bDC, 0, 3, &b2_2d_font.gt, &b2_2d_font.ts, p_ed->wtext, 0, &xt, &yt); ddxTransparentBlt(hdc, p_ed->rect.left + 5 + xcor, p_ed->rect.top + 4 + xcor, p_ed->rect.right - p_ed->rect.left - 10, p_ed->rect.bottom - p_ed->rect.top - 8, p_ed->bDC, 0, 0, p_ed->rect.right - p_ed->rect.left - 10, p_ed->rect.bottom - p_ed->rect.top - 8, TRANSCOLOR); r.left = p_ed->x; r.top = p_ed->y; r.right = ddxGetWidth(hdcED.hdcEdit); r.bottom = ddxGetHight(hdcED.hdcEdit); _2d_Add_RectItem(&rline, r, 0); return xt; } // It's actually ascii character WCHAR co_ToUnicode(int wScanCode) { WCHAR res; char c = wScanCode; mbrtowc(&res, &c, 1, NULL); key_pressed = 0; return res; } int co_Handle_Edit(CONTROL_EDIT * p_ed, int x, int y, int hdc, int xcor, int ycor) { DWORD t = timeGetTime(); if (bBlockList) return 0; if (dim.t1) { if (co_Rect_Hit(p_ed->rect, x, y)) { if (!p_ed->bActive) { p_ed->pTime = t; p_ed->bcActive = 0; } p_ed->bActive = 1; return 1; } else { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] == 95) p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->bActive = 0; goto CO_HANDLE_DRAW; } } if (p_ed->bActive) { spracuj_spravy(0); if (key[0] && key_pressed) { WCHAR wt[3]; int size; if (co_Handle_Edit_Key_Filter() || (co_Handle_wsclen(p_ed) && !key[K_BKSP])) { memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } wt[0] = wt[1] = wt[2] = 0; size = MultiByteToWideChar(CP_ACP, 0, (char *) &key_pressed, 1, wt, sizeof(wt)/sizeof(wt[0])); if(size > 1) { // we have got some unsupported character - ignore it memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } wt[0] = co_ToUnicode(key_pressed); if (!wt[0]) { memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } if (wt[0] == '_') { memset(key, 0, POCET_KLAVES * sizeof(int)); return 1; } if (key[K_ENTER]) { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] == 95) p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->bActive = 0; goto CO_HANDLE_DRAW; } if (key[K_BKSP]) { if (wcslen(p_ed->wtext)) { if (p_ed->wtext[wcslen(p_ed->wtext) - 1] != 95) p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; else if (wcslen(p_ed->wtext) > 1) { p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->wtext[wcslen(p_ed->wtext) - 1] = 95; } else { p_ed->wtext[0] = 95; p_ed->wtext[1] = 0; } } } else { if (!wcslen(p_ed->wtext)) wcscat(p_ed->wtext, wt); else if (p_ed->wtext[wcslen(p_ed->wtext) - 1] != 95) wcscat(p_ed->wtext, wt); else { p_ed->wtext[wcslen(p_ed->wtext) - 1] = wt[0]; p_ed->wtext[wcslen(p_ed->wtext)] = 95; p_ed->wtext[wcslen(p_ed->wtext)] = 0; } } CO_HANDLE_DRAW: p_ed->tx = draw_edit(p_ed, x, y, hdc, xcor, ycor); memset(key, 0, POCET_KLAVES * sizeof(int)); } } if (t - p_ed->pTime > 500 && p_ed->bActive) { p_ed->pTime = t; if (!p_ed->bcActive) { char t[32]; WCHAR wt[32]; p_ed->bcActive = 1; strcpy(t, "_"); MultiByteToWideChar(CP_ACP, 0, t, strlen(t) + 1, wt, sizeof(wt) / sizeof(wt[0])); if (!wcslen(p_ed->wtext)) wcscat(p_ed->wtext, wt); else if (p_ed->wtext[wcslen(p_ed->wtext) - 1] != 95) wcscat(p_ed->wtext, wt); p_ed->tx = draw_edit(p_ed, x, y, hdc, xcor, ycor); } else { p_ed->bcActive = 0; p_ed->wtext[wcslen(p_ed->wtext) - 1] = 0; p_ed->tx = draw_edit(p_ed, x, y, hdc, xcor, ycor); } } return 1; } char co_Check_Open_Combo(CONTROL_LIST_ITEM * p_list, int lsize) { int i; for (i = 0; i < lsize; i++) if ((p_list + i)->p_combo && (p_list + i)->bActive) if ((p_list + i)->p_combo->bList) return 1; return 0; } void co_Handle_Controls(CONTROL_LIST_ITEM * p_list, int lsize, int x, int y, int hdc, int xcor, int ycor) { char c = co_Check_Open_Combo(p_list, lsize); int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_combo && (p_list + i)->bActive && !(p_list + i)->bDisabled) { if (!co_Handle_Combo((p_list + i)->p_combo, (p_list + i)->bFocus, x, y, hdc, xcor, ycor, c) && (p_list + i)->bFocus) (p_list + i)->bFocus = 0; else (p_list + i)->bFocus = 1; } if (dim.t1) if ((p_list + i)->p_combod && (p_list + i)->bActive && !(p_list + i)->bDisabled) { if (!co_Handle_Combo_Drop((p_list + i)->p_combod, (p_list + i)->bFocus, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else (p_list + i)->bFocus = 1; } if (dim.t1) if ((p_list + i)->p_button && (p_list + i)->bActive && !(p_list + i)->bDisabled) { int xx = x, yy = y; if ((p_list + i)->iTab == -1) { xx += TAB_X; yy += TAB_Y; } if (!co_Handle_Button((p_list + i)->p_button, xx, yy)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if (dim.t1) if ((p_list + i)->p_check && (p_list + i)->bActive && !(p_list + i)->bDisabled) { if (!co_Handle_Checkbox((p_list + i)->p_check, x, y)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if ((p_list + i)->p_prog && (p_list + i)->bActive && !(p_list + i)->bDisabled) { if (!co_Handle_Progres((p_list + i)->p_prog, x, y)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if ((p_list + i)->p_list && (p_list + i)->bActive && !(p_list + i)->bDisabled) { if (!co_Handle_List((p_list + i)->p_list, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } if ((p_list + i)->p_edit && (p_list + i)->bActive && !(p_list + i)->bDisabled) { if (!co_Handle_Edit((p_list + i)->p_edit, x, y, hdc, xcor, ycor)) (p_list + i)->bFocus = 0; else { (p_list + i)->bFocus = 1; } } } } void co_Handle_Release(CONTROL_LIST_ITEM * p_list, int lsize) { int i; for (i = 0; i < lsize; i++) { if ((p_list + i)->p_combo) co_Release_Combo((p_list + i)->p_combo); if ((p_list + i)->p_button) co_Release_Button((p_list + i)->p_button); if ((p_list + i)->p_check) co_Release_CheckBox((p_list + i)->p_check); if ((p_list + i)->p_prog) co_Release_Progres((p_list + i)->p_prog); if ((p_list + i)->p_list) co_Release_List((p_list + i)->p_list); if ((p_list + i)->p_edit) co_Release_Edit((p_list + i)->p_edit); if ((p_list + i)->p_combod) co_Release_Combo_Drop((p_list + i)->p_combod); } } berusky2-0.12/src/kofola/controls.h0000644000175000017500000001764113674426075014230 00000000000000#ifndef __CONTROLS_ #define __CONTROLS_ #define BUTTON_LARGE 0 #define BUTTON_SMALL 1 typedef void (* CONTROL_CALLBACK)(void *p_control); typedef struct _HDC_EDIT_CONTROL { int hdcEdit; } HDC_EDIT_CONTROL; typedef struct _HDC_COMBO_CONTROL { int hdcCombo; int hdcComboEnd; int hdcComboMid; int hdcComboUp; int hdcComboDown; int hdcComboDrop; int hdcComboMover; int hdcComboMoverb; } HDC_COMBO_CONTROL; typedef struct _HDC_BUTTON_CONTROL { int hdcButtonL; int hdcButtonS; } HDC_BUTTON_CONTROL; typedef struct _HDC_FRAME_CONTROL { int hdcFrame; } HDC_FRAME_CONTROL; typedef struct _HDC_PROGRES_CONTROL { int hdcLine; int hdcMover; } HDC_PROGRES_CONTROL; typedef struct _HDC_CHECKBOX_CONTROL { int hdcCheck; int hdcGray; } HDC_CHECKBOX_CONTROL; typedef struct _HDC_LIST_CONTROL { int hdcListDown; int hdcListUp; int hdcListMover; int hdcListTop; int hdcListBottom; int hdcListLeft; int hdcListRight; int hdcListTL; int hdcListTR; int hdcListBL; int hdcListBR; } HDC_LIST_CONTROL; typedef struct _COMBO_ITEM { char text[256]; int Sel; int Norm; float fValue; } COMBO_ITEM; typedef struct _COMBO_CONTROL { int comboID; int x; int y; int Width; int WidthR; int Hight; int ListHight; int ListMaxHight; int ListMaxHightR; int Selected; int CSelected; int SSelected; int OSelected; COMBO_ITEM *pItem; int CounfOfItems; int CounfOfItemsL; RECT coEditRect; RECT coDownRect; RECT coListRect; RECT coLUp; RECT coLDown; RECT coLMov; RECT coLMovA; char bEdit; char bList; char bOpen; int *pBDC; int xmstart; int xm; int xmp; char bIn; } COMBO_CONTROL; typedef struct _COMBO_DROP_CONTROL { int dropID; RECT coLUp; RECT coLDown; int x; int y; int Selected; COMBO_ITEM *pItem; int CounfOfItems; } COMBO_DROP_CONTROL; typedef struct _BUTTON_CONTROL { int x; int y; int type; RECT Rect; int dc; int ButtonID; char bActivated; } BUTTON_CONTROL; typedef struct _CHECKBOX_CONTROL { int x; int y; RECT Rect; RECT RectFull; int iDC; int checkID; char bChecked; char bChange; void *p_callback_data; CONTROL_CALLBACK p_callback; } CHECKBOX_CONTROL; typedef struct _PROGRES_CONTROL { RECT rectMover; RECT rectProgres; int progID; int min; int max; int pos; int cor; int x; int y; int bDC; char bIn; char bChange; char bExclusive; RECT RectFull; int iDC; } PROGRES_CONTROL; typedef struct _LIST_VIEW_ITEM { int iValue; char *cValue; WCHAR *wcValue; } LIST_VIEW_ITEM; typedef struct _LIST_VIEW_CONTROL { int listID; int dx; int listnum; int x; int y; int mpmin; int mpmax; int mpos; RECT rectList; RECT rectUp; RECT rectDown; RECT rectMoverA; RECT rectMover; int bDCn; int bDCs; int bDCm; char bIn; char bInE; int Selected; int Pushc; DWORD pTime; int cSelected; int cClckSel; char bClck; char bDblClck; int bSelection; LIST_VIEW_ITEM *piValue; } LIST_VIEW_CONTROL; typedef struct _CONTROL_EDIT { int bDC; //int bDCb; int x; int y; WCHAR wtext[128]; int lchar; int editID; RECT rect; char bActive; char bcActive; DWORD pTime; int tx; } CONTROL_EDIT; typedef struct _CONTROL_LIST_ITEM { COMBO_CONTROL *p_combo; BUTTON_CONTROL *p_button; CHECKBOX_CONTROL *p_check; PROGRES_CONTROL *p_prog; LIST_VIEW_CONTROL *p_list; CONTROL_EDIT *p_edit; COMBO_DROP_CONTROL *p_combod; int iTab; char bActive; char bFocus; char bDisabled; } CONTROL_LIST_ITEM; int co_Load_Graphic(int combo_var); int co_Release_Graphic(void); COMBO_CONTROL *co_Create_Combo(int hdc, int x, int y, int maxlisthight, int id); int co_Combo_Add_String(COMBO_CONTROL * p_co, char *text); int co_Combo_Add_StringWC(COMBO_CONTROL * p_co, char *text); int co_Combo_Add_StringWC2(COMBO_CONTROL * p_co, WCHAR * wc, char *text); int co_Combo_Set_Params(COMBO_CONTROL * p_co, int itemnum); int co_Combo_Set_Sel(int hdc, COMBO_CONTROL * p_co, int i); int co_Combo_Get_Sel(CONTROL_LIST_ITEM * p_list, int lsize, int id); void co_Release_Combo(COMBO_CONTROL * p_co); BUTTON_CONTROL *co_Create_Button(int hdc, int x, int y, int type, char *text, int isection, int buttonID); int co_Is_Button_Activated(CONTROL_LIST_ITEM * p_list, int lsize, int id); void co_Release_Button(BUTTON_CONTROL * p_bu); CHECKBOX_CONTROL *co_Create_CheckBox(int hdc, int x, int y, char *text, int isection, int checkID, CONTROL_CALLBACK p_callback = NULL, void *p_callback_data = NULL); int co_Check_Get_State(CONTROL_LIST_ITEM * p_list, int lsize, int id); int co_Check_Set_State(CHECKBOX_CONTROL * p_ch, int hdc, int state, char bDraw); void co_Release_CheckBox(CHECKBOX_CONTROL * p_ch); PROGRES_CONTROL *co_Create_Progres(int hdc, int x, int y, int min, int max, int progID); int co_Progres_Set(PROGRES_CONTROL * p_pr, int hdc, int i); int co_Progres_Get(CONTROL_LIST_ITEM * p_list, int lsize, int id); int co_Progres_Changed(CONTROL_LIST_ITEM * p_list, int lsize, int id); void co_Release_Progres(PROGRES_CONTROL * p_pr); int co_Set_Text(int hdc, int x, int y, char *text, int isection); int co_Set_Text_Center(int hdc, char *text, int isection, RECT r); int co_Set_Text_Right(int hdc, char *text, int isection, int x, int y); int co_Set_Text_RightWC(int hdc, char *text, int isection, int x, int y); LIST_VIEW_CONTROL *co_Create_List(int hdc, int x, int y, int width, int hight, int id, int numofitems, int bSelection); int co_List_Add_String(LIST_VIEW_CONTROL * p_li, int index, int x, char *text, int iValue, char bSelected); int co_List_Add_StringWC(LIST_VIEW_CONTROL * p_li, int index, int x, char *text, int iValue, char bSelected); int co_List_Add_StringWC2(LIST_VIEW_CONTROL * p_li, int index, int x, WCHAR * wc, char *text, int iValue, char bSelected); int co_List_Redraw(int hdc, LIST_VIEW_CONTROL * p_li, int y); int co_List_Get_Dbclck(CONTROL_LIST_ITEM * p_list, int lsize, int id, LIST_VIEW_CONTROL ** p_li); int co_List_Get_Clck(CONTROL_LIST_ITEM * p_list, int lsize, int id, LIST_VIEW_CONTROL ** p_li); int co_List_Get_Value(CONTROL_LIST_ITEM * p_list, int lsize, int id, int index); int co_List_Delete_Item(LIST_VIEW_CONTROL * p_li, char **cValue); void co_Release_List(LIST_VIEW_CONTROL * p_li); CONTROL_EDIT *co_Create_Edit(int hdc, int x, int y, int editID); WCHAR *co_Edit_Get_Text(CONTROL_EDIT * p_ed); COMBO_DROP_CONTROL *co_Create_Combo_Drop(int hdc, int x, int y, int id); int co_Combo_Drop_Add_String(COMBO_DROP_CONTROL * p_co, char *text, float fValue); int co_Combo_Drop_Set_Sel(int hdc, COMBO_DROP_CONTROL * p_co, int i); int co_Combo_Drop_Set_String(int hdc, COMBO_DROP_CONTROL * p_co, int xcor, int ycor); int co_Combo_Drop_Add_StringWC(COMBO_DROP_CONTROL * p_co, char *text, float fValue); int co_Combo_Drop_Get_Sel(CONTROL_LIST_ITEM * p_list, int lsize, int id, float *pf); void co_Handle_Controls(CONTROL_LIST_ITEM * p_list, int lsize, int x, int y, int hdc, int xcor, int ycor); void co_Handle_Release(CONTROL_LIST_ITEM * p_list, int lsize); int co_Rect_Hit(RECT rect, int x, int y); int co_Combo_Get_Sel_Not_Opend(CONTROL_LIST_ITEM * p_list, int lsize, int id); void co_Cleare_List(LIST_VIEW_CONTROL * p_li, int numofitems, int hdc, int xcor, int ycor); void co_Release_Combo_Drop(COMBO_DROP_CONTROL * p_co); void co_Check_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id); void co_Check_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id); int co_Check_Get_State_Change(CONTROL_LIST_ITEM * p_list, int lsize, int id); void co_Progres_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id, char bSave, int shdc); void co_Progres_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list, int lsize, int id); #endif berusky2-0.12/src/kofola/camera.h0000644000175000017500000000161213674426075013604 00000000000000#ifndef __CAMERA_ #define __CAMERA_ typedef struct { float Position[3]; // pozice float Target[3]; // cil float Roll; float fi; float r; float Distance; } CAMERA_STRUCT; typedef struct { CAMERA_STRUCT init; CAMERA_STRUCT real; CAMERA_STRUCT finish; int flag; int bChange; char anim_type; int last_move; } CAMERA_ANIMATION; void camera_Animate(CAMERA_ANIMATION * cam); void camera_Animate_Jumping(CAMERA_ANIMATION * cam); void camera_Fast_Turn(int pressed_key, char left, int *flag, float fpq); void camera_Zoom(int pressed_key, char out, int *flag, float fpq); void camera_Turn(int pressed_key, int left, int down, CAMERA_ANIMATION * cam, float fpq); void camera_Move(int pressed_key, int left, int back, CAMERA_ANIMATION * cam, float fpq); void camera_Center(int *pcameraflag, void *v_Level, int framenum, char bTopView, char bLastCam); #endif berusky2-0.12/src/kofola/Comics.h0000644000175000017500000000055713674426075013600 00000000000000#ifndef __COMICS_ #define __COMICS_ void cmcs_Start_Comics(char *cFile, AUDIO_DATA * p_ad, char bMusic); void cmcs_Play_Intro(char *cFile, AUDIO_DATA * p_ad); void cmcs_Play_Video(char *pFile, long dwVideoTime, AUDIO_DATA * p_ad); void cmcs_Start_Picture(int Index, long time, AUDIO_DATA * p_ad, char bMusic); void cmcs_Game_Down(); void cmcs_Game_Up(); #endif berusky2-0.12/src/kofola/profiles.h0000644000175000017500000000172013674426075014177 00000000000000//------------------------------------------------------------------------------------------------ // 1.0.0 //------------------------------------------------------------------------------------------------ #ifndef __PROFILES_ #define __PROFILES_ #define PLAYER_NAME_LENGTH 32 typedef struct { int iVer; char cScene[20]; char cMovie[20]; char cLevel[600]; WCHAR cName[PLAYER_NAME_LENGTH]; char Reserved[1000]; } PLAYER_PROFILE; typedef struct { int iVer; char cScene[20]; char cMovie[20]; char cLevel[600]; word cName[PLAYER_NAME_LENGTH]; char Reserved[1000]; } PLAYER_PROFILE_DISC; int pr_CreateProfile(WCHAR * cPlayerName); int pr_ReadProfile(char *cPlayerName, PLAYER_PROFILE * pProfile); int pr_SaveProfile(PLAYER_PROFILE * pProfile); int pr_GetPlayerName(char *cFile, WCHAR * cName); void pr_DiscToProfile(PLAYER_PROFILE_DISC * disc, PLAYER_PROFILE * prof); void pr_ProfileToDisc(PLAYER_PROFILE * prof, PLAYER_PROFILE_DISC * disc); #endif berusky2-0.12/src/kofola/font.cpp0000644000175000017500000006377713674426075013701 00000000000000#include #include #include "font.h" #include "2D_graphic.h" #include "menu_def.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky_universal.h" B2_FONT b2_2d_font; extern _3D_DATA _3dd; void fn_Release_Font(int bTextures); void Uni2Char(WCHAR * cUni, char *cText, int ctsize); int fn_Find_Char(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, int *top, int *left, int *bottom, int *right, int *ycor, WCHAR cWChar, float xbmp, float ybmp) { float *l, *t, *r, *b, *y; int i; if (cWChar < 0 || cWChar > b2_2d_font.iMaxCharValue) return 0; i = b2_2d_font.pTTable[cWChar]; if (i < 0) { return 0; } else { l = (float *) >->command[i].Parametr[1].Value; t = (float *) >->command[i].Parametr[2].Value; r = (float *) >->command[i].Parametr[3].Value; b = (float *) >->command[i].Parametr[4].Value; y = (float *) >->command[i].Parametr[5].Value; *left = ftoi((*l) * xbmp); *top = ftoi((*t) * ybmp); *right = ftoi((*r) * xbmp); *bottom = ftoi((*b) * ybmp); *ycor = ftoi((*y) * ybmp); } return 1; } int fn_Create_TTable(int iMaxCharValue, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts) { int i; b2_2d_font.pTTable = (int *) malloc((iMaxCharValue + 1) * sizeof(int)); b2_2d_font.iMaxCharValue = iMaxCharValue; kprintf(1, "b2_2d_font.pTTable = %p", b2_2d_font.pTTable); if (!b2_2d_font.pTTable) return 0; for (i = 0; i < iMaxCharValue + 1; i++) b2_2d_font.pTTable[i] = -1; for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 1: if (gt->command[i].Parametr[0].Value < (unsigned) iMaxCharValue + 1) b2_2d_font.pTTable[(int) gt->command[i].Parametr[0].Value] = i; break; } return 1; } int fn_Set_Font_Params(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts) { int iMaxCharValue = 0; int i; for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 1: if ((int) gt->command[i].Parametr[0].Value > iMaxCharValue) iMaxCharValue = (int) gt->command[i].Parametr[0].Value; break; case 2: { if (gt->command[i].LastParam > 2 && gt->command[i].Parametr[0].Type == 0) b2_2d_font.tcolor = RGB(gt->command[i].Parametr[0].Value, gt->command[i].Parametr[1].Value, gt->command[i].Parametr[2].Value); } break; case 3: { if (gt->command[i].LastParam > 0 && gt->command[i].Parametr[0].Type == 0) b2_2d_font.iYPlus = gt->command[i].Parametr[0].Value; } break; case 6: { if (gt->command[i].LastParam > 0 && gt->command[i].Parametr[0].Type == 0) b2_2d_font.iXPlus = gt->command[i].Parametr[0].Value; } break; } if (!fn_Create_TTable(iMaxCharValue, gt, ts)) return 0; return 1; } int fn_Set_Font_Bmps(GAME_TRIGER * gt, TRIGER_STRUCTURE * ts) { char text[256]; int i; txt_trida(TEXT_MENU); for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 4: { if (gt->command[i].LastParam > 1 && gt->command[i].Parametr[1].Type == 2) { memset(text, 0, 256); WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, (wchar_t *) ts->StrTable[gt->command[i].Parametr[1].Value], wcslen((wchar_t *) ts->StrTable[gt->command[i].Parametr[1]. Value]), text, 256, NULL, NULL); b2_2d_font.iBitmap[gt->command[i].Parametr[0].Value] = ddxLoadBitmap(text, b2_2d_font.dir); } } break; case 5: { if (gt->command[i].LastParam > 1 && gt->command[i].Parametr[1].Type == 2) { memset(text, 0, 256); WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, (wchar_t *) ts->StrTable[gt->command[i].Parametr[1].Value], wcslen((wchar_t *) ts->StrTable[gt->command[i].Parametr[1]. Value]), text, 256, NULL, NULL); txt_nahraj_texturu_z_func(b2_2d_font.dir, text, &b2_2d_font.tex[gt->command[i].Parametr[0].Value], 1, 0, &b2_2d_font.konf[gt->command[i].Parametr[0].Value], bmp_nahraj); } } break; } return 0; } bool fn_Draw_Message(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXmax, int *iYmax) { WCHAR wtext[1024]; int i; int top, bottom, left, right, ycor; int x = iXpos, y = iYpos - b2_2d_font.iYPlus; *iXmax = x; *iYmax = y; i = wcslen(cFile); cFile = wcsstr((WCHAR *) b2_2d_font.pTBuffer, cFile); if (!cFile) return(FALSE); cStop = wcsstr(cFile, cStop); if (!cStop) return(FALSE); ZeroMemory(wtext, 1024 * sizeof(WCHAR)); wcsncpy(wtext, cFile + i, cStop - cFile - i); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { //x+= 50; x += b2_2d_font.iXPlus; continue; } else if (wtext[i] == 10) { //y+= 17; y += b2_2d_font.iYPlus; x = iXpos; *iYmax += b2_2d_font.iYPlus; continue; } else if (fn_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float) ddxGetWidth(b2_2d_font.iBitmap[iSection]), (float) ddxGetHight(b2_2d_font.iBitmap[iSection]))) { ddxTransparentBlt(iSurface, x, y + ycor, right - left + 1, bottom - top + 1, b2_2d_font.iBitmap[iSection], left, top, right - left + 1, bottom - top + 1, b2_2d_font.tcolor); x += right - left + 2; if (x > *iXmax) *iXmax = x; if (bottom - top + 1 > b2_2d_font.iYPlus) *iYmax = (*iYmax) - b2_2d_font.iYPlus + (bottom - top + 1); } } return(TRUE); } bool fn_Draw_MessageA(int iSurface, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cText, int iSection, int *iXmax, int *iYmax) { WCHAR wtext[1024]; int i; int top, bottom, left, right, ycor; int x = iXpos, y = iYpos; *iXmax = x; *iYmax = y + b2_2d_font.iYPlus; ZeroMemory(wtext, 1024 * sizeof(WCHAR)); wcsncpy(wtext, cText, wcslen(cText)); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { x += b2_2d_font.iXPlus; continue; } else if (wtext[i] == 10) { y += b2_2d_font.iYPlus; x = iXpos; *iYmax += b2_2d_font.iYPlus; continue; } else { int ret = fn_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float)ddxGetWidth(b2_2d_font.iBitmap[iSection]), (float)ddxGetHight(b2_2d_font.iBitmap[iSection])); if(ret) { ddxTransparentBlt(iSurface, x, y + ycor, right - left + 1, bottom - top + 1, b2_2d_font.iBitmap[iSection], left, top, right - left + 1, bottom - top + 1, b2_2d_font.tcolor); x += right - left + 2; if (x > *iXmax) *iXmax = x; if (bottom - top + 1 > b2_2d_font.iYPlus) *iYmax = (*iYmax) - b2_2d_font.iYPlus + (bottom - top + 1); } } } return(TRUE); } void fn_Set_Char(unsigned int *pTexture, int iXSize, int iYSize, int iXpos, int iYpos, unsigned int *pSource, int iXSSize, int iYSSize, int iCXSize, int iCYSize, int iXCpos, int iYCpos) { unsigned int *pT = &pTexture[(iXSize * (iYSize - iYpos)) - (iXSize - iXpos)]; unsigned int *pS = &pSource[(iXSSize * (iYSSize - iYCpos)) - (iXSSize - iXCpos)]; int y; for (y = iYCpos; y <= iYCpos + iCYSize; y++) { memcpy((void *) pT, (void *) pS, iCXSize * sizeof(unsigned int)); pT -= iXSize; pS -= iXSSize; } } void fn_Gen_Texture(char ** lpTexture, int iXSize, int iYSize, int iXpos, int iYpos, GAME_TRIGER * gt, TRIGER_STRUCTURE * ts, WCHAR * cFile, WCHAR * cStop, int iSection, int *iXres, int *iYres) { WCHAR wtext[1024]; int i; int top, bottom, left, right, ycor; char *pT = NULL; int x = iXpos, y = iYpos - b2_2d_font.iYPlus; *iXres = iXpos; *iYres = iYpos; i = wcslen(cFile); cFile = wcsstr((WCHAR *) b2_2d_font.pTBuffer, cFile); if (!cFile) return; cStop = wcsstr(cFile, cStop); if (!cStop) return; ZeroMemory(wtext, 1024 * sizeof(WCHAR)); wcsncpy(wtext, cFile + i, cStop - cFile - i); pT = (char *) malloc(iXSize * iYSize * sizeof(unsigned int)); if (!pT) return; *lpTexture = pT; ZeroMemory(pT, iXSize * iYSize * sizeof(unsigned int)); for (i = 0; i < (int) wcslen(wtext); i++) { if (wtext[i] == 32) { x += b2_2d_font.iXPlus; continue; } else if (wtext[i] == 10) { //y+= 17; y += b2_2d_font.iYPlus; // *iYres = y; x = iXpos; continue; } else if (fn_Find_Char(gt, ts, &top, &left, &bottom, &right, &ycor, wtext[i], (float) b2_2d_font.tex[iSection].p_bmp->x, (float) b2_2d_font.tex[iSection].p_bmp->y)) { if (b2_2d_font.tex[iSection].p_bmp) { fn_Set_Char((unsigned int *) pT, iXSize, iYSize, x, y + ycor, (unsigned int *) b2_2d_font.tex[iSection].p_bmp->data, b2_2d_font.tex[iSection].p_bmp->x, b2_2d_font.tex[iSection].p_bmp->y, right - left, bottom - top, left, top); } x += right - left + 2; if (x > *iXres) *iXres = x; if (y + ycor + (bottom - top) > *iYres) *iYres = y + ycor + (bottom - top); } } } int fn_Load_Grammar(char *pFile, GRAMMAR * pGr) { FILE *file; char text[MAX_FILENAME]; construct_path(text, MAX_FILENAME, 2, b2_2d_font.dir, pFile); file = fopen(text, "rb"); if (!file) return 0; pGr->LastMask = 0; while (fgets(text, 256, file)) { gr_Add_Mask(text, pGr); strcpy(text, ""); } fclose(file); return 1; } char fn_Load_Triger(char *pFile, GAME_TRIGER * pTriger, GRAMMAR * pGr, TRIGER_STRUCTURE * pTStruct) { FILE *file; char text[64]; WCHAR wtext[sizeof(text)*4]; char filename[MAX_FILENAME]; pTriger->lastcommand = 0; construct_path(filename, MAX_FILENAME, 2, b2_2d_font.dir, pFile); file = fopen(filename, "rb"); if (!file) return 0; while (!feof(file)) { memset(wtext, 0, sizeof(wtext)); if (fgets(text, sizeof(text), file)) { if (MultiByteToWideChar(CP_ACP, 0, text, sizeof(text)/sizeof(*text), wtext, sizeof(wtext)/sizeof(*wtext)) < 0) { fclose(file); return 0; } trig_Parse_LineU(wtext, &pTriger->command[pTriger->lastcommand], pTriger, pGr, pTStruct); } } fclose(file); return 1; } int fn_Set_Font(char *cDir) { int i; char filename[MAX_FILENAME]; long size; char *buffer; memset(&b2_2d_font, 0, sizeof(B2_FONT)); construct_path(b2_2d_font.dir, MAX_FILENAME, 2, p_ber->dir.bitmap_dir, cDir); construct_path(filename, MAX_FILENAME, 2, b2_2d_font.dir, "texts.txt"); b2_2d_font.file = fopen(filename, "rb"); if (!b2_2d_font.file) return 0; if (fseek(b2_2d_font.file, 0, SEEK_END) < 0 || (size = ftell(b2_2d_font.file)) < 0 || fseek(b2_2d_font.file, 0, SEEK_SET) < 0) return 0; buffer = (char *) mmalloc(sizeof(*buffer) * (size + 1)); if (fread(buffer, sizeof(*buffer), size, b2_2d_font.file) != (size_t) size) return 0; buffer[size] = 0; b2_2d_font.iTSize = MultiByteToWideChar(CP_ACP, 0, buffer, size, NULL, 0); b2_2d_font.pTBuffer = (WCHAR *) mmalloc(sizeof(*b2_2d_font.pTBuffer) * (b2_2d_font.iTSize + 1)); size = MultiByteToWideChar(CP_ACP, 0, buffer, size, b2_2d_font.pTBuffer, b2_2d_font.iTSize + 1); assert((size_t) size == b2_2d_font.iTSize); free(buffer); if (!fn_Load_Grammar("font_grammar.txt", &b2_2d_font.gr)) return 0; b2_2d_font.ts.LastStr = 0; b2_2d_font.ts.sizeofT = 0; b2_2d_font.ts.pTriger = NULL; if (!fn_Load_Triger("font_def.txt", &b2_2d_font.gt, &b2_2d_font.gr, &b2_2d_font.ts)) return 0; for (i = 0; i < FONT_MAX_BMP; i++) b2_2d_font.iBitmap[i] = -1; b2_2d_font.pTTable = NULL; if (!fn_Set_Font_Params(&b2_2d_font.gt, &b2_2d_font.ts)) return 0; kprintf(1, "set font = %s", cDir); return 1; } int fn_Load_Bitmaps(void) { if (b2_2d_font.dir[0] == '\0') return 0; kom_set_default_text_config(0, 0, 1, 0, 0, 1); fn_Set_Font_Bmps(&b2_2d_font.gt, &b2_2d_font.ts); kom_ret_default_text_config(); return 1; } void fn_Release_Font(int bTextures) { int i; fclose(b2_2d_font.file); free(b2_2d_font.pTBuffer); //if(_2dd.bitmap) if (bTextures) for (i = 0; i < FONT_MAX_BMP; i++) if (b2_2d_font.iBitmap[i] != -1) { ddxReleaseBitmap(b2_2d_font.iBitmap[i]); } if (bTextures) for (i = 0; i < FONT_MAX_BMP; i++) if (b2_2d_font.tex[i].load) { txt_zrus_texturu_ram(&b2_2d_font.tex[i]); b2_2d_font.tex[i].load = 0; } b2_2d_font.iTSize = 0; if (b2_2d_font.pTTable) free((void *) b2_2d_font.pTTable); b2_2d_font.pTTable = NULL; } void fn_Release_3d_Textures_Full(void) { int i; for (i = 133 + MENU_ANIMATION_CORECTION; i < _3dd.last; i++) { txt_zrus_texturu(&_3dd.p_texture[i]); _3dd.p_texture[i].text = -1; free((void *) _3dd.p_sysramtexture[i].data); } _3dd.last = 133 + MENU_ANIMATION_CORECTION; } void fn_Release_3d_Textures(void) { int i; for (i = 133 + MENU_ANIMATION_CORECTION; i < _3dd.last; i++) { txt_zrus_texturu(&_3dd.p_texture[i]); _3dd.p_texture[i].text = -1; } } void fn_Test(int hdc) { int x, y; WCHAR wc[64]; WCHAR ws[64]; MultiByteToWideChar(CP_ACP, 0, "##message1", strlen("##message1") + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(hdc, 360, 230, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 0, &x, &y); } void fn_Test2(int hdc) { int x, y; WCHAR wc[64]; WCHAR ws[64]; MultiByteToWideChar(CP_ACP, 0, "##settings", strlen("##settings") + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Draw_Message(hdc, 800, 600, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, 0, &x, &y); } int fn_Text_Blt(int hdc, WCHAR * ws, WCHAR * wc, int iSurface, int iSection, int *i) { int x, y; int tmpDC; fn_Draw_Message(iSurface, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, iSection, &x, &y); *i = ddxFindFreeSurface(); tmpDC = ddxCreateSurface(x, y, *i); if (!tmpDC) return 0; else ddxTransparentBlt(tmpDC, 0, 0, x, y, iSurface, 0, 0, x, y, TRANSCOLOR); return 1; } int fn_Gen_Menu_Text(int iSection, int hdc, char *cText, int *i1, int *i2) { WCHAR wc[64]; WCHAR ws[64]; int sidx = ddxFindFreeSurface(); int fDC = ddxCreateSurface(1024, 200, sidx); if (!fDC) return -1; MultiByteToWideChar(CP_ACP, 0, cText, strlen(cText) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); if (!fn_Text_Blt(hdc, ws, wc, fDC, iSection, i1)) { ddxReleaseBitmap(sidx); return -1; } if (!fn_Text_Blt(hdc, ws, wc, fDC, iSection + 1, i2)) { ddxReleaseBitmap(sidx); return -1; } ddxReleaseBitmap(sidx); return sidx; } int fn_Gen_Menu_Texts(int iSection, int hdc) { int x; WCHAR wc[64]; WCHAR ws[64]; int sidx = ddxFindFreeSurface(); int fDC = ddxCreateSurface(1024, 200, sidx); if (!fDC) return 0; MultiByteToWideChar(CP_ACP, 0, "##menu_newgame", strlen("##menu_newgame") + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); if (!fn_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if (!fn_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; MultiByteToWideChar(CP_ACP, 0, "##menu_loadgame", strlen("##menu_loadgame") + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!fn_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if (!fn_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; MultiByteToWideChar(CP_ACP, 0, "##menu_settings", strlen("##menu_settings") + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!fn_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if (!fn_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; MultiByteToWideChar(CP_ACP, 0, "##menu_credits", strlen("##menu_credits") + 1, wc, sizeof(wc) / sizeof(wc[0])); if (!fn_Text_Blt(hdc, ws, wc, fDC, 0, &x)) return 0; if (!fn_Text_Blt(hdc, ws, wc, fDC, 1, &x)) return 0; ddxReleaseBitmap(sidx); return 1; } int fn_Gen_Menu(void) { return fn_Gen_Menu_Texts(0, HDC2DD); } #define FONT_X_MAX 1024 #define FONT_Y_MAX 1024 int fn_Up(int iValue) { int i, x = 4; for (i = 3; i < 12; i++) { x = x * 2; if (x > iValue) return x; } return FONT_X_MAX; } int fn_Blt(char *pT, char **pD, int ix, int iy) { int y; unsigned int *puT = (unsigned int *) pT + (FONT_X_MAX * (FONT_Y_MAX - 1)); unsigned int *puD; *pD = (char *) malloc(ix * iy * sizeof(unsigned int)); if (!(*pD)) return 0; memset((*pD), 0, ix * iy * sizeof(unsigned int)); puD = (unsigned int *) (*pD) + (ix * (iy - 1)); for (y = 0; y < iy; y++) { memcpy((void *) puD, (void *) puT, ix * sizeof(unsigned int)); puT -= FONT_X_MAX; puD -= ix; } for (y = 0; y < FONT_X_MAX * FONT_Y_MAX; y++) if (pT[y]) pT[y] = pT[y]; free((void *) pT); return 1; } int fn_Put_in_3d_List(int text, EDIT_TEXT * p_tex, EDIT_TEXT_KONFIG * p_konf, int x, int y, char *pMem, int ox, int oy) { memcpy(&_3dd.p_texture[_3dd.last], p_tex, sizeof(EDIT_TEXT)); memcpy(&_3dd.p_sysramtexture[_3dd.last].konf, p_konf, sizeof(EDIT_TEXT_KONFIG)); _3dd.p_texture[_3dd.last].text = text; _3dd.p_sysramtexture[_3dd.last].data = pMem; _3dd.p_sysramtexture[_3dd.last].x = x; _3dd.p_sysramtexture[_3dd.last].y = y; _3dd.p_sysramtexture[_3dd.last].tx = ox; _3dd.p_sysramtexture[_3dd.last].ty = oy; _3dd.p_sysramtexture[_3dd.last].bSLoaded = 0; _3dd.p_sysramtexture[_3dd.last].bVLoaded = 0; _3dd.last++; return _3dd.last - 1; } int fn_Get_Font_Texture(int iSection, char *cText) { int tx, ty; int Xmax, Ymax; char *pT = NULL; char *pnT = NULL; WCHAR wc[64]; WCHAR ws[64]; MultiByteToWideChar(CP_ACP, 0, cText, strlen(cText) + 1, wc, sizeof(wc) / sizeof(wc[0])); MultiByteToWideChar(CP_ACP, 0, "##endofmessage", strlen("##endofmessage") + 1, ws, sizeof(ws) / sizeof(ws[0])); fn_Gen_Texture(&pT, FONT_X_MAX, FONT_Y_MAX, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, ws, iSection, &Xmax, &Ymax); tx = Xmax; ty = Ymax; Xmax = fn_Up(Xmax); Ymax = fn_Up(Ymax); fn_Blt(pT, &pnT, Xmax, Ymax); /*glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, b2_2d_font.tex.p_bmp->x, b2_2d_font.tex.p_bmp->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b2_2d_font.tex.p_bmp->data); */ return fn_Put_in_3d_List(b2_2d_font.tex[iSection].text, &b2_2d_font.tex[iSection], &b2_2d_font.konf[iSection], Xmax, Ymax, pnT, tx, ty); } void fn_Load_Textures_From_RAM(void) { int i; for (i = 133 + MENU_ANIMATION_CORECTION; i < _3dd.last; i++) { glGenTextures(1, &_3dd.p_texture[i].text); glBindTexture(GL_TEXTURE_2D, _3dd.p_texture[i].text); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _3dd.p_sysramtexture[i].x, _3dd.p_sysramtexture[i].y, 0, GL_RGBA, GL_UNSIGNED_BYTE, _3dd.p_sysramtexture[i].data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } } void fn_Texture(int iSection) { int i; for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##restartlevel"); for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##mainmenu"); for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##settings"); for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##recorddemo"); for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##back"); for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##menu_loadgame"); for (i = 0; i <= iSection; i++) fn_Get_Font_Texture(i, "##menu_savegame"); } //int fn_Find_Char(GAME_TRIGER *gt, TRIGER_STRUCTURE *ts, int *top, int *left, int *bottom, int *right, int *ycor, WCHAR cWChar) void fn_Convert_Rect(char *cFile, int xmax, int ymax) { FILE *f; FILE *fi; GAME_TRIGER *gt = &b2_2d_font.gt; //TRIGER_STRUCTURE *ts = &b2_2d_font.ts; int i; char text[256]; char textt[256]; char t[32]; float *fl1, *fl2, *fl3, *fl4, *fl5; if (getcwd(text, 255) == NULL) return; f = fopen("fontout.txt", "w"); fi = fopen("font_def.txt", "r"); for (i = 0; i < gt->lastcommand; i++) switch (gt->command[i].iCommand) { case 1: { if (gt->command[i].LastParam > 5 && gt->command[i].Parametr[0].Type == 3) { if (fgets(textt, 256, fi) == NULL) { fclose(fi); fclose(f); return; } strncpy(t, textt, 10); t[10] = '\0'; strcpy(text, ""); fl1 = (float *) >->command[i].Parametr[1].Value; fl2 = (float *) >->command[i].Parametr[2].Value; fl3 = (float *) >->command[i].Parametr[3].Value; fl4 = (float *) >->command[i].Parametr[4].Value; fl5 = (float *) >->command[i].Parametr[5].Value; *fl2 = ((*fl2) * 576) / 900.0f; *fl4 = ((*fl4) * 576) / 900.0f; *fl5 = ((*fl5) * 576) / 900.0f; sprintf(text, "%s %f, %f, %f, %f, %f);\n", t, (*fl1), (*fl2), (*fl3), (*fl4), (*fl5)); fputs(text, f); } } break; } fclose(fi); fclose(f); return; } void fn_Draw_Line(int x1, int y1, int x2, int y2, COLORREF color, HDC hdc) { /* HPEN LastPen; HPEN MePen; MePen = CreatePen(PS_SOLID,1,color); LastPen = (HPEN)SelectObject(hdc,MePen); MoveToEx(hdc,x1, y1, NULL); LineTo(hdc,x2, y2); SelectObject(hdc,LastPen); DeleteObject(MePen); */ } void fn_Draw_Draw_Frames(void) { /* float xbmp = 1024.0f; float ybmp = 768.0f; GAME_TRIGER *gt = &b2_2d_font.gt; TRIGER_STRUCTURE *ts = &b2_2d_font.ts; int left, top, bottom, right, ycor; float *l, *t, *r, *b, *y; int i; BitBlt(_2dd.hDC,0,0,1024,768,_2dd.bitmap[b2_2d_font.iBitmap[0]].bitmapDC,0,0,SRCCOPY); for(i=0;ilastcommand;i++) switch(gt->command[i].iCommand) { case 1: { if(gt->command[i].LastParam > 5 && gt->command[i].Parametr[0].Type == 3) { l = (float *)>->command[i].Parametr[1].Value; t = (float *)>->command[i].Parametr[2].Value; r = (float *)>->command[i].Parametr[3].Value; b = (float *)>->command[i].Parametr[4].Value; y = (float *)>->command[i].Parametr[5].Value; left = ftoi((*l) * xbmp); top = ftoi((*t) * ybmp); right = ftoi((*r) * xbmp); bottom = ftoi((*b) * ybmp); ycor = ftoi((*y) * ybmp); fn_Draw_Line(left-1, top-1, right+1, top-1, RGB(255, 0, 0), _2dd.hDC); fn_Draw_Line(right+1, top-1, right+1, bottom+1, RGB(255, 0, 0), _2dd.hDC); fn_Draw_Line(right+1, bottom+1, left-1, bottom+1, RGB(255, 0, 0), _2dd.hDC); fn_Draw_Line(left-1, bottom+1, left-1, top-1, RGB(255, 0, 0), _2dd.hDC); } } break; } */ return; } /* int fn_DC2Tex(HDC hdc, int xr, int yr, int turn, int texture) { int tex; int i, c = 0; // HDC hdcMem; BITMAPINFO *pbmiRGB = (BITMAPINFO *) NULL; HBITMAP hbmRGB = (HBITMAP) NULL; PBYTE pjBitsRGB; PBYTE pjBitsTEX; // hdcMem = CreateCompatibleDC(hdc); pbmiRGB = (BITMAPINFO *)LocalAlloc(LMEM_FIXED|LMEM_ZEROINIT, sizeof(BITMAPINFO) ); if (!pbmiRGB) return 0; pbmiRGB->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmiRGB->bmiHeader.biWidth = xr; pbmiRGB->bmiHeader.biHeight = yr; pbmiRGB->bmiHeader.biPlanes = 1; pbmiRGB->bmiHeader.biBitCount = 24; pbmiRGB->bmiHeader.biCompression = BI_RGB; pbmiRGB->bmiHeader.biSizeImage = pbmiRGB->bmiHeader.biWidth * abs(pbmiRGB->bmiHeader.biHeight) * 3; */ /* hbmRGB = CreateDIBSection(hdcMem, pbmiRGB, DIB_RGB_COLORS, (PVOID *) &pjBitsRGB, NULL, 0); if (!hbmRGB) return 0; if (!SelectObject(hdcMem, hbmRGB)) return 0; if (!BitBlt(hdcMem, 0,0, xr, yr, hdc, 0,0,SRCCOPY)) return 0;*/ /* pjBitsRGB = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbmiRGB->bmiHeader.biSizeImage); if (!pjBitsRGB) return 0; if (!GetDIBits(hdc, hbmRGB, 0, (UINT)pbmiRGB->bmiHeader.biHeight, pjBitsRGB, (LPBITMAPINFO)pbmiRGB, DIB_RGB_COLORS)) return 0; pjBitsTEX = (PBYTE) malloc(pbmiRGB->bmiHeader.biWidth * abs(pbmiRGB->bmiHeader.biHeight) * 4); memset(pjBitsTEX, 0, pbmiRGB->bmiHeader.biWidth * abs(pbmiRGB->bmiHeader.biHeight) * 4); for(i=0;i<(signed)pbmiRGB->bmiHeader.biSizeImage;i+=3) { pjBitsTEX[c] = pjBitsRGB[i+2]; pjBitsTEX[c+1] = pjBitsRGB[i+1]; pjBitsTEX[c+2] = pjBitsRGB[i]; pjBitsTEX[c+3] = 0xff; c+=4; } if(!turn) { glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, xr, yr, 0, GL_RGBA, GL_UNSIGNED_BYTE, pjBitsTEX); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); } else { //void glTexSubImage2D ( GLenum target , GLint level , GLint xoffset , GLint yoffset , GLsizei width , // GLsizei height , GLenum format , GLenum type , const GLvoid *pixels ); glTexSubImage2D(texture, 0, 0, 0, 1024, 768, GL_RGBA, GL_TEXTURE_2D, pjBitsTEX); } //DeleteDC(hdcMem); DeleteObject(hbmRGB); LocalFree(pbmiRGB); GlobalFree((HGLOBAL)pjBitsRGB); free((void *) pjBitsTEX); return tex; */ /* } */ berusky2-0.12/src/kofola/Dda.cpp0000644000175000017500000000613513674426075013404 00000000000000//------------------------------------------------------------------------------------------------ // 1.0.0 //------------------------------------------------------------------------------------------------ #include #include #include "Dda.h" //------------------------------------------------------------------------------------------------ // prvni krok dda primky //------------------------------------------------------------------------------------------------ void dda_First(DDA * dda) { // int p[2]; if (abs(dda->y1 - dda->y2) < abs(dda->x1 - dda->x2)) { /* if (dda->x1 > dda->x2) { p[0]=dda->x2; p[1]=dda->y2; dda->x2=dda->x1; dda->y2=dda->y1; dda->x1=p[0]; dda->y1=p[1]; }*/ dda->y = dda->y1; dda->plus = (float) abs(dda->y1 - dda->y2) / (float) (dda->x2 - dda->x1); dda->realy = (float) dda->y1; dda->x = dda->x1; dda->main_axe = 0; //dda->main_axe = dda->x2 - dda->x1; } else { /* if (dda->y1 > dda->y2) { p[0]=dda->x2; p[1]=dda->y2; dda->x2=dda->x1; dda->y2=dda->y1; dda->x1=p[0]; dda->y1=p[1]; }*/ dda->x = dda->x1; dda->plus = (float) abs(dda->x1 - dda->x2) / (float) (dda->y2 - dda->y1); dda->realx = (float) dda->x1; dda->y = dda->y1; //dda->main_axe = dda->y2 - dda->y1; dda->main_axe = 0; } } //------------------------------------------------------------------------------------------------ // dalsi krok dda primky //------------------------------------------------------------------------------------------------ int dda_Next(DDA * dda) { if (abs(dda->y1 - dda->y2) < abs(dda->x1 - dda->x2)) { if (dda->x == dda->x2) return 0; if (dda->x1 < dda->x2) dda->x++; else dda->x--; if (dda->y1 < dda->y2) dda->realy = dda->realy + dda->plus; else dda->realy = dda->realy - dda->plus; dda->y = (int) floor(dda->realy); } else { if (dda->y == dda->y2) return 0; if (dda->y1 < dda->y2) dda->y++; else dda->y--; if (dda->x1 < dda->x2) dda->realx = dda->realx + dda->plus; else dda->realx = dda->realx - dda->plus; dda->x = (int) floor(dda->realx); } dda->main_axe++; return 1; } //------------------------------------------------------------------------------------------------ // dalsi krok dda primky //------------------------------------------------------------------------------------------------ int dda_Prev(DDA * dda) { if (abs(dda->y1 - dda->y2) < abs(dda->x1 - dda->x2)) { if (dda->x == dda->x1) return 0; if (dda->x1 < dda->x2) dda->x--; else dda->x++; if (dda->y1 < dda->y2) dda->realy = dda->realy - dda->plus; else dda->realy = dda->realy + dda->plus; dda->y = (int) floor(dda->realy); } else { if (dda->y == dda->y1) return 0; if (dda->y1 < dda->y2) dda->y--; else dda->y++; if (dda->x1 < dda->x2) dda->realx = dda->realx - dda->plus; else dda->realx = dda->realx + dda->plus; dda->x = (int) floor(dda->realx); } dda->main_axe--; return 1; } berusky2-0.12/src/kofola/menu_script.cpp0000644000175000017500000002635613674426075015253 00000000000000#include #include #include #include "menu_script.h" #include "menu_def.h" #include "3d_all.h" extern char pDataDir[MAX_FILENAME]; //------------------------------------------------------------------------------------------------ // najde prvni platny znak //------------------------------------------------------------------------------------------------ int Find_First_Valid_Char(int start, char *text) { int l = strlen(text); int i; for (i = start; i < l; i++) if (text[i] != 32 && text[i] != '(' && text[i] != 9 && text[i] != ',') { if (text[i] != ')') return i; else return -1; } return -1; } int Find_First_Valid_CharU(int start, WCHAR * text) { int l = wcslen(text); int i; assert(l); for (i = start; i < l; i++) if (text[i] != MAKEWORD(32, 0) && text[i] != MAKEWORD('(', 0) && text[i] != MAKEWORD(9, 0) && text[i] != MAKEWORD(',', 0)) { if (text[i] != MAKEWORD(')', 0)) { if (i > 0) if (text[i - 1] == MAKEWORD('\\', 0)) continue; return i; } else return -1; } return -1; } //------------------------------------------------------------------------------------------------ // najde prvni platny oddelovac //------------------------------------------------------------------------------------------------ int Find_First_Separator(int start, char *text) { int l = strlen(text); int i; for (i = start; i < l; i++) if (text[i] == 32 || text[i] == '(' || text[i] == 9 || text[i] == ')' || text[i] == ',' || text[i] == 10 || text[i] == 13) return i; return -1; } int Find_First_SeparatorU(int start, WCHAR * text) { int l = wcslen(text); int i; for (i = start; i < l; i++) if (text[i] == MAKEWORD(32, 0) || text[i] == MAKEWORD('(', 0) || text[i] == MAKEWORD(9, 0) || text[i] == MAKEWORD(')', 0) || text[i] == MAKEWORD(',', 0) || text[i] == MAKEWORD(10, 0) || text[i] == MAKEWORD(13, 0)) { if (i > 0) if (text[i - 1] == MAKEWORD('\\', 0)) continue; return i; } return -1; } //------------------------------------------------------------------------------------------------ // najde prvni platny vyraz //------------------------------------------------------------------------------------------------ int Find_Next_Expresion(char *p_Command, int start, char *p_Expresion) { int first, last; if (start == -1) return -1; if (p_Command[start] == 10 || p_Command[start] == 13) return -1; first = Find_First_Valid_Char(start, p_Command); if (first == -1) return -1; last = Find_First_Separator(first, p_Command); if (last == -1) return -1; strncpy(p_Expresion, &p_Command[first], last - first); p_Expresion[last - first] = '\0'; return last; } int Find_Next_ExpresionU(WCHAR * p_Command, int start, WCHAR * p_Expresion) { int first, last; if (start == -1) return -1; if (p_Command[start] == 10 || p_Command[start] == 13) return -1; first = Find_First_Valid_CharU(start, p_Command); if (first == -1) return -1; last = Find_First_SeparatorU(first, p_Command); if (last == -1) return -1; wcsncpy(p_Expresion, &p_Command[first], last - first); p_Expresion[last - first] = '\0'; return last; } //------------------------------------------------------------------------------------------------ // prevede string na prikaz //------------------------------------------------------------------------------------------------ int String2Command(char *string) { if (string == NULL) return COM_NOCOMMAND; if (string[0] == '\0') return COM_NOCOMMAND; if (!strcmp(string, "Draw")) return COM_DRAW; if (!strcmp(string, "Flip")) return COM_FLIP; if (!strcmp(string, "OnAbove")) return COM_ONABOVE; if (!strcmp(string, "OnClick")) return COM_ONCLICK; if (!strcmp(string, "RandomAnimation")) return COM_RANDOMANIMATION; if (!strcmp(string, "RunLevel")) return COM_RUNLEVEL; if (!strcmp(string, "Comics")) return COM_COMICS; if (!strcmp(string, "BindSound")) return COM_BINDSOUND; if (!strcmp(string, "LoadTextures")) return COM_LOADTEXTURES; if (!strcmp(string, "InitOpenGL")) return COM_INITOPENGL; if (!strcmp(string, "ReleaseOpenGL")) return COM_RELEASEOPENGL; if (!strcmp(string, "RunAnimation")) return COM_RUNANIMATION; if (!strcmp(string, "BindExitAnimation")) return COM_BINDEXITANIMATION; if (!strcmp(string, "BindAnimation")) return COM_BINDANIMATION; if (!strcmp(string, "CreateButton")) return COM_CREATEBUTTON; if (!strcmp(string, "SetRect")) return COM_SETRECT; return COM_UNKNOWN; } //------------------------------------------------------------------------------------------------ // naparsuje radek //------------------------------------------------------------------------------------------------ void Parse_Line(FILE * file, int *result, int res_size, char *comfile1, char *comfile2) { char text[256], expression[256]; int p = 0, r = 1; int i; if (!fgets(text, 256, file)) { result[0] = COM_NOCOMMAND; return; } for (i = 0; i < res_size; i++) result[i] = -1; strcpy(comfile1, ""); strcpy(comfile2, ""); p = Find_Next_Expresion(text, p, expression); if (p != -1) result[0] = String2Command(expression); else result[0] = COM_NOCOMMAND; if (result[0] == COM_NOCOMMAND || result[0] == COM_UNKNOWN || result[0] == COM_FLIP) { result[0] = -1; return; } while (p != -1) { p = Find_Next_Expresion(text, p, expression); switch (result[0]) { case COM_DRAW: if ((p != -1) && (r < res_size)) result[r] = atoi(expression); break; case COM_SETRECT: case COM_BINDSOUND: case COM_RANDOMANIMATION: case COM_ONABOVE: case COM_ONCLICK: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: if (p != -1) { if (r == 5) strcpy(comfile1, expression); else if (r == 6) strcpy(comfile2, expression); else if (r < res_size) result[r] = atoi(expression); } break; case COM_RUNANIMATION: if (p != -1) { if (r == 1) strcpy(comfile1, expression); else if (r == 2) strcpy(comfile2, expression); } break; case COM_CREATEBUTTON: if (p != -1) { if (r == 1 || r == 2) result[r] = atoi(expression); else if (r == 3) strcpy(comfile1, expression); else if (r == 4) strcpy(comfile2, expression); } break; } r++; } } void Parse_LineT(char *ftext, int *result, int res_size, char *comfile1, char *comfile2) { char text[256], expression[256]; int p = 0, r = 1; //fgets(text, 256, file); strcpy(text, ftext); p = Find_Next_Expresion(text, p, expression); if (p != -1) result[0] = String2Command(expression); else result[0] = COM_NOCOMMAND; if (result[0] == COM_NOCOMMAND || result[0] == COM_UNKNOWN || result[0] == COM_FLIP) return; while (p != -1) { p = Find_Next_Expresion(text, p, expression); switch (result[0]) { case COM_DRAW: if ((p != -1) && (r < res_size)) result[r] = atoi(expression); break; case COM_SETRECT: case COM_BINDSOUND: case COM_RANDOMANIMATION: case COM_ONABOVE: case COM_ONCLICK: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: if (p != -1) { if (r == 5) strcpy(comfile1, expression); else if (r == 6) strcpy(comfile2, expression); else if (r < res_size) result[r] = atoi(expression); } break; case COM_RUNANIMATION: if (p != -1) { if (r == 1) strcpy(comfile1, expression); else if (r == 2) strcpy(comfile2, expression); } break; case COM_CREATEBUTTON: if (p != -1) { if (r == 1 || r == 2) result[r] = atoi(expression); else if (r == 3) strcpy(comfile1, expression); else if (r == 4) strcpy(comfile2, expression); } break; } r++; } } void Parse_RandomLine(char *expression, int *result, int res_size) { char text[32]; int c = 11, i = 0; int done = 0; while (!done) { result[c] = atoi(&expression[i]); i += strlen(itoa(result[c], text, 10)); if (expression[i] != ';' || i >= (int) strlen(expression)) break; i++; c++; if (c >= res_size - 1) break; } c++; for (i = c; c < res_size; c++) result[i] = -1; result[17] = c - 12; } //------------------------------------------------------------------------------------------------ // naparsuje radek animace //------------------------------------------------------------------------------------------------ void Parse_AnimLine(FILE * file, int *result, int res_size) { char text[256], expression[256]; int p = 0, r = 0, i; if (!fgets(text, 256, file)) { result[0] = COM_NOCOMMAND; return; } for (i = 0; i < res_size; i++) result[i] = -1; while ((p != -1) && (r < res_size)) { p = Find_Next_Expresion(text, p, expression); /*if(p != -1) result[r] = atoi(expression); */ if (p == -1) break; if (r < 11) result[r] = atoi(expression); else if (expression[0] == '?') Parse_RandomLine(&expression[1], result, res_size); r++; } } //------------------------------------------------------------------------------------------------ // naparsuje radek skriptu hry //------------------------------------------------------------------------------------------------ void Parse_ScenarioLine(FILE * file, int *result, int res_size, char *comfile1, char *comfile2) { char text[256], expression[256]; int p = 0, r = 1; if (fgets(text, 256, file) == NULL) { result[0] = COM_NOCOMMAND; return; } p = Find_Next_Expresion(text, p, expression); if (p != -1) result[0] = String2Command(expression); else result[0] = COM_NOCOMMAND; while (p != -1) { p = Find_Next_Expresion(text, p, expression); switch (r) { case 1: strcpy(comfile1, expression); break; case 2: strcpy(comfile2, expression); break; } r++; } } void LoadMenuScript(char *p_File_Name, CMD_LINE * res, int *lastcmd) { char filename[MAX_FILENAME]; FILE *file; construct_path(filename, MAX_FILENAME, 2, pDataDir, p_File_Name); file = fopen(filename, "r"); if (file) { while (!feof(file)) { Parse_Line(file, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].uiTimerID = 0; res[*lastcmd].iLastfrm = 1; res[*lastcmd].iCounter = 0; (*lastcmd)++; } fclose(file); } (*lastcmd)--; } void LoadAnimationMenuScript(CMD_LINE * res, int i, int *lastanm) { char filename[MAX_FILENAME]; FILE *file; construct_path(filename, MAX_FILENAME, 2, pDataDir, res[i].cParam[0]); file = fopen(filename, "r"); if (file) { while (!feof(file)) { Parse_AnimLine(file, res[i].iAnim[*lastanm], 18); (*lastanm)++; } fclose(file); } } berusky2-0.12/src/kofola/credits.cpp0000644000175000017500000002670213674766375014365 00000000000000#include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "menu_script.h" #include "2D_graphic.h" //#include "2ddx.h" #include "font.h" #define CREDIT_SURFACES 150 typedef struct { int iSurface; int x; int y; } CREDIT_SURFACE; extern B2_FONT b2_2d_font; extern char pBmpDir[MAX_FILENAME]; extern char cBrutalRestart; extern int CompositDC; extern int FontDC; extern int BackDC; extern int iCompositDC, iFontDC, iBackDC; extern char cFontDir[5][64]; int LoadClock(int *iClock); void DrawClock(int *iClock, int i); int cr_Set_Text_Center(int hdc, char *text, int isection, RECT r) { int xp, yp; int tx, ty; WCHAR wc[256]; int h; h = ddxCreateSurface(1024, 110, ddxFindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn_Draw_MessageA(h, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, wc, isection, &tx, &ty); xp = ftoi(((r.right - r.left) - tx) / 2.0f); yp = 0; ddxTransparentBlt(hdc, r.left + xp, r.top + yp, tx, ty, h, 0, 0, tx, 90, TRANSCOLOR); ddxReleaseBitmap(h); return 1; } int cr_Set_Text_CenterW(int hdc, WCHAR * text, int isection, RECT r) { int xp, yp; int tx, ty; WCHAR wc[128]; int h; h = ddxCreateSurface(1024, 110, ddxFindFreeSurface()); MultiByteToWideChar(CP_ACP, 0, (char *) text, strlen((char *) text) + 1, wc, sizeof(wc) / sizeof(wc[0])); fn_Draw_MessageA(h, 0, 0, &b2_2d_font.gt, &b2_2d_font.ts, text, isection, &tx, &ty); xp = ftoi(((r.right - r.left) - tx) / 2.0f); yp = 0; ddxTransparentBlt(hdc, r.left + xp, r.top + yp, tx, ty, h, 0, 0, tx, 90, TRANSCOLOR); ddxReleaseBitmap(h); return 1; } void cr_DrawSurface(int iDest, int iSour, int *y) { int xp = ftoi((1024 - ddxGetWidth(iSour)) / 2.0f); ddxBitBlt(iDest, xp, *y, ddxGetWidth(iSour), ddxGetHight(iSour), iSour, 0, 0); (*y) += ddxGetHight(iSour); } void cr_Cleare(int iSurface) { int idx = ddxCreateSurface(1024, 100, ddxFindFreeSurface()); int i; if (idx == -1) { ddxCleareSurfaceColor(iSurface, 0); kprintf(1, "cr_Cleare probehl neuspesne!!!"); return; } ddxCleareSurfaceColor(idx, 0); for (i = 0; i < ddxGetHight(iSurface); i += 100) { ddxBitBlt(iSurface, 0, i, 1024, 100, idx, 0, 0); } ddxBitBlt(iSurface, 0, ddxGetHight(iSurface) - 100, 1024, 100, idx, 0, 0); ddxReleaseBitmap(idx); } void cr_Release_Bitmaps(CREDIT_SURFACE * p_cs, int *iClock) { int i; for (i = 0; i < CREDIT_SURFACES; i++) if (p_cs->iSurface != -1) ddxReleaseBitmap(p_cs->iSurface); ddxResizeCursorBack(0); ddxSetCursorSurface(0); for (i = 0; i < 12; i++) if (iClock[i] != -1) { ddxReleaseBitmap(iClock[i]); iClock[i] = -1; } } void cr_Set_Surface(CREDIT_SURFACE * p_cs, int y) { if (p_cs->iSurface == -1) return; p_cs->y = y; p_cs->x = ftoi((1024 - ddxGetWidth(p_cs->iSurface)) / 2.0f); } void cr_Draw_Creadits(CREDIT_SURFACE * cs, int y) { int dy; int i; ddxCleareSurfaceColorDisplay(0); for (i = 0; i < CREDIT_SURFACES; i++) if (cs[i].iSurface != -1) if ((cs[i].y + ddxGetHight(cs[i].iSurface)) > y && (cs[i].y < y + 768)) { dy = cs[i].y - y; if (dy < 0) //obrazek vyjizdi nahore ven ddxBitBltDisplay(cs[i].x, 0, ddxGetWidth(cs[i].iSurface), ddxGetHight(cs[i].iSurface) + dy, cs[i].iSurface, 0, dy * -1); else if (cs[i].y + ddxGetHight(cs[i].iSurface) > y + 768) //obrazek vjizni zespodu { int dm = (cs[i].y + ddxGetHight(cs[i].iSurface)) - (y + 768); ddxBitBltDisplay(cs[i].x, dy, ddxGetWidth(cs[i].iSurface), ddxGetHight(cs[i].iSurface) - dm, cs[i].iSurface, 0, 0); } else ddxBitBltDisplay(cs[i].x, dy, ddxGetWidth(cs[i].iSurface), ddxGetHight(cs[i].iSurface), cs[i].iSurface, 0, 0); } DisplayFrame(); spracuj_spravy(0); } int cr_Credits(HWND hWnd, AUDIO_DATA * p_ad) { DWORD dwStart, dwStop, dwEplased = 0; int y = 868; int dy = 868*2 + 2000; char text[MAX_FILENAME]; char cbmp[MAX_FILENAME]; FILE *file; int c = 0; int bmp = 0; RECT r; float f = p_ad->Music_Gain; int i; CREDIT_SURFACE cs[CREDIT_SURFACES]; int iActual = 0; int iClock[12]; for(i=0;i<12;i++) iClock[i] = -1; LoadClock(iClock); if(iClock[0] != -1) { ddxResizeCursorBack(iClock[0]); DrawClock(iClock, 0); } if(ogg_playing()) { while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); DrawClock(iClock, 0); } ap_Stop_Song(p_ad); } for(i=0;i CREDIT_SURFACES-1) { kprintf(1, "Kredity: radku je vic jak surfacu!"); fclose(file); return 0; } ddxSetFlip(0); fn_Set_Font(cFontDir[0]); DrawClock(iClock, 2); fn_Load_Bitmaps(); DrawClock(iClock, 3); cs[iActual].iSurface = ddxLoadBitmap("anakreon_small.png", pBmpDir); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else cr_Set_Surface(&cs[iActual], y); DrawClock(iClock, 4); y+= 250; iActual++; cs[iActual].iSurface = ddxLoadBitmap("cinemax_small.png", pBmpDir); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else cr_Set_Surface(&cs[iActual], y); iActual++; y+= 768; DrawClock(iClock, 5); r.left = 0; r.right = 1024; r.top = 0; r.bottom = 90; while(fgets(text, 256, file)) { if(text[0] == '$') { if(bmp < 5) { if(bmp) { sprintf(cbmp, "brouk%d.png", bmp); cs[iActual].iSurface = ddxLoadBitmap(cbmp, pBmpDir); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else { cr_Set_Surface(&cs[iActual], y); y += ddxGetHight(cs[iActual].iSurface); iActual++; } } bmp++; } cs[iActual].iSurface = ddxCreateSurface(1024, 90, ddxFindFreeSurface()); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else { ddxCleareSurfaceColor(cs[iActual].iSurface, 0); cr_Set_Text_Center(cs[iActual].iSurface, text, 1, r); cs[iActual].y = y; iActual++; } } else if(strcmp(text,"\n") && strlen(text)) { cs[iActual].iSurface = ddxCreateSurface(1024, 90, ddxFindFreeSurface()); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else { ddxCleareSurfaceColor(cs[iActual].iSurface, 0); cr_Set_Text_Center(cs[iActual].iSurface, text, 0, r); cs[iActual].y = y; iActual++; } } y += 80; if(iActual >= CREDIT_SURFACES) { kprintf(1, "iActual >= CREDIT_SURFACES !!!!!!!!!!!"); break; } DrawClock(iClock, 6); } fclose(file); y = 0; ap_Play_Song(11,0, p_ad); ddxResizeCursorBack(0); ddxSetCursorSurface(0); for(i=0;i<12;i++) if(iClock[i] != -1) { ddxReleaseBitmap(iClock[i]); iClock[i] = -1; } ddxSetCursor(0); dwStart = timeGetTime(); while(!key[K_ESC]) { y = (int)ftoi((dwEplased * dy) / (float) 195000); if(y >= dy) key[K_ESC] = 1; cr_Draw_Creadits(cs, y); dwStop = timeGetTime(); dwEplased = dwStop - dwStart; ddxRestore(p_ad); } cr_Release_Bitmaps(cs, iClock); fn_Release_Font(1); if(ogg_playing()) ap_Stop_Song(p_ad); ap_Play_Song(0, 0, p_ad); ddxSetCursor(1); ddxSetFlip(1); key[K_ESC] = 0; return 0; } int cr_CreditsUNI(HWND hWnd, AUDIO_DATA * p_ad) { DWORD dwStart, dwStop, dwEplased = 0; int y = 868; int dy = 868*2 + 2000; char text[MAX_FILENAME]; char cbmp[256]; FILE *file; int c = 0; int bmp = 0; RECT r; float f = p_ad->Music_Gain; int i; CREDIT_SURFACE cs[CREDIT_SURFACES]; int iActual = 0; int iClock[12]; for(i=0;i<12;i++) iClock[i] = -1; LoadClock(iClock); if(iClock[0] != -1) { ddxResizeCursorBack(iClock[0]); DrawClock(iClock, 0); } if(ogg_playing()) { while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); DrawClock(iClock, 0); } ap_Stop_Song(p_ad); } for(i=0;i CREDIT_SURFACES-1) { kprintf(1, "Kredity: radku je vic jak surfacu!"); fclose(file); return 0; } ddxSetFlip(0); fn_Set_Font(cFontDir[0]); DrawClock(iClock, 2); fn_Load_Bitmaps(); DrawClock(iClock, 3); cs[iActual].iSurface = ddxLoadBitmap("anakreon_small.png", pBmpDir); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else cr_Set_Surface(&cs[iActual], y); DrawClock(iClock, 4); y+= 250; iActual++; cs[iActual].iSurface = ddxLoadBitmap("cinemax_small.png", pBmpDir); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else cr_Set_Surface(&cs[iActual], y); iActual++; y+= 768; DrawClock(iClock, 5); r.left = 0; r.right = 1024; r.top = 0; r.bottom = 90; while(fgets(text, 256, file)) { if(text[0] == '$') { if(bmp < 5) { if(bmp) { sprintf(cbmp, "brouk%d.png", bmp); cs[iActual].iSurface = ddxLoadBitmap(cbmp, pBmpDir); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else { cr_Set_Surface(&cs[iActual], y); y += ddxGetHight(cs[iActual].iSurface); iActual++; } } bmp++; } cs[iActual].iSurface = ddxCreateSurface(1024, 90, ddxFindFreeSurface()); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else { ddxCleareSurfaceColor(cs[iActual].iSurface, 0); cr_Set_Text_CenterW(cs[iActual].iSurface, (WCHAR *)text, 1, r); cs[iActual].y = y; iActual++; } } else if(strcmp(text,"\n") && strlen(text)) { cs[iActual].iSurface = ddxCreateSurface(1024, 90, ddxFindFreeSurface()); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); fclose(file); return 0; } else { ddxCleareSurfaceColor(cs[iActual].iSurface, 0); cr_Set_Text_CenterW(cs[iActual].iSurface, (WCHAR *)text, 0, r); cs[iActual].y = y; iActual++; } } y += 80; if(iActual >= CREDIT_SURFACES) { kprintf(1, "iActual >= CREDIT_SURFACES !!!!!!!!!!!"); break; } DrawClock(iClock, 6); } fclose(file); y = 0; ap_Play_Song(11,0, p_ad); ddxResizeCursorBack(0); ddxSetCursorSurface(0); for(i=0;i<12;i++) if(iClock[i] != -1) { ddxReleaseBitmap(iClock[i]); iClock[i] = -1; } ddxSetCursor(0); dwStart = timeGetTime(); while(!key[K_ESC]) { y = (int)ftoi((dwEplased * dy) / (float) 195000); if(y >= dy) key[K_ESC] = 1; cr_Draw_Creadits(cs, y); dwStop = timeGetTime(); dwEplased = dwStop - dwStart; ddxRestore(p_ad); } cr_Release_Bitmaps(cs, iClock); fn_Release_Font(1); if(ogg_playing()) ap_Stop_Song(p_ad); //Sleep(1000); ap_Play_Song(0, 0, p_ad); ddxSetCursor(1); ddxSetFlip(1); key[K_ESC] = 0; return 0; } berusky2-0.12/src/kofola/Bind.h0000644000175000017500000000201413674426075013225 00000000000000#ifndef __BIND_ #define __BIND_ typedef struct { int move_forward; int turn_back; int turn_left; int turn_right; int next_beatle; int inventory; int inventory_select; int inventory_left; int inventory_right; int inventory_cancel; int camera_move_left; int camera_move_right; int camera_move_forward; int camera_move_back; int camera_zoom_in; int camera_zoom_out; int camera_turn_left; int camera_turn_right; int camera_turn_up; int camera_turn_down; int camera_fast_turn_left; int camera_fast_turn_right; int camera_center; int menu; int item_lock; int blow_detonation_pack; int beatle1; int beatle2; int beatle3; int beatle4; int beatle5; int beatle6; int item1; int item2; int item3; int item4; int next_song; int disable_inventory; int disable_top_ledge; int screenshot; int visibility; int hint; int camera_rotation; int camera_move; int restart; int highlight; int pause; } CONTROL_KEYS; void Bind_Keys(CONTROL_KEYS * p_keys); #endif berusky2-0.12/src/kofola/3D_graphic.cpp0000644000175000017500000002701613674766375014672 00000000000000//------------------------------------------------------------------------------------------------ // version 0.0.1 //------------------------------------------------------------------------------------------------ #include #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky_universal.h" #include "3D_graphic.h" #include "font.h" _3D_DATA _3dd; _3D_CURSOR _3dCur; extern char p3DMDir[MAX_FILENAME]; extern EDIT_TEXT sIndikace[3]; extern char cFontDir[5][64]; extern HINT_TEXTURE pMessageTexture[8]; //------------------------------------------------------------------------------------------------ // init 3d //------------------------------------------------------------------------------------------------ int _3d_Init(void) { int i; _3dd.count = 200; _3dd.last = 0; _3dd.p_texture = (EDIT_TEXT *) mmalloc((_3dd.count) * sizeof(EDIT_TEXT)); _3dd.p_sysramtexture = (_3D_TEXTURE *) mmalloc((_3dd.count) * sizeof(_3D_TEXTURE)); for (i = 0; i < _3dd.count; i++) { strcpy(_3dd.p_texture[i].jmeno, "\0"); _3dd.p_texture[i].load = 0; _3dd.p_texture[i].p_bmp = NULL; _3dd.p_texture[i].text = 0; _3dd.p_sysramtexture[i].bSLoaded = 0; _3dd.p_sysramtexture[i].bVLoaded = 0; } _3dd.bMenuVRAMLoad = GetPrivateProfileInt("game", "menu_vram_load", 1, ini_file); strcpy(_3dd.bm_dir, BITMAP_DIR); return 1; } //------------------------------------------------------------------------------------------------ // release 3d //------------------------------------------------------------------------------------------------ void _3d_Release(void) { int i; kprintf(1, "Kofola: - Release Textur..."); for (i = 0; i < _3dd.count; i++) if (_3dd.p_texture[i].load) { if (_3dd.p_sysramtexture[i].bVLoaded) { txt_zrus_texturu(&_3dd.p_texture[i]); _3dd.p_sysramtexture[i].bVLoaded = 1; } if (_3dd.p_sysramtexture[i].bSLoaded) { if (_3dd.p_texture[i].p_bmp) txt_zrus_texturu_ram(&_3dd.p_texture[i]); _3dd.p_sysramtexture[i].bSLoaded = 0; } } free((void *) _3dd.p_texture); free((void *) _3dd.p_sysramtexture); _3dd.last = 0; _3dd.count = 0; } //------------------------------------------------------------------------------------------------ // release texture //------------------------------------------------------------------------------------------------ void _3d_Release_Texture(int Index) { if (_3dd.p_sysramtexture[Index].bVLoaded) { txt_zrus_texturu(&_3dd.p_texture[Index]); _3dd.p_sysramtexture[Index].bVLoaded = 0; } if (_3dd.p_sysramtexture[Index].bSLoaded) { txt_zrus_texturu_ram(&_3dd.p_texture[Index]); _3dd.p_sysramtexture[Index].bSLoaded = 0; } strcpy(_3dd.p_texture[Index].jmeno, "\0"); _3dd.p_texture[Index].load = 0; _3dd.p_texture[Index].p_bmp = NULL; _3dd.p_texture[Index].text = 0; } //------------------------------------------------------------------------------------------------ // load texture //------------------------------------------------------------------------------------------------ int _3d_Load_Texture(char *p_File_Name, int Index, char bVideoRAM, char bSeek) { if (_3dd.p_texture[Index].load) return 0; _3dd.p_texture[Index].flag = 0; if (bVideoRAM) { txt_nahraj_texturu_z_func(p3DMDir, p_File_Name, &_3dd.p_texture[Index], 0, bVideoRAM, NULL, bmp_nahraj); } else { txt_nahraj_texturu_z_func(p3DMDir, p_File_Name, &_3dd.p_texture[Index], 1, bVideoRAM, &_3dd.p_sysramtexture[Index].konf, bmp_nahraj); } if (!_3dd.p_texture[Index].load) { kprintf(1, "Can't load %s", p_File_Name); _3dd.p_sysramtexture[Index].bVLoaded = 0; _3dd.p_sysramtexture[Index].bSLoaded = 0; return 0; } else { if (bVideoRAM) { _3dd.p_sysramtexture[Index].bVLoaded = 1; _3dd.p_sysramtexture[Index].bSLoaded = 0; } else { _3dd.p_sysramtexture[Index].bVLoaded = 0; _3dd.p_sysramtexture[Index].bSLoaded = 1; } return 1; } } void _3d_Get_Cursor_Name(char *cName) { FILE *file; char filename[MAX_FILENAME], text[32]; GetPrivateProfileString("game", "cursor", "cursor", filename, 32, ini_file); strcpy(cName, filename); strcat(cName, ".png"); strcat(filename, ".inf"); file = fopen(filename, "r"); if (!file) { kprintf(1, "Soubor %s, nebyl nalezen!", filename); return; } if (fgets(text, 32, file) == NULL) { kprintf(1, "Cannot read from %s!", filename); return; } _3dCur.idx = atoi(text); if (fgets(text, 32, file) == NULL) { kprintf(1, "Cannot read from %s!", filename); return; } _3dCur.idy = atoi(text); if (fgets(text, 32, file) == NULL) { kprintf(1, "Cannot read from %s!", filename); return; } _3dCur.iaddx = atoi(text); if (fgets(text, 32, file) == NULL) { kprintf(1, "Cannot read from %s!", filename); return; } _3dCur.iaddy = atoi(text); fclose(file); } //------------------------------------------------------------------------------------------------ // load list of textures //------------------------------------------------------------------------------------------------ int _3d_Load_List(char *p_File_Name) { char text[MAX_FILENAME]; FILE *file = 0; int c = 0; construct_path(text, MAX_FILENAME, 2, p3DMDir, p_File_Name); file = fopen(text, "rb"); if (!file) { kprintf(1, "%s: %s", text, strerror(errno)); return 0; } if (chdir((_3dd.bm_dir))) { kprintf(1, "Cannot change directory to %s", _3dd.bm_dir); return 0; } kprintf(1, "Kofola: - Load textur pro herni menu"); txt_trida(TEXT_MENU); kom_set_default_text_config(0, 0, 1, 0, 0, 1); while (!feof(file)) { if (fgets(text, MAX_FILENAME, file) && !feof(file)) { newline_cut(text); if (!c) _3d_Get_Cursor_Name(text); if (c < 107 || c > 132) { _3d_Load_Texture(text, c, TRUE, !c); } else { _3d_Load_Texture(text, c, _3dd.bMenuVRAMLoad, 0); } c++; } } fclose(file); _3dd.last = c; kom_ret_default_text_config(); return 1; } void _3d_Load_From_Sys_To_Video(int iStart) { int i; if (_3dd.bMenuVRAMLoad) return; for (i = iStart; i < 133; i++) if (_3dd.p_texture[i].load && !_3dd.p_sysramtexture[i].bVLoaded) { txt_nahraj_texturu_do_vram(&_3dd.p_texture[i], &_3dd.p_sysramtexture[i].konf); _3dd.p_sysramtexture[i].bVLoaded = 1; } } void _3d_Release_From_Video(int iStart) { int i; if (_3dd.bMenuVRAMLoad) return; for (i = iStart; i < 133; i++) if (_3dd.p_sysramtexture[i].bVLoaded && _3dd.p_texture[i].load) { txt_zrus_texturu_z_vram(&_3dd.p_texture[i]); _3dd.p_sysramtexture[i].bVLoaded = 0; } } void _3d_Set_Mask(void) { /*glDisable(GL_BLEND); glAlphaFunc(GL_EQUAL,1.0f); */ } void _3d_Set_Smooth(void) { /*glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glAlphaFunc(GL_GREATER,0.0f); */ } void _3d_Begin_Draw(void) { set_matrix_2d(SCREEN_XRES, SCREEN_YRES); glColor4f(1, 1, 1, 1); glDisable(GL_DEPTH_TEST); glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glAlphaFunc(GL_GREATER, 0.0f); } void _3d_End_Draw(void) { glDisable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.5f); glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); ret_matrix_2d(); } //------------------------------------------------------------------------------------------------ // Draws box in 3d device // int i, float {left, top, right, bottom} //------------------------------------------------------------------------------------------------ void _3d_Draw_Box(int i, float *vfPoint) { glBindTexture(GL_TEXTURE_2D, _3dd.p_texture[i].text); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0, 1); glVertex2d(vfPoint[0], vfPoint[1]); glTexCoord2d(0, 0); glVertex2d(vfPoint[0], vfPoint[3]); glTexCoord2d(1, 1); glVertex2d(vfPoint[2], vfPoint[1]); glTexCoord2d(1, 0); glVertex2d(vfPoint[2], vfPoint[3]); glEnd(); } void _3d_Put_Texture_In_VRAM(int *text, int x, int y, char *data) { glGenTextures(1, (GLuint *) text); glBindTexture(GL_TEXTURE_2D, *text); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } void _3d_Load_Hint(HINT_TEXTURE * bTexture, char *cHint, int i, int iSection) { fn_Get_Font_Texture(iSection, cHint); _3d_Put_Texture_In_VRAM((int *) &bTexture[i].text.text, _3dd.p_sysramtexture[_3dd.last - 1].x, _3dd.p_sysramtexture[_3dd.last - 1].y, _3dd.p_sysramtexture[_3dd.last - 1].data); bTexture[i].tx = _3dd.p_sysramtexture[_3dd.last - 1].tx; bTexture[i].ty = _3dd.p_sysramtexture[_3dd.last - 1].ty; bTexture[i].x = _3dd.p_sysramtexture[_3dd.last - 1].x; bTexture[i].y = _3dd.p_sysramtexture[_3dd.last - 1].y; free((void *) _3dd.p_sysramtexture[_3dd.last - 1].data); memset(&_3dd.p_texture[_3dd.last - 1], 0, sizeof(EDIT_TEXT)); memset(&_3dd.p_sysramtexture[_3dd.last - 1], 0, sizeof(_3D_TEXTURE)); _3dd.last--; } void _3d_Load_Indikace(void) { ZeroMemory(sIndikace, 3 * sizeof(EDIT_TEXT)); txt_trida(TEXT_MENU); kom_set_default_text_config(0, 0, 1, 0, 0, 1); txt_nahraj_texturu_z_func(p3DMDir, "camera1.png", &sIndikace[0], 0, 1, NULL, bmp_nahraj); txt_nahraj_texturu_z_func(p3DMDir, "vitamin1.png", &sIndikace[1], 0, 1, NULL, bmp_nahraj); txt_nahraj_texturu_z_func(p3DMDir, "lock1.png", &sIndikace[2], 0, 1, NULL, bmp_nahraj); kom_ret_default_text_config(); } void _3d_Gen_Hints(HINT_TEXTURE * bTexture, int tsize) { char text[MAX_FILENAME]; int i; ZeroMemory(bTexture, sizeof(EDIT_TEXT) * tsize); if (!fn_Set_Font(cFontDir[4])) { kprintf(1, "Unable to set font!"); return; } if (!fn_Load_Bitmaps()) { kprintf(1, "Unable to load font bitmaps"); return; } kom_set_default_text_config(0, 0, 1, 0, 0, 1); txt_nahraj_texturu_z_func(p3DMDir, "hint_frame.png", &bTexture[0].text, 0, 1, NULL, bmp_nahraj); kom_ret_default_text_config(); for (i = 1; i < 26; i++) { sprintf(text, "##hint_%d", i); _3d_Load_Hint(bTexture, text, i, 0); kprintf(1, "Load Hint: %s", text); } sprintf(text, "##message_yes"); _3d_Load_Hint(pMessageTexture, text, 0, 0); _3d_Load_Hint(pMessageTexture, text, 1, 1); kprintf(1, "Load Message: %s", text); sprintf(text, "##message_no"); _3d_Load_Hint(pMessageTexture, text, 2, 0); _3d_Load_Hint(pMessageTexture, text, 3, 1); kprintf(1, "Load Message: %s", text); sprintf(text, "##message_restart"); _3d_Load_Hint(pMessageTexture, text, 4, 0); kprintf(1, "Load Message: %s", text); sprintf(text, "##message_save"); _3d_Load_Hint(pMessageTexture, text, 5, 0); kprintf(1, "Load Message: %s", text); sprintf(text, "##message_mainmenu"); _3d_Load_Hint(pMessageTexture, text, 6, 0); kprintf(1, "Load Message: %s", text); sprintf(text, "##message_demo"); _3d_Load_Hint(pMessageTexture, text, 7, 0); kprintf(1, "Load Message: %s", text); fn_Release_Font(1); } void _3d_Release_Hints(HINT_TEXTURE * bTexture, int tsize) { int i; for (i = 1; i < tsize; i++) txt_zrus_texturu(&bTexture[i].text); for (i = 0; i < 3; i++) txt_zrus_texturu(&sIndikace[i]); for (i = 0; i < 8; i++) txt_zrus_texturu(&pMessageTexture[i].text); } berusky2-0.12/src/kofola/Menu2.cpp0000644000175000017500000034162013674766375013715 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #include "Berusky3d_kofola2d.h" #include "game_logic.h" #include "menu_script.h" #include "Command.h" #include "3D_graphic.h" #include "Menu.h" #include "Menu2.h" #include "Comics.h" #include "credits.h" #include "font3d.h" #include "controls3d.h" #include "menu_def.h" #include "Setup.h" #include "profiles.h" #include "Object.h" #include "animationk.h" #include "Demo.h" #include "load_level.h" #include "ambient_sounds.h" #include "Tools.h" #define RES_NUM 60 #define HDC2DD -1 extern SETUP setup; extern _3D_CURSOR _3dCur; extern char pBmpDir[MAX_FILENAME]; extern PLAYER_PROFILE pPlayerProfile; extern char p3DMDir[MAX_FILENAME]; extern int iActualLevel; extern int iActualScene; extern B2_FONT b2_3d_font; extern char cFontDir[5][64]; extern AUDIO_DATA ad; typedef struct { CMD_LINE *cmd; int iWave; char bStop; } ANIMATION; extern HW_KONFIG hwconf; static ANIMATION anm[32]; static DWORD timercnt = 0; static DWORD dwLTime; static int CompositDC; static int FontDC; static int BackDC; static int iCompositDC; static int iFontDC; //static int iBackDC; static char bBackDC = 0; static DeviceHandle iLoadScreenDevice = 0; static int iLoadScreenBitmap = K_CHYBA; static RECT iLoadScreenRect = { 0, 0, 1024, 768 }; RECT_LINE rline; //extern int gi_EnumDisplaySettings(DEVMODE *pdevmode); int check_Save_Owner(char *cDir, WCHAR * wFileName); int LoadHelp(char *c_file); CMD_LINE *GetCMD2(CMD_LINE * cmp, CMD_LINE * pres) { int i; for (i = 0; i < RES_NUM; i++) if (!strcmp(cmp->cParam[1], pres[i].cParam[0])) return &pres[i]; return NULL; } //------------------------------------------------------------------------------------------------ // zastavi vsechny animace //------------------------------------------------------------------------------------------------ void StopAll2(void) { int i; for (i = 0; i < 32; i++) if (anm[i].cmd) anm[i].bStop = 1; } //------------------------------------------------------------------------------------------------ // zastavi animaci //------------------------------------------------------------------------------------------------ void Stop2(CMD_LINE * cmd) { int i; for (i = 0; i < 32; i++) if (cmd == anm[i].cmd) { if (cmd->bEndActivate[0] && cmd->pCmdLine) cmd->pCmdLine[(int)cmd->bEndActivate[0]].bActive = 1; if (cmd->bEndActivate[1] && cmd->pCmdLine) cmd->pCmdLine[(int)cmd->bEndActivate[1]].bActive = 1; cmd->bActive = 0; anm[i].bStop = 1; return; } } int NextStep2(CMD_LINE * cmd) { if ((rand() % 100) < 60) return cmd->iAnim[cmd->iLastfrm][6]; else return cmd->iAnim[cmd->iLastfrm][6 + rand() % (cmd->iAnim[cmd->iLastfrm][12])]; } void DrawFrame2(CMD_LINE * cmd) { if (!cmd->iLayer) { if (cmd->iAnim[cmd->iLastfrm][6] >= 0) { RECT r; ddx2BitBlt(CompositDC, cmd->iAnim[cmd->iLastfrm][2] + cmd->iAnim[cmd->iLastfrm][6], cmd->iAnim[cmd->iLastfrm][3] + cmd->iAnim[cmd->iLastfrm][7], cmd->iAnim[cmd->iLastfrm][8], cmd->iAnim[cmd->iLastfrm][9], cmd->iAnim[cmd->iLastfrm][1], cmd->iAnim[cmd->iLastfrm][6], cmd->iAnim[cmd->iLastfrm][7]); r.left = cmd->iAnim[cmd->iLastfrm][2] + cmd->iAnim[cmd->iLastfrm][6]; r.top = cmd->iAnim[cmd->iLastfrm][3] + cmd->iAnim[cmd->iLastfrm][7]; r.right = cmd->iAnim[cmd->iLastfrm][8]; r.bottom = cmd->iAnim[cmd->iLastfrm][9]; ddx2AddRectItem(&rline, r, 1); } else ddx2DrawSurface(CompositDC, cmd->iAnim[cmd->iLastfrm], 1); } else ddx2DrawSurface(FontDC, cmd->iAnim[cmd->iLastfrm], 3); } //------------------------------------------------------------------------------------------------ // provede animaci //------------------------------------------------------------------------------------------------ void Animation2(CMD_LINE * cmd, int time) { ANIMATION_DRAW: while (time > 0) { if (cmd->iAnim[cmd->iLastfrm][5] == -1) { Stop2(cmd); break; } time -= cmd->iAnim[cmd->iLastfrm][4]; if (time > (cmd->iAnim[cmd->iAnim[cmd->iLastfrm][5]][4] / 2.0f)) { /* if(cmd->iAnim[cmd->iLastfrm][6] >= 0) cmd->iAnim[cmd->iLastfrm][5] = NextStep(cmd);*/ if (cmd->iAnim[cmd->iLastfrm][10] > 0) DrawFrame2(cmd); cmd->iLastfrm = cmd->iAnim[cmd->iLastfrm][5]; } } //---------------------------------------------------------------------- DrawFrame2(cmd); if (!cmd->iAnim[cmd->iLastfrm][4]) { /* if(cmd->iAnim[cmd->iLastfrm][6] >= 0) cmd->iAnim[cmd->iLastfrm][5] = NextStep(cmd);*/ cmd->iLastfrm = cmd->iAnim[cmd->iLastfrm][5]; goto ANIMATION_DRAW; } if (cmd->iAnim[cmd->iLastfrm][5] == -1) { Stop2(cmd); return; } /* if(cmd->iAnim[cmd->iLastfrm][6] >= 0) cmd->iAnim[cmd->iLastfrm][5] = NextStep(cmd);*/ cmd->iLastfrm = cmd->iAnim[cmd->iLastfrm][5]; } int RectCross2(RECT_LINE * p_rl, int idx) { int c = 0; int i; RECT *dr = &p_rl->rect[idx].rect; for (i = 0; i < rline.rlast; i++) if (i != idx) if (co2_Rect_Hit(p_rl->rect[i].rect, dr->left, dr->top) || co2_Rect_Hit(p_rl->rect[i].rect, dr->right, dr->top) || co2_Rect_Hit(p_rl->rect[i].rect, dr->left, dr->bottom) || co2_Rect_Hit(p_rl->rect[i].rect, dr->right, dr->bottom)) c++; return 0; } //------------------------------------------------------------------------------------------------ // provede animace //------------------------------------------------------------------------------------------------ void AnimationEvent2(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { DRAW_RECT *dr; int i; char bAnim = 0; DWORD e; //priprava //BitBltU(CompositDC,0,0,1024,768,NULL,0,0,WHITENESS); e = abs((int)(dwLTime - dwTime)); for (i = 0; i < 32; i++) if (anm[i].cmd) { if (anm[i].bStop) { anm[i].cmd->iLastfrm = 1; anm[i].cmd->iCounter = 0; if(anm[i].iWave != -1) adas_Release_Source(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, anm[i].iWave); anm[i].iWave = -1; anm[i].cmd = NULL; } else { anm[i].cmd->iCounter += e; if (anm[i].cmd->iCounter >= anm[i].cmd->iAnim[anm[i].cmd->iLastfrm][4]) { Animation2(anm[i].cmd, anm[i].cmd->iCounter); anm[i].cmd->iCounter = 0; bAnim = 1; } } } //prenos kreslenych dat; if (bAnim) { if (bBackDC) { for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddx2TransparentBlt(BackDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, FontDC, dr->rect.left, dr->rect.top, TRANSCOLOR); } for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddx2TransparentBlt(CompositDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, BackDC, dr->rect.left, dr->rect.top, TRANSCOLOR); } } else for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; ddx2TransparentBlt(CompositDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, FontDC, dr->rect.left, dr->rect.top, TRANSCOLOR); } for (i = 0; i < rline.rlast; i++) { dr = &rline.rect[i]; // ddx2UpdateMouse(); //if(dr->iLayer >= 1 || RectCross(&rline, i)) ddx2TransparentBltDisplay(dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, CompositDC, dr->rect.left, dr->rect.top, dr->rect.right, dr->rect.bottom, TRANSCOLOR); } } dwLTime = dwTime; timercnt += e; //_2d_Clear_RectLine(&rline); } void InitRandomJumps2(CMD_LINE * cmd) { int i; for (i = 0; i < 200; i++) if (cmd->iAnim[i][6] >= 0) cmd->iAnim[i][5] = cmd->iAnim[i][6 + rand() % (cmd->iAnim[i][12])]; } int FindAnimation2(CMD_LINE * cmd) { int i; for (i = 0; i < 32; i++) if (anm[i].cmd == cmd) return 1; return 0; } //------------------------------------------------------------------------------------------------ // prida animaci //------------------------------------------------------------------------------------------------ int AddAnimation2(CMD_LINE * cmd, AUDIO_DATA * p_ad, char bOnlyOnes) { int i, r; float pos[3] = { 0.0f, 0.0f, 1.0f }; for (i = 0; i < 32; i++) if (!anm[i].cmd) { if (bOnlyOnes && FindAnimation2(cmd)) return -1; // InitRandomJumps(cmd); anm[i].cmd = cmd; anm[i].bStop = 0; anm[i].iWave = -1; Animation2(anm[i].cmd, 0); if (cmd->iParam[0] == COM_RANDOMANIMATION) { r = rand() % 3; if (cmd->iParam[r + 2] < 0) { if (cmd->iParam[2] >= 0) { adas_Get_Listener_Position(pos); ap_Play_Sound(0,1,0,pos,cmd->iParam[2], NULL, &ad); } } else { adas_Get_Listener_Position(pos); ap_Play_Sound(0,1,0,pos,cmd->iParam[r+2], NULL, &ad); } } return i; } else if (!strcmp(cmd->cParam[1], anm[i].cmd->cParam[0]) && !anm[i].bStop) return -1; return -1; } int ChooseBidedExitAnimation2(CMD_LINE * cmd, int Index, AUDIO_DATA * p_ad) { int id[32]; int i, c = 0; for (i = Index; i < 32; i++) if (cmd[i].iParam[0] == COM_BINDEXITANIMATION) { id[c] = i; c++; if (c > 31) break; } else if (cmd[i].iParam[0] != COM_BINDANIMATION) break; if (c) return id[rand() % c]; else return -1; } int ChooseBidedAnimation2(CMD_LINE * cmd, int Index, AUDIO_DATA * p_ad) { int id[32]; int i, c = 0; for (i = Index; i < 32; i++) if (cmd[i].iParam[0] == COM_BINDANIMATION) { id[c] = i; c++; if (c > 31) break; } else if (cmd[i].iParam[0] != COM_BINDEXITANIMATION) break; if (c) return id[rand() % c]; else return -1; } void FreeAnimations2(CMD_LINE * cmd, int csize) { int i, j; for (i = 0; i < csize; i++) for (j = 0; j < 32; j++) if (anm[j].cmd) if (anm[j].cmd == &cmd[i]) { anm[j].cmd->iLastfrm = 1; anm[j].cmd->iCounter = 0; anm[j].iWave = -1; anm[j].cmd = NULL; } } //------------------------------------------------------------------------------------------------ // prida animaci //------------------------------------------------------------------------------------------------ void CheckAnimation2(CMD_LINE * cmd, AUDIO_DATA * p_ad) { int i; // float pos[3] = { 0.0f, 0.0f, 1.0f }; for (i = 0; i < 32; i++) if (anm[i].cmd) if (!strcmp(cmd->cParam[1], anm[i].cmd->cParam[0])) { Stop2(anm[i].cmd); if (!cmd->iLayer) { //menucommand_Draw(_2dd.hDC, anm[i].cmd->iAnim[0] , 0); ddx2DrawDisplay(anm[i].cmd->iAnim[0], 0); } else { //menucommand_DrawT(_2dd.hDC, anm[i].cmd->iAnim[0]); ddx2DrawDisplayColorKey(anm[i].cmd->iAnim[0], 0, TRANSCOLOR); //menucommand_Draw(FontDC, anm[i].cmd->iAnim[0], 3); ddx2DrawSurface(FontDC, anm[i].cmd->iAnim[0], 3); } return; } } //------------------------------------------------------------------------------------------------ // spusti nahodny zvuk podle zadani //------------------------------------------------------------------------------------------------ int mPlaySound2(CMD_LINE * cmd, AUDIO_DATA * p_ad, int type) { float pos[3] = { 0.0f, 0.0f, 1.0f }; int r = rand() % 4, ret = 0; if (cmd->iParam[r + 1] < 0) { if (cmd->iParam[1] >= 0) { adas_Get_Listener_Position(pos); ret = ap_Play_Sound(type,1,0,pos,cmd->iParam[1], NULL, &ad); } } else { adas_Get_Listener_Position(pos); ret = ap_Play_Sound(type,1,0,pos,cmd->iParam[r+1], NULL, &ad); } return ret; } int CreateFontAnimations2(CMD_LINE * res, int *lastcmd, int ycor, char bcor) { int lcmd = *lastcmd; char text[256]; RECT r = { 0, 0, 0, 0 }; int i; int sidx1, sidx2; int y; int ret; for (i = 0; i < lcmd; i++) if (res[i].iParam[0] == COM_SETRECT) { r.left = res[i].iParam[1]; r.top = res[i].iParam[2]; r.right = res[i].iParam[3]; r.bottom = res[i].iParam[4]; if (bcor) { r.top += ycor; r.bottom += ycor; } } y = r.top; for (i = 0; i < lcmd; i++) if (res[i].iParam[0] == COM_CREATEBUTTON) if (fn2_Gen_Menu_Text(0, HDC2DD, res[i].cParam[0], &sidx1, &sidx2) != -1) if (sidx1 != -1 && sidx2 != -1) { int ii; int oy = res[i].iParam[2]; //int x = r.left + ftoi((r.right - r.left - _2dd.bitmap[sidx1].bitmap.bmWidth) / (float)2.0f); int x = r.left + ftoi((r.right - r.left - ddx2GetWidth(sidx1)) / (float) 2.0f); if (bcor) oy += ycor; if (res[i].iParam[1] != -1) { oy = res[i].iParam[2]; if (bcor) oy += ycor; y = oy; x = res[i].iParam[1]; } y += ddx2GetHeight(sidx1); //OnAbove(16,661,100,748, quit_game.txt, NO_EXEPTION) sprintf(text, "OnAbove(%d,%d,%d,%d, NO_EXEPTION, NO_EXEPTION)", x, oy, x + ddx2GetWidth(sidx1), y); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].uiTimerID = 0; res[*lastcmd].iLastfrm = 1; res[*lastcmd].iCounter = 0; /* (0, 123, 0, 640, 0, 1) (1, 124, 0, 640, 25, 2) (2, 124, 0, 640, 25, -1) */ res[*lastcmd].iAnim[0][0] = 0; res[*lastcmd].iAnim[0][1] = sidx1; res[*lastcmd].iAnim[0][2] = x; res[*lastcmd].iAnim[0][3] = oy; res[*lastcmd].iAnim[0][4] = 0; res[*lastcmd].iAnim[0][5] = 1; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[0][ii] = -1; x = r.left + ftoi((r.right - r.left - ddx2GetWidth(sidx2)) / (float) 2.0f); if (res[i].iParam[1] != -1) x = res[i].iParam[1]; res[*lastcmd].iAnim[1][0] = 1; res[*lastcmd].iAnim[1][1] = sidx2; res[*lastcmd].iAnim[1][2] = x; res[*lastcmd].iAnim[1][3] = oy; res[*lastcmd].iAnim[1][4] = 50; res[*lastcmd].iAnim[1][5] = 2; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[1][ii] = -1; res[*lastcmd].iAnim[2][0] = 2; res[*lastcmd].iAnim[2][1] = sidx2; res[*lastcmd].iAnim[2][2] = x; res[*lastcmd].iAnim[2][3] = oy; res[*lastcmd].iAnim[2][4] = 50; res[*lastcmd].iAnim[2][5] = -1; for (ii = 6; ii < 13; ii++) res[*lastcmd].iAnim[2][ii] = -1; res[*lastcmd].iLayer = 1; (*lastcmd)++; //Draw(1,0,0) sprintf(text, "Draw(%d,%d,%d)", sidx1, x, oy); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; //OnClick(16,661,100,748, quit_gamec.txt, EXIT) ret = snprintf(text, sizeof(text), "OnClick(%d,%d,%d,%d, NO_EXEPTION, %s)", x, oy, x + ddx2GetWidth(sidx1), y, res[i].cParam[1]); assert(ret < (int)sizeof(text)); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 1; (*lastcmd)++; //BindSound(54,55,56,-1) strcpy(text, "BindSound(54,55,56,-1)"); Parse_LineT(text, res[*lastcmd].iParam, 6, res[*lastcmd].cParam[0], res[*lastcmd].cParam[1]); res[*lastcmd].iLayer = 0; (*lastcmd)++; } return y; } void SetTab2(int iTab, int iLTab, CONTROL_LIST_ITEM2 * p_list, int lsize, int *hdcTab) { int i; if (iLTab > -1) { //BitBlt(hdcTab[iLTab], 0, 0, TAB_XRES, TAB_YRES, _2dd.hDC, TAB_X, TAB_Y, SRCCOPY); ddx2BitBlt(hdcTab[iLTab], 0, 0, TAB_XRES, TAB_YRES, HDC2DD, TAB_X, TAB_Y); } for (i = 0; i < lsize; i++) if ((p_list + i)->iTab == iTab && !(p_list + i)->bDisabled) (p_list + i)->bActive = 1; else if ((p_list + i)->iTab != -1) (p_list + i)->bActive = 0; ddx2BitBltDisplay(TAB_X, TAB_Y, TAB_XRES, TAB_YRES, hdcTab[iTab], 0, 0); } void CharMenuCheckMultyKyes2(LIST_VIEW_CONTROL2 * p_li, int iKey) { int y; int i; RECT r; for (i = 0; i < p_li->listnum; i++) if (i != p_li->cSelected && p_li->piValue[i] == iKey) { y = i * 30; r.left = 550; r.top = y + 2; r.right = r.left + (ddx2GetWidth(p_li->bDCn) - 550); r.bottom = r.top + 28; ddx2FillRect(p_li->bDCn, &r, 0); ddx2FillRect(p_li->bDCs, &r, 0); char tmp[200]; co2_List_Add_String(p_li, i, 550, Key2String(255, tmp), 255, 0); } } void SetCharMenu2(LIST_VIEW_CONTROL2 * p_li, LEVELINFO * p_Level, ANIMATION_MODULE * p_am, int mix, int miy) { char text[128]; int y = p_li->cSelected * 30; // int xs = p_li->rectList.top + TAB_Y + y - p_li->dx; int xp = 0; int xt = 0; int i; RECT r; RECT rtmp; int iCursor = 0; mi.x = mix; mi.y = miy; if (!p_li->cSelected || p_li->cSelected == 11 || p_li->cSelected == 19) return; r.left = 550; r.top = y + 2; r.right = r.left + (ddx2GetWidth(p_li->bDCn) - 550); r.bottom = r.top + 28; ddx2FillRect(p_li->bDCn, &r, 0); ddx2FillRect(p_li->bDCs, &r, 0); if (y - p_li->dx < 0) xp = (y - p_li->dx) * -1; if ((p_li->rectList.top + TAB_Y + y - p_li->dx + 30) > p_li->rectList.bottom + TAB_Y) xt = (p_li->rectList.top + TAB_Y + y - p_li->dx + 30) - (p_li->rectList.bottom + TAB_Y); ddx2BitBlt(HDC2DD, p_li->rectList.left + TAB_X, p_li->rectList.top + TAB_Y + y - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, y + xp); //spracuj_spravy(0); am_Flip(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); r.top = p_li->rectList.top + TAB_Y + y - p_li->dx + xp - 2; r.left = 665; r.right = r.left + 220; r.bottom = r.top + 27; rtmp.left = r.left; rtmp.top = r.top; rtmp.right = 220; rtmp.bottom = 27; while (!key[0]) { if (iCursor < 100) ddx2FillRect(HDC2DD, &r, RGB(63, 122, 163)); else if (iCursor > 99 && iCursor < 200) ddx2FillRect(HDC2DD, &r, 0); else { iCursor = 0; ddx2FillRect(HDC2DD, &r, 0); } ddx2AddRectItem(&rline, rtmp, 0); iCursor += 4; Sleep(10); am_Flip(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); if (key[K_F1] || key[K_F2] || key[K_F3] || key[K_F10] || key[K_PLUS] || key[K_MINUS]) { key[0] = 0; key[K_F1] = 0; key[K_F2] = 0; key[K_F3] = 0; key[K_F10] = 0; key[K_PLUS] = 0; key[K_MINUS] = 0; } } key[0] = 0; for (i = 0; i < POCET_KLAVES; i++) if (key[i]) { Key2String(i, text); key[i] = 0; break; } co2_List_Add_String(p_li, p_li->cSelected, 550, text, i, 0); CharMenuCheckMultyKyes2(p_li, i); ddx2BitBlt(HDC2DD, p_li->rectList.left + TAB_X, p_li->rectList.top + TAB_Y, ddx2GetWidth(p_li->bDCn), p_li->rectList.bottom - p_li->rectList.top, p_li->bDCn, 0, p_li->dx); ddx2BitBlt(HDC2DD, p_li->rectList.left + TAB_X, p_li->rectList.top + TAB_Y + y - p_li->dx + xp, ddx2GetWidth(p_li->bDCs), 30 - xp - xt, p_li->bDCs, 0, y + xp); } void SetMenuSettings2(CONTROL_LIST_ITEM2 * citem, int *hdcTabUse) { int i; if (hdcTabUse[0]) { setup.posouvat_kameru = co2_Check_Get_State(citem, CLIST_ITEMC, 1); setup.ovladani = co2_Check_Get_State(citem, CLIST_ITEMC, 2); setup.bugs_highlight = co2_Check_Get_State(citem, CLIST_ITEMC, 10); setup.items_highlight = co2_Check_Get_State(citem, CLIST_ITEMC, 11); setup.ovladani_rohy = co2_Check_Get_State(citem, CLIST_ITEMC, 12); setup.camera_intro = co2_Check_Get_State(citem, CLIST_ITEMC, 16); i = co2_Check_Get_State(citem, CLIST_ITEMC, 13); if (i) setup.ovladani_rohy_default = 0; else setup.ovladani_rohy_default = 1; setup.ovladani_rohy_smer = co2_Check_Get_State(citem, CLIST_ITEMC, 15); //setup.ovladani_pr_posun = co2_Check_Get_State(citem, CLIST_ITEMC, 16); setup.ovladani_rohy_rychlost = co2_Progres_Get(citem, CLIST_ITEMC, 0) / 10.0f; setup.p_kamera_radius = co2_Progres_Get(citem, CLIST_ITEMC, 1) / 2.0f; } if (hdcTabUse[1]) { co2_Combo_Drop_Get_Sel(citem, CLIST_ITEMC, 10, &setup.text_ostrost); setup.ditering = co2_Check_Get_State(citem, CLIST_ITEMC, 7); setup.mirror_effects = co2_Check_Get_State(citem, CLIST_ITEMC, 4); setup.animace_okoli = co2_Check_Get_State(citem, CLIST_ITEMC, 8); } if (hdcTabUse[2]) { setup.soundvolume = co2_Progres_Get(citem, CLIST_ITEMC, 4); setup.ambientvolume = co2_Progres_Get(citem, CLIST_ITEMC, 5); setup.musicvolume = co2_Progres_Get(citem, CLIST_ITEMC, 6); } if (hdcTabUse[3]) { setup.key[1] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 1); setup.key[2] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 2); setup.key[3] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 3); setup.key[4] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 4); setup.key[5] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 5); setup.key[6] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 6); setup.key[7] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 7); setup.key[8] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 8); setup.key[9] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 9); setup.key[10] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 10); setup.key[12] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 12); setup.key[13] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 13); setup.key[14] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 14); setup.key[15] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 15); setup.key[16] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 16); setup.key[17] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 17); setup.key[18] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 18); setup.key[20] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 20); setup.key[21] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 21); setup.key[22] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 22); setup.key[23] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 23); setup.key[24] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 24); setup.key[25] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 25); setup.key[26] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 26); setup.key[27] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 27); setup.key[28] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 28); setup.key[29] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 29); setup.key[30] = co2_List_Get_Value(citem, CLIST_ITEMC, 0, 30); } } void SetMenuSettingsS2(CONTROL_LIST_ITEM2 * citem, int *hdcTabUse) { if (hdcTabUse[2]) { setup.soundvolume = co2_Progres_Get(citem, CLIST_ITEMC, 4); setup.ambientvolume = co2_Progres_Get(citem, CLIST_ITEMC, 5); setup.musicvolume = co2_Progres_Get(citem, CLIST_ITEMC, 6); } } void ControlFullScreenCallback2(void *p_control) { GRAPH3D *p_grf = (p_ber->p_age)->graph_get(); p_grf->fullscreen_toggle(); } void InitTab3d2(CONTROL_LIST_ITEM2 * citem, int *hdcTab) { int i; //kprintf(1, "##settings_sharpness"); co2_Set_Text_Right(hdcTab[1], "##settings_sharpness", 0, 285, 97); citem[42].p_combod = co2_Create_Combo_Drop(hdcTab[1], 300, 90, 10); citem[42].iTab = 1; co2_Combo_Drop_Add_String(citem[42].p_combod, "-3.0", -3.0f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-2.75", -2.75f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-2.5", -2.5f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-2.25", -2.25f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-2.0", -2.0f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-1.75", -1.75f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-1.5", -1.5f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-1.25", -1.25f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-1.0", -1.0f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-0.75", -0.75f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-0.5", -0.5f); co2_Combo_Drop_Add_String(citem[42].p_combod, "-0.25", -0.25f); co2_Combo_Drop_Add_String(citem[42].p_combod, "0.0", 0.0f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+0.25", 0.25f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+0.5", 0.5f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+0.75", 0.75f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+1.0", 1.0f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+1.25", 1.25f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+1.5", 1.5f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+1.75", 1.75f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+2.0", 2.0f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+2.25", 2.25f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+2.5", 2.5f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+2.75", 2.75f); co2_Combo_Drop_Add_String(citem[42].p_combod, "+3.0", 3.0f); i = ftoi(((setup.text_ostrost + 3) * 100) / 25.0f); if (i > 24) i = 24; co2_Combo_Drop_Set_Sel(hdcTab[1], citem[42].p_combod, i); //kprintf(1, "##settings_dithering"); citem[29].p_check = co2_Create_CheckBox(hdcTab[1], 300, 150, "##settings_dithering", 0, 7); citem[29].iTab = 1; co2_Check_Set_State(citem[29].p_check, hdcTab[1], setup.ditering, 1); //kprintf(1, "##settings_animations"); citem[11].p_check = co2_Create_CheckBox(hdcTab[1], 300, 180, "##settings_draw_mirror", 0, 4); citem[11].iTab = 1; co2_Check_Set_State(citem[11].p_check, hdcTab[1], setup.mirror_effects, 1); citem[30].p_check = co2_Create_CheckBox(hdcTab[1], 300, 210, "##settings_animations", 0, 8); citem[30].iTab = 1; co2_Check_Set_State(citem[30].p_check, hdcTab[1], setup.animace_okoli, 1); citem[31].p_check = co2_Create_CheckBox(hdcTab[1], 300, 240, "##settings_fullscreen", 0, 5, ControlFullScreenCallback2); citem[31].iTab = 1; co2_Check_Set_State(citem[31].p_check, hdcTab[1], setup.fullscreen, 1); } void InitTabSound2(CONTROL_LIST_ITEM2 * citem, int *hdcTab) { co2_Set_Text_Right(hdcTab[2], "##settings_sound", 0, 260, 50); citem[21].p_prog = co2_Create_Progres(hdcTab[2], 310, 50, 0, 100, 4); citem[21].iTab = 2; co2_Progres_Set(citem[21].p_prog, hdcTab[2], setup.soundvolume); co2_Set_Text_Right(hdcTab[2], "##settings_ambient", 0, 260, 85); citem[22].p_prog = co2_Create_Progres(hdcTab[2], 310, 85, 0, 100, 5); citem[22].iTab = 2; co2_Progres_Set(citem[22].p_prog, hdcTab[2], setup.ambientvolume); co2_Set_Text_Right(hdcTab[2], "##settings_music", 0, 260, 120); citem[23].p_prog = co2_Create_Progres(hdcTab[2], 310, 120, 0, 100, 6); citem[23].iTab = 2; co2_Progres_Set(citem[23].p_prog, hdcTab[2], setup.musicvolume); /*co2_Set_Text(hdcTab[2], 260 - TAB_X, 350 - TAB_Y, "##settings_sound", 0); citem[21].p_prog = co2_Create_Progres(hdcTab[2], 345 - TAB_X, 352 - TAB_Y, 0, 100, 4); citem[21].iTab = 2; co2_Progres_Set(citem[21].p_prog, hdcTab[2], setup.soundvolume); co2_Set_Text(hdcTab[2], 150 - TAB_X, 385 - TAB_Y, "##settings_ambient", 0); citem[22].p_prog = co2_Create_Progres(hdcTab[2], 345 - TAB_X, 387 - TAB_Y, 0, 100, 5); citem[22].iTab = 2; co2_Progres_Set(citem[22].p_prog, hdcTab[2], setup.ambientvolume); co2_Set_Text(hdcTab[2], 242 - TAB_X, 420 - TAB_Y, "##settings_music", 0); citem[23].p_prog = co2_Create_Progres(hdcTab[2], 345 - TAB_X, 422 - TAB_Y, 0, 100, 6); citem[23].iTab = 2; co2_Progres_Set(citem[23].p_prog, hdcTab[2], setup.musicvolume); */ } void InitTabControls2(CONTROL_LIST_ITEM2 * citem, int *hdcTab) { char ctext[256]; citem[24].p_list = co2_Create_List(hdcTab[3], 25, 50, 800, 580, 0, 31, 0); citem[24].iTab = 3; co2_List_Add_String(citem[24].p_list, 0, 2, "##control_beatle", 0, 1); co2_List_Add_String(citem[24].p_list, 1, 2, "##control_forward", 0, 0); co2_List_Add_String(citem[24].p_list, 2, 2, "##control_back", 0, 0); co2_List_Add_String(citem[24].p_list, 3, 2, "##control_left", 0, 0); co2_List_Add_String(citem[24].p_list, 4, 2, "##control_right", 0, 0); co2_List_Add_String(citem[24].p_list, 5, 2, "##control_nextb", 0, 0); co2_List_Add_String(citem[24].p_list, 6, 2, "##control_b1", 0, 0); co2_List_Add_String(citem[24].p_list, 7, 2, "##control_b2", 0, 0); co2_List_Add_String(citem[24].p_list, 8, 2, "##control_b3", 0, 0); co2_List_Add_String(citem[24].p_list, 9, 2, "##control_b4", 0, 0); co2_List_Add_String(citem[24].p_list, 10, 2, "##control_b5", 0, 0); co2_List_Add_String(citem[24].p_list, 11, 2, "##control_camera", 0, 1); co2_List_Add_String(citem[24].p_list, 12, 2, "##control_crotation", 0, 0); co2_List_Add_String(citem[24].p_list, 13, 2, "##control_cmove", 0, 0); co2_List_Add_String(citem[24].p_list, 14, 2, "##control_czoomin", 0, 0); co2_List_Add_String(citem[24].p_list, 15, 2, "##control_czoomout", 0, 0); co2_List_Add_String(citem[24].p_list, 16, 2, "##control_cfastleft", 0, 0); co2_List_Add_String(citem[24].p_list, 17, 2, "##control_cfastright", 0, 0); co2_List_Add_String(citem[24].p_list, 18, 2, "##control_ccamera", 0, 0); co2_List_Add_String(citem[24].p_list, 19, 2, "##control_game", 0, 1); co2_List_Add_String(citem[24].p_list, 20, 2, "##control_gmenu", 0, 0); co2_List_Add_String(citem[24].p_list, 21, 2, "##control_grestart", 0, 0); co2_List_Add_String(citem[24].p_list, 22, 2, "##control_ginventory", 0, 0); //co2_List_Add_String(citem[24].p_list, 23, 2, "##control_gusepack", 0, 0); co2_List_Add_String(citem[24].p_list, 23, 2, "##control_gnexttrack", 0, 0); co2_List_Add_String(citem[24].p_list, 24, 2, "##control_gturnoffi", 0, 0); co2_List_Add_String(citem[24].p_list, 25, 2, "##control_gturnofft", 0, 0); co2_List_Add_String(citem[24].p_list, 26, 2, "##control_gscreenshot", 0, 0); co2_List_Add_String(citem[24].p_list, 27, 2, "##control_gtransparent", 0, 0); co2_List_Add_String(citem[24].p_list, 28, 2, "##control_ghighlight", 0, 0); co2_List_Add_String(citem[24].p_list, 29, 2, "##control_gdrawconn", 0, 0); co2_List_Add_String(citem[24].p_list, 30, 2, "##control_pause", 0, 0); Key2String(setup.key[1], ctext); co2_List_Add_String(citem[24].p_list, 1, 550, ctext, setup.key[1], 0); Key2String(setup.key[2], ctext); co2_List_Add_String(citem[24].p_list, 2, 550, ctext, setup.key[2], 0); Key2String(setup.key[3], ctext); co2_List_Add_String(citem[24].p_list, 3, 550, ctext, setup.key[3], 0); Key2String(setup.key[4], ctext); co2_List_Add_String(citem[24].p_list, 4, 550, ctext, setup.key[4], 0); Key2String(setup.key[5], ctext); co2_List_Add_String(citem[24].p_list, 5, 550, ctext, setup.key[5], 0); Key2String(setup.key[6], ctext); co2_List_Add_String(citem[24].p_list, 6, 550, ctext, setup.key[6], 0); Key2String(setup.key[7], ctext); co2_List_Add_String(citem[24].p_list, 7, 550, ctext, setup.key[7], 0); Key2String(setup.key[8], ctext); co2_List_Add_String(citem[24].p_list, 8, 550, ctext, setup.key[8], 0); Key2String(setup.key[9], ctext); co2_List_Add_String(citem[24].p_list, 9, 550, ctext, setup.key[9], 0); Key2String(setup.key[10], ctext); co2_List_Add_String(citem[24].p_list, 10, 550, ctext, setup.key[10], 0); Key2String(setup.key[12], ctext); co2_List_Add_String(citem[24].p_list, 12, 550, ctext, setup.key[12], 0); Key2String(setup.key[13], ctext); co2_List_Add_String(citem[24].p_list, 13, 550, ctext, setup.key[13], 0); Key2String(setup.key[14], ctext); co2_List_Add_String(citem[24].p_list, 14, 550, ctext, setup.key[14], 0); Key2String(setup.key[15], ctext); co2_List_Add_String(citem[24].p_list, 15, 550, ctext, setup.key[15], 0); Key2String(setup.key[16], ctext); co2_List_Add_String(citem[24].p_list, 16, 550, ctext, setup.key[16], 0); Key2String(setup.key[17], ctext); co2_List_Add_String(citem[24].p_list, 17, 550, ctext, setup.key[17], 0); Key2String(setup.key[18], ctext); co2_List_Add_String(citem[24].p_list, 18, 550, ctext, setup.key[18], 0); Key2String(setup.key[20], ctext); co2_List_Add_String(citem[24].p_list, 20, 550, ctext, setup.key[20], 0); Key2String(setup.key[21], ctext); co2_List_Add_String(citem[24].p_list, 21, 550, ctext, setup.key[21], 0); Key2String(setup.key[22], ctext); co2_List_Add_String(citem[24].p_list, 22, 550, ctext, setup.key[22], 0); /*Key2String(setup.key[23], ctext); co2_List_Add_String(citem[24].p_list, 23, 550, ctext, setup.key[23], 0); */ Key2String(setup.key[23], ctext); co2_List_Add_String(citem[24].p_list, 23, 550, ctext, setup.key[23], 0); Key2String(setup.key[24], ctext); co2_List_Add_String(citem[24].p_list, 24, 550, ctext, setup.key[24], 0); Key2String(setup.key[25], ctext); co2_List_Add_String(citem[24].p_list, 25, 550, ctext, setup.key[25], 0); Key2String(setup.key[26], ctext); co2_List_Add_String(citem[24].p_list, 26, 550, ctext, setup.key[26], 0); Key2String(setup.key[27], ctext); co2_List_Add_String(citem[24].p_list, 27, 550, ctext, setup.key[27], 0); Key2String(setup.key[28], ctext); co2_List_Add_String(citem[24].p_list, 28, 550, ctext, setup.key[28], 0); Key2String(setup.key[29], ctext); co2_List_Add_String(citem[24].p_list, 29, 550, ctext, setup.key[29], 0); Key2String(setup.key[30], ctext); co2_List_Add_String(citem[24].p_list, 30, 550, ctext, setup.key[30], 0); co2_List_Redraw(hdcTab[3], citem[24].p_list, 0); } void RunMenuSettings2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am) { int mix, miy; RECT rTMP = { 0, 0, 1024, 768 }; DWORD dwEplased = 0, dwStart, dwStop; int ActiveTab = 0; int hdcTab[TAB_NUM]; int hdcTabUse[TAB_NUM]; CONTROL_LIST_ITEM2 citem[CLIST_ITEMC]; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; DeviceHandle dh = 0; int sh = K_CHYBA; _3d_End_Draw(); p_Level->bResetini = 0; p_Level->iCursor = 133; am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); _2d_Clear_RectLine(&rline); ddx2Init(200, RGB(255, 0, 255)); dh = ddx2DeviceCreate(TRUE, 32); ddx2DeviceSetActive(dh); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(0, 0, 1024, 768); ddx2DeviceSetTextRenderRec(0, 0, 1024, 768); ddx2DeviceSetScreenRecCallback(ddx2ScreenResDefaultCallback); ddx2CleareSurface(DDX2_BACK_BUFFER); sh = ddx2LoadBitmap("settings.png", pBmpDir); LoadHelp("3dsettings_load.txt"); ddx2FillRect(DDX2_BACK_BUFFER, &rTMP, RGB(255, 0, 255)); ddx2SetRect(&rTMP, 1); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); // Stop renderu hry //ddx2GameRender(FALSE); // - volat jako soucast hry (po vykreslni listi) //void ddx2RenderDevices(G_KONFIG *p_ber) // - volat pokud jede menu bez hry - maze obrazovku a kresli menu //void ddx2RenderujVse(G_KONFIG *p_ber) // flipovat musis sam vzdycky // volej ale v kazdem frame jen jednu tuto funkci (podle toho jesli // 2D grafika je soucasti hry nebo jede samostatne) _2d_Clear_RectLine(&rline); res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); Load_ini(); iCompositDC = ddx2FindFreeSurface(); CompositDC = ddx2CreateSurface(1024, 768, iCompositDC); iFontDC = ddx2FindFreeSurface(); FontDC = ddx2CreateSurface(1024, 768, iFontDC); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM2)); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); fn2_Set_Font(cFontDir[2]); fn2_Load_Bitmaps(); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][11] = -1; res[bind].iAnim[lastcmd][0] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; CreateFontAnimations2(res, &lastcmd, 0, 0); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) { //ddx2DrawSurface(BackDC, res[i].iParam, 2); ddx2DrawDisplay(res[i].iParam, 0); } else { //ddx2DrawSurfaceColorKey(BackDC, res[i].iParam, 2, TRANSCOLOR ); //ddx2DrawSurface(FontDC, res[i].iParam, 3); ddx2DrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iParam, 3); } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); for (i = 0; i < TAB_NUM; i++) { hdcTab[i] = ddx2CreateSurface(TAB_XRES, TAB_YRES, ddx2FindFreeSurface()); if (hdcTab[i]) ddx2BitBlt(hdcTab[i], 0, 0, TAB_XRES, TAB_YRES, HDC2DD, TAB_X, TAB_Y); hdcTabUse[i] = 0; } am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); if (!co2_Load_Graphic(0)) { kerror(1, "co2_Load_Graphic ... can't load controls!"); } else { citem[0].bActive = 0; citem[1].bActive = 0; citem[3].p_check = co2_Create_CheckBox(hdcTab[0], 25, 50, "##settings_camera_mov", 0, 1); co2_Check_Set_State(citem[3].p_check, hdcTab[0], setup.posouvat_kameru, 1); citem[3].bActive = 1; citem[4].p_check = co2_Create_CheckBox(hdcTab[0], 25, 80, "##settings_b1_control", 0, 2); co2_Check_Set_State(citem[4].p_check, hdcTab[0], setup.ovladani, 1); citem[4].bActive = 1; citem[35].p_check = co2_Create_CheckBox(hdcTab[0], 25, 110, "##settings_beathe_vis_at_start", 0, 10); co2_Check_Set_State(citem[35].p_check, hdcTab[0], setup.bugs_highlight, 1); citem[35].bActive = 1; citem[36].p_check = co2_Create_CheckBox(hdcTab[0], 25, 140, "##settings_items_vis_at_start", 0, 11); co2_Check_Set_State(citem[36].p_check, hdcTab[0], setup.items_highlight, 1); citem[36].bActive = 1; citem[41].p_check = co2_Create_CheckBox(hdcTab[0], 25, 200, "##settings_camera_intro", 0, 16); co2_Check_Set_State(citem[41].p_check, hdcTab[0], setup.camera_intro, 1); citem[41].bActive = 1; citem[37].p_check = co2_Create_CheckBox(hdcTab[0], 25, 230, "##settings_camera_rect", 0, 12); co2_Check_Set_State(citem[37].p_check, hdcTab[0], setup.ovladani_rohy, 1); citem[37].bActive = 1; citem[38].p_check = co2_Create_CheckBox(hdcTab[0], 25, 260, "##settings_implicit_move", 0, 13); if (setup.ovladani_rohy_default) co2_Check_Set_State(citem[38].p_check, hdcTab[0], 0, 1); else co2_Check_Set_State(citem[38].p_check, hdcTab[0], 1, 1); citem[38].bActive = 1; citem[39].p_check = co2_Create_CheckBox(hdcTab[0], 25, 290, "##settings_imlicit_rot", 0, 14); if (setup.ovladani_rohy_default) co2_Check_Set_State(citem[39].p_check, hdcTab[0], 1, 1); else co2_Check_Set_State(citem[39].p_check, hdcTab[0], 0, 1); citem[39].bActive = 1; citem[40].p_check = co2_Create_CheckBox(hdcTab[0], 25, 320, "##settings_camera_swap", 0, 15); co2_Check_Set_State(citem[40].p_check, hdcTab[0], setup.ovladani_rohy_smer, 1); citem[40].bActive = 1; /*citem[41].p_check = co2_Create_CheckBox(hdcTab[0], 25, 350, "##setings_camera_move_cur", 0, 16); co2_Check_Set_State(citem[41].p_check, hdcTab[0], setup.ovladani_pr_posun, 1); citem[41].bActive = 1; */ co2_Set_Text_Right(hdcTab[0], "##setings_camera_speed", 0, 450, 390); citem[42].p_prog = co2_Create_Progres(hdcTab[0], 500, 387, 0, 10, 0); co2_Progres_Set(citem[42].p_prog, hdcTab[0], ftoi(setup.ovladani_rohy_rychlost * 10)); citem[42].bActive = 1; co2_Set_Text_Right(hdcTab[0], "##settings_trans_radius", 0, 450, 425); citem[7].p_prog = co2_Create_Progres(hdcTab[0], 500, 412, 1, 20, 1); co2_Progres_Set(citem[7].p_prog, hdcTab[0], ftoi(setup.p_kamera_radius * 2)); citem[7].bActive = 1; /*if(!setup.posouvat_kameru) co2_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 0); */ if (!setup.ovladani_rohy) { co2_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 13); co2_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 14); co2_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 15); //co2_Check_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 16); co2_Progres_Disable(hdcTab[0], 0, 0, citem, CLIST_ITEMC, 0, 1, hdcTab[0]); } SetTab2(0, -1, citem, CLIST_ITEMC, hdcTab); hdcTabUse[0] = 1; /*if(!setup.posouvat_kameru) co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0); */ if (!setup.ovladani_rohy) { co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 13); co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 14); co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 15); //co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 16); co2_Progres_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0, 0, HDC2DD); } } am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); //BEGIN_MENU: for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation2(&res[i], &ad, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound2(&res[i + 1], &ad, 2); } } mi.t1 = 0; mi.t2 = 0; mi.dx = 0; mi.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; p_Level->iCursor = 0; ddx2GameRender(FALSE); ddx2DeviceSetRender(TRUE); spracuj_spravy(0); while (!key[K_ESC]) { mix = mi.x; miy = mi.y; mi.x = (int) ceil(mi.x * scale_factor_x()); mi.y = (int) ceil(mi.y * scale_factor_y()); dwStart = timeGetTime(); //pohnul mysi if (mi.dx || mi.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop2(&res[lastabv]); if (!res[lastabv].iLayer) { ddx2DrawDisplay(res[lastabv].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[lastabv].iAnim[0], 3, TRANSCOLOR); ddx2DrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation2(&res[i], &ad); lastabv = i; AddAnimation2(&res[i], &ad, 0); in = 1; bind = ChooseBidedAnimation2(res, i + 1, &ad); if (bind != -1) { CheckAnimation2(&res[bind], &ad); AddAnimation2(&res[bind], &ad, 1); anbind = bind; mPlaySound2(&res[bind], &ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop2(&res[i]); if (!res[i].iLayer) { ddx2DrawDisplay(res[i].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation2(res, i + 1, &ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop2(&res[anbind]); if (!res[i].iLayer) { ddx2DrawDisplay(res[anbind].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation2(&res[bind], &ad, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound2(&res[bind], &ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } mi.dx = 0; mi.dy = 0; } co2_Handle_Controls(citem, CLIST_ITEMC, mi.x - TAB_X, mi.y - TAB_Y, HDC2DD, TAB_X, TAB_Y); if(co2_Progres_Changed(citem, CLIST_ITEMC, 4)) ad.Sound_Gain = co2_Progres_Get(citem, CLIST_ITEMC, 4) / 100.0f; if (co2_Progres_Changed(citem, CLIST_ITEMC, 5)) { float laf = ad.Ambient_Gain; ad.Ambient_Gain = co2_Progres_Get(citem, CLIST_ITEMC, 5) / 100.0f; adas_Set_Source_Gain(-1, LOOPING_TYPE, UNDEFINED_VALUE, ad.Ambient_Gain); if(laf < 0.05f && ad.Ambient_Gain >= 0.05f) { adas_Release_Source(-1, LOOPING_TYPE, UNDEFINED_VALUE); as_Start(p_Level->Environment.id, &ad, p_Level); } } if (co2_Progres_Changed(citem, CLIST_ITEMC, 6)) { float f = co2_Progres_Get(citem, CLIST_ITEMC, 6) / 100.0f; ogg_gain(f); ad.Music_Gain = f; if(f >= 0.05f && !ogg_playing()) { ad.Music_Gain = f; ap_Stop_Song(&ad); ap_Play_Song(0,1,&ad); //adas_OGG_Set_Priority(p_Level->Base_Priority); //ap_Play_Song(0,0,&ad); } } //stlacil leve tlacitko if (mi.t1 && !click) { int iCheck = -1; LIST_VIEW_CONTROL2 *p_li; iCheck = co2_Check_Get_State_Change(citem, CLIST_ITEMC, 12); if (iCheck != -1) { if (!iCheck) { co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 13); co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 14); co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 15); //co2_Check_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 16); co2_Progres_Disable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0, 1, HDC2DD); } else { co2_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 13); co2_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 14); co2_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 15); //co2_Check_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 16); co2_Progres_Enable(HDC2DD, TAB_X, TAB_Y, citem, CLIST_ITEMC, 0); } } if (ActiveTab == 0 && !citem[39].bDisabled) { iCheck = co2_Check_Get_State_Change(citem, CLIST_ITEMC, 13); if (iCheck != -1 && iCheck == 1) co2_Check_Set_State(citem[39].p_check, HDC2DD, 0, 1); else if (iCheck != -1 && !iCheck) co2_Check_Set_State(citem[39].p_check, HDC2DD, 1, 1); iCheck = co2_Check_Get_State_Change(citem, CLIST_ITEMC, 14); if (iCheck != -1 && iCheck == 1) co2_Check_Set_State(citem[38].p_check, HDC2DD, 0, 1); else if (iCheck != -1 && !iCheck) co2_Check_Set_State(citem[38].p_check, HDC2DD, 1, 1); } if (co2_List_Get_Clck(citem, CLIST_ITEMC, 0, &p_li) == 1) { float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, &ad); SetCharMenu2(p_li, p_Level, p_am, mix, miy); } //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation2(&res[i], &ad, 0); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; anmid = 31; } } mi.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT")) { float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, &ad); key[K_ESC] = 1; } if (!strcmp(res[resid].cParam[1], "OK")) { float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, &ad); SetMenuSettings2(citem, hdcTabUse); Save_ini(); key[K_ESC] = 1; p_Level->bResetini = 1; } if (!strcmp(res[resid].cParam[1], "GAME") && ActiveTab) { SetTab2(0, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 0; hdcTabUse[0]++; } if (!strcmp(res[resid].cParam[1], "3D") && ActiveTab != 1) { if (!hdcTabUse[1]) InitTab3d2(citem, hdcTab); SetTab2(1, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 1; hdcTabUse[1]++; } if (!strcmp(res[resid].cParam[1], "SOUND") && ActiveTab != 2) { if (!hdcTabUse[2]) InitTabSound2(citem, hdcTab); SetTab2(2, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 2; hdcTabUse[2]++; } if (!strcmp(res[resid].cParam[1], "CONTROLS") && ActiveTab != 3) { if (!hdcTabUse[3]) InitTabControls2(citem, hdcTab); SetTab2(3, ActiveTab, citem, CLIST_ITEMC, hdcTab); ActiveTab = 3; hdcTabUse[3]++; } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation2(&res[i], &ad); AddAnimation2(&res[i], &ad, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; AnimationEvent2(NULL, 0, 0, dwStop); mi.x = mix; mi.y = miy; am_Flip(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); } __QUIT: ddx2ReleaseBitmap(iCompositDC); ddx2ReleaseBitmap(iFontDC); // ddx2ReleaseBitmap(iBackDC); SetMenuSettingsS2(citem, hdcTabUse); Save_ini(); fn2_Release_Font(); StopAll2(); co2_Handle_Release(citem, CLIST_ITEMC); co2_Release_Graphic(); key[K_ESC] = 0; if (dh) { ddx2ReleaseBitmap(sh); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(dh); ddx2Release(); dh = 0; } FreeAnimations2(res, RES_NUM); free((void *) res); // fn2_Set_Font("font3d.pak"); // fn2_Load_Bitmaps(); // Start renderu hry ddx2GameRender(TRUE); } int FillListLoad2(LIST_VIEW_CONTROL2 * p_li, char *mask, char bAdd, char bLoad) { WCHAR wFile[128]; int x = 0; int c = 0; LIST_ITEM_ *list; int isize; if (chdir(SAVE_DIR)) return 0; FillStringList(mask, &list, &isize); if (!isize) return 0; for (c = 0; c < isize; c++) { ZeroMemory(wFile, 128 * sizeof(WCHAR)); if (bLoad == 2) { if (!demo_Check_Owner(pPlayerProfile.cName, list[c].text, wFile)) continue; } else if (!check_Save_Owner(list[c].text, wFile)) continue; if (bAdd) co2_List_Add_StringWC2(p_li, x, 2, wFile, list[c].text, x, 0); x++; } free((void *) list); return x; } static void RunMenuLoadGameLoad2ResizeCallback(void) { ddx2DeviceSetScreenRec((int) ceil(scale_back_factor_x() * 299), (int) ceil(scale_back_factor_y() * 209), (int) ceil(scale_back_factor_x() * 444), (int) ceil(scale_back_factor_y() * 415)); } int RunMenuLoadGameLoad2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am, char bLoad, WCHAR * cText) { int iReturn = 0; int mix, miy; RECT rTMP = { 299, 209, 444, 415 }; DWORD dwEplased = 0, dwStart, dwStop; CONTROL_LIST_ITEM2 citem[CLIST_ITEMC]; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; DeviceHandle dh = 0; int sh = K_CHYBA; _3d_End_Draw(); //kprintf(1, "----------------- RunMenuLoadGameLoad2 ---------------------"); p_Level->bResetini = 0; _2d_Clear_RectLine(&rline); p_Level->iCursor = 133; am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); p_Level->iCursor = 0; ddx2Init(200, RGB(255, 0, 255)); dh = ddx2DeviceCreate(TRUE, 32); ddx2DeviceSetActive(dh); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(299, 209, 444, 415); ddx2DeviceSetTextRenderRec(0, 0, 444, 415); ddx2DeviceSetScreenRecCallback(RunMenuLoadGameLoad2ResizeCallback); ddx2DeviceSetRender(TRUE); ddx2CleareSurface(DDX2_BACK_BUFFER); sh = ddx2LoadBitmap("smallmenu.png", pBmpDir); ddx2SetRect(&rTMP, 1); ddx2GameRender(TRUE); res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); iCompositDC = ddx2FindFreeSurface(); CompositDC = ddx2CreateSurface(1024, 768, iCompositDC); iFontDC = ddx2FindFreeSurface(); FontDC = ddx2CreateSurface(1024, 768, iFontDC); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM2)); fn2_Set_Font(cFontDir[0]); fn2_Load_Bitmaps(); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][11] = -1; res[bind].iAnim[lastcmd][0] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return 0; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; CreateFontAnimations2(res, &lastcmd, 0, 0); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) ddx2DrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); else { ddx2DrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iParam, 3); } break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } if (!co2_Load_Graphic(0)) kprintf(1, "co2_Load_Graphic ... con't load controls!"); else { RECT r; int xx; r.left = 299; r.top = 209; r.right = 743; r.bottom = 359; if (!bLoad) //save co2_Set_Text_Center(HDC2DD, "##menu_savegame", 0, r); else if (bLoad == 1) // load co2_Set_Text_Center(HDC2DD, "##menu_loadgame", 0, r); else //save demo co2_Set_Text_Center(HDC2DD, "##menu_savedemo", 0, r); fn2_Release_Font(); fn2_Set_Font(cFontDir[2]); fn2_Load_Bitmaps(); xx = FillListLoad2(NULL, "*", 0, bLoad); if (bLoad == 1) { if (xx < 6) xx = 6; citem[1].p_list = co2_Create_List(HDC2DD, 360, 320, 320, 185, 0, xx, 1); citem[1].bActive = 1; FillListLoad2(citem[1].p_list, "*", 1, bLoad); } else if (!bLoad) { if (xx < 5) xx = 5; citem[0].p_edit = co2_Create_Edit(HDC2DD, 373, 485, 0); citem[0].bActive = 1; citem[1].p_list = co2_Create_List(HDC2DD, 360, 320, 320, 150, 0, xx, 1); citem[1].bActive = 1; FillListLoad2(citem[1].p_list, "*", 1, bLoad); } else { xx = FillListLoad2(NULL, "*.dem", 0, bLoad); if (xx < 5) xx = 5; citem[0].p_edit = co2_Create_Edit(HDC2DD, 373, 485, 0); citem[0].bActive = 1; citem[1].p_list = co2_Create_List(HDC2DD, 360, 320, 320, 150, 0, xx, 1); citem[1].bActive = 1; FillListLoad2(citem[1].p_list, "*.dem", 1, bLoad); } co2_List_Redraw(HDC2DD, citem[1].p_list, 0); } //BEGIN_MENU: for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation2(&res[i], &ad, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound2(&res[i + 1], &ad, 2); } } mi.t1 = 0; mi.t2 = 0; mi.dx = 0; mi.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC]) { mix = mi.x; miy = mi.y; mi.x = (int) ceil(mi.x * scale_factor_x()); mi.y = (int) ceil(mi.y * scale_factor_y()); dwStart = timeGetTime(); //pohnul mysi if ((mi.dx || mi.dy) && !p_Level->bRestart && !p_Level->bReturnToMenu) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop2(&res[lastabv]); if (!res[lastabv].iLayer) { ddx2DrawDisplay(res[lastabv].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[lastabv].iAnim[0], 3, TRANSCOLOR); ddx2DrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation2(&res[i], &ad); lastabv = i; AddAnimation2(&res[i], &ad, 0); in = 1; bind = ChooseBidedAnimation2(res, i + 1, &ad); if (bind != -1) { CheckAnimation2(&res[bind], &ad); AddAnimation2(&res[bind], &ad, 1); anbind = bind; mPlaySound2(&res[bind], &ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop2(&res[i]); if (!res[i].iLayer) { ddx2DrawDisplay(res[i].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation2(res, i + 1, &ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop2(&res[anbind]); if (!res[i].iLayer) { ddx2DrawDisplay(res[anbind].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation2(&res[bind], &ad, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound2(&res[bind], &ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } mi.dx = 0; mi.dy = 0; } if (!p_Level->bRestart && !p_Level->bReturnToMenu) co2_Handle_Controls(citem, CLIST_ITEMC, mi.x, mi.y, HDC2DD, 0, 0); //stlacil leve tlacitko if (mi.t1 && !click && !p_Level->bRestart && !p_Level->bReturnToMenu) { LIST_VIEW_CONTROL2 *p_li; if (co2_List_Get_Clck(citem, CLIST_ITEMC, 0, &p_li) == 1) { if (p_li->cSelected != -1) { float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, &ad); if (!bLoad || bLoad == 2) co2_Edit_Set_Text(citem[0].p_edit, p_li->pwText[p_li->cSelected], 1, HDC2DD, 0, 0); } } if (co2_List_Get_Dbclck(citem, CLIST_ITEMC, 0, &p_li) == 1) { float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, &ad); if (p_li->cSelected != -1) if (p_li->pwText[p_li->cSelected]) { if (!bLoad || bLoad == 2) wcscpy(cText, citem[0].p_edit->wtext); else wcscpy(cText, p_li->pwText[p_li->cSelected]); if (!bLoad || bLoad == 2) iReturn++; key[K_ESC] = 1; } } //dostala se mys do akcni oblasti (OnClick)? if (!p_Level->bRestart && !p_Level->bReturnToMenu) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation2(&res[i], &ad, 0); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; anmid = 31; } } mi.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; if (!strcmp(res[resid].cParam[1], "OK")) { if (!bLoad || bLoad == 2) wcscpy(cText, citem[0].p_edit->wtext); else if (citem[1].p_list->cClckSel != -1) if (citem[1].p_list->pwText[citem[1].p_list->cClckSel]) wcscpy(cText, citem[1].p_list->pwText[citem[1].p_list->cClckSel]); if (wcslen(cText)) { char ccheck[] = "profiles"; WCHAR wcheck[64]; MultiByteToWideChar(CP_ACP, 0, ccheck, strlen(ccheck) + 1, wcheck, sizeof(wcheck) / sizeof(wcheck[0])); if (wcscasecmp(cText, wcheck)) { if (!bLoad || bLoad == 2) iReturn++; key[K_ESC] = 1; } } } if (!strcmp(res[resid].cParam[1], "EXIT") || !strcmp(res[resid].cParam[1], "CANCEL")) { ZeroMemory(cText, 128 * sizeof(WCHAR)); key[K_ESC] = 1; //break; } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation2(&res[i], &ad); AddAnimation2(&res[i], &ad, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; AnimationEvent2(NULL, 0, 0, dwStop); mi.x = mix; mi.y = miy; if (iReturn) { char ccheck[256]; ZeroMemory(ccheck, 256); if (!bLoad) lsi_Save_Exist(cText, ccheck); else demo_Exist(cText, ccheck); if (strlen(ccheck)) { if (!bLoad) p_Level->bRestart = 1; else p_Level->bReturnToMenu = 1; p_Level->iMessageBoxReturn = -1; key[K_ESC] = 0; iReturn = 0; } } if ((p_Level->bRestart || p_Level->bReturnToMenu) && mi.t1) { if (!p_Level->iMessageBoxReturn) { iReturn = 0; p_Level->bRestart = 0; p_Level->bReturnToMenu = 0; p_Level->iMessageBoxReturn = -1; } else if (p_Level->iMessageBoxReturn == 1) { iReturn = 1; key[K_ESC] = 1; p_Level->bRestart = 0; p_Level->bReturnToMenu = 0; p_Level->iMessageBoxReturn = -1; } mi.t1 = 0; } am_Flip(p_Level, p_am, 0, &rline, CLIST_ITEMC, 0, 0, 0); } //__QUIT: ddx2ReleaseBitmap(iCompositDC); ddx2ReleaseBitmap(iFontDC); fn2_Release_Font(); StopAll2(); co2_Handle_Release(citem, CLIST_ITEMC); co2_Release_Graphic(); key[K_ESC] = 0; if (dh) { ddx2ReleaseBitmap(sh); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(dh); ddx2Release(); dh = 0; } FreeAnimations2(res, RES_NUM); free((void *) res); // fn2_Set_Font("font3d.pak"); // fn2_Load_Bitmaps(); ddx2GameRender(TRUE); p_Level->bRestart = 0; return iReturn; } int LoadHelp(char *c_file) { int c = 0, i = -1; char text[MAX_FILENAME]; FILE *file; construct_path(text, MAX_FILENAME, 2, pBmpDir, c_file); file = fopen(text, "r"); if (!file) return -1; while (!feof(file)) { memset(text, 0, 256); if (fgets(text, 256, file) && text[0]) { newline_cut(text); if (!c) i = ddx2LoadBitmap(text, pBmpDir); else ddx2LoadBitmap(text, pBmpDir); //kprintf(1, "%s - %d", text, t); c++; } } fclose(file); return i; } int DrawHelp(int iBmp, int iSurface, int *iHelpIndex) { int y, ty; RECT rect = { 10, 0, 776, 1000 }; if (iSurface == -1) return 0; iHelpIndex[0] = 0; co2_Set_Text(iSurface, 10, 10, "##help_introduction_main", 1); y = co2_Set_Text_Formated_Rect(iSurface, 10, 60, "##help_introduction_h", 0, &rect) + 50; //BERUSKA///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[1] = y; co2_Set_Text(iSurface, 10, y, "##help_beatle_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 3), ddx2GetHeight(iBmp + 3), iBmp + 3, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 3); y = co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_beatle_h", 0, &rect) + 50; //EXIT///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[2] = y; co2_Set_Text(iSurface, 10, y, "##help_exit_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 4), ddx2GetHeight(iBmp + 4), iBmp + 4, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 4); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_exit_h", 0, &rect); y += ddx2GetHeight(iBmp + 4) + 50; //ZED///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[3] = y; co2_Set_Text(iSurface, 10, y, "##help_wall_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 15), ddx2GetHeight(iBmp + 15), iBmp + 15, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 15); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_wall_h", 0, &rect); y += ddx2GetHeight(iBmp + 15) + 50; //SIKMINA///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[4] = y; co2_Set_Text(iSurface, 10, y, "##help_up_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 8), ddx2GetHeight(iBmp + 8), iBmp + 8, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 8); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_up_h", 0, &rect); y += ddx2GetHeight(iBmp + 8) + 50; //BEDNA LEHKA ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[5] = y; co2_Set_Text(iSurface, 10, y, "##help_empty_box_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 1), ddx2GetHeight(iBmp + 1), iBmp + 1, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 1); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_empty_box_h", 0, &rect); y += ddx2GetHeight(iBmp + 1) + 50; //BEDNA TEZKA ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[6] = y; co2_Set_Text(iSurface, 10, y, "##help_full_box_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 2), ddx2GetHeight(iBmp + 2), iBmp + 2, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 2); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_full_box_h", 0, &rect); y += ddx2GetHeight(iBmp + 2) + 50; //BEDNA TNT ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[7] = y; co2_Set_Text(iSurface, 10, y, "##help_tnt_box_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 11), ddx2GetHeight(iBmp + 11), iBmp + 11, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 11); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_tnt_box_h", 0, &rect); y += ddx2GetHeight(iBmp + 11) + 50; //KAMEN ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[8] = y; co2_Set_Text(iSurface, 10, y, "##help_rock_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 5), ddx2GetHeight(iBmp + 5), iBmp + 5, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 5); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_rock_h", 0, &rect); y += ddx2GetHeight(iBmp + 5) + 50; //Tlacitko ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[9] = y; co2_Set_Text(iSurface, 10, y, "##help_button_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 10), ddx2GetHeight(iBmp + 10), iBmp + 10, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 10); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_button_h", 0, &rect); y += ddx2GetHeight(iBmp + 10) + 50; //TELEPORT ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[10] = y; co2_Set_Text(iSurface, 10, y, "##help_teleport_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 9), ddx2GetHeight(iBmp + 9), iBmp + 9, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 9); ty = y + ddx2GetHeight(iBmp + 9) + 50; y = co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_teleport_h", 0, &rect) + 50; //TELEPORT NA TLACITKO///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[11] = y; co2_Set_Text(iSurface, rect.left, y, "##help_teleport_button_main", 1); y += 50; y = co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_teleport_button_h", 0, &rect); y = ty; //VYTAH ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[12] = y; co2_Set_Text(iSurface, 10, y, "##help_lift_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 12), ddx2GetHeight(iBmp + 12), iBmp + 12, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 12); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_lift_h", 0, &rect); y += ddx2GetHeight(iBmp + 12) + 50; //VYTAH NA VAHU ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[13] = y; co2_Set_Text(iSurface, 10, y, "##help_lift_weight_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 17), ddx2GetHeight(iBmp + 17), iBmp + 17, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 17); ty = y + ddx2GetHeight(iBmp + 17) + 50; y = co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_lift_weight_h", 0, &rect); y += 50; //VYTAH NA TLACITKO ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[14] = y; co2_Set_Text(iSurface, 10, y, "##help_lift_button_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 18), ddx2GetHeight(iBmp + 18), iBmp + 18, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 18); ty = y + ddx2GetHeight(iBmp + 18) + 50; y = co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_lift_button_h", 0, &rect); y = ty; //VODA ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[15] = y; co2_Set_Text(iSurface, 10, y, "##help_water_main", 1); y += 50; rect.left = 10; y = co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_water_h", 0, &rect); y += 50; //PROPADLO ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[16] = y; co2_Set_Text(iSurface, 10, y, "##help_trap_door_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 7), ddx2GetHeight(iBmp + 7), iBmp + 7, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 7); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_trap_door_h", 0, &rect); y += ddx2GetHeight(iBmp + 7) + 50; //SNORCHL ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[17] = y; co2_Set_Text(iSurface, 10, y, "##help_water_pipe_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 16), ddx2GetHeight(iBmp + 16), iBmp + 16, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 16); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_water_pipe_h", 0, &rect); y += ddx2GetHeight(iBmp + 16) + 50; //JIDLO ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[18] = y; co2_Set_Text(iSurface, 10, y, "##help_hormonal_vitamine_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 13), ddx2GetHeight(iBmp + 13), iBmp + 13, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 13); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_hormonal_vitamine_h", 0, &rect); y += ddx2GetHeight(iBmp + 13) + 50; //ZAVAZI ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[19] = y; co2_Set_Text(iSurface, 10, y, "##help_iron_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 14), ddx2GetHeight(iBmp + 14), iBmp + 14, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 14); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_iron_h", 0, &rect); y += ddx2GetHeight(iBmp + 14) + 50; //KROMPAC ///////////////////////////////////////////////////////////////////////////////////////////////// iHelpIndex[20] = y; co2_Set_Text(iSurface, 10, y, "##help_rock_axe_main", 1); y += 50; ddx2BitBlt(iSurface, 0, y, ddx2GetWidth(iBmp + 6), ddx2GetHeight(iBmp + 6), iBmp + 6, 0, 0); rect.left = 10 + ddx2GetWidth(iBmp + 6); co2_Set_Text_Formated_Rect(iSurface, rect.left, y, "##help_rock_axe_h", 0, &rect); y += ddx2GetHeight(iBmp + 6) + 50; return 1; } void RunMenuHelp2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am) { int mix, miy; RECT rTMP = { 0, 0, 1024, 768 }; DWORD dwEplased = 0, dwStart, dwStop; CONTROL_LIST_ITEM2 citem[CLIST_ITEMC]; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; DeviceHandle dh = 0; int sh = K_CHYBA; int sh1 = K_CHYBA; int sh2 = K_CHYBA; int iBmp; int iHelpIndex[23]; int iComboSel = 0; int iComboActSel = 0; _3d_End_Draw(); ZeroMemory(iHelpIndex, 23 * sizeof(int)); _2d_Clear_RectLine(&rline); p_Level->iCursor = 133; am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); ddx2Init(200, RGB(255, 0, 255)); dh = ddx2DeviceCreate(TRUE, 32); ddx2DeviceSetActive(dh); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(0, 0, 1024, 768); ddx2DeviceSetTextRenderRec(0, 0, 1024, 768); ddx2DeviceSetScreenRecCallback(ddx2ScreenResDefaultCallback); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); ddx2CleareSurface(DDX2_BACK_BUFFER); sh = ddx2LoadBitmap("help_frame.png", pBmpDir); sh1 = ddx2LoadBitmap("set_back2-1.png", pBmpDir); sh2 = ddx2LoadBitmap("set_back1-1.png", pBmpDir); ddx2FillRect(DDX2_BACK_BUFFER, &rTMP, RGB(255, 0, 255)); ddx2SetRect(&rTMP, 1); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); LoadHelp("helpbook.txt"); iBmp = LoadHelp("helpload.txt"); iCompositDC = ddx2FindFreeSurface(); CompositDC = ddx2CreateSurface(1024, 768, iCompositDC); iFontDC = ddx2FindFreeSurface(); FontDC = ddx2CreateSurface(1024, 768, iFontDC); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM2)); fn2_Set_Font(cFontDir[2]); fn2_Load_Bitmaps(); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][11] = -1; res[bind].iAnim[lastcmd][0] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); in = 0; //CreateFontAnimations2(res, &lastcmd); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: // if(!res[i].iLayer) ddx2DrawDisplay(res[i].iParam, 0); /* else ddx2DrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR ); ddx2DrawSurface(FontDC, res[i].iParam, 3);*/ break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); if (!co2_Load_Graphic(1)) { kprintf(1, "co2_Load_Graphic ... con't load controls!"); assert(0); } else { citem[0].p_combo = co2_Create_Combo(HDC2DD, 100, 67, 500, 0); citem[0].bActive = 1; co2_Combo_Add_StringWC(citem[0].p_combo, "##help_introduction_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_beatle_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_exit_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_wall_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_up_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_empty_box_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_full_box_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_tnt_box_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_rock_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_button_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_teleport_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_teleport_button_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_lift_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_lift_weight_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_lift_button_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_water_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_trap_door_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_water_pipe_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_hormonal_vitamine_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_iron_mainc"); co2_Combo_Add_StringWC(citem[0].p_combo, "##help_rock_axe_mainc"); co2_Combo_Set_Params(citem[0].p_combo, 19); co2_Combo_Set_Sel(HDC2DD, citem[0].p_combo, 0); citem[1].p_list_v = co2_Create_List_View(HDC2DD, 100, 107, 828, 622, 0, 6800); citem[1].bActive = 1; am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); DrawHelp(iBmp, co2_Get_List_View_DC(citem[1].p_list_v), iHelpIndex); am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); co2_List_View_Redraw(HDC2DD, citem[1].p_list_v, 0); } for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation2(&res[i], &ad, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound2(&res[i + 1], &ad, 2); } } mi.t1 = 0; mi.t2 = 0; mi.dx = 0; mi.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; p_Level->iCursor = 0; ddx2GameRender(FALSE); ddx2DeviceSetRender(TRUE); spracuj_spravy(0); while (!key[K_ESC]) { mix = mi.x; miy = mi.y; mi.x = (int) ceil(mi.x * scale_factor_x()); mi.y = (int) ceil(mi.y * scale_factor_y()); dwStart = timeGetTime(); //pohnul mysi if (mi.dx || mi.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { //spusteni animace v OnAbove if (i != lastabv) { if (in) { Stop2(&res[lastabv]); if (!res[lastabv].iLayer) { ddx2DrawDisplay(res[lastabv].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[lastabv].iAnim[0], 3, TRANSCOLOR); ddx2DrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation2(&res[i], &ad); lastabv = i; AddAnimation2(&res[i], &ad, 0); in = 1; bind = ChooseBidedAnimation2(res, i + 1, &ad); if (bind != -1) { CheckAnimation2(&res[bind], &ad); AddAnimation2(&res[bind], &ad, 1); anbind = bind; mPlaySound2(&res[bind], &ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop2(&res[i]); if (!res[i].iLayer) { ddx2DrawDisplay(res[i].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation2(res, i + 1, &ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop2(&res[anbind]); if (!res[i].iLayer) { ddx2DrawDisplay(res[anbind].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation2(&res[bind], &ad, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound2(&res[bind], &ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } mi.dx = 0; mi.dy = 0; } co2_Handle_Controls(citem, CLIST_ITEMC, mi.x, mi.y, HDC2DD, 0, 0); iComboActSel = co2_Combo_Get_Sel_Not_Opend(citem, CLIST_ITEMC, 0); if (iComboActSel != iComboSel && iComboActSel != -1) { co2_Set_List_View_List_Pos(citem[1].p_list_v, iHelpIndex[iComboActSel], HDC2DD, 0, 0); iComboSel = iComboActSel; } //stlacil leve tlacitko if (mi.t1 && !click) { if (co2_Is_Button_Activated(citem, CLIST_ITEMC, 0)) { float pos[3] = { 0, 0, 0 }; ap_Play_Sound(0,1,0,pos,54 + (rand()%3), NULL, &ad); key[K_ESC] = 1; p_Level->bResetini = 1; } //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation2(&res[i], &ad, 0); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; anmid = 31; } } mi.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT")) { key[K_ESC] = 1; //break; } resid = -1; if (key[K_ESC]) { for(i=0;i 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation2(&res[i], &ad); AddAnimation2(&res[i], &ad, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; AnimationEvent2(NULL, 0, 0, dwStop); mi.x = mix; mi.y = miy; am_Flip(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); } __QUIT: ddx2ReleaseBitmap(iCompositDC); ddx2ReleaseBitmap(iFontDC); fn2_Release_Font(); StopAll2(); co2_Handle_Release(citem, CLIST_ITEMC); co2_Release_Graphic(); key[K_ESC] = 0; if (dh) { ddx2ReleaseBitmap(sh); ddx2ReleaseBitmap(sh1); ddx2ReleaseBitmap(sh2); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(dh); ddx2Release(); dh = 0; } FreeAnimations2(res, RES_NUM); free((void *) res); // fn2_Set_Font("font3d.pak"); // fn2_Load_Bitmaps(); // Start renderu hry ddx2GameRender(TRUE); } void GetSceneString(char *cscene) { if (iActualScene < 0 || iActualScene > 12) strcpy(cscene, "##scene_name_unknown"); else sprintf(cscene, "##scene_name_%d", iActualScene); return; } void GetLevelTime(char *ctime, LEVELINFO * p_Level) { long iTime = (int) floor(p_Level->dwPlayTime / 1000.0f); int sec = iTime % 60; int min; int hour; char cmin[12]; char csec[12]; iTime = (int) floor(iTime / 60.0f); min = iTime % 60; iTime = (int) floor(iTime / 60.0f); hour = iTime % 60; if (sec < 10) sprintf(csec, "0%d", sec); else sprintf(csec, "%d", sec); if (min < 10) sprintf(cmin, "0%d", min); else sprintf(cmin, "%d", min); if (!min && !hour) { sprintf(ctime, "00:%d", sec); /*sprintf(ctime, "%d sekund", sec); if(sec < 2) strcat(ctime, "a"); if(sec > 1 && sec < 5) strcat(ctime, "y"); */ } else if (!hour) sprintf(ctime, "%s:%s", cmin, csec); else sprintf(ctime, "%d:%s:%s", hour, cmin, csec); } int LoadCList2(char *cFile) { int c = 0, i = -1; char text[MAX_FILENAME]; FILE *file; construct_path(text, MAX_FILENAME, 2, pBmpDir, cFile); file = fopen(text, "r"); if (!file) return -1; while (!feof(file)) { memset(text, 0, 256); if (fgets(text, 256, file) && text[0]) { newline_cut(text); if (!c) i = ddx2LoadBitmap(text, pBmpDir); else ddx2LoadBitmap(text, pBmpDir); c++; } } fclose(file); return i; } void RunMenuLevelStats2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am) { int mix, miy; RECT rTMP = { 0, 0, 1024, 768 }; DWORD dwEplased = 0, dwStart, dwStop; CONTROL_LIST_ITEM2 citem[CLIST_ITEMC]; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; DeviceHandle dh = 0; int sh = K_CHYBA; int ifdx = 0; _2d_Clear_RectLine(&rline); _2d_Add_RectItem(&rline, rTMP, 0); ddx2Init(200, RGB(255, 0, 255)); dh = ddx2DeviceCreate(TRUE, 32); ddx2DeviceSetActive(dh); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(0, 0, 1024, 768); ddx2DeviceSetTextRenderRec(0, 0, 1024, 768); ddx2DeviceSetScreenRecCallback(ddx2ScreenResDefaultCallback); ddx2DeviceSetRender(TRUE); ddx2CleareSurface(DDX2_BACK_BUFFER); switch (iActualScene) { case 1: case 2: case 3: case 4: case 7: sh = ddx2LoadBitmap("end_screen3.png", pBmpDir); ifdx = 2; break; case 5: case 8: sh = ddx2LoadBitmap("end_screen1.png", pBmpDir); ifdx = 0; break; case 0: case 6: case 9: case 10: case 11: sh = ddx2LoadBitmap("end_screen2.png", pBmpDir); ifdx = 1; break; case 12: sh = ddx2LoadBitmap("end_screen4.png", pBmpDir); ifdx = 3; break; default: sh = ddx2LoadBitmap("end_screen4.png", pBmpDir); ifdx = 3; break; } if (sh == -1) { kprintf(1, "RunMenuLevelStats2 ... sh == -1 !!!"); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(dh); ddx2Release(); ddx2GameRender(TRUE); return; } ddx2SetRect(&rTMP, 1); ddx2GameRender(FALSE); res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); iCompositDC = ddx2FindFreeSurface(); CompositDC = ddx2CreateSurface(1024, 768, iCompositDC); iFontDC = ddx2FindFreeSurface(); FontDC = ddx2CreateSurface(1024, 768, iFontDC); LoadCList2("load_bs.txt"); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM2)); fn2_Set_Font(cFontDir[3]); fn2_Load_Bitmaps(); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][11] = -1; res[bind].iAnim[lastcmd][0] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); in = 0; //CreateFontAnimations2(res, &lastcmd, 0, 0); // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: //if(!res[i].iLayer) ddx2DrawDisplay(res[i].iParam, 0); break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } co2_Set_Text(HDC2DD, 50, 50, "##stats_scene", ifdx); co2_Set_Text(HDC2DD, 50, 80, "##stats_time", ifdx); co2_Set_Text(HDC2DD, 50, 110, "##stats_steps", ifdx); GetSceneString(dir); co2_Set_Text(HDC2DD, 250, 50, dir, ifdx); GetLevelTime(dir, p_Level); co2_Set_TextWC(HDC2DD, 250, 80, dir, ifdx); co2_Set_TextWC(HDC2DD, 250, 110, itoa(p_Level->iNumOfSteps, dir, 10), ifdx); for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation2(&res[i], &ad, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound2(&res[i + 1], &ad, 2); } } mi.t1 = 0; mi.t2 = 0; mi.dx = 0; mi.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC] && !key[K_ENTER]) { mix = mi.x; miy = mi.y; mi.x = (int) ceil(mi.x * scale_factor_x()); mi.y = (int) ceil(mi.y * scale_factor_y()); dwStart = timeGetTime(); //pohnul mysi if (mi.dx || mi.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { //kprintf(1, "i = %d, lastabv = %d", i, lastabv); //spusteni animace v OnAbove if (i != lastabv) { //kprintf(1, "in = %d, %d, %d, %d = mi = %d, %d", res[i].iParam[1], res[i].iParam[2], res[i].iParam[3], res[i].iParam[4], mi.x, mi.y); if (in) { Stop2(&res[lastabv]); if (!res[lastabv].iLayer) { ddx2DrawDisplay(res[lastabv].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[lastabv].iAnim[0], 3, TRANSCOLOR); ddx2DrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation2(&res[i], &ad); lastabv = i; AddAnimation2(&res[i], &ad, 0); in = 1; bind = ChooseBidedAnimation2(res, i + 1, &ad); if (bind != -1) { CheckAnimation2(&res[bind], &ad); AddAnimation2(&res[bind], &ad, 1); anbind = bind; mPlaySound2(&res[bind], &ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { //kprintf(1, "out mi = %d, %d", mi.x, mi.y); // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop2(&res[i]); if (!res[i].iLayer) { ddx2DrawDisplay(res[i].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation2(res, i + 1, &ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop2(&res[anbind]); if (!res[i].iLayer) { ddx2DrawDisplay(res[anbind].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[anbind].iAnim[0], 0,TRANSCOLOR); ddx2DrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation2(&res[bind], &ad, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound2(&res[bind], &ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } mi.dx = 0; mi.dy = 0; } //stlacil leve tlacitko if (mi.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_ONCLICK) { if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation2(&res[i], &ad, 0); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; anmid = 31; } } } } mi.t1 = 0; } //provedeni akce po animaci menu if (click) { if (!anm[anmid].cmd) { click = 0; if (!strcmp(res[resid].cParam[1], "EXIT")) { key[K_ESC] = 1; //break; } resid = -1; if (key[K_ESC]) { goto __QUIT; } } } //pokud prisel cas, tak provedu nahodne animace (podle jejich pravdepodobnosti) if (timercnt > 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) { if (res[i].iParam[0] == COM_RANDOMANIMATION) { if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation2(&res[i], &ad); AddAnimation2(&res[i], &ad, 0); } } } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; AnimationEvent2(NULL, 0, 0, dwStop); mi.x = mix; mi.y = miy; am_Flip(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); } __QUIT: ddx2ReleaseBitmap(iCompositDC); ddx2ReleaseBitmap(iFontDC); fn2_Release_Font(); StopAll2(); key[K_ESC] = 0; key[K_ENTER] = 0; if (dh) { ddx2ReleaseBitmap(sh); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(dh); ddx2Release(); dh = 0; } FreeAnimations2(res, RES_NUM); free((void *) res); // Start renderu hry ddx2GameRender(TRUE); } static void RunMenuTutorial2ResizeCallback(void) { ddx2DeviceSetScreenRec(ftoi(10 * scale_back_factor_x()), ftoi(200 * scale_back_factor_y()), ftoi(900 * scale_back_factor_x()), ftoi(450 * scale_back_factor_y())); } void RunMenuTutorial2(char *p_File_Name, AUDIO_DATA * p_ad, LEVELINFO * p_Level, ANIMATION_MODULE * p_am) { int mix, miy; RECT rTMP = { 0, 0, 1024, 768 }; DWORD dwEplased = 0, dwStart, dwStop; CONTROL_LIST_ITEM2 citem[CLIST_ITEMC]; int lastcmd, lastanm, i; CMD_LINE *res = NULL; int lastabv = -1; char in, click = 0; int anmid = -1, resid = -1, anbind = -1; int bind; DeviceHandle dh = 0; int ycorrection = 0; EDIT_TEXT ttext; ZeroMemory(&ttext, sizeof(EDIT_TEXT)); p_Level->iCursor = 133; am_FlipA(p_Level, p_am, 1, &rline, CLIST_ITEMC, 0, 0, 0); p_Level->iCursor = 0; txt_trida(TEXT_MENU); kom_set_default_text_config(0, 0, 1, 0, 0, 1); txt_nahraj_texturu_z_func(p3DMDir, "tutor_frame.png", &ttext, 0, 1, NULL, bmp_nahraj); kom_ret_default_text_config(); _2d_Clear_RectLine(&rline); ddx2Init(200, RGB(255, 0, 255)); dh = ddx2DeviceCreate(FALSE, 32); if (!dh) return; ddx2DeviceSetActive(dh); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(10, 200, 900, 450); ddx2DeviceSetTextRenderRec(0, 0, 900, 450); ddx2DeviceSetScreenRecCallback(RunMenuTutorial2ResizeCallback); ddx2DeviceSetRender(TRUE); ddx2CleareSurface(DDX2_BACK_BUFFER); ddx2SetRect(&rTMP, 1); // Stop renderu hry ddx2GameRender(TRUE); res = (CMD_LINE *) mmalloc(RES_NUM * sizeof(CMD_LINE)); iCompositDC = ddx2FindFreeSurface(); CompositDC = ddx2CreateSurface(1024, 768, iCompositDC); iFontDC = ddx2FindFreeSurface(); FontDC = ddx2CreateSurface(1024, 768, iFontDC); ZeroMemory(citem, CLIST_ITEMC * sizeof(CONTROL_LIST_ITEM2)); fn2_Set_Font(cFontDir[2]); fn2_Load_Bitmaps(); for (bind = 0; bind < RES_NUM; bind++) { for (lastcmd = 0; lastcmd < 200; lastcmd++) { res[bind].iAnim[lastcmd][11] = -1; res[bind].iAnim[lastcmd][0] = -1; } for (in = 0; in < 6; in++) res[bind].iParam[(int)in] = -1; res[bind].iLayer = 0; } lastcmd = 0; timercnt = 0; if (chdir(DATA_DIR)) { free((void *) res); return; } char dir[MAX_FILENAME]; strcpy(dir, DATA_DIR); //natadhe skript menu LoadMenuScript(p_File_Name, res, &lastcmd); //lastcmd--; in = 0; { int ycor = 0; char tt[256]; RECT rr = { 20, 210, 890, 758 }; sprintf(tt, "##tutorial_%d", iActualLevel - 200); ycor = co2_Set_Text_Formated_Rect(HDC2DD, 20, 210, tt, 0, &rr); //ycor = (200 + ycor + 50) - 600; ycor = (ycor + 50) - 600; _2d_Clear_RectLine(&rline); rr.left = 10; rr.top = 200; rr.right = 910; rr.bottom = 460; ddx2AddRectItem(&rline, rr, 0); ycorrection = CreateFontAnimations2(res, &lastcmd, ycor, 1); //ycor = ftoi((ycor - 25) * s_factor[1]); //ycor = ycor - 50; //ycorrection = 650 + ycor; } // privede prikazy, ketere se maji provest na zacatku a, kresleni, flip, // animace na OnAbove for (i = 0; i < lastcmd; i++) { lastanm = 0; switch (res[i].iParam[0]) { case COM_DRAW: if (!res[i].iLayer) ddx2DrawDisplay(res[i].iParam, 0); else ddx2DrawDisplayColorKey(res[i].iParam, 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iParam, 3); break; case COM_RANDOMANIMATION: case COM_ONCLICK: case COM_ONABOVE: case COM_RUNANIMATION: case COM_BINDEXITANIMATION: case COM_BINDANIMATION: //nahrati animace k udalosti OnAbove LoadAnimationMenuScript(res, i, &lastanm); break; } } for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RUNANIMATION) { int iWave = AddAnimation2(&res[i], &ad, 0); if (iWave != -1) { if (res[i + 1].iParam[0] == COM_BINDSOUND) anm[iWave].iWave = res[i + 1].iParam[5] = mPlaySound2(&res[i + 1], &ad, 2); } } mi.t1 = 0; mi.t2 = 0; mi.dx = 0; mi.dy = 0; anmid = -1; resid = -1; anbind = -1; bind = -1; lastabv = -1; in = 0; spracuj_spravy(0); while (!key[K_ESC] && !key[K_ENTER]) { mix = mi.x; miy = mi.y; mi.x = (int) ceil(mi.x * scale_factor_x()); mi.y = (int) ceil(mi.y * scale_factor_y()); dwStart = timeGetTime(); //pohnul mysi if (mi.dx || mi.dy) { //dostala se mys do akcni oblasti (OnAbove)? if (!click) for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONABOVE) { if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { //kprintf(1, "i = %d, lastabv = %d", i, lastabv); //spusteni animace v OnAbove if (i != lastabv) { //kprintf(1, "in = %d, %d, %d, %d = mi = %d, %d", res[i].iParam[1], res[i].iParam[2], res[i].iParam[3], res[i].iParam[4], mi.x, mi.y); if (in) { Stop2(&res[lastabv]); if (!res[lastabv].iLayer) { ddx2DrawDisplay(res[lastabv].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[lastabv].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[lastabv].iAnim[0], 3, TRANSCOLOR); ddx2DrawSurface(FontDC, res[lastabv].iAnim[0], 3); } } CheckAnimation2(&res[i], &ad); lastabv = i; AddAnimation2(&res[i], &ad, 0); in = 1; bind = ChooseBidedAnimation2(res, i + 1, &ad); if (bind != -1) { CheckAnimation2(&res[bind], &ad); AddAnimation2(&res[bind], &ad, 1); anbind = bind; mPlaySound2(&res[bind], &ad, 0); } strcpy(dir, res[i].cParam[1]); } } else if (lastabv == i) { //kprintf(1, "out mi = %d, %d", mi.x, mi.y); // odesel z oblasti, ktera byla aktivni -> stop animace // a odznaceni oblasti Stop2(&res[i]); if (!res[i].iLayer) { ddx2DrawDisplay(res[i].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[i].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[i].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[i].iAnim[0], 3); } bind = ChooseBidedExitAnimation2(res, i + 1, &ad); if (bind != -1) { int iAnim; if (anbind != -1) { Stop2(&res[anbind]); if (!res[i].iLayer) { ddx2DrawDisplay(res[anbind].iAnim[0], 0); ddx2DrawSurface(CompositDC, res[anbind].iAnim[0], 3); } else { ddx2DrawDisplayColorKey(res[anbind].iAnim[0], 0, TRANSCOLOR); ddx2DrawSurface(FontDC, res[anbind].iAnim[0], 3); } } iAnim = AddAnimation2(&res[bind], &ad, 1); if (iAnim != -1) anm[iAnim].iWave = mPlaySound2(&res[bind], &ad, 2); } lastabv = -1; anbind = -1; in = 0; strcpy(dir, ""); } } mi.dx = 0; mi.dy = 0; } //stlacil leve tlacitko if (mi.t1 && !click) { //dostala se mys do akcni oblasti (OnClick)? for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_ONCLICK) if ((mi.x >= res[i].iParam[1]) && (mi.x <= res[i].iParam[3]) && (mi.y >= res[i].iParam[2]) && (mi.y <= res[i].iParam[4])) { if (res[i].iAnim[0][0] >= 0) { //pokud je animace, tak ji spust anmid = AddAnimation2(&res[i], &ad, 0); if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; } else { if (res[i + 1].iParam[0] == COM_BINDSOUND) mPlaySound2(&res[i + 1], &ad, 1); resid = i; click = 1; anmid = 31; } } mi.t1 = 0; } //provedeni akce po animaci menu if (click) if (!anm[anmid].cmd) { click = 0; //StopAll(); if (!strcmp(res[resid].cParam[1], "EXIT")) { key[K_ESC] = 1; //break; } resid = -1; if (key[K_ESC]) { for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_BINDSOUND && res[i].iParam[5] != -1) { adas_Release_Source(PARTICULAR_SOUND_SOURCE, UNDEFINED_VALUE, res[i].iParam[5]); res[i].iParam[5] = -1; } goto __QUIT; } } //pokud prisel cas, tak provedu nahodne animace (podle jejich pravdepodobnosti) if (timercnt > 500) { timercnt = 0; for (i = 0; i < lastcmd; i++) if (res[i].iParam[0] == COM_RANDOMANIMATION) if (rand() % 200 <= res[i].iParam[1] && strcmp(dir, res[i].cParam[0])) { CheckAnimation2(&res[i], &ad); AddAnimation2(&res[i], &ad, 0); } } dwStop = timeGetTime(); dwEplased += dwStop - dwStart; AnimationEvent2(NULL, 0, 0, dwStop); mi.x = mix; mi.y = miy; am_Flip(p_Level, p_am, 0, &rline, CLIST_ITEMC, 1, ttext.text, ycorrection); } __QUIT: ddx2ReleaseBitmap(iCompositDC); ddx2ReleaseBitmap(iFontDC); fn2_Release_Font(); StopAll2(); key[K_ESC] = 0; key[K_ENTER] = 0; if (dh) { // ddx2ReleaseBitmap(sh); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(dh); ddx2Release(); dh = 0; } FreeAnimations2(res, RES_NUM); free((void *) res); // fn2_Set_Font("font3d.pak"); // fn2_Load_Bitmaps(); // Start renderu hry ddx2GameRender(TRUE); txt_zrus_texturu(&ttext); } void RunMenuLoadScreen2(void) { RECT r = { 0, 0, 891, 149 }; int i = rand() % 49; char text[256]; int sh, ty; sprintf(text, "##load_hint_%d", i); kprintf(1, "ddx2Init"); ddx2Init(10000, RGB(255, 0, 255)); iLoadScreenDevice = ddx2DeviceCreate(TRUE, 32); if (!iLoadScreenDevice) return; ddx2DeviceSetActive(iLoadScreenDevice); ddx2DeviceSetBackBufferSize(1024, 768); ddx2DeviceSetBackBufferRect(0, 0, 1024, 768); ddx2DeviceSetTextRenderRec(0, 0, 1024, 768); ddx2DeviceSetScreenRecCallback(ddx2ScreenResDefaultCallback); ddx2DeviceSetRender(TRUE); ddx2CleareSurface(DDX2_BACK_BUFFER); if (iActualScene < 13) { char text[256]; sprintf(text, "scene%d.png", iActualScene); iLoadScreenBitmap = ddx2LoadBitmap(text, pBmpDir); } else iLoadScreenBitmap = ddx2LoadBitmap("LoadScreen.png", pBmpDir); ddx2SetRect(&iLoadScreenRect, 1); ddx2GameRender(FALSE); ddx2BitBltDisplay(0, 0, 1024, 768, iLoadScreenBitmap, 0, 0); if (iActualScene < 13) { fn2_Set_Font(cFontDir[2]); fn2_Load_Bitmaps(); sh = ddx2CreateSurface(891, 149, ddx2FindFreeSurface()); if (sh != K_CHYBA) { ty = co2_Set_Text_Formated_Rect(sh, 0, 0, text, 0, &r); ddx2TransparentBltDisplay(83, 33 + ftoi(((6 * b2_3d_font.iYPlus) - ty) / 2.0f), 891, 149, sh, 0, 0, 891, 149, TRANSCOLOR); ddx2ReleaseBitmap(sh); } fn2_Release_Font(); } ddx2RenderujVse(p_ber); flip(); } void RunMenuLoadScreenRelease(int iCount) { if (iLoadScreenDevice) { ddx2CleareSurfaceColor(DDX2_BACK_BUFFER, 0); for (int i = 0; i < iCount; i++) { ddx2RenderujVse(p_ber); flip(); } ddx2ReleaseBitmap(iLoadScreenBitmap); ddx2DeviceDeaktivuj(); ddx2DeviceRemove(iLoadScreenDevice); ddx2Release(); iLoadScreenDevice = 0; } ddx2GameRender(TRUE); } static float ProgressStatus; static float ProgressPlus; void RunMenuLoadScreenInitBar(int iNumOfItems) { ProgressStatus = 0; ProgressPlus = 100.0f / (float) iNumOfItems; } void RunMenuLoadScreenAddProgress(float fPercent) { if (fPercent >= 0) ProgressStatus += fPercent; else ProgressStatus += ProgressPlus; if(ProgressStatus > 100.0f) ProgressStatus = 100.0f; } void RunMenuLoadScreenDrawProgress(int x, int y) { RECT r = { 0, 753, 0, 768 }; int Width; Width = (int) ftoi((1024 * ProgressStatus) / 100.0f); r.right = Width; switch (iActualScene) { case 1: case 2: case 3: case 4: case 7: ddx2FillRect(DDX2_BACK_BUFFER, &r, RGB(166, 200, 145)); break; case 5: case 8: ddx2FillRect(DDX2_BACK_BUFFER, &r, RGB(224, 211, 188)); break; case 0: case 10: case 11: ddx2FillRect(DDX2_BACK_BUFFER, &r, RGB(2, 25, 77)); break; case 6: case 9: ddx2FillRect(DDX2_BACK_BUFFER, &r, RGB(170, 193, 245)); break; case 12: ddx2FillRect(DDX2_BACK_BUFFER, &r, RGB(255, 196, 129)); break; default: ddx2FillRect(DDX2_BACK_BUFFER, &r, RGB(255, 0, 0)); break; } ddx2RenderujVse(p_ber); flip(); } berusky2-0.12/src/kofola/Camera.cpp0000644000175000017500000002446613674426075014113 00000000000000//------------------------------------------------------------------------------------------------ // 0.0.1 //------------------------------------------------------------------------------------------------ #include "camera.h" #include "3d_math.h" #include "Object.h" #include "3d_all.h" #include "Berusky3d_kofola_interface.h" #define MAXZOOMSPEED 20 #define MAXRSPEED 80 #define MAXFISPEED 60 //------------------------------------------------------------------------------------------------ // spocte procenta //------------------------------------------------------------------------------------------------ float f_Count_Percentage(float init, float real, float finish) { if ((finish - init) == 0) return 100; return ((100.0f * (real - init)) / (finish - init)); } float vf_Count_Percentage(float *init, float *real, float *finish) { float vr[3], dr, vf[3], df; Make_Vector(init, finish, vf); df = Vector_Length(vf); Make_Vector(init, real, vr); dr = Vector_Length(vr); if (df == 0) return 100; return ((100.0f * dr) / df); } //------------------------------------------------------------------------------------------------ // spocte minimum //------------------------------------------------------------------------------------------------ float Min(float *vfArray, int size) { int i; float min = vfArray[0]; for (i = 1; i < size; i++) if (vfArray[i] < min) min = vfArray[i]; return min; } //------------------------------------------------------------------------------------------------ // aniamce kamery "jumping" //------------------------------------------------------------------------------------------------ void camera_Animate_Jumping(CAMERA_ANIMATION * cam) { float v[3], r, fi, dist, fpq, perc[4], min_p; if (!cam->flag) return; fpq = kom_get_framerate() / 4.0f; kam_pol_get((BOD *) & cam->real.Position, &cam->real.r, &cam->real.fi, &cam->real.Distance); Make_Vector(cam->real.Position, cam->finish.Position, v); Multiple_Vector(v, (1.0f / fpq)); r = (cam->finish.r - cam->real.r) / fpq; fi = (cam->finish.fi - cam->real.fi) / fpq; dist = (cam->finish.Distance - cam->real.Distance) / fpq; Add_Vector(cam->real.Position, v, cam->real.Position); cam->real.r += r; cam->real.fi += fi; cam->real.Distance += dist; perc[0] = f_Count_Percentage(cam->init.Distance, cam->real.Distance, cam->finish.Distance); perc[1] = f_Count_Percentage(cam->init.r, cam->real.r, cam->finish.r); perc[2] = f_Count_Percentage(cam->init.fi, cam->real.fi, cam->finish.fi); perc[3] = vf_Count_Percentage(cam->init.Position, cam->real.Position, cam->finish.Position); min_p = Min(perc, 4); if (min_p > 60) cam->bChange = 1; if (fabs(r) < 0.1f && fabs(fi) < 0.1f && fabs(dist) < 0.1f && fabs(v[0]) < 0.1f && fabs(v[1]) < 0.1f && fabs(v[2]) < 0.1f) cam->flag = 0; kam_pol_set((BOD *) & cam->real.Position, cam->real.r, cam->real.fi, cam->real.Distance, 1); } //------------------------------------------------------------------------------------------------ // init kamery //------------------------------------------------------------------------------------------------ void camera_Init(CAMERA_ANIMATION * cam) { kam_pol_get((BOD *) & cam->init.Position, &cam->init.r, &cam->init.fi, &cam->init.Distance); } //------------------------------------------------------------------------------------------------ // animace kamery //------------------------------------------------------------------------------------------------ void camera_Animate(CAMERA_ANIMATION * cam) { float v[3], r, fi, dist, perc[4], min_p, fpq; if (!cam->flag) return; fpq = kom_get_framerate() / 4.0f; kam_pol_get((BOD *) & cam->real.Position, &cam->real.r, &cam->real.fi, &cam->real.Distance); perc[0] = f_Count_Percentage(cam->init.Distance, cam->real.Distance, cam->finish.Distance); perc[1] = f_Count_Percentage(cam->init.r, cam->real.r, cam->finish.r); perc[2] = f_Count_Percentage(cam->init.fi, cam->real.fi, cam->finish.fi); perc[3] = vf_Count_Percentage(cam->init.Position, cam->real.Position, cam->finish.Position); min_p = Min(perc, 4); if (min_p > 75) { Make_Vector(cam->real.Position, cam->finish.Position, v); Multiple_Vector(v, (1.0f / fpq)); r = (cam->finish.r - cam->real.r) / fpq; fi = (cam->finish.fi - cam->real.fi) / fpq; dist = (cam->finish.Distance - cam->real.Distance) / fpq; } else { Make_Vector(cam->init.Position, cam->finish.Position, v); Normalize_Vector(v); Multiple_Vector(v, (1.0f / fpq)); r = (cam->finish.r - cam->init.r) / fpq; if (fabs(r) > (MAXRSPEED / (fpq * 4.0f))) { if (r < 0) r = MAXRSPEED / (fpq * -4.0f); else r = MAXRSPEED / (fpq * 4.0f); } fi = (cam->finish.fi - cam->init.fi) / fpq; if (fabs(fi) > (MAXFISPEED / (fpq * 4.0f))) { if (fi < 0) fi = MAXFISPEED / (fpq * -4.0f); else fi = MAXFISPEED / (fpq * 4.0f); } dist = (cam->finish.Distance - cam->init.Distance) / (fpq * 4.0f); if (fabs(dist) > (MAXZOOMSPEED / (fpq * 4.0f))) { if (dist < 0) dist = MAXZOOMSPEED / (fpq * -4.0f); else dist = MAXZOOMSPEED / (fpq * 4.0f); } } if (min_p > 60) cam->bChange = 1; Add_Vector(cam->real.Position, v, cam->real.Position); cam->real.r += r; cam->real.fi += fi; cam->real.Distance += dist; if (fabs(r) < 0.1f && fabs(fi) < 0.1f && fabs(dist) < 0.1f && fabs(v[0]) < 0.1f && fabs(v[1]) < 0.1f && fabs(v[2]) < 0.1f) cam->flag = 0; kam_pol_set((BOD *) & cam->real.Position, cam->real.r, cam->real.fi, cam->real.Distance, 1); } //------------------------------------------------------------------------------------------------ // spusti kameru //------------------------------------------------------------------------------------------------ void camera_Go(CAMERA_ANIMATION * cam, float fpq) { cam->flag = 1; cam->bChange = 0; camera_Init(cam); } void camera_Fast_Turn(int pressed_key, char left, int *flag, float fpq) { CAMERA_ANIMATION cam; float lr; int f, i; key[pressed_key] = 0; kam_pol_get((BOD *) & cam.finish.Position, &cam.finish.r, &cam.finish.fi, &cam.finish.Distance); lr = cam.finish.r; if (left) cam.finish.r -= 90.0f; else cam.finish.r += 90.0f; f = (int) floor(cam.finish.r / 90.0f); i = (int) floor(cam.finish.r) % 90; if (abs(i) < 45) { if (left) f--; else f++; } cam.finish.r = f * 90.0f; while (fabs(cam.finish.r - lr) > 135) { if (left) f++; else f--; cam.finish.r = f * 90.0f; } cam.last_move = left; kam_pol_anim((BOD *) cam.finish.Position, cam.finish.r, cam.finish.fi, cam.finish.Distance, flag, GK_REMOVE, 4, 1); //camera_Go(cam, fpq); } void camera_Zoom(int pressed_key, char out, int *flag, float fpq) { CAMERA_ANIMATION cam; key[pressed_key] = 0; kam_pol_get((BOD *) & cam.finish.Position, &cam.finish.r, &cam.finish.fi, &cam.finish.Distance); if (!out) cam.finish.Distance -= 10.0f; else cam.finish.Distance += 10.0f; // camera_Go(cam, fpq); kam_pol_anim((BOD *) cam.finish.Position, cam.finish.r, cam.finish.fi, cam.finish.Distance, flag, GK_REMOVE, 4, 1); } void camera_Turn(int pressed_key, int left, int down, CAMERA_ANIMATION * cam, float fpq) { key[pressed_key] = 0; kam_pol_get((BOD *) & cam->finish.Position, &cam->finish.r, &cam->finish.fi, &cam->finish.Distance); if (!left) cam->finish.r += 40.0f; else if (left == 1) cam->finish.r -= 40.0f; if (!down) cam->finish.fi += 20.0f; else if (down == 1) cam->finish.fi -= 20.0f; camera_Go(cam, fpq); } void camera_Move(int pressed_key, int left, int back, CAMERA_ANIMATION * cam, float fpq) { float v[3], vR[3]; key[pressed_key] = 0; kam_pol_get((BOD *) & cam->finish.Position, &cam->finish.r, &cam->finish.fi, &cam->finish.Distance); kam_3ds_get((BOD *) & cam->finish.Position, (BOD *) & cam->finish.Target, &cam->finish.Roll); cam->finish.Position[1] = cam->finish.Target[1]; Make_Vector(cam->finish.Target, cam->finish.Position, v); Normalize_Vector(v); if (!left) { Normal_Vector(v, vR); Multiple_Vector(vR, 4); Add_Vector(cam->finish.Target, vR, cam->finish.Position); } else if (left == 1) { Normal_Vector(v, vR); Multiple_Vector(vR, 4); Inverse_Vector(vR, vR, 3); Add_Vector(cam->finish.Target, vR, cam->finish.Position); } if (!back) { Multiple_Vector(v, 4); Inverse_Vector(v, v, 3); Add_Vector(cam->finish.Target, v, cam->finish.Position); } else if (back == 1) { Multiple_Vector(v, 4); Add_Vector(cam->finish.Target, v, cam->finish.Position); } camera_Go(cam, fpq); } void camera_Center(int *pcameraflag, void *v_Level, int framenum, char bTopView, char bLastCam) { LEVELINFO *p_Level = (LEVELINFO *) v_Level; float pos[3] = {0,0,0}; int r; BOD p; float fr, ffi, dist; if (bLastCam) { kam_pol_anim((BOD *) p_Level->lCamera.Position, p_Level->lCamera.r, p_Level->lCamera.fi, p_Level->lCamera.Distance, pcameraflag, GK_REMOVE, framenum, 1); *pcameraflag = 0; return; } kam_pol_get(&p, &fr, &ffi, &dist); if(p_Level->Actual_Item != -1) { kom_mesh_get_float(p_Level->Level[p_Level->Actual_Item]->Index_Of_Game_Mesh, &pos[0], &pos[1], &pos[2], &r); } if (p_Level->Actual_Item != -1) { /* switch(p_Level->Level[p_Level->Actual_Item]->Rotation) { case 0: if(!bTopView) kam_pol_anim((BOD *)pos, 0, 45, 15, pcameraflag,GK_REMOVE,framenum,1); else kam_pol_anim((BOD *)pos, 0, 89, 15, pcameraflag,GK_REMOVE,framenum,1); break; case 1: if(!bTopView) kam_pol_anim((BOD *)pos, 270, 45, 15, pcameraflag,GK_REMOVE,framenum,1); else kam_pol_anim((BOD *)pos, 270, 89, 15, pcameraflag,GK_REMOVE,framenum,1); break; case 2: if(!bTopView) kam_pol_anim((BOD *)pos, 180, 45, 15, pcameraflag,GK_REMOVE,framenum,1); else kam_pol_anim((BOD *)pos, 270, 89, 15, pcameraflag,GK_REMOVE,framenum,1); break; case 3: if(!bTopView) kam_pol_anim((BOD *)pos, 90, 45, 15, pcameraflag,GK_REMOVE,framenum,1); else kam_pol_anim((BOD *)pos, 270, 89, 15, pcameraflag,GK_REMOVE,framenum,1); break; }*/ kam_pol_anim((BOD *) pos, fr, ffi, 25, pcameraflag, GK_REMOVE, framenum, 1); *pcameraflag = 0; } } berusky2-0.12/src/kofola/Tools.h0000644000175000017500000000036513674426075013460 00000000000000#ifndef _TOOLS__ #define _TOOLS__ void tools_Parse_Command_Line(char *pCommnad, char *pLevel, char *pDemo, char *demo); void MyMessageBox(HWND hWnd, char *ctagtitle, char *ctagtext, char *addtext); char * Key2String(int k, char *text); #endif berusky2-0.12/configure.ac0000644000175000017500000001254313676430157012432 00000000000000dnl Process this file with autoconf to produce a configure script. dnl Created by Anjuta - will be overwritten dnl If you don't want it to overwrite it, dnl Please disable it in the Anjuta project configuration AC_INIT(configure.ac) AM_INIT_AUTOMAKE(berusky2, 0.12) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC AC_HEADER_STDC AC_PROG_CPP AC_PROG_CXX GETTEXT_PACKAGE=berusky2 AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext]) dnl Languages which your application supports ALL_LINGUAS="" AM_GLIB_GNU_GETTEXT AM_PROG_LIBTOOL PKG_CHECK_MODULES(SDL, [sdl SDL_image]) AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) PKG_CHECK_MODULES(OPENGL, [gl glu]) AC_SUBST(OPENGL_CFLAGS) AC_SUBST(OPENGL_LIBS) PKG_CHECK_MODULES(X11, [x11]) AC_SUBST(X11_CFLAGS) AC_SUBST(X11_LIBS) PKG_CHECK_MODULES(ZLIB, [zlib]) AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) PKG_CHECK_MODULES(SOUND, [openal freealut vorbisfile]) AC_SUBST(SOUND_CFLAGS) AC_SUBST(SOUND_LIBS) CFLAGS="$CFLAGS $SDL_CFLAGS $OPENGL_CFLAGS $X11_CFLAGS $SOUND_CFLAGS $ZLIB_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS $OPENGL_CFLAGS $X11_CFLAGS $SOUND_CFLAGS $ZLIB_CFLAGS" LDFLAGS="$LDFLAGS $SDL_LIBS $OPENGL_LIBS $X11_LIBS $SOUND_LIBS $ZLIB_LIBS" # https://github.com/stransky/berusky2/issues/23 LDFLAGS="$LDFLAGS -lpthread" AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) AC_ARG_WITH([user_directory], AS_HELP_STRING([--with-user-directory=DIR], [User directory location (default is ~/.berusky2)])) if test "x$with_user_directory" != x; then AC_DEFINE_UNQUOTED([INI_USER_DIRECTORY], [$with_user_directory], [Default user directory location.]) else AC_DEFINE_UNQUOTED([INI_USER_DIRECTORY], ["~/.berusky2"], [Default user directory location.]) fi AC_ARG_WITH([saves_directory], AS_HELP_STRING([--with-saves-directory=DIR], [Game saves dir (default is ~/.berusky2/Save)])) if test "x$with_saves_directory" != x; then AC_DEFINE_UNQUOTED([INI_SAVES_DIRECTORY], [$with_saves_directory], [Game saves dir]) else AC_DEFINE_UNQUOTED([INI_SAVES_DIRECTORY], ["~/.berusky2/Save"], [Game saves dir]) fi AC_ARG_WITH([profile_directory], AS_HELP_STRING([--with-profile-directory=DIR], [User profiles dir (default is ~/.berusky2/Save/profiles)])) if test "x$with_profile_directory" != x; then AC_DEFINE_UNQUOTED([INI_PROFILE_DIRECTORY], [$with_profile_directory], [User profile dir.]) else AC_DEFINE_UNQUOTED([INI_PROFILE_DIRECTORY], ["~/.berusky2/Save/profiles"], [User profile dir.]) fi AC_ARG_WITH([ini_file], AS_HELP_STRING([--with-ini-file=NAME], [Define ini file name (default is berusky3d.ini)])) if test "x$with_ini_file" != x; then AC_DEFINE_UNQUOTED([INI_FILE_NAME], [$with_ini_file], [Game ini file]) else AC_DEFINE_UNQUOTED([INI_FILE_NAME], ["berusky3d.ini"], [Game ini file]) fi AC_ARG_WITH([ini_file_global_dir], AS_HELP_STRING([--with-ini-file-global-dir=DIR], [Location of global ini file (default is /var/games/berusky2)])) if test "x$with_ini_file_global_dir" != x; then AC_DEFINE_UNQUOTED([INI_FILE_GLOBAL_DIR], [$with_ini_file_global_dir], [Global ini file dir.]) else AC_DEFINE_UNQUOTED([INI_FILE_GLOBAL_DIR], ["/var/games/berusky2"], [Global ini file dir.]) fi dnl Set PACKAGE_LOCALE_DIR in config.h. if test "x${prefix}" = "xNONE"; then AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale", [Package local directory]) else AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale", [Package local directory]) fi dnl Set PACKAGE SOURCE DIR in config.h. packagesrcdir=`cd $srcdir && pwd` dnl Set PACKAGE PREFIX if test "x${prefix}" = "xNONE"; then packageprefix=${ac_default_prefix} else packageprefix=${prefix} fi dnl Set PACKAGE DATA & DOC DIR packagedatadir=share packagedocdir=doc/${PACKAGE} dnl Set PACKAGE DIRS in config.h. packagepixmapsdir=${packagedatadir}/pixmaps packagehelpdir=${packagedatadir}/help packagemenudir=${packagedatadir} dnl Subst PACKAGE_DATA_DIR. NO_PREFIX_PACKAGE_DATA_DIR="${packagedatadir}" AC_SUBST(NO_PREFIX_PACKAGE_DATA_DIR) PACKAGE_DATA_DIR="${packageprefix}/${packagedatadir}" AC_SUBST(PACKAGE_DATA_DIR) dnl Subst PACKAGE_DOC_DIR. NO_PREFIX_PACKAGE_DOC_DIR="${packagedocdir}" AC_SUBST(NO_PREFIX_PACKAGE_DOC_DIR) PACKAGE_DOC_DIR="${packageprefix}/${packagedocdir}" AC_SUBST(PACKAGE_DOC_DIR) dnl Subst PACKAGE_PIXMAPS_DIR. NO_PREFIX_PACKAGE_PIXMAPS_DIR="${packagepixmapsdir}" AC_SUBST(NO_PREFIX_PACKAGE_PIXMAPS_DIR) PACKAGE_PIXMAPS_DIR="${packageprefix}/${packagepixmapsdir}" AC_SUBST(PACKAGE_PIXMAPS_DIR) dnl Subst PACKAGE_HELP_DIR. NO_PREFIX_PACKAGE_HELP_DIR="${packagehelpdir}" AC_SUBST(NO_PREFIX_PACKAGE_HELP_DIR) PACKAGE_HELP_DIR="${packageprefix}/${packagehelpdir}" AC_SUBST(PACKAGE_HELP_DIR) dnl Subst PACKAGE_MENU_DIR. NO_PREFIX_PACKAGE_MENU_DIR="${packagemenudir}" AC_SUBST(NO_PREFIX_PACKAGE_MENU_DIR) PACKAGE_MENU_DIR="${packageprefix}/${packagemenudir}" AC_SUBST(PACKAGE_MENU_DIR) AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${packageprefix}/${packagedatadir}") AC_DEFINE_UNQUOTED(PACKAGE_DOC_DIR, "${packageprefix}/${packagedocdir}") AC_DEFINE_UNQUOTED(PACKAGE_PIXMAPS_DIR, "${packageprefix}/${packagepixmapsdir}") AC_DEFINE_UNQUOTED(PACKAGE_HELP_DIR, "${packageprefix}/${packagehelpdir}") AC_DEFINE_UNQUOTED(PACKAGE_MENU_DIR, "${packageprefix}/${packagemenudir}") AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}") AC_OUTPUT([ Makefile po/Makefile.in src/Makefile data/Makefile ]) berusky2-0.12/compile0000755000175000017500000001632713630633105011512 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: